From b74e992148de53893c06bd97bc798b2cac515368 Mon Sep 17 00:00:00 2001 From: hhb Date: Fri, 11 May 2012 17:41:58 +0800 Subject: [PATCH] rk30 phone loquat: modify camera LED error in board --- arch/arm/mach-rk30/board-rk30-phone-loquat.c | 37 +++++++++----------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/arch/arm/mach-rk30/board-rk30-phone-loquat.c b/arch/arm/mach-rk30/board-rk30-phone-loquat.c index 6fcfd96dc814..b97194474785 100755 --- a/arch/arm/mach-rk30/board-rk30-phone-loquat.c +++ b/arch/arm/mach-rk30/board-rk30-phone-loquat.c @@ -243,39 +243,36 @@ static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on) //sgm3140 LED driver #define CONFIG_SENSOR_FALSH_EN_PIN_0 RK30_PIN4_PD6 //high:enable #define CONFIG_SENSOR_FALSH_MODE_PIN_0 RK30_PIN0_PD6 //high:FLASH, low:torch -static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on) +static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res, int on) { - - gpio_request(CONFIG_SENSOR_FALSH_MODE_PIN_0, "camera_falsh_mode"); - rk30_mux_api_set(GPIO0D6_PWM2_NAME, GPIO0D_GPIO0D6); - gpio_request(CONFIG_SENSOR_FALSH_EN_PIN_0, "camera_falsh_en"); - rk30_mux_api_set(GPIO4D6_SMCDATA14_TRACEDATA14_NAME, GPIO4D_GPIO4D6); - - switch (on) - { - case Flash_Off: - { + static int init_flag = 0; + if(init_flag == 0) { + gpio_request(CONFIG_SENSOR_FALSH_MODE_PIN_0, "camera_falsh_mode"); + rk30_mux_api_set(GPIO0D6_PWM2_NAME, GPIO0D_GPIO0D6); + gpio_request(CONFIG_SENSOR_FALSH_EN_PIN_0, "camera_falsh_en"); + rk30_mux_api_set(GPIO4D6_SMCDATA14_TRACEDATA14_NAME, GPIO4D_GPIO4D6); + init_flag = 1; + } + switch (on) { + case Flash_Off: { gpio_direction_output(CONFIG_SENSOR_FALSH_EN_PIN_0, 0); - gpio_direction_output(CONFIG_SENSOR_FALSH_PIN_0, 1); + gpio_direction_output(CONFIG_SENSOR_FALSH_MODE_PIN_0, 1); break; } - case Flash_On: - { + case Flash_On: { gpio_direction_output(CONFIG_SENSOR_FALSH_EN_PIN_0, 1); - gpio_direction_output(CONFIG_SENSOR_FALSH_PIN_0, 1); + gpio_direction_output(CONFIG_SENSOR_FALSH_MODE_PIN_0, 1); break; } - case Flash_Torch: - { + case Flash_Torch: { gpio_direction_output(CONFIG_SENSOR_FALSH_EN_PIN_0, 1); - gpio_direction_output(CONFIG_SENSOR_FALSH_PIN_0, 0); + gpio_direction_output(CONFIG_SENSOR_FALSH_MODE_PIN_0, 0); break; } - default: - { + default: { printk("%s..Flash command(%d) is invalidate \n",__FUNCTION__, on); gpio_direction_output(CONFIG_SENSOR_FALSH_EN_PIN_0, 0); break; -- 2.34.1