drm/dp_mst: Add MST support to DP DPCD R/W functions
Instead of having drm_dp_dpcd_read/write and drm_dp_mst_dpcd_read/write as entry points into the aux code, have drm_dp_dpcd_read/write handle both. This means that DRM drivers can make MST DPCD read/writes. v2: Fix spacing v3: Dump dpcd access on MST read/writes v4: Fix calling wrong function on DPCD write v5: delete deprecated include of drmP.h Reviewed-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: David Francis <David.Francis@amd.com> Signed-off-by: Mikita Lipski <mikita.lipski@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
a3c2b0ffc0
commit
2f221a5efe
@ -163,11 +163,7 @@ static ssize_t auxdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aux_dev->aux->is_remote)
|
res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
|
||||||
res = drm_dp_mst_dpcd_read(aux_dev->aux, pos, buf,
|
|
||||||
todo);
|
|
||||||
else
|
|
||||||
res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
|
|
||||||
|
|
||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
break;
|
break;
|
||||||
@ -215,11 +211,7 @@ static ssize_t auxdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aux_dev->aux->is_remote)
|
res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
|
||||||
res = drm_dp_mst_dpcd_write(aux_dev->aux, pos, buf,
|
|
||||||
todo);
|
|
||||||
else
|
|
||||||
res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
|
|
||||||
|
|
||||||
if (res <= 0)
|
if (res <= 0)
|
||||||
break;
|
break;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <drm/drm_dp_helper.h>
|
#include <drm/drm_dp_helper.h>
|
||||||
#include <drm/drm_print.h>
|
#include <drm/drm_print.h>
|
||||||
#include <drm/drm_vblank.h>
|
#include <drm/drm_vblank.h>
|
||||||
|
#include <drm/drm_dp_mst_helper.h>
|
||||||
|
|
||||||
#include "drm_crtc_helper_internal.h"
|
#include "drm_crtc_helper_internal.h"
|
||||||
|
|
||||||
@ -266,7 +267,7 @@ unlock:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* drm_dp_dpcd_read() - read a series of bytes from the DPCD
|
* drm_dp_dpcd_read() - read a series of bytes from the DPCD
|
||||||
* @aux: DisplayPort AUX channel
|
* @aux: DisplayPort AUX channel (SST or MST)
|
||||||
* @offset: address of the (first) register to read
|
* @offset: address of the (first) register to read
|
||||||
* @buffer: buffer to store the register values
|
* @buffer: buffer to store the register values
|
||||||
* @size: number of bytes in @buffer
|
* @size: number of bytes in @buffer
|
||||||
@ -295,13 +296,18 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
|
|||||||
* We just have to do it before any DPCD access and hope that the
|
* We just have to do it before any DPCD access and hope that the
|
||||||
* monitor doesn't power down exactly after the throw away read.
|
* monitor doesn't power down exactly after the throw away read.
|
||||||
*/
|
*/
|
||||||
ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV, buffer,
|
if (!aux->is_remote) {
|
||||||
1);
|
ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV,
|
||||||
if (ret != 1)
|
buffer, 1);
|
||||||
goto out;
|
if (ret != 1)
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, buffer,
|
if (aux->is_remote)
|
||||||
size);
|
ret = drm_dp_mst_dpcd_read(aux, offset, buffer, size);
|
||||||
|
else
|
||||||
|
ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset,
|
||||||
|
buffer, size);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, buffer, ret);
|
drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, buffer, ret);
|
||||||
@ -311,7 +317,7 @@ EXPORT_SYMBOL(drm_dp_dpcd_read);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* drm_dp_dpcd_write() - write a series of bytes to the DPCD
|
* drm_dp_dpcd_write() - write a series of bytes to the DPCD
|
||||||
* @aux: DisplayPort AUX channel
|
* @aux: DisplayPort AUX channel (SST or MST)
|
||||||
* @offset: address of the (first) register to write
|
* @offset: address of the (first) register to write
|
||||||
* @buffer: buffer containing the values to write
|
* @buffer: buffer containing the values to write
|
||||||
* @size: number of bytes in @buffer
|
* @size: number of bytes in @buffer
|
||||||
@ -328,8 +334,12 @@ ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer,
|
if (aux->is_remote)
|
||||||
size);
|
ret = drm_dp_mst_dpcd_write(aux, offset, buffer, size);
|
||||||
|
else
|
||||||
|
ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_WRITE, offset,
|
||||||
|
buffer, size);
|
||||||
|
|
||||||
drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret);
|
drm_dp_dump_access(aux, DP_AUX_NATIVE_WRITE, offset, buffer, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user