Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: palmas: add dt support

Add of_device_id table for Palma GPIO to be enable the
driver from DT file.

The driver can be registered from DT file as:
palmas: tps65913@58 {
:::::::::::
palmas_gpio: palmas_gpio {
compatible = "ti,palmas-gpio";
gpio-controller;
#gpio-cells = <2>;
};
};

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Laxman Dewangan and committed by
Linus Walleij
5763318f 5e0dd400

+38 -1
+27
Documentation/devicetree/bindings/gpio/gpio-palmas.txt
··· 1 + Palmas GPIO controller bindings 2 + 3 + Required properties: 4 + - compatible: 5 + - "ti,palams-gpio" for palma series of the GPIO controller 6 + - "ti,tps80036-gpio" for Palma series device TPS80036. 7 + - "ti,tps65913-gpio" for palma series device TPS65913. 8 + - "ti,tps65914-gpio" for palma series device TPS65914. 9 + - #gpio-cells : Should be two. 10 + - first cell is the gpio pin number 11 + - second cell is used to specify the gpio polarity: 12 + 0 = active high 13 + 1 = active low 14 + - gpio-controller : Marks the device node as a GPIO controller. 15 + 16 + Note: This gpio node will be sub node of palmas node. 17 + 18 + Example: 19 + palmas: tps65913@58 { 20 + ::::::::::: 21 + palmas_gpio: palmas_gpio { 22 + compatible = "ti,palmas-gpio"; 23 + gpio-controller; 24 + #gpio-cells = <2>; 25 + }; 26 + ::::::::::: 27 + };
+11 -1
drivers/gpio/gpio-palmas.c
··· 134 134 palmas_gpio->gpio_chip.get = palmas_gpio_get; 135 135 palmas_gpio->gpio_chip.dev = &pdev->dev; 136 136 #ifdef CONFIG_OF_GPIO 137 - palmas_gpio->gpio_chip.of_node = palmas->dev->of_node; 137 + palmas_gpio->gpio_chip.of_node = pdev->dev.of_node; 138 138 #endif 139 139 palmas_pdata = dev_get_platdata(palmas->dev); 140 140 if (palmas_pdata && palmas_pdata->gpio_base) ··· 159 159 return gpiochip_remove(&palmas_gpio->gpio_chip); 160 160 } 161 161 162 + static struct of_device_id of_palmas_gpio_match[] = { 163 + { .compatible = "ti,palmas-gpio"}, 164 + { .compatible = "ti,tps65913-gpio"}, 165 + { .compatible = "ti,tps65914-gpio"}, 166 + { .compatible = "ti,tps80036-gpio"}, 167 + { }, 168 + }; 169 + MODULE_DEVICE_TABLE(of, of_palmas_gpio_match); 170 + 162 171 static struct platform_driver palmas_gpio_driver = { 163 172 .driver.name = "palmas-gpio", 164 173 .driver.owner = THIS_MODULE, 174 + .driver.of_match_table = of_palmas_gpio_match, 165 175 .probe = palmas_gpio_probe, 166 176 .remove = palmas_gpio_remove, 167 177 };