aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/adp5520-gpio.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-14 13:02:35 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-14 13:02:35 -0500
commit76b8f82cde2d9c13ef0c9a9aa2581b9b30b68e8c (patch)
treef94b370b95051b4a7b3c272b4b2ee20091e1b746 /drivers/gpio/adp5520-gpio.c
parentaf853e631db12a97363c8c3b727d153bd2cb346b (diff)
parent9da66539281b5e15afc4a4739014c8923059d894 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (58 commits) mfd: Add twl6030 regulator subdevices regulator: Add support for twl6030 regulators rtc: Add twl6030 RTC support mfd: Add support for twl6030 irq framework mfd: Rename twl4030_ routines in twl-regulator.c mfd: Rename twl4030_ routines in rtc-twl.c mfd: Rename all twl4030_i2c* mfd: Rename twl4030* driver files to enable re-use mfd: Clarify twl4030 return value for read and write mfd: Add all twl4030 regulators to the twl4030 mfd driver mfd: Don't set mc13783 ADREFMODE for touch conversions mfd: Remove ezx-pcap defines for custom led gpio encoding mfd: Near complete mc13783 rewrite mfd: Remove build time warning for WM835x register default tables mfd: Force I2C to be built in when building WM831x mfd: Don't allow wm831x to be built as a module mfd: Fix incorrect error check for wm8350-core mfd: Fix twl4030 warning gpiolib: Implement gpio_to_irq() for wm831x mfd: Remove default selection of AB4500 ...
Diffstat (limited to 'drivers/gpio/adp5520-gpio.c')
-rw-r--r--drivers/gpio/adp5520-gpio.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/gpio/adp5520-gpio.c b/drivers/gpio/adp5520-gpio.c
index ad05bbc7ffd5..0f93105873cd 100644
--- a/drivers/gpio/adp5520-gpio.c
+++ b/drivers/gpio/adp5520-gpio.c
@@ -34,9 +34,9 @@ static int adp5520_gpio_get_value(struct gpio_chip *chip, unsigned off)
34 */ 34 */
35 35
36 if (test_bit(off, &dev->output)) 36 if (test_bit(off, &dev->output))
37 adp5520_read(dev->master, GPIO_OUT, &reg_val); 37 adp5520_read(dev->master, ADP5520_GPIO_OUT, &reg_val);
38 else 38 else
39 adp5520_read(dev->master, GPIO_IN, &reg_val); 39 adp5520_read(dev->master, ADP5520_GPIO_IN, &reg_val);
40 40
41 return !!(reg_val & dev->lut[off]); 41 return !!(reg_val & dev->lut[off]);
42} 42}
@@ -48,9 +48,9 @@ static void adp5520_gpio_set_value(struct gpio_chip *chip,
48 dev = container_of(chip, struct adp5520_gpio, gpio_chip); 48 dev = container_of(chip, struct adp5520_gpio, gpio_chip);
49 49
50 if (val) 50 if (val)
51 adp5520_set_bits(dev->master, GPIO_OUT, dev->lut[off]); 51 adp5520_set_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]);
52 else 52 else
53 adp5520_clr_bits(dev->master, GPIO_OUT, dev->lut[off]); 53 adp5520_clr_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]);
54} 54}
55 55
56static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off) 56static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off)
@@ -60,7 +60,8 @@ static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off)
60 60
61 clear_bit(off, &dev->output); 61 clear_bit(off, &dev->output);
62 62
63 return adp5520_clr_bits(dev->master, GPIO_CFG_2, dev->lut[off]); 63 return adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_2,
64 dev->lut[off]);
64} 65}
65 66
66static int adp5520_gpio_direction_output(struct gpio_chip *chip, 67static int adp5520_gpio_direction_output(struct gpio_chip *chip,
@@ -73,18 +74,21 @@ static int adp5520_gpio_direction_output(struct gpio_chip *chip,
73 set_bit(off, &dev->output); 74 set_bit(off, &dev->output);
74 75
75 if (val) 76 if (val)
76 ret |= adp5520_set_bits(dev->master, GPIO_OUT, dev->lut[off]); 77 ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_OUT,
78 dev->lut[off]);
77 else 79 else
78 ret |= adp5520_clr_bits(dev->master, GPIO_OUT, dev->lut[off]); 80 ret |= adp5520_clr_bits(dev->master, ADP5520_GPIO_OUT,
81 dev->lut[off]);
79 82
80 ret |= adp5520_set_bits(dev->master, GPIO_CFG_2, dev->lut[off]); 83 ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_CFG_2,
84 dev->lut[off]);
81 85
82 return ret; 86 return ret;
83} 87}
84 88
85static int __devinit adp5520_gpio_probe(struct platform_device *pdev) 89static int __devinit adp5520_gpio_probe(struct platform_device *pdev)
86{ 90{
87 struct adp5520_gpio_platfrom_data *pdata = pdev->dev.platform_data; 91 struct adp5520_gpio_platform_data *pdata = pdev->dev.platform_data;
88 struct adp5520_gpio *dev; 92 struct adp5520_gpio *dev;
89 struct gpio_chip *gc; 93 struct gpio_chip *gc;
90 int ret, i, gpios; 94 int ret, i, gpios;
@@ -129,20 +133,20 @@ static int __devinit adp5520_gpio_probe(struct platform_device *pdev)
129 gc->label = pdev->name; 133 gc->label = pdev->name;
130 gc->owner = THIS_MODULE; 134 gc->owner = THIS_MODULE;
131 135
132 ret = adp5520_clr_bits(dev->master, GPIO_CFG_1, 136 ret = adp5520_clr_bits(dev->master, ADP5520_GPIO_CFG_1,
133 pdata->gpio_en_mask); 137 pdata->gpio_en_mask);
134 138
135 if (pdata->gpio_en_mask & GPIO_C3) 139 if (pdata->gpio_en_mask & ADP5520_GPIO_C3)
136 ctl_mask |= C3_MODE; 140 ctl_mask |= ADP5520_C3_MODE;
137 141
138 if (pdata->gpio_en_mask & GPIO_R3) 142 if (pdata->gpio_en_mask & ADP5520_GPIO_R3)
139 ctl_mask |= R3_MODE; 143 ctl_mask |= ADP5520_R3_MODE;
140 144
141 if (ctl_mask) 145 if (ctl_mask)
142 ret = adp5520_set_bits(dev->master, LED_CONTROL, 146 ret = adp5520_set_bits(dev->master, ADP5520_LED_CONTROL,
143 ctl_mask); 147 ctl_mask);
144 148
145 ret |= adp5520_set_bits(dev->master, GPIO_PULLUP, 149 ret |= adp5520_set_bits(dev->master, ADP5520_GPIO_PULLUP,
146 pdata->gpio_pullup_mask); 150 pdata->gpio_pullup_mask);
147 151
148 if (ret) { 152 if (ret) {