From 9a802aba8446799b522c3926f866b79492d07dcc Mon Sep 17 00:00:00 2001 From: Gaurav K Singh Date: Thu, 26 Sep 2019 10:20:52 +0530 Subject: [PATCH 2/2] CHROMIUM: drm: modify drm_dp_dpcd_read to include single read Add single read functionality to drm_dp_dpcd_read, to be executed conditionally based on the value in /sys/kernel/debug/dri/dpcd_read_once Single read is required to satisfy AUX channel sequencing when updating TCON firmware in display panels. BUG=None TEST=Pick patch, build, boot - Set value in file to Y, and successfully execute TCON firmware update script - Set value in file to N, and verify script fails to update TCON firmware Change-Id: Id7e926fce91a1bd5ae769423508146c49d4207a8 Signed-off-by: Gaurav K Singh --- drivers/gpu/drm/drm_dp_helper.c | 15 ++++++++++----- include/drm/drm_drv.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 871abbc00b79..513df9b8f618 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c @@ -277,14 +277,19 @@ ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset, * up, so there is no particularly good place to do the workaround. * 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. + * + * In order to support updates of the TCON firmware in display panels + * a single read must be supported as well. Choose single or double + * based on the value stored in the drm debugfs file dpcd_read_once */ - ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV, buffer, + if (!dpcd_read_once) { + ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, DP_DPCD_REV, buffer, 1); - if (ret != 1) - goto out; + if (ret != 1) + goto out; + } - ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, buffer, - size); + ret = drm_dp_dpcd_access(aux, DP_AUX_NATIVE_READ, offset, buffer, size); out: drm_dp_dump_access(aux, DP_AUX_NATIVE_READ, offset, buffer, ret); diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 7eda22464b7f..a14e573d65be 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -613,6 +613,7 @@ struct drm_driver { extern unsigned int drm_debug; extern bool drm_master_relax; +extern bool dpcd_read_once; int drm_dev_init(struct drm_device *dev, struct drm_driver *driver, -- 1.9.1