aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Problems with overlay for TI TLC59116

Sat Jul 24, 2021 12:21 pm

I'm trying to write an overlay for using TLC59116 I2C 16-channel LED driver https://www.ti.com/product/TLC59116
A kernel driver is available (under LEDs) and I've enabled it when compiling my kernel.

I'm now struggling to get the overlay working and would like to have some feedback on possible root cause. The device is connected to the I2C bus and is probed, strange thing is that it's address (0x68h) is neither shown, nor claimed by the kernel (UU shown)

Here is the overlay source:

Code: Select all

/*
 * i2C-led-tlc59116-overlay.dts
 */

/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&i2c_csi_dsi>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;

			tlc59116@34{
				#address-cells = <1>;
				#size-cells = <0>;
				compatible = "ti,tlc59116";
				reg = <0x34>;

				ledr1@0 {
					label = "led1:red";
					reg = <0x0>;
				};

				ledr2@4 {
					label = "led2:red";
					reg = <0x4>;
				};

				ledr3@8 {
					label = "led3:red";
					reg = <0x8>;
					linux,default_trigger = "default-on";
				};
			};
		};
	};

	fragment@1 {
		target = <&i2c0if>;
		__overlay__ {
			status = "okay";
		};
	};
		
	fragment@2 {
		target = <&i2c0mux>;
		__overlay__ {
			status = "okay";
		};
	};
};
and here is some debug info (platform is a CM3+CM3IO)

Code: Select all

pi@raspberrypi:~ $ raspi-gpio get
BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=0 func=INPUT
GPIO 1: level=1 fsel=0 func=INPUT
GPIO 2: level=0 fsel=1 func=OUTPUT
GPIO 3: level=0 fsel=1 func=OUTPUT
GPIO 4: level=1 fsel=0 func=INPUT
GPIO 5: level=1 fsel=0 func=INPUT
GPIO 6: level=1 fsel=0 func=INPUT
GPIO 7: level=1 fsel=0 func=INPUT
GPIO 8: level=1 fsel=0 func=INPUT
GPIO 9: level=0 fsel=0 func=INPUT
GPIO 10: level=0 fsel=0 func=INPUT
GPIO 11: level=0 fsel=0 func=INPUT
GPIO 12: level=0 fsel=0 func=INPUT
GPIO 13: level=0 fsel=0 func=INPUT
GPIO 14: level=0 fsel=0 func=INPUT
GPIO 15: level=1 fsel=0 func=INPUT
GPIO 16: level=0 fsel=0 func=INPUT
GPIO 17: level=0 fsel=0 func=INPUT
GPIO 18: level=0 fsel=0 func=INPUT
GPIO 19: level=0 fsel=0 func=INPUT
GPIO 20: level=0 fsel=0 func=INPUT
GPIO 21: level=0 fsel=0 func=INPUT
GPIO 22: level=0 fsel=0 func=INPUT
GPIO 23: level=0 fsel=0 func=INPUT
GPIO 24: level=0 fsel=0 func=INPUT
GPIO 25: level=0 fsel=0 func=INPUT
GPIO 26: level=0 fsel=0 func=INPUT
GPIO 27: level=0 fsel=0 func=INPUT
BANK1 (GPIO 28 to 45):
GPIO 28: level=1 fsel=4 alt=0 func=SDA0
GPIO 29: level=1 fsel=4 alt=0 func=SCL0
GPIO 30: level=0 fsel=0 func=INPUT
GPIO 31: level=0 fsel=0 func=INPUT
GPIO 32: level=0 fsel=0 func=INPUT
GPIO 33: level=0 fsel=0 func=INPUT
GPIO 34: level=1 fsel=0 func=INPUT
GPIO 35: level=1 fsel=0 func=INPUT
GPIO 36: level=1 fsel=0 func=INPUT
GPIO 37: level=0 fsel=0 func=INPUT
GPIO 38: level=0 fsel=0 func=INPUT
GPIO 39: level=0 fsel=0 func=INPUT
GPIO 40: level=0 fsel=0 func=INPUT
GPIO 41: level=0 fsel=0 func=INPUT
GPIO 42: level=0 fsel=0 func=INPUT
GPIO 43: level=0 fsel=0 func=INPUT
GPIO 44: level=0 fsel=0 func=INPUT
GPIO 45: level=0 fsel=0 func=INPUT
BANK2 (GPIO 46 to 53):
GPIO 46: level=1 fsel=0 func=INPUT
GPIO 47: level=1 fsel=1 func=OUTPUT
GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK
GPIO 49: level=1 fsel=4 alt=0 func=SD0_CMD
GPIO 50: level=1 fsel=4 alt=0 func=SD0_DAT0
GPIO 51: level=1 fsel=4 alt=0 func=SD0_DAT1
GPIO 52: level=1 fsel=4 alt=0 func=SD0_DAT2
GPIO 53: level=1 fsel=4 alt=0 func=SD0_DAT3
pi@raspberrypi:~ $ grep tlc59116 /lib/modules/`uname -r`/*
grep: /lib/modules/5.10.52-v7+/build: Is a directory
grep: /lib/modules/5.10.52-v7+/kernel: Is a directory
/lib/modules/5.10.52-v7+/modules.alias:alias of:N*T*Cti,tlc59116C* leds_tlc591xx
/lib/modules/5.10.52-v7+/modules.alias:alias of:N*T*Cti,tlc59116 leds_tlc591xx
/lib/modules/5.10.52-v7+/modules.alias:alias i2c:tlc59116 leds_tlc591xx
grep: /lib/modules/5.10.52-v7+/source: Is a directory
pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: 60 -- -- -- -- -- -- -- -- -- -- 6b -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.52-v7+ #1 SMP Fri Jul 23 09:50:12 CEST 2021 armv7l GNU/Linux
pi@raspberrypi:~ $ 
Any feedback is welcome!

aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Re: Problems with overlay for TI TLC59116

Sat Jul 24, 2021 1:46 pm

aBUGSworstnightmare wrote:
Sat Jul 24, 2021 12:21 pm
I'm trying to write an overlay for using TLC59116 I2C 16-channel LED driver https://www.ti.com/product/TLC59116
A kernel driver is available (under LEDs) and I've enabled it when compiling my kernel.

I'm now struggling to get the overlay working and would like to have some feedback on possible root cause. The device is connected to the I2C bus and is probed, strange thing is that it's address (0x68h) is neither shown, nor claimed by the kernel (UU shown)

Here is the overlay source:

Code: Select all

/*
 * i2C-led-tlc59116-overlay.dts
 */

/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&i2c_csi_dsi>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;

			tlc59116@68{
				#address-cells = <1>;
				#size-cells = <0>;
				compatible = "ti,tlc59116";
				reg = <0x68>;

				ledr1@0 {
					label = "led1:red";
					reg = <0x0>;
				};

				ledr2@4 {
					label = "led2:red";
					reg = <0x4>;
				};

				ledr3@8 {
					label = "led3:red";
					reg = <0x8>;
					linux,default_trigger = "default-on";
				};
			};
		};
	};

	fragment@1 {
		target = <&i2c0if>;
		__overlay__ {
			status = "okay";
		};
	};
		
	fragment@2 {
		target = <&i2c0mux>;
		__overlay__ {
			status = "okay";
		};
	};
};
and here is some debug info (platform is a CM3+CM3IO)

Code: Select all

