9 #include <linux/module.h>
10 #include <linux/slab.h>
11 #include <linux/kernel.h>
25 static int adp5520_gpio_get_value(
struct gpio_chip *
chip,
unsigned off)
42 return !!(reg_val & dev->
lut[off]);
46 unsigned off,
int val)
57 static int adp5520_gpio_direction_input(
struct gpio_chip *chip,
unsigned off)
68 static int adp5520_gpio_direction_output(
struct gpio_chip *chip,
69 unsigned off,
int val)
96 unsigned char ctl_mask = 0;
99 dev_err(&pdev->
dev,
"missing platform data\n");
104 dev_err(&pdev->
dev,
"only ADP5520 supports GPIO\n");
110 dev_err(&pdev->
dev,
"failed to alloc memory\n");
118 dev->
lut[gpios++] = 1 <<
i;
126 gc->direction_input = adp5520_gpio_direction_input;
127 gc->direction_output = adp5520_gpio_direction_output;
128 gc->get = adp5520_gpio_get_value;
129 gc->set = adp5520_gpio_set_value;
134 gc->label = pdev->
name;
162 platform_set_drvdata(pdev, dev);
175 dev = platform_get_drvdata(pdev);
179 "gpiochip_remove()", ret);
189 .name =
"adp5520-gpio",
192 .probe = adp5520_gpio_probe,