]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
gpio: lib: Add support to change pin in GPIO mode on suspend
authorLaxman Dewangan <ldewangan@nvidia.com>
Tue, 18 Aug 2015 11:50:11 +0000 (17:20 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Thu, 20 Aug 2015 10:14:13 +0000 (03:14 -0700)
Add support to parse DT property "gpio-suspend-to-sfio" from
DT node of device which convert the pins in GPIO mode to
SFIO mode.

bug 1650903

Change-Id: Ia12e37de37f0dd1e376a7c1d840b3efc5a85dd00
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/785377

drivers/gpio/gpiolib-of.c

index 80336a7813982e11d620f812e4bf7edd19c6056c..1b80d0115f635df532cdb53d9a395dc255677466 100644 (file)
@@ -376,6 +376,20 @@ void of_gpiochip_suspend(struct gpio_chip *chip)
                        if (!ret)
                                chip->direction_output(chip, pval, 1);
                }
+
+               count = of_property_count_u32(child, "gpio-suspend-to-sfio");
+               for (i = 0; i < count; ++i) {
+                       found = true;
+                       ret = of_property_read_u32_index(child,
+                                       "gpio-suspend-to-sfio", i, &pval);
+                       if (!ret) {
+                               if (chip->request)
+                                       chip->request(chip, pval);
+                               if (chip->free)
+                                       chip->free(chip, pval);
+                       }
+               }
+
                if (found) {
                        statename = NULL;
                        /* Determine whether gpio-init-names property names the state */