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

Commit 503d71d8 authored by Jigarkumar Zala's avatar Jigarkumar Zala Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: Add extra skip after applying flash off operation



Currently flash off operation is exposing partial lit. Flash HW
needs extra frame to completely cool down. This change adds extra
skip frame for flash off operation to give flash hardware enough
time to reach luminance level to zero.

Change-Id: I321756c5989c974ad7a3df5f78bcd7b6e27c6eb3
Signed-off-by: default avatarJigarkumar Zala <jzala@codeaurora.org>
parent fbfcf596
Loading
Loading
Loading
Loading
+59 −4
Original line number Diff line number Diff line
@@ -403,10 +403,53 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
	struct cam_req_mgr_connected_device *dev = NULL;
	struct cam_req_mgr_apply_request     apply_req;
	struct cam_req_mgr_link_evt_data     evt_data;
	struct cam_req_mgr_tbl_slot          *slot = NULL;

	apply_req.link_hdl = link->link_hdl;
	apply_req.report_if_bubble = 0;

	for (i = 0; i < link->num_devs; i++) {
		dev = &link->l_dev[i];
		if (!dev)
			continue;
		pd = dev->dev_info.p_delay;
		if (pd >= CAM_PIPELINE_DELAY_MAX) {
			CAM_WARN(CAM_CRM, "pd %d greater than max",
				pd);
			continue;
		}

		idx = link->req.apply_data[pd].idx;
		slot = &dev->pd_tbl->slot[idx];
		/*
		 * Just let flash go for this request and other
		 * device get restricted
		 */

		if ((slot->skip_next_frame != true) ||
			(slot->dev_hdl != dev->dev_hdl))
			continue;

		if (!(dev->dev_info.trigger & trigger))
			continue;

		apply_req.dev_hdl = dev->dev_hdl;
		apply_req.request_id =
			link->req.apply_data[pd].req_id;
		apply_req.trigger_point = trigger;
		if (dev->ops && dev->ops->apply_req) {
			rc = dev->ops->apply_req(&apply_req);
			if (rc)
				return rc;
			CAM_DBG(CAM_REQ,
				"SEND: link_hdl: %x pd: %d req_id %lld",
				link->link_hdl, pd, apply_req.request_id);
			slot->skip_next_frame = false;
			slot->is_applied = true;
			return -EAGAIN;
		}
	}

	for (i = 0; i < link->num_devs; i++) {
		dev = &link->l_dev[i];
		if (dev) {
@@ -430,9 +473,16 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link,
			apply_req.request_id =
				link->req.apply_data[pd].req_id;
			idx = link->req.apply_data[pd].idx;
			slot = &dev->pd_tbl->slot[idx];
			apply_req.report_if_bubble =
				in_q->slot[idx].recover;

			if ((slot->dev_hdl == dev->dev_hdl) &&
				(slot->is_applied == true)) {
				slot->is_applied = false;
				continue;
			}

			trace_cam_req_mgr_apply_request(link, &apply_req, dev);

			apply_req.trigger_point = trigger;
@@ -1661,10 +1711,15 @@ int cam_req_mgr_process_add_req(void *priv, void *data)
	}

	slot = &tbl->slot[idx];
	if (add_req->skip_before_applying > slot->inject_delay) {
		slot->inject_delay = add_req->skip_before_applying;
		CAM_DBG(CAM_CRM, "Req_id %llu injecting delay %u",
			add_req->req_id, add_req->skip_before_applying);
	slot->is_applied = false;
	if ((add_req->skip_before_applying & 0xFF) > slot->inject_delay) {
		slot->inject_delay = (add_req->skip_before_applying & 0xFF);
		slot->dev_hdl = add_req->dev_hdl;
		if (add_req->skip_before_applying & SKIP_NEXT_FRAME)
			slot->skip_next_frame = true;
		CAM_DBG(CAM_CRM, "Req_id %llu injecting delay %llu",
			add_req->req_id,
			(add_req->skip_before_applying & 0xFF));
	}

	if (slot->state != CRM_REQ_STATE_PENDING &&
+11 −4
Original line number Diff line number Diff line
@@ -172,12 +172,19 @@ struct cam_req_mgr_apply {
 * @req_ready_map   : mask tracking which all devices have request ready
 * @state           : state machine for life cycle of a slot
 * @inject_delay    : insert extra bubbling for flash type of use cases
 * @dev_hdl         : stores the dev_hdl, who is having higher inject delay
 * @skip_next_frame : flag to drop the frame after skip_before_apply frame
 * @is_applied      : flag to identify if request is already applied to
 *                    device.
 */
struct cam_req_mgr_tbl_slot {
	int32_t             idx;
	uint32_t            req_ready_map;
	enum crm_req_state  state;
	uint32_t            inject_delay;
	int32_t             dev_hdl;
	bool                skip_next_frame;
	bool                is_applied;
};

/**
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ struct cam_req_mgr_apply_request;
struct cam_req_mgr_flush_request;
struct cam_req_mgr_link_evt_data;

#define SKIP_NEXT_FRAME 0x100

/* Request Manager -- camera device driver interface */
/**
 * @brief: camera kernel drivers to cam req mgr communication
+5 −2
Original line number Diff line number Diff line
@@ -1226,7 +1226,7 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
	struct cam_cmd_buf_desc *cmd_desc = NULL;
	struct common_header *cmn_hdr;
	struct cam_config_dev_cmd config;
	struct cam_req_mgr_add_request add_req;
	struct cam_req_mgr_add_request add_req = {0};
	struct cam_flash_init *cam_flash_info = NULL;
	struct cam_flash_set_rer *flash_rer_info = NULL;
	struct cam_flash_set_on_off *flash_operation_info = NULL;
@@ -1403,6 +1403,9 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
			for (i = 0; i < flash_operation_info->count; i++)
				flash_data->led_current_ma[i]
				= flash_operation_info->led_current_ma[i];

			if (flash_data->opcode == CAMERA_SENSOR_FLASH_OP_OFF)
				add_req.skip_before_applying |= SKIP_NEXT_FRAME;
		}
		break;
		default:
@@ -1541,7 +1544,7 @@ int cam_flash_pmic_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)

		if ((csl_packet->header.op_code & 0xFFFFF) ==
			CAM_FLASH_PACKET_OPCODE_SET_OPS)
			add_req.skip_before_applying = 1;
			add_req.skip_before_applying |= 1;
		else
			add_req.skip_before_applying = 0;