This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Replies: 8
Views: 147
Part Number: LP5024
Hi TI Team,
We are using LP5024 IC, We have the source code from the below link and we are able to successfully compile it.
Now we are trying to create sys class entries for the same for accessing the led individual color from the "/sys/class/led". We followed the below link but not helping. Please how to edit the DTSI file so that we can create the individual node for each LED in sys/class/leds/.
Hello
The LP50xx driver has been accepted for upstream kernel for 5.10 and has a bit of a different interface.
Please refer to these patches which were applied for documentation and code.
Documentation
Code
Multicolor framework sysfs interface is described here
Dan
In reply to Dan Murphy:
I also forgot to mention that this new driver has a dependency on the Multicolor framework which can be found here.
git.kernel.org/.../led-class-multicolor.c
Hi Dan, Thanks for your reply.
Dan, as per your shared links I am using your driver "leds-lp50xx.c" as our device kernel is based on 4.17, have fixed the dependencies like
led-class-multicolor.c
led-class-multicolor.h
/include/dt-bindings/leds/common.h
/include/linux/leds.h
/include/linux/property.h
So now driver is budling.
But still not able to get the sys/class/leds entries:
Below is the dtsi entry I am using and getting this error, whatever entry I add.
/ # dmesg | grep lp50xx[ 4.674694] lp50xx 2-0028: 2-0028 supply vled not found, using dummy regulator[ 4.699646] lp50xx 2-0028: led register err: -22[ 4.709583] lp50xx: probe of 2-0028 failed with error -22
***************************************************************************
&i2c_2 { status = "ok"; qcom,clk-freq-out = <100000>; /* LP50XX LED Drivers */ led-controller@28 { compatible = "ti,lp5024"; reg = <0x28>; #address-cells = <1>; #size-cells = <0>; multi-led@1 { #address-cells = <1>; #size-cells = <0>; reg = <0x1>; color = <LED_COLOR_ID_RGB>; function = LED_FUNCTION_INDICATOR; led-0 { color = <LED_COLOR_ID_RED>; }; led-1 { color = <LED_COLOR_ID_GREEN>; }; led-2 { color = <LED_COLOR_ID_BLUE>; }; }; multi-led@2 { #address-cells = <1>; #size-cells = <0>; reg = <0x2>; color = <LED_COLOR_ID_RGB>; function = LED_FUNCTION_STANDBY; led-3 { color = <LED_COLOR_ID_RED>; }; led-4 { color = <LED_COLOR_ID_GREEN>; }; led-5 { color = <LED_COLOR_ID_BLUE>; }; }; }; };
Please suggest, is these entries are correct.
In reply to Kaushal Singh:
Try adding the reg for each LED entry like below
#address-cells = <1>; #size-cells = <0>; reg = <0>; color = <LED_COLOR_ID_RGB>; function = LED_FUNCTION_INDICATOR; led@0 { reg = <0>; color = <LED_COLOR_ID_RED>; };
led@1 { reg = <1>; color = <LED_COLOR_ID_GREEN>; };
led@2 { reg = <2>; color = <LED_COLOR_ID_BLUE>; };
The yaml may need to be updated
Hi Dan,
I have tried the changes you shared but the issue is still the same. Are you able to create the sysfs nodes with your side? If yes please share your changes.
Have you checked the boot log to see if you have any errors?
This DT worked for me.
I have checked the boot logs, no error and the issue is still there.
As you said, DT worked for you, could please share the other files too.
leds-lp50xx.c
DTSI file
The code I am using is here in staged for 5.10 kernel
led-controller@28 { #address-cells = <1>; #size-cells = <0>; compatible = "ti,lp5024"; reg = <0x28>; multi-led@0 { #address-cells = <1>; #size-cells = <0>; reg = <0>; color = <LED_COLOR_ID_RGB>; function = LED_FUNCTION_ACTIVITY; led@0 { reg = <0>; color = <LED_COLOR_ID_RED>; }; led@1 { reg = <1>; color = <LED_COLOR_ID_GREEN>; }; led@2 { reg = <2>; color = <LED_COLOR_ID_BLUE>; }; }; multi-led@1 { #address-cells = <1>; #size-cells = <0>; reg = <0x1>; color = <LED_COLOR_ID_RGB>; function = LED_FUNCTION_CHARGING; led-0 { color = <LED_COLOR_ID_RED>; }; led-1 { color = <LED_COLOR_ID_GREEN>; }; led-2 { color = <LED_COLOR_ID_BLUE>; }; }; multi-led@2 { #address-cells = <1>; #size-cells = <0>; reg = <2 3 5>; color = <LED_COLOR_ID_RGB>; function = LED_FUNCTION_STANDBY; led-6 { color = <LED_COLOR_ID_RED>; }; led-7 { color = <LED_COLOR_ID_GREEN>; }; led-8 { color = <LED_COLOR_ID_BLUE>; }; }; multi-led@4 { #address-cells = <1>; #size-cells = <0>; reg = <4>; color = <LED_COLOR_ID_RGB>; function = LED_FUNCTION_PANIC; led@12 { reg = <0x12>; color = <LED_COLOR_ID_RED>; }; led@13 { reg = <0x13>; color = <LED_COLOR_ID_GREEN>; }; led@14 { reg = <0x14>; color = <LED_COLOR_ID_BLUE>; }; }; };