linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] dt-bindings: leds: Read max-brightness from devicetree
       [not found] <20230703130313.548519-1-astrid.rost@axis.com>
@ 2023-07-03 13:03 ` Astrid Rost
  2023-07-05  6:32   ` Krzysztof Kozlowski
                     ` (2 more replies)
  2023-07-03 13:03 ` [PATCH v3 2/2] led: led-class: " Astrid Rost
  1 sibling, 3 replies; 7+ messages in thread
From: Astrid Rost @ 2023-07-03 13:03 UTC (permalink / raw)
  To: Andy Shevchenko, Krzysztof Kozlowski, Rob Herring,
	Jacek Anaszewski, Pavel Machek, Lee Jones, Rob Herring,
	Conor Dooley
  Cc: kernel, Astrid Rost, linux-leds, devicetree, linux-kernel

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.

Signed-off-by: Astrid Rost <astrid.rost@axis.com>
---
 Documentation/devicetree/bindings/leds/common.yaml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/leds/common.yaml b/Documentation/devicetree/bindings/leds/common.yaml
index 11aedf1650a1..16f08d0939ce 100644
--- a/Documentation/devicetree/bindings/leds/common.yaml
+++ b/Documentation/devicetree/bindings/leds/common.yaml
@@ -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,
-- 
2.30.2


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

* [PATCH v3 2/2] led: led-class: Read max-brightness from devicetree
       [not found] <20230703130313.548519-1-astrid.rost@axis.com>
  2023-07-03 13:03 ` [PATCH v3 1/2] dt-bindings: leds: Read max-brightness from devicetree Astrid Rost
@ 2023-07-03 13:03 ` Astrid Rost
  2023-07-03 21:39   ` Jacek Anaszewski
  2023-07-13 13:33   ` Lee Jones
  1 sibling, 2 replies; 7+ messages in thread
From: Astrid Rost @ 2023-07-03 13:03 UTC (permalink / raw)
  To: Andy Shevchenko, Krzysztof Kozlowski, Rob Herring,
	Jacek Anaszewski, Pavel Machek, Lee Jones
  Cc: kernel, Astrid Rost, linux-leds, linux-kernel

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.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Astrid Rost <astrid.rost@axis.com>
---
 drivers/leds/led-class.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 9255bc11f99d..ce652abf9336 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -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;
-- 
2.30.2


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

* Re: [PATCH v3 2/2] led: led-class: Read max-brightness from devicetree
  2023-07-03 13:03 ` [PATCH v3 2/2] led: led-class: " Astrid Rost
@ 2023-07-03 21:39   ` Jacek Anaszewski
  2023-07-13 13:33   ` Lee Jones
  1 sibling, 0 replies; 7+ messages in thread
From: Jacek Anaszewski @ 2023-07-03 21:39 UTC (permalink / raw)
  To: Astrid Rost, Andy Shevchenko, Krzysztof Kozlowski, Rob Herring,
	Pavel Machek, Lee Jones
  Cc: kernel, linux-leds, linux-kernel

Hi Astrid,

Thanks for the update.

On 7/3/23 15:03, Astrid Rost wrote:
> 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.
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Astrid Rost <astrid.rost@axis.com>
> ---
>   drivers/leds/led-class.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index 9255bc11f99d..ce652abf9336 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -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:

Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>

-- 
Best regards,
Jacek Anaszewski

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

* Re: [PATCH v3 1/2] dt-bindings: leds: Read max-brightness from devicetree
  2023-07-03 13:03 ` [PATCH v3 1/2] dt-bindings: leds: Read max-brightness from devicetree Astrid Rost
