summaryrefslogtreecommitdiff
path: root/drivers/mfd/tps6591x.c
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2011-04-25 21:02:41 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:43:01 -0800
commit701261cb128273fcd0490ec9417f4d355a6ce042 (patch)
tree37800c5d1aef331f8ce5a69d3ebe539a8d9a7ff4 /drivers/mfd/tps6591x.c
parentf501c93f859761f4f884a374b72179f164b2742c (diff)
mfd: tps6591x: Implementing input mode of tps6591x-gpio
Implemention direction_input() of the tps6591x-gpio and returing correct value from gpio based on direction. Original-Change-Id: I114a7101c2a14b61b2e475bdab547ea7601f6b93 Reviewed-on: http://git-master/r/29627 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Tested-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Rebase-Id: Rce033a2827107f86ea05e4dd3c47fca59aa07e71
Diffstat (limited to 'drivers/mfd/tps6591x.c')
-rw-r--r--[-rwxr-xr-x]drivers/mfd/tps6591x.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/mfd/tps6591x.c b/drivers/mfd/tps6591x.c
index 3a8fb9aadbe7..0852eb43c2aa 100755..100644
--- a/drivers/mfd/tps6591x.c
+++ b/drivers/mfd/tps6591x.c
@@ -289,7 +289,10 @@ static int tps6591x_gpio_get(struct gpio_chip *gc, unsigned offset)
if (ret)
return ret;
- return val & 0x1;
+ if (val & 0x4)
+ return val & 0x1;
+ else
+ return ((val & 0x2)? 1: 0);
}
static void tps6591x_gpio_set(struct gpio_chip *chip, unsigned offset,
@@ -304,8 +307,18 @@ static void tps6591x_gpio_set(struct gpio_chip *chip, unsigned offset,
static int tps6591x_gpio_input(struct gpio_chip *gc, unsigned offset)
{
- /* FIXME: add handling of GPIOs as dedicated inputs */
- return -ENOSYS;
+ struct tps6591x *tps6591x = container_of(gc, struct tps6591x, gpio);
+ uint8_t reg_val;
+ int ret;
+
+ ret = __tps6591x_read(tps6591x->client, TPS6591X_GPIO_BASE_ADDR +
+ offset, &reg_val);
+ if (ret)
+ return ret;
+
+ reg_val &= ~0x4;
+ return __tps6591x_write(tps6591x->client, TPS6591X_GPIO_BASE_ADDR +
+ offset, reg_val);
}
static int tps6591x_gpio_output(struct gpio_chip *gc, unsigned offset,