diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2012-07-05 10:58:54 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-07-05 10:58:54 -0400 |
commit | 5e67cc4041304a0dc77e6cfbb355d69eefb883d0 (patch) | |
tree | 4eb04d0a2890f2e0a182e762071fea4ffb5abe5d /drivers/gpio | |
parent | 6887a4131da3adaab011613776d865f4bcfb5678 (diff) | |
parent | 96b70641b937e99c1579cb6ebbcdb7b0af98cdd0 (diff) |
Merge branch 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6 into grant
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-pca953x.c | 28 | ||||
-rw-r--r-- | drivers/gpio/gpiolib-of.c | 2 |
2 files changed, 17 insertions, 13 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 1c313c710be3..de24af202447 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c | |||
@@ -98,12 +98,11 @@ static int pca953x_write_reg(struct pca953x_chip *chip, int reg, u32 val) | |||
98 | if (chip->gpio_chip.ngpio <= 8) | 98 | if (chip->gpio_chip.ngpio <= 8) |
99 | ret = i2c_smbus_write_byte_data(chip->client, reg, val); | 99 | ret = i2c_smbus_write_byte_data(chip->client, reg, val); |
100 | else if (chip->gpio_chip.ngpio == 24) { | 100 | else if (chip->gpio_chip.ngpio == 24) { |
101 | ret = i2c_smbus_write_word_data(chip->client, | 101 | cpu_to_le32s(&val); |
102 | ret = i2c_smbus_write_i2c_block_data(chip->client, | ||
102 | (reg << 2) | REG_ADDR_AI, | 103 | (reg << 2) | REG_ADDR_AI, |
103 | val & 0xffff); | 104 | 3, |
104 | ret = i2c_smbus_write_byte_data(chip->client, | 105 | (u8 *) &val); |
105 | (reg << 2) + 2, | ||
106 | (val & 0xff0000) >> 16); | ||
107 | } | 106 | } |
108 | else { | 107 | else { |
109 | switch (chip->chip_type) { | 108 | switch (chip->chip_type) { |
@@ -135,22 +134,27 @@ static int pca953x_read_reg(struct pca953x_chip *chip, int reg, u32 *val) | |||
135 | { | 134 | { |
136 | int ret; | 135 | int ret; |
137 | 136 | ||
138 | if (chip->gpio_chip.ngpio <= 8) | 137 | if (chip->gpio_chip.ngpio <= 8) { |
139 | ret = i2c_smbus_read_byte_data(chip->client, reg); | 138 | ret = i2c_smbus_read_byte_data(chip->client, reg); |
140 | else if (chip->gpio_chip.ngpio == 24) { | 139 | *val = ret; |
141 | ret = i2c_smbus_read_word_data(chip->client, reg << 2); | ||
142 | ret |= (i2c_smbus_read_byte_data(chip->client, | ||
143 | (reg << 2) + 2)<<16); | ||
144 | } | 140 | } |
145 | else | 141 | else if (chip->gpio_chip.ngpio == 24) { |
142 | *val = 0; | ||
143 | ret = i2c_smbus_read_i2c_block_data(chip->client, | ||
144 | (reg << 2) | REG_ADDR_AI, | ||
145 | 3, | ||
146 | (u8 *) val); | ||
147 | le32_to_cpus(val); | ||
148 | } else { | ||
146 | ret = i2c_smbus_read_word_data(chip->client, reg << 1); | 149 | ret = i2c_smbus_read_word_data(chip->client, reg << 1); |
150 | *val = ret; | ||
151 | } | ||
147 | 152 | ||
148 | if (ret < 0) { | 153 | if (ret < 0) { |
149 | dev_err(&chip->client->dev, "failed reading register\n"); | 154 | dev_err(&chip->client->dev, "failed reading register\n"); |
150 | return ret; | 155 | return ret; |
151 | } | 156 | } |
152 | 157 | ||
153 | *val = (u32)ret; | ||
154 | return 0; | 158 | return 0; |
155 | } | 159 | } |
156 | 160 | ||
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index d18068a9f3ec..8389d4a0ec45 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <linux/of_gpio.h> | 21 | #include <linux/of_gpio.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | 23 | ||
24 | /* Private data structure for of_gpiochip_is_match */ | 24 | /* Private data structure for of_gpiochip_find_and_xlate */ |
25 | struct gg_data { | 25 | struct gg_data { |
26 | enum of_gpio_flags *flags; | 26 | enum of_gpio_flags *flags; |
27 | struct of_phandle_args gpiospec; | 27 | struct of_phandle_args gpiospec; |