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

Commit 97c5848b authored by Shankar Ravi's avatar Shankar Ravi Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: Add bulk changes for flash support for sdm845



Migrate the flash changes from mainline.

Change-Id: Ia8401e2d3e658666916beb6cbccdb76aaf8ccb3e
Signed-off-by: default avatarShankar Ravi <rshankar@codeaurora.org>
Signed-off-by: default avatarRaja Mallik <rmallik@codeaurora.org>
parent fe46d93a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -241,6 +241,13 @@ int cam_mem_get_cpu_buf(int32_t buf_handle, uintptr_t *vaddr_ptr, size_t *len)
}
EXPORT_SYMBOL(cam_mem_get_cpu_buf);

int cam_mem_put_cpu_buf(int32_t buf_handle)
{
	int rc = 0;
	return rc;
}
EXPORT_SYMBOL(cam_mem_put_cpu_buf);

int cam_mem_mgr_cache_ops(struct cam_mem_cache_ops_cmd *cmd)
{
	int rc = 0, idx;
+10 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -95,6 +95,15 @@ int cam_mem_get_io_buf(int32_t buf_handle, int32_t mmu_handle,
int cam_mem_get_cpu_buf(int32_t buf_handle, uintptr_t *vaddr_ptr,
	size_t *len);

/**
 * @brief: This indicates end of CPU access
 *
 * @buf_handle: Handle for the buffer
 *
 * @return Status of operation. Negative in case of error. Zero otherwise.
 */
int cam_mem_put_cpu_buf(int32_t buf_handle);

static inline bool cam_mem_is_secure_buf(int32_t buf_handle)
{
	return CAM_MEM_MGR_IS_SECURE_HDL(buf_handle);
+172 −86
Original line number Diff line number Diff line
@@ -22,38 +22,72 @@ static int cam_flash_prepare(struct cam_flash_ctrl *flash_ctrl,
	bool regulator_enable)
{
	int rc = 0;
	struct cam_flash_private_soc *soc_private =
		(struct cam_flash_private_soc *)
		flash_ctrl->soc_info.soc_private;

	if (!(flash_ctrl->switch_trigger)) {
		CAM_ERR(CAM_FLASH, "Invalid argument");
		return -EINVAL;
	}

	if (soc_private->is_wled_flash) {
		if (regulator_enable &&
			flash_ctrl->is_regulator_enabled == false) {
			rc = wled_flash_led_prepare(flash_ctrl->switch_trigger,
				ENABLE_REGULATOR, NULL);
			if (rc) {
				CAM_ERR(CAM_FLASH, "enable reg failed: rc: %d",
					rc);
				return rc;
			}

			flash_ctrl->is_regulator_enabled = true;
		} else if (!regulator_enable &&
				flash_ctrl->is_regulator_enabled == true) {
			rc = wled_flash_led_prepare(flash_ctrl->switch_trigger,
				DISABLE_REGULATOR, NULL);
			if (rc) {
				CAM_ERR(CAM_FLASH, "disalbe reg fail: rc: %d",
					rc);
				return rc;
			}

			flash_ctrl->is_regulator_enabled = false;
		} else {
			CAM_ERR(CAM_FLASH, "Wrong Wled flash state: %d",
				flash_ctrl->flash_state);
			rc = -EINVAL;
		}
	} else {
		if (regulator_enable &&
			(flash_ctrl->is_regulator_enabled == false)) {
			rc = qpnp_flash_led_prepare(flash_ctrl->switch_trigger,
				ENABLE_REGULATOR, NULL);
			if (rc) {
			CAM_ERR(CAM_FLASH, "regulator enable failed rc = %d",
				rc);
				CAM_ERR(CAM_FLASH,
					"Regulator enable failed rc = %d", rc);
				return rc;
			}

			flash_ctrl->is_regulator_enabled = true;
		} else if ((!regulator_enable) &&
			(flash_ctrl->is_regulator_enabled == true)) {
			rc = qpnp_flash_led_prepare(flash_ctrl->switch_trigger,
				DISABLE_REGULATOR, NULL);
			if (rc) {
			CAM_ERR(CAM_FLASH, "regulator disable failed rc = %d",
				rc);
				CAM_ERR(CAM_FLASH,
					"Regulator disable failed rc = %d", rc);
				return rc;
			}

			flash_ctrl->is_regulator_enabled = false;
		} else {
			CAM_ERR(CAM_FLASH, "Wrong Flash State : %d",
				flash_ctrl->flash_state);
			rc = -EINVAL;
		}

	}
	return rc;
}

@@ -269,7 +303,6 @@ int cam_flash_pmic_flush_request(struct cam_flash_ctrl *fctrl,
	}

	if (type == FLUSH_ALL) {
		cam_flash_off(fctrl);
	/* flush all requests*/
		for (i = 0; i < MAX_PER_FRAME_ARRAY; i++) {
			fctrl->per_frame[i].cmn_attr.request_id = 0;
@@ -362,6 +395,9 @@ int cam_flash_flush_request(struct cam_req_mgr_flush_request *flush)
	}

	mutex_lock(&fctrl->flash_mutex);
	if (fctrl->flash_state == CAM_FLASH_STATE_INIT)
		goto end;

	if (flush->type == CAM_REQ_MGR_FLUSH_TYPE_ALL) {
		fctrl->last_flush_req = flush->req_id;
		CAM_DBG(CAM_FLASH, "last reqest to flush is %lld",
@@ -403,37 +439,31 @@ static int cam_flash_ops(struct cam_flash_ctrl *flash_ctrl,
		for (i = 0; i < flash_ctrl->torch_num_sources; i++) {
			if (flash_ctrl->torch_trigger[i]) {
				max_current = soc_private->torch_max_current[i];

				if (flash_data->led_current_ma[i] <=
					max_current)
					curr = flash_data->led_current_ma[i];
				else
					curr = soc_private->torch_op_current[i];

				CAM_DBG(CAM_PERF,
					"Led_Current[%d] = %d", i, curr);
				cam_res_mgr_led_trigger_event(
					flash_ctrl->torch_trigger[i],
					curr);
					curr = max_current;
			}
			CAM_DBG(CAM_FLASH, "Led_Torch[%d]: Current: %d",
				i, curr);
			cam_res_mgr_led_trigger_event(
				flash_ctrl->torch_trigger[i], curr);
		}
	} else if (op == CAMERA_SENSOR_FLASH_OP_FIREHIGH) {
		for (i = 0; i < flash_ctrl->flash_num_sources; i++) {
			if (flash_ctrl->flash_trigger[i]) {
				max_current = soc_private->flash_max_current[i];

				if (flash_data->led_current_ma[i] <=
					max_current)
					curr = flash_data->led_current_ma[i];
				else
					curr = soc_private->flash_op_current[i];

				CAM_DBG(CAM_PERF, "LED flash_current[%d]: %d",
					curr = max_current;
			}
			CAM_DBG(CAM_FLASH, "LED_Flash[%d]: Current: %d",
				i, curr);
			cam_res_mgr_led_trigger_event(
					flash_ctrl->flash_trigger[i],
					curr);
			}
				flash_ctrl->flash_trigger[i], curr);
		}
	} else {
		CAM_ERR(CAM_FLASH, "Wrong Operation: %d", op);
@@ -443,7 +473,7 @@ static int cam_flash_ops(struct cam_flash_ctrl *flash_ctrl,
	if (flash_ctrl->switch_trigger)
		cam_res_mgr_led_trigger_event(
			flash_ctrl->switch_trigger,
			LED_SWITCH_ON);
			(enum led_brightness)LED_SWITCH_ON);

	return 0;
}
@@ -457,7 +487,7 @@ int cam_flash_off(struct cam_flash_ctrl *flash_ctrl)

	if (flash_ctrl->switch_trigger)
		cam_res_mgr_led_trigger_event(flash_ctrl->switch_trigger,
			LED_SWITCH_OFF);
			(enum led_brightness)LED_SWITCH_OFF);

	flash_ctrl->flash_state = CAM_FLASH_STATE_START;
	return 0;
@@ -907,10 +937,9 @@ int cam_flash_i2c_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
	rc = cam_mem_get_cpu_buf(config.packet_handle,
		&generic_ptr, &len_of_buffer);
	if (rc) {
		CAM_ERR(CAM_FLASH, "Failed in getting the buffer : %d", rc);
		CAM_ERR(CAM_FLASH, "Failed in getting the packet : %d", rc);
		return rc;
	}

	remain_len = len_of_buffer;
	if ((sizeof(struct cam_packet) > len_of_buffer) ||
		((size_t)config.offset >= len_of_buffer -
@@ -1272,7 +1301,8 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
		CAM_ERR(CAM_FLASH,
			"Inval cam_packet strut size: %zu, len_of_buff: %zu",
			 sizeof(struct cam_packet), len_of_buffer);
		return -EINVAL;
		rc = -EINVAL;
		goto rel_pkt_buf;
	}

	remain_len -= (size_t)config.offset;
@@ -1282,17 +1312,19 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
	if (cam_packet_util_validate_packet(csl_packet,
		remain_len)) {
		CAM_ERR(CAM_FLASH, "Invalid packet params");
		return -EINVAL;
		rc = -EINVAL;
		goto rel_pkt_buf;
	}

	if ((csl_packet->header.op_code & 0xFFFFFF) !=
		CAM_FLASH_PACKET_OPCODE_INIT &&
		csl_packet->header.request_id <= fctrl->last_flush_req
		&& fctrl->last_flush_req != 0) {
		CAM_DBG(CAM_FLASH,
			"reject request %lld, last request to flush %lld",
		CAM_WARN(CAM_FLASH,
			"reject request %lld, last request to flush %u",
			csl_packet->header.request_id, fctrl->last_flush_req);
		return -EINVAL;
		rc = -EINVAL;
		goto rel_pkt_buf;
	}

	if (csl_packet->header.request_id > fctrl->last_flush_req)
@@ -1308,13 +1340,14 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
			&cmd_buf_ptr, &len_of_buffer);
		if (rc) {
			CAM_ERR(CAM_FLASH, "Fail in get buffer: %d", rc);
			return rc;
			goto rel_pkt_buf;
		}
		if ((len_of_buffer < sizeof(struct cam_flash_init)) ||
			(cmd_desc->offset >
			(len_of_buffer - sizeof(struct cam_flash_init)))) {
			CAM_ERR(CAM_FLASH, "Not enough buffer");
			return -EINVAL;
			rc = -EINVAL;
			goto rel_pkt_buf;
		}
		remain_len = len_of_buffer - cmd_desc->offset;
		cmd_buf = (uint32_t *)((uint8_t *)cmd_buf_ptr +
@@ -1336,7 +1369,7 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
			if (rc) {
				CAM_ERR(CAM_FLASH,
					"Enable Regulator Failed rc = %d", rc);
				return rc;
				goto rel_cmd_buf;
			}

			fctrl->flash_state =
@@ -1348,7 +1381,8 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)

			if (remain_len < sizeof(struct cam_flash_set_on_off)) {
				CAM_ERR(CAM_FLASH, "Not enough buffer");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}

			flash_operation_info =
@@ -1356,12 +1390,14 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
			if (!flash_operation_info) {
				CAM_ERR(CAM_FLASH,
					"flash_operation_info Null");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}
			if (flash_operation_info->count >
				CAM_FLASH_MAX_LED_TRIGGERS) {
				CAM_ERR(CAM_FLASH, "led count out of limit");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}
			fctrl->nrt_info.cmn_attr.count =
				flash_operation_info->count;
@@ -1387,8 +1423,13 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
		default:
			CAM_ERR(CAM_FLASH, "Wrong cmd_type = %d",
				cam_flash_info->cmd_type);
			return -EINVAL;
			rc = -EINVAL;
			goto rel_cmd_buf;
		}

		if (cam_mem_put_cpu_buf(cmd_desc->mem_handle))
			CAM_WARN(CAM_FLASH, "Fail in put buffer: %d",
				cmd_desc->mem_handle);
		break;
	}
	case CAM_FLASH_PACKET_OPCODE_SET_OPS: {
@@ -1413,22 +1454,24 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
		if (rc) {
			CAM_ERR(CAM_FLASH, "Fail in get buffer: 0x%x",
				cmd_desc->mem_handle);
			return rc;
			goto rel_pkt_buf;
		}

		if ((len_of_buffer < sizeof(struct common_header)) ||
			(cmd_desc->offset >
			(len_of_buffer - sizeof(struct common_header)))) {
			CAM_ERR(CAM_FLASH, "not enough buffer");
			return -EINVAL;
			rc = -EINVAL;
			goto rel_pkt_buf;
		}
		remain_len = len_of_buffer - cmd_desc->offset;

		cmd_buf = (uint32_t *)((uint8_t *)cmd_buf_ptr +
			cmd_desc->offset);
		if (!cmd_buf)
			return -EINVAL;

		if (!cmd_buf) {
			rc = -EINVAL;
			goto rel_cmd_buf;
		}
		cmn_hdr = (struct common_header *)cmd_buf;

		switch (cmn_hdr->cmd_type) {
@@ -1441,11 +1484,12 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
				CAM_WARN(CAM_FLASH,
					"Rxed Flash fire ops without linking");
				flash_data->cmn_attr.is_settings_valid = false;
				return -EINVAL;
				goto rel_cmd_buf;
			}
			if (remain_len < sizeof(struct cam_flash_set_on_off)) {
				CAM_ERR(CAM_FLASH, "Not enough buffer");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}

			flash_operation_info =
@@ -1453,12 +1497,14 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
			if (!flash_operation_info) {
				CAM_ERR(CAM_FLASH,
					"flash_operation_info Null");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}
			if (flash_operation_info->count >
				CAM_FLASH_MAX_LED_TRIGGERS) {
				CAM_ERR(CAM_FLASH, "led count out of limit");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}

			flash_data->opcode = flash_operation_info->opcode;
@@ -1475,8 +1521,12 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
		default:
			CAM_ERR(CAM_FLASH, "Wrong cmd_type = %d",
				cmn_hdr->cmd_type);
			return -EINVAL;
			rc = -EINVAL;
			goto rel_cmd_buf;
		}
		if (cam_mem_put_cpu_buf(cmd_desc->mem_handle))
			CAM_WARN(CAM_FLASH, "Fail in put buffer: 0x%x",
				cmd_desc->mem_handle);
		break;
	}
	case CAM_FLASH_PACKET_OPCODE_NON_REALTIME_SET_OPS: {
@@ -1488,14 +1538,15 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
			&cmd_buf_ptr, &len_of_buffer);
		if (rc) {
			CAM_ERR(CAM_FLASH, "Fail in get buffer: %d", rc);
			return rc;
			goto rel_pkt_buf;
		}

		if ((len_of_buffer < sizeof(struct common_header)) ||
			(cmd_desc->offset >
			(len_of_buffer - sizeof(struct common_header)))) {
			CAM_ERR(CAM_FLASH, "Not enough buffer");
			return -EINVAL;
			rc = -EINVAL;
			goto rel_pkt_buf;
		}
		remain_len = len_of_buffer - cmd_desc->offset;
		cmd_buf = (uint32_t *)((uint8_t *)cmd_buf_ptr +
@@ -1507,19 +1558,22 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
			CAM_DBG(CAM_FLASH, "Widget Flash Operation");
			if (remain_len < sizeof(struct cam_flash_set_on_off)) {
				CAM_ERR(CAM_FLASH, "Not enough buffer");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_pkt_buf;
			}
			flash_operation_info =
				(struct cam_flash_set_on_off *) cmd_buf;
			if (!flash_operation_info) {
				CAM_ERR(CAM_FLASH,
					"flash_operation_info Null");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}
			if (flash_operation_info->count >
				CAM_FLASH_MAX_LED_TRIGGERS) {
				CAM_ERR(CAM_FLASH, "led count out of limit");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}

			fctrl->nrt_info.cmn_attr.count =
@@ -1538,26 +1592,36 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
			if (rc)
				CAM_ERR(CAM_FLASH, "Apply setting failed: %d",
					rc);
			return rc;
			goto rel_cmd_buf;
		}
		case CAMERA_SENSOR_FLASH_CMD_TYPE_QUERYCURR: {
			int query_curr_ma = 0;

			if (remain_len < sizeof(struct cam_flash_query_curr)) {
				CAM_ERR(CAM_FLASH, "Not enough buffer");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}
			flash_query_info =
				(struct cam_flash_query_curr *)cmd_buf;

			rc = qpnp_flash_led_prepare(fctrl->switch_trigger,
				QUERY_MAX_CURRENT, &query_curr_ma);
			if (soc_private->is_wled_flash)
				rc = wled_flash_led_prepare(
					fctrl->switch_trigger,
					QUERY_MAX_AVAIL_CURRENT,
					&query_curr_ma);
			else
				rc = qpnp_flash_led_prepare(
					fctrl->switch_trigger,
					QUERY_MAX_AVAIL_CURRENT,
					&query_curr_ma);

			CAM_DBG(CAM_FLASH, "query_curr_ma = %d",
				query_curr_ma);
			if (rc) {
				CAM_ERR(CAM_FLASH,
				"Query current failed with rc=%d", rc);
				return rc;
				goto rel_cmd_buf;
			}
			flash_query_info->query_current_ma = query_curr_ma;
			break;
@@ -1566,18 +1630,21 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
			rc = 0;
			if (remain_len < sizeof(struct cam_flash_set_rer)) {
				CAM_ERR(CAM_FLASH, "Not enough buffer");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}
			flash_rer_info = (struct cam_flash_set_rer *)cmd_buf;
			if (!flash_rer_info) {
				CAM_ERR(CAM_FLASH,
					"flash_rer_info Null");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}
			if (flash_rer_info->count >
				CAM_FLASH_MAX_LED_TRIGGERS) {
				CAM_ERR(CAM_FLASH, "led count out of limit");
				return -EINVAL;
				rc = -EINVAL;
				goto rel_cmd_buf;
			}

			fctrl->nrt_info.cmn_attr.cmd_type =
@@ -1600,13 +1667,17 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
			if (rc)
				CAM_ERR(CAM_FLASH, "apply_setting failed: %d",
					rc);
			return rc;
			goto rel_cmd_buf;
		}
		default:
			CAM_ERR(CAM_FLASH, "Wrong cmd_type : %d",
				cmn_hdr->cmd_type);
			return -EINVAL;
			rc = -EINVAL;
			goto rel_cmd_buf;
		}
		if (cam_mem_put_cpu_buf(cmd_desc->mem_handle))
			CAM_WARN(CAM_FLASH, "Fail in put buffer: 0x%x",
				cmd_desc->mem_handle);
		break;
	}
	case CAM_PKT_NOP_OPCODE: {
@@ -1618,7 +1689,7 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
				"Rxed NOP packets without linking");
			fctrl->per_frame[frm_offset].cmn_attr.is_settings_valid
				= false;
			return -EINVAL;
			goto rel_pkt_buf;
		}

		fctrl->per_frame[frm_offset].cmn_attr.is_settings_valid = false;
@@ -1626,15 +1697,15 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
		fctrl->per_frame[frm_offset].opcode = CAM_PKT_NOP_OPCODE;
		CAM_DBG(CAM_FLASH, "NOP Packet is Received: req_id: %llu",
			csl_packet->header.request_id);
		goto update_req_mgr;
		break;
	}
	default:
		CAM_ERR(CAM_FLASH, "Wrong Opcode : %d",
			(csl_packet->header.op_code & 0xFFFFFF));
		return -EINVAL;
		rc = -EINVAL;
		goto rel_pkt_buf;
	}

update_req_mgr:
	if (((csl_packet->header.op_code  & 0xFFFFF) ==
		CAM_PKT_NOP_OPCODE) ||
		((csl_packet->header.op_code & 0xFFFFF) ==
@@ -1655,6 +1726,21 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
		CAM_DBG(CAM_FLASH, "add req to req_mgr= %lld", add_req.req_id);
	}

	if (cam_mem_put_cpu_buf(config.packet_handle))
		CAM_WARN(CAM_FLASH, "Failed in put the buffer: %llu ",
			config.packet_handle);

	return 0;

rel_cmd_buf:
	if (cam_mem_put_cpu_buf(cmd_desc->mem_handle))
		CAM_WARN(CAM_FLASH, "Fail in put buffer: %d",
			cmd_desc->mem_handle);
rel_pkt_buf:
	if (cam_mem_put_cpu_buf(config.packet_handle))
		CAM_WARN(CAM_FLASH, "Failed in put the buffer: %llu ",
			config.packet_handle);

	return rc;
}

