Commit 87b9b0e0d50db3282fb1eb702307ccfca8775744
Committed by
Grant Likely
1 parent
28538df038
Exists in
master
and in
6 other branches
gpio: Fix DA9052 GPIO build errors.
This patch is functionally tested on Samsung SMDKV6410. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: David Dajun Chen <dchen@diasemi.com> Signed-off-by: Ashish Jangam <ashish.jangam@kpitcummins.com> [grant.likely: don't create an unnecessary header file] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Showing 1 changed file with 8 additions and 13 deletions Side-by-side Diff
drivers/gpio/gpio-da9052.c
... | ... | @@ -22,7 +22,6 @@ |
22 | 22 | #include <linux/mfd/da9052/da9052.h> |
23 | 23 | #include <linux/mfd/da9052/reg.h> |
24 | 24 | #include <linux/mfd/da9052/pdata.h> |
25 | -#include <linux/mfd/da9052/gpio.h> | |
26 | 25 | |
27 | 26 | #define DA9052_INPUT 1 |
28 | 27 | #define DA9052_OUTPUT_OPENDRAIN 2 |
... | ... | @@ -43,6 +42,9 @@ |
43 | 42 | #define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0 |
44 | 43 | #define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F |
45 | 44 | #define DA9052_GPIO_NIBBLE_SHIFT 4 |
45 | +#define DA9052_IRQ_GPI0 16 | |
46 | +#define DA9052_GPIO_ODD_SHIFT 7 | |
47 | +#define DA9052_GPIO_EVEN_SHIFT 3 | |
46 | 48 | |
47 | 49 | struct da9052_gpio { |
48 | 50 | struct da9052 *da9052; |
49 | 51 | |
50 | 52 | |
51 | 53 | |
52 | 54 | |
53 | 55 | |
54 | 56 | |
... | ... | @@ -104,33 +106,26 @@ |
104 | 106 | static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) |
105 | 107 | { |
106 | 108 | struct da9052_gpio *gpio = to_da9052_gpio(gc); |
107 | - unsigned char register_value = 0; | |
108 | 109 | int ret; |
109 | 110 | |
110 | 111 | if (da9052_gpio_port_odd(offset)) { |
111 | - if (value) { | |
112 | - register_value = DA9052_GPIO_ODD_PORT_MODE; | |
113 | 112 | ret = da9052_reg_update(gpio->da9052, (offset >> 1) + |
114 | 113 | DA9052_GPIO_0_1_REG, |
115 | 114 | DA9052_GPIO_ODD_PORT_MODE, |
116 | - register_value); | |
115 | + value << DA9052_GPIO_ODD_SHIFT); | |
117 | 116 | if (ret != 0) |
118 | 117 | dev_err(gpio->da9052->dev, |
119 | 118 | "Failed to updated gpio odd reg,%d", |
120 | 119 | ret); |
121 | - } | |
122 | 120 | } else { |
123 | - if (value) { | |
124 | - register_value = DA9052_GPIO_EVEN_PORT_MODE; | |
125 | 121 | ret = da9052_reg_update(gpio->da9052, (offset >> 1) + |
126 | 122 | DA9052_GPIO_0_1_REG, |
127 | 123 | DA9052_GPIO_EVEN_PORT_MODE, |
128 | - register_value); | |
124 | + value << DA9052_GPIO_EVEN_SHIFT); | |
129 | 125 | if (ret != 0) |
130 | 126 | dev_err(gpio->da9052->dev, |
131 | 127 | "Failed to updated gpio even reg,%d", |
132 | 128 | ret); |
133 | - } | |
134 | 129 | } |
135 | 130 | } |
136 | 131 | |
... | ... | @@ -201,9 +196,9 @@ |
201 | 196 | .direction_input = da9052_gpio_direction_input, |
202 | 197 | .direction_output = da9052_gpio_direction_output, |
203 | 198 | .to_irq = da9052_gpio_to_irq, |
204 | - .can_sleep = 1; | |
205 | - .ngpio = 16; | |
206 | - .base = -1; | |
199 | + .can_sleep = 1, | |
200 | + .ngpio = 16, | |
201 | + .base = -1, | |
207 | 202 | }; |
208 | 203 | |
209 | 204 | static int __devinit da9052_gpio_probe(struct platform_device *pdev) |