24 #include <linux/errno.h>
26 #include <linux/kernel.h>
27 #include <linux/module.h>
33 #define TPS6586X_GPIOSET1 0x5d
34 #define TPS6586X_GPIOSET2 0x5e
56 return !!(val & (1 <<
offset));
59 static void tps6586x_gpio_set(
struct gpio_chip *gc,
unsigned offset,
62 struct tps6586x_gpio *tps6586x_gpio = to_tps6586x_gpio(gc);
65 value << offset, 1 << offset);
68 static int tps6586x_gpio_output(
struct gpio_chip *gc,
unsigned offset,
71 struct tps6586x_gpio *tps6586x_gpio = to_tps6586x_gpio(gc);
74 tps6586x_gpio_set(gc, offset, value);
76 val = 0x1 << (offset * 2);
77 mask = 0x3 << (offset * 2);
86 struct tps6586x_gpio *tps6586x_gpio;
89 pdata = dev_get_platdata(pdev->
dev.parent);
93 dev_err(&pdev->
dev,
"Could not allocate tps6586x_gpio\n");
106 tps6586x_gpio->
gpio_chip.direction_output = tps6586x_gpio_output;
107 tps6586x_gpio->
gpio_chip.set = tps6586x_gpio_set;
108 tps6586x_gpio->
gpio_chip.get = tps6586x_gpio_get;
110 #ifdef CONFIG_OF_GPIO
111 tps6586x_gpio->
gpio_chip.of_node = pdev->
dev.parent->of_node;
120 dev_err(&pdev->
dev,
"Could not register gpiochip, %d\n", ret);
124 platform_set_drvdata(pdev, tps6586x_gpio);
131 struct tps6586x_gpio *tps6586x_gpio = platform_get_drvdata(pdev);
137 .driver.name =
"tps6586x-gpio",
139 .probe = tps6586x_gpio_probe,
143 static int __init tps6586x_gpio_init(
void)
149 static void __exit tps6586x_gpio_exit(
void)