summaryrefslogtreecommitdiff
path: root/drivers/mfd
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2011-04-25 21:02:41 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-04-28 19:52:56 -0700
commitbe220d5fa55408fedec59f194c59eb95dc2d1573 (patch)
treec604dd230c88db49ef10286d24d58e2a1137c0e6 /drivers/mfd
parent03cd045d6c87ed3bd46df792d3a6645371241fc9 (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. 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>
Diffstat (limited to 'drivers/mfd')
-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,