diff options
author | Philippe Langlais <philippe.langlais@linaro.org> | 2011-05-09 13:54:04 +0200 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 15:15:03 +0200 |
commit | c57cdab3a8d76c025b2d969f09523bf9137e6148 (patch) | |
tree | 3ede1b70d096d98d1e9a07c3d6fa50b74273b7d0 /drivers/gpio | |
parent | f13106b5c5fae60d113afd4f377860919bb029d3 (diff) |
regulator Added regulator for sysclkreq and connected BT and WLAN
ST-Ericsson Linux next: -
ST-Ericsson ID: ER 324615
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: I616eda9d8e292c05dd8094d8085f5b488ee90396
Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/19533
Reviewed-by: Par-Gunnar HJALMDAHL <par-gunnar.p.hjalmdahl@stericsson.com>
Reviewed-by: Yvan FILLION <yvan.fillion@stericsson.com>
Tested-by: Yvan FILLION <yvan.fillion@stericsson.com>
Reviewed-by: Henrik CARLING <henrik.carling@stericsson.com>
Conflicts:
arch/arm/mach-ux500/board-mop500-regulators.c
arch/arm/mach-ux500/board-mop500.c
arch/arm/mach-ux500/virt-regulator-u8500.c
drivers/regulator/ab8500.c
include/linux/mfd/ab8500/ab8500-gpio.h
Signed-off-by: Philippe Langlais <philippe.langlais@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/ab8500-gpio.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/gpio/ab8500-gpio.c b/drivers/gpio/ab8500-gpio.c index 46e146a0eb4..d5bfbc40cdd 100644 --- a/drivers/gpio/ab8500-gpio.c +++ b/drivers/gpio/ab8500-gpio.c @@ -519,6 +519,69 @@ int ab8500_config_pull_up_or_down(struct device *dev, } EXPORT_SYMBOL(ab8500_config_pull_up_or_down); +/* + * ab8500_gpio_config_select() + * + * Configure functionality of pin, either specific use or GPIO. + * @dev: device pointer + * @gpio: gpio number + * @gpio_select: true if the pin should be used as GPIO + */ +int ab8500_gpio_config_select(struct device *dev, + unsigned gpio_offset, bool gpio_select) +{ + u8 reg = AB8500_GPIO_SEL1_REG + (gpio_offset / 8); + u8 pos = gpio_offset % 8; + u8 val = gpio_select ? 1 : 0; + int ret; + + ret = abx500_mask_and_set_register_interruptible(dev, + AB8500_MISC, reg, 1 << pos, val << pos); + if (ret < 0) + dev_err(dev, "%s write failed\n", __func__); + + dev_vdbg(dev, "%s (bank, addr, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n", + __func__, AB8500_MISC, reg, 1 << pos, val << pos); + + return ret; +} +EXPORT_SYMBOL(ab8500_gpio_config_select); + +/* + * ab8500_gpio_config_get_select() + * + * Configure functionality of pin, either specific use or GPIO. + * @dev: device pointer + * @gpio: gpio number + * @gpio_select: pointer to pin selection status + */ +int ab8500_gpio_config_get_select(struct device *dev, + unsigned gpio_offset, bool *gpio_select) +{ + u8 reg = AB8500_GPIO_SEL1_REG + (gpio_offset / 8); + u8 pos = gpio_offset % 8; + u8 val; + int ret; + + ret = abx500_get_register_interruptible(dev, + AB8500_MISC, reg, &val); + if (ret < 0) { + dev_err(dev, "%s read failed\n", __func__); + return ret; + } + + if (val & (1 << pos)) + *gpio_select = true; + else + *gpio_select = false; + + dev_vdbg(dev, "%s (bank, addr, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n", + __func__, AB8500_MISC, reg, 1 << pos, val); + + return 0; +} +EXPORT_SYMBOL(ab8500_gpio_config_get_select); + static struct platform_driver ab8500_gpio_driver = { .driver = { .name = "ab8500-gpio", |