mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: rpi-panel-v2: Add optional vcc-supply support
@ 2026-08-28  4:29 Shashank Maurya
  2026-08-28 12:13 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Shashank Maurya @ 2026-08-28  4:29 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: linux-kernel, venkata.valluru, Jessica Zhang, Shashank Maurya

The Raspberry Pi Panel V2 regulator driver may rely on an external
power rail being provided through the device tree. Add support for an
optional "vcc" regulator and enable it during probe before accessing
the panel controller.

This ensures the panel controller is powered before I2C communication
is attempted while maintaining backward compatibility with existing
platforms.

Signed-off-by: Shashank Maurya <shashank.maurya@oss.qualcomm.com>
---
 drivers/regulator/rpi-panel-v2-regulator.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/regulator/rpi-panel-v2-regulator.c b/drivers/regulator/rpi-panel-v2-regulator.c
index 30b78aa75ee3..4e84f05f6811 100644
--- a/drivers/regulator/rpi-panel-v2-regulator.c
+++ b/drivers/regulator/rpi-panel-v2-regulator.c
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/pwm.h>
 #include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
 
 /* I2C registers of the microcontroller. */
 #define REG_ID		0x01
@@ -66,10 +67,27 @@ static int rpi_panel_v2_i2c_probe(struct i2c_client *i2c)
 		.parent		= &i2c->dev,
 		.reg_set_base	= REG_POWERON,
 	};
+	struct regulator *vcc;
 	struct regmap *regmap;
 	struct pwm_chip *pc;
 	int ret;
 
+	vcc = devm_regulator_get_optional(&i2c->dev, "vcc");
+	if (IS_ERR(vcc)) {
+		ret = PTR_ERR(vcc);
+		if (ret == -EPROBE_DEFER)
+			return ret;
+		/* vcc-supply is optional, proceed without it */
+		vcc = NULL;
+	}
+
+	if (vcc) {
+		ret = regulator_enable(vcc);
+		if (ret)
+			return dev_err_probe(&i2c->dev, ret,
+					     "Failed to enable vcc supply\n");
+	}
+
 	pc = devm_pwmchip_alloc(&i2c->dev, 1, 0);
 	if (IS_ERR(pc))
 		return PTR_ERR(pc);

---
base-commit: bd2a0c2d8c49ffb7acfcb0c1177af355ea417caf
change-id: 20260828-rpi_reg-3f9db1057567

Best regards,
--  
Shashank Maurya <shashank.maurya@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-05  4:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-28  4:29 [PATCH] regulator: rpi-panel-v2: Add optional vcc-supply support Shashank Maurya
2026-08-28 12:13 ` Mark Brown
2026-08-31  6:14   ` Shashank Maurya
2026-09-02 15:48     ` Mark Brown
2026-09-05  4:38       ` Shashank Maurya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®