diff options
author | Philippe Langlais <philippe.langlais@linaro.org> | 2011-01-14 04:53:59 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2011-03-14 09:05:11 -0400 |
commit | a71b819b6edfb31d6866d084167583bd92f4ad29 (patch) | |
tree | da71554cd223bab699bf60e3cffee09eb09cf499 /arch/arm/mach-ux500 | |
parent | b3f1f73d35839f3e40bd9dba2c3de53f56a2a880 (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')
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.c | 52 | ||||
-rw-r--r-- | arch/arm/mach-ux500/board-mop500.h | 1 |
2 files changed, 53 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 | ||
186 | static 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 | |||
197 | static struct regulator *prox_regulator; | ||
198 | static int mop500_prox_activate(struct device *dev); | ||
199 | static void mop500_prox_deactivate(struct device *dev); | ||
200 | |||
201 | static 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 | |||
208 | static 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 | |||
216 | static 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 | |||
229 | static 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 */ |
185 | static struct platform_device *platform_devs[] __initdata = { | 236 | static struct platform_device *platform_devs[] __initdata = { |
237 | &mop500_gpio_keys_device, | ||
186 | }; | 238 | }; |
187 | 239 | ||
188 | static void __init mop500_spi_init(void) | 240 | static void __init mop500_spi_init(void) |
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h index fe22b84f89ea..19b6c270d206 100644 --- a/arch/arm/mach-ux500/board-mop500.h +++ b/arch/arm/mach-ux500/board-mop500.h | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | /* GPIOs on the TC35892 expander */ | 12 | /* GPIOs on the TC35892 expander */ |
13 | #define GPIO_SDMMC_CD MOP500_EGPIO(3) | 13 | #define GPIO_SDMMC_CD MOP500_EGPIO(3) |
14 | #define GPIO_PROX_SENSOR MOP500_EGPIO(7) | ||
14 | #define GPIO_BU21013_CS MOP500_EGPIO(13) | 15 | #define GPIO_BU21013_CS MOP500_EGPIO(13) |
15 | #define GPIO_SDMMC_EN MOP500_EGPIO(17) | 16 | #define GPIO_SDMMC_EN MOP500_EGPIO(17) |
16 | #define GPIO_SDMMC_1V8_3V_SEL MOP500_EGPIO(18) | 17 | #define GPIO_SDMMC_1V8_3V_SEL MOP500_EGPIO(18) |