Skip to contentSkip to conversation

gpio: pca953x: Add support for MaxLinear's XRA1200 / XRA1200P

PATCH Superseded Uwe Kleine-König 2 participants 3 messages Oct 25 GPIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: pca953x: Add support for MaxLinear's XRA1200 / XRA1200P

These are documented to be compatible with PCA9534 and PCA9554 respectively. The difference between the two is, that the XRA1200P has the configurable pull-ups enabled upon power-up.

Datasheet available at https://www.maxlinear.com/ds/xra1200.pdf.

---
 drivers/gpio/gpio-pca953x.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpio/gpio-pca953x.c +5 -0
index afec5ec23696..ea01fd152ac2 100644
@@ -124,6 +124,8 @@ static const struct i2c_device_id pca953x_id[] = {
 	{ .name = "tca9538", .driver_data = 8  | PCA953X_TYPE | PCA_INT },
 	{ .name = "tca9539", .driver_data = 16 | PCA953X_TYPE | PCA_INT },
 	{ .name = "tca9554", .driver_data = 8  | PCA953X_TYPE | PCA_INT },
+	{ .name = "xra1200", .driver_data = 8  | PCA953X_TYPE },
+	{ .name = "xra1200p", .driver_data = 8  | PCA953X_TYPE },
 	{ .name = "xra1202", .driver_data = 8  | PCA953X_TYPE },
 
 	{ .name = "tcal6408", .driver_data = 8  | PCA953X_TYPE | PCA_LATCH_INT },
@@ -1485,6 +1487,9 @@ static const struct of_device_id pca953x_dt_ids[] = {
 	{ .compatible = "nxp,pcal9554b", .data = OF_953X( 8, PCA_LATCH_INT), },
 	{ .compatible = "nxp,pcal9555a", .data = OF_953X(16, PCA_LATCH_INT), },
 
+	{ .compatible = "maxlinear,xra1200",  .data = OF_953X( 8, PCA_INT), },
+	{ .compatible = "maxlinear,xra1200p", .data = OF_953X( 8, PCA_INT), },
+
 	{ .compatible = "maxim,max7310", .data = OF_953X( 8, 0), },
 	{ .compatible = "maxim,max7312", .data = OF_953X(16, PCA_INT), },
 	{ .compatible = "maxim,max7313", .data = OF_953X(16, PCA_INT), },
Signature · 1 line
2.47.3
#1 lore raw
Quoted 16 lines · Uwe Kleine-König

These are documented to be compatible with PCA9534 and PCA9554 respectively. The difference between the two is, that the XRA1200P has the configurable pull-ups enabled upon power-up.

Datasheet available at https://www.maxlinear.com/ds/xra1200.pdf.

---
 drivers/gpio/gpio-pca953x.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpio/gpio-pca953x.c +0 -0
index afec5ec23696..ea01fd152ac2 100644

drivers/gpio/gpio-pca953x.c static const struct i2c_device_id pca953x_id[] = { · line 128

Quoted 5 lines
drivers/gpio/gpio-pca953x.c +2 -0
@@ -124,6 +124,8 @@ static const struct i2c_device_id pca953x_id[] = {
 	{ .name = "tca9538", .driver_data = 8  | PCA953X_TYPE | PCA_INT },
 	{ .name = "tca9539", .driver_data = 16 | PCA953X_TYPE | PCA_INT },
 	{ .name = "tca9554", .driver_data = 8  | PCA953X_TYPE | PCA_INT },
+	{ .name = "xra1200", .driver_data = 8  | PCA953X_TYPE },
+	{ .name = "xra1200p", .driver_data = 8  | PCA953X_TYPE },

Argh, after seeing that patch in my inbox I saw that the two lines lack a | PCA_INT.

I'll wait a bit before resending ...

Best regards
Uwe

#2 lore raw
In reply to Uwe Kleine-König
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] gpio: pca953x: missing PCA_INT flag for xra1200/xra1200p in pca953x_id --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] gpio: pca953x: missing PCA_INT flag for xra1200/xra1200p in pca953x_id --

commit 79260b2b7ac0a0bff8a0c5399da85adabe336338
Author: Uwe Kleine-König <[email protected]>

gpio: pca953x: Add support for MaxLinear's XRA1200 / XRA1200P

This commit adds I2C device ID and OF match table entries to support the MaxLinear XRA1200 and XRA1200P 8-bit I2C GPIO expanders in the pca953x driver.

drivers/gpio/gpio-pca953x.c static const struct i2c_device_id pca953x_id[] = { · line 128

Quoted 10 lines
drivers/gpio/gpio-pca953x.c +2 -0
index afec5ec236968..ea01fd152ac22 100644
@@ -124,6 +124,8 @@ static const struct i2c_device_id pca953x_id[] = {
 	{ .name = "tca9538", .driver_data = 8  | PCA953X_TYPE | PCA_INT },
 	{ .name = "tca9539", .driver_data = 16 | PCA953X_TYPE | PCA_INT },
 	{ .name = "tca9554", .driver_data = 8  | PCA953X_TYPE | PCA_INT },
+	{ .name = "xra1200", .driver_data = 8  | PCA953X_TYPE },
+	{ .name = "xra1200p", .driver_data = 8  | PCA953X_TYPE },

[Severity: Medium]
Should the xra1200 and xra1200p entries in pca953x_id[] in drivers/gpio/gpio-pca953x.c also include the PCA_INT flag in .driver_data?

In pca953x_dt_ids[], the corresponding entries for these devices set PCA_INT, matching the pca9534 and pca9554 entries that they are compatible with:

	{ .compatible = "maxlinear,xra1200",  .data = OF_953X( 8, PCA_INT), },
	{ .compatible = "maxlinear,xra1200p", .data = OF_953X( 8, PCA_INT), },

However, when an xra1200 or xra1200p device is matched via pca953x_id[] in pca953x_probe() -> i2c_get_match_data(), chip->driver_data will not have PCA_INT set, causing pca953x_irq_setup() to return early without setting up interrupt support:

	if (!(chip->driver_data & PCA_INT))
		return 0;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1