diff options
Diffstat (limited to 'drivers/gpio/adp5520-gpio.c')
-rw-r--r-- | drivers/gpio/adp5520-gpio.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/gpio/adp5520-gpio.c b/drivers/gpio/adp5520-gpio.c index ad05bbc7ffd5..9f2781537001 100644 --- a/drivers/gpio/adp5520-gpio.c +++ b/drivers/gpio/adp5520-gpio.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/slab.h> | ||
10 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
11 | #include <linux/init.h> | 12 | #include <linux/init.h> |
12 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
@@ -34,9 +35,9 @@ static int adp5520_gpio_get_value(struct gpio_chip *chip, unsigned off) | |||
34 | */ | 35 | */ |
35 | 36 | ||
36 | if (test_bit(off, &dev->output)) | 37 | if (test_bit(off, &dev->output)) |
37 | adp5520_read(dev->master, GPIO_OUT, ®_val); | 38 | adp5520_read(dev->master, ADP5520_GPIO_OUT, ®_val); |
38 | else | 39 | else |
39 | adp5520_read(dev->master, GPIO_IN, ®_val); | 40 | adp5520_read(dev->master, ADP5520_GPIO_IN, ®_val); |
40 | 41 | ||
41 | return !!(reg_val & dev->lut[off]); | 42 | return !!(reg_val & dev->lut[off]); |
42 | } | 43 | } |
@@ -48,9 +49,9 @@ static void adp5520_gpio_set_value(struct gpio_chip *chip, | |||
48 | dev = container_of(chip, struct adp5520_gpio, gpio_chip); | 49 | dev = container_of(chip, struct adp5520_gpio, gpio_chip); |
49 | 50 | ||
50 | if (val) | 51 | if (val) |
51 | adp5520_set_bits(dev->master, GPIO_OUT, dev->lut[off]); | 52 | adp5520_set_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]); |
52 | else | 53 | else |
53 | adp5520_clr_bits(dev->master, GPIO_OUT, dev->lut[off]); | 54 | adp5520_clr_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]); |
54 | } | 55 | } |
55 | 56 | ||
56 | static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off) | 57 | static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off) |
@@ -60,7 +61,8 @@ static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off) | |||
60 | 61 | ||
61 | clear_bit(off, &dev->output); | 62 | clear_bit(off, &dev->output); |
62 | 63 | ||
63 | return adp5520_clr_bits(dev->master, GPIO_CFG_2, dev->lut[off]); | 64 | return adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_2, |
65 | dev->lut[off]); | ||
64 | } | 66 | } |
65 | 67 | ||
66 | static int adp5520_gpio_direction_output(struct gpio_chip *chip, | 68 | static int adp5520_gpio_direction_output(struct gpio_chip *chip, |
@@ -73,18 +75,21 @@ static int adp5520_gpio_direction_output(struct gpio_chip *chip, | |||
73 | set_bit(off, &dev->output); | 75 | set_bit(off, &dev->output); |
74 | 76 | ||
75 | if (val) | 77 | if (val) |
76 | ret |= adp5520_set_bits(dev->master, GPIO_OUT, dev->lut[off]); | 78 | ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_OUT, |
79 | dev->lut[off]); | ||
77 | else | 80 | else |
78 | ret |= adp5520_clr_bits(dev->master, GPIO_OUT, dev->lut[off]); | 81 | ret |= adp5520_clr_bits(dev->master, ADP5520_GPIO_OUT, |
82 | dev->lut[off]); | ||
79 | 83 | ||
80 | ret |= adp5520_set_bits(dev->master, GPIO_CFG_2, dev->lut[off]); | 84 | ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_CFG_2, |
85 | dev->lut[off]); | ||
81 | 86 | ||
82 | return ret; | 87 | return ret; |
83 | } | 88 | } |
84 | 89 | ||
85 | static int __devinit adp5520_gpio_probe(struct platform_device *pdev) | 90 | static int __devinit adp5520_gpio_probe(struct platform_device *pdev) |
86 | { | 91 | { |
87 | struct adp5520_gpio_platfrom_data *pdata = pdev->dev.platform_data; | 92 | struct adp5520_gpio_platform_data *pdata = pdev->dev.platform_data; |
88 | struct adp5520_gpio *dev; | 93 | struct adp5520_gpio *dev; |
89 | struct gpio_chip *gc; | 94 | struct gpio_chip *gc; |
90 | int ret, i, gpios; | 95 | int ret, i, gpios; |
@@ -129,20 +134,20 @@ static int __devinit adp5520_gpio_probe(struct platform_device *pdev) | |||
129 | gc->label = pdev->name; | 134 | gc->label = pdev->name; |
130 | gc->owner = THIS_MODULE; | 135 | gc->owner = THIS_MODULE; |
131 | 136 | ||
132 | ret = adp5520_clr_bits(dev->master, GPIO_CFG_1, | 137 | ret = adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_1, |
133 | pdata->gpio_en_mask); | 138 | pdata->gpio_en_mask); |
134 | 139 | ||
135 | if (pdata->gpio_en_mask & GPIO_C3) | 140 | if (pdata->gpio_en_mask & ADP5520_GPIO_C3) |
136 | ctl_mask |= C3_MODE; | 141 | ctl_mask |= ADP5520_C3_MODE; |
137 | 142 | ||
138 | if (pdata->gpio_en_mask & GPIO_R3) | 143 | if (pdata->gpio_en_mask & ADP5520_GPIO_R3) |
139 | ctl_mask |= R3_MODE; | 144 | ctl_mask |= ADP5520_R3_MODE; |
140 | 145 | ||
141 | if (ctl_mask) | 146 | if (ctl_mask) |
142 | ret = adp5520_set_bits(dev->master, LED_CONTROL, | 147 | ret = adp5520_set_bits(dev->master, ADP5520_LED_CONTROL, |
143 | ctl_mask); | 148 | ctl_mask); |
144 | 149 | ||
145 | ret |= adp5520_set_bits(dev->master, GPIO_PULLUP, | 150 | ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_PULLUP, |
146 | pdata->gpio_pullup_mask); | 151 | pdata->gpio_pullup_mask); |
147 | 152 | ||
148 | if (ret) { | 153 | if (ret) { |