diff mbox series

[RESEND,8/8] leds: turris-omnia: change max brightness from 255 to 1

Message ID 20221226123630.6515-9-pali@kernel.org (mailing list archive)
State Changes Requested
Headers show
Series Resend LED patches | expand

Commit Message

Pali Rohár Dec. 26, 2022, 12:36 p.m. UTC
From: Marek Behún <kabel@kernel.org>

Using binary brightness makes more sense for this controller, because
internally in the MCU it works that way: the LED has a color, and a
state whether it is ON or OFF.

The resulting brightness computation with led_mc_calc_color_components()
will now always result in either (0, 0, 0) or the multi_intensity value.

Signed-off-by: Marek Behún <kabel@kernel.org>
Fixes: 089381b27abe ("leds: initial support for Turris Omnia LEDs")
Reviewed-by: Pali Rohár <pali@kernel.org>
---
 drivers/leds/leds-turris-omnia.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lee Jones Feb. 24, 2023, 9:34 a.m. UTC | #1
On Mon, 26 Dec 2022, Pali Rohár wrote:

> From: Marek Behún <kabel@kernel.org>
> 
> Using binary brightness makes more sense for this controller, because
> internally in the MCU it works that way: the LED has a color, and a
> state whether it is ON or OFF.
> 
> The resulting brightness computation with led_mc_calc_color_components()
> will now always result in either (0, 0, 0) or the multi_intensity value.
> 
> Signed-off-by: Marek Behún <kabel@kernel.org>
> Fixes: 089381b27abe ("leds: initial support for Turris Omnia LEDs")
> Reviewed-by: Pali Rohár <pali@kernel.org>
> ---
>  drivers/leds/leds-turris-omnia.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c
> index 71340dec492a..04f01ae46c27 100644
> --- a/drivers/leds/leds-turris-omnia.c
> +++ b/drivers/leds/leds-turris-omnia.c
> @@ -146,7 +146,7 @@ static int omnia_led_register(struct i2c_client *client, struct omnia_led *led,
>  	init_data.fwnode = &np->fwnode;
>  
>  	cdev = &led->mc_cdev.led_cdev;
> -	cdev->max_brightness = 255;
> +	cdev->max_brightness = 1;

Should this now be LED_ON?

>  	cdev->brightness_set_blocking = omnia_led_brightness_set_blocking;
>  	cdev->trigger_type = &omnia_hw_trigger_type;
>  	cdev->default_trigger = omnia_hw_trigger.name;
> -- 
> 2.20.1
>
Pali Rohár March 9, 2023, 8:07 p.m. UTC | #2
On Friday 24 February 2023 09:34:11 Lee Jones wrote:
> On Mon, 26 Dec 2022, Pali Rohár wrote:
> 
> > From: Marek Behún <kabel@kernel.org>
> > 
> > Using binary brightness makes more sense for this controller, because
> > internally in the MCU it works that way: the LED has a color, and a
> > state whether it is ON or OFF.
> > 
> > The resulting brightness computation with led_mc_calc_color_components()
> > will now always result in either (0, 0, 0) or the multi_intensity value.
> > 
> > Signed-off-by: Marek Behún <kabel@kernel.org>
> > Fixes: 089381b27abe ("leds: initial support for Turris Omnia LEDs")
> > Reviewed-by: Pali Rohár <pali@kernel.org>
> > ---
> >  drivers/leds/leds-turris-omnia.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c
> > index 71340dec492a..04f01ae46c27 100644
> > --- a/drivers/leds/leds-turris-omnia.c
> > +++ b/drivers/leds/leds-turris-omnia.c
> > @@ -146,7 +146,7 @@ static int omnia_led_register(struct i2c_client *client, struct omnia_led *led,
> >  	init_data.fwnode = &np->fwnode;
> >  
> >  	cdev = &led->mc_cdev.led_cdev;
> > -	cdev->max_brightness = 255;
> > +	cdev->max_brightness = 1;
> 
> Should this now be LED_ON?

Somebody said that LED_ON is deprecated.

> >  	cdev->brightness_set_blocking = omnia_led_brightness_set_blocking;
> >  	cdev->trigger_type = &omnia_hw_trigger_type;
> >  	cdev->default_trigger = omnia_hw_trigger.name;
> > -- 
> > 2.20.1
> > 
> 
> -- 
> Lee Jones [李琼斯]
diff mbox series

Patch

diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c
index 71340dec492a..04f01ae46c27 100644
--- a/drivers/leds/leds-turris-omnia.c
+++ b/drivers/leds/leds-turris-omnia.c
@@ -146,7 +146,7 @@  static int omnia_led_register(struct i2c_client *client, struct omnia_led *led,
 	init_data.fwnode = &np->fwnode;
 
 	cdev = &led->mc_cdev.led_cdev;
-	cdev->max_brightness = 255;
+	cdev->max_brightness = 1;
 	cdev->brightness_set_blocking = omnia_led_brightness_set_blocking;
 	cdev->trigger_type = &omnia_hw_trigger_type;
 	cdev->default_trigger = omnia_hw_trigger.name;