Re: [PATCH 1/2] leds: Add Intel Cherry Trail Whiskey Cove PMIC LEDs

From: Pavel Machek
Date: Mon Feb 11 2019 - 08:17:32 EST


Hi!

> +static struct cht_wc_led cht_wc_leds[] = {
> + {
> + .name = "pmic::charge",
> + .ctrl_reg = CHT_WC_LED1_CTRL,
> + .fsm_reg = CHT_WC_LED1_FSM,
> + .pwm_reg = CHT_WC_LED1_PWM,
> + .enable_mask = CHT_WC_LED1_ON,
> + },
> + {
> + .name = "pmic::gpled",
> + .ctrl_reg = CHT_WC_LED2_CTRL,
> + .fsm_reg = CHT_WC_LED2_FSM,
> + .pwm_reg = CHT_WC_LED2_PWM,
> + .enable_mask = CHT_WC_LED2_ON,
> + },
> +};

Unfortunately, these LED names will not be too useful for
userspace. What about "platform::charging" and "status-led::"?

Should we have some default triggers?
Pavel

-*- org -*-

It is somehow important to provide consistent interface to the
userland. LED devices have one problem there, and that is naming of
directories in /sys/class/leds. It would be nice if userland would
just know right "name" for given LED function, but situation got more
complex.

Anyway, if backwards compatibility is not an issue, new code should
use one of the "good" names from this list, and you should extend the
list where applicable.

Bad names are listed, too, in case you are writing application that
wants to use particular feature, you should probe for good name first
but then try the bad ones, too".

* Keyboards

Good: "input*:*:capslock"
Good: "input*:*:scrolllock"
Good: "input*:*:numlock"
Bad: "shift-key-light" (Motorola Droid 4, capslock)

Set of common keyboard LEDs, going back to PC AT or so.

Bad: "tpacpi::thinklight" (IBM/Lenovo Thinkpads)
Bad: "lp5523:kb{1,2,3,4,5,6}" (Nokia N900)

Frontlight/backlight of main keyboard.

Bad: "button-backlight" (Motorola Droid 4)

Some phones have touch buttons below screen; it is different from main
keyboard. And this is their backlight.

* Sound subsystem

Good: "platform:*:mute"
Good: "platform:*:micmute"

LEDs on notebook body, indicating that sound input / output is muted.

* System notification

Good: "status-led:{red,green,blue}" (Motorola Droid 4)
Bad: "lp5523:{r,g,b}" (Nokia N900)

Phones usually have multi-color status LED.



--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature