25 #include <linux/module.h>
35 static struct gpio_chip twl6040gpo_chip;
37 static int twl6040gpo_get(
struct gpio_chip *
chip,
unsigned offset)
46 return (ret >> offset) & 1;
49 static int twl6040gpo_direction_out(
struct gpio_chip *chip,
unsigned offset,
56 static void twl6040gpo_set(
struct gpio_chip *chip,
unsigned offset,
int value)
67 gpoctl = ret | (1 <<
offset);
69 gpoctl = ret & ~(1 <<
offset);
74 static struct gpio_chip twl6040gpo_chip = {
77 .get = twl6040gpo_get,
78 .direction_output = twl6040gpo_direction_out,
79 .set = twl6040gpo_set,
88 struct device *twl6040_core_dev = pdev->
dev.parent;
95 twl6040gpo_chip.base = -1;
98 twl6040gpo_chip.ngpio = 3;
100 twl6040gpo_chip.ngpio = 1;
102 twl6040gpo_chip.dev = &pdev->
dev;
103 #ifdef CONFIG_OF_GPIO
104 twl6040gpo_chip.of_node = twl6040_core_dev->
of_node;
109 dev_err(&pdev->
dev,
"could not register gpiochip, %d\n", ret);
110 twl6040gpo_chip.ngpio = 0;
126 .name =
"twl6040-gpo",
129 .probe = gpo_twl6040_probe,
130 .remove = gpo_twl6040_remove,