pi@raspberrypi:~ $ raspi-gpio get
BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=0 func=INPUT
GPIO 1: level=1 fsel=0 func=INPUT
GPIO 2: level=0 fsel=1 func=OUTPUT
GPIO 3: level=0 fsel=1 func=OUTPUT
GPIO 4: level=1 fsel=0 func=INPUT
GPIO 5: level=1 fsel=0 func=INPUT
GPIO 6: level=1 fsel=0 func=INPUT
GPIO 7: level=1 fsel=0 func=INPUT
GPIO 8: level=1 fsel=0 func=INPUT
GPIO 9: level=0 fsel=0 func=INPUT
GPIO 10: level=0 fsel=0 func=INPUT
GPIO 11: level=0 fsel=0 func=INPUT
GPIO 12: level=0 fsel=0 func=INPUT
GPIO 13: level=0 fsel=0 func=INPUT
GPIO 14: level=0 fsel=0 func=INPUT
GPIO 15: level=1 fsel=0 func=INPUT
GPIO 16: level=0 fsel=0 func=INPUT
GPIO 17: level=0 fsel=0 func=INPUT
GPIO 18: level=0 fsel=0 func=INPUT
GPIO 19: level=0 fsel=0 func=INPUT
GPIO 20: level=0 fsel=0 func=INPUT
GPIO 21: level=0 fsel=0 func=INPUT
GPIO 22: level=0 fsel=0 func=INPUT
GPIO 23: level=0 fsel=0 func=INPUT
GPIO 24: level=0 fsel=0 func=INPUT
GPIO 25: level=0 fsel=0 func=INPUT
GPIO 26: level=0 fsel=0 func=INPUT
GPIO 27: level=0 fsel=0 func=INPUT
BANK1 (GPIO 28 to 45):
GPIO 28: level=1 fsel=4 alt=0 func=SDA0
GPIO 29: level=1 fsel=4 alt=0 func=SCL0
GPIO 30: level=0 fsel=0 func=INPUT
GPIO 31: level=0 fsel=0 func=INPUT
GPIO 32: level=0 fsel=0 func=INPUT
GPIO 33: level=0 fsel=0 func=INPUT
GPIO 34: level=1 fsel=0 func=INPUT
GPIO 35: level=1 fsel=0 func=INPUT
GPIO 36: level=1 fsel=0 func=INPUT
GPIO 37: level=0 fsel=0 func=INPUT
GPIO 38: level=0 fsel=0 func=INPUT
GPIO 39: level=0 fsel=0 func=INPUT
GPIO 40: level=0 fsel=0 func=INPUT
GPIO 41: level=0 fsel=0 func=INPUT
GPIO 42: level=0 fsel=0 func=INPUT
GPIO 43: level=0 fsel=0 func=INPUT
GPIO 44: level=0 fsel=0 func=INPUT
GPIO 45: level=0 fsel=0 func=INPUT
BANK2 (GPIO 46 to 53):
GPIO 46: level=1 fsel=0 func=INPUT
GPIO 47: level=1 fsel=1 func=OUTPUT
GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK
GPIO 49: level=1 fsel=4 alt=0 func=SD0_CMD
GPIO 50: level=1 fsel=4 alt=0 func=SD0_DAT0
GPIO 51: level=1 fsel=4 alt=0 func=SD0_DAT1
GPIO 52: level=1 fsel=4 alt=0 func=SD0_DAT2
GPIO 53: level=1 fsel=4 alt=0 func=SD0_DAT3
pi@raspberrypi:~ $ grep tlc59116 /lib/modules/`uname -r`/*
grep: /lib/modules/5.10.52-v7+/build: Is a directory
grep: /lib/modules/5.10.52-v7+/kernel: Is a directory
/lib/modules/5.10.52-v7+/modules.alias:alias of:N*T*Cti,tlc59116C* leds_tlc591xx
/lib/modules/5.10.52-v7+/modules.alias:alias of:N*T*Cti,tlc59116 leds_tlc591xx
/lib/modules/5.10.52-v7+/modules.alias:alias i2c:tlc59116 leds_tlc591xx
grep: /lib/modules/5.10.52-v7+/source: Is a directory
pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: 60 -- -- -- -- -- -- -- -- -- -- 6b -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.52-v7+ #1 SMP Fri Jul 23 09:50:12 CEST 2021 armv7l GNU/Linux
pi@raspberrypi:~ $ 
Any feedback is welcome!

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4069
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Problems with overlay for TI TLC59116

Sat Jul 24, 2021 1:57 pm

Let's start with a few simple questions:
1. Which GPIO pins is the device connected to?
2. Do you have any external pull-ups fitted?
3. Can you account for the other devices (0x60 and 0x6b)?
4. Should the other devices be on the same bus (group of pins)?

aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Re: Problems with overlay for TI TLC59116

Sat Jul 24, 2021 3:15 pm

PhilE wrote:
Sat Jul 24, 2021 1:57 pm
Let's start with a few simple questions:
1. Which GPIO pins is the device connected to?
GPIO28 and GPIO29; i'm loading the disp1-cam1 dt-blob to https://datasheets.raspberrypi.org/cmio ... 1-cam1.dts to configure GPIO for I2C0. Need that device on the same bus as DSI interface is configured/connected to (will serve as backlight controller).
PhilE wrote:
Sat Jul 24, 2021 1:57 pm
2. Do you have any external pull-ups fitted?
Yes, 4k7 to 3.3V
PhilE wrote:
Sat Jul 24, 2021 1:57 pm
3. Can you account for the other devices (0x60 and 0x6b)?
that device has several I2C addresses, as well as possible sub-addresses. These two are the all-call and software reset call address. My slave address is 0b0110000=0x68h (configure by HW). The device shows up with all three addresses with 'dtparam=i2c_vc=on' added to config.txt and my new overlay not loaded).
PhilE wrote:
Sat Jul 24, 2021 1:57 pm
4. Should the other devices be on the same bus (group of pins)?
see 3.

I think I also need to include https://github.com/torvalds/linux/blob/ ... s/common.h but not sure.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11650
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Problems with overlay for TI TLC59116

Sat Jul 24, 2021 8:32 pm

aBUGSworstnightmare wrote:
Sat Jul 24, 2021 3:15 pm
PhilE wrote:
Sat Jul 24, 2021 1:57 pm
Let's start with a few simple questions:
1. Which GPIO pins is the device connected to?
GPIO28 and GPIO29; i'm loading the disp1-cam1 dt-blob to https://datasheets.raspberrypi.org/cmio ... 1-cam1.dts to configure GPIO for I2C0. Need that device on the same bus as DSI interface is configured/connected to (will serve as backlight controller).
Don't!

dt-blob.bin configures FIRMWARE resources, not kernel.
bcm2710-rpi-cm3 defines the GPIOs that are used for the BSC0 mux as being 0&1 and 28&29 on that platform.
If the firmware has left the wrong set of pins muxed for BSC0 then the kernel is not guaranteed to disable them all, and it can miss devices during boot due to double muxing.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Re: Problems with overlay for TI TLC59116

Sun Jul 25, 2021 1:27 pm

6by9 wrote:
Sat Jul 24, 2021 8:32 pm
Don't!

dt-blob.bin configures FIRMWARE resources, not kernel.
bcm2710-rpi-cm3 defines the GPIOs that are used for the BSC0 mux as being 0&1 and 28&29 on that platform.
If the firmware has left the wrong set of pins muxed for BSC0 then the kernel is not guaranteed to disable them all, and it can miss devices during boot due to double muxing.
Thanks for the pointer with the blob; was so used to that's one is needed...

o.k., started from scratch with a new uSD and a freshly compiled kernel. TLC59116 was enabled by 'make menuconfig', no other changes made to the config.

After the new kernel was compiled/installed I've check the I2C bus for the device, 'dtparam=i2c_vc=on' is added to my config.txt and I get below outputs:

Code: Select all

pi@raspberrypi:~ $ raspi-gpio get
BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=0 func=INPUT
GPIO 1: level=1 fsel=0 func=INPUT
GPIO 2: level=1 fsel=0 func=INPUT
GPIO 3: level=1 fsel=0 func=INPUT
GPIO 4: level=1 fsel=0 func=INPUT
GPIO 5: level=1 fsel=0 func=INPUT
GPIO 6: level=1 fsel=0 func=INPUT
GPIO 7: level=1 fsel=0 func=INPUT
GPIO 8: level=1 fsel=0 func=INPUT
GPIO 9: level=0 fsel=0 func=INPUT
GPIO 10: level=0 fsel=0 func=INPUT
GPIO 11: level=0 fsel=0 func=INPUT
GPIO 12: level=0 fsel=0 func=INPUT
GPIO 13: level=0 fsel=0 func=INPUT
GPIO 14: level=0 fsel=0 func=INPUT
GPIO 15: level=1 fsel=0 func=INPUT
GPIO 16: level=0 fsel=0 func=INPUT
GPIO 17: level=0 fsel=0 func=INPUT
GPIO 18: level=0 fsel=0 func=INPUT
GPIO 19: level=0 fsel=0 func=INPUT
GPIO 20: level=0 fsel=0 func=INPUT
GPIO 21: level=0 fsel=0 func=INPUT
GPIO 22: level=0 fsel=0 func=INPUT
GPIO 23: level=0 fsel=0 func=INPUT
GPIO 24: level=0 fsel=0 func=INPUT
GPIO 25: level=0 fsel=0 func=INPUT
GPIO 26: level=0 fsel=0 func=INPUT
GPIO 27: level=0 fsel=0 func=INPUT
BANK1 (GPIO 28 to 45):
GPIO 28: level=1 fsel=0 func=INPUT
GPIO 29: level=1 fsel=0 func=INPUT
GPIO 30: level=0 fsel=0 func=INPUT
GPIO 31: level=0 fsel=0 func=INPUT
GPIO 32: level=0 fsel=0 func=INPUT
GPIO 33: level=0 fsel=0 func=INPUT
GPIO 34: level=1 fsel=0 func=INPUT
GPIO 35: level=1 fsel=0 func=INPUT
GPIO 36: level=1 fsel=0 func=INPUT
GPIO 37: level=0 fsel=0 func=INPUT
GPIO 38: level=0 fsel=0 func=INPUT
GPIO 39: level=0 fsel=0 func=INPUT
GPIO 40: level=0 fsel=0 func=INPUT
GPIO 41: level=0 fsel=0 func=INPUT
GPIO 42: level=0 fsel=0 func=INPUT
GPIO 43: level=0 fsel=0 func=INPUT
GPIO 44: level=0 fsel=0 func=INPUT
GPIO 45: level=0 fsel=0 func=INPUT
BANK2 (GPIO 46 to 53):
GPIO 46: level=1 fsel=0 func=INPUT
GPIO 47: level=1 fsel=1 func=OUTPUT
GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK
GPIO 49: level=1 fsel=4 alt=0 func=SD0_CMD
GPIO 50: level=1 fsel=4 alt=0 func=SD0_DAT0
GPIO 51: level=1 fsel=4 alt=0 func=SD0_DAT1
GPIO 52: level=1 fsel=4 alt=0 func=SD0_DAT2
GPIO 53: level=1 fsel=4 alt=0 func=SD0_DAT3
pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: 60 -- -- -- -- -- -- -- 68 -- -- 6b -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.52-v7+ #1 SMP Sun Jul 25 12:39:29 CEST 2021 armv7l GNU/Linux
pi@raspberrypi:~ $ 
Device is connected, and can be detected; I2C address of interrest is 0x68h.

I did some digging in the devicetree documentation and came to the conclusion that I need to improve/change my overlay. New overlay is:

Code: Select all

/*
 * i2c-led-tlc59116-overlay.dts
 */

/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&i2c_csi_dsi>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;

			led-controller@68{
				#address-cells = <1>;
				#size-cells = <0>;
				compatible = "ti,tlc59116";
				reg = <0x68>;

				led@0 {
					reg = <0>;
					function = LED_FUNCTION_BACKLIGHT;
					color = <LED_COLOR_ID_WHITE>;
					linux,default-trigger = "backlight";
				};

				led@4 {
					reg = <4>;
					function = LED_FUNCTION_BACKLIGHT;
					color = <LED_COLOR_ID_WHITE>;
					linux,default-trigger = "backlight";
				};

				led@8 {
					reg = <8>;
					function = LED_FUNCTION_INDICATOR;
					color = <LED_COLOR_ID_RED>;
				};
				
				led@13 {
					reg = <13>;
					function = LED_FUNCTION_INDICATOR;
					color = <LED_COLOR_ID_GREEN>;
					linux,default-trigger = "default-on";
				};
			};
		};
	};

	fragment@1 {
		target = <&i2c0if>;
		__overlay__ {
			status = "okay";
		};
	};
		
	fragment@2 {
		target = <&i2c0mux>;
		__overlay__ {
			status = "okay";
		};
	};
};
Compiles fine! Added to config.txt while 'dtparam=i2c_vc=on' get's removed and reboot.
Checking same as above now no longer lists address 0x68h as you can see from below:

Code: Select all

pi@raspberrypi:~ $ raspi-gpio get
BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=0 func=INPUT
GPIO 1: level=1 fsel=0 func=INPUT
GPIO 2: level=1 fsel=0 func=INPUT
GPIO 3: level=1 fsel=0 func=INPUT
GPIO 4: level=1 fsel=0 func=INPUT
GPIO 5: level=1 fsel=0 func=INPUT
GPIO 6: level=1 fsel=0 func=INPUT
GPIO 7: level=1 fsel=0 func=INPUT
GPIO 8: level=1 fsel=0 func=INPUT
GPIO 9: level=0 fsel=0 func=INPUT
GPIO 10: level=0 fsel=0 func=INPUT
GPIO 11: level=0 fsel=0 func=INPUT
GPIO 12: level=0 fsel=0 func=INPUT
GPIO 13: level=0 fsel=0 func=INPUT
GPIO 14: level=0 fsel=0 func=INPUT
GPIO 15: level=1 fsel=0 func=INPUT
GPIO 16: level=0 fsel=0 func=INPUT
GPIO 17: level=0 fsel=0 func=INPUT
GPIO 18: level=0 fsel=0 func=INPUT
GPIO 19: level=0 fsel=0 func=INPUT
GPIO 20: level=0 fsel=0 func=INPUT
GPIO 21: level=0 fsel=0 func=INPUT
GPIO 22: level=0 fsel=0 func=INPUT
GPIO 23: level=0 fsel=0 func=INPUT
GPIO 24: level=0 fsel=0 func=INPUT
GPIO 25: level=0 fsel=0 func=INPUT
GPIO 26: level=0 fsel=0 func=INPUT
GPIO 27: level=0 fsel=0 func=INPUT
BANK1 (GPIO 28 to 45):
GPIO 28: level=1 fsel=4 alt=0 func=SDA0
GPIO 29: level=1 fsel=4 alt=0 func=SCL0
GPIO 30: level=0 fsel=0 func=INPUT
GPIO 31: level=0 fsel=0 func=INPUT
GPIO 32: level=0 fsel=0 func=INPUT
GPIO 33: level=0 fsel=0 func=INPUT
GPIO 34: level=1 fsel=0 func=INPUT
GPIO 35: level=1 fsel=0 func=INPUT
GPIO 36: level=1 fsel=0 func=INPUT
GPIO 37: level=0 fsel=0 func=INPUT
GPIO 38: level=0 fsel=0 func=INPUT
GPIO 39: level=0 fsel=0 func=INPUT
GPIO 40: level=0 fsel=0 func=INPUT
GPIO 41: level=0 fsel=0 func=INPUT
GPIO 42: level=0 fsel=0 func=INPUT
GPIO 43: level=0 fsel=0 func=INPUT
GPIO 44: level=0 fsel=0 func=INPUT
GPIO 45: level=0 fsel=0 func=INPUT
BANK2 (GPIO 46 to 53):
GPIO 46: level=1 fsel=0 func=INPUT
GPIO 47: level=1 fsel=1 func=OUTPUT
GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK
GPIO 49: level=1 fsel=4 alt=0 func=SD0_CMD
GPIO 50: level=1 fsel=4 alt=0 func=SD0_DAT0
GPIO 51: level=1 fsel=4 alt=0 func=SD0_DAT1
GPIO 52: level=1 fsel=4 alt=0 func=SD0_DAT2
GPIO 53: level=1 fsel=4 alt=0 func=SD0_DAT3
pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: 60 -- -- -- -- -- -- -- -- -- -- 6b -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@raspberrypi:~ $ grep tlc59116 /lib/modules/`uname -r`/*
grep: /lib/modules/5.10.52-v7+/build: Is a directory
grep: /lib/modules/5.10.52-v7+/kernel: Is a directory
/lib/modules/5.10.52-v7+/modules.alias:alias of:N*T*Cti,tlc59116C* leds_tlc591xx
/lib/modules/5.10.52-v7+/modules.alias:alias of:N*T*Cti,tlc59116 leds_tlc591xx
/lib/modules/5.10.52-v7+/modules.alias:alias i2c:tlc59116 leds_tlc591xx
grep: /lib/modules/5.10.52-v7+/source: Is a directory
pi@raspberrypi:~ $ 
My 'confg.txt' looks like:

Code: Select all

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_vc=on

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[cm4]
# ---------------------------------------------
# select WiFi antenna on CM4
# ant1 = internal
# ant2 = external
# ---------------------------------------------
dtparam=ant2
# ---------------------------------------------
# enable USB in host mode on CM4
# ---------------------------------------------
dtoverlay=dwc2,dr_mode=host
# ---------------------------------------------
# uncomment to enable overclocking for RPi4/CM4/Pi400
# ---------------------------------------------
over_voltage=6
arm_freq=2000

[pi3]
# ---------------------------------------------
 uncomment to enable overclocking RPI CM3L
# ---------------------------------------------
over_voltage=5
arm_freq=1350

[pi4]
# ---------------------------------------------
# uncomment to enable overclocking for RPi4
# ---------------------------------------------
over_voltage=6
arm_freq=2000

[all]
# ignore the official DSI display
ignore_lcd=1
dtoverlay=vc4-fkms-v3d
#dtoverlay=vc4-kms-v3d
#max_framebuffers=1
#dtoverlay=vc4-kms-dpi-at056tn53v1
#gpio=19=op,dh

# settings for MANGA SCREEN 2
hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080
hdmi_group=2
hdmi_mode=87
max_framebuffer_height=1920
# ---------------------------------------------
# HDMI timing definitions
# ---------------------------------------------
hdmi_timings=1080 1 100 10 50 1920 1 2 2 2 0 0 0 60 0 144400000 3

# alternative settings for at056tn53v1 when using FKMS
#dtoverlay=dpi18cpadhi
#gpio=0-9=a2
#gpio=12-17=a2
#gpio=20-25=a2
#enable_dpi_lcd=1
#dpi_group=2
#dpi_mode=87
#dpi_output_format=98342
#dpi_timings=640 0 16 10 134 480 0 32 2 11 0 0 0 60 0 39700000 1

dtoverlay=i2c-led-tlc59116

start_x=1
gpu_mem=128
enable_uart=0
Questions:
- why is 0x68h disappearing when my overlay is loaded?
- is the overlay correct or what prevents it from being applied?

aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Re: Problems with overlay for TI TLC59116

Mon Jul 26, 2021 12:36 pm

Spend some time today on another FRESH kernel compile, making sure only 'PWM driver LED support' and 'TLC59116' got added to the kernel config (wasn't 100% on the kernel build done yesterday), but still the same bad result: 0x68h is not there anymore!

What makes it worse is the fact that I've added 'dtdebug=1' to my config.txt but this only gives me a strange error message on this kernel revision.

Code: Select all

pi@raspberrypi:~ $ raspi-gpio get
BANK0 (GPIO 0 to 27):
GPIO 0: level=1 fsel=0 func=INPUT
GPIO 1: level=1 fsel=0 func=INPUT
GPIO 2: level=1 fsel=0 func=INPUT
GPIO 3: level=1 fsel=0 func=INPUT
GPIO 4: level=1 fsel=0 func=INPUT
GPIO 5: level=1 fsel=0 func=INPUT
GPIO 6: level=1 fsel=0 func=INPUT
GPIO 7: level=1 fsel=0 func=INPUT
GPIO 8: level=1 fsel=0 func=INPUT
GPIO 9: level=0 fsel=0 func=INPUT
GPIO 10: level=0 fsel=0 func=INPUT
GPIO 11: level=0 fsel=0 func=INPUT
GPIO 12: level=0 fsel=0 func=INPUT
GPIO 13: level=0 fsel=0 func=INPUT
GPIO 14: level=0 fsel=0 func=INPUT
GPIO 15: level=1 fsel=0 func=INPUT
GPIO 16: level=0 fsel=0 func=INPUT
GPIO 17: level=0 fsel=0 func=INPUT
GPIO 18: level=0 fsel=0 func=INPUT
GPIO 19: level=0 fsel=0 func=INPUT
GPIO 20: level=0 fsel=0 func=INPUT
GPIO 21: level=0 fsel=0 func=INPUT
GPIO 22: level=0 fsel=0 func=INPUT
GPIO 23: level=0 fsel=0 func=INPUT
GPIO 24: level=0 fsel=0 func=INPUT
GPIO 25: level=0 fsel=0 func=INPUT
GPIO 26: level=0 fsel=0 func=INPUT
GPIO 27: level=0 fsel=0 func=INPUT
BANK1 (GPIO 28 to 45):
GPIO 28: level=1 fsel=4 alt=0 func=SDA0
GPIO 29: level=1 fsel=4 alt=0 func=SCL0
GPIO 30: level=0 fsel=0 func=INPUT
GPIO 31: level=0 fsel=0 func=INPUT
GPIO 32: level=0 fsel=0 func=INPUT
GPIO 33: level=0 fsel=0 func=INPUT
GPIO 34: level=1 fsel=0 func=INPUT
GPIO 35: level=1 fsel=0 func=INPUT
GPIO 36: level=1 fsel=0 func=INPUT
GPIO 37: level=0 fsel=0 func=INPUT
GPIO 38: level=0 fsel=0 func=INPUT
GPIO 39: level=0 fsel=0 func=INPUT
GPIO 40: level=0 fsel=0 func=INPUT
GPIO 41: level=0 fsel=0 func=INPUT
GPIO 42: level=0 fsel=0 func=INPUT
GPIO 43: level=0 fsel=0 func=INPUT
GPIO 44: level=0 fsel=0 func=INPUT
GPIO 45: level=0 fsel=0 func=INPUT
BANK2 (GPIO 46 to 53):
GPIO 46: level=1 fsel=0 func=INPUT
GPIO 47: level=1 fsel=1 func=OUTPUT
GPIO 48: level=0 fsel=4 alt=0 func=SD0_CLK
GPIO 49: level=1 fsel=4 alt=0 func=SD0_CMD
GPIO 50: level=1 fsel=4 alt=0 func=SD0_DAT0
GPIO 51: level=1 fsel=4 alt=0 func=SD0_DAT1
GPIO 52: level=1 fsel=4 alt=0 func=SD0_DAT2
GPIO 53: level=1 fsel=4 alt=0 func=SD0_DAT3
pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: 60 -- -- -- -- -- -- -- -- -- -- 6b -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@raspberrypi:~ $ sudo vcdbg log msg
Failed to allocate -201253077 bytes for message buffer
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.52-v7+ #1 SMP Mon Jul 26 10:19:53 CEST 2021 armv7l GNU/Linux
pi@raspberrypi:~ $ 
2021-07-26-091101_1239x945_scrot.jpg
only additional modules added to the kernel
2021-07-26-091101_1239x945_scrot.jpg (78.85 KiB) Viewed 1950 times

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11650
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 7:20 am

Have you got proper pull-ups/downs on the A3-A0 address lines of the chip? How are they pulled?

Reading the datasheet 0x68 appears to be the default all call address, and 0x6b the s/w reset address.
At power-up, LED All Call I2C bus address is enabled. TLC59116 sends an ACK when D0h (R/W = 0) or D1h
(R/W = 1) is sent by the master.

The default LED All Call I2C bus address (D0h or 1101 000) must not be used as a regular
I2C bus slave address, since this address is enabled at power-up. All the TLC59116
devices on the I2C bus will acknowledge the address if it is sent by the I2C bus master.
0x60 would therefore appear to be your chip address.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11650
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 7:22 am

Code: Select all

pi@raspberrypi:~ $ sudo vcdbg log msg
Failed to allocate -201253077 bytes for message buffer
You've got FKMS or KMS loaded. There is 16MB of RAM that the ARM can't get to but the VPU can. There's a custom ioctl in bcm2708_fb to allow a DMA memcpy of that region for reading logs and other data.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 7:35 am

6by9 wrote:
Tue Jul 27, 2021 7:22 am

Code: Select all

pi@raspberrypi:~ $ sudo vcdbg log msg
Failed to allocate -201253077 bytes for message buffer
You've got FKMS or KMS loaded. There is 16MB of RAM that the ARM can't get to but the VPU can. There's a custom ioctl in bcm2708_fb to allow a DMA memcpy of that region for reading logs and other data.
so what is the right way to get to know what is going on? What should I look for in the logs?

And yes, this error message gets shown when FKMS or KMS is loaded. I need to get TLC59116 to work when KMS is loaded, not really interested in FKMS use.
A PCA9685 breakout should arrive today/tomorrow, but I'm quite sure it will show the same behavior, will it?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11650
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 8:09 am

aBUGSworstnightmare wrote:
Tue Jul 27, 2021 7:35 am
6by9 wrote:
Tue Jul 27, 2021 7:22 am

Code: Select all

pi@raspberrypi:~ $ sudo vcdbg log msg
Failed to allocate -201253077 bytes for message buffer
You've got FKMS or KMS loaded. There is 16MB of RAM that the ARM can't get to but the VPU can. There's a custom ioctl in bcm2708_fb to allow a DMA memcpy of that region for reading logs and other data.
so what is the right way to get to know what is going on? What should I look for in the logs?

And yes, this error message gets shown when FKMS or KMS is loaded. I need to get TLC59116 to work when KMS is loaded, not really interested in FKMS use.
A PCA9685 breakout should arrive today/tomorrow, but I'm quite sure it will show the same behavior, will it?
IIRC Set total_mem=1008 in config.txt to stop the VPU from using that top 16MB segment. vcdbg should then be able to use /dev/mem to read it all. I think you still get the error logged, but it takes the alternate path.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 12:07 pm

6by9 wrote:
Tue Jul 27, 2021 8:09 am
...
IIRC Set total_mem=1008 in config.txt to stop the VPU from using that top 16MB segment. vcdbg should then be able to use /dev/mem to read it all. I think you still get the error logged, but it takes the alternate path.
Thanks 6by9, that did the trick for vcdbg.
Anyhow, overlay seems to be loaded, but still not figured out the root cause why the kernel doesn't claim the LED driver address. Is my understanding wrong that below dt-entry should lead to an LED which is ON (active) after boot (note: tested default-off as well, makes no difference)?

Code: Select all

				led@13 {
					reg = <13>;
					function = LED_FUNCTION_INDICATOR;
					color = <LED_COLOR_ID_GREEN>;
					linux,default-trigger = "default-on";
				};

Code: Select all

pi@raspberrypi:~ $ sudo vcdbg log msg
001490.075: brfs: File read: /mfs/sd/config.txt
001491.481: brfs: File read: 2138 bytes
001560.272: brfs: File read: /mfs/sd/config.txt
001561.604: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
001586.108: gpioman: gpioman_get_pin_num: pin FLASH_0_ENABLE not defined
001586.134: gpioman: gpioman_get_pin_num: pin FLASH_0_INDICATOR not defined
001586.181: gpioman: gpioman_get_pin_num: pin FLASH_0_ENABLE not defined
001586.208: gpioman: gpioman_get_pin_num: pin FLASH_0_INDICATOR not defined
001586.252: gpioman: gpioman_get_pin_num: pin BT_ON not defined
001586.271: gpioman: gpioman_get_pin_num: pin WL_ON not defined
001613.288: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
001613.345: *** Restart logging
001613.372: brfs: File read: 2138 bytes
001627.912: HDMI0: hdmi_pixel_encoding: 162000000
001628.817: gpioman: gpioman_get_pin_num: pin CAMERA_0_I2C_PORT not defined
001628.846: dtb_file 'bcm2710-rpi-cm3.dtb'
001628.862: Trying Device Tree file 'bcm2710-rpi-cm3.dtb'
001638.818: brfs: File read: /mfs/sd/bcm2710-rpi-cm3.dtb
001638.841: Loading 'bcm2710-rpi-cm3.dtb' to 0x100 size 0x6b1d
001648.807: dtdebug: delete_node(/__local_fixups__)
001651.840: brfs: File read: 27421 bytes
001673.464: dtdebug: using platform 'bcm2835'
001676.939: brfs: File read: /mfs/sd/overlays/overlay_map.dtb
001678.396: dtdebug: overlay map loaded
001680.100: dtdebug: /aliases:i2c_vc=i2c0
001685.593: dtdebug: /__symbols__:i2c_vc=i2c0
001689.242: dtdebug: /__overrides__:i2c_vc=i2c0
001696.738: dtdebug: /__overrides__:i2c_vc_baudrate=i2c0_baudrate
001698.429: dtdebug: /aliases:i2c=i2c1
001704.097: dtdebug: /__symbols__:i2c=i2c1
001707.845: dtdebug: /__overrides__:i2c=i2c1
001709.552: dtdebug: /aliases:i2c_arm=i2c1
001715.186: dtdebug: /__symbols__:i2c_arm=i2c1
001718.907: dtdebug: /__overrides__:i2c_arm=i2c1
001726.454: dtdebug: /__overrides__:i2c_baudrate=i2c1_baudrate
001734.141: dtdebug: /__overrides__:i2c_arm_baudrate=i2c1_baudrate
001740.074: dtparam: uart0_clkrate=48000000
001743.080: dtdebug: /__overrides__ has no uart0_clkrate property
001743.095: Unknown dtparam 'uart0_clkrate' - ignored
001743.118: brfs: File read: 1559 bytes
001746.837: brfs: File read: /mfs/sd/config.txt
001746.987: dtparam: audio=off
001749.739: dtdebug: found override audio
001749.778: dtdebug:   override audio: string target 'status'
001757.846: brfs: File read: 2138 bytes
001780.263: dtdebug: Opened overlay file 'overlays/vc4-kms-v3d.dtbo'
001783.621: brfs: File read: /mfs/sd/overlays/vc4-kms-v3d.dtbo
001828.922: Loaded overlay 'vc4-kms-v3d'
001856.153: dtdebug: fragment 13 disabled
001859.183: dtdebug: merge_fragment(/reserved-memory/linux,cma,/fragment@0/__overlay__)
001859.210: dtdebug:   +prop(size)
001860.046: dtdebug: merge_fragment() end
001868.287: dtdebug: merge_fragment(/soc/i2c@7e805000,/fragment@1/__overlay__)
001868.314: dtdebug:   +prop(status)
001868.811: dtdebug: merge_fragment() end
001879.086: dtdebug: merge_fragment(/soc/fb,/fragment@2/__overlay__)
001879.112: dtdebug:   +prop(status)
001879.534: dtdebug: merge_fragment() end
001887.525: dtdebug: merge_fragment(/soc/pixelvalve@7e206000,/fragment@3/__overlay__)
001887.552: dtdebug:   +prop(status)
001888.050: dtdebug: merge_fragment() end
001896.224: dtdebug: merge_fragment(/soc/pixelvalve@7e207000,/fragment@4/__overlay__)
001896.252: dtdebug:   +prop(status)
001896.744: dtdebug: merge_fragment() end
001905.303: dtdebug: merge_fragment(/soc/pixelvalve@7e807000,/fragment@5/__overlay__)
001905.330: dtdebug:   +prop(status)
001905.802: dtdebug: merge_fragment() end
001913.048: dtdebug: merge_fragment(/soc/hvs@7e400000,/fragment@6/__overlay__)
001913.075: dtdebug:   +prop(status)
001913.625: dtdebug: merge_fragment() end
001922.390: dtdebug: merge_fragment(/soc/hdmi@7e902000,/fragment@7/__overlay__)
001922.415: dtdebug:   +prop(status)
001922.911: dtdebug: merge_fragment() end
001931.887: dtdebug: merge_fragment(/soc/v3d@7ec00000,/fragment@8/__overlay__)
001931.912: dtdebug:   +prop(status)
001932.375: dtdebug: merge_fragment() end
001941.387: dtdebug: merge_fragment(/soc/gpu,/fragment@9/__overlay__)
001941.414: dtdebug:   +prop(status)
001941.859: dtdebug: merge_fragment() end
001943.661: dtdebug: merge_fragment(/soc/cprman@7e101000,/fragment@10/__overlay__)
001943.689: dtdebug:   +prop(claim-clocks)
001944.808: dtdebug: merge_fragment() end
001953.504: dtdebug: merge_fragment(/soc/vec@7e806000,/fragment@11/__overlay__)
001953.530: dtdebug:   +prop(status)
001954.012: dtdebug: merge_fragment() end
001955.792: dtdebug: merge_fragment(/soc/txp@7e004000,/fragment@12/__overlay__)
001955.818: dtdebug:   +prop(status)
001956.620: dtdebug: merge_fragment() end
001956.718: dtdebug: fragment 13 disabled
001967.354: dtdebug: merge_fragment(/soc/mailbox@7e00b840/bcm2835_audio,/fragment@14/__overlay__)
001967.383: dtdebug:   +prop(brcm,disable-hdmi)
001968.091: dtdebug: merge_fragment() end
001968.879: brfs: File read: 2721 bytes
001994.388: dtdebug: Opened overlay file 'overlays/i2c-led-tlc59116.dtbo'
001997.101: brfs: File read: /mfs/sd/overlays/i2c-led-tlc59116.dtbo
002008.092: Loaded overlay 'i2c-led-tlc59116'
002017.051: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1,/fragment@0/__overlay__)
002017.077: dtdebug:   +prop(#address-cells)
002017.662: dtdebug:   +prop(#size-cells)
002020.903: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@68,/fragment@0/__overlay__/led-controller@68)
002020.930: dtdebug:   +prop(#address-cells)
002021.514: dtdebug:   +prop(#size-cells)
002022.095: dtdebug:   +prop(compatible)
002022.678: dtdebug:   +prop(reg)
002026.016: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@68/led@0,/fragment@0/__overlay__/led-controller@68/led@0)
002026.042: dtdebug:   +prop(reg)
002026.654: dtdebug:   +prop(function)
002027.280: dtdebug:   +prop(color)
002028.161: dtdebug:   +prop(linux,default-trigger)
002028.911: dtdebug: merge_fragment() end
002031.676: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@68/led@4,/fragment@0/__overlay__/led-controller@68/led@4)
002031.700: dtdebug:   +prop(reg)
002032.314: dtdebug:   +prop(function)
002032.942: dtdebug:   +prop(color)
002033.825: dtdebug:   +prop(linux,default-trigger)
002034.578: dtdebug: merge_fragment() end
002037.395: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@68/led@8,/fragment@0/__overlay__/led-controller@68/led@8)
002037.420: dtdebug:   +prop(reg)
002038.036: dtdebug:   +prop(function)
002038.668: dtdebug:   +prop(color)
002039.571: dtdebug: merge_fragment() end
002042.455: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@68/led@13,/fragment@0/__overlay__/led-controller@68/led@13)
002042.482: dtdebug:   +prop(reg)
002043.102: dtdebug:   +prop(function)
002043.737: dtdebug:   +prop(color)
002044.627: dtdebug:   +prop(linux,default-trigger)
002045.384: dtdebug: merge_fragment() end
002045.411: dtdebug: merge_fragment() end
002045.492: dtdebug: merge_fragment() end
002051.596: dtdebug: merge_fragment(/soc/i2c@7e205000,/fragment@1/__overlay__)
002051.621: dtdebug:   +prop(status)
002052.254: dtdebug: merge_fragment() end
002058.442: dtdebug: merge_fragment(/soc/i2c0mux,/fragment@2/__overlay__)
002058.469: dtdebug:   +prop(status)
002059.092: dtdebug: merge_fragment() end
002065.196: brfs: File read: 1048 bytes
002068.320: brfs: File read: /mfs/sd/cmdline.txt
002068.380: Read command line from file 'cmdline.txt':
002068.403: 'console=serial0,115200 console=tty1 root=PARTUUID=12c48c02-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles'
002076.775: dtparam: uart0=off
002079.557: dtdebug: found override uart0
002079.596: dtdebug:   override uart0: string target 'status'
004097.079: dtparam: arm_freq=1350000000
004100.070: dtdebug: found override arm_freq
004100.127: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004109.332: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004118.633: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004127.995: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004137.416: dtparam: core_freq=400000000
004140.570: dtdebug: /__overrides__ has no core_freq property
004140.585: Unknown dtparam 'core_freq' - ignored
004152.684: gpioman: gpioman_get_pin_num: pin WL_ON not defined
004152.703: dtdebug: delete_node(/hat)
004156.816: brfs: File read: 166 bytes
004681.406: brfs: File read: /mfs/sd/kernel7.img
004681.429: Loading 'kernel7.img' to 0x8000 size 0x60f3b8
004681.458: Device tree loaded to 0x2eff8d00 (size 0x729a)
004691.568: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined
008363.392: vchiq_core: vchiq_init_state: slot_zero = 0xded80000, is_master = 1
008371.683: TV service:host side not connected, dropping notification 0x00000002, 0x00000002, 0x00000057
pi@raspberrypi:~ $ 

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4069
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 12:47 pm

As 6by9 has explained, 0x68 is an illegal address for the TLC59116 because it is reserved for broadcast use. The actual address is set by pins A0-A3 which should be pulled high or low, not left to float. The output of i2cdetect suggests they are pulled low in your case (or have floated that way), making the actual address 0x60. There is still some doubt about whether the kernel is calling into the driver's probe function, but to start with I suggest you change the overlay to use address 0x60 and see what happens.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11650
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 1:14 pm

I've just tried your overlay with the address amended to 0x60 and CONFIG_LEDS_TLC591XX=m

Code: Select all

[    7.215077] tlc591xx: probe of 10-0060 failed with error -121
which is expected as I don't have the module connected. lsmod also lists leds_tlc591xx as being loaded.
So all looks fine from that perspective.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 2:10 pm

PhilE wrote: As 6by9 has explained, 0x68 is an illegal address for the TLC59116 because it is reserved for broadcast use. The actual address is set by pins A0-A3 which should be pulled high or low, not left to float. The output of i2cdetect suggests they are pulled low in your case (or have floated that way), making the actual address 0x60. There is still some doubt about whether the kernel is calling into the driver's probe function, but to start with I suggest you change the overlay to use address 0x60 and see what happens.
0x68 is the ALL-CALL address; it's not illegal as it can be used for accessing all devices on the bus, i.e. in case you want to configure the in the same way.
btw: https://github.com/raspberrypi/linux/bl ... c591xx.txt
...
Required properties
- compatible: should be "ti,tlc59116" or "ti,tlc59108"
- #address-cells: must be 1
- #size-cells: must be 0
- reg: typically 0x68
...
And I have proper address selection for sure!

Swapping to a board with address 0x64. Below address test was done before changing the address in the overlay/comiling.

Code: Select all

pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- 66 -- 68 -- -- 6b -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@raspberrypi:~ $ 

Code: Select all

pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- UU -- -- -- -- 6b -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@raspberrypi:~ $ sudo vcdbg log msg
001489.810: brfs: File read: /mfs/sd/config.txt
001491.210: brfs: File read: 2138 bytes
001559.278: brfs: File read: /mfs/sd/config.txt
001560.610: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
001585.049: gpioman: gpioman_get_pin_num: pin FLASH_0_ENABLE not defined
001585.075: gpioman: gpioman_get_pin_num: pin FLASH_0_INDICATOR not defined
001585.121: gpioman: gpioman_get_pin_num: pin FLASH_0_ENABLE not defined
001585.149: gpioman: gpioman_get_pin_num: pin FLASH_0_INDICATOR not defined
001585.193: gpioman: gpioman_get_pin_num: pin BT_ON not defined
001585.212: gpioman: gpioman_get_pin_num: pin WL_ON not defined
001611.924: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
001611.981: *** Restart logging
001612.008: brfs: File read: 2138 bytes
001626.275: HDMI0: hdmi_pixel_encoding: 162000000
001627.183: gpioman: gpioman_get_pin_num: pin CAMERA_0_I2C_PORT not defined
001627.212: dtb_file 'bcm2710-rpi-cm3.dtb'
001627.227: Trying Device Tree file 'bcm2710-rpi-cm3.dtb'
001636.162: brfs: File read: /mfs/sd/bcm2710-rpi-cm3.dtb
001636.185: Loading 'bcm2710-rpi-cm3.dtb' to 0x100 size 0x6b1d
001646.150: dtdebug: delete_node(/__local_fixups__)
001649.183: brfs: File read: 27421 bytes
001671.251: dtdebug: using platform 'bcm2835'
001673.500: brfs: File read: /mfs/sd/overlays/overlay_map.dtb
001674.937: dtdebug: overlay map loaded
001676.650: dtdebug: /aliases:i2c_vc=i2c0
001682.234: dtdebug: /__symbols__:i2c_vc=i2c0
001685.931: dtdebug: /__overrides__:i2c_vc=i2c0
001693.500: dtdebug: /__overrides__:i2c_vc_baudrate=i2c0_baudrate
001695.183: dtdebug: /aliases:i2c=i2c1
001700.770: dtdebug: /__symbols__:i2c=i2c1
001704.468: dtdebug: /__overrides__:i2c=i2c1
001706.165: dtdebug: /aliases:i2c_arm=i2c1
001711.814: dtdebug: /__symbols__:i2c_arm=i2c1
001715.596: dtdebug: /__overrides__:i2c_arm=i2c1
001723.257: dtdebug: /__overrides__:i2c_baudrate=i2c1_baudrate
001730.949: dtdebug: /__overrides__:i2c_arm_baudrate=i2c1_baudrate
001736.870: dtparam: uart0_clkrate=48000000
001739.888: dtdebug: /__overrides__ has no uart0_clkrate property
001739.904: Unknown dtparam 'uart0_clkrate' - ignored
001739.927: brfs: File read: 1559 bytes
001743.476: brfs: File read: /mfs/sd/config.txt
001743.626: dtparam: audio=off
001746.376: dtdebug: found override audio
001746.414: dtdebug:   override audio: string target 'status'
001754.496: brfs: File read: 2138 bytes
001776.781: dtdebug: Opened overlay file 'overlays/vc4-kms-v3d.dtbo'
001779.497: brfs: File read: /mfs/sd/overlays/vc4-kms-v3d.dtbo
001824.680: Loaded overlay 'vc4-kms-v3d'
001851.720: dtdebug: fragment 13 disabled
001854.745: dtdebug: merge_fragment(/reserved-memory/linux,cma,/fragment@0/__overlay__)
001854.772: dtdebug:   +prop(size)
001855.583: dtdebug: merge_fragment() end
001863.893: dtdebug: merge_fragment(/soc/i2c@7e805000,/fragment@1/__overlay__)
001863.921: dtdebug:   +prop(status)
001864.418: dtdebug: merge_fragment() end
001874.648: dtdebug: merge_fragment(/soc/fb,/fragment@2/__overlay__)
001874.674: dtdebug:   +prop(status)
001875.043: dtdebug: merge_fragment() end
001883.087: dtdebug: merge_fragment(/soc/pixelvalve@7e206000,/fragment@3/__overlay__)
001883.115: dtdebug:   +prop(status)
001883.613: dtdebug: merge_fragment() end
001891.765: dtdebug: merge_fragment(/soc/pixelvalve@7e207000,/fragment@4/__overlay__)
001891.793: dtdebug:   +prop(status)
001892.287: dtdebug: merge_fragment() end
001900.845: dtdebug: merge_fragment(/soc/pixelvalve@7e807000,/fragment@5/__overlay__)
001900.872: dtdebug:   +prop(status)
001901.345: dtdebug: merge_fragment() end
001908.548: dtdebug: merge_fragment(/soc/hvs@7e400000,/fragment@6/__overlay__)
001908.575: dtdebug:   +prop(status)
001909.132: dtdebug: merge_fragment() end
001917.885: dtdebug: merge_fragment(/soc/hdmi@7e902000,/fragment@7/__overlay__)
001917.910: dtdebug:   +prop(status)
001918.406: dtdebug: merge_fragment() end
001927.381: dtdebug: merge_fragment(/soc/v3d@7ec00000,/fragment@8/__overlay__)
001927.406: dtdebug:   +prop(status)
001927.869: dtdebug: merge_fragment() end
001936.880: dtdebug: merge_fragment(/soc/gpu,/fragment@9/__overlay__)
001936.907: dtdebug:   +prop(status)
001937.346: dtdebug: merge_fragment() end
001939.145: dtdebug: merge_fragment(/soc/cprman@7e101000,/fragment@10/__overlay__)
001939.173: dtdebug:   +prop(claim-clocks)
001940.298: dtdebug: merge_fragment() end
001949.008: dtdebug: merge_fragment(/soc/vec@7e806000,/fragment@11/__overlay__)
001949.035: dtdebug:   +prop(status)
001949.517: dtdebug: merge_fragment() end
001951.297: dtdebug: merge_fragment(/soc/txp@7e004000,/fragment@12/__overlay__)
001951.322: dtdebug:   +prop(status)
001952.124: dtdebug: merge_fragment() end
001952.222: dtdebug: fragment 13 disabled
001962.856: dtdebug: merge_fragment(/soc/mailbox@7e00b840/bcm2835_audio,/fragment@14/__overlay__)
001962.885: dtdebug:   +prop(brcm,disable-hdmi)
001963.594: dtdebug: merge_fragment() end
001964.381: brfs: File read: 2721 bytes
001989.727: dtdebug: Opened overlay file 'overlays/i2c-led-tlc59116.dtbo'
001992.660: brfs: File read: /mfs/sd/overlays/i2c-led-tlc59116.dtbo
002003.645: Loaded overlay 'i2c-led-tlc59116'
002012.573: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1,/fragment@0/__overlay__)
002012.599: dtdebug:   +prop(#address-cells)
002013.184: dtdebug:   +prop(#size-cells)
002016.412: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@66,/fragment@0/__overlay__/led-controller@66)
002016.440: dtdebug:   +prop(#address-cells)
002017.024: dtdebug:   +prop(#size-cells)
002017.605: dtdebug:   +prop(compatible)
002018.188: dtdebug:   +prop(reg)
002021.522: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@66/led@0,/fragment@0/__overlay__/led-controller@66/led@0)
002021.548: dtdebug:   +prop(reg)
002022.157: dtdebug:   +prop(function)
002022.783: dtdebug:   +prop(color)
002023.686: dtdebug:   +prop(linux,default-trigger)
002024.436: dtdebug: merge_fragment() end
002027.200: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@66/led@4,/fragment@0/__overlay__/led-controller@66/led@4)
002027.224: dtdebug:   +prop(reg)
002027.838: dtdebug:   +prop(function)
002028.466: dtdebug:   +prop(color)
002029.351: dtdebug:   +prop(linux,default-trigger)
002030.103: dtdebug: merge_fragment() end
002032.921: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@66/led@8,/fragment@0/__overlay__/led-controller@66/led@8)
002032.946: dtdebug:   +prop(reg)
002033.562: dtdebug:   +prop(function)
002034.193: dtdebug:   +prop(color)
002035.084: dtdebug: merge_fragment() end
002037.949: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@66/led@13,/fragment@0/__overlay__/led-controller@66/led@13)
002037.974: dtdebug:   +prop(reg)
002038.593: dtdebug:   +prop(function)
002039.241: dtdebug:   +prop(color)
002040.152: dtdebug:   +prop(linux,default-trigger)
002040.909: dtdebug: merge_fragment() end
002040.936: dtdebug: merge_fragment() end
002041.017: dtdebug: merge_fragment() end
002047.118: dtdebug: merge_fragment(/soc/i2c@7e205000,/fragment@1/__overlay__)
002047.144: dtdebug:   +prop(status)
002047.776: dtdebug: merge_fragment() end
002053.946: dtdebug: merge_fragment(/soc/i2c0mux,/fragment@2/__overlay__)
002053.973: dtdebug:   +prop(status)
002054.594: dtdebug: merge_fragment() end
002060.725: brfs: File read: 1048 bytes
002063.691: brfs: File read: /mfs/sd/cmdline.txt
002063.751: Read command line from file 'cmdline.txt':
002063.774: 'console=serial0,115200 console=tty1 root=PARTUUID=12c48c02-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles'
002072.124: dtparam: uart0=off
002074.916: dtdebug: found override uart0
002074.955: dtdebug:   override uart0: string target 'status'
004079.082: dtparam: arm_freq=1350000000
004082.051: dtdebug: found override arm_freq
004082.108: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004091.328: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004100.633: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004109.990: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004119.421: dtparam: core_freq=400000000
004122.547: dtdebug: /__overrides__ has no core_freq property
004122.562: Unknown dtparam 'core_freq' - ignored
004134.661: gpioman: gpioman_get_pin_num: pin WL_ON not defined
004134.680: dtdebug: delete_node(/hat)
004138.818: brfs: File read: 166 bytes
004671.439: brfs: File read: /mfs/sd/kernel7.img
004671.462: Loading 'kernel7.img' to 0x8000 size 0x60f3b8
004671.491: Device tree loaded to 0x2eff8d00 (size 0x729a)
004678.533: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined
008342.899: vchiq_core: vchiq_init_state: slot_zero = 0xded80000, is_master = 1
008351.188: TV service:host side not connected, dropping notification 0x00000002, 0x00000002, 0x00000057
pi@raspberrypi:~ $ 
Swapping to a board with address 0x64. Below address test was done before changing the address in the overlay/comiling.

Code: Select all

pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- 64 -- -- -- 68 -- -- 6b -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@raspberrypi:~ $ 

Rebooting

Code: Select all

pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- UU -- -- -- -- -- -- 6b -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@raspberrypi:~ $ sudo vcdbg log msg
001490.085: brfs: File read: /mfs/sd/config.txt
001491.485: brfs: File read: 2138 bytes
001559.505: brfs: File read: /mfs/sd/config.txt
001560.837: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
001585.340: gpioman: gpioman_get_pin_num: pin FLASH_0_ENABLE not defined
001585.366: gpioman: gpioman_get_pin_num: pin FLASH_0_INDICATOR not defined
001585.413: gpioman: gpioman_get_pin_num: pin FLASH_0_ENABLE not defined
001585.440: gpioman: gpioman_get_pin_num: pin FLASH_0_INDICATOR not defined
001585.485: gpioman: gpioman_get_pin_num: pin BT_ON not defined
001585.503: gpioman: gpioman_get_pin_num: pin WL_ON not defined
001612.508: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
001612.565: *** Restart logging
001612.592: brfs: File read: 2138 bytes
001626.867: HDMI0: hdmi_pixel_encoding: 162000000
001627.775: gpioman: gpioman_get_pin_num: pin CAMERA_0_I2C_PORT not defined
001627.805: dtb_file 'bcm2710-rpi-cm3.dtb'
001627.820: Trying Device Tree file 'bcm2710-rpi-cm3.dtb'
001636.764: brfs: File read: /mfs/sd/bcm2710-rpi-cm3.dtb
001636.786: Loading 'bcm2710-rpi-cm3.dtb' to 0x100 size 0x6b1d
001646.750: dtdebug: delete_node(/__local_fixups__)
001649.784: brfs: File read: 27421 bytes
001671.855: dtdebug: using platform 'bcm2835'
001674.102: brfs: File read: /mfs/sd/overlays/overlay_map.dtb
001675.539: dtdebug: overlay map loaded
001677.252: dtdebug: /aliases:i2c_vc=i2c0
001682.835: dtdebug: /__symbols__:i2c_vc=i2c0
001686.532: dtdebug: /__overrides__:i2c_vc=i2c0
001694.101: dtdebug: /__overrides__:i2c_vc_baudrate=i2c0_baudrate
001695.785: dtdebug: /aliases:i2c=i2c1
001701.371: dtdebug: /__symbols__:i2c=i2c1
001705.069: dtdebug: /__overrides__:i2c=i2c1
001706.766: dtdebug: /aliases:i2c_arm=i2c1
001712.415: dtdebug: /__symbols__:i2c_arm=i2c1
001716.197: dtdebug: /__overrides__:i2c_arm=i2c1
001723.858: dtdebug: /__overrides__:i2c_baudrate=i2c1_baudrate
001731.549: dtdebug: /__overrides__:i2c_arm_baudrate=i2c1_baudrate
001737.471: dtparam: uart0_clkrate=48000000
001740.489: dtdebug: /__overrides__ has no uart0_clkrate property
001740.504: Unknown dtparam 'uart0_clkrate' - ignored
001740.528: brfs: File read: 1559 bytes
001744.071: brfs: File read: /mfs/sd/config.txt
001744.221: dtparam: audio=off
001746.970: dtdebug: found override audio
001747.009: dtdebug:   override audio: string target 'status'
001755.091: brfs: File read: 2138 bytes
001777.366: dtdebug: Opened overlay file 'overlays/vc4-kms-v3d.dtbo'
001780.078: brfs: File read: /mfs/sd/overlays/vc4-kms-v3d.dtbo
001825.506: Loaded overlay 'vc4-kms-v3d'
001852.493: dtdebug: fragment 13 disabled
001855.518: dtdebug: merge_fragment(/reserved-memory/linux,cma,/fragment@0/__overlay__)
001855.545: dtdebug:   +prop(size)
001856.356: dtdebug: merge_fragment() end
001864.665: dtdebug: merge_fragment(/soc/i2c@7e805000,/fragment@1/__overlay__)
001864.693: dtdebug:   +prop(status)
001865.191: dtdebug: merge_fragment() end
001875.420: dtdebug: merge_fragment(/soc/fb,/fragment@2/__overlay__)
001875.446: dtdebug:   +prop(status)
001875.816: dtdebug: merge_fragment() end
001883.859: dtdebug: merge_fragment(/soc/pixelvalve@7e206000,/fragment@3/__overlay__)
001883.887: dtdebug:   +prop(status)
001884.385: dtdebug: merge_fragment() end
001892.518: dtdebug: merge_fragment(/soc/pixelvalve@7e207000,/fragment@4/__overlay__)
001892.546: dtdebug:   +prop(status)
001893.039: dtdebug: merge_fragment() end
001901.598: dtdebug: merge_fragment(/soc/pixelvalve@7e807000,/fragment@5/__overlay__)
001901.626: dtdebug:   +prop(status)
001902.098: dtdebug: merge_fragment() end
001909.307: dtdebug: merge_fragment(/soc/hvs@7e400000,/fragment@6/__overlay__)
001909.335: dtdebug:   +prop(status)
001909.886: dtdebug: merge_fragment() end
001918.638: dtdebug: merge_fragment(/soc/hdmi@7e902000,/fragment@7/__overlay__)
001918.663: dtdebug:   +prop(status)
001919.170: dtdebug: merge_fragment() end
001928.134: dtdebug: merge_fragment(/soc/v3d@7ec00000,/fragment@8/__overlay__)
001928.159: dtdebug:   +prop(status)
001928.622: dtdebug: merge_fragment() end
001937.633: dtdebug: merge_fragment(/soc/gpu,/fragment@9/__overlay__)
001937.659: dtdebug:   +prop(status)
001938.099: dtdebug: merge_fragment() end
001939.898: dtdebug: merge_fragment(/soc/cprman@7e101000,/fragment@10/__overlay__)
001939.926: dtdebug:   +prop(claim-clocks)
001941.063: dtdebug: merge_fragment() end
001949.760: dtdebug: merge_fragment(/soc/vec@7e806000,/fragment@11/__overlay__)
001949.787: dtdebug:   +prop(status)
001950.269: dtdebug: merge_fragment() end
001952.049: dtdebug: merge_fragment(/soc/txp@7e004000,/fragment@12/__overlay__)
001952.074: dtdebug:   +prop(status)
001952.876: dtdebug: merge_fragment() end
001952.974: dtdebug: fragment 13 disabled
001963.608: dtdebug: merge_fragment(/soc/mailbox@7e00b840/bcm2835_audio,/fragment@14/__overlay__)
001963.637: dtdebug:   +prop(brcm,disable-hdmi)
001964.346: dtdebug: merge_fragment() end
001965.134: brfs: File read: 2721 bytes
001990.510: dtdebug: Opened overlay file 'overlays/i2c-led-tlc59116.dtbo'
001993.439: brfs: File read: /mfs/sd/overlays/i2c-led-tlc59116.dtbo
002004.426: Loaded overlay 'i2c-led-tlc59116'
002013.356: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1,/fragment@0/__overlay__)
002013.382: dtdebug:   +prop(#address-cells)
002013.967: dtdebug:   +prop(#size-cells)
002017.195: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@64,/fragment@0/__overlay__/led-controller@64)
002017.223: dtdebug:   +prop(#address-cells)
002017.807: dtdebug:   +prop(#size-cells)
002018.389: dtdebug:   +prop(compatible)
002018.971: dtdebug:   +prop(reg)
002022.305: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@64/led@0,/fragment@0/__overlay__/led-controller@64/led@0)
002022.331: dtdebug:   +prop(reg)
002022.941: dtdebug:   +prop(function)
002023.572: dtdebug:   +prop(color)
002024.470: dtdebug:   +prop(linux,default-trigger)
002025.220: dtdebug: merge_fragment() end
002027.984: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@64/led@4,/fragment@0/__overlay__/led-controller@64/led@4)
002028.008: dtdebug:   +prop(reg)
002028.622: dtdebug:   +prop(function)
002029.252: dtdebug:   +prop(color)
002030.135: dtdebug:   +prop(linux,default-trigger)
002030.888: dtdebug: merge_fragment() end
002033.705: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@64/led@8,/fragment@0/__overlay__/led-controller@64/led@8)
002033.730: dtdebug:   +prop(reg)
002034.346: dtdebug:   +prop(function)
002034.978: dtdebug:   +prop(color)
002035.868: dtdebug: merge_fragment() end
002038.733: dtdebug: merge_fragment(/soc/i2c0mux/i2c@1/led-controller@64/led@13,/fragment@0/__overlay__/led-controller@64/led@13)
002038.758: dtdebug:   +prop(reg)
002039.390: dtdebug:   +prop(function)
002040.032: dtdebug:   +prop(color)
002040.939: dtdebug:   +prop(linux,default-trigger)
002041.696: dtdebug: merge_fragment() end
002041.723: dtdebug: merge_fragment() end
002041.804: dtdebug: merge_fragment() end
002047.904: dtdebug: merge_fragment(/soc/i2c@7e205000,/fragment@1/__overlay__)
002047.930: dtdebug:   +prop(status)
002048.562: dtdebug: merge_fragment() end
002054.732: dtdebug: merge_fragment(/soc/i2c0mux,/fragment@2/__overlay__)
002054.759: dtdebug:   +prop(status)
002055.380: dtdebug: merge_fragment() end
002061.512: brfs: File read: 1048 bytes
002064.478: brfs: File read: /mfs/sd/cmdline.txt
002064.539: Read command line from file 'cmdline.txt':
002064.562: 'console=serial0,115200 console=tty1 root=PARTUUID=12c48c02-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles'
002072.914: dtparam: uart0=off
002075.708: dtdebug: found override uart0
002075.747: dtdebug:   override uart0: string target 'status'
004075.804: dtparam: arm_freq=1350000000
004078.766: dtdebug: found override arm_freq
004078.823: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004088.062: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004097.358: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004106.719: dtdebug:   override arm_freq: cell target clock-frequency @ offset 0 (size 4)
004116.146: dtparam: core_freq=400000000
004119.298: dtdebug: /__overrides__ has no core_freq property
004119.313: Unknown dtparam 'core_freq' - ignored
004131.414: gpioman: gpioman_get_pin_num: pin WL_ON not defined
004131.432: dtdebug: delete_node(/hat)
004135.546: brfs: File read: 166 bytes
004674.865: brfs: File read: /mfs/sd/kernel7.img
004674.888: Loading 'kernel7.img' to 0x8000 size 0x60f3b8
004674.917: Device tree loaded to 0x2eff8d00 (size 0x729a)
004681.959: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined
008354.200: vchiq_core: vchiq_init_state: slot_zero = 0xded80000, is_master = 1
008362.471: TV service:host side not connected, dropping notification 0x00000002, 0x00000002, 0x00000057
pi@raspberrypi:~ $ 
As a picture it now looks like below, but still not sure why the driver 'hides' the all-call address. Digging further..
IMG_20210727_155147.jpg
IMG_20210727_155147.jpg (147.3 KiB) Viewed 1808 times

aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 2:33 pm

Added a second "default-on" led (red one) and also tested with the board which is at adress 0x60h: working as well

Code: Select all

pi@raspberrypi:~ $ sudo i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: UU -- -- -- -- -- -- -- -- -- -- 6b -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@raspberrypi:~ $ 
IMG_20210727_162526.jpg
two LED configured to 'default-on' in the overlay
IMG_20210727_162526.jpg (134.13 KiB) Viewed 1803 times
so, big question is which code leads the driver to discard/hide address 0x68!

Next step: figure out how to use the LED from the display driver source and what else is needed to get the backlight PWM running (definition in the overlay?).

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11650
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 2:42 pm

aBUGSworstnightmare wrote:
Tue Jul 27, 2021 2:33 pm
so, big question is which code leads the driver to discard/hide address 0x68!
https://www.ti.com/lit/ds/symlink/tlc59116.pdf
9.5.1ModeRegister1 (MODE1)
Bit 0
ALLCALL R/W
0 Device does not respond to LED All Call I2C bus address.
1 Device responds to LED All Call I2C bus address.

https://elixir.bootlin.com/linux/latest ... 91xx.c#L77

Code: Select all

err = regmap_write(regmap, TLC591XX_REG_MODE1, MODE1_NORMAL_MODE);
MODE1_NORMAL_MODE = (0 << 4), so the device no longer responds to the all call address.

All call is great for debug quick testing, but is near useless in a generic system.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4069
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 2:46 pm

The driver function tlc591xx_set_mode includes the following line:

Code: Select all

	err = regmap_write(regmap, TLC591XX_REG_MODE1, MODE1_NORMAL_MODE);
where TLC591XX_REG_MODE1 is 0 and MODE1_NORMAL_LINE is defined to be (0 << 4), i.e. also 0. Therefore bit 0 (ALLCALL) of the MODE1 register is set to zero ("Device does not respond to LED All Call I2C bus address.").

In other words, your device is behaving as expected by the driver writer.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4069
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 2:48 pm

(There was a time when the forums would warn about a topic being updated mid reply...)

aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Re: Problems with overlay for TI TLC59116

Tue Jul 27, 2021 4:03 pm

6by9 wrote: https://elixir.bootlin.com/linux/latest ... 91xx.c#L77

Code: Select all

err = regmap_write(regmap, TLC591XX_REG_MODE1, MODE1_NORMAL_MODE);
MODE1_NORMAL_MODE = (0 << 4), so the device no longer responds to the all call address.

All call is great for debug quick testing, but is near useless in a generic system.
thanks to PhilE and 6by9! Missed that one, sorry.
Quick debug testing ... That's exactly what I intended to use the small LED board for :oops:
Device will be integrated on another PCB once I'm convinced it's good for the job.

At least a new overlay will result out of this in case my pull request (to be created when all the overlay defines etc are clear to me/been tested) gets accepted.

aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Re: Problems with overlay for TI TLC59116

Sun Aug 01, 2021 2:17 pm

I'm still digging through this device tree minefield, finding my way how to gain access to the LEDs connected to the controller.

My current overlay is below. When I now try to switch off the blue LED (power_blue) by sysfs it's not possible:

Code: Select all

pi@raspberrypi:~ $ cd /sys/class/leds
pi@raspberrypi:/sys/class/leds $ tree
.
├── default-on -> ../../devices/virtual/leds/default-on
├── enable -> ../../devices/platform/soc/fe205000.i2c/i2c-0/0-0062/leds/enable
├── green -> ../../devices/platform/soc/fe205000.i2c/i2c-0/0-0062/leds/green
├── led0 -> ../../devices/platform/leds/leds/led0
├── led1 -> ../../devices/platform/leds/leds/led1
├── mmc0 -> ../../devices/virtual/leds/mmc0
├── mmc0:: -> ../../devices/platform/emmc2bus/fe340000.emmc2/leds/mmc0::
└── power_blue -> ../../devices/platform/soc/fe205000.i2c/i2c-0/0-0062/leds/power_blue

8 directories, 0 files
pi@raspberrypi:/sys/class/leds $ sudo echo 0 > power_blue/brightness
bash: power_blue/brightness: Permission denied
Questions:
- what is the correct procedure for switching LEDs ON/OFF/change duty (if configured as led-pwm)?
- how do I access them from a driver (i.e. when I have a signal named 'enable' I use i.e. 'enable-gpios = <&gpio 4 0>;' when using a SOC GPIO; when using a I2C GPIO expander I have i.e. 'enable-gpios = <&pca 2 0>;' with the device defined as 'pca: pca@<addr>'). So what would be the equivalent for changing the LED state from a kernel driver?

Current overlay source:

Code: Select all

/*
 * i2c-led-tlc59116-overlay.dts
 */

