aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-4430sdp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/board-4430sdp.c')
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c69
1 files changed, 68 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index e379bef1ef40..1bed1e666a60 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -20,6 +20,7 @@
20#include <linux/usb/otg.h> 20#include <linux/usb/otg.h>
21#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
22#include <linux/i2c/twl.h> 22#include <linux/i2c/twl.h>
23#include <linux/gpio_keys.h>
23#include <linux/regulator/machine.h> 24#include <linux/regulator/machine.h>
24#include <linux/leds.h> 25#include <linux/leds.h>
25 26
@@ -40,6 +41,8 @@
40#define ETH_KS8851_IRQ 34 41#define ETH_KS8851_IRQ 34
41#define ETH_KS8851_POWER_ON 48 42#define ETH_KS8851_POWER_ON 48
42#define ETH_KS8851_QUART 138 43#define ETH_KS8851_QUART 138
44#define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184
45#define OMAP4_SFH7741_ENABLE_GPIO 188
43 46
44static struct gpio_led sdp4430_gpio_leds[] = { 47static struct gpio_led sdp4430_gpio_leds[] = {
45 { 48 {
@@ -77,11 +80,47 @@ static struct gpio_led sdp4430_gpio_leds[] = {
77 80
78}; 81};
79 82
83static struct gpio_keys_button sdp4430_gpio_keys[] = {
84 {
85 .desc = "Proximity Sensor",
86 .type = EV_SW,
87 .code = SW_FRONT_PROXIMITY,
88 .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO,
89 .active_low = 0,
90 }
91};
92
80static struct gpio_led_platform_data sdp4430_led_data = { 93static struct gpio_led_platform_data sdp4430_led_data = {
81 .leds = sdp4430_gpio_leds, 94 .leds = sdp4430_gpio_leds,
82 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds), 95 .num_leds = ARRAY_SIZE(sdp4430_gpio_leds),
83}; 96};
84 97
98static int omap_prox_activate(struct device *dev)
99{
100 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1);
101 return 0;
102}
103
104static void omap_prox_deactivate(struct device *dev)
105{
106 gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0);
107}
108
109static struct gpio_keys_platform_data sdp4430_gpio_keys_data = {
110 .buttons = sdp4430_gpio_keys,
111 .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys),
112 .enable = omap_prox_activate,
113 .disable = omap_prox_deactivate,
114};
115
116static struct platform_device sdp4430_gpio_keys_device = {
117 .name = "gpio-keys",
118 .id = -1,
119 .dev = {
120 .platform_data = &sdp4430_gpio_keys_data,
121 },
122};
123
85static struct platform_device sdp4430_leds_gpio = { 124static struct platform_device sdp4430_leds_gpio = {
86 .name = "leds-gpio", 125 .name = "leds-gpio",
87 .id = -1, 126 .id = -1,
@@ -161,6 +200,7 @@ static struct platform_device sdp4430_lcd_device = {
161 200
162static struct platform_device *sdp4430_devices[] __initdata = { 201static struct platform_device *sdp4430_devices[] __initdata = {
163 &sdp4430_lcd_device, 202 &sdp4430_lcd_device,
203 &sdp4430_gpio_keys_device,
164 &sdp4430_leds_gpio, 204 &sdp4430_leds_gpio,
165}; 205};
166 206
@@ -412,6 +452,11 @@ static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
412 I2C_BOARD_INFO("tmp105", 0x48), 452 I2C_BOARD_INFO("tmp105", 0x48),
413 }, 453 },
414}; 454};
455static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
456 {
457 I2C_BOARD_INFO("hmc5843", 0x1e),
458 },
459};
415static int __init omap4_i2c_init(void) 460static int __init omap4_i2c_init(void)
416{ 461{
417 /* 462 /*
@@ -423,14 +468,36 @@ static int __init omap4_i2c_init(void)
423 omap_register_i2c_bus(2, 400, NULL, 0); 468 omap_register_i2c_bus(2, 400, NULL, 0);
424 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, 469 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
425 ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); 470 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
426 omap_register_i2c_bus(4, 400, NULL, 0); 471 omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo,
472 ARRAY_SIZE(sdp4430_i2c_4_boardinfo));
427 return 0; 473 return 0;
428} 474}
475
476static void __init omap_sfh7741prox_init(void)
477{
478 int error;
479
480 error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
481 if (error < 0) {
482 pr_err("%s:failed to request GPIO %d, error %d\n",
483 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
484 return;
485 }
486
487 error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
488 if (error < 0) {
489 pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
490 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
491 gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
492 }
493}
494
429static void __init omap_4430sdp_init(void) 495static void __init omap_4430sdp_init(void)
430{ 496{
431 int status; 497 int status;
432 498
433 omap4_i2c_init(); 499 omap4_i2c_init();
500 omap_sfh7741prox_init();
434 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); 501 platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
435 omap_serial_init(); 502 omap_serial_init();
436 omap4_twl6030_hsmmc_init(mmc); 503 omap4_twl6030_hsmmc_init(mmc);