mbox series

[RFC,0/2] leds: Add led_mc_set_brightness() and led_mc_trigger_event() functions

Message ID 20240309190835.173703-1-hdegoede@redhat.com
Headers show
Series leds: Add led_mc_set_brightness() and led_mc_trigger_event() functions | expand

Message

Hans de Goede March 9, 2024, 7:08 p.m. UTC
Hi All,

Here is a patch-series adding led_mc_set_brightness() and
led_mc_trigger_event() functions for changing multi-color LED colors
from inside the kernel.

This is a preparation series for adding a new trigger to
drivers/power/supply/power_supply_leds.c which changes the color
of a RGB LED depending on if the battery is discharging (LED off)
charging (LED red) or full (LED green)

This is marked as RFC since the power_supply_leds.c changes have not
been written yet and as such this is compile-tested only atm.
The main goal of this RFC is to gather review feedback on the
chosen approach in these 2 patches.

Regards,

Hans


Hans de Goede (2):
  leds: core: Add led_mc_set_brightness() function
  leds: trigger: Add led_mc_trigger_event() function

 drivers/leds/led-class-multicolor.c |  1 +
 drivers/leds/led-core.c             | 31 +++++++++++++++++++++++++++++
 drivers/leds/led-triggers.c         | 20 +++++++++++++++++++
 include/linux/leds.h                | 26 ++++++++++++++++++++++++
 4 files changed, 78 insertions(+)

Comments

Jacek Anaszewski March 18, 2024, 9:05 p.m. UTC | #1
Hi Hans,

On 3/9/24 20:08, Hans de Goede wrote:
> Hi All,
> 
> Here is a patch-series adding led_mc_set_brightness() and
> led_mc_trigger_event() functions for changing multi-color LED colors
> from inside the kernel.
> 
> This is a preparation series for adding a new trigger to
> drivers/power/supply/power_supply_leds.c which changes the color
> of a RGB LED depending on if the battery is discharging (LED off)
> charging (LED red) or full (LED green)
> 
> This is marked as RFC since the power_supply_leds.c changes have not
> been written yet and as such this is compile-tested only atm.
> The main goal of this RFC is to gather review feedback on the
> chosen approach in these 2 patches.
> 
> Regards,
> 
> Hans
> 
> 
> Hans de Goede (2):
>    leds: core: Add led_mc_set_brightness() function
>    leds: trigger: Add led_mc_trigger_event() function
> 
>   drivers/leds/led-class-multicolor.c |  1 +
>   drivers/leds/led-core.c             | 31 +++++++++++++++++++++++++++++
>   drivers/leds/led-triggers.c         | 20 +++++++++++++++++++
>   include/linux/leds.h                | 26 ++++++++++++++++++++++++
>   4 files changed, 78 insertions(+)
> 

LGTM.

Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Lee Jones March 21, 2024, 6:18 p.m. UTC | #2
On Sat, 09 Mar 2024, Hans de Goede wrote:

> Hi All,
> 
> Here is a patch-series adding led_mc_set_brightness() and
> led_mc_trigger_event() functions for changing multi-color LED colors
> from inside the kernel.
> 
> This is a preparation series for adding a new trigger to
> drivers/power/supply/power_supply_leds.c which changes the color
> of a RGB LED depending on if the battery is discharging (LED off)
> charging (LED red) or full (LED green)
> 
> This is marked as RFC since the power_supply_leds.c changes have not
> been written yet and as such this is compile-tested only atm.
> The main goal of this RFC is to gather review feedback on the
> chosen approach in these 2 patches.
> 
> Regards,
> 
> Hans
> 
> 
> Hans de Goede (2):
>   leds: core: Add led_mc_set_brightness() function
>   leds: trigger: Add led_mc_trigger_event() function
> 
>  drivers/leds/led-class-multicolor.c |  1 +
>  drivers/leds/led-core.c             | 31 +++++++++++++++++++++++++++++
>  drivers/leds/led-triggers.c         | 20 +++++++++++++++++++
>  include/linux/leds.h                | 26 ++++++++++++++++++++++++
>  4 files changed, 78 insertions(+)

What is it you want me to do with this RFC patches Hans?
Kate Hsuan March 22, 2024, 3:43 a.m. UTC | #3
Hi,

On Fri, Mar 22, 2024 at 2:19 AM Lee Jones <lee@kernel.org> wrote:
>
> On Sat, 09 Mar 2024, Hans de Goede wrote:
>
> > Hi All,
> >
> > Here is a patch-series adding led_mc_set_brightness() and
> > led_mc_trigger_event() functions for changing multi-color LED colors
> > from inside the kernel.
> >
> > This is a preparation series for adding a new trigger to
> > drivers/power/supply/power_supply_leds.c which changes the color
> > of a RGB LED depending on if the battery is discharging (LED off)
> > charging (LED red) or full (LED green)
> >
> > This is marked as RFC since the power_supply_leds.c changes have not
> > been written yet and as such this is compile-tested only atm.
> > The main goal of this RFC is to gather review feedback on the
> > chosen approach in these 2 patches.
> >
> > Regards,
> >
> > Hans
> >
> >
> > Hans de Goede (2):
> >   leds: core: Add led_mc_set_brightness() function
> >   leds: trigger: Add led_mc_trigger_event() function
> >
> >  drivers/leds/led-class-multicolor.c |  1 +
> >  drivers/leds/led-core.c             | 31 +++++++++++++++++++++++++++++
> >  drivers/leds/led-triggers.c         | 20 +++++++++++++++++++
> >  include/linux/leds.h                | 26 ++++++++++++++++++++++++
> >  4 files changed, 78 insertions(+)
>
> What is it you want me to do with this RFC patches Hans?
>
> --
> Lee Jones [李琼斯]
>

This is used for the Xiaomi pad2 indicator LED to show the battery
status in a multi-color manner and it can be found in the following
URL.
https://lore.kernel.org/linux-leds/20240322033736.9344-1-hpa@redhat.com/T/#m577efb6549aeb29d2813faf8c51ed38e9e092598

Thank you