[PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate

Rudraksha Gupta via B4 Relay posted 3 patches 1 month ago
There is a newer version of this series
[PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate
Posted by Rudraksha Gupta via B4 Relay 1 month ago
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
Re: [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate
Posted by Linus Walleij 1 month ago
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
Re: [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate
Posted by Rudraksha Gupta 3 weeks ago
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
Re: [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate
Posted by Krzysztof Kozlowski 1 month ago
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
Re: [PATCH 1/3] dt-bindings: leds: rt8515: Support single-GPIO flash ICs with unlock gate
Posted by Rudraksha Gupta 3 weeks ago
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
>