diff options
author | Chris Kimber <chris.kimber@stericsson.com> | 2011-05-18 16:34:59 +0100 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 15:15:31 +0200 |
commit | 193962083213436f81e08e9e53288c0f44f4ac1c (patch) | |
tree | 67789678e511552683f64e51cf8724c800b6ac43 /drivers | |
parent | 1984f0558cca34c56b84c97884181a42a82d3701 (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.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/gpio/ab8500-gpio.c b/drivers/gpio/ab8500-gpio.c index 46040219713..bd095d7e7e7 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; |