public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] drm/bridge: ite-it6263: Support power cycle in runtime
@ 2026-04-17 16:54 Biju
  0 siblings, 0 replies; 4+ messages in thread
From: Biju @ 2026-04-17 16:54 UTC (permalink / raw)
  To: Liu Ying, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: Biju Das, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	dri-devel, linux-kernel, Geert Uytterhoeven,
	Prabhakar Mahadev Lad, Biju Das, linux-renesas-soc

From: Biju Das <biju.das.jz@bp.renesas.com>

On the RZ/G3L SMARC EVK using PSCI, suspend to RAM powers down the ITE
IT6263 chip. The display controller driver's system PM callbacks invoke
drm_mode_config_helper_{suspend,resume}, which in turn call the bridge's
atomic_{disable,enable} callbacks can handle suspend/resume for the
bridge without dedicated PM ops.

Switch from devm_regulator_bulk_get_enable() to devm_regulator_bulk_get()
so that regulators can be explicitly enabled and disabled across power
cycles. Move reset_gpio and regulator state into the it6263 struct so they
are accessible beyond probe time.

Move it6263_supplies[] to the top of the file, before the it6263 struct
definition, as it is now referenced by ARRAY_SIZE() within the struct.

Add reset, I2C address configuration, and LVDS/HDMI initialisation to the
atomic_enable callback so that the hardware is fully reinitialised after
each power cycle. Correspondingly, remove these steps from probe, since
they are no longer needed there.

Add regulator_bulk_disable() to the atomic_disable callback to power down
the supplies on bridge disable, completing the power cycle support.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 Tested s2idle, s2ram and hotplug on Renesas RZ/G3L SMARC EVK platform.
v2->v3:
 * Updated commit header and description.
 * Moved it6263_supplies above struct it6263.
 * Replaced *supplies with supplies[] in struct it6263 and removed the
   num_supplies variable from struct it6263, as ARRAY_SIZE already
   provides this information.
 * Dropped it6263_bridge_{init,uninit}().
 * Added reset, I2C address configuration, and LVDS/HDMI initialisation to
   the atomic_enable callback so that the hardware is fully reinitialised
   after each power cycle. Correspondingly, remove these steps from probe,
   since they are no longer needed there.
 * Dropped the remove callback as it is not needed.
 * Dropped the variable powered from struct it6263.
v1->v2:
 * Dropped system PM callbacks instead using bridge's
   atomic_{disable,enable} callbacks to handle suspend/resume.
---
 drivers/gpu/drm/bridge/ite-it6263.c | 49 +++++++++++++++++------------
 1 file changed, 29 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ite-it6263.c b/drivers/gpu/drm/bridge/ite-it6263.c
index 4f3ebb7af4d4..10bf4cc89eb6 100644
--- a/drivers/gpu/drm/bridge/ite-it6263.c
+++ b/drivers/gpu/drm/bridge/ite-it6263.c
@@ -192,6 +192,11 @@
  */
 #define MAX_HDMI_TMDS_CHAR_RATE_HZ	225000000
 
