From 543147e02b7b458d7f84a72fd9087cc5e4e29b07 Mon Sep 17 00:00:00 2001 From: Markinus Date: Sat, 28 Aug 2010 14:39:19 +0200 Subject: [PATCH] htcleo: add flashlight driver --- arch/arm/mach-msm/board-htcleo.c | 36 +++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-msm/board-htcleo.c b/arch/arm/mach-msm/board-htcleo.c index 0f56a672..069a4526 100644 --- a/arch/arm/mach-msm/board-htcleo.c +++ b/arch/arm/mach-msm/board-htcleo.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "board-htcleo.h" #include "board-htcleo-ts.h" @@ -228,6 +229,39 @@ unsigned htcleo_get_vbus_state(void) #endif +/////////////////////////////////////////////////////////////////////// +// Flashlight +/////////////////////////////////////////////////////////////////////// + +static uint32_t flashlight_gpio_table[] = +{ + PCOM_GPIO_CFG(HTCLEO_GPIO_FLASHLIGHT_TORCH, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), + PCOM_GPIO_CFG(HTCLEO_GPIO_FLASHLIGHT_FLASH, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_2MA), +}; + +static int config_htcleo_flashlight_gpios(void) +{ + config_gpio_table(flashlight_gpio_table, ARRAY_SIZE(flashlight_gpio_table)); + return 0; +} + +static struct flashlight_platform_data htcleo_flashlight_data = +{ + .gpio_init = config_htcleo_flashlight_gpios, + .torch = HTCLEO_GPIO_FLASHLIGHT_TORCH, + .flash = HTCLEO_GPIO_FLASHLIGHT_FLASH, + .flash_duration_ms = 600 +}; + +static struct platform_device htcleo_flashlight_device = +{ + .name = "flashlight", + .dev = + { + .platform_data = &htcleo_flashlight_data, + }, +}; + /////////////////////////////////////////////////////////////////////// // KGSL (HW3D support)#include @@ -364,7 +398,7 @@ static struct platform_device *devices[] __initdata = // &msm_kgsl_device, // &capella_cm3602, // &msm_camera_sensor_s5k3e2fx, -// &htcleo_flashlight_device, + &htcleo_flashlight_device, &htcleo_power, &qsd_device_spi,