Skip to contentSkip to conversation

drm/bridge: adv7511: use cache_only during power down

RFC PATCH In review [email protected] 2 participants 4 messages Jul 24

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

From: bui duc phuc <[email protected]>

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.

---

This RFC is related to the following patch series:
https://lore.kernel.org/all/[email protected]/

 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +3 -0
index 3e470366bce0..49da1806797b 100644
@@ -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;
 	}
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 6 lines · On Fri, Jul 24, 2026 at 05:32:35PM +0700, [email protected] wrote:

From: bui duc phuc <[email protected]>

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.

Quoted 39 lines

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.

---

This RFC is related to the following patch series:
https://lore.kernel.org/all/[email protected]/

 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +3 -0
index 3e470366bce0..49da1806797b 100644
@@ -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;
 	}
 
Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw

Hi Laurent,

Thanks for the feedback.

Quoted 4 lines

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/[email protected]/
https://lore.kernel.org/all/[email protected]/

Best regards,
Phuc

#3 lore raw
Quoted 5 lines
Quoted 4 lines

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/[email protected]/

https://lore.kernel.org/all/[email protected]/

Best regards,
Phuc