Commit 87b9b0e0 authored by Ashish Jangam's avatar Ashish Jangam Committed by Grant Likely

gpio: Fix DA9052 GPIO build errors.

This patch is functionally tested on Samsung SMDKV6410.
Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarDavid Dajun Chen <dchen@diasemi.com>
Signed-off-by: default avatarAshish Jangam <ashish.jangam@kpitcummins.com>
[grant.likely: don't create an unnecessary header file]
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent 28538df0
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/mfd/da9052/da9052.h> #include <linux/mfd/da9052/da9052.h>
#include <linux/mfd/da9052/reg.h> #include <linux/mfd/da9052/reg.h>
#include <linux/mfd/da9052/pdata.h> #include <linux/mfd/da9052/pdata.h>
#include <linux/mfd/da9052/gpio.h>
#define DA9052_INPUT 1 #define DA9052_INPUT 1
#define DA9052_OUTPUT_OPENDRAIN 2 #define DA9052_OUTPUT_OPENDRAIN 2
...@@ -43,6 +42,9 @@ ...@@ -43,6 +42,9 @@
#define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0 #define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0
#define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F #define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F
#define DA9052_GPIO_NIBBLE_SHIFT 4 #define DA9052_GPIO_NIBBLE_SHIFT 4
#define DA9052_IRQ_GPI0 16
#define DA9052_GPIO_ODD_SHIFT 7
#define DA9052_GPIO_EVEN_SHIFT 3
struct da9052_gpio { struct da9052_gpio {
struct da9052 *da9052; struct da9052 *da9052;
...@@ -104,34 +106,27 @@ static int da9052_gpio_get(struct gpio_chip *gc, unsigned offset) ...@@ -104,34 +106,27 @@ static int da9052_gpio_get(struct gpio_chip *gc, unsigned offset)
static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
{ {
struct da9052_gpio *gpio = to_da9052_gpio(gc); struct da9052_gpio *gpio = to_da9052_gpio(gc);
unsigned char register_value = 0;
int ret; int ret;
if (da9052_gpio_port_odd(offset)) { if (da9052_gpio_port_odd(offset)) {
if (value) {
register_value = DA9052_GPIO_ODD_PORT_MODE;
ret = da9052_reg_update(gpio->da9052, (offset >> 1) + ret = da9052_reg_update(gpio->da9052, (offset >> 1) +
DA9052_GPIO_0_1_REG, DA9052_GPIO_0_1_REG,
DA9052_GPIO_ODD_PORT_MODE, DA9052_GPIO_ODD_PORT_MODE,
register_value); value << DA9052_GPIO_ODD_SHIFT);
if (ret != 0) if (ret != 0)
dev_err(gpio->da9052->dev, dev_err(gpio->da9052->dev,
"Failed to updated gpio odd reg,%d", "Failed to updated gpio odd reg,%d",
ret); ret);
}
} else { } else {
if (value) {
register_value = DA9052_GPIO_EVEN_PORT_MODE;
ret = da9052_reg_update(gpio->da9052, (offset >> 1) + ret = da9052_reg_update(gpio->da9052, (offset >> 1) +
DA9052_GPIO_0_1_REG, DA9052_GPIO_0_1_REG,
DA9052_GPIO_EVEN_PORT_MODE, DA9052_GPIO_EVEN_PORT_MODE,
register_value); value << DA9052_GPIO_EVEN_SHIFT);
if (ret != 0) if (ret != 0)
dev_err(gpio->da9052->dev, dev_err(gpio->da9052->dev,
"Failed to updated gpio even reg,%d", "Failed to updated gpio even reg,%d",
ret); ret);
} }
}
} }
static int da9052_gpio_direction_input(struct gpio_chip *gc, unsigned offset) static int da9052_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
...@@ -201,9 +196,9 @@ static struct gpio_chip reference_gp __devinitdata = { ...@@ -201,9 +196,9 @@ static struct gpio_chip reference_gp __devinitdata = {
.direction_input = da9052_gpio_direction_input, .direction_input = da9052_gpio_direction_input,
.direction_output = da9052_gpio_direction_output, .direction_output = da9052_gpio_direction_output,
.to_irq = da9052_gpio_to_irq, .to_irq = da9052_gpio_to_irq,
.can_sleep = 1; .can_sleep = 1,
.ngpio = 16; .ngpio = 16,
.base = -1; .base = -1,
}; };
static int __devinit da9052_gpio_probe(struct platform_device *pdev) static int __devinit da9052_gpio_probe(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment