diff options
| author | Pradeep Kumar <pgoudagunta@nvidia.com> | 2012-08-01 16:05:51 +0530 |
|---|---|---|
| committer | Simone Willett <swillett@nvidia.com> | 2012-08-02 16:40:25 -0700 |
| commit | 41528c296948a694b835f4b88c300583c4f87cd3 (patch) | |
| tree | 26642de2c0c82f346f8b9a1a33f01b972a0b910b /drivers/gpio | |
| parent | d1b803e40b9b42c9113a7aba5cf345b67f8e3a3d (diff) | |
gpio: palmas: fix compilation failures
Update palmas gpio support driver as per updated palmas core.
Bug 978821
Change-Id: If4b4a297db2acaa36f9b4184137ac5f73d6dd7f2
Reviewed-on: http://git-master/r/119989
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Pradeep Goudagunta <pgoudagunta@nvidia.com>
Diffstat (limited to 'drivers/gpio')
| -rw-r--r-- | drivers/gpio/gpio-palmas.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c index 1956ff183b02..c627f2becb79 100644 --- a/drivers/gpio/gpio-palmas.c +++ b/drivers/gpio/gpio-palmas.c @@ -33,6 +33,26 @@ struct palmas_gpio { struct gpio_chip gpio_chip; }; +#define GPIO_SLAVE PALMAS_BASE_TO_SLAVE(PALMAS_GPIO_BASE) + +int palmas_gpio_read(struct palmas *palmas, unsigned int reg, + unsigned int *dest) +{ + unsigned int addr; + addr = PALMAS_BASE_TO_REG(PALMAS_GPIO_BASE, reg); + + return regmap_read(palmas->regmap[GPIO_SLAVE], addr, dest); +} + +int palmas_gpio_write(struct palmas *palmas, unsigned int reg, + unsigned int value) +{ + unsigned int addr; + addr = PALMAS_BASE_TO_REG(PALMAS_GPIO_BASE, reg); + + return regmap_write(palmas->regmap[GPIO_SLAVE], addr, value); +} + static inline struct palmas_gpio *to_palmas_gpio(struct gpio_chip *chip) { return container_of(chip, struct palmas_gpio, gpio_chip); @@ -43,7 +63,7 @@ static int palmas_gpio_direction_in(struct gpio_chip *chip, unsigned offset) struct palmas_gpio *palmas_gpio = to_palmas_gpio(chip); struct palmas *palmas = palmas_gpio->palmas; int ret; - u8 reg = 0; + unsigned int reg = 0; if (!((1 << offset) & palmas->gpio_muxed)) return -EINVAL; @@ -61,7 +81,7 @@ static int palmas_gpio_get(struct gpio_chip *chip, unsigned offset) { struct palmas_gpio *palmas_gpio = to_palmas_gpio(chip); struct palmas *palmas = palmas_gpio->palmas; - u8 reg = 0; + unsigned int reg = 0; if (!((1 << offset) & palmas->gpio_muxed)) return 0; @@ -75,7 +95,7 @@ static void palmas_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { struct palmas_gpio *palmas_gpio = to_palmas_gpio(chip); struct palmas *palmas = palmas_gpio->palmas; - u8 reg; + unsigned int reg; if (!((1 << offset) & palmas->gpio_muxed)) return; @@ -94,7 +114,7 @@ static int palmas_gpio_direction_out(struct gpio_chip *chip, struct palmas_gpio *palmas_gpio = to_palmas_gpio(chip); struct palmas *palmas = palmas_gpio->palmas; int ret; - u8 reg; + unsigned int reg; if (!((1 << offset) & palmas->gpio_muxed)) return -EINVAL; @@ -113,10 +133,11 @@ static int palmas_gpio_to_irq(struct gpio_chip *chip, unsigned offset) struct palmas_gpio *palmas_gpio = to_palmas_gpio(chip); struct palmas *palmas = palmas_gpio->palmas; - if (!palmas->irq_base) + if (!regmap_irq_chip_get_base(palmas->irq_data)) return -EINVAL; - return palmas->irq_base + PALMAS_GPIO_0_IRQ + offset; + return (regmap_irq_chip_get_base(palmas->irq_data)) + + PALMAS_GPIO_0_IRQ + offset; } static int palmas_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, @@ -125,7 +146,7 @@ static int palmas_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, struct palmas_gpio *palmas_gpio = to_palmas_gpio(chip); struct palmas *palmas = palmas_gpio->palmas; int ret; - u8 reg; + unsigned int reg; if (!((1 << offset) & palmas->gpio_muxed)) return -EINVAL; @@ -142,7 +163,7 @@ static int palmas_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, return palmas_gpio_write(palmas, PALMAS_GPIO_DATA_DIR, reg); } -static struct gpio_chip template_chip = { +static struct gpio_chip palmas_gpio_chip = { .label = "palmas", .owner = THIS_MODULE, .direction_input = palmas_gpio_direction_in, @@ -167,7 +188,7 @@ static int __devinit palmas_gpio_probe(struct platform_device *pdev) return -ENOMEM; gpio->palmas = palmas; - gpio->gpio_chip = template_chip; + gpio->gpio_chip = palmas_gpio_chip; gpio->gpio_chip.dev = &pdev->dev; if (pdata && pdata->gpio_base) |
