Skip to contentSkip to conversation

dt-bindings: leds: Read max-brightness from devicetree

PATCH Applied Astrid Rost 5 participants 7 messages Jul 3, 2023 – Jul 13, 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 v3 1/2 dt-bindings: leds: Read max-brightness from devicetree

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.
Note that this flag is mainly used for PWM-LEDs, where it is not possible to map brightness to current. Drivers for other controllers should use led-max-microamp.

---
 Documentation/devicetree/bindings/leds/common.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/leds/common.yaml +12 -0
index 11aedf1650a1..16f08d0939ce 100644
@@ -160,6 +160,18 @@ properties:
       For flash LED controllers with configurable current this property is
       mandatory for the LEDs in the non-flash modes (e.g. torch or indicator).
 
+  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.
+      Note that this flag is mainly used for PWM-LEDs, where it is not possible
+      to map brightness to current. Drivers for other controllers should use
+      led-max-microamp.
+    $ref: /schemas/types.yaml#definitions/uint32
+
   panic-indicator:
     description:
       This property specifies that the LED should be used, if at all possible,
Signature · 1 line
2.30.2
Reviewed-by on v3 1/2
#2 lore raw
Quoted 10 lines · Astrid Rost

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.
Note that this flag is mainly used for PWM-LEDs, where it is not possible to map brightness to current. Drivers for other controllers should use led-max-microamp.

Best regards,
Krzysztof

maintainer Reviewed-by on v3 1/2
#3 lore raw
In reply to Astrid Rost
Quoted 9 lines · Astrid Rost

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.
Note that this flag is mainly used for PWM-LEDs, where it is not possible to map brightness to current. Drivers for other controllers should use led-max-microamp.

Quoted 5 lines
---
 Documentation/devicetree/bindings/leds/common.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)
maintainer Applied
#4 lore raw
In reply to Astrid Rost
Quoted 9 lines · Astrid Rost

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.
Note that this flag is mainly used for PWM-LEDs, where it is not possible to map brightness to current. Drivers for other controllers should use led-max-microamp.

Quoted 4 lines
---
 Documentation/devicetree/bindings/leds/common.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Applied, thanks

Signature · 1 line
Lee Jones [李琼斯]
#5 lore raw

PATCH v3 2/2 led: led-class: Read max-brightness from devicetree

In reply to a message not in the archive

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.
Note that this flag is mainly used for PWM-LEDs, where it is not possible to map brightness to current. Drivers for other controllers should use led-max-microamp.

---
 drivers/leds/led-class.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/leds/led-class.c +4 -0
index 9255bc11f99d..ce652abf9336 100644
@@ -457,6 +457,10 @@ int led_classdev_register_ext(struct device *parent,
 			if (fwnode_property_present(init_data->fwnode,
 						    "retain-state-shutdown"))
 				led_cdev->flags |= LED_RETAIN_AT_SHUTDOWN;
+
+			fwnode_property_read_u32(init_data->fwnode,
+				"max-brightness",
+				&led_cdev->max_brightness);
 		}
 	} else {
 		proposed_name = led_cdev->name;
Signature · 1 line
2.30.2
Acked-by on v3 2/2
#6 lore raw

Re: [PATCH v3 2/2] led: led-class: Read max-brightness from devicetree

Hi Astrid,

Thanks for the update.

Quoted 20 lines · Astrid Rost

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.
Note that this flag is mainly used for PWM-LEDs, where it is not possible to map brightness to current. Drivers for other controllers should use led-max-microamp.

---
  drivers/leds/led-class.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/leds/led-class.c +0 -0
index 9255bc11f99d..ce652abf9336 100644

drivers/leds/led-class.c int led_classdev_register_ext(struct device *parent, · line 466

Quoted 10 lines
drivers/leds/led-class.c +4 -0
@@ -457,6 +457,10 @@ int led_classdev_register_ext(struct device *parent,
  			if (fwnode_property_present(init_data->fwnode,
  						    "retain-state-shutdown"))
  				led_cdev->flags |= LED_RETAIN_AT_SHUTDOWN;
+
+			fwnode_property_read_u32(init_data->fwnode,
+				"max-brightness",
+				&led_cdev->max_brightness);
  		}
  	} else {
  		proposed_name = led_cdev->name;

For the whole set:

Signature · 2 lines
Best regards,
Jacek Anaszewski
maintainer Applied
#7 lore raw

Re: [PATCH v3 2/2] led: led-class: Read max-brightness from devicetree

In reply to Astrid Rost
Quoted 9 lines · Astrid Rost

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.
Note that this flag is mainly used for PWM-LEDs, where it is not possible to map brightness to current. Drivers for other controllers should use led-max-microamp.

Quoted 5 lines
---
 drivers/leds/led-class.c | 4 ++++
 1 file changed, 4 insertions(+)

Applied, thanks

Signature · 1 line
Lee Jones [李琼斯]