diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-4430sdp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-4430sdp.c | 69 |
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 | ||
44 | static struct gpio_led sdp4430_gpio_leds[] = { | 47 | static 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 | ||
83 | static 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 | |||
80 | static struct gpio_led_platform_data sdp4430_led_data = { | 93 | static 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 | ||
98 | static int omap_prox_activate(struct device *dev) | ||
99 | { | ||
100 | gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1); | ||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | static void omap_prox_deactivate(struct device *dev) | ||
105 | { | ||
106 | gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0); | ||
107 | } | ||
108 | |||
109 | static 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 | |||
116 | static 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 | |||
85 | static struct platform_device sdp4430_leds_gpio = { | 124 | static 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 | ||
162 | static struct platform_device *sdp4430_devices[] __initdata = { | 201 | static 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 | }; |
455 | static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = { | ||
456 | { | ||
457 | I2C_BOARD_INFO("hmc5843", 0x1e), | ||
458 | }, | ||
459 | }; | ||
415 | static int __init omap4_i2c_init(void) | 460 | static 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 | |||
476 | static 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 | |||
429 | static void __init omap_4430sdp_init(void) | 495 | static 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); |