+8 −3
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -13,15 +13,20 @@
#ifndef _CAM_FLASH_CORE_H_
#define _CAM_FLASH_CORE_H_

#include <linux/leds-qpnp-flash.h>
#include <media/cam_sensor.h>
#include "cam_flash_dev.h"

#define QUERY_MAX_AVAIL_CURRENT		BIT(2)

int cam_flash_publish_dev_info(struct cam_req_mgr_device_info *info);
int cam_flash_establish_link(struct cam_req_mgr_core_dev_link_setup *link);
int cam_flash_apply_request(struct cam_req_mgr_apply_request *apply);
int cam_flash_process_evt(struct cam_req_mgr_link_evt_data *event_data);
int cam_flash_flush_request(struct cam_req_mgr_flush_request *flush);

static inline int wled_flash_led_prepare(struct led_trigger *trig, int options,
					int *max_current)
{
	return -EINVAL;
}

#endif /*_CAM_FLASH_CORE_H_*/
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/of.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/leds-qpnp-flash.h>
#include <media/v4l2-subdev.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-event.h>
@@ -135,6 +136,7 @@ struct cam_flash_frame_setting {
 * @torch_trigger_name  : Torch trigger name array
 * @torch_op_current    : Torch operational current
 * @torch_max_current   : Max supported current for LED in torch mode
 * @is_wled_flash       : Detection between WLED/LED flash
 */

struct cam_flash_private_soc {
@@ -146,6 +148,7 @@ struct cam_flash_private_soc {
	const char   *torch_trigger_name[CAM_FLASH_MAX_LED_TRIGGERS];
	uint32_t     torch_op_current[CAM_FLASH_MAX_LED_TRIGGERS];
	uint32_t     torch_max_current[CAM_FLASH_MAX_LED_TRIGGERS];
	bool         is_wled_flash;
};

struct cam_flash_func_tbl {
Loading