[PATCH v4] drm/bridge: ite-it6263: Move chip initialization code from probe to atomic_enable

Biju posted 1 patch 1 month, 1 week ago
drivers/gpu/drm/bridge/ite-it6263.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
[PATCH v4] drm/bridge: ite-it6263: Move chip initialization code from probe to atomic_enable
Posted by Biju 1 month, 1 week ago
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.
v3->v4:
 * Updated commit header.
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 2ea49245e700..4a8268d0eac2 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;
@@ -838,7 +848,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;
 
@@ -856,9 +865,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),
@@ -870,12 +879,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))
@@ -888,9 +891,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
Re: [PATCH v4] drm/bridge: ite-it6263: Move chip initialization code from probe to atomic_enable
Posted by Liu Ying 1 month, 1 week ago
On Fri, 01 May 2026 07:11:58 +0100, Biju wrote:
> 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.
> 
> [...]

Applied to misc/kernel.git (drm-misc-next), thanks!

[1/1] drm/bridge: ite-it6263: Move chip initialization code from probe to atomic_enable
      commit: 6d0cc72b3ad5a631d7ecb2c14de82ca0c2a1ceda

-- 
Regards,
Liu Ying
Re: [PATCH v4] drm/bridge: ite-it6263: Move chip initialization code from probe to atomic_enable
Posted by Liu Ying 1 month, 1 week ago
# Add your code comments below. There is no need to trim or delete
# any existing content -- just insert your comments under the relevant
# lines of code. Lines starting with "> " are quoted diff context and
# lines starting with "| " are comments from other reviewers.
# The final email will be reformatted automatically to include only
# the sections that have your comments.
#
> 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>
>
> diff --git a/drivers/gpu/drm/bridge/ite-it6263.c b/drivers/gpu/drm/bridge/ite-it6263.c
> index 2ea49245e700..4a8268d0eac2 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;
> @@ -838,7 +848,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;
>  
> @@ -856,9 +865,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),
> @@ -870,12 +879,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))
> @@ -888,9 +891,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;

Reviewed-by: Liu Ying <victor.liu@nxp.com>

-- 
Regards,
Liu Ying