* [PATCH v2 0/3] Samsung Expressatt: Camera Flash
@ 2026-03-18 18:34 Rudraksha Gupta via B4 Relay
2026-03-18 18:34 ` [PATCH v2 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with vin supply Rudraksha Gupta via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Rudraksha Gupta via B4 Relay @ 2026-03-18 18:34 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Linus Walleij, Bjorn Andersson, Konrad Dybcio,
Liam Girdwood, Mark Brown
Cc: linux-leds, devicetree, linux-kernel, linux-arm-msm, phone-devel,
Rudraksha Gupta, David Heidelberg
This small series adds camera flash to an existing similar mainline
driver and adds it the the Samsung Expressatt's DTS
Assisted by AI (Claude).
Downstream reference:
Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/drivers/leds/Makefile#L51
Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/arch/arm/mach-msm/board-apexq-camera.c#L591
Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
Changes in v2:
- dt-bindings: Explain the hardware and not the driver
- **/*: Use vin-supply instead of unlock-gpio
- expressatt DTS: Reorder pinctrl-*
- expressatt DTS: Define rfs-ohms to a default (couldn't find
information about this)
- Link to v1: https://lore.kernel.org/r/20260306-expressatt_camera_flash-v1-0-b1996f7cdfdd@gmail.com
---
Rudraksha Gupta (3):
dt-bindings: leds: rt8515: Support single-GPIO flash ICs with vin supply
leds: flash: rt8515: Support single-GPIO flash ICs with vin supply
ARM: dts: qcom: msm8960: expressatt: Add camera flash
.../devicetree/bindings/leds/richtek,rt8515.yaml | 34 +++++++++++-
.../dts/qcom/qcom-msm8960-samsung-expressatt.dts | 43 +++++++++++++++
drivers/leds/flash/leds-rt8515.c | 64 +++++++++++++++++++---
3 files changed, 132 insertions(+), 9 deletions(-)
---
base-commit: e9ec05addd1a067fc7cb218f20ecdc1b1b0898c0
change-id: 20260306-expressatt_camera_flash-13c15a7427aa
prerequisite-message-id: <20251205-expressatt-touchkey-v1-1-1444b927c9f3@gmail.com>
prerequisite-patch-id: 8de4de7909722ccaf385c4224f25a623eaa72c28
Best regards,
--
Rudraksha Gupta <guptarud@gmail.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with vin supply
2026-03-18 18:34 [PATCH v2 0/3] Samsung Expressatt: Camera Flash Rudraksha Gupta via B4 Relay
@ 2026-03-18 18:34 ` Rudraksha Gupta via B4 Relay
2026-03-19 12:38 ` Linus Walleij
2026-03-19 17:15 ` Conor Dooley
2026-03-18 18:34 ` [PATCH v2 2/3] leds: flash: " Rudraksha Gupta via B4 Relay
2026-03-18 18:34 ` [PATCH v2 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash Rudraksha Gupta via B4 Relay
2 siblings, 2 replies; 8+ messages in thread
From: Rudraksha Gupta via B4 Relay @ 2026-03-18 18:34 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Linus Walleij, Bjorn Andersson, Konrad Dybcio,
Liam Girdwood, Mark Brown
Cc: linux-leds, devicetree, linux-kernel, linux-arm-msm, phone-devel,
Rudraksha Gupta
From: Rudraksha Gupta <guptarud@gmail.com>
Some flash ICs use the same one-wire pulse-count protocol as the RT8515
but have only a single enable line for both flash and torch modes, plus
an optional input voltage supply (e.g. a GPIO-controlled fixed
regulator) that gates power to the chip.
Make ent-gpios optional and add a vin-supply property to support these
variants. Add a oneOf constraint requiring exactly one of ent-gpios or
vin-supply. Add a binding example showing the single-GPIO configuration
with an input supply.
Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
.../devicetree/bindings/leds/richtek,rt8515.yaml | 34 +++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml
index 0356371a6b01..ab3c5139132c 100644
--- a/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml
+++ b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml
@@ -15,6 +15,10 @@ description: |
current for each mode is defined in hardware using two resistors
RFS and RTS.
+ Some flash ICs use the same one-wire pulse-count protocol but have
+ only a single enable line for both flash and torch modes. For these
+ single-channel variants, only enf-gpios is needed.
+
properties:
compatible:
const: richtek,rt8515
@@ -26,6 +30,11 @@ properties:
ent-gpios:
maxItems: 1
description: A connection to the 'ENT' (enable torch) pin.
+ Not present on single-channel flash ICs that use only one enable
+ line for both flash and torch modes.
+
+ vin-supply:
+ description: Optional input supply for the flash IC.
richtek,rfs-ohms:
minimum: 7680
@@ -81,10 +90,15 @@ properties:
required:
- compatible
- - ent-gpios
- enf-gpios
- led
+oneOf:
+ - required:
+ - ent-gpios
+ - required:
+ - vin-supply
+
additionalProperties: false
examples:
@@ -108,4 +122,22 @@ examples:
};
};
+ - |
+ /* Single-channel flash IC with input supply */
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/leds/common.h>
+
+ led-controller {
+ compatible = "richtek,rt8515";
+ enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
+ vin-supply = <&flash_reg>;
+ richtek,rfs-ohms = <16000>;
+
+ led {
+ function = LED_FUNCTION_FLASH;
+ color = <LED_COLOR_ID_WHITE>;
+ flash-max-timeout-us = <250000>;
+ };
+ };
+
...
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/3] leds: flash: rt8515: Support single-GPIO flash ICs with vin supply
2026-03-18 18:34 [PATCH v2 0/3] Samsung Expressatt: Camera Flash Rudraksha Gupta via B4 Relay
2026-03-18 18:34 ` [PATCH v2 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with vin supply Rudraksha Gupta via B4 Relay
@ 2026-03-18 18:34 ` Rudraksha Gupta via B4 Relay
2026-03-19 12:47 ` Linus Walleij
2026-03-18 18:34 ` [PATCH v2 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash Rudraksha Gupta via B4 Relay
2 siblings, 1 reply; 8+ messages in thread
From: Rudraksha Gupta via B4 Relay @ 2026-03-18 18:34 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Linus Walleij, Bjorn Andersson, Konrad Dybcio,
Liam Girdwood, Mark Brown
Cc: linux-leds, devicetree, linux-kernel, linux-arm-msm, phone-devel,
Rudraksha Gupta
From: Rudraksha Gupta <guptarud@gmail.com>
Extend the RT8515 driver to support flash ICs that use only a single
GPIO for both flash and torch modes (no separate ENT pin), with an
optional vin regulator that gates power to the flash IC.
When vin-supply is provided, the driver enables the regulator before
activating the LED and disables it when turning off.
Make ent-gpios optional and validate at probe time that exactly one of
ent-gpios or vin-supply is provided. When ent-gpios is absent, the
driver uses enf-gpios for both flash and torch brightness control.
Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
drivers/leds/flash/leds-rt8515.c | 64 +++++++++++++++++++++++++++++++++++-----
1 file changed, 56 insertions(+), 8 deletions(-)
diff --git a/drivers/leds/flash/leds-rt8515.c b/drivers/leds/flash/leds-rt8515.c
index f6b439674c03..69cfd5cba921 100644
--- a/drivers/leds/flash/leds-rt8515.c
+++ b/drivers/leds/flash/leds-rt8515.c
@@ -50,6 +50,7 @@ struct rt8515 {
struct v4l2_flash *v4l2_flash;
struct mutex lock;
struct regulator *reg;
+ bool reg_enabled;
struct gpio_desc *enable_torch;
struct gpio_desc *enable_flash;
struct timer_list powerdown_timer;
@@ -66,7 +67,12 @@ static struct rt8515 *to_rt8515(struct led_classdev_flash *fled)
static void rt8515_gpio_led_off(struct rt8515 *rt)
{
gpiod_set_value(rt->enable_flash, 0);
- gpiod_set_value(rt->enable_torch, 0);
+ if (rt->enable_torch)
+ gpiod_set_value(rt->enable_torch, 0);
+ if (rt->reg && rt->reg_enabled) {
+ regulator_disable(rt->reg);
+ rt->reg_enabled = false;
+ }
}
static void rt8515_gpio_brightness_commit(struct gpio_desc *gpiod,
@@ -92,6 +98,7 @@ static int rt8515_led_brightness_set(struct led_classdev *led,
{
struct led_classdev_flash *fled = lcdev_to_flcdev(led);
struct rt8515 *rt = to_rt8515(fled);
+ int ret = 0;
mutex_lock(&rt->lock);
@@ -99,16 +106,33 @@ static int rt8515_led_brightness_set(struct led_classdev *led,
/* Off */
rt8515_gpio_led_off(rt);
} else if (brightness < RT8515_TORCH_MAX) {
- /* Step it up to movie mode brightness using the flash pin */
- rt8515_gpio_brightness_commit(rt->enable_torch, brightness);
+ /* Enable the vin regulator if needed */
+ if (rt->reg && !rt->reg_enabled) {
+ ret = regulator_enable(rt->reg);
+ if (ret)
+ goto out;
+ rt->reg_enabled = true;
+ }
+ /* Step it up to movie mode brightness */
+ rt8515_gpio_brightness_commit(rt->enable_torch ?
+ rt->enable_torch : rt->enable_flash, brightness);
} else {
+ /* Enable the vin regulator if needed */
+ if (rt->reg && !rt->reg_enabled) {
+ ret = regulator_enable(rt->reg);
+ if (ret)
+ goto out;
+ rt->reg_enabled = true;
+ }
/* Max torch brightness requested */
- gpiod_set_value(rt->enable_torch, 1);
+ gpiod_set_value(rt->enable_torch ? rt->enable_torch :
+ rt->enable_flash, 1);
}
+out:
mutex_unlock(&rt->lock);
- return 0;
+ return ret;
}
static int rt8515_led_flash_strobe_set(struct led_classdev_flash *fled,
@@ -117,10 +141,18 @@ static int rt8515_led_flash_strobe_set(struct led_classdev_flash *fled,
struct rt8515 *rt = to_rt8515(fled);
struct led_flash_setting *timeout = &fled->timeout;
int brightness = rt->flash_max_intensity;
+ int ret = 0;
mutex_lock(&rt->lock);
if (state) {
+ /* Enable the vin regulator if needed */
+ if (rt->reg && !rt->reg_enabled) {
+ ret = regulator_enable(rt->reg);
+ if (ret)
+ goto out;
+ rt->reg_enabled = true;
+ }
/* Enable LED flash mode and set brightness */
rt8515_gpio_brightness_commit(rt->enable_flash, brightness);
/* Set timeout */
@@ -135,9 +167,10 @@ static int rt8515_led_flash_strobe_set(struct led_classdev_flash *fled,
fled->led_cdev.brightness = LED_OFF;
/* After this the torch LED will be disabled */
+out:
mutex_unlock(&rt->lock);
- return 0;
+ return ret;
}
static int rt8515_led_flash_strobe_get(struct led_classdev_flash *fled,
@@ -298,12 +331,27 @@ static int rt8515_probe(struct platform_device *pdev)
return dev_err_probe(dev, PTR_ERR(rt->enable_flash),
"cannot get ENF (enable flash) GPIO\n");
- /* ENT - Enable Torch line */
- rt->enable_torch = devm_gpiod_get(dev, "ent", GPIOD_OUT_LOW);
+ /* ENT - Enable Torch line (optional for single-GPIO flash ICs) */
+ rt->enable_torch = devm_gpiod_get_optional(dev, "ent", GPIOD_OUT_LOW);
if (IS_ERR(rt->enable_torch))
return dev_err_probe(dev, PTR_ERR(rt->enable_torch),
"cannot get ENT (enable torch) GPIO\n");
+ /* Optional VIN supply (e.g. GPIO-controlled fixed regulator) */
+ rt->reg = devm_regulator_get_optional(dev, "vin");
+ if (IS_ERR(rt->reg)) {
+ if (PTR_ERR(rt->reg) == -ENODEV)
+ rt->reg = NULL;
+ else
+ return dev_err_probe(dev, PTR_ERR(rt->reg),
+ "failed to get vin supply\n");
+ }
+
+ /* Exactly one of ENT or VIN must be provided */
+ if (!rt->enable_torch == !rt->reg)
+ return dev_err_probe(dev, -EINVAL,
+ "exactly one of ent-gpios or vin-supply is required\n");
+
child = device_get_next_child_node(dev, NULL);
if (!child) {
dev_err(dev,
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash
2026-03-18 18:34 [PATCH v2 0/3] Samsung Expressatt: Camera Flash Rudraksha Gupta via B4 Relay
2026-03-18 18:34 ` [PATCH v2 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with vin supply Rudraksha Gupta via B4 Relay
2026-03-18 18:34 ` [PATCH v2 2/3] leds: flash: " Rudraksha Gupta via B4 Relay
@ 2026-03-18 18:34 ` Rudraksha Gupta via B4 Relay
2026-03-19 10:34 ` Konrad Dybcio
2 siblings, 1 reply; 8+ messages in thread
From: Rudraksha Gupta via B4 Relay @ 2026-03-18 18:34 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Linus Walleij, Bjorn Andersson, Konrad Dybcio,
Liam Girdwood, Mark Brown
Cc: linux-leds, devicetree, linux-kernel, linux-arm-msm, phone-devel,
Rudraksha Gupta, David Heidelberg
From: Rudraksha Gupta <guptarud@gmail.com>
Add camera flash support for the Samsung Galaxy Express (expressatt).
The flash IC uses a one-wire pulse-count protocol on GPIO 3, powered
by a GPIO-controlled fixed regulator on PMIC MPP 4. The regulator is
modeled as a regulator-fixed node and supplied to the flash IC via
vin-supply.
Downstream references:
Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/drivers/leds/Makefile#L51
Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/arch/arm/mach-msm/board-apexq-camera.c#L591
Reviewed-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
.../dts/qcom/qcom-msm8960-samsung-expressatt.dts | 43 ++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
index c4b98af6955d..ad5169a60937 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
+++ b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
#include <dt-bindings/reset/qcom,gcc-msm8960.h>
#include "qcom-msm8960.dtsi"
@@ -61,6 +62,32 @@ touchkey_enable: touchkey-enable {
regulator-boot-on;
};
+ flash_gpio_reg: regulator-flash {
+ compatible = "regulator-fixed";
+ regulator-name = "flash_led_en";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ gpio = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ pinctrl-0 = <&flash_led_unlock>;
+ pinctrl-names = "default";
+ };
+
+ camera_flash: led-controller {
+ compatible = "richtek,rt8515";
+ enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
+ vin-supply = <&flash_gpio_reg>;
+ richtek,rfs-ohms = <16000>;
+ pinctrl-0 = <&cam_flash_en>;
+ pinctrl-names = "default";
+
+ led {
+ function = LED_FUNCTION_FLASH;
+ color = <LED_COLOR_ID_WHITE>;
+ flash-max-timeout-us = <250000>;
+ };
+ };
+
i2c-gpio-touchkey {
compatible = "i2c-gpio";
#address-cells = <1>;
@@ -247,6 +274,13 @@ touchkey_irq_pin: touchkey-irq-state {
drive-strength = <2>;
bias-disable;
};
+
+ cam_flash_en: cam-flash-en-state {
+ pins = "gpio3";
+ function = "gpio";
+ drive-strength = <16>;
+ bias-pull-down;
+ };
};
&pm8921 {
@@ -572,3 +606,12 @@ magnetometer@2e {
/* TODO: Figure out Mount Matrix */
};
};
+
+&pm8921_mpps {
+ flash_led_unlock: flash-led-unlock-state {
+ pins = "mpp4";
+ function = "digital";
+ output-low;
+ power-source = <PM8921_GPIO_S4>;
+ };
+};
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash
2026-03-18 18:34 ` [PATCH v2 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash Rudraksha Gupta via B4 Relay
@ 2026-03-19 10:34 ` Konrad Dybcio
0 siblings, 0 replies; 8+ messages in thread
From: Konrad Dybcio @ 2026-03-19 10:34 UTC (permalink / raw)
To: guptarud, Lee Jones, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Linus Walleij, Bjorn Andersson,
Konrad Dybcio, Liam Girdwood, Mark Brown
Cc: linux-leds, devicetree, linux-kernel, linux-arm-msm, phone-devel,
David Heidelberg
On 3/18/26 7:34 PM, Rudraksha Gupta via B4 Relay wrote:
> From: Rudraksha Gupta <guptarud@gmail.com>
>
> Add camera flash support for the Samsung Galaxy Express (expressatt).
>
> The flash IC uses a one-wire pulse-count protocol on GPIO 3, powered
> by a GPIO-controlled fixed regulator on PMIC MPP 4. The regulator is
> modeled as a regulator-fixed node and supplied to the flash IC via
> vin-supply.
>
> Downstream references:
> Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/drivers/leds/Makefile#L51
> Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/arch/arm/mach-msm/board-apexq-camera.c#L591
>
> Reviewed-by: David Heidelberg <david@ixit.cz>
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
> ---
> .../dts/qcom/qcom-msm8960-samsung-expressatt.dts | 43 ++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
> index c4b98af6955d..ad5169a60937 100644
> --- a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
> +++ b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
> @@ -1,5 +1,6 @@
> // SPDX-License-Identifier: GPL-2.0
> #include <dt-bindings/input/input.h>
> +#include <dt-bindings/leds/common.h>
> #include <dt-bindings/reset/qcom,gcc-msm8960.h>
>
> #include "qcom-msm8960.dtsi"
> @@ -61,6 +62,32 @@ touchkey_enable: touchkey-enable {
> regulator-boot-on;
> };
>
> + flash_gpio_reg: regulator-flash {
"vreg_flash:"
> + compatible = "regulator-fixed";
> + regulator-name = "flash_led_en";
"_en" makes it sound like it's an enable pin - if we don't have a better
idea, perhaps VREG_FLASH_3P3?
> + regulator-min-microvolt = <3300000>;
> + regulator-max-microvolt = <3300000>;
> + gpio = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
> + enable-active-high;
> + pinctrl-0 = <&flash_led_unlock>;
> + pinctrl-names = "default";
> + };
> +
> + camera_flash: led-controller {
Let's drop the label since it's unused
> + compatible = "richtek,rt8515";
> + enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
> + vin-supply = <&flash_gpio_reg>;
> + richtek,rfs-ohms = <16000>;
> + pinctrl-0 = <&cam_flash_en>;
> + pinctrl-names = "default";
> +
> + led {
> + function = LED_FUNCTION_FLASH;
> + color = <LED_COLOR_ID_WHITE>;
> + flash-max-timeout-us = <250000>;
> + };
> + };
> +
> i2c-gpio-touchkey {
> compatible = "i2c-gpio";
> #address-cells = <1>;
> @@ -247,6 +274,13 @@ touchkey_irq_pin: touchkey-irq-state {
This label from the context seems not to be present in -next, FWIW
> drive-strength = <2>;
> bias-disable;
> };
> +
> + cam_flash_en: cam-flash-en-state {
> + pins = "gpio3";
Please keep the pinctrl entries sorted by the GPIO index
Konrad
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with vin supply
2026-03-18 18:34 ` [PATCH v2 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with vin supply Rudraksha Gupta via B4 Relay
@ 2026-03-19 12:38 ` Linus Walleij
2026-03-19 17:15 ` Conor Dooley
1 sibling, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2026-03-19 12:38 UTC (permalink / raw)
To: guptarud
Cc: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Liam Girdwood,
Mark Brown, linux-leds, devicetree, linux-kernel, linux-arm-msm,
phone-devel
On Wed, Mar 18, 2026 at 7:34 PM Rudraksha Gupta via B4 Relay
<devnull+guptarud.gmail.com@kernel.org> wrote:
> From: Rudraksha Gupta <guptarud@gmail.com>
>
> Some flash ICs use the same one-wire pulse-count protocol as the RT8515
> but have only a single enable line for both flash and torch modes, plus
> an optional input voltage supply (e.g. a GPIO-controlled fixed
> regulator) that gates power to the chip.
>
> Make ent-gpios optional and add a vin-supply property to support these
> variants. Add a oneOf constraint requiring exactly one of ent-gpios or
> vin-supply. Add a binding example showing the single-GPIO configuration
> with an input supply.
>
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
This looks right to me!
Reviewed-by: Linus Walleij <linusw@kernel.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/3] leds: flash: rt8515: Support single-GPIO flash ICs with vin supply
2026-03-18 18:34 ` [PATCH v2 2/3] leds: flash: " Rudraksha Gupta via B4 Relay
@ 2026-03-19 12:47 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2026-03-19 12:47 UTC (permalink / raw)
To: guptarud, Mark Brown
Cc: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Bjorn Andersson, Konrad Dybcio, Liam Girdwood,
linux-leds, devicetree, linux-kernel, linux-arm-msm, phone-devel
Hi Rudraksha,
this is a clear improvement! I like the directions this
is going.
Mark Brown needs to look at how you're using regulators
here.
On Wed, Mar 18, 2026 at 7:34 PM Rudraksha Gupta via B4 Relay
<devnull+guptarud.gmail.com@kernel.org> wrote:
> From: Rudraksha Gupta <guptarud@gmail.com>
>
> Extend the RT8515 driver to support flash ICs that use only a single
> GPIO for both flash and torch modes (no separate ENT pin), with an
> optional vin regulator that gates power to the flash IC.
>
> When vin-supply is provided, the driver enables the regulator before
> activating the LED and disables it when turning off.
>
> Make ent-gpios optional and validate at probe time that exactly one of
> ent-gpios or vin-supply is provided. When ent-gpios is absent, the
> driver uses enf-gpios for both flash and torch brightness control.
>
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
(...)
> struct regulator *reg;
> + bool reg_enabled;
I think you can actually ask a regulator if it is enabled already,
regulator_is_enabled().
Also as long as you enable and disable it the same number of
times it also contains an internal reference count, so this is
often enough.
> + if (rt->reg && rt->reg_enabled) {
> + regulator_disable(rt->reg);
> + rt->reg_enabled = false;
> + }
I don't think you need to NULL-check rt-reg but not sure.
Can you use regulator_is_enabled() instead of the bool local?
> + /* Enable the vin regulator if needed */
> + if (rt->reg && !rt->reg_enabled) {
Dito
> + /* Enable the vin regulator if needed */
> + if (rt->reg && !rt->reg_enabled) {
> + ret = regulator_enable(rt->reg);
Dito
> if (state) {
> + /* Enable the vin regulator if needed */
> + if (rt->reg && !rt->reg_enabled) {
Dito.
> + /* Optional VIN supply (e.g. GPIO-controlled fixed regulator) */
> + rt->reg = devm_regulator_get_optional(dev, "vin");
> + if (IS_ERR(rt->reg)) {
> + if (PTR_ERR(rt->reg) == -ENODEV)
> + rt->reg = NULL;
I think the regulator callbacks are able to deal transparently
with "regulators" that are -ENODEV, can you just let it pass?
Anyway Mark knows what to do here.
> + /* Exactly one of ENT or VIN must be provided */
> + if (!rt->enable_torch == !rt->reg)
> + return dev_err_probe(dev, -EINVAL,
> + "exactly one of ent-gpios or vin-supply is required\n");
Please drop this check.
I think there can be systems using the torch but also define
the regulator.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with vin supply
2026-03-18 18:34 ` [PATCH v2 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with vin supply Rudraksha Gupta via B4 Relay
2026-03-19 12:38 ` Linus Walleij
@ 2026-03-19 17:15 ` Conor Dooley
1 sibling, 0 replies; 8+ messages in thread
From: Conor Dooley @ 2026-03-19 17:15 UTC (permalink / raw)
To: guptarud
Cc: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Linus Walleij, Bjorn Andersson, Konrad Dybcio,
Liam Girdwood, Mark Brown, linux-leds, devicetree, linux-kernel,
linux-arm-msm, phone-devel
[-- Attachment #1: Type: text/plain, Size: 75 bytes --]
Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-03-19 17:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 18:34 [PATCH v2 0/3] Samsung Expressatt: Camera Flash Rudraksha Gupta via B4 Relay
2026-03-18 18:34 ` [PATCH v2 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with vin supply Rudraksha Gupta via B4 Relay
2026-03-19 12:38 ` Linus Walleij
2026-03-19 17:15 ` Conor Dooley
2026-03-18 18:34 ` [PATCH v2 2/3] leds: flash: " Rudraksha Gupta via B4 Relay
2026-03-19 12:47 ` Linus Walleij
2026-03-18 18:34 ` [PATCH v2 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash Rudraksha Gupta via B4 Relay
2026-03-19 10:34 ` Konrad Dybcio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox