* [RFC PATCH] drm/bridge: adv7511: use cache_only during power down
@ 2026-07-24 10:32 phucduc.bui
2026-07-24 10:39 ` Laurent Pinchart
0 siblings, 1 reply; 4+ messages in thread
From: phucduc.bui @ 2026-07-24 10:32 UTC (permalink / raw)
To: Andrzej Hajda, Neil Armstrong
Cc: Robert Foss, Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
linux-kernel, bui duc phuc
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] drm/bridge: adv7511: use cache_only during power down
2026-07-24 10:32 [RFC PATCH] drm/bridge: adv7511: use cache_only during power down phucduc.bui
@ 2026-07-24 10:39 ` Laurent Pinchart
2026-07-24 10:56 ` Bui Duc Phuc
0 siblings, 1 reply; 4+ messages in thread
From: Laurent Pinchart @ 2026-07-24 10:39 UTC (permalink / raw)
To: phucduc.bui
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Jonas Karlman,
Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] drm/bridge: adv7511: use cache_only during power down
2026-07-24 10:39 ` Laurent Pinchart
@ 2026-07-24 10:56 ` Bui Duc Phuc
2026-07-24 12:20 ` Bui Duc Phuc
0 siblings, 1 reply; 4+ messages in thread
From: Bui Duc Phuc @ 2026-07-24 10:56 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Jonas Karlman,
Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] drm/bridge: adv7511: use cache_only during power down
2026-07-24 10:56 ` Bui Duc Phuc
@ 2026-07-24 12:20 ` Bui Duc Phuc
0 siblings, 0 replies; 4+ messages in thread
From: Bui Duc Phuc @ 2026-07-24 12:20 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Jonas Karlman,
Jernej Skrabec, Luca Ceresoli, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, dri-devel,
linux-kernel
> >
> > 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-24 12:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-24 10:32 [RFC PATCH] drm/bridge: adv7511: use cache_only during power down phucduc.bui
2026-07-24 10:39 ` Laurent Pinchart
2026-07-24 10:56 ` Bui Duc Phuc
2026-07-24 12:20 ` Bui Duc Phuc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox