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

Commit 26543c96 authored by Ayush Kumar's avatar Ayush Kumar Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: isp: Enable format measurement in CSID



Enabling format measure helps to find mismatch between
the expected sensor width and height with actual sensor width
and height. In case of metadata, width is more than 16 bit, hence
skip format measure check for it.
In case of mismatch CSID will give CSID_PATH_ERROR_PIX_COUNT
and CSID_PATH_ERROR_LINE_COUNT.

CRs-Fixed: 2634468
Change-Id: Ic57a18ee5217982d36116060371bdc99405ea759
Signed-off-by: default avatarAyush Kumar <ayushkr@codeaurora.org>
parent 3ab71328
Loading
Loading
Loading
Loading
+91 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@
	(CAM_ISP_PACKET_META_GENERIC_BLOB_COMMON + 1)

#define CAM_ISP_GENERIC_BLOB_TYPE_MAX               \
	(CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG_V2 + 1)
	(CAM_ISP_GENERIC_BLOB_TYPE_CSID_QCFA_CONFIG + 1)

static uint32_t blob_type_hw_cmd_map[CAM_ISP_GENERIC_BLOB_TYPE_MAX] = {
	CAM_ISP_HW_CMD_GET_HFR_UPDATE,
@@ -5119,6 +5119,76 @@ static int cam_isp_blob_clock_update(
	return rc;
}

static int cam_isp_blob_sensor_config(
	uint32_t                               blob_type,
	struct cam_isp_generic_blob_info      *blob_info,
	struct cam_isp_sensor_config          *dim_config,
	struct cam_hw_prepare_update_args     *prepare)
{
	struct cam_ife_hw_mgr_ctx                   *ctx = NULL;
	struct cam_ife_hw_mgr_res                   *hw_mgr_res;
	struct cam_hw_intf                          *hw_intf;
	struct cam_ife_sensor_dimension_update_args  update_args;
	int                                          rc = -EINVAL, found = 0;
	uint32_t                                     i, j;
	struct cam_isp_sensor_dimension             *path_config;

	ctx = prepare->ctxt_to_hw_map;

	list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_csid, list) {
		for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
			if (!hw_mgr_res->hw_res[i])
				continue;
			found = 1;
			hw_intf = hw_mgr_res->hw_res[i]->hw_intf;
			if (hw_intf && hw_intf->hw_ops.process_cmd) {
				path_config = &(dim_config->ipp_path);
				update_args.ipp_path.width =
					path_config->width;
				update_args.ipp_path.height =
					path_config->height;
				update_args.ipp_path.measure_enabled =
					path_config->measure_enabled;
				path_config = &(dim_config->ppp_path);
				update_args.ppp_path.width =
					path_config->width;
				update_args.ppp_path.height =
					path_config->height;
				update_args.ppp_path.measure_enabled =
					path_config->measure_enabled;
				for (j = 0; j < CAM_IFE_RDI_NUM_MAX; j++) {
					path_config =
						&(dim_config->rdi_path[j]);
					update_args.rdi_path[j].width =
						path_config->width;
					update_args.rdi_path[j].height =
						path_config->height;
				update_args.rdi_path[j].measure_enabled =
						path_config->measure_enabled;
				}
				rc = hw_intf->hw_ops.process_cmd(
					hw_intf->hw_priv,
					CAM_IFE_CSID_SET_SENSOR_DIMENSION_CFG,
					&update_args,
					sizeof(
					struct
					cam_ife_sensor_dimension_update_args)
					);
				if (rc) {
					CAM_ERR(CAM_ISP,
						"Dimension Update failed");
					break;
				}
			} else
				CAM_ERR(CAM_ISP, "hw_intf is NULL");
		}
		if (found)
			break;
	}

	return rc;
}

static int cam_isp_blob_vfe_out_update(
	uint32_t                               blob_type,
	struct cam_isp_generic_blob_info      *blob_info,
@@ -5739,6 +5809,26 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
			CAM_ERR(CAM_ISP, "CSID Config failed rc: %d", rc);
	}
		break;
	case CAM_ISP_GENERIC_BLOB_TYPE_SENSOR_DIMENSION_CONFIG: {
		struct cam_isp_sensor_config *csid_dim_config;

		if (blob_size < sizeof(struct cam_isp_sensor_config)) {
			CAM_ERR(CAM_ISP, "Invalid blob size %zu expected %zu",
				blob_size,
				sizeof(struct cam_isp_sensor_config));
			return -EINVAL;
		}

		csid_dim_config =
			(struct cam_isp_sensor_config *)blob_data;

		rc = cam_isp_blob_sensor_config(blob_type, blob_info,
			csid_dim_config, prepare);
		if (rc)
			CAM_ERR(CAM_ISP,
				"Sensor Dimension Update Failed rc: %d", rc);
	}
		break;
	default:
		CAM_WARN(CAM_ISP, "Invalid blob type %d", blob_type);
		break;
+5 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */

#ifndef _CAM_IFE_CSID_170_H_
@@ -286,6 +286,10 @@ static struct cam_ife_csid_common_reg_offset
	.ppp_irq_mask_all                             = 0x0,
	.measure_en_hbi_vbi_cnt_mask                  = 0xC,
	.format_measure_en_val                        = 1,
	.format_measure_height_mask_val               = 0xFFFF,
	.format_measure_height_shift_val              = 0x10,
	.format_measure_width_mask_val                = 0xFFFF,
	.format_measure_width_shift_val               = 0x0,
};

static struct cam_ife_csid_reg_offset cam_ife_csid_170_reg_offset = {
+4 −0
Original line number Diff line number Diff line
@@ -349,6 +349,10 @@ static struct cam_ife_csid_common_reg_offset
	.ppp_irq_mask_all                             = 0xFFFF,
	.measure_en_hbi_vbi_cnt_mask                  = 0xC,
	.format_measure_en_val                        = 1,
	.format_measure_height_mask_val               = 0xFFFF,
	.format_measure_height_shift_val              = 0x10,
	.format_measure_width_mask_val                = 0xFFFF,
	.format_measure_width_shift_val               = 0x0,
};

static struct cam_ife_csid_reg_offset cam_ife_csid_170_200_reg_offset = {
+5 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
 */

#ifndef _CAM_IFE_CSID_175_H_
@@ -327,6 +327,10 @@ static struct cam_ife_csid_common_reg_offset
	.ppp_irq_mask_all                             = 0xFFFF,
	.measure_en_hbi_vbi_cnt_mask                  = 0xC,
	.format_measure_en_val                        = 1,
	.format_measure_height_mask_val               = 0xFFFF,
	.format_measure_height_shift_val              = 0x10,
	.format_measure_width_mask_val                = 0xFFFF,
	.format_measure_width_shift_val               = 0x0,
};

static struct cam_ife_csid_reg_offset cam_ife_csid_175_reg_offset = {
+5 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
 */

#ifndef _CAM_IFE_CSID_175_200_H_
@@ -345,6 +345,10 @@ static struct cam_ife_csid_common_reg_offset
	.ppp_irq_mask_all                             = 0xFFFF,
	.measure_en_hbi_vbi_cnt_mask                  = 0xC,
	.format_measure_en_val                        = 1,
	.format_measure_height_mask_val               = 0xFFFF,
	.format_measure_height_shift_val              = 0x10,
	.format_measure_width_mask_val                = 0xFFFF,
	.format_measure_width_shift_val               = 0x0,
};

static struct cam_ife_csid_reg_offset cam_ife_csid_175_200_reg_offset = {
Loading