diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-02-01 12:09:04 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-02-16 13:07:58 -0800 |
commit | a99c44e4c597baab1d0e5bdc7598f1fb927823ea (patch) | |
tree | b082df19f0496a01ec74e9015174b363eaf2e458 /drivers/gpio/gpio-tps65910.c | |
parent | ee94b6b4952bcf912a306d7416c90f0f259a98a7 (diff) |
gpio: tps65910: Add sleep control support
The device tps65910/tps65911 supports the sleep
functionality in some of gpios. If gpio is configured
in output mode and sleep is enabled then during device
sleep state, the output of gpio becomes LOW regardless
of non-sleep output value.
Such gpio can be used to control regulator switch such
that output of regulator is off in device sleep state.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cherry-picked from mainline commit:
ccd68fff6b86b93a2d69caf4679c0ba4ca6dbc53
Resolve merge conflicts.
Change-Id: Ib424499821fde2ae916ae3792e980eab7dbdae4a
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/79788
Diffstat (limited to 'drivers/gpio/gpio-tps65910.c')
-rw-r--r-- | drivers/gpio/gpio-tps65910.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c index 91f45b965d1e..7eef648a3351 100644 --- a/drivers/gpio/gpio-tps65910.c +++ b/drivers/gpio/gpio-tps65910.c @@ -69,6 +69,7 @@ static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset) void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base) { int ret; + struct tps65910_board *board_data; if (!gpio_base) return; @@ -80,10 +81,10 @@ void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base) switch(tps65910_chip_id(tps65910)) { case TPS65910: - tps65910->gpio.ngpio = 6; + tps65910->gpio.ngpio = TPS65910_NUM_GPIO; break; case TPS65911: - tps65910->gpio.ngpio = 9; + tps65910->gpio.ngpio = TPS65911_NUM_GPIO; break; default: return; @@ -95,6 +96,21 @@ void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base) tps65910->gpio.set = tps65910_gpio_set; tps65910->gpio.get = tps65910_gpio_get; + /* Configure sleep control for gpios */ + board_data = dev_get_platdata(tps65910->dev); + if (board_data) { + int i; + for (i = 0; i < tps65910->gpio.ngpio; ++i) { + if (board_data->en_gpio_sleep[i]) { + ret = tps65910_set_bits(tps65910, + TPS65910_GPIO0 + i, GPIO_SLEEP_MASK); + if (ret < 0) + dev_warn(tps65910->dev, + "GPIO Sleep setting failed\n"); + } + } + } + ret = gpiochip_add(&tps65910->gpio); if (ret) |