[RFC PATCH] drm/bridge: adv7511: use cache_only during power down

phucduc.bui@gmail.com posted 1 patch 10 hours ago
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 +++
1 file changed, 3 insertions(+)
[RFC PATCH] drm/bridge: adv7511: use cache_only during power down
Posted by phucduc.bui@gmail.com 10 hours ago
From: bui duc phuc <phucduc.bui@gmail.com>

adv7511_power_on() and adv7511_power_off() restore the register state
using regcache_mark_dirty() and regcache_sync(), but nothing prevents
other code paths from accessing the registers over I2C while the chip
is powered down.
Wrap the power-down window with regcache_cache_only() to prevent direct
register accesses. It is unclear whether this is necessary or whether
it could affect the CEC or packet sub-regmaps, so send this as an RFC.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---

This RFC is related to the following patch series:
https://lore.kernel.org/all/20260724100803.50169-1-phucduc.bui@gmail.com/

 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
index 3e470366bce0..49da1806797b 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
@@ -323,6 +323,7 @@ static void adv7511_power_off(struct adv7511 *adv7511)
 	__adv7511_power_off(adv7511);
 	if (adv7511->info->has_dsi)
 		adv7533_dsi_power_off(adv7511);
+	regcache_cache_only(adv7511->regmap, true);
 	adv7511->powered = false;
 }
 
@@ -374,11 +375,13 @@ static void adv7511_power_on(struct adv7511 *adv7511)
 	/*
 	 * Most of the registers are reset during power down or when HPD is low.
 	 */
+	regcache_cache_only(adv7511->regmap, false);
 	ret = regcache_sync(adv7511->regmap);
 	if (ret) {
 		dev_err(&adv7511->i2c_main->dev,
 			"Failed to sync register cache: %d\n", ret);
 		__adv7511_power_off(adv7511);
+		regcache_cache_only(adv7511->regmap, true);
 		return;
 	}
 
-- 
2.43.0
Re: [RFC PATCH] drm/bridge: adv7511: use cache_only during power down
Posted by Laurent Pinchart 10 hours ago
On Fri, Jul 24, 2026 at 05:32:35PM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> adv7511_power_on() and adv7511_power_off() restore the register state
> using regcache_mark_dirty() and regcache_sync(), but nothing prevents
> other code paths from accessing the registers over I2C while the chip
> is powered down.

Please give a detailed example of a scenario where that can happen, and
make sure you can reproduce the scenario and see the issue on your
hardware.

> Wrap the power-down window with regcache_cache_only() to prevent direct
> register accesses. It is unclear whether this is necessary or whether
> it could affect the CEC or packet sub-regmaps, so send this as an RFC.
> 
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
> ---
> 
> This RFC is related to the following patch series:
> https://lore.kernel.org/all/20260724100803.50169-1-phucduc.bui@gmail.com/
> 
>  drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> index 3e470366bce0..49da1806797b 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
> @@ -323,6 +323,7 @@ static void adv7511_power_off(struct adv7511 *adv7511)
>  	__adv7511_power_off(adv7511);
>  	if (adv7511->info->has_dsi)
>  		adv7533_dsi_power_off(adv7511);
> +	regcache_cache_only(adv7511->regmap, true);
>  	adv7511->powered = false;
>  }
>  
> @@ -374,11 +375,13 @@ static void adv7511_power_on(struct adv7511 *adv7511)
>  	/*
>  	 * Most of the registers are reset during power down or when HPD is low.
>  	 */
> +	regcache_cache_only(adv7511->regmap, false);
>  	ret = regcache_sync(adv7511->regmap);
>  	if (ret) {
>  		dev_err(&adv7511->i2c_main->dev,
>  			"Failed to sync register cache: %d\n", ret);
>  		__adv7511_power_off(adv7511);
> +		regcache_cache_only(adv7511->regmap, true);
>  		return;
>  	}
>  

-- 
Regards,

Laurent Pinchart
Re: [RFC PATCH] drm/bridge: adv7511: use cache_only during power down
Posted by Bui Duc Phuc 9 hours ago
Hi Laurent,

Thanks for the feedback.
>
> Please give a detailed example of a scenario where that can happen, and
> make sure you can reproduce the scenario and see the issue on your
> hardware.

I don't have the hardware to reproduce or validate this scenario,
which is why I sent this as an RFC.
The idea was based on the recent regcache_sync()/cache_only changes
that were merged:

https://lore.kernel.org/all/20260720033238.52479-1-phucduc.bui@gmail.com/
https://lore.kernel.org/all/20260713050312.38729-1-phucduc.bui@gmail.com/


Best regards,
Phuc
Re: [RFC PATCH] drm/bridge: adv7511: use cache_only during power down
Posted by Bui Duc Phuc 8 hours ago
> >
> > Please give a detailed example of a scenario where that can happen, and
> > make sure you can reproduce the scenario and see the issue on your
> > hardware.
>

An RFC is definitely helpful for discussion, though reproducing it on
real hardware is always ideal.
Speaking of which, it reminds me of a DRM patch I sent earlier—which
also deals with register state
restoration across power cycles.
It was a real bug that had existed for over 10 years, fully tested and
verified on hardware,
yet it hasn't been merged yet.

https://lore.kernel.org/all/20260226051338.27460-1-phucduc.bui@gmail.com/

https://lore.kernel.org/all/20260707093004.987846-1-phucduc.bui@gmail.com/

Best regards,
Phuc