From 0118523efd3f4c20fac7e22d9b18ab60282de59e Mon Sep 17 00:00:00 2001 From: Depeng Shao Date: Fri, 23 Apr 2021 13:00:39 +0800 Subject: [PATCH] msm: camera: flash: Get the flash on wait time from userspace This change gets the flash on wait time from userspace to control the precise flash. CRs-Fixed: 2929276 Change-Id: Ieac18f6e049b446c5a7b20dcfdff013aa9838575 Signed-off-by: Depeng Shao --- .../cam_flash/cam_flash_core.c | 12 ++++++------ .../cam_flash/cam_flash_dev.h | 18 ++++++++++-------- include/uapi/camera/media/cam_sensor.h | 4 +++- 3 files changed, 19 insertions(+), 15 deletions(-) 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 db065345d4..3483185bd5 100644 --- a/drivers/cam_sensor_module/cam_flash/cam_flash_core.c +++ b/drivers/cam_sensor_module/cam_flash/cam_flash_core.c @@ -11,9 +11,6 @@ #include "cam_common_util.h" #include "cam_packet_util.h" -static uint default_on_timer = 2; -module_param(default_on_timer, uint, 0644); - int cam_flash_led_prepare(struct led_trigger *trigger, int options, int *max_current, bool is_wled) { @@ -428,8 +425,7 @@ static int cam_flash_ops(struct cam_flash_ctrl *flash_ctrl, param.off_time_ms = flash_data->flash_active_time_ms; - /* This is to dynamically change the turn on time */ - param.on_time_ms = default_on_timer; + param.on_time_ms = flash_data->flash_on_wait_time_ms; CAM_DBG(CAM_FLASH, "Precise flash_on time: %u, Precise flash_off time: %u", param.on_time_ms, param.off_time_ms); @@ -1559,8 +1555,12 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg) flash_data->flash_active_time_ms = (flash_operation_info->time_on_duration_ns) / 1000000; + flash_data->flash_on_wait_time_ms = + (flash_operation_info->led_on_wait_time_ns) + / 1000000; CAM_DBG(CAM_FLASH, - "PRECISE FLASH: active_time: %llu", + "PRECISE FLASH: active wait tme:%llu duration: %llu", + flash_data->flash_on_wait_time_ms, flash_data->flash_active_time_ms); } } diff --git a/drivers/cam_sensor_module/cam_flash/cam_flash_dev.h b/drivers/cam_sensor_module/cam_flash/cam_flash_dev.h index b8416cd15d..d469fc5e76 100644 --- a/drivers/cam_sensor_module/cam_flash/cam_flash_dev.h +++ b/drivers/cam_sensor_module/cam_flash/cam_flash_dev.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ #ifndef _CAM_FLASH_DEV_H_ @@ -108,13 +108,14 @@ struct cam_flash_init_packet { /** * struct flash_frame_setting - * @cmn_attr : Provides common attributes - * @num_iterations : Iterations used to perform RER - * @led_on_delay_ms : LED on time in milisec - * @led_off_delay_ms : LED off time in milisec - * @opcode : Command buffer opcode - * @led_current_ma[] : LED current array in miliamps - * @flash_active_time_ms : Flash_On time with precise flash + * @cmn_attr : Provides common attributes + * @num_iterations : Iterations used to perform RER + * @led_on_delay_ms : LED on time in milisec + * @led_off_delay_ms : LED off time in milisec + * @opcode : Command buffer opcode + * @led_current_ma[] : LED current array in miliamps + * @flash_active_time_ms : Flash_On time with precise flash + * @flash_on_wait_time_ms : Flash on wait time with precise flash */ struct cam_flash_frame_setting { struct cam_flash_common_attr cmn_attr; @@ -124,6 +125,7 @@ struct cam_flash_frame_setting { int8_t opcode; uint32_t led_current_ma[CAM_FLASH_MAX_LED_TRIGGERS]; uint64_t flash_active_time_ms; + uint64_t flash_on_wait_time_ms; }; /** diff --git a/include/uapi/camera/media/cam_sensor.h b/include/uapi/camera/media/cam_sensor.h index 8508d440b4..c02cadda02 100644 --- a/include/uapi/camera/media/cam_sensor.h +++ b/include/uapi/camera/media/cam_sensor.h @@ -547,7 +547,8 @@ struct cam_flash_set_rer { * CAM_FLASH_OFF * @cmd_type : Command buffer operation type * @led_current_ma : Flash led current in ma - * @time_on_duration_ms : Flash time on duration in ns + * @time_on_duration_ns : Flash time on duration in ns + * @led_on_wait_time_ns : Flash led turn on wait time in ns * */ struct cam_flash_set_on_off { @@ -557,6 +558,7 @@ struct cam_flash_set_on_off { __u16 reserved; __u32 led_current_ma[CAM_FLASH_MAX_LED_TRIGGERS]; __u64 time_on_duration_ns; + __u64 led_on_wait_time_ns; } __attribute__((packed)); /**