aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorChris Kimber <chris.kimber@stericsson.com>2011-05-18 16:34:59 +0100
committersaid m bagheri <ebgheri@steludxu2848.(none)>2011-06-17 13:42:03 +0200
commitf5dcdcd0a68eedbfdbc96d5de42e51cba4ac8520 (patch)
tree96b9f576d2d9aee7c44794a9ca476d4f26c56cc6 /drivers
parent777a6679baca03511f350b272a1122d3869c1bc9 (diff)
ab8500-gpio: Allow initial configuration of GPIO registers
Allows the setting of the initial GPIO direction & pullup registers. ST-Ericsson Linux next: Ported & patch created ST-Ericsson ID: 334609 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I676ed8129a96a2fe41865117e4c864edc09d01ce Signed-off-by: Chris Kimber <chris.kimber@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/23339 Reviewed-by: Andrew LYNN <andrew.lynn@stericsson.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/ab8500-gpio.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/gpio/ab8500-gpio.c b/drivers/gpio/ab8500-gpio.c
index b67c962e805..cfb239e101e 100644
--- a/drivers/gpio/ab8500-gpio.c
+++ b/drivers/gpio/ab8500-gpio.c
@@ -413,7 +413,7 @@ static int __devinit ab8500_gpio_probe(struct platform_device *pdev)
int i;
pdata = ab8500_pdata->gpio;
- if (!pdata) {
+ if (!pdata) {
dev_err(&pdev->dev, "gpio platform data missing\n");
return -ENODEV;
}
@@ -430,24 +430,40 @@ static int __devinit ab8500_gpio_probe(struct platform_device *pdev)
ab8500_gpio->chip.dev = &pdev->dev;
ab8500_gpio->chip.base = pdata->gpio_base;
ab8500_gpio->irq_base = pdata->irq_base;
+
/* initialize the lock */
mutex_init(&ab8500_gpio->lock);
+
/*
* AB8500 core will handle and clear the IRQ
- * configre GPIO based on config-reg value.
- * These values are for selecting the PINs as
- * GPIO or alternate function
+ * configure GPIO based on initial_pins_{config, direction, pullups}
+ * value.
+ * These values are for selecting the PINs as GPIO
+ * or alternative function
*/
- for (i = AB8500_GPIO_SEL1_REG; i <= AB8500_GPIO_SEL6_REG; i++) {
+ for (i = AB8500_GPIO_SEL1_REG; i <= AB8500_GPIO_SEL6_REG; i++) {
ret = abx500_set_register_interruptible(ab8500_gpio->dev,
AB8500_MISC, i,
- pdata->config_reg[i]);
+ pdata->initial_pin_config[i]);
+ if (ret < 0)
+ goto out_free;
+
+ ret = abx500_set_register_interruptible(ab8500_gpio->dev,
+ AB8500_MISC, i + AB8500_GPIO_DIR1_REG,
+ pdata->initial_pin_direction[i]);
+ if (ret < 0)
+ goto out_free;
+
+ ret = abx500_set_register_interruptible(ab8500_gpio->dev,
+ AB8500_MISC, i + AB8500_GPIO_PUD1_REG,
+ pdata->initial_pin_pullups[i]);
if (ret < 0)
goto out_free;
}
+
ret = abx500_set_register_interruptible(ab8500_gpio->dev, AB8500_MISC,
AB8500_GPIO_ALTFUN_REG,
- pdata->config_reg[ALTFUN_REG_INDEX]);
+ pdata->initial_pin_config[ALTFUN_REG_INDEX]);
if (ret < 0)
goto out_free;