From f963ba77849cc4bc3a19d2c47cb3c4d5d54fe9b3 Mon Sep 17 00:00:00 2001 From: Wyon Bi Date: Tue, 18 May 2021 11:49:32 +0800 Subject: [PATCH] drm/bridge: analogix_dp: Add optional LCD panel self test Many TCON devices include an embedded LCD panel self-test mode. This mode is designed to help system integrators identify the root cause of abnormal display operation, without the use of complicated debug tools. Signed-off-by: Wyon Bi Change-Id: I19770c7488d43e2486c5fde5cc0a5b345e5be0eb --- .../bindings/display/bridge/analogix_dp.txt | 2 ++ .../drm/bridge/analogix/analogix_dp_core.c | 22 ++++++------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt index ba447c3e3b4f..a548f404033c 100644 --- a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt +++ b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt @@ -29,6 +29,8 @@ Optional properties for dp-controller: -hpd-gpios: Hotplug detect GPIO. Indicates which GPIO should be used for hotplug detection + -panel-self-test: + Enable optional LCD Panel Self Test. -port@[X]: SoC specific port nodes with endpoint definitions as defined in Documentation/devicetree/bindings/media/video-interfaces.txt, please refer to the SoC specific binding document: diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index af981b587db8..b8d4a5f49924 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -959,11 +959,9 @@ static int analogix_dp_commit(struct analogix_dp_device *dp) struct video_info *video = &dp->video_info; int ret; - /* Keep the panel disabled while we configure video */ - if (dp->plat_data->panel) { - if (drm_panel_disable(dp->plat_data->panel)) - DRM_ERROR("failed to disable the panel\n"); - } + if (device_property_read_bool(dp->dev, "panel-self-test")) + return drm_dp_dpcd_writeb(&dp->aux, DP_EDP_CONFIGURATION_SET, + DP_PANEL_SELF_TEST_ENABLE); ret = analogix_dp_train_link(dp); if (ret) { @@ -989,15 +987,6 @@ static int analogix_dp_commit(struct analogix_dp_device *dp) return ret; } - /* Safe to enable the panel now */ - if (dp->plat_data->panel) { - ret = drm_panel_enable(dp->plat_data->panel); - if (ret) { - DRM_ERROR("failed to enable the panel\n"); - return ret; - } - } - /* Check whether panel supports fast training */ ret = analogix_dp_fast_link_train_detection(dp); if (ret) @@ -1301,11 +1290,14 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp) } ret = analogix_dp_commit(dp); - if (ret) { + if (ret < 0) { DRM_ERROR("dp commit error, ret = %d\n", ret); goto out_dp_init; } + if (dp->plat_data->panel) + drm_panel_enable(dp->plat_data->panel); + if (dp->plat_data->power_on_end) dp->plat_data->power_on_end(dp->plat_data);