aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ux500/board-mop500.c
diff options
context:
space:
mode:
authorPhilippe Langlais <philippe.langlais@linaro.org>2011-01-14 04:53:59 -0500
committerLinus Walleij <linus.walleij@linaro.org>2011-03-14 09:05:11 -0400
commita71b819b6edfb31d6866d084167583bd92f4ad29 (patch)
treeda71554cd223bab699bf60e3cffee09eb09cf499 /arch/arm/mach-ux500/board-mop500.c
parentb3f1f73d35839f3e40bd9dba2c3de53f56a2a880 (diff)
mach-ux500: platform data for SFH7741 proximity sensor driver
Proximity sensor is managed as an input event (SW_PROXIMITY). Signed-off-by: Philippe Langlais <philippe.langlais@linaro.org> [Named GPIO pin] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-ux500/board-mop500.c')
-rw-r--r--arch/arm/mach-ux500/board-mop500.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index fd6d5090caea..dce68788be39 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -20,6 +20,8 @@
20#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
21#include <linux/mfd/ab8500.h> 21#include <linux/mfd/ab8500.h>
22#include <linux/mfd/tc3589x.h> 22#include <linux/mfd/tc3589x.h>
23#include <linux/input.h>
24#include <linux/gpio_keys.h>
23 25
24#include <asm/mach-types.h> 26#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
@@ -181,8 +183,58 @@ static void __init mop500_i2c_init(void)
181 db8500_add_i2c3(&u8500_i2c3_data); 183 db8500_add_i2c3(&u8500_i2c3_data);
182} 184}
183 185
186static struct gpio_keys_button mop500_gpio_keys[] = {
187 {
188 .desc = "SFH7741 Proximity Sensor",
189 .type = EV_SW,
190 .code = SW_FRONT_PROXIMITY,
191 .gpio = GPIO_PROX_SENSOR,
192 .active_low = 0,
193 .can_disable = 1,
194 }
195};
196
197static struct regulator *prox_regulator;
198static int mop500_prox_activate(struct device *dev);
199static void mop500_prox_deactivate(struct device *dev);
200
201static struct gpio_keys_platform_data mop500_gpio_keys_data = {
202 .buttons = mop500_gpio_keys,
203 .nbuttons = ARRAY_SIZE(mop500_gpio_keys),
204 .enable = mop500_prox_activate,
205 .disable = mop500_prox_deactivate,
206};
207
208static struct platform_device mop500_gpio_keys_device = {
209 .name = "gpio-keys",
210 .id = 0,
211 .dev = {
212 .platform_data = &mop500_gpio_keys_data,
213 },
214};
215
216static int mop500_prox_activate(struct device *dev)
217{
218 prox_regulator = regulator_get(&mop500_gpio_keys_device.dev,
219 "vcc");
220 if (IS_ERR(prox_regulator)) {
221 dev_err(&mop500_gpio_keys_device.dev,
222 "no regulator\n");
223 return PTR_ERR(prox_regulator);
224 }
225 regulator_enable(prox_regulator);
226 return 0;
227}
228
229static void mop500_prox_deactivate(struct device *dev)
230{
231 regulator_disable(prox_regulator);
232 regulator_put(prox_regulator);
233}
234
184/* add any platform devices here - TODO */ 235/* add any platform devices here - TODO */
185static struct platform_device *platform_devs[] __initdata = { 236static struct platform_device *platform_devs[] __initdata = {
237 &mop500_gpio_keys_device,
186}; 238};
187 239
188static void __init mop500_spi_init(void) 240static void __init mop500_spi_init(void)