|
@@ -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)
|