Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 956a6efc authored by Anil Kumar Kanakanti's avatar Anil Kumar Kanakanti
Browse files

msm: camera: sensor: Turn off the i2c flash while flushing



Turn off the i2c flash while flushing if the flushed request
turns off the flash.

CRs-Fixed: 2840575
Change-Id: Ia4734ed2a4957ca4f06fac3ee5eb4681ff354fe8
Signed-off-by: default avatarAnil Kumar Kanakanti <akanakan@codeaurora.org>
parent 34cbbdd6
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
// 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.
 */

#include <linux/module.h>
@@ -403,6 +403,7 @@ int cam_flash_i2c_flush_request(struct cam_flash_ctrl *fctrl,
	int i = 0;
	uint32_t cancel_req_id_found = 0;
	struct i2c_settings_array *i2c_set = NULL;
	struct i2c_settings_list *i2c_list;

	if (!fctrl) {
		CAM_ERR(CAM_FLASH, "Device data is NULL");
@@ -423,6 +424,20 @@ int cam_flash_i2c_flush_request(struct cam_flash_ctrl *fctrl,
				continue;

			if (i2c_set->is_settings_valid == 1) {
				/* If any flash_off request pending,
				 * process it before deleting it
				 */
				list_for_each_entry(i2c_list,
				&(i2c_set->list_head), list) {
					rc = cam_sensor_util_i2c_apply_setting(
						&(fctrl->io_master_info),
						i2c_list);
					if (rc) {
						CAM_ERR(CAM_FLASH,
						"Failed to apply settings: %d",
						rc);
					}
				}
				rc = delete_request(i2c_set);
				if (rc < 0)
					CAM_ERR(CAM_FLASH,
@@ -625,6 +640,7 @@ static int cam_flash_i2c_delete_req(struct cam_flash_ctrl *fctrl,
{
	int i = 0, rc = 0;
	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++) {
@@ -653,6 +669,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);
	}
	/* delete/invalidate the request */
	frame_offset = del_req_id % MAX_PER_FRAME_ARRAY;
	fctrl->i2c_data.per_frame[frame_offset].is_settings_valid = false;

	cam_flash_i2c_flush_nrt(fctrl);