/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>

/ {
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&i2c0>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;

			tlc: tlc@62{
				#address-cells = <1>;
				#size-cells = <0>;
				compatible = "ti,tlc59116";
				reg = <0x62>;
				
				enable@0 {
					label = "enable";
					reg = <0>;
					function = LED_FUNCTION_INDICATOR;
					color = <LED_COLOR_ID_RED>;
					linux,default-trigger = "none";
				};
				green@6 {
					label = "green";
					reg = <6>;
					function = LED_FUNCTION_INDICATOR;
					color = <LED_COLOR_ID_GREEN>;
					linux,default-trigger = "none";
				};
				power_blue@14 {
					label = "power_blue";
					reg = <14>;
					function = LED_FUNCTION_INDICATOR;
					color = <LED_COLOR_ID_BLUE>;
					linux,default-trigger = "default-on";
				};
			};
		};
	};
	
	/*fragment@1 {
		target-path = "/";
		__overlay__ {
			led-controller {
				compatible = "gpio-leds";
				status = "okay";

			};
		};
	};*/
};

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4069
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Problems with overlay for TI TLC59116

Mon Aug 02, 2021 8:47 am

Code: Select all

pi@raspberrypi:/sys/class/leds $ sudo echo 0 > power_blue/brightness
bash: power_blue/brightness: Permission denied
Although that command looks plausible it fails because of the way it is interpreted. The shell (running as user "pi") splits lines by semicolons (of which there are none), then breaks what's left into a command and any associated input and output redirection. In this case the command is "sudo echo 0" and the output is redirected to "power_blue/brightness". Your problem is that the shell sets up the redirection before running the command, meaning that the user "pi" is trying to open the brightness control for output and failing.

There are several ways around this common problem:

1. echo 0 | sudo tee power_blue/brightness
This has the quirk that the 0 is also echoed to the console.

2. sudo sh -c "echo 0 > power_blue/brightness"
I like this one, but it's more typing.

3. sudo myscript
where myscript contains:

Code: Select all

#!/bin/sh
echo 0 > power_blue/brightness
and is executable. Creating a script for one random write is overkill, but as the list of commands gets longer it becomes more attractive, particularly if there's a chance you might run it again.

4. sudo -i
echo 0 > power_blue/brightness
The first line launches an interactive root shell, from which you can run anything you like as root. Just beware that with great power comes great responsibility...

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4069
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Problems with overlay for TI TLC59116

Mon Aug 02, 2021 9:01 am

To answer the second part of your question, I've not previously come across an LED consumer API, but there is one: of_led_get (and the managed version devm_of_led_get) returns a "struct led_classdev *".
From led_bl_get_leds (https://github.com/raspberrypi/linux/bl ... d_bl.c#L71):

Code: Select all

	struct led_classdev **leds;
...
	leds = devm_kzalloc(dev, sizeof(struct led_classdev *) * nb_leds,
			    GFP_KERNEL);
...
	for (i = 0; i < nb_leds; i++) {
		leds[i] = devm_of_led_get(dev, i);
		if (IS_ERR(leds[i]))
			return PTR_ERR(leds[i]);
	}
...
	priv->leds = leds;
Then from led_bl_set_brightness (https://github.com/raspberrypi/linux/bl ... d_bl.c#L25):

Code: Select all

	for (i = 0; i < priv->nb_leds; i++)
		led_set_brightness(priv->leds[i], bkl_brightness);

aBUGSworstnightmare
Posts: 3491
Joined: Tue Jun 30, 2015 1:35 pm

Re: Problems with overlay for TI TLC59116

Tue Aug 03, 2021 6:53 am

PhilE wrote:
Mon Aug 02, 2021 9:01 am
To answer the second part of your question, I've not previously come across an LED consumer API, but there is one: of_led_get (and the managed version devm_of_led_get) returns a "struct led_classdev *".
From led_bl_get_leds (https://github.com/raspberrypi/linux/bl ... d_bl.c#L71):

Code: Select all

	struct led_classdev **leds;
...
	leds = devm_kzalloc(dev, sizeof(struct led_classdev *) * nb_leds,
			    GFP_KERNEL);
...
	for (i = 0; i < nb_leds; i++) {
		leds[i] = devm_of_led_get(dev, i);
		if (IS_ERR(leds[i]))
			return PTR_ERR(leds[i]);
	}
...
	priv->leds = leds;
Then from led_bl_set_brightness (https://github.com/raspberrypi/linux/bl ... d_bl.c#L25):

Code: Select all

	for (i = 0; i < priv->nb_leds; i++)
		led_set_brightness(priv->leds[i], bkl_brightness);
Thanks PhilE for this, but I think I'm done with that device for now as it's too much effort to achieve what I'm up for.

Will have a look at PCA9685 as that driver seems to expose a GPIO expansion feature (comparable to PCA953x i.e.) as I'm looking for a solution that gives me 2 PWMs (100Hz to some kHz) and (around) 7 GPIOs (with kernel drivers in the tree).

Return to “Device Tree”