On Tue, Apr 24, 2012 at 3:48 PM, Andreas SchallenbergYes, I'll add it.
<Andreas.Schallenberg@xxxxxxxxxxxxxxxxxx> wrote:
From: Andreas Schallenberg<aschallenberg@GWS026Linux.(none)>Some more detailed commit blurb here detailing some TC6424 characteristics
maybe?
Yes, it is a 24 bit I/O expander.struct pca953x_chip {So ther are not 16bit?
unsigned gpio_start;
- uint16_t reg_output;
- uint16_t reg_direction;
+ uint reg_output;
+ uint reg_direction;
struct mutex i2c_lock;
Suggest using the kernel-internal u16 otherwise.
Or u32 if they really are 32bit. Which I suspect they are.
Or if they are 24bit as I see in some below code,
cosider:Nice. Haven't seen this before.
u32 foo:24;
Changing to u32.-static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val)u32?
+static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint val)
All the other chips supported by this driver have 8 or 16 GPIOs. Its the only one with 24.if (chip->gpio_chip.ngpio<= 8)And you are positively certain that this does not create a problem
ret = i2c_smbus_write_byte_data(chip->client, reg, val);
+ else if (chip->gpio_chip.ngpio> 16) {
+ ret = i2c_smbus_write_word_data(chip->client,
+ (reg<< 2) | REG_ADDR_AI,
+ val& 0xffff);
+ ret = i2c_smbus_write_byte_data(chip->client,
+ (reg<< 2) + 2,
+ (val& 0xff0000)>> 16);
+ }
else {
switch (chip->chip_type) {
case PCA953X_TYPE:
on other chips in this familym or is this the only chip with
16 IRQs?
Changing to u32.@@ -121,12 +131,17 @@ static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val)u32?
return 0;
}
-static int pca953x_read_reg(struct pca953x_chip *chip, int reg, uint16_t *val)
+static int pca953x_read_reg(struct pca953x_chip *chip, int reg, uint *val)
Switching to == 24 in both places.{So is the comparison going to be> 16 (as above) or ==24 as here?
int ret;
if (chip->gpio_chip.ngpio<= 8)
ret = i2c_smbus_read_byte_data(chip->client, reg);
+ else if (chip->gpio_chip.ngpio == 24) {
Decide for *one* way of detecting.
Changing to u32.@@ -135,14 +150,14 @@ static int pca953x_read_reg(struct pca953x_chip *chip, int reg, uint16_t *val)u32?
return ret;
}
- *val = (uint16_t)ret;
+ *val = (uint)ret;
Changing to u32.static int pca953x_gpio_direction_input(struct gpio_chip *gc, unsigned off)u32?
{
struct pca953x_chip *chip;
- uint16_t reg_val;
+ uint reg_val;
Changing to u32.@@ -173,7 +188,7 @@ static int pca953x_gpio_direction_output(struct gpio_chip *gc,u32?
unsigned off, int val)
{
struct pca953x_chip *chip;
- uint16_t reg_val;
+ uint reg_val;
Changing to u32.@@ -223,7 +238,7 @@ exit:u32?
static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off)
{
struct pca953x_chip *chip;
- uint16_t reg_val;
+ uint reg_val;
Changing to u32.@@ -253,7 +268,7 @@ static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off)u32?
static void pca953x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val)
{
struct pca953x_chip *chip;
- uint16_t reg_val;
+ uint reg_val;
Changing to u32.@@ -386,7 +401,7 @@ static struct irq_chip pca953x_irq_chip = {u32?
static uint16_t pca953x_irq_pending(struct pca953x_chip *chip)
{
- uint16_t cur_stat;
+ uint cur_stat;
Changing to u32.@@ -449,6 +464,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,u32?
{
struct i2c_client *client = chip->client;
int ret, offset = 0;
+ uint temporary;
Changing to u32.@@ -606,7 +623,7 @@ out:u32?
static int __devinit device_pca957x_init(struct pca953x_chip *chip, int invert)
{
int ret;
- uint16_t val = 0;
+ uint val = 0;