aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-tps65910.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/gpio-tps65910.c')
-rw-r--r--drivers/gpio/gpio-tps65910.c20
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)
69void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base) 69void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base)
70{ 70{
71 int ret; 71 int ret;
72 struct tps65910_board *board_data;
72 73
73 if (!gpio_base) 74 if (!gpio_base)
74 return; 75 return;
@@ -80,10 +81,10 @@ void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base)
80 81
81 switch(tps65910_chip_id(tps65910)) { 82 switch(tps65910_chip_id(tps65910)) {
82 case TPS65910: 83 case TPS65910:
83 tps65910->gpio.ngpio = 6; 84 tps65910->gpio.ngpio = TPS65910_NUM_GPIO;
84 break; 85 break;
85 case TPS65911: 86 case TPS65911:
86 tps65910->gpio.ngpio = 9; 87 tps65910->gpio.ngpio = TPS65911_NUM_GPIO;
87 break; 88 break;
88 default: 89 default:
89 return; 90 return;
@@ -95,6 +96,21 @@ void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base)
95 tps65910->gpio.set = tps65910_gpio_set; 96 tps65910->gpio.set = tps65910_gpio_set;
96 tps65910->gpio.get = tps65910_gpio_get; 97 tps65910->gpio.get = tps65910_gpio_get;
97 98
99 /* Configure sleep control for gpios */
100 board_data = dev_get_platdata(tps65910->dev);
101 if (board_data) {
102 int i;
103 for (i = 0; i < tps65910->gpio.ngpio; ++i) {
104 if (board_data->en_gpio_sleep[i]) {
105 ret = tps65910_set_bits(tps65910,
106 TPS65910_GPIO0 + i, GPIO_SLEEP_MASK);
107 if (ret < 0)
108 dev_warn(tps65910->dev,
109 "GPIO Sleep setting failed\n");
110 }
111 }
112 }
113
98 ret = gpiochip_add(&tps65910->gpio); 114 ret = gpiochip_add(&tps65910->gpio);
99 115
100 if (ret) 116 if (ret)