dloranger
Posts: 45
Joined: Wed Nov 02, 2016 1:56 am
Location: Seattle

Overlay for pca9534 gpio expander?

Sun Aug 09, 2020 10:41 pm

I am trying to figure out if a device tree overlay exists for the pca9534 family of chips.

I have found a few posts here that are quite old stating the driver is not compiled by default, but that was 3 years ago, so hoping that has been updated.

Beyond that, I have found the device tree from the chipset manufacturer here..

https://e2e.ti.com/support/legacy_forum ... evice-Tree

We are trying to load up a relay board that uses this chipset, but we are restricted to interacting with it as a gpio device due to application restrictions so we need to have the gpio of the device mapped similar to how the mcp23017 gpio expander works.

Here is the hat we are trying to use

https://sequentmicrosystems.com/index.p ... duct_id=50

Am I out in left field here, or am I missing an existing overlay? If its not already available, can we get it added?

I have seen references to gpio-pca953x.dts if that helps at all.

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

Re: Overlay for pca9534 gpio expander?

Mon Aug 10, 2020 9:37 am

CONFIG_GPIO_PCA953X is defined for the 5.4 kernel branch.

There doesn't appear to be an overlay for it at present, but it won't be that different from the other GPIO expander type overlays (eg mcp23017), so I'd guess at something like

Code: Select all

// Definitions for NXP PCA9534 I2C GPIO controller on ARM I2C bus.
/dts-v1/;
/plugin/;

/{
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&i2c_arm>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			pca: pca@20 {
				compatible = "nxp,pca9534";
				reg = <0x20>;
				gpio-controller;
				#gpio-cells = <2>;

				status = "okay";
			};
		};
	};
	fragment@1 {
		target = <&gpio>;
		__overlay__ {
			pca_pins: pca_pins@20 {
				brcm,pins = <4>;
				brcm,function = <0>;
			};
		};
	};
	fragment@2 {
		target = <&pca>;
		pca_irq: __overlay__ {
			#interrupt-cells=<2>;
			interrupt-parent = <&gpio>;
			interrupts = <4 2>;
			interrupt-controller;
			microchip,irq-mirror;
		};
	};

	__overrides__ {
		gpiopin = <&pca_pins>,"brcm,pins:0",
				<&pca_irq>,"interrupts:0";
		addr = <&pca>,"reg:0", <&pca_pins>,"reg:0";
		noints = <0>,"!1!2";
	};
};
If it works, then it'd be nice to extend it out with the additional GPIO expanders that are supported by that driver

Code: Select all

	nxp,pca6416
	nxp,pca9505
	nxp,pca9534
	nxp,pca9535
	nxp,pca9536
	nxp,pca9537
	nxp,pca9538
	nxp,pca9539
	nxp,pca9554
	nxp,pca9555
	nxp,pca9556
	nxp,pca9557
	nxp,pca9574
	nxp,pca9575
	nxp,pca9698
	nxp,pcal6416
	nxp,pcal6524
	nxp,pcal9555a
	maxim,max7310
	maxim,max7312
	maxim,max7313
	maxim,max7315
	ti,pca6107
	ti,pca9536
	ti,tca6408
	ti,tca6416
	ti,tca6424
	ti,tca9539
	ti,tca9554
	onnn,cat9554
	onnn,pca9654
	exar,xra1202
and it would also need a README entry before it could be merged into the tree.
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.

dloranger
Posts: 45
Joined: Wed Nov 02, 2016 1:56 am
Location: Seattle

Re: Overlay for pca9534 gpio expander?

Fri Aug 14, 2020 10:15 pm

Hardware arrived today, and started playing with the overlay.

Partial success I think; the overlay loads without spitting any errors in the vcdbg log msg dump, but using i2cdetect utility, the device still shows as 3f instead of "UU" and nothing is added in the /sys/class/gpio/gpiochip### area


004141.209: brfs: File read: /mfs/sd/overlays/mcp3008.dtbo
004181.732: Loaded overlay 'mcp3008'
004181.786: dtparam: spi0-0-present=true
004183.131: dtparam: spi0-0-speed=3600000
004219.618: brfs: File read: 4213 bytes
004252.791: brfs: File read: /mfs/sd/overlays/test.dtbo
004266.185: Loaded overlay 'test'
006286.675: gpioman: gpioman_get_pin_num: pin EMMC_ENABLE not defined
006393.618: Device tree loaded to 0x2eff8f00 (size 0x7057)
006395.713: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined
007791.925: vchiq_core: vchiq_init_state: slot_zero = 0xfad80000, is_master = 1
015616.832: brfs: File read: 1224 bytes

root@openrepeater:~# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- UU -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 3f
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

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

Re: Overlay for pca9534 gpio expander?

Fri Aug 14, 2020 10:31 pm

Unless you've modified the overlay, and from the output of i2cdetect I don't think you have, it is expecting the expander to be at address 0x20. If instead it is at 0x3f then you'll need to use the "addr" parameter to specify the new address.

dloranger
Posts: 45
Joined: Wed Nov 02, 2016 1:56 am
Location: Seattle

Re: Overlay for pca9534 gpio expander?

Fri Aug 14, 2020 10:52 pm

Just to be sure, as yes I did modify the register to 3f before compiling, I have removed all extra boards and recompiled the dts (I changed the address from 3f to 3d to be sure I was talking to what I thought I was talking to on the i2c bus)

root@openrepeater:~# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- 3d -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
~~~
root@openrepeater:~# echo "" > /boot/overlays/test.dts
~~~
root@openrepeater:~# nano /boot/overlays/test.dts
~~~

Code: Select all

root@openrepeater:~# tail /boot/config.txt
#Enable mcp23s17 Overlay
dtoverlay=mcp23017,addr=0x20,gpiopin=12

#Enable mcp3008 adc overlay
dtoverlay=mcp3008:spi0-0-present,spi0-0-speed=3600000

# Relay overlay
dtoverlay=test,addr=0x3d
# Enable UART for serial console
enable_uart=1

Code: Select all

root@openrepeater:~# dtc -I dts -Odtb -o /boot/overlays/test.dtbo /boot/overlays/test.dts
/boot/overlays/test.dtbo: Warning (unit_address_vs_reg): /fragment@1/__overlay__/pca_pins@20: node has a unit name, but no reg property
root@openrepeater:~#
~~~~ rebooted

Code: Select all

Last login: Fri Aug 14 18:46:23 2020 from 192.168.1.202
root@openrepeater:~# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- 3d -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@openrepeater:~#
~~~~

Code: Select all

004242.971: brfs: File read: /mfs/sd/overlays/test.dtbo
004256.382: Loaded overlay 'test'
004256.437: dtparam: addr=0x3d
006273.420: gpioman: gpioman_get_pin_num: pin EMMC_ENABLE not defined

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

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 6:43 am

Look in the kernel log (dmesg) to see if it gives a reason for not loading.
The vcdbg log will only tell you about issues in merging the dtoverlay into the base config, nothing from the driver.
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.

dloranger
Posts: 45
Joined: Wed Nov 02, 2016 1:56 am
Location: Seattle

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 7:32 am

The 0x20 (MCP23017) and 0x0a (SGTL5000) and MCP320x (SPI) are expected failures since I removed the other hat, they are attempted to load prior to the new PCA chipset (come first in the config.txt)

Code: Select all

[    9.093194] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[    9.107162] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    9.107444] usbcore: registered new interface driver brcmfmac
[    9.108070] snd-fe-pi-audio soc:sound: ASoC: CODEC DAI sgtl5000 not registered - will retry
[    9.191970] snd-fe-pi-audio soc:sound: ASoC: CODEC DAI sgtl5000 not registered - will retry
[    9.222425] mcp230xx: probe of 1-0020 failed with error -121
[    9.226209] sgtl5000 1-000a: Linked as a consumer to regulator.1
[    9.226300] sgtl5000 1-000a: Dropping the link to regulator.1
[    9.226441] sgtl5000 1-000a: Linked as a consumer to regulator.2
[    9.226594] sgtl5000 1-000a: Linked as a consumer to regulator.1
[    9.228962] sgtl5000 1-000a: Error reading chip id -121
[    9.229253] sgtl5000 1-000a: Dropping the link to regulator.1
[    9.229409] sgtl5000: probe of 1-000a failed with error -121
[    9.238465] mcp320x spi0.0: spi0.0 supply vref not found, using dummy regulator
[    9.238559] mcp320x spi0.0: Linked as a consumer to regulator.0
[    9.239839] snd-fe-pi-audio soc:sound: ASoC: CODEC DAI sgtl5000 not registered - will retry
[    9.375269] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    9.375400] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[    9.376245] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[   11.181025] random: crng init done
[   11.181038] random: 7 urandom warning(s) missed due to ratelimiting
[   11.365238] uart-pl011 3f201000.serial: no DMA platform data
[   11.660353] 8021q: 802.1Q VLAN Support v1.8
[   12.307232] Adding 102396k swap on /var/swap.  Priority:-2 extents:1 across:102396k SSFS
[   12.444765] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   12.444788] brcmfmac: power management disabled
[   13.013961] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[   13.916489] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   14.585446] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
[   16.750706] Bluetooth: Core ver 2.22
[   16.750816] NET: Registered protocol family 31
[   16.750823] Bluetooth: HCI device and connection manager initialized
[   16.752437] Bluetooth: HCI socket layer initialized
[   16.752458] Bluetooth: L2CAP socket layer initialized
[   16.752517] Bluetooth: SCO socket layer initialized
[   16.782729] Bluetooth: HCI UART driver ver 2.3
[   16.782743] Bluetooth: HCI UART protocol H4 registered
[   16.782829] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   16.783059] Bluetooth: HCI UART protocol Broadcom registered
[   17.656840] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   17.656854] Bluetooth: BNEP filters: protocol multicast
[   17.656879] Bluetooth: BNEP socket layer initialized
[   21.870773] export_store: invalid GPIO 498
[   22.108863] export_store: invalid GPIO 497

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

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 8:13 am

Hmm, the bindings list the vcc-supply as an optional property, but the driver looks to fail on no regulator. I'd have expected to see the error message "reg get err: X" in that case though.

Can you check that on your system, "modinfo gpio-pca953x" produces a result which includes the line

Code: Select all

alias:          of:N*T*Cnxp,pca9534
(for me it's 5 from the end)?

Your other approach is to remove dtoverlay=pca953x from config.txt and try loading it dynamically via

Code: Select all

sudo dtoverlay pca953x
That way you can see any error messages more clearly in the kernel log.
(Add any parameters on the end that you require, separated with spaces rather than commas)
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: 9281
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 8:20 am

Looking more closely, I don't think interrupt support isn't going to be available as GPIO_PCA953X_IRQ isn't defined.
Help text says
Say yes here to enable the pca953x to be used as an interrupt
controller. It requires the driver to be built in the kernel.
Building the driver into the kernel becomes an overhead to ALL users of the Pi kernel, so isn't going to happen. I'm not quite certain why it needs to be built in seeing as MCP23017 manages to be an interrupt controller as a module.
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: 9281
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 1:24 pm

I've just tried the overlay I listed in my first post. Loading via the dtoverlay command it seems to be fine, even without a device attached.

Code: Select all

[   62.371548] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/i2c@7e804000/status
[   62.448841] pca953x 1-0020: 1-0020 supply vcc not found, using dummy regulator
[   62.448894] pca953x 1-0020: using no AI
pi@raspberrypi:~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --         
pi@raspberrypi:~ $ cat /sys/class/gpio/gpiochip496/device/name 
pca9534                
It does appear that this device can't support interrupts without being a builtin and having an extra option (CONFIG_GPIO_PCA953X_IRQ) defined, therefore there's no point in having the interrupt section defined.
I sort of expected the warning message "interrupt support not compiled in", so that may not be configured correctly anyway. There appear to be bits that only apply to ACPI, so it's a bit of a rabbit hole to disappear down.
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.

dloranger
Posts: 45
Joined: Wed Nov 02, 2016 1:56 am
Location: Seattle

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 3:51 pm

edit, inserting answer to previous question, mod-info command response

root@openrepeater:~# modinfo gpio-pca953x
modinfo: ERROR: Module gpio-pca953x not found.
root@openrepeater:~#

~~~~~~~

sudo: unable to resolve host openrepeater: Name or service not known* Failed to apply overlay '0_test' (kernel)
root@openrepeater:~#

[ 169.215159] OF: overlay: find target, node: /fragment@2, phandle 0x90 not found
[ 169.215175] OF: overlay: init_overlay_changeset() failed, ret = -22

For this hat, the !int is not even connected up and the gpio are all driving outputs for relays, so it is not necessary, but I agree it should be an optional feature for others.

As an aside, the mcp23017 interrupts have never worked correctly that I am aware of. There were complaints on the overlay thread for that device. The inputs work fine, but you cant subscribe to them and get interrupts triggered by gpio pins. It seems like it only considers the actual int pin for the device, but not for the gpio### targets.

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

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 4:28 pm

What kernel are you using then? uname - a

And which variant of pi? Most of the configs are the same between Pis, but its possible that there are options that have been missed.
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.

dloranger
Posts: 45
Joined: Wed Nov 02, 2016 1:56 am
Location: Seattle

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 4:44 pm

doing an apt-get update/upgrade currently as it is likely out of date, so whatever the current regular release is what will be in play, but I will confirm when it finishes.

RPI3B is what I am currently using

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

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 5:09 pm

I think your installation was sufficiently old that the dtoverlay command didn't support fragments patching other fragments. The upgrade should resolve that.

dloranger
Posts: 45
Joined: Wed Nov 02, 2016 1:56 am
Location: Seattle

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 5:20 pm

Updating has helped the modinfo not fall on its face at least

Code: Select all

root@openrepeater:~# uname -a
Linux openrepeater 5.4.51-v7+ #1333 SMP Mon Aug 10 16:45:19 BST 2020 armv7l GNU/Linux
root@openrepeater:~# modinfo gpio-pca953x
filename:       /lib/modules/5.4.51-v7+/kernel/drivers/gpio/gpio-pca953x.ko
license:        GPL
description:    GPIO expander driver for PCA953x
author:         eric miao <eric.miao@marvell.com>
srcversion:     D09B03E41498D50C3F3162D
alias:          i2c:xra1202
alias:          i2c:tca9554
alias:          i2c:tca9539
alias:          i2c:tca6424
alias:          i2c:tca6416
alias:          i2c:tca6408
alias:          i2c:pca6107
alias:          i2c:max7318
alias:          i2c:max7315
alias:          i2c:max7313
alias:          i2c:max7312
alias:          i2c:max7310
alias:          i2c:pcal9555a
alias:          i2c:pcal6524
alias:          i2c:pcal6416
alias:          i2c:pca9698
alias:          i2c:pca9575
alias:          i2c:pca9574
alias:          i2c:pca9557
alias:          i2c:pca9556
alias:          i2c:pca9555
alias:          i2c:pca9554
alias:          i2c:pca9539
alias:          i2c:pca9538
alias:          i2c:pca9537
alias:          i2c:pca9536
alias:          i2c:pca9535
alias:          i2c:pca9534
alias:          i2c:pca9505
alias:          i2c:pca6416
alias:          acpi*:INT3491:*
alias:          of:N*T*Cexar,xra1202C*
alias:          of:N*T*Cexar,xra1202
alias:          of:N*T*Connn,pca9654C*
alias:          of:N*T*Connn,pca9654
alias:          of:N*T*Connn,cat9554C*
alias:          of:N*T*Connn,cat9554
alias:          of:N*T*Cti,tca9539C*
alias:          of:N*T*Cti,tca9539
alias:          of:N*T*Cti,tca6424C*
alias:          of:N*T*Cti,tca6424
alias:          of:N*T*Cti,tca6416C*
alias:          of:N*T*Cti,tca6416
alias:          of:N*T*Cti,tca6408C*
alias:          of:N*T*Cti,tca6408
alias:          of:N*T*Cti,pca9536C*
alias:          of:N*T*Cti,pca9536
alias:          of:N*T*Cti,pca6107C*
alias:          of:N*T*Cti,pca6107
alias:          of:N*T*Cmaxim,max7318C*
alias:          of:N*T*Cmaxim,max7318
alias:          of:N*T*Cmaxim,max7315C*
alias:          of:N*T*Cmaxim,max7315
alias:          of:N*T*Cmaxim,max7313C*
alias:          of:N*T*Cmaxim,max7313
alias:          of:N*T*Cmaxim,max7312C*
alias:          of:N*T*Cmaxim,max7312
alias:          of:N*T*Cmaxim,max7310C*
alias:          of:N*T*Cmaxim,max7310
alias:          of:N*T*Cnxp,pcal9555aC*
alias:          of:N*T*Cnxp,pcal9555a
alias:          of:N*T*Cnxp,pcal6524C*
alias:          of:N*T*Cnxp,pcal6524
alias:          of:N*T*Cnxp,pcal6416C*
alias:          of:N*T*Cnxp,pcal6416
alias:          of:N*T*Cnxp,pca9698C*
alias:          of:N*T*Cnxp,pca9698
alias:          of:N*T*Cnxp,pca9575C*
alias:          of:N*T*Cnxp,pca9575
alias:          of:N*T*Cnxp,pca9574C*
alias:          of:N*T*Cnxp,pca9574
alias:          of:N*T*Cnxp,pca9557C*
alias:          of:N*T*Cnxp,pca9557
alias:          of:N*T*Cnxp,pca9556C*
alias:          of:N*T*Cnxp,pca9556
alias:          of:N*T*Cnxp,pca9555C*
alias:          of:N*T*Cnxp,pca9555
alias:          of:N*T*Cnxp,pca9554C*
alias:          of:N*T*Cnxp,pca9554
alias:          of:N*T*Cnxp,pca9539C*
alias:          of:N*T*Cnxp,pca9539
alias:          of:N*T*Cnxp,pca9538C*
alias:          of:N*T*Cnxp,pca9538
alias:          of:N*T*Cnxp,pca9537C*
alias:          of:N*T*Cnxp,pca9537
alias:          of:N*T*Cnxp,pca9536C*
alias:          of:N*T*Cnxp,pca9536
alias:          of:N*T*Cnxp,pca9535C*
alias:          of:N*T*Cnxp,pca9535
alias:          of:N*T*Cnxp,pca9534C*
alias:          of:N*T*Cnxp,pca9534
alias:          of:N*T*Cnxp,pca9505C*
alias:          of:N*T*Cnxp,pca9505
alias:          of:N*T*Cnxp,pca6416C*
alias:          of:N*T*Cnxp,pca6416
depends:        regmap-i2c
intree:         Y
name:           gpio_pca953x
vermagic:       5.4.51-v7+ SMP mod_unload modversions ARMv7 p2v8

Reinitiated the entry in /boot/config.txt

root@openrepeater:~# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@openrepeater:~#

I think this has it loading everything successfully, now to get the other card reinstalled.

~~~~

Related to one of the original comments about making it accept the other versions of the chipsets, I am not familiar with adding that code, but we should also include the TCA versions (version hit extended operating conditions) as wellas the ones with an "A" suffix which have an offset i2c address

https://e2e.ti.com/support/interface/f/138/t/840162

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

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 8:17 pm

Well if the overlay works, that's the first major hurdle. Ought to resolve the interrupts question before looking to merge it.

Adding in the additional compatible strings is more tedious than difficult.
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: 9281
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Overlay for pca9534 gpio expander?

Sat Aug 15, 2020 8:19 pm

And if the a varieties only change the i2c address, then that's already handled by the addr parameter. They don't need to change the compatible string.
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: 9281
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Overlay for pca9534 gpio expander?

Mon Aug 17, 2020 9:20 am

Commit in 5.8 - https://github.com/torvalds/linux/commi ... feb5e2fbe0
So it looks like we can have interrrupt support with no other real changes.

I'll sort a PR for this overlay (with the alternate compatible strings) and backporting that commit.
I can't find any eval boards or similar that use this chip, so testing it could be entertaining.
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.

dloranger
Posts: 45
Joined: Wed Nov 02, 2016 1:56 am
Location: Seattle

Re: Overlay for pca9534 gpio expander?

Mon Aug 17, 2020 2:14 pm

I will see if I can locate a dev board as well. I can design one quickly and get it fabbed in about a week. Shipping would be the challenge with getting it to you.

Just getting a chip and a surfboard (smt to TH adapter) would likely be far faster and cheaper for your location though.

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

Re: Overlay for pca9534 gpio expander?

Mon Aug 17, 2020 2:18 pm

The testing standard for optional, user-contributed overlays is lower, particularly so if it is a new submission. If the overlay works for you, looks reasonable to us and obeys our rules (including having an entry in the overlay README file) then it is likely to be accepted if offered as a Pull Request (https://github.com/raspberrypi/linux/pulls).

dloranger
Posts: 45
Joined: Wed Nov 02, 2016 1:56 am
Location: Seattle

Re: Overlay for pca9534 gpio expander?

Mon Aug 17, 2020 2:29 pm

It seems this chipset has many clones that are footprint and software compatible.

I am finding the additional chipset families below claiming the are drop in options to the pca9534.

Xra1200
Max7315

Let me know where I can help with anything on the PR.

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

Re: Overlay for pca9534 gpio expander?

Mon Aug 17, 2020 2:39 pm

We can find bits to test this out, it'll just take a little time. Taking a SMD breakout board such as this and finding a few of the relevant chips to mount on it is well within even my soldering capabilities (and we have people who are better at it than me around too).

Other things have come up today, but I'll sort a PR for the basics first, then worry about interrupts when we can test it. As Phil says, as long as it has worked "as-is" for one person, that's good enough for a first merge.
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.

dloranger
Posts: 45
Joined: Wed Nov 02, 2016 1:56 am
Location: Seattle

Re: Overlay for pca9534 gpio expander?

Mon Aug 17, 2020 2:57 pm

Sounds great for me, I will toggle the relays today and such just to make sure thing are behaving as expected, but I am not expecting any issues at this layer.

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

Re: Overlay for pca9534 gpio expander?

Mon Aug 17, 2020 5:36 pm

PR created - https://github.com/raspberrypi/linux/pull/3800

I'll go shopping on Ebay for bits to make up a test board.
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: 3133
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Overlay for pca9534 gpio expander?

Tue Aug 18, 2020 10:15 am

The PR has been merged, and the overlay will be in future kernel releases.

Return to “Device Tree”