All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>, David Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>
Cc: "Ahmad Fatoum" <a.fatoum@pengutronix.de>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	dri-devel@lists.freedesktop.org,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Javier Martinez Canillas" <javierm@redhat.com>,
	linux-renesas-soc@vger.kernel.org,
	"Andy Shevchenko" <andy.shevchenko@gmail.com>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Biju Das" <biju.das.jz@bp.renesas.com>,
	"Adam Ford" <aford173@gmail.com>,
	"Bogdan Togorean" <bogdan.togorean@analog.com>
Subject: [PATCH v2 8/8] drm: adv7511: Add hpd_override_enable variable to struct adv7511_chip_info
Date: Wed, 30 Aug 2023 15:23:58 +0100	[thread overview]
Message-ID: <20230830142358.275459-9-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20230830142358.275459-1-biju.das.jz@bp.renesas.com>

As per spec, it is allowed to pulse the HPD signal to indicate that the
EDID information has changed. Some monitors do this when they wake up
from standby or are enabled. When the HPD goes low the adv7511 is
reset and the outputs are disabled which might cause the monitor to
go to standby again. To avoid this we ignore the HPD pin for the
first few seconds after enabling the output. On the other hand,
adv7535 require to enable HPD Override bit for proper HPD.

Add hpd_override_enable variable to struct adv7511_chip_info to handle
this scenario.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
 * Restored enum adv7511_type as there are users.
 * Replaced variable type from unsigned->bool.
---
 drivers/gpu/drm/bridge/adv7511/adv7511.h     | 1 +
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h
index 0d39e32b0793..39c9ece373b0 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511.h
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h
@@ -342,6 +342,7 @@ struct adv7511_chip_info {
 	unsigned int reg_cec_offset;
 	bool has_dsi;
 	bool link_config;
+	bool hpd_override_enable;
 };
 
 struct adv7511 {
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index e0ec3c098225..83ff4206b3b7 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -354,7 +354,7 @@ static void __adv7511_power_on(struct adv7511 *adv7511)
 	 * first few seconds after enabling the output. On the other hand
 	 * adv7535 require to enable HPD Override bit for proper HPD.
 	 */
-	if (adv7511->info->type == ADV7535)
+	if (adv7511->info->hpd_override_enable)
 		regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
 				   ADV7535_REG_POWER2_HPD_OVERRIDE,
 				   ADV7535_REG_POWER2_HPD_OVERRIDE);
@@ -381,7 +381,7 @@ static void adv7511_power_on(struct adv7511 *adv7511)
 static void __adv7511_power_off(struct adv7511 *adv7511)
 {
 	/* TODO: setup additional power down modes */
-	if (adv7511->info->type == ADV7535)
+	if (adv7511->info->hpd_override_enable)
 		regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
 				   ADV7535_REG_POWER2_HPD_OVERRIDE, 0);
 
@@ -682,7 +682,7 @@ adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector)
 			status = connector_status_disconnected;
 	} else {
 		/* Renable HPD sensing */
-		if (adv7511->info->type == ADV7535)
+		if (adv7511->info->hpd_override_enable)
 			regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
 					   ADV7535_REG_POWER2_HPD_OVERRIDE,
 					   ADV7535_REG_POWER2_HPD_OVERRIDE);
@@ -1379,6 +1379,7 @@ static const struct adv7511_chip_info adv7535_chip_info = {
 	.num_supplies = ARRAY_SIZE(adv7533_supply_names),
 	.reg_cec_offset = ADV7533_REG_CEC_OFFSET,
 	.has_dsi = true,
+	.hpd_override_enable = true,
 };
 
 static const struct i2c_device_id adv7511_i2c_ids[] = {
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>, David Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>
Cc: "Biju Das" <biju.das.jz@bp.renesas.com>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Jonas Karlman" <jonas@kwiboo.se>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Andy Shevchenko" <andy.shevchenko@gmail.com>,
	"Javier Martinez Canillas" <javierm@redhat.com>,
	"Ahmad Fatoum" <a.fatoum@pengutronix.de>,
	"Rob Herring" <robh@kernel.org>,
	"Bogdan Togorean" <bogdan.togorean@analog.com>,
	"Adam Ford" <aford173@gmail.com>,
	dri-devel@lists.freedesktop.org,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	linux-renesas-soc@vger.kernel.org
Subject: [PATCH v2 8/8] drm: adv7511: Add hpd_override_enable variable to struct adv7511_chip_info
Date: Wed, 30 Aug 2023 15:23:58 +0100	[thread overview]
Message-ID: <20230830142358.275459-9-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20230830142358.275459-1-biju.das.jz@bp.renesas.com>

As per spec, it is allowed to pulse the HPD signal to indicate that the
EDID information has changed. Some monitors do this when they wake up
from standby or are enabled. When the HPD goes low the adv7511 is
reset and the outputs are disabled which might cause the monitor to
go to standby again. To avoid this we ignore the HPD pin for the
first few seconds after enabling the output. On the other hand,
adv7535 require to enable HPD Override bit for proper HPD.

Add hpd_override_enable variable to struct adv7511_chip_info to handle
this scenario.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
 * Restored enum adv7511_type as there are users.
 * Replaced variable type from unsigned->bool.
---
 drivers/gpu/drm/bridge/adv7511/adv7511.h     | 1 +
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h
index 0d39e32b0793..39c9ece373b0 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511.h
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h
@@ -342,6 +342,7 @@ struct adv7511_chip_info {
 	unsigned int reg_cec_offset;
 	bool has_dsi;
 	bool link_config;
+	bool hpd_override_enable;
 };
 
 struct adv7511 {
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index e0ec3c098225..83ff4206b3b7 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -354,7 +354,7 @@ static void __adv7511_power_on(struct adv7511 *adv7511)
 	 * first few seconds after enabling the output. On the other hand
 	 * adv7535 require to enable HPD Override bit for proper HPD.
 	 */
-	if (adv7511->info->type == ADV7535)
+	if (adv7511->info->hpd_override_enable)
 		regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
 				   ADV7535_REG_POWER2_HPD_OVERRIDE,
 				   ADV7535_REG_POWER2_HPD_OVERRIDE);
@@ -381,7 +381,7 @@ static void adv7511_power_on(struct adv7511 *adv7511)
 static void __adv7511_power_off(struct adv7511 *adv7511)
 {
 	/* TODO: setup additional power down modes */
-	if (adv7511->info->type == ADV7535)
+	if (adv7511->info->hpd_override_enable)
 		regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
 				   ADV7535_REG_POWER2_HPD_OVERRIDE, 0);
 
@@ -682,7 +682,7 @@ adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector)
 			status = connector_status_disconnected;
 	} else {
 		/* Renable HPD sensing */
-		if (adv7511->info->type == ADV7535)
+		if (adv7511->info->hpd_override_enable)
 			regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
 					   ADV7535_REG_POWER2_HPD_OVERRIDE,
 					   ADV7535_REG_POWER2_HPD_OVERRIDE);
@@ -1379,6 +1379,7 @@ static const struct adv7511_chip_info adv7535_chip_info = {
 	.num_supplies = ARRAY_SIZE(adv7533_supply_names),
 	.reg_cec_offset = ADV7533_REG_CEC_OFFSET,
 	.has_dsi = true,
+	.hpd_override_enable = true,
 };
 
 static const struct i2c_device_id adv7511_i2c_ids[] = {
-- 
2.25.1


  parent reply	other threads:[~2023-08-30 14:25 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30 14:23 [PATCH v2 0/8] ADV7511 driver enhancements Biju Das
2023-08-30 14:23 ` Biju Das
2023-08-30 14:23 ` [PATCH v2 1/8] drm: adv7511: Add struct adv7511_chip_info and use i2c_get_match_data() Biju Das
2023-08-30 14:23   ` Biju Das
2023-10-16  9:07   ` Robert Foss
2023-10-16  9:07     ` Robert Foss
2023-08-30 14:23 ` [PATCH v2 2/8] drm: adv7511: Add max_mode_clock_khz variable to struct adv7511_chip_info Biju Das
2023-08-30 14:23   ` Biju Das
2023-10-16  9:06   ` Robert Foss
2023-10-16  9:06     ` Robert Foss
2023-08-30 14:23 ` [PATCH v2 3/8] drm: adv7511: Add max_lane_freq_khz " Biju Das
2023-08-30 14:23   ` Biju Das
2023-10-16  9:05   ` Robert Foss
2023-10-16  9:05     ` Robert Foss
2023-08-30 14:23 ` [PATCH v2 4/8] drm: adv7511: Add supply_names and num_supplies variables " Biju Das
2023-08-30 14:23   ` Biju Das
2023-10-16  9:03   ` Robert Foss
2023-10-16  9:03     ` Robert Foss
2023-08-30 14:23 ` [PATCH v2 5/8] drm: adv7511: Add reg_cec_offset variable " Biju Das
2023-08-30 14:23   ` Biju Das
2023-10-16  8:58   ` Robert Foss
2023-10-16  8:58     ` Robert Foss
2023-10-16  9:37     ` Biju Das
2023-10-16  9:37       ` Biju Das
2023-08-30 14:23 ` [PATCH v2 6/8] drm: adv7511: Add has_dsi " Biju Das
2023-08-30 14:23   ` Biju Das
2023-10-16  9:01   ` Robert Foss
2023-10-16  9:01     ` Robert Foss
2023-08-30 14:23 ` [PATCH v2 7/8] drm: adv7511: Add link_config " Biju Das
2023-08-30 14:23   ` Biju Das
2023-10-16  8:59   ` Robert Foss
2023-10-16  8:59     ` Robert Foss
2023-08-30 14:23 ` Biju Das [this message]
2023-08-30 14:23   ` [PATCH v2 8/8] drm: adv7511: Add hpd_override_enable " Biju Das
2023-10-16  8:59   ` Robert Foss
2023-10-16  8:59     ` Robert Foss
2023-10-02  7:14 ` [PATCH v2 0/8] ADV7511 driver enhancements Biju Das
2023-10-02  7:14   ` Biju Das
2023-10-09  7:04   ` Biju Das
2023-10-09  7:04     ` Biju Das
2023-10-16  9:12 ` Robert Foss
2023-10-16  9:12   ` Robert Foss
2023-10-16  9:28   ` Biju Das
2023-10-16  9:28     ` Biju Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230830142358.275459-9-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=aford173@gmail.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bogdan.togorean@analog.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert+renesas@glider.be \
    --cc=javierm@redhat.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=rfoss@kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.