mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
msm: camera: sensor: Turn off the flash while flushing
Turn off the flash while flushing if the flushed request turns off the flash. CRs-Fixed: 2576732 Change-Id: I546fc6b6ee79f492af905d163515eb19eed78f41 Signed-off-by: Depeng Shao <depengs@codeaurora.org>
This commit is contained in:
parent
5619d4e93e
commit
d500bda747
1 changed files with 51 additions and 10 deletions
|
|
@ -213,6 +213,8 @@ int cam_flash_pmic_flush_request(struct cam_flash_ctrl *fctrl,
|
|||
int rc = 0;
|
||||
int i = 0, j = 0;
|
||||
int frame_offset = 0;
|
||||
bool is_off_needed = false;
|
||||
struct cam_flash_frame_setting *flash_data = NULL;
|
||||
|
||||
if (!fctrl) {
|
||||
CAM_ERR(CAM_FLASH, "Device data is NULL");
|
||||
|
|
@ -222,23 +224,47 @@ int cam_flash_pmic_flush_request(struct cam_flash_ctrl *fctrl,
|
|||
if (type == FLUSH_ALL) {
|
||||
/* flush all requests*/
|
||||
for (i = 0; i < MAX_PER_FRAME_ARRAY; i++) {
|
||||
fctrl->per_frame[i].cmn_attr.request_id = 0;
|
||||
fctrl->per_frame[i].cmn_attr.is_settings_valid = false;
|
||||
fctrl->per_frame[i].cmn_attr.count = 0;
|
||||
flash_data =
|
||||
&fctrl->per_frame[i];
|
||||
if ((flash_data->opcode ==
|
||||
CAMERA_SENSOR_FLASH_OP_OFF) &&
|
||||
(flash_data->cmn_attr.request_id > 0) &&
|
||||
(flash_data->cmn_attr.request_id <= req_id) &&
|
||||
flash_data->cmn_attr.is_settings_valid) {
|
||||
is_off_needed = true;
|
||||
CAM_DBG(CAM_FLASH,
|
||||
"FLASH_ALL: Turn off the flash for req %llu",
|
||||
flash_data->cmn_attr.request_id);
|
||||
}
|
||||
|
||||
flash_data->cmn_attr.request_id = 0;
|
||||
flash_data->cmn_attr.is_settings_valid = false;
|
||||
flash_data->cmn_attr.count = 0;
|
||||
for (j = 0; j < CAM_FLASH_MAX_LED_TRIGGERS; j++)
|
||||
fctrl->per_frame[i].led_current_ma[j] = 0;
|
||||
flash_data->led_current_ma[j] = 0;
|
||||
}
|
||||
|
||||
cam_flash_pmic_flush_nrt(fctrl);
|
||||
} else if ((type == FLUSH_REQ) && (req_id != 0)) {
|
||||
/* flush request with req_id*/
|
||||
frame_offset = req_id % MAX_PER_FRAME_ARRAY;
|
||||
fctrl->per_frame[frame_offset].cmn_attr.request_id = 0;
|
||||
fctrl->per_frame[frame_offset].cmn_attr.is_settings_valid =
|
||||
flash_data =
|
||||
&fctrl->per_frame[frame_offset];
|
||||
|
||||
if (flash_data->opcode ==
|
||||
CAMERA_SENSOR_FLASH_OP_OFF) {
|
||||
is_off_needed = true;
|
||||
CAM_DBG(CAM_FLASH,
|
||||
"FLASH_REQ: Turn off the flash for req %llu",
|
||||
flash_data->cmn_attr.request_id);
|
||||
}
|
||||
|
||||
flash_data->cmn_attr.request_id = 0;
|
||||
flash_data->cmn_attr.is_settings_valid =
|
||||
false;
|
||||
fctrl->per_frame[frame_offset].cmn_attr.count = 0;
|
||||
flash_data->cmn_attr.count = 0;
|
||||
for (i = 0; i < CAM_FLASH_MAX_LED_TRIGGERS; i++)
|
||||
fctrl->per_frame[frame_offset].led_current_ma[i] = 0;
|
||||
flash_data->led_current_ma[i] = 0;
|
||||
} else if ((type == FLUSH_REQ) && (req_id == 0)) {
|
||||
/* Handels NonRealTime usecase */
|
||||
cam_flash_pmic_flush_nrt(fctrl);
|
||||
|
|
@ -247,6 +273,9 @@ int cam_flash_pmic_flush_request(struct cam_flash_ctrl *fctrl,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (is_off_needed)
|
||||
cam_flash_off(fctrl);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -493,7 +522,9 @@ static int cam_flash_i2c_delete_req(struct cam_flash_ctrl *fctrl,
|
|||
CAM_DBG(CAM_FLASH, "top: %llu, del_req_id:%llu",
|
||||
top, del_req_id);
|
||||
}
|
||||
fctrl->func_tbl.flush_req(fctrl, FLUSH_REQ, del_req_id);
|
||||
|
||||
cam_flash_i2c_flush_nrt(fctrl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -503,6 +534,7 @@ static int cam_flash_pmic_delete_req(struct cam_flash_ctrl *fctrl,
|
|||
int i = 0;
|
||||
struct cam_flash_frame_setting *flash_data = NULL;
|
||||
uint64_t top = 0, del_req_id = 0;
|
||||
int frame_offset = 0;
|
||||
|
||||
if (req_id != 0) {
|
||||
for (i = 0; i < MAX_PER_FRAME_ARRAY; i++) {
|
||||
|
|
@ -538,7 +570,16 @@ static int cam_flash_pmic_delete_req(struct cam_flash_ctrl *fctrl,
|
|||
top, del_req_id);
|
||||
}
|
||||
|
||||
fctrl->func_tbl.flush_req(fctrl, FLUSH_REQ, del_req_id);
|
||||
/* delete the request */
|
||||
frame_offset = del_req_id % MAX_PER_FRAME_ARRAY;
|
||||
flash_data = &fctrl->per_frame[frame_offset];
|
||||
flash_data->cmn_attr.request_id = 0;
|
||||
flash_data->cmn_attr.is_settings_valid = false;
|
||||
flash_data->cmn_attr.count = 0;
|
||||
|
||||
for (i = 0; i < CAM_FLASH_MAX_LED_TRIGGERS; i++)
|
||||
flash_data->led_current_ma[i] = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue