[PATCH 10/49] staging: hikey9xx/gpu: add debug prints for this driver

From: Mauro Carvalho Chehab
Date: Wed Aug 19 2020 - 07:47:50 EST


From: Xiubin Zhang <zhangxiubin1@xxxxxxxxxx>

Add some debug prints on adv7535 and kirin_drm_drv.

Signed-off-by: Xiubin Zhang <zhangxiubin1@xxxxxxxxxx>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
---
drivers/staging/hikey9xx/gpu/hdmi/adv7535.c | 40 ++++++++++++++++++--
drivers/staging/hikey9xx/gpu/kirin_drm_drv.c | 2 +-
2 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hikey9xx/gpu/hdmi/adv7535.c b/drivers/staging/hikey9xx/gpu/hdmi/adv7535.c
index a21a8f8b917e..04c1e7b9ca8e 100644
--- a/drivers/staging/hikey9xx/gpu/hdmi/adv7535.c
+++ b/drivers/staging/hikey9xx/gpu/hdmi/adv7535.c
@@ -28,7 +28,8 @@

#include "adv7535.h"

-#define HPD_ENABLE 1
+//#define HPD_ENABLE 1
+#define HPD_ENABLE 0
//#define TEST_COLORBAR_DISPLAY
#ifdef CONFIG_HDMI_ADV7511_AUDIO
extern int adv7511_audio_init(struct device *dev);
@@ -785,19 +786,25 @@ adv7511_detect(struct adv7511 *adv7511,
{
enum drm_connector_status status;
unsigned int val;
+ unsigned int time = 0;
#if HPD_ENABLE
bool hpd;
#endif
int ret;

ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val);
- if (ret < 0)
+ if (ret < 0) {
+ DRM_ERROR("regmap_read fail, ret = %d \n", ret);
return connector_status_disconnected;
+ }

- if (val & ADV7511_STATUS_HPD)
+ if (val & ADV7511_STATUS_HPD) {
+ DRM_INFO("connected : regmap_read val = 0x%x \n", val);
status = connector_status_connected;
- else
+ } else {
+ DRM_INFO("disconnected : regmap_read val = 0x%x \n", val);
status = connector_status_disconnected;
+ }

#if HPD_ENABLE
hpd = adv7511_hpd(adv7511);
@@ -820,7 +827,32 @@ adv7511_detect(struct adv7511 *adv7511,
}
#endif

+ if (status == connector_status_disconnected) {
+ do {
+ ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val);
+ if (ret < 0) {
+ DRM_ERROR("regmap_read fail, ret = %d \n", ret);
+ return connector_status_disconnected;
+ }
+
+ if (val & ADV7511_STATUS_HPD) {
+ DRM_INFO("connected : regmap_read val = 0x%x \n", val);
+ status = connector_status_connected;
+ } else {
+ DRM_INFO("disconnected : regmap_read val = 0x%x \n", val);
+ status = connector_status_disconnected;
+ }
+ time ++;
+ mdelay(20);
+ } while (status == connector_status_disconnected && time < 10);
+ }
+
+ if (time >= 10)
+ DRM_ERROR("Read connector status timout, time = %d \n", time);
+
adv7511->status = status;
+
+ DRM_INFO("hdmi connector status = %d \n", status);
return status;
}

diff --git a/drivers/staging/hikey9xx/gpu/kirin_drm_drv.c b/drivers/staging/hikey9xx/gpu/kirin_drm_drv.c
index 958aafa1a09c..ec1f668f2d21 100644
--- a/drivers/staging/hikey9xx/gpu/kirin_drm_drv.c
+++ b/drivers/staging/hikey9xx/gpu/kirin_drm_drv.c
@@ -144,7 +144,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)
/* init kms poll for handling hpd */
drm_kms_helper_poll_init(dev);

-#if 0
+#if 1
/* force detection after connectors init */
(void)drm_helper_hpd_irq_event(dev);
#endif
--
2.26.2