@ 2023-07-05  6:32   ` Krzysztof Kozlowski
  2023-07-05 15:55   ` Rob Herring
  2023-07-13 13:33   ` Lee Jones
  2 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-05  6:32 UTC (permalink / raw)
  To: Astrid Rost, Andy Shevchenko, Krzysztof Kozlowski, Rob Herring,
	Jacek Anaszewski, Pavel Machek, Lee Jones, Rob Herring,
	Conor Dooley
  Cc: kernel, linux-leds, devicetree, linux-kernel

On 03/07/2023 15:03, Astrid Rost wrote:
> 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.
> 
> Signed-off-by: Astrid Rost <astrid.rost@axis.com>

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH v3 1/2] dt-bindings: leds: Read max-brightness from devicetree
  2023-07-03 13:03 ` [PATCH v3 1/2] dt-bindings: leds: Read max-brightness from devicetree Astrid Rost
  2023-07-05  6:32   ` Krzysztof Kozlowski
@ 2023-07-05 15:55   ` Rob Herring
  2023-07-13 13:33   ` Lee Jones
  2 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2023-07-05 15:55 UTC (permalink / raw)
  To: Astrid Rost
  Cc: Conor Dooley, linux-kernel, Andy Shevchenko, linux-leds,
	Jacek Anaszewski, Pavel Machek, Rob Herring, Lee Jones,
	Krzysztof Kozlowski, devicetree, kernel


On Mon, 03 Jul 2023 15:03:12 +0200, Astrid Rost wrote:
> 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.
> 
> Signed-off-by: Astrid Rost <astrid.rost@axis.com>
> ---
>  Documentation/devicetree/bindings/leds/common.yaml | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>


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

* Re: [PATCH v3 1/2] dt-bindings: leds: Read max-brightness from devicetree
  2023-07-03 13:03 ` [PATCH v3 1/2] dt-bindings: leds: Read max-brightness from devicetree Astrid Rost
  2023-07-05  6:32   ` Krzysztof Kozlowski
  2023-07-05 15:55   ` Rob Herring
@ 2023-07-13 13:33   ` Lee Jones
  2 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2023-07-13 13:33 UTC (permalink / raw)
  To: Astrid Rost
  Cc: Andy Shevchenko, Krzysztof Kozlowski, Rob Herring,
	Jacek Anaszewski, Pavel Machek, Rob Herring, Conor Dooley,
	kernel, linux-leds, devicetree, linux-kernel

On Mon, 03 Jul 2023, Astrid Rost wrote:

> 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.
> 
> Signed-off-by: Astrid Rost <astrid.rost@axis.com>
> ---
>  Documentation/devicetree/bindings/leds/common.yaml | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

Applied, thanks

-- 
Lee Jones [李琼斯]

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

* Re: [PATCH v3 2/2] led: led-class: Read max-brightness from devicetree
  2023-07-03 13:03 ` [PATCH v3 2/2] led: led-class: " Astrid Rost
  2023-07-03 21:39   ` Jacek Anaszewski
@ 2023-07-13 13:33   ` Lee Jones
  1 sibling, 0 replies; 7+ messages in thread
From: Lee Jones @ 2023-07-13 13:33 UTC (permalink / raw)
  To: Astrid Rost
  Cc: Andy Shevchenko, Krzysztof Kozlowski, Rob Herring,
	Jacek Anaszewski, Pavel Machek, kernel, linux-leds, linux-kernel

On Mon, 03 Jul 2023, Astrid Rost wrote:

> 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.
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Astrid Rost <astrid.rost@axis.com>
> ---
>  drivers/leds/led-class.c | 4 ++++
>  1 file changed, 4 insertions(+)

Applied, thanks

-- 
Lee Jones [李琼斯]

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

end of thread, other threads:[~2023-07-13 13:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230703130313.548519-1-astrid.rost@axis.com>
2023-07-03 13:03 ` [PATCH v3 1/2] dt-bindings: leds: Read max-brightness from devicetree Astrid Rost
2023-07-05  6:32   ` Krzysztof Kozlowski
2023-07-05 15:55   ` Rob Herring
2023-07-13 13:33   ` Lee Jones
2023-07-03 13:03 ` [PATCH v3 2/2] led: led-class: " Astrid Rost
2023-07-03 21:39   ` Jacek Anaszewski
2023-07-13 13:33   ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).