LP55231 LED Driver Not Detected

Hi!

I am trying to get an led driver working using an overlay.

   /* LED DRIVER LP55231 AT REG 0x32
   STATUS: DETECTED ON I2C BUS BUT DRIVER NOT LOADING
    */
   lp55231: led@32 {
      compatible = "ti,lp5523";
      reg = <0x32>;
      status = "okay";
      clock-mode = /bits/ 8 <1>; // 1: internal oscillator

      /* first multicolor led */
      multi-led@1 {
         #address-cells = <1>;
         #size-cells = <0>;
         reg = <0x1>;
         color = <LED_COLOR_ID_RGB>;
         function = LED_FUNCTION_STANDBY;
         linux,default-trigger = "heartbeat";

         led@0 {
            led-cur = /bits/ 8 <50>;
            max-cur = /bits/ 8 <100>;
            reg = <0x0>;
            color = <LED_COLOR_ID_GREEN>;
         };

         led@1 {
            led-cur = /bits/ 8 <50>;
            max-cur = /bits/ 8 <100>;
            reg = <0x1>;
            color = <LED_COLOR_ID_BLUE>;
         };

         led@6 {
            led-cur = /bits/ 8 <50>;
            max-cur = /bits/ 8 <100>;
            reg = <0x6>;
            color = <LED_COLOR_ID_RED>;
         };
      };

      /* second multicolor led */
      multi-led@2 {
         #address-cells = <1>;
         #size-cells = <0>;
         reg = <0x2>;
         color = <LED_COLOR_ID_RGB>;
         function = LED_FUNCTION_STANDBY;
         linux,default-trigger = "heartbeat";

         led@2 {
            led-cur = /bits/ 8 <50>;
            max-cur = /bits/ 8 <100>;
            reg = <0x2>;
            color = <LED_COLOR_ID_GREEN>;
         };

         led@3 {
            led-cur = /bits/ 8 <50>;
            max-cur = /bits/ 8 <100>;
            reg = <0x3>;
            color = <LED_COLOR_ID_BLUE>;
         };

         led@7 {
            led-cur = /bits/ 8 <50>;
            max-cur = /bits/ 8 <100>;
            reg = <0x7>;
            color = <LED_COLOR_ID_RED>;
         };
      };

      /* third multicolor led */
      multi-led@3 {
         #address-cells = <1>;
         #size-cells = <0>;
         reg = <0x3>;
         color = <LED_COLOR_ID_RGB>;
         function = LED_FUNCTION_STANDBY;
         linux,default-trigger = "heartbeat";

         led@4 {
            led-cur = /bits/ 8 <50>;
            max-cur = /bits/ 8 <100>;
            reg = <0x4>;
            color = <LED_COLOR_ID_GREEN>;
         };

         led@5 {
            led-cur = /bits/ 8 <50>;
            max-cur = /bits/ 8 <100>;
            reg = <0x5>;
            color = <LED_COLOR_ID_BLUE>;
         };

         led@8 {
            led-cur = /bits/ 8 <50>;
            max-cur = /bits/ 8 <100>;
            reg = <0x8>;
            color = <LED_COLOR_ID_RED>;
         };
      };
   };

the led driver is turned on using a gpio hog that enables the led driver during boot.

the driver is detected on the i2c bus on the 0x32 address, however, there is no indication of the driver being loaded or any messages in the dmesg log. the i2cdetect gives the following output:

torizon@verdin-imx8mm-14756428:~$ i2cdetect -y 3
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
20: -- UU 22 -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- 32 -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- UU -- -- -- -- -- -- -- -- UU UU -- -- -- --
70: -- -- -- -- -- -- -- --

Best Regards.

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello!

If the LP55231 LED driver is detected on the I2C bus but the driver is not loading, there are several steps you can take to troubleshoot and resolve the issue:

  1. Ensure Kernel Module is Present: Verify that the kernel module for the LP55231 driver (lp5523) is included in your kernel build. You can check if the module is available by looking in /lib/modules/$(uname -r)/kernel/drivers/leds/ directory or by using modinfo lp5523.

  2. Kernel Configuration: Make sure that the kernel configuration includes support for the LP55231 driver. This typically involves ensuring that CONFIG_LEDS_LP5523 (or a similarly named option) is enabled in your kernel configuration. You can check the current kernel configuration by examining the /proc/config.gz file if available.

  3. Device Tree Configuration: Double-check the device tree overlay you’ve created for any typos or incorrect properties. The compatible property should exactly match the driver’s supported compatible strings. For the LP55231, this should be "ti,lp5523" as you have correctly specified.

  4. I2C Bus Communication: Confirm that the I2C communication with the device is functioning correctly outside of the driver context. You can use tools like i2cdetect, i2cget, and i2cset from the i2c-tools package to probe the device and read/write registers.

  5. Driver Binding: If the driver is present in the kernel but not binding automatically, you might need to manually bind the driver to the device. This can be done through the sysfs bind and unbind interface in the /sys/bus/i2c/drivers/ directory.

  6. Kernel Log Messages: Even if there are no explicit messages in dmesg about the driver loading, look for any I2C related errors or warnings that might indicate communication issues or problems during the driver initialization phase.

  7. GPIO Hog Configuration: Verify the GPIO hog configuration that powers on the LED driver. Ensure that the GPIO is correctly defined in the device tree and that it transitions to the correct state (high or low as required) to power on the LP55231.

  8. Software Reset: Some devices may require a software reset or specific initialization sequence to be fully operational after power-up. Check the LP55231 datasheet for any such requirements and consider adding this initialization sequence either in

Please, also check if these links can help you solve your problem:

How to Write Device Tree Overlays | Toradex Developer Center.

now that I see the zcat /proc/config.gz, the flag is apparently not set :face_holding_back_tears:

torizon@verdin-imx8mm-14756428:~$ zcat /proc/config.gz | grep LP55
# CONFIG_LEDS_LP55XX_COMMON is not set

"Yes, drivers for the TI/National LP5523/55231 LED driver chip are not included in our build(s) and default configuration. You need to include

CONFIG_LEDS_LP55XX_COMMON=y
CONFIG_LEDS_LP5523=y

into your kernel config and rebuild it.

But I do not have the necessary skills. Last time someone added it to the nightly builds for me and i used that. Can you do the same?

Greetings @geopaxpvtltd,

What version of Torizon OS are you using here? We have had CONFIG_LEDS_LP55XX_COMMON enabled for quite some time now: features/leds: enable National Semiconductor LP5521 LED driver · toradex/toradex-kernel-cache@ab9ba47 · GitHub

Though we only have CONFIG_LEDS_LP5521 enabled. It seems your hardware here needs CONFIG_LEDS_LP5523 instead, correct? If that is the case we can enable this for you on the latest version of Torizon if that is what you want.

Best Regards,
Jeremias

Hi Jeremias

I am using 6.5.0 quarterly build without any containers.

My device is the ti,55321 but i believe the driver is the same for this and the national instruments one.

If it has been enabled then it should hav ebeen working.

I am using the following image
torizon-core-docker-verdin-imx8mm-Tezi_6.5.0-devel-20231228+build.467

Well if you look at the commit I linked prior you’ll see it’s dated January 25th 2024. The image you are using here looks it’s from December 2023. So obviously that’s why you’re not seeing these configs as enabled in the image you are using.

The latest release is 6.6.1, please use this as it has both CONFIG_LEDS_LP55XX_COMMON and CONFIG_LEDS_LP5521 enables as kernel modules.

My device is the ti,55321 but i believe the driver is the same for this and the national instruments one.

Okay so you don’t need CONFIG_LEDS_LP5523 then?

Best Regards,
Jeremias

1 Like

Thanks for pointing this out. I will try and let you know tomorrow!

This also depends on how it goes.

Thanks!

This also depends on how it goes.

Well please let us know whether you need additional kernel configs or not.

Best Regards,
Jeremias

Hi @jeremias.tx !

With the newest image with

configs enabled, the module is not loading. perhaps the

needs to be enabled. How can one be sure?

needs to be enabled. How can one be sure?

Did you update your device tree? In your original post you set compatible = "ti,lp5523";. This would invoke the driver corresponding to CONFIG_LEDS_LP5523. If you’re trying to use the driver corresponding to CONFIG_LEDS_LP5521 instead then you would need to update this compatible to the appropriate value.

Otherwise the only way to be sure would be to build a custom kernel with CONFIG_LEDS_LP5523 enabled and test to see if this driver actually works for your hardware peripheral here.

Best Regards,
Jeremias

Hi @jeremias.tx ,

Since the device i am using is ti,lp55231, i believe the CONFIG_LEDS_LP5523 is required.

the config with the name CONFIG_LEDS_LP55XX_COMMON loads a common module thatincludes other drivers as well such as the 5521 and 5523.

the ti,55231’s driver is the same as the 5523 (in the kernel files). so i believe the CONFIG_LEDS_LP5523 is required for it to work. (i tried without it and it didnt.)

You think you can enable that config?

You think you can enable that config?

Sure I can go ahead and make the request to enable CONFIG_LEDS_LP5523. I’ll let you know once there is an update.

Best Regards,
Jeremias

1 Like

Hello @geopaxpvtltd,

The CONFIG_LEDS_LP5523 has been enabled in Torizon OS.
To use an image with this configuration, you can download the latest nightly releases.

Best Regards,
Bruno

1 Like

Hi @bruno.tx !

I shall test it and report soon.

Best Regards.