gpio-pca953x driver and PCA9536 chip
RFC PATCH 1/1 gpio-pca953x driver and PCA9536 chip
Hi,
The driver sets register #02 (inversion) to 0x01 instead of 0x00 on my board.
Reason: device_pca953x_init() does not initialize val buffer because NBANK() returns for PCA9536 ngpio=4 value 0 instead of 1.
My proposed code-patch for 3.14.17 is below.
Because I don't work on stable/next I can't deliver complete/ready patch. Please for comments.
best regards
Janusz
drivers/gpio/gpio-pca953x.c +1 -1
@@ -75,7 +75,7 @@ MODULE_DEVICE_TABLE(i2c, pca953x_id);#define MAX_BANK 5#define BANK_SZ 8 -#define NBANK (chip) (chip->gpio_chip.ngpio / BANK_SZ) +#define NBANK (chip) DIV_ROUND_UP(chip->gpio_chip.ngpio, BANK_SZ)struct pca953x_chip {unsigned gpio_start;
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 55E4641D.7050603-cjVIcFy54eMe9JSWTWOYM+658FiBabzs@public.gmane.org
W dniu 2015-08-31 o 16:26, Janusz Użycki pisze:
Quoted 16 lines
Hi,
The driver sets register #02 (inversion) to
0x01instead of0x00on my board.
Reason:device_pca953x_init()does not initialize val buffer becauseNBANK()returns for PCA9536 ngpio=4 value 0 instead of 1.My proposed code-patch for 3.14.17 is below.
Because I don't work on stable/next I can't deliver complete/ready patch. Please for comments.best regards
Janusz
drivers/gpio/gpio-pca953x.c MODULE_DEVICE_TABLE(i2c, pca953x_id); · line 81
Quoted 8 lines
drivers/gpio/gpio-pca953x.c +1
-1@@ -75,7 +75,7 @@ MODULE_DEVICE_TABLE(i2c, pca953x_id);#define MAX_BANK 5#define BANK_SZ 8 -#define NBANK (chip) (chip->gpio_chip.ngpio / BANK_SZ) +#define NBANK (chip) DIV_ROUND_UP(chip->gpio_chip.ngpio, BANK_SZ)struct pca953x_chip {unsigned gpio_start;
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Adding linux-gpio and some people that have been patching this driver to TO-line.
Grygorii et al, does this look correct? Anyone who can test and send a patch for mainline?
Yours,
Linus Walleij
Quoted 18 lines · Janusz Użycki
Hi,
The driver sets register #02 (inversion) to
0x01instead of0x00on my board.
Reason:device_pca953x_init()does not initialize val buffer becauseNBANK()returns
for PCA9536 ngpio=4 value 0 instead of 1.My proposed code-patch for 3.14.17 is below.
Because I don't work on stable/next I can't deliver complete/ready patch. Please for comments.best regards
Janusz
drivers/gpio/gpio-pca953x.c MODULE_DEVICE_TABLE(i2c, pca953x_id); · line 81
Quoted 8 lines
drivers/gpio/gpio-pca953x.c +1
-1@@ -75,7 +75,7 @@ MODULE_DEVICE_TABLE(i2c, pca953x_id);#define MAX_BANK 5#define BANK_SZ 8 -#define NBANK (chip) (chip->gpio_chip.ngpio / BANK_SZ) +#define NBANK (chip) DIV_ROUND_UP(chip->gpio_chip.ngpio, BANK_SZ)struct pca953x_chip {unsigned gpio_start;
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 32 lines · Linus Walleij
Adding linux-gpio and some people that have been patching this driver to TO-line.
Grygorii et al, does this look correct? Anyone who can test and send a patch for mainline?
Yours,
Linus WalleijQuoted 21 lines · Janusz Użycki
Hi,
The driver sets register #02 (inversion) to
0x01instead of0x00on my board.
Reason:device_pca953x_init()does not initialize val buffer becauseNBANK()returns
for PCA9536 ngpio=4 value 0 instead of 1.My proposed code-patch for 3.14.17 is below.
Because I don't work on stable/next I can't deliver complete/ready patch. Please for comments.best regards
Januszdrivers/gpio/gpio-pca953x.c +0
-0@@ -75,7 +75,7 @@ MODULE_DEVICE_TABLE(i2c, pca953x_id);#define MAX_BANK 5#define BANK_SZ 8
Quoted 5 lines
drivers/gpio/gpio-pca953x.c MODULE_DEVICE_TABLE(i2c, pca953x_id); · line 81
Quoted 5 lines
drivers/gpio/gpio-pca953x.c +1
-1-#define NBANK (chip) (chip->gpio_chip.ngpio / BANK_SZ) +#define NBANK (chip) DIV_ROUND_UP(chip->gpio_chip.ngpio, BANK_SZ)struct pca953x_chip {unsigned gpio_start;
Seems yes, but I can't test it - have no such HW now.
As per code, NBANK(chip) expected to return number of 8-bit banks, but now it returns NBANK-1.
Additional info:
- Corresponding code was changed by Gregory CLEMENT
commit: f5f0b7aa897ebf6b0d077356a787526212460dd7
Signature · 6 lines
regards, -grygorii -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html