aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorAshish Jangam <ashish.jangam@kpitcummins.com>2011-12-15 04:25:46 -0500
committerGrant Likely <grant.likely@secretlab.ca>2011-12-15 13:25:43 -0500
commit87b9b0e0d50db3282fb1eb702307ccfca8775744 (patch)
tree2ffe8a12337074e0167ca0ece066c9d11c192190 /drivers/gpio
parent28538df0389a59ede9ccd6f327d2031f0044db87 (diff)
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>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-da9052.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c
index 038f5eb8b13d..f8ce29ef9f88 100644
--- a/drivers/gpio/gpio-da9052.c
+++ b/drivers/gpio/gpio-da9052.c
@@ -22,7 +22,6 @@
22#include <linux/mfd/da9052/da9052.h> 22#include <linux/mfd/da9052/da9052.h>
23#include <linux/mfd/da9052/reg.h> 23#include <linux/mfd/da9052/reg.h>
24#include <linux/mfd/da9052/pdata.h> 24#include <linux/mfd/da9052/pdata.h>
25#include <linux/mfd/da9052/gpio.h>
26 25
27#define DA9052_INPUT 1 26#define DA9052_INPUT 1
28#define DA9052_OUTPUT_OPENDRAIN 2 27#define DA9052_OUTPUT_OPENDRAIN 2
@@ -43,6 +42,9 @@
43#define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0 42#define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0
44#define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F 43#define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F
45#define DA9052_GPIO_NIBBLE_SHIFT 4 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
47struct da9052_gpio { 49struct da9052_gpio {
48 struct da9052 *da9052; 50 struct da9052 *da9052;
@@ -104,33 +106,26 @@ static int da9052_gpio_get(struct gpio_chip *gc, unsigned offset)
104static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) 106static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
105{ 107{
106 struct da9052_gpio *gpio = to_da9052_gpio(gc); 108 struct da9052_gpio *gpio = to_da9052_gpio(gc);
107 unsigned char register_value = 0;
108 int ret; 109 int ret;
109 110
110 if (da9052_gpio_port_odd(offset)) { 111 if (da9052_gpio_port_odd(offset)) {
111 if (value) {
112 register_value = DA9052_GPIO_ODD_PORT_MODE;
113 ret = da9052_reg_update(gpio->da9052, (offset >> 1) + 112 ret = da9052_reg_update(gpio->da9052, (offset >> 1) +
114 DA9052_GPIO_0_1_REG, 113 DA9052_GPIO_0_1_REG,
115 DA9052_GPIO_ODD_PORT_MODE, 114 DA9052_GPIO_ODD_PORT_MODE,
116 register_value); 115 value << DA9052_GPIO_ODD_SHIFT);
117 if (ret != 0) 116 if (ret != 0)
118 dev_err(gpio->da9052->dev, 117 dev_err(gpio->da9052->dev,
119 "Failed to updated gpio odd reg,%d", 118 "Failed to updated gpio odd reg,%d",
120 ret); 119 ret);
121 }
122 } else { 120 } else {
123 if (value) {
124 register_value = DA9052_GPIO_EVEN_PORT_MODE;
125 ret = da9052_reg_update(gpio->da9052, (offset >> 1) + 121 ret = da9052_reg_update(gpio->da9052, (offset >> 1) +
126 DA9052_GPIO_0_1_REG, 122 DA9052_GPIO_0_1_REG,
127 DA9052_GPIO_EVEN_PORT_MODE, 123 DA9052_GPIO_EVEN_PORT_MODE,
128 register_value); 124 value << DA9052_GPIO_EVEN_SHIFT);
129 if (ret != 0) 125 if (ret != 0)
130 dev_err(gpio->da9052->dev, 126 dev_err(gpio->da9052->dev,
131 "Failed to updated gpio even reg,%d", 127 "Failed to updated gpio even reg,%d",
132 ret); 128 ret);
133 }
134 } 129 }
135} 130}
136 131
@@ -201,9 +196,9 @@ static struct gpio_chip reference_gp __devinitdata = {
201 .direction_input = da9052_gpio_direction_input, 196 .direction_input = da9052_gpio_direction_input,
202 .direction_output = da9052_gpio_direction_output, 197 .direction_output = da9052_gpio_direction_output,
203 .to_irq = da9052_gpio_to_irq, 198 .to_irq = da9052_gpio_to_irq,
204 .can_sleep = 1; 199 .can_sleep = 1,
205 .ngpio = 16; 200 .ngpio = 16,
206 .base = -1; 201 .base = -1,
207}; 202};
208 203
209static int __devinit da9052_gpio_probe(struct platform_device *pdev) 204static int __devinit da9052_gpio_probe(struct platform_device *pdev)