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

From: Laurent Pinchart

Date: Fri Jul 24 2026 - 06:44:27 EST


On Fri, Jul 24, 2026 at 05:32:35PM +0700, phucduc.bui@xxxxxxxxx wrote:
> From: bui duc phuc <phucduc.bui@xxxxxxxxx>
>
> 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@xxxxxxxxx>
> ---
>
> This RFC is related to the following patch series:
> https://lore.kernel.org/all/20260724100803.50169-1-phucduc.bui@xxxxxxxxx/
>
> 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