+static const char * const it6263_supplies[] = {
+	"ivdd", "ovdd", "txavcc18", "txavcc33", "pvcc1", "pvcc2",
+	"avcc", "anvdd", "apvdd"
+};
+
 struct it6263 {
 	struct device *dev;
 	struct i2c_client *hdmi_i2c;
@@ -200,6 +205,8 @@ struct it6263 {
 	struct regmap *lvds_regmap;
 	struct drm_bridge bridge;
 	struct drm_bridge *next_bridge;
+	struct gpio_desc *reset_gpio;
+	struct regulator_bulk_data supplies[ARRAY_SIZE(it6263_supplies)];
 	int lvds_data_mapping;
 	bool lvds_dual_link;
 	bool lvds_link12_swap;
@@ -344,11 +351,6 @@ static const struct regmap_config it6263_lvds_regmap_config = {
 	.cache_type = REGCACHE_MAPLE,
 };
 
-static const char * const it6263_supplies[] = {
-	"ivdd", "ovdd", "txavcc18", "txavcc33", "pvcc1", "pvcc2",
-	"avcc", "anvdd", "apvdd"
-};
-
 static int it6263_parse_dt(struct it6263 *it)
 {
 	struct device *dev = it->dev;
@@ -587,6 +589,8 @@ static void it6263_bridge_atomic_disable(struct drm_bridge *bridge,
 	regmap_write(it->hdmi_regmap, HDMI_REG_PKT_GENERAL_CTRL, 0);
 	regmap_write(it->hdmi_regmap, HDMI_REG_AFE_DRV_CTRL,
 		     AFE_DRV_RST | AFE_DRV_PWD);
+
+	regulator_bulk_disable(ARRAY_SIZE(it->supplies), it->supplies);
 }
 
 static void it6263_bridge_atomic_enable(struct drm_bridge *bridge,
@@ -603,6 +607,19 @@ static void it6263_bridge_atomic_enable(struct drm_bridge *bridge,
 	bool pclk_high;
 	int i, ret;
 
+	ret = regulator_bulk_enable(ARRAY_SIZE(it->supplies), it->supplies);
+	if (ret)
+		dev_err(it->dev, "failed to enable power supplies\n");
+
+	it6263_hw_reset(it->reset_gpio);
+
+	ret = it6263_lvds_set_i2c_addr(it);
+	if (ret)
+		dev_err(it->dev, "failed to set I2C addr\n");
+
+	it6263_lvds_config(it);
+	it6263_hdmi_config(it);
+
 	connector = drm_atomic_get_new_connector_for_encoder(state,
 							     bridge->encoder);
 	crtc = drm_atomic_get_new_connector_state(state, connector)->crtc;
@@ -840,7 +857,6 @@ static const struct drm_bridge_funcs it6263_bridge_funcs = {
 static int it6263_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
-	struct gpio_desc *reset_gpio;
 	struct it6263 *it;
 	int ret;
 
@@ -858,13 +874,15 @@ static int it6263_probe(struct i2c_client *client)
 		return dev_err_probe(dev, PTR_ERR(it->hdmi_regmap),
 				     "failed to init I2C regmap for HDMI\n");
 
-	reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
-	if (IS_ERR(reset_gpio))
-		return dev_err_probe(dev, PTR_ERR(reset_gpio),
+	it->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(it->reset_gpio))
+		return dev_err_probe(dev, PTR_ERR(it->reset_gpio),
 				     "failed to get reset gpio\n");
 
-	ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(it6263_supplies),
-					     it6263_supplies);
+	for (unsigned int i = 0; i < ARRAY_SIZE(it->supplies); i++)
+		it->supplies[i].supply = it6263_supplies[i];
+
+	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(it->supplies), it->supplies);
 	if (ret)
 		return dev_err_probe(dev, ret, "failed to get power supplies\n");
 
@@ -872,12 +890,6 @@ static int it6263_probe(struct i2c_client *client)
 	if (ret)
 		return ret;
 
-	it6263_hw_reset(reset_gpio);
-
-	ret = it6263_lvds_set_i2c_addr(it);
-	if (ret)
-		return dev_err_probe(dev, ret, "failed to set I2C addr\n");
-
 	it->lvds_i2c = devm_i2c_new_dummy_device(dev, client->adapter,
 						 LVDS_INPUT_CTRL_I2C_ADDR);
 	if (IS_ERR(it->lvds_i2c))
@@ -890,9 +902,6 @@ static int it6263_probe(struct i2c_client *client)
 		return dev_err_probe(dev, PTR_ERR(it->lvds_regmap),
 				     "failed to init I2C regmap for LVDS\n");
 
-	it6263_lvds_config(it);
-	it6263_hdmi_config(it);
-
 	i2c_set_clientdata(client, it);
 
 	it->bridge.of_node = dev->of_node;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3] drm/bridge: ite-it6263: Support power cycle in runtime
@ 2026-04-21 10:53 Biju
  2026-04-22  6:04 ` Liu Ying
  0 siblings, 1 reply; 4+ messages in thread
From: Biju @ 2026-04-21 10:53 UTC (permalink / raw)
  To: Liu Ying, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: Biju Das, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	dri-devel, linux-kernel, Geert Uytterhoeven,
	Prabhakar Mahadev Lad, Biju Das, linux-renesas-soc

From: Biju Das <biju.das.jz@bp.renesas.com>

On the RZ/G3L SMARC EVK, suspend to RAM powers down the ITE IT6263 chip.
The display controller driver's system PM callbacks invoke
drm_mode_config_helper_{suspend,resume}, which in turn call the bridge's
atomic_{disable,enable} callbacks to handle suspend/resume for the bridge
without dedicated PM ops.

To support proper reinitialization after power loss, move reset_gpio into
the it6263 struct so it is accessible beyond probe time. Relocate
it6263_hw_reset(), it6263_lvds_set_i2c_addr(), it6263_lvds_config() and
it6263_hdmi_config() from probe to atomic_enable, ensuring the chip is
fully reset and reconfigured on every enable, including after a
suspend/resume cycle.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
Tested s2idle, s2ram and hotplug on Renesas RZ/G3L SMARC EVK platform.
v2->v3:
 * Updated commit header and description.
 * Dropped it6263_bridge_{init,uninit}().
 * Restored regulator_bulk_enable in probe().
 * Dropped the variable powered, supplies and num_supplies from
   struct it6263.
 * Added reset, I2C address configuration, and LVDS/HDMI initialisation to
   the atomic_enable callback so that the hardware is fully reinitialised
   after each power cycle. Correspondingly, remove these steps from probe,
   since they are no longer needed there.
 * Dropped the remove callback as it is not needed.
v1->v2:
 * Dropped system PM callbacks instead using bridge's
   atomic_{disable,enable} callbacks to handle suspend/resume.
---
 drivers/gpu/drm/bridge/ite-it6263.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ite-it6263.c b/drivers/gpu/drm/bridge/ite-it6263.c
index 4f3ebb7af4d4..efb8aacef8ff 100644
--- a/drivers/gpu/drm/bridge/ite-it6263.c
+++ b/drivers/gpu/drm/bridge/ite-it6263.c
@@ -200,6 +200,7 @@ struct it6263 {
 	struct regmap *lvds_regmap;
 	struct drm_bridge bridge;
 	struct drm_bridge *next_bridge;
+	struct gpio_desc *reset_gpio;
 	int lvds_data_mapping;
 	bool lvds_dual_link;
 	bool lvds_link12_swap;
@@ -603,6 +604,15 @@ static void it6263_bridge_atomic_enable(struct drm_bridge *bridge,
 	bool pclk_high;
 	int i, ret;
 
+	it6263_hw_reset(it->reset_gpio);
+
+	ret = it6263_lvds_set_i2c_addr(it);
+	if (ret)
+		dev_err(it->dev, "failed to set I2C addr\n");
+
+	it6263_lvds_config(it);
+	it6263_hdmi_config(it);
+
 	connector = drm_atomic_get_new_connector_for_encoder(state,
 							     bridge->encoder);
 	crtc = drm_atomic_get_new_connector_state(state, connector)->crtc;
@@ -840,7 +850,6 @@ static const struct drm_bridge_funcs it6263_bridge_funcs = {
 static int it6263_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
-	struct gpio_desc *reset_gpio;
 	struct it6263 *it;
 	int ret;
 
@@ -858,9 +867,9 @@ static int it6263_probe(struct i2c_client *client)
 		return dev_err_probe(dev, PTR_ERR(it->hdmi_regmap),
 				     "failed to init I2C regmap for HDMI\n");
 
-	reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
-	if (IS_ERR(reset_gpio))
-		return dev_err_probe(dev, PTR_ERR(reset_gpio),
+	it->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(it->reset_gpio))
+		return dev_err_probe(dev, PTR_ERR(it->reset_gpio),
 				     "failed to get reset gpio\n");
 
 	ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(it6263_supplies),
@@ -872,12 +881,6 @@ static int it6263_probe(struct i2c_client *client)
 	if (ret)
 		return ret;
 
-	it6263_hw_reset(reset_gpio);
-
-	ret = it6263_lvds_set_i2c_addr(it);
-	if (ret)
-		return dev_err_probe(dev, ret, "failed to set I2C addr\n");
-
 	it->lvds_i2c = devm_i2c_new_dummy_device(dev, client->adapter,
 						 LVDS_INPUT_CTRL_I2C_ADDR);
 	if (IS_ERR(it->lvds_i2c))
@@ -890,9 +893,6 @@ static int it6263_probe(struct i2c_client *client)
 		return dev_err_probe(dev, PTR_ERR(it->lvds_regmap),
 				     "failed to init I2C regmap for LVDS\n");
 
-	it6263_lvds_config(it);
-	it6263_hdmi_config(it);
-
 	i2c_set_clientdata(client, it);
 
 	it->bridge.of_node = dev->of_node;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] drm/bridge: ite-it6263: Support power cycle in runtime
  2026-04-21 10:53 [PATCH v3] drm/bridge: ite-it6263: Support power cycle in runtime Biju
@ 2026-04-22  6:04 ` Liu Ying
  2026-04-22  7:16   ` Biju Das
  0 siblings, 1 reply; 4+ messages in thread
From: Liu Ying @ 2026-04-22  6:04 UTC (permalink / raw)
  To: Biju
  Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Biju Das, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	dri-devel, linux-kernel, Geert Uytterhoeven,
	Prabhakar Mahadev Lad, linux-renesas-soc

Hi Biju,

On Tue, Apr 21, 2026 at 11:53:32AM +0100, Biju wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> On the RZ/G3L SMARC EVK, suspend to RAM powers down the ITE IT6263 chip.
> The display controller driver's system PM callbacks invoke
> drm_mode_config_helper_{suspend,resume}, which in turn call the bridge's
> atomic_{disable,enable} callbacks to handle suspend/resume for the bridge
> without dedicated PM ops.
> 
> To support proper reinitialization after power loss, move reset_gpio into
> the it6263 struct so it is accessible beyond probe time. Relocate
> it6263_hw_reset(), it6263_lvds_set_i2c_addr(), it6263_lvds_config() and
> it6263_hdmi_config() from probe to atomic_enable, ensuring the chip is
> fully reset and reconfigured on every enable, including after a
> suspend/resume cycle.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> Tested s2idle, s2ram and hotplug on Renesas RZ/G3L SMARC EVK platform.
> v2->v3:
>  * Updated commit header and description.
>  * Dropped it6263_bridge_{init,uninit}().
>  * Restored regulator_bulk_enable in probe().
>  * Dropped the variable powered, supplies and num_supplies from
>    struct it6263.
>  * Added reset, I2C address configuration, and LVDS/HDMI initialisation to
>    the atomic_enable callback so that the hardware is fully reinitialised
>    after each power cycle. Correspondingly, remove these steps from probe,
>    since they are no longer needed there.
>  * Dropped the remove callback as it is not needed.
> v1->v2:
>  * Dropped system PM callbacks instead using bridge's
>    atomic_{disable,enable} callbacks to handle suspend/resume.
> ---
>  drivers/gpu/drm/bridge/ite-it6263.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)

The subject no longer summaries what this patch does.
Can you change it to be something like:
drm/bridge: ite-it6263: Move chip initialization code from probe to atomic_enable
?

Otherwise, I'll provide my R-b tag.

--
Regards,
Liu Ying

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v3] drm/bridge: ite-it6263: Support power cycle in runtime
  2026-04-22  6:04 ` Liu Ying
@ 2026-04-22  7:16   ` Biju Das
  0 siblings, 0 replies; 4+ messages in thread
From: Biju Das @ 2026-04-22  7:16 UTC (permalink / raw)
  To: Liu Ying, biju.das.au
  Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	laurent.pinchart, Jonas Karlman, Jernej Skrabec,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Geert Uytterhoeven, Prabhakar Mahadev Lad,
	linux-renesas-soc@vger.kernel.org

Hi Liu Ying,

> -----Original Message-----
> From: Liu Ying <victor.liu@nxp.com>
> Sent: 22 April 2026 07:05
> Subject: Re: [PATCH v3] drm/bridge: ite-it6263: Support power cycle in runtime
> 
> Hi Biju,
> 
> On Tue, Apr 21, 2026 at 11:53:32AM +0100, Biju wrote:
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > On the RZ/G3L SMARC EVK, suspend to RAM powers down the ITE IT6263 chip.
> > The display controller driver's system PM callbacks invoke
> > drm_mode_config_helper_{suspend,resume}, which in turn call the
> > bridge's atomic_{disable,enable} callbacks to handle suspend/resume
> > for the bridge without dedicated PM ops.
> >
> > To support proper reinitialization after power loss, move reset_gpio
> > into the it6263 struct so it is accessible beyond probe time. Relocate
> > it6263_hw_reset(), it6263_lvds_set_i2c_addr(), it6263_lvds_config()
> > and
> > it6263_hdmi_config() from probe to atomic_enable, ensuring the chip is
> > fully reset and reconfigured on every enable, including after a
> > suspend/resume cycle.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > Tested s2idle, s2ram and hotplug on Renesas RZ/G3L SMARC EVK platform.
> > v2->v3:
> >  * Updated commit header and description.
> >  * Dropped it6263_bridge_{init,uninit}().
> >  * Restored regulator_bulk_enable in probe().
> >  * Dropped the variable powered, supplies and num_supplies from
> >    struct it6263.
> >  * Added reset, I2C address configuration, and LVDS/HDMI initialisation to
> >    the atomic_enable callback so that the hardware is fully reinitialised
> >    after each power cycle. Correspondingly, remove these steps from probe,
> >    since they are no longer needed there.
> >  * Dropped the remove callback as it is not needed.
> > v1->v2:
> >  * Dropped system PM callbacks instead using bridge's
> >    atomic_{disable,enable} callbacks to handle suspend/resume.
> > ---
> >  drivers/gpu/drm/bridge/ite-it6263.c | 26 +++++++++++++-------------
> >  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> The subject no longer summaries what this patch does.
> Can you change it to be something like:
> drm/bridge: ite-it6263: Move chip initialization code from probe to atomic_enable ?
> 
> Otherwise, I'll provide my R-b tag.

OK for me. Will incorporate this in v4.

I will wait for feedback from others if any, before posting v4.

Cheers,
Biju

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-22  7:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-21 10:53 [PATCH v3] drm/bridge: ite-it6263: Support power cycle in runtime Biju
2026-04-22  6:04 ` Liu Ying
2026-04-22  7:16   ` Biju Das
  -- strict thread matches above, loose matches on Subject: below --
2026-04-17 16:54 Biju

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox