Re: Clarification regarding multicolor leds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Luca

On 10/24/20 4:16 AM, Luca Weiss wrote:
Hi Alex,

On Samstag, 24. Oktober 2020 08:42:38 CEST Alexander Dahl wrote:
Hello Luca,

On Sat, Oct 24, 2020 at 12:48:42AM +0200, Luca Weiss wrote:
I'm currently experimenting with the qcom lpg[0] which is a driver for the
rgb notification led found on e.g. Snapdragon 801 devices (and many
more), specifically my example is about the Fairphone 2
(msm8974-fairphone-fp2).
Great to hear someone is interested in mainline support for Fairphone.
I just bought a used FP2 on ebay. :-)

[0]
https://lore.kernel.org/lkml/20201021201224.3430546-1-bjorn.andersson@lin
aro.org/>
My dts is looking like the following (abbreviated):
     [in lpg node]
     multi-led {
color = <LED_COLOR_ID_MULTI>;
         function = LED_FUNCTION_STATUS;
         ....
};

I'm comparing this to the PinePhone where the leds are defined as follows:
     [in gpio-leds node]
     blue {
function = LED_FUNCTION_INDICATOR;
         color = <LED_COLOR_ID_BLUE>;
}; green { function = LED_FUNCTION_INDICATOR;
         color = <LED_COLOR_ID_GREEN>;
}; red { function = LED_FUNCTION_INDICATOR;
         color = <LED_COLOR_ID_RED>;
};

(sidenote: the LED_FUNCTION_INDICATOR should probably also be
LED_FUNCTION_STATUS there; the dts was made before the better descriptions
for the defines have been added)

This gets the following directories created in /sys/class/leds/:
     blue:indicator
     green:indicator
     red:indicator
That's right.  From Linux point of view these behave like three
independent LEDs.  It's fully up to userspace to handle this.
Exactly, that I understand well.

But with the multicolor led on the Fairphone 2 only a directory with the
name of "multi-led" gets created which I would have expected to be
"multicolor:status" instead.
Obviously it's named after the node label.  If I read
Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
correctly, that's how it is supposed to be named?

That's from the i read from the documentation as well.

How is user space supposed to get function and/or color from the led? I don't
see it exposed in user space - apart from the directory name (label) in the
leds-gpio example.

This is what I get in sysfs for the multicolor led with the lpg driver:

     brightness
     device -> ../../../fc4cf000.spmi:pm8941@1:lpg
     max_brightness
     multi_index

If you refer to the ABI doc you see that by reading the multi_index file gives you the colors contained within the file.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/testing/sysfs-class-led-multicolor

Dan




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux