* [PATCH v3 0/2] regulator: rpi-panel-v2: Add vcc-supply
@ 2026-09-22 15:31 Shashank Maurya
2026-09-22 15:31 ` [PATCH v3 1/2] dt-bindings: regulator: rpi-panel-v2: Add vcc-supply property Shashank Maurya
2026-09-22 15:32 ` [PATCH v3 2/2] regulator: rpi-panel-v2: Add vcc-supply support Shashank Maurya
0 siblings, 2 replies; 5+ messages in thread
From: Shashank Maurya @ 2026-09-22 15:31 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Florian Fainelli,
Broadcom internal kernel review list, Marek Vasut
Cc: linux-kernel, devicetree, linux-rpi-kernel, linux-arm-kernel,
venkata.valluru, Jessica Zhang, Shashank Maurya
This series adds a vcc-supply property to both the dt-binding and the
driver:
- Patch 1/2: dt-bindings - documents the vcc-supply property as an
optional property.
- Patch 2/2: driver - uses devm_regulator_get() to obtain and enable
the vcc supply at the start of probe, before any I2C access.
---
Changes in v3:
- dt-bindings: make vcc-supply optional instead of required, to preserve
compatibility with existing device trees that do not describe the
supply.
- Driver is unchanged from v2: devm_regulator_get() returns a dummy
regulator when the supply is absent, so an optional binding needs no
driver change.
- Link to v2: https://patch.msgid.link/20260907-rpi_reg-v2-0-0c59aa60d31f@oss.qualcomm.com
Changes in v2:
- Made vcc-supply required instead of optional (devm_regulator_get()
instead of devm_regulator_get_optional()).
- Added vcc-supply to the required list in the dt-binding schema.
Changes in v1:
- Initial submission with optional vcc-supply support.
To: Liam Girdwood <lgirdwood@gmail.com>
To: Mark Brown <broonie@kernel.org>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Florian Fainelli <florian.fainelli@broadcom.com>
To: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
To: Marek Vasut <marek.vasut+renesas@mailbox.org>
Cc: linux-kernel@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-rpi-kernel@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
---
Shashank Maurya (2):
dt-bindings: regulator: rpi-panel-v2: Add vcc-supply property
regulator: rpi-panel-v2: Add vcc-supply support
.../raspberrypi,7inch-touchscreen-panel-regulator-v2.yaml | 4 ++++
drivers/regulator/rpi-panel-v2-regulator.c | 12 ++++++++++++
2 files changed, 16 insertions(+)
---
base-commit: bd2a0c2d8c49ffb7acfcb0c1177af355ea417caf
change-id: 20260907-rpi_reg-8c6885b35e5b
Best regards,
--
Shashank Maurya <shashank.maurya@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/2] dt-bindings: regulator: rpi-panel-v2: Add vcc-supply property
2026-09-22 15:31 [PATCH v3 0/2] regulator: rpi-panel-v2: Add vcc-supply Shashank Maurya
@ 2026-09-22 15:31 ` Shashank Maurya
2026-09-28 9:35 ` Krzysztof Kozlowski
2026-09-22 15:32 ` [PATCH v3 2/2] regulator: rpi-panel-v2: Add vcc-supply support Shashank Maurya
1 sibling, 1 reply; 5+ messages in thread
From: Shashank Maurya @ 2026-09-22 15:31 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Florian Fainelli,
Broadcom internal kernel review list, Marek Vasut
Cc: linux-kernel, devicetree, linux-rpi-kernel, linux-arm-kernel,
venkata.valluru, Jessica Zhang, Shashank Maurya
Add an optional vcc-supply property to the Raspberry Pi 7" touchscreen
panel V2 regulator binding. The panel controller MCU is powered from an
external power rail, which has to be supplied before any I2C
communication can take place.
The property is optional so that existing device trees which do not
describe the supply remain valid.
Signed-off-by: Shashank Maurya <shashank.maurya@oss.qualcomm.com>
---
.../regulator/raspberrypi,7inch-touchscreen-panel-regulator-v2.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/regulator/raspberrypi,7inch-touchscreen-panel-regulator-v2.yaml b/Documentation/devicetree/bindings/regulator/raspberrypi,7inch-touchscreen-panel-regulator-v2.yaml
index 37b9ed371b67..3e2cbcad6490 100644
--- a/Documentation/devicetree/bindings/regulator/raspberrypi,7inch-touchscreen-panel-regulator-v2.yaml
+++ b/Documentation/devicetree/bindings/regulator/raspberrypi,7inch-touchscreen-panel-regulator-v2.yaml
@@ -35,6 +35,9 @@ properties:
const: 3
description: See ../../pwm/pwm.yaml for description of the cell formats.
+ vcc-supply:
+ description: Regulator supplying power to the panel controller.
+
additionalProperties: false
required:
@@ -55,6 +58,7 @@ examples:
gpio-controller;
#gpio-cells = <2>;
#pwm-cells = <3>;
+ vcc-supply = <&vcc_reg>;
};
};
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] regulator: rpi-panel-v2: Add vcc-supply support
2026-09-22 15:31 [PATCH v3 0/2] regulator: rpi-panel-v2: Add vcc-supply Shashank Maurya
2026-09-22 15:31 ` [PATCH v3 1/2] dt-bindings: regulator: rpi-panel-v2: Add vcc-supply property Shashank Maurya
@ 2026-09-22 15:32 ` Shashank Maurya
2026-09-22 15:39 ` sashiko-bot
1 sibling, 1 reply; 5+ messages in thread
From: Shashank Maurya @ 2026-09-22 15:32 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Florian Fainelli,
Broadcom internal kernel review list, Marek Vasut
Cc: linux-kernel, devicetree, linux-rpi-kernel, linux-arm-kernel,
venkata.valluru, Jessica Zhang, Shashank Maurya
The Raspberry Pi 7" touchscreen panel V2 MCU is powered from an external
power rail which has to be enabled before any I2C register access is
attempted. Use devm_regulator_get() to obtain the vcc supply and enable
it at the start of probe.
devm_regulator_get() returns a dummy regulator when the supply is not
described in the device tree, so device trees without a vcc-supply
property keep working as before.
Signed-off-by: Shashank Maurya <shashank.maurya@oss.qualcomm.com>
---
drivers/regulator/rpi-panel-v2-regulator.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/regulator/rpi-panel-v2-regulator.c b/drivers/regulator/rpi-panel-v2-regulator.c
index 30b78aa75ee3..e54d675962e7 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,21 @@ 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(&i2c->dev, "vcc");
+ if (IS_ERR(vcc))
+ return dev_err_probe(&i2c->dev, PTR_ERR(vcc),
+ "Failed to get vcc supply\n");
+
+ 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);
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 2/2] regulator: rpi-panel-v2: Add vcc-supply support
2026-09-22 15:32 ` [PATCH v3 2/2] regulator: rpi-panel-v2: Add vcc-supply support Shashank Maurya
@ 2026-09-22 15:39 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-09-22 15:39 UTC (permalink / raw)
To: Shashank Maurya; +Cc: robh, devicetree, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] regulator: leaked enable count on vcc regulator during probe failure and unbind
--
commit db1c448e80eee7e671cad78e558097db3e8ec366
Author: Shashank Maurya <shashank.maurya@oss.qualcomm.com>
regulator: rpi-panel-v2: Add vcc-supply support
The Raspberry Pi 7" touchscreen panel V2 MCU is powered from an external
power rail which has to be enabled before any I2C register access is
attempted. This commit uses devm_regulator_get() to obtain the vcc supply
and enable it at the start of probe.
> diff --git a/drivers/regulator/rpi-panel-v2-regulator.c b/drivers/regulator/rpi-panel-v2-regulator.c
> index 30b78aa75ee38..e54d675962e71 100644
> --- a/drivers/regulator/rpi-panel-v2-regulator.c
> +++ b/drivers/regulator/rpi-panel-v2-regulator.c
[ ... ]
> @@ -66,10 +67,21 @@ 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(&i2c->dev, "vcc");
> + if (IS_ERR(vcc))
> + return dev_err_probe(&i2c->dev, PTR_ERR(vcc),
> + "Failed to get vcc supply\n");
> +
> + ret = regulator_enable(vcc);
> + if (ret)
> + return dev_err_probe(&i2c->dev, ret,
> + "Failed to enable vcc supply\n");
[Severity: High]
Could this introduce a regression where a matching regulator_disable() is
missing in rpi_panel_v2_i2c_probe() for subsequent error paths and driver
remove callbacks?
> +
> pc = devm_pwmchip_alloc(&i2c->dev, 1, 0);
> if (IS_ERR(pc))
> return PTR_ERR(pc);
[Severity: High]
If this allocation fails in rpi_panel_v2_i2c_probe(), does the function
return directly and leak the vcc regulator enable count?
The vcc regulator's enable count is incremented via regulator_enable() but
is never decremented. When the driver unbinds or probe fails, devres calls
regulator_put(), which triggers a WARN_ON(regulator->enable_count) and
permanently leaks the underlying regulator device's use count. This prevents
the power rail from ever being physically disabled. On systems with
panic_on_warn, this triggers a kernel panic.
This regression is reachable locally via device unbind, or automatically
during boot if a downstream resource causes a probe deferral.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260922-rpi_reg-v3-0-9214321c4070@oss.qualcomm.com?part=2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: regulator: rpi-panel-v2: Add vcc-supply property
2026-09-22 15:31 ` [PATCH v3 1/2] dt-bindings: regulator: rpi-panel-v2: Add vcc-supply property Shashank Maurya
@ 2026-09-28 9:35 ` Krzysztof Kozlowski
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-09-28 9:35 UTC (permalink / raw)
To: Shashank Maurya
Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Florian Fainelli,
Broadcom internal kernel review list, Marek Vasut, linux-kernel,
devicetree, linux-rpi-kernel, linux-arm-kernel, venkata.valluru,
Jessica Zhang
On Tue, Sep 22, 2026 at 09:01:59PM +0530, Shashank Maurya wrote:
> Add an optional vcc-supply property to the Raspberry Pi 7" touchscreen
> panel V2 regulator binding. The panel controller MCU is powered from an
> external power rail, which has to be supplied before any I2C
> communication can take place.
>
> The property is optional so that existing device trees which do not
> describe the supply remain valid.
>
> Signed-off-by: Shashank Maurya <shashank.maurya@oss.qualcomm.com>
> ---
> .../regulator/raspberrypi,7inch-touchscreen-panel-regulator-v2.yaml | 4 ++++
> 1 file changed, 4 insertions(+)
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-28 9:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-22 15:31 [PATCH v3 0/2] regulator: rpi-panel-v2: Add vcc-supply Shashank Maurya
2026-09-22 15:31 ` [PATCH v3 1/2] dt-bindings: regulator: rpi-panel-v2: Add vcc-supply property Shashank Maurya
2026-09-28 9:35 ` Krzysztof Kozlowski
2026-09-22 15:32 ` [PATCH v3 2/2] regulator: rpi-panel-v2: Add vcc-supply support Shashank Maurya
2026-09-22 15:39 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox