public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Samsung Expressatt: Camera Flash
@ 2026-03-07  0:58 Rudraksha Gupta via B4 Relay
  2026-03-07  0:58 ` [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate Rudraksha Gupta via B4 Relay
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Rudraksha Gupta via B4 Relay @ 2026-03-07  0:58 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Linus Walleij, Bjorn Andersson, Konrad Dybcio
  Cc: linux-leds, devicetree, linux-kernel, linux-arm-msm,
	Rudraksha Gupta

This small series adds camera flash to an existing similar mainline
driver and adds it the the Samsung Expressatt's DTS

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>
---
Rudraksha Gupta (3):
      dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate
      leds: flash: rt8515: Support single-GPIO flash ICs with unlock gate
      ARM: dts: qcom: msm8960: expressatt: Add camera flash

 .../devicetree/bindings/leds/richtek,rt8515.yaml   | 36 +++++++++++++++++++-
 .../dts/qcom/qcom-msm8960-samsung-expressatt.dts   | 31 ++++++++++++++++++
 drivers/leds/flash/leds-rt8515.c                   | 38 ++++++++++++++++++----
 3 files changed, 98 insertions(+), 7 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] 12+ messages in thread

* [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate
  2026-03-07  0:58 [PATCH 0/3] Samsung Expressatt: Camera Flash Rudraksha Gupta via B4 Relay
@ 2026-03-07  0:58 ` Rudraksha Gupta via B4 Relay
  2026-03-07 15:46   ` Krzysztof Kozlowski
  2026-03-08 23:20   ` Linus Walleij
  2026-03-07  0:58 ` [PATCH 2/3] leds: flash: " Rudraksha Gupta via B4 Relay
  2026-03-07  0:58 ` [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash Rudraksha Gupta via B4 Relay
  2 siblings, 2 replies; 12+ messages in thread
From: Rudraksha Gupta via B4 Relay @ 2026-03-07  0:58 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Linus Walleij, Bjorn Andersson, Konrad Dybcio
  Cc: linux-leds, devicetree, linux-kernel, linux-arm-msm,
	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 GPIO line for both flash and torch modes, plus an
optional unlock gate (e.g. a PMIC MPP) that must be driven high before
the chip responds to the enable GPIO.

Make ent-gpios optional and add an unlock-gpios property to support
these variants. Add a oneOf constraint requiring exactly one of
ent-gpios or unlock-gpios. Add a binding example showing the
single-GPIO configuration.

Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
 .../devicetree/bindings/leds/richtek,rt8515.yaml   | 36 +++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml
index 0356371a6b01..820cf8c55090 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.
 
+  This driver also supports single-GPIO flash ICs that use the same
+  one-wire pulse-count protocol on one line for both flash and torch.
+  For these, only enf-gpios is required.
+
 properties:
   compatible:
     const: richtek,rt8515
@@ -26,6 +30,14 @@ properties:
   ent-gpios:
     maxItems: 1
     description: A connection to the 'ENT' (enable torch) pin.
+      Optional for single-GPIO flash ICs where enf-gpios is used for
+      both flash and torch modes.
+
+  unlock-gpios:
+    maxItems: 1
+    description: Optional GPIO to unlock the flash LED circuit. Some
+      boards use a PMIC MPP pin that must be driven high before the
+      flash IC will respond to the enable GPIOs.
 
   richtek,rfs-ohms:
     minimum: 7680
@@ -81,10 +93,15 @@ properties:
 
 required:
   - compatible
-  - ent-gpios
   - enf-gpios
   - led
 
+oneOf:
+  - required:
+      - ent-gpios
+  - required:
+      - unlock-gpios
+
 additionalProperties: false
 
 examples:
@@ -108,4 +125,21 @@ examples:
         };
     };
 
+  - |
+    /* Single-GPIO flash IC with unlock gate */
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/leds/common.h>
+
+    led-controller {
+        compatible = "richtek,rt8515";
+        enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
+        unlock-gpios = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
+
+        led {
+            function = LED_FUNCTION_FLASH;
+            color = <LED_COLOR_ID_WHITE>;
+            flash-max-timeout-us = <250000>;
+        };
+    };
+
 ...

-- 
2.53.0



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

* [PATCH 2/3] leds: flash: rt8515: Support single-GPIO flash ICs with unlock gate
  2026-03-07  0:58 [PATCH 0/3] Samsung Expressatt: Camera Flash Rudraksha Gupta via B4 Relay
  2026-03-07  0:58 ` [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate Rudraksha Gupta via B4 Relay
@ 2026-03-07  0:58 ` Rudraksha Gupta via B4 Relay
  2026-03-08 23:24   ` Linus Walleij
  2026-03-07  0:58 ` [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash Rudraksha Gupta via B4 Relay
  2 siblings, 1 reply; 12+ messages in thread
From: Rudraksha Gupta via B4 Relay @ 2026-03-07  0:58 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Linus Walleij, Bjorn Andersson, Konrad Dybcio
  Cc: linux-leds, devicetree, linux-kernel, linux-arm-msm,
	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 unlock GPIO that gates the flash circuit.

Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
 drivers/leds/flash/leds-rt8515.c | 38 ++++++++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/drivers/leds/flash/leds-rt8515.c b/drivers/leds/flash/leds-rt8515.c
index f6b439674c03..3164bf91e4c9 100644
--- a/drivers/leds/flash/leds-rt8515.c
+++ b/drivers/leds/flash/leds-rt8515.c
@@ -52,6 +52,7 @@ struct rt8515 {
 	struct regulator *reg;
 	struct gpio_desc *enable_torch;
 	struct gpio_desc *enable_flash;
+	struct gpio_desc *unlock_gpio;
 	struct timer_list powerdown_timer;
 	u32 max_timeout; /* Flash max timeout */
 	int flash_max_intensity;
@@ -66,7 +67,10 @@ 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->unlock_gpio)
+		gpiod_set_value_cansleep(rt->unlock_gpio, 0);
 }
 
 static void rt8515_gpio_brightness_commit(struct gpio_desc *gpiod,
@@ -99,11 +103,19 @@ 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);
+		/* Unlock the flash circuit if needed */
+		if (rt->unlock_gpio)
+			gpiod_set_value_cansleep(rt->unlock_gpio, 1);
+		/* Step it up to movie mode brightness */
+		rt8515_gpio_brightness_commit(rt->enable_torch ?
+				rt->enable_torch : rt->enable_flash, brightness);
 	} else {
+		/* Unlock the flash circuit if needed */
+		if (rt->unlock_gpio)
+			gpiod_set_value_cansleep(rt->unlock_gpio, 1);
 		/* Max torch brightness requested */
-		gpiod_set_value(rt->enable_torch, 1);
+		gpiod_set_value(rt->enable_torch ? rt->enable_torch :
+				rt->enable_flash, 1);
 	}
 
 	mutex_unlock(&rt->lock);
@@ -121,6 +133,9 @@ static int rt8515_led_flash_strobe_set(struct led_classdev_flash *fled,
 	mutex_lock(&rt->lock);
 
 	if (state) {
+		/* Unlock the flash circuit if needed */
+		if (rt->unlock_gpio)
+			gpiod_set_value_cansleep(rt->unlock_gpio, 1);
 		/* Enable LED flash mode and set brightness */
 		rt8515_gpio_brightness_commit(rt->enable_flash, brightness);
 		/* Set timeout */
@@ -298,12 +313,23 @@ 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 unlock GPIO (e.g. PMIC MPP to gate flash circuit) */
+	rt->unlock_gpio = devm_gpiod_get_optional(dev, "unlock", GPIOD_OUT_LOW);
+	if (IS_ERR(rt->unlock_gpio))
+		return dev_err_probe(dev, PTR_ERR(rt->unlock_gpio),
+				     "cannot get unlock GPIO\n");
+
+	/* Exactly one of ENT or unlock must be provided */
+	if (!rt->enable_torch == !rt->unlock_gpio)
+		return dev_err_probe(dev, -EINVAL,
+				     "exactly one of ent-gpios or unlock-gpios 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] 12+ messages in thread

* [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash
  2026-03-07  0:58 [PATCH 0/3] Samsung Expressatt: Camera Flash Rudraksha Gupta via B4 Relay
  2026-03-07  0:58 ` [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate Rudraksha Gupta via B4 Relay
  2026-03-07  0:58 ` [PATCH 2/3] leds: flash: " Rudraksha Gupta via B4 Relay
@ 2026-03-07  0:58 ` Rudraksha Gupta via B4 Relay
  2026-03-07  8:23   ` David Heidelberg
  2026-03-08 23:37   ` Linus Walleij
  2 siblings, 2 replies; 12+ messages in thread
From: Rudraksha Gupta via B4 Relay @ 2026-03-07  0:58 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Linus Walleij, Bjorn Andersson, Konrad Dybcio
  Cc: linux-leds, devicetree, linux-kernel, linux-arm-msm,
	Rudraksha Gupta

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, gated by
PMIC MPP 4 which must be driven high to unlock the flash circuit.

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

Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
 .../dts/qcom/qcom-msm8960-samsung-expressatt.dts   | 31 ++++++++++++++++++++++
 1 file changed, 31 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..96460775a4ec 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,20 @@ touchkey_enable: touchkey-enable {
 		regulator-boot-on;
 	};
 
+	camera_flash: led-controller {
+		compatible = "richtek,rt8515";
+		enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
+		unlock-gpios = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&cam_flash_en>;
+
+		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 +262,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 +594,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] 12+ messages in thread

* Re: [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash
  2026-03-07  0:58 ` [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash Rudraksha Gupta via B4 Relay
@ 2026-03-07  8:23   ` David Heidelberg
  2026-03-18 18:39     ` Rudraksha Gupta
  2026-03-08 23:37   ` Linus Walleij
  1 sibling, 1 reply; 12+ messages in thread
From: David Heidelberg @ 2026-03-07  8:23 UTC (permalink / raw)
  To: guptarud, Lee Jones, Pavel Machek, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Linus Walleij, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-leds, devicetree, linux-kernel, linux-arm-msm

On 07/03/2026 01:58, 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, gated by
> PMIC MPP 4 which must be driven high to unlock the flash circuit.
> 
> 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
> 
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
> ---
>   .../dts/qcom/qcom-msm8960-samsung-expressatt.dts   | 31 ++++++++++++++++++++++
>   1 file changed, 31 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..96460775a4ec 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,20 @@ touchkey_enable: touchkey-enable {
>   		regulator-boot-on;
>   	};
>   
> +	camera_flash: led-controller {
> +		compatible = "richtek,rt8515";
> +		enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
> +		unlock-gpios = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
> +		pinctrl-names = "default";
> +		pinctrl-0 = <&cam_flash_en>;
> +

LGTM, just please order pinctrl-n before pinctrl-names :)

Reviewed-by: David Heidelberg <david@ixit.cz>

Nitpick: if you can, add phone-devel@vger.kernel.org for next time,
it's easier to distinguish the phone patches in huge linux-arm-msm pile :)

David

-- 
David Heidelberg


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

* Re: [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate
  2026-03-07  0:58 ` [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate Rudraksha Gupta via B4 Relay
@ 2026-03-07 15:46   ` Krzysztof Kozlowski
  2026-03-18 18:35     ` Rudraksha Gupta
  2026-03-08 23:20   ` Linus Walleij
  1 sibling, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-07 15:46 UTC (permalink / raw)
  To: Rudraksha Gupta
  Cc: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Linus Walleij, Bjorn Andersson, Konrad Dybcio,
	linux-leds, devicetree, linux-kernel, linux-arm-msm

On Fri, Mar 06, 2026 at 04:58:02PM -0800, Rudraksha Gupta wrote:
> Some flash ICs use the same one-wire pulse-count protocol as the RT8515
> but have only a single GPIO line for both flash and torch modes, plus an
> optional unlock gate (e.g. a PMIC MPP) that must be driven high before
> the chip responds to the enable GPIO.
> 
> Make ent-gpios optional and add an unlock-gpios property to support
> these variants. Add a oneOf constraint requiring exactly one of
> ent-gpios or unlock-gpios. Add a binding example showing the
> single-GPIO configuration.
> 
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
> ---
>  .../devicetree/bindings/leds/richtek,rt8515.yaml   | 36 +++++++++++++++++++++-
>  1 file changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml
> index 0356371a6b01..820cf8c55090 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.
>  
> +  This driver also supports single-GPIO flash ICs that use the same

Drop reference to driver and explain the hardware here.

> +  one-wire pulse-count protocol on one line for both flash and torch.
> +  For these, only enf-gpios is required.
> +
>  properties:
>    compatible:
>      const: richtek,rt8515
> @@ -26,6 +30,14 @@ properties:
>    ent-gpios:
>      maxItems: 1
>      description: A connection to the 'ENT' (enable torch) pin.
> +      Optional for single-GPIO flash ICs where enf-gpios is used for
> +      both flash and torch modes.

So what happens with ENT GPIO on such boards? How is it connected?

Best regards,
Krzysztof


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

* Re: [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate
  2026-03-07  0:58 ` [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate Rudraksha Gupta via B4 Relay
  2026-03-07 15:46   ` Krzysztof Kozlowski
@ 2026-03-08 23:20   ` Linus Walleij
  2026-03-18 18:36     ` Rudraksha Gupta
  1 sibling, 1 reply; 12+ messages in thread
From: Linus Walleij @ 2026-03-08 23:20 UTC (permalink / raw)
  To: guptarud
  Cc: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Bjorn Andersson, Konrad Dybcio, linux-leds,
	devicetree, linux-kernel, linux-arm-msm

Hi Rudraksha,

thanks for your patch!

On Sat, Mar 7, 2026 at 1:58 AM Rudraksha Gupta via B4 Relay
<devnull+guptarud.gmail.com@kernel.org> wrote:

>    ent-gpios:
>      maxItems: 1
>      description: A connection to the 'ENT' (enable torch) pin.
> +      Optional for single-GPIO flash ICs where enf-gpios is used for
> +      both flash and torch modes.

Fair enough, that can be done.

> +  unlock-gpios:
> +    maxItems: 1
> +    description: Optional GPIO to unlock the flash LED circuit. Some
> +      boards use a PMIC MPP pin that must be driven high before the
> +      flash IC will respond to the enable GPIOs.

But this IC has no pin named "unlock". This is something else.

Given the way it works it looks like a regulator enable signal.

If you don't have any better idea about what this is, I would
suggest adding

vin-supply

to the RT8615 bindings instead and then use a GPIO regulator
in your device tree to provide the voltage to it from that GPIO.

Yours,
Linus Walleij

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

* Re: [PATCH 2/3] leds: flash: rt8515: Support single-GPIO flash ICs with unlock gate
  2026-03-07  0:58 ` [PATCH 2/3] leds: flash: " Rudraksha Gupta via B4 Relay
@ 2026-03-08 23:24   ` Linus Walleij
  0 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2026-03-08 23:24 UTC (permalink / raw)
  To: guptarud
  Cc: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Bjorn Andersson, Konrad Dybcio, linux-leds,
	devicetree, linux-kernel, linux-arm-msm

Hi Rudraksha,

thanks for your patch!

Overall this looks fine but:

On Sat, Mar 7, 2026 at 1:58 AM Rudraksha Gupta via B4 Relay
<devnull+guptarud.gmail.com@kernel.org> wrote:

>         struct regulator *reg;

struct rt8515 actually has an unused regulator struct
that was never implemented, but should represent the
vin signal.

>         struct gpio_desc *enable_torch;
>         struct gpio_desc *enable_flash;
> +       struct gpio_desc *unlock_gpio;

Skip this unless you can explain how it works, use the
*reg from vin instead. I think this is just a GPIO-controlled
regulator.

> +       if (rt->unlock_gpio)
> +               gpiod_set_value_cansleep(rt->unlock_gpio, 0);

Add code to disable the vin regulator instead.

> +               /* Unlock the flash circuit if needed */
> +               if (rt->unlock_gpio)
> +                       gpiod_set_value_cansleep(rt->unlock_gpio, 1);

Add code to enable and stablize the vin regulator instead.

>         if (state) {
> +               /* Unlock the flash circuit if needed */
> +               if (rt->unlock_gpio)
> +                       gpiod_set_value_cansleep(rt->unlock_gpio, 1);

Add code to enable and stablize the vin regulator instead.

Yours,
Linus Walleij

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

* Re: [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash
  2026-03-07  0:58 ` [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash Rudraksha Gupta via B4 Relay
  2026-03-07  8:23   ` David Heidelberg
@ 2026-03-08 23:37   ` Linus Walleij
  1 sibling, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2026-03-08 23:37 UTC (permalink / raw)
  To: guptarud
  Cc: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Bjorn Andersson, Konrad Dybcio, linux-leds,
	devicetree, linux-kernel, linux-arm-msm

Hi Rudraksha,

thanks for your patch!

On Sat, Mar 7, 2026 at 1:58 AM Rudraksha Gupta via B4 Relay
<devnull+guptarud.gmail.com@kernel.org> 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, gated by
> PMIC MPP 4 which must be driven high to unlock the flash circuit.
>
> 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
>
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>

(...)

> +       camera_flash: led-controller {
> +               compatible = "richtek,rt8515";
> +               enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;

I think you should ideally define richtek,rfs-ohms, if it's impossible
to find this information then use the default,
richtek,rfs-ohms = <16000>;

> +               unlock-gpios = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;

As mentioned I don't think this is right. The chip has no "unlock"
signal. I think this is a simple regulator (such as a switch).

I would do:

vin-supply = <&flash_gpio_reg>;

Then something like (better if you reserarch it a bit):

flash_gpio_reg: regulator-gpio-ldo-3v3 {
    compatible = "regulator-fixed";
    /* Supplied in turn by VBAT? I guess so. It is between 2.8 and 5V */
    regulator-name = "FLASH_3V3"; // Or whatever the rail is best called?
    regulator-min-microvolt = <3300000>; // If you have better guesses, use them
    regulator-max-microvolt = <3300000>; // If you know VBAT then use
that voltage
    gpio = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
    startup-delay-us = <5000>; // FIXME
    enable-active-high;
    pinctrl-names = "default";
    pinctrl-0 = <&flash_led_unlock>;
};

Notice:

+&pm8921_mpps {
+       flash_led_unlock: flash-led-unlock-state {
+               pins = "mpp4";
+               function = "digital";
+               output-low;
+               power-source = <PM8921_GPIO_S4>;
+       };

This seems completely unused in the current patch, but my addition
above uses it.

Yours,
Linus Walleij

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

* Re: [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate
  2026-03-07 15:46   ` Krzysztof Kozlowski
@ 2026-03-18 18:35     ` Rudraksha Gupta
  0 siblings, 0 replies; 12+ messages in thread
From: Rudraksha Gupta @ 2026-03-18 18:35 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Linus Walleij, Bjorn Andersson, Konrad Dybcio,
	linux-leds, devicetree, linux-kernel, linux-arm-msm


On 3/7/26 07:46, Krzysztof Kozlowski wrote:
> On Fri, Mar 06, 2026 at 04:58:02PM -0800, Rudraksha Gupta wrote:
>> Some flash ICs use the same one-wire pulse-count protocol as the RT8515
>> but have only a single GPIO line for both flash and torch modes, plus an
>> optional unlock gate (e.g. a PMIC MPP) that must be driven high before
>> the chip responds to the enable GPIO.
>>
>> Make ent-gpios optional and add an unlock-gpios property to support
>> these variants. Add a oneOf constraint requiring exactly one of
>> ent-gpios or unlock-gpios. Add a binding example showing the
>> single-GPIO configuration.
>>
>> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
>> ---
>>   .../devicetree/bindings/leds/richtek,rt8515.yaml   | 36 +++++++++++++++++++++-
>>   1 file changed, 35 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml b/Documentation/devicetree/bindings/leds/richtek,rt8515.yaml
>> index 0356371a6b01..820cf8c55090 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.
>>   
>> +  This driver also supports single-GPIO flash ICs that use the same
> Drop reference to driver and explain the hardware here.
>
>> +  one-wire pulse-count protocol on one line for both flash and torch.
>> +  For these, only enf-gpios is required.
>> +
>>   properties:
>>     compatible:
>>       const: richtek,rt8515
>> @@ -26,6 +30,14 @@ properties:
>>     ent-gpios:
>>       maxItems: 1
>>       description: A connection to the 'ENT' (enable torch) pin.
>> +      Optional for single-GPIO flash ICs where enf-gpios is used for
>> +      both flash and torch modes.
> So what happens with ENT GPIO on such boards? How is it connected?

Hello Krzysztof,

Thanks for these comments. I have addressed these in v2

Rudraksha

>
> Best regards,
> Krzysztof
>

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

* Re: [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate
  2026-03-08 23:20   ` Linus Walleij
@ 2026-03-18 18:36     ` Rudraksha Gupta
  0 siblings, 0 replies; 12+ messages in thread
From: Rudraksha Gupta @ 2026-03-18 18:36 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Bjorn Andersson, Konrad Dybcio, linux-leds,
	devicetree, linux-kernel, linux-arm-msm


On 3/8/26 16:20, Linus Walleij wrote:
> Hi Rudraksha,
>
> thanks for your patch!
>
> On Sat, Mar 7, 2026 at 1:58 AM Rudraksha Gupta via B4 Relay
> <devnull+guptarud.gmail.com@kernel.org> wrote:
>
>>     ent-gpios:
>>       maxItems: 1
>>       description: A connection to the 'ENT' (enable torch) pin.
>> +      Optional for single-GPIO flash ICs where enf-gpios is used for
>> +      both flash and torch modes.
> Fair enough, that can be done.
>
>> +  unlock-gpios:
>> +    maxItems: 1
>> +    description: Optional GPIO to unlock the flash LED circuit. Some
>> +      boards use a PMIC MPP pin that must be driven high before the
>> +      flash IC will respond to the enable GPIOs.
> But this IC has no pin named "unlock". This is something else.
>
> Given the way it works it looks like a regulator enable signal.
>
> If you don't have any better idea about what this is, I would
> suggest adding
>
> vin-supply
>
> to the RT8615 bindings instead and then use a GPIO regulator
> in your device tree to provide the voltage to it from that GPIO.

Hello Linus,

Thanks for your comments (both in this email and others)! I have 
addressed these in v2.

Rudraksha


>
> Yours,
> Linus Walleij

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

* Re: [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash
  2026-03-07  8:23   ` David Heidelberg
@ 2026-03-18 18:39     ` Rudraksha Gupta
  0 siblings, 0 replies; 12+ messages in thread
From: Rudraksha Gupta @ 2026-03-18 18:39 UTC (permalink / raw)
  To: David Heidelberg, Lee Jones, Pavel Machek, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Linus Walleij, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-leds, devicetree, linux-kernel, linux-arm-msm


On 3/7/26 00:23, David Heidelberg wrote:
> On 07/03/2026 01:58, 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, gated by
>> PMIC MPP 4 which must be driven high to unlock the flash circuit.
>>
>> 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
>>
>> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
>> ---
>>   .../dts/qcom/qcom-msm8960-samsung-expressatt.dts   | 31 
>> ++++++++++++++++++++++
>>   1 file changed, 31 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..96460775a4ec 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,20 @@ touchkey_enable: touchkey-enable {
>>           regulator-boot-on;
>>       };
>>   +    camera_flash: led-controller {
>> +        compatible = "richtek,rt8515";
>> +        enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
>> +        unlock-gpios = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
>> +        pinctrl-names = "default";
>> +        pinctrl-0 = <&cam_flash_en>;
>> +
>
> LGTM, just please order pinctrl-n before pinctrl-names :)
>
> Reviewed-by: David Heidelberg <david@ixit.cz>
>
> Nitpick: if you can, add phone-devel@vger.kernel.org for next time,
> it's easier to distinguish the phone patches in huge linux-arm-msm 
> pile :)

Hello David,

Thanks for your comments! I have addressed them in v2 :)

Rudraksha


>
> David
>

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

end of thread, other threads:[~2026-03-18 18:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-07  0:58 [PATCH 0/3] Samsung Expressatt: Camera Flash Rudraksha Gupta via B4 Relay
2026-03-07  0:58 ` [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate Rudraksha Gupta via B4 Relay
2026-03-07 15:46   ` Krzysztof Kozlowski
2026-03-18 18:35     ` Rudraksha Gupta
2026-03-08 23:20   ` Linus Walleij
2026-03-18 18:36     ` Rudraksha Gupta
2026-03-07  0:58 ` [PATCH 2/3] leds: flash: " Rudraksha Gupta via B4 Relay
2026-03-08 23:24   ` Linus Walleij
2026-03-07  0:58 ` [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash Rudraksha Gupta via B4 Relay
2026-03-07  8:23   ` David Heidelberg
2026-03-18 18:39     ` Rudraksha Gupta
2026-03-08 23:37   ` Linus Walleij

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