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

Commit b81e5191 authored by Alok Pandey's avatar Alok Pandey
Browse files

msm: camera: isp: Switching between rdi and pix rup for fs2 state machine



Preview state machine should transitions states from APPLIED to EPOCH
on PIX RUP. It is wrongly doing on RDI RUP. For preview request PIX RUP
is used to confirm for successful apply done. In snapshot request, RDI RUP
is used for successful apply.
This change selects between RDI RUP and PIX RUP  based on request packet.

Change-Id: Iab4f84061e78e3327c2e22154a146ef86280b896
Signed-off-by: default avatarAlok Pandey <akumarpa@codeaurora.org>
parent dc547447
Loading
Loading
Loading
Loading
+54 −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
@@ -3496,6 +3496,53 @@ static int cam_isp_blob_clock_update(
	return rc;
}

void fill_res_bitmap(uint32_t resource_type, unsigned long *res_bitmap)
{

	switch (resource_type) {
	case CAM_ISP_IFE_OUT_RES_FULL:
	case CAM_ISP_IFE_OUT_RES_DS4:
	case CAM_ISP_IFE_OUT_RES_DS16:
	case CAM_ISP_IFE_OUT_RES_RAW_DUMP:
	case CAM_ISP_IFE_OUT_RES_FD:
	case CAM_ISP_IFE_OUT_RES_PDAF:
	case CAM_ISP_IFE_OUT_RES_STATS_HDR_BE:
	case CAM_ISP_IFE_OUT_RES_STATS_HDR_BHIST:
	case CAM_ISP_IFE_OUT_RES_STATS_TL_BG:
	case CAM_ISP_IFE_OUT_RES_STATS_BF:
	case CAM_ISP_IFE_OUT_RES_STATS_AWB_BG:
	case CAM_ISP_IFE_OUT_RES_STATS_BHIST:
	case CAM_ISP_IFE_OUT_RES_STATS_RS:
	case CAM_ISP_IFE_OUT_RES_STATS_CS:
	case CAM_ISP_IFE_OUT_RES_STATS_IHIST:
	case CAM_ISP_IFE_OUT_RES_FULL_DISP:
	case CAM_ISP_IFE_OUT_RES_DS4_DISP:
	case CAM_ISP_IFE_OUT_RES_DS16_DISP:
	case CAM_ISP_IFE_IN_RES_RD:
		set_bit(CAM_IFE_REG_UPD_CMD_PIX_BIT, res_bitmap);
		break;
	case CAM_ISP_IFE_OUT_RES_RDI_0:
		set_bit(CAM_IFE_REG_UPD_CMD_RDI0_BIT, res_bitmap);
		break;
	case CAM_ISP_IFE_OUT_RES_RDI_1:
		set_bit(CAM_IFE_REG_UPD_CMD_RDI1_BIT, res_bitmap);
		break;
	case CAM_ISP_IFE_OUT_RES_RDI_2:
		set_bit(CAM_IFE_REG_UPD_CMD_RDI2_BIT, res_bitmap);
		break;
	case CAM_ISP_IFE_OUT_RES_RDI_3:
		set_bit(CAM_IFE_REG_UPD_CMD_RDI3_BIT, res_bitmap);
		break;
	case CAM_ISP_IFE_OUT_RES_2PD:
		set_bit(CAM_IFE_REG_UPD_CMD_DUAL_PD_BIT,
			res_bitmap);
		break;
	default:
		CAM_ERR(CAM_ISP, "Invalid resource");
		break;
	}
}

static int cam_isp_packet_generic_blob_handler(void *user_data,
	uint32_t blob_type, uint32_t blob_size, uint8_t *blob_data)
{
@@ -3693,7 +3740,9 @@ static int cam_ife_mgr_prepare_hw_update(void *hw_mgr_priv,
			prepare, ctx->base[i].idx,
			&kmd_buf, ctx->res_list_ife_out,
			&ctx->res_list_ife_in_rd,
			CAM_IFE_HW_OUT_RES_MAX, fill_fence);
			CAM_IFE_HW_OUT_RES_MAX, fill_fence,
			&ctx->res_bitmap,
			fill_res_bitmap);

		if (rc) {
			CAM_ERR(CAM_ISP,
@@ -3734,7 +3783,8 @@ static int cam_ife_mgr_prepare_hw_update(void *hw_mgr_priv,

		/*Add reg update */
		rc = cam_isp_add_reg_update(prepare, &ctx->res_list_ife_src,
			ctx->base[i].idx, &kmd_buf);
				ctx->base[i].idx, &kmd_buf, ctx->is_fe_enable,
				ctx->res_bitmap);
		if (rc) {
			CAM_ERR(CAM_ISP,
				"Add Reg_update cmd Failed i=%d, idx=%d, rc=%d",
@@ -3742,6 +3792,7 @@ static int cam_ife_mgr_prepare_hw_update(void *hw_mgr_priv,
			goto end;
		}
	}
	ctx->res_bitmap = 0;

end:
	return rc;
+3 −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
@@ -131,6 +131,7 @@ struct cam_ife_hw_mgr_debug {
 * @config_done_complete    indicator for configuration complete
 * @init_done               indicate whether init hw is done
 * @is_fe_enable            indicate whether fetch engine\read path is enabled
 * @res_bitmap              fill resource bitmap for which rup to be set
 */
struct cam_ife_hw_mgr_ctx {
	struct list_head                list;
@@ -167,6 +168,7 @@ struct cam_ife_hw_mgr_ctx {
	struct completion               config_done_complete;
	bool                            init_done;
	bool                            is_fe_enable;
	unsigned long                   res_bitmap;
};

/**
+13 −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
@@ -451,7 +451,9 @@ int cam_isp_add_io_buffers(
	struct cam_ife_hw_mgr_res            *res_list_isp_out,
	struct list_head                     *res_list_ife_in_rd,
	uint32_t                              size_isp_out,
	bool                                  fill_fence)
	bool                                  fill_fence,
	unsigned long                         *res_bitmap,
	cam_fill_res_bitmap                   fill_res_bitmap)
{
	int rc = 0;
	uint64_t                            io_addr[CAM_PACKET_MAX_PLANES];
@@ -796,6 +798,8 @@ int cam_isp_add_io_buffers(
			}
			io_cfg_used_bytes += update_buf.cmd.used_bytes;
		}

		fill_res_bitmap(io_cfg[i].resource_type, res_bitmap);
	}

	CAM_DBG(CAM_ISP, "io_cfg_used_bytes %d, fill_fence %d",
@@ -834,13 +838,16 @@ int cam_isp_add_reg_update(
	struct cam_hw_prepare_update_args    *prepare,
	struct list_head                     *res_list_isp_src,
	uint32_t                              base_idx,
	struct cam_kmd_buf_info              *kmd_buf_info)
	struct cam_kmd_buf_info              *kmd_buf_info,
	bool                                  is_fe_en,
	unsigned long                         res_bitmap)
{
	int rc = -EINVAL;
	struct cam_isp_resource_node         *res;
	struct cam_ife_hw_mgr_res            *hw_mgr_res;
	struct cam_hw_update_entry           *hw_entry;
	struct cam_isp_hw_get_cmd_update      get_regup;
	struct cam_isp_hw_rup_data            rup_data;
	uint32_t kmd_buf_remain_size, num_ent, i, reg_update_size;

	hw_entry = prepare->hw_update_entries;
@@ -886,6 +893,9 @@ int cam_isp_add_reg_update(
			get_regup.cmd.size = kmd_buf_remain_size;
			get_regup.cmd_type = CAM_ISP_HW_CMD_GET_REG_UPDATE;
			get_regup.res = res;
			rup_data.is_fe_enable = is_fe_en;
			rup_data.res_bitmap = res_bitmap;
			get_regup.rup_data = &rup_data;

			rc = res->hw_intf->hw_ops.process_cmd(
				res->hw_intf->hw_priv,
+12 −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
@@ -126,6 +126,8 @@ int cam_isp_add_command_buffers(
 * @res_list_ife_in_rd:    IFE /VFE in rd resource list
 * @size_isp_out:          Size of the res_list_isp_out array
 * @fill_fence:            If true, Fence map table will be filled
 * @res_bitmap             resource bitmap to be set for rup
 * @fill_res_bitmap        callback function to set resource bitmap
 *
 * @return:                0 for success
 *                         -EINVAL for Fail
@@ -139,7 +141,9 @@ int cam_isp_add_io_buffers(
	struct cam_ife_hw_mgr_res            *res_list_isp_out,
	struct list_head                     *res_list_ife_in_rd,
	uint32_t                              size_isp_out,
	bool                                  fill_fence);
	bool                                  fill_fence,
	unsigned long                        *res_bitmap,
	cam_fill_res_bitmap                   fill_res_bitmap);

/*
 * cam_isp_add_reg_update()
@@ -152,6 +156,9 @@ int cam_isp_add_io_buffers(
 * @res_list_isp_src:      Resource list for IFE/VFE source
 * @base_idx:              Base or dev index of the IFE/VFE HW instance
 * @kmd_buf_info:          Kmd buffer to store the change base command
 * @is_fe_enable           If fetch engine enable
 * @res_bitmap             resource bitmap to be set for rup
 *
 * @return:                0 for success
 *                         -EINVAL for Fail
 */
@@ -159,6 +166,8 @@ int cam_isp_add_reg_update(
	struct cam_hw_prepare_update_args    *prepare,
	struct list_head                     *res_list_isp_src,
	uint32_t                              base_idx,
	struct cam_kmd_buf_info              *kmd_buf_info);
	struct cam_kmd_buf_info              *kmd_buf_info,
	bool                                  is_fe_enable,
	unsigned long                         res_bitmap);

#endif /*_CAM_ISP_HW_PARSER_H */
+11 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-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
@@ -19,6 +19,16 @@
#include <uapi/media/cam_isp.h>
#include "cam_hw_mgr_intf.h"

/*
 * bit position in resource bitmap
 */
#define CAM_IFE_REG_UPD_CMD_PIX_BIT     0
#define CAM_IFE_REG_UPD_CMD_RDI0_BIT    1
#define CAM_IFE_REG_UPD_CMD_RDI1_BIT    2
#define CAM_IFE_REG_UPD_CMD_RDI2_BIT    3
#define CAM_IFE_REG_UPD_CMD_RDI3_BIT    4
#define CAM_IFE_REG_UPD_CMD_DUAL_PD_BIT 5

/* MAX IFE instance */
#define CAM_IFE_HW_NUM_MAX   4
#define CAM_IFE_RDI_NUM_MAX  4
Loading