Commit 5e67cc40 authored by Linus Walleij's avatar Linus Walleij

Merge branch 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6 into grant

Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parents 6887a413 96b70641
...@@ -98,12 +98,11 @@ static int pca953x_write_reg(struct pca953x_chip *chip, int reg, u32 val) ...@@ -98,12 +98,11 @@ static int pca953x_write_reg(struct pca953x_chip *chip, int reg, u32 val)
if (chip->gpio_chip.ngpio <= 8) if (chip->gpio_chip.ngpio <= 8)
ret = i2c_smbus_write_byte_data(chip->client, reg, val); ret = i2c_smbus_write_byte_data(chip->client, reg, val);
else if (chip->gpio_chip.ngpio == 24) { else if (chip->gpio_chip.ngpio == 24) {
ret = i2c_smbus_write_word_data(chip->client, cpu_to_le32s(&val);
ret = i2c_smbus_write_i2c_block_data(chip->client,
(reg << 2) | REG_ADDR_AI, (reg << 2) | REG_ADDR_AI,
val & 0xffff); 3,
ret = i2c_smbus_write_byte_data(chip->client, (u8 *) &val);
(reg << 2) + 2,
(val & 0xff0000) >> 16);
} }
else { else {
switch (chip->chip_type) { switch (chip->chip_type) {
...@@ -135,22 +134,27 @@ static int pca953x_read_reg(struct pca953x_chip *chip, int reg, u32 *val) ...@@ -135,22 +134,27 @@ static int pca953x_read_reg(struct pca953x_chip *chip, int reg, u32 *val)
{ {
int ret; int ret;
if (chip->gpio_chip.ngpio <= 8) if (chip->gpio_chip.ngpio <= 8) {
ret = i2c_smbus_read_byte_data(chip->client, reg); ret = i2c_smbus_read_byte_data(chip->client, reg);
else if (chip->gpio_chip.ngpio == 24) { *val = ret;
ret = i2c_smbus_read_word_data(chip->client, reg << 2);
ret |= (i2c_smbus_read_byte_data(chip->client,
(reg << 2) + 2)<<16);
} }
else else if (chip->gpio_chip.ngpio == 24) {
*val = 0;
ret = i2c_smbus_read_i2c_block_data(chip->client,
(reg << 2) | REG_ADDR_AI,
3,
(u8 *) val);
le32_to_cpus(val);
} else {
ret = i2c_smbus_read_word_data(chip->client, reg << 1); ret = i2c_smbus_read_word_data(chip->client, reg << 1);
*val = ret;
}
if (ret < 0) { if (ret < 0) {
dev_err(&chip->client->dev, "failed reading register\n"); dev_err(&chip->client->dev, "failed reading register\n");
return ret; return ret;
} }
*val = (u32)ret;
return 0; return 0;
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/slab.h> #include <linux/slab.h>
/* Private data structure for of_gpiochip_is_match */ /* Private data structure for of_gpiochip_find_and_xlate */
struct gg_data { struct gg_data {
enum of_gpio_flags *flags; enum of_gpio_flags *flags;
struct of_phandle_args gpiospec; struct of_phandle_args gpiospec;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment