From f7fd513151ae684cc8a637bbd8db23b7e5514eb6 Mon Sep 17 00:00:00 2001 From: longc129 Date: Fri, 22 Apr 2022 18:03:55 +0800 Subject: [PATCH] Low flashlight brightness bugfix Low flashlight brightness bugfix Because the platform side cannot output a PWM wave with 100% duty cycle, the brightness of the flashlight is too low. To fix this, we manually pull up this pin. Change-Id: Iaa58f021dcecf86d173332f425ba311d40959127 Reviewed-on: https://gerrit.mot.com/2250288 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Pengfei Qiao Reviewed-by: Zhichao Chen Submit-Approved: Jira Key --- drivers/cam_sensor_module/cam_flash/cam_flash_core.c | 8 ++++++++ drivers/cam_sensor_module/cam_flash/cam_flash_core.h | 4 ++++ .../cam_flash_pm6125_gpio/pm6125_flash_gpio.h | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/drivers/cam_sensor_module/cam_flash/cam_flash_core.c b/drivers/cam_sensor_module/cam_flash/cam_flash_core.c index 2ee249487eaf..c2b41efc1d15 100644 --- a/drivers/cam_sensor_module/cam_flash/cam_flash_core.c +++ b/drivers/cam_sensor_module/cam_flash/cam_flash_core.c @@ -582,8 +582,16 @@ static int cam_flash_low( } cam_res_mgr_gpio_set_value(soc_private->flash_gpio_enable, 0); +#ifdef CONFIG_DEVON_CAMERA_FLASH + cam_res_mgr_gpio_request(soc_info.dev, DEVON_CAMERA_PWM_GPIO, 0, "torch_enable"); + cam_res_mgr_gpio_set_value(DEVON_CAMERA_PWM_GPIO, 1); + usleep_range(5000,6000); + cam_res_mgr_gpio_set_value(DEVON_CAMERA_PWM_GPIO, 0); + cam_res_mgr_gpio_free(soc_info.dev, DEVON_CAMERA_PWM_GPIO); +#else pm6125_flash_gpio_select_state(PM6125_FLASH_GPIO_STATE_ACTIVE, CAMERA_SENSOR_FLASH_OP_FIRELOW, FLASH_FIRE_LOW_MAXCURRENT); usleep_range(5000,6000); +#endif pm6125_flash_gpio_select_state(PM6125_FLASH_GPIO_STATE_ACTIVE, CAMERA_SENSOR_FLASH_OP_FIRELOW, flash_data->led_current_ma[0]); #endif diff --git a/drivers/cam_sensor_module/cam_flash/cam_flash_core.h b/drivers/cam_sensor_module/cam_flash/cam_flash_core.h index c382809dbb92..f76a3e2c8aae 100644 --- a/drivers/cam_sensor_module/cam_flash/cam_flash_core.h +++ b/drivers/cam_sensor_module/cam_flash/cam_flash_core.h @@ -6,6 +6,10 @@ #ifndef _CAM_FLASH_CORE_H_ #define _CAM_FLASH_CORE_H_ +#ifdef CONFIG_DEVON_CAMERA_FLASH +#define DEVON_CAMERA_PWM_GPIO 1165 +#endif + #include #include "cam_flash_dev.h" diff --git a/drivers/cam_sensor_module/cam_flash_pm6125_gpio/pm6125_flash_gpio.h b/drivers/cam_sensor_module/cam_flash_pm6125_gpio/pm6125_flash_gpio.h index 24296af7c997..69ea3cc007b9 100644 --- a/drivers/cam_sensor_module/cam_flash_pm6125_gpio/pm6125_flash_gpio.h +++ b/drivers/cam_sensor_module/cam_flash_pm6125_gpio/pm6125_flash_gpio.h @@ -20,9 +20,15 @@ enum{ }; #endif +#ifdef CONFIG_DEVON_CAMERA_FLASH +#define PM6125_PWM_PERIOD 50000 +#define FLASH_FIRE_HIGH_MAXCURRENT 1750 +#define FLASH_FIRE_LOW_MAXCURRENT 285 +#else #define PM6125_PWM_PERIOD 50000 #define FLASH_FIRE_HIGH_MAXCURRENT 1200 #define FLASH_FIRE_LOW_MAXCURRENT 150 +#endif /***************************************************************************** * Function Prototype