Skip to contentSkip to conversation

led: leds-lp50xx: Add max-brightness as in leds-pwm

PATCH In review Astrid Rost 4 participants 5 messages Jun 29, 2023 – Jun 30, 2023 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/2 led: leds-lp50xx: Add max-brightness as in leds-pwm

Add max-brightness in order to reduce the current on the connected LEDs. Normally, the maximum brightness is determined by the hardware, and this property is not required. This property is used to set a software limit. It could happen that an LED is made so bright that it gets damaged or causes damage due to restrictions in a specific system, such as mounting conditions.

---
 drivers/leds/leds-lp50xx.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/leds/leds-lp50xx.c +2 -0
index 28d6b39fa72d..1cb54c0524a1 100644
@@ -502,6 +502,8 @@ static int lp50xx_probe_dt(struct lp50xx *priv)
 		led->mc_cdev.num_colors = num_colors;
 		led->mc_cdev.subled_info = mc_led_info;
 		led_cdev = &led->mc_cdev.led_cdev;
+		fwnode_property_read_u32(child, "max-brightness",
+					 &led_cdev->max_brightness);
 		led_cdev->brightness_set_blocking = lp50xx_brightness_set;
 
 		ret = devm_led_classdev_multicolor_register_ext(priv->dev,
Signature · 1 line
2.30.2
#2 lore raw
Quoted 6 lines · Astrid Rost

Add max-brightness in order to reduce the current on the connected LEDs. Normally, the maximum brightness is determined by the hardware, and this property is not required. This property is used to set a software limit. It could happen that an LED is made so bright that it gets damaged or causes damage due to restrictions in a specific system, such as mounting conditions.

This will be 4th driver in the LED subsystem that will use this (optional) property. Perhaps it's time to actually move it to the LED generic bindings and call this from led_parse_fwnode_props()?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

PATCH 2/2 dt: bindings: lp50xx: Add max-brightness as in leds-pwm

In reply to a message not in the archive

Add max-brightness in order to reduce the current on the connected LEDs. Normally, the maximum brightness is determined by the hardware, and this property is not required. This property is used to set a software limit. It could happen that an LED is made so bright that it gets damaged or causes damage due to restrictions in a specific system, such as mounting conditions.

---
 Documentation/devicetree/bindings/leds/leds-lp50xx.yaml | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/leds/leds-lp50xx.yaml +9 -0
index 402c25424525..6a1425969cb4 100644
@@ -73,6 +73,15 @@ patternProperties:
       '#size-cells':
         const: 0
 
+      max-brightness:
+        description:
+          Normally, the maximum brightness is determined by the hardware, and
+          this property is not required. This property is used to set a software
+          limit. It could happen that an LED is made so bright that it gets
+          damaged or causes damage due to restrictions in a specific system,
+          such as mounting conditions.
+        $ref: /schemas/types.yaml#definitions/uint32
+
     patternProperties:
       "^led@[0-9a-f]+$":
         type: object
Signature · 1 line
2.30.2
maintainer
#4 lore raw

Re: [PATCH v1 2/2] dt: bindings: lp50xx: Add max-brightness as in leds-pwm

Quoted 18 lines · Astrid Rost

Add max-brightness in order to reduce the current on the connected LEDs. Normally, the maximum brightness is determined by the hardware, and this property is not required. This property is used to set a software limit. It could happen that an LED is made so bright that it gets damaged or causes damage due to restrictions in a specific system, such as mounting conditions.

---
 Documentation/devicetree/bindings/leds/leds-lp50xx.yaml | 9 +++++++++
 1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/leds/leds-lp50xx.yaml +0 -0
index 402c25424525..6a1425969cb4 100644
@@ -73,6 +73,15 @@ patternProperties:
       '#size-cells':

Documentation/devicetree/bindings/leds/leds-lp50xx.yaml patternProperties: · line 83

Quoted 10 lines
Documentation/devicetree/bindings/leds/leds-lp50xx.yaml +8 -0
         const: 0
 
+      max-brightness:
+        description:
+          Normally, the maximum brightness is determined by the hardware, and
+          this property is not required. This property is used to set a software
+          limit. It could happen that an LED is made so bright that it gets
+          damaged or causes damage due to restrictions in a specific system,
+          such as mounting conditions.
+        $ref: /schemas/types.yaml#definitions/uint32

We already have led-max-microamp. If this h/w works by controlling the current, then that is what you should use. "max-brightness" makes more sense for PWM based control.

If you do end up keeping this, it belongs in the 'led' nodes not the controller as brightness is a property of the LED, not the LED driver(controller). And it should be in common schema rather than defining the type yet again.

Rob

#5 lore raw

Re: [PATCH v1 2/2] dt: bindings: lp50xx: Add max-brightness as in leds-pwm

Quoted 21 lines · Rob Herring
Quoted 20 lines · Astrid Rost

Add max-brightness in order to reduce the current on the connected LEDs. Normally, the maximum brightness is determined by the hardware, and this property is not required. This property is used to set a software limit. It could happen that an LED is made so bright that it gets damaged or causes damage due to restrictions in a specific system, such as mounting conditions.

---
  Documentation/devicetree/bindings/leds/leds-lp50xx.yaml | 9 +++++++++
  1 file changed, 9 insertions(+)
Documentation/devicetree/bindings/leds/leds-lp50xx.yaml +0 -0
index 402c25424525..6a1425969cb4 100644
@@ -73,6 +73,15 @@ patternProperties:
        '#size-cells':
          const: 0
 
Quoted 12 lines

Documentation/devicetree/bindings/leds/leds-lp50xx.yaml patternProperties: · line 83

Quoted 8 lines
Documentation/devicetree/bindings/leds/leds-lp50xx.yaml +8 -0
+      max-brightness:
+        description:
+          Normally, the maximum brightness is determined by the hardware, and
+          this property is not required. This property is used to set a software
+          limit. It could happen that an LED is made so bright that it gets
+          damaged or causes damage due to restrictions in a specific system,
+          such as mounting conditions.
+        $ref: /schemas/types.yaml#definitions/uint32

We already have led-max-microamp. If this h/w works by controlling the current, then that is what you should use. "max-brightness" makes more sense for PWM based control.

Yes, I looked into this. This LED controller TI-LP5024 has only one flag as max current option, which allows to set between 35 mA and the default value 25.5 mA. This is not enough for our application.

Quoted 5 lines

If you do end up keeping this, it belongs in the 'led' nodes not the controller as brightness is a property of the LED, not the LED driver(controller). And it should be in common schema rather than defining the type yet again.

I will look moving it into the the LED generic bindings as Andy suggested. max_brightness is already there and handled correctly. It is just a matter of reading it from the devicetree.

Quoted 2 lines

Rob