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

Commit 1f20ca74 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: Add new spectra camera changes"

parents 1ecfc497 f2269d0a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ int32_t cam_context_release_dev_to_hw(struct cam_context *ctx,
	ctx->session_hdl = -1;
	ctx->dev_hdl = -1;
	ctx->link_hdl = -1;
	ctx->last_flush_req = 0;

	return 0;
}
+114 −14
Original line number Diff line number Diff line
@@ -3551,8 +3551,8 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
	struct cam_hw_prepare_update_args *prepare = NULL;

	if (!blob_data || (blob_size == 0) || !blob_info) {
		CAM_ERR(CAM_ISP, "Invalid info blob %pK %d prepare %pK",
			blob_data, blob_size, prepare);
		CAM_ERR(CAM_ISP, "Invalid args data %pK size %d info %pK",
			blob_data, blob_size, blob_info);
		return -EINVAL;
	}

@@ -3572,8 +3572,29 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
	CAM_DBG(CAM_ISP, "FS2: BLOB Type: %d", blob_type);
	switch (blob_type) {
	case CAM_ISP_GENERIC_BLOB_TYPE_HFR_CONFIG: {
		struct cam_isp_resource_hfr_config    *hfr_config =
			(struct cam_isp_resource_hfr_config *)blob_data;
		struct cam_isp_resource_hfr_config    *hfr_config;

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

		hfr_config = (struct cam_isp_resource_hfr_config *)blob_data;

		if (hfr_config->num_ports > CAM_ISP_IFE_OUT_RES_MAX) {
			CAM_ERR(CAM_ISP, "Invalid num_ports %u in hfr config",
				hfr_config->num_ports);
			return -EINVAL;
		}

		if (blob_size < (sizeof(uint32_t) * 2 + hfr_config->num_ports *
			sizeof(struct cam_isp_port_hfr_config))) {
			CAM_ERR(CAM_ISP, "Invalid blob size %u expected %lu",
				blob_size, sizeof(uint32_t) * 2 +
				sizeof(struct cam_isp_port_hfr_config) *
				hfr_config->num_ports);
			return -EINVAL;
		}

		rc = cam_isp_blob_hfr_update(blob_type, blob_info,
			hfr_config, prepare);
@@ -3582,8 +3603,29 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
	}
		break;
	case CAM_ISP_GENERIC_BLOB_TYPE_CLOCK_CONFIG: {
		struct cam_isp_clock_config    *clock_config =
			(struct cam_isp_clock_config *)blob_data;
		struct cam_isp_clock_config    *clock_config;

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

		clock_config = (struct cam_isp_clock_config *)blob_data;

		if (clock_config->num_rdi > CAM_IFE_RDI_NUM_MAX) {
			CAM_ERR(CAM_ISP, "Invalid num_rdi %u in clock config",
				clock_config->num_rdi);
			return -EINVAL;
		}

		if (blob_size < (sizeof(uint32_t) * 2 + sizeof(uint64_t) *
			(clock_config->num_rdi + 2))) {
			CAM_ERR(CAM_ISP, "Invalid blob size %u expected %lu",
				blob_size,
				sizeof(uint32_t) * 2 + sizeof(uint64_t) *
				(clock_config->num_rdi + 2));
			return -EINVAL;
		}

		rc = cam_isp_blob_clock_update(blob_type, blob_info,
			clock_config, prepare);
@@ -3592,10 +3634,31 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
	}
		break;
	case CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG: {
		struct cam_isp_bw_config    *bw_config =
			(struct cam_isp_bw_config *)blob_data;
		struct cam_isp_bw_config    *bw_config;
		struct cam_isp_prepare_hw_update_data   *prepare_hw_data;

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

		bw_config = (struct cam_isp_bw_config *)blob_data;

		if (bw_config->num_rdi > CAM_IFE_RDI_NUM_MAX) {
			CAM_ERR(CAM_ISP, "Invalid num_rdi %u in bw config",
				bw_config->num_rdi);
			return -EINVAL;
		}

		if (blob_size < (sizeof(uint32_t) * 2 + (bw_config->num_rdi + 2)
			* sizeof(struct cam_isp_bw_vote))) {
			CAM_ERR(CAM_ISP, "Invalid blob size %u expected %lu",
				blob_size,
				sizeof(uint32_t) * 2 + (bw_config->num_rdi + 2)
				* sizeof(struct cam_isp_bw_vote));
			return -EINVAL;
		}

		if (!prepare || !prepare->priv ||
			(bw_config->usage_type >= CAM_IFE_HW_NUM_MAX)) {
			CAM_ERR(CAM_ISP, "Invalid inputs");
@@ -3613,8 +3676,29 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
	}
		break;
	case CAM_ISP_GENERIC_BLOB_TYPE_UBWC_CONFIG: {
		struct cam_ubwc_config *ubwc_config =
			(struct cam_ubwc_config *)blob_data;
		struct cam_ubwc_config *ubwc_config;

		if (blob_size < sizeof(struct cam_ubwc_config)) {
			CAM_ERR(CAM_ISP, "Invalid blob_size %u", blob_size);
			return -EINVAL;
		}

		ubwc_config = (struct cam_ubwc_config *)blob_data;

		if (ubwc_config->num_ports > CAM_ISP_IFE_OUT_RES_MAX) {
			CAM_ERR(CAM_ISP, "Invalid num_ports %u in ubwc config",
				ubwc_config->num_ports);
			return -EINVAL;
		}

		if (blob_size < (sizeof(uint32_t) * 2 + ubwc_config->num_ports *
			sizeof(struct cam_ubwc_plane_cfg_v1) * 2)) {
			CAM_ERR(CAM_ISP, "Invalid blob_size %u expected %lu",
				blob_size,
				sizeof(uint32_t) * 2 + ubwc_config->num_ports *
				sizeof(struct cam_ubwc_plane_cfg_v1) * 2);
			return -EINVAL;
		}

		rc = cam_isp_blob_ubwc_update(blob_type, blob_info,
			ubwc_config, prepare);
@@ -3623,8 +3707,16 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
	}
		break;
	case CAM_ISP_GENERIC_BLOB_TYPE_CSID_CLOCK_CONFIG: {
		struct cam_isp_csid_clock_config    *clock_config =
			(struct cam_isp_csid_clock_config *)blob_data;
		struct cam_isp_csid_clock_config    *clock_config;

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

		clock_config = (struct cam_isp_csid_clock_config *)blob_data;

		rc = cam_isp_blob_csid_clock_update(blob_type, blob_info,
			clock_config, prepare);
@@ -3633,8 +3725,16 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
	}
		break;
	case CAM_ISP_GENERIC_BLOB_TYPE_FE_CONFIG: {
		struct cam_fe_config *fe_config =
			(struct cam_fe_config *)blob_data;
		struct cam_fe_config *fe_config;

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

		fe_config = (struct cam_fe_config *)blob_data;

		rc = cam_isp_blob_fe_update(blob_type, blob_info,
			fe_config, prepare);
		if (rc)
+1 −1
Original line number Diff line number Diff line
@@ -1059,7 +1059,7 @@ static int cam_ife_csid_enable_hw(struct cam_ife_csid_hw *csid_hw)
	CAM_DBG(CAM_ISP, "CSID:%d init CSID HW",
		csid_hw->hw_intf->hw_idx);

	clk_lvl = cam_ife_csid_get_vote_level(soc_info, csid_hw->clk_rate);
	clk_lvl = cam_soc_util_get_vote_level(soc_info, csid_hw->clk_rate);
	CAM_DBG(CAM_ISP, "CSID clock lvl %u", clk_lvl);

	rc = cam_ife_csid_enable_soc_resources(soc_info, clk_lvl);
+3 −24
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
@@ -117,7 +117,7 @@ int cam_ife_csid_deinit_soc_resources(
}

int cam_ife_csid_enable_soc_resources(
	struct cam_hw_soc_info *soc_info, uint32_t clk_lvl)
	struct cam_hw_soc_info *soc_info, enum cam_vote_level clk_level)
{
	int rc = 0;
	struct cam_csid_soc_private       *soc_private;
@@ -142,7 +142,7 @@ int cam_ife_csid_enable_soc_resources(
	}

	rc = cam_soc_util_enable_platform_resource(soc_info, true,
		clk_lvl, true);
		clk_level, true);
	if (rc) {
		CAM_ERR(CAM_ISP, "enable platform failed");
		goto stop_cpas;
@@ -235,24 +235,3 @@ int cam_ife_csid_disable_ife_force_clock_on(struct cam_hw_soc_info *soc_info,

	return rc;
}

uint32_t cam_ife_csid_get_vote_level(struct cam_hw_soc_info *soc_info,
	uint64_t clock_rate)
{
	int i = 0;

	if (!clock_rate)
		return CAM_SVS_VOTE;

	for (i = 0; i < CAM_MAX_VOTE; i++) {
		if (soc_info->clk_rate[i][soc_info->num_clk - 1] >=
			clock_rate) {
			CAM_DBG(CAM_ISP,
				"Clock rate %lld, selected clock level %d",
				clock_rate, i);
			return i;
		}
	}

	return CAM_TURBO_VOTE;
}
+22 −0
Original line number Diff line number Diff line
@@ -1770,3 +1770,25 @@ int cam_soc_util_reg_dump(struct cam_hw_soc_info *soc_info,

	return 0;
}

uint32_t cam_soc_util_get_vote_level(struct cam_hw_soc_info *soc_info,
	uint64_t clock_rate)
{
	int i = 0;

	if (!clock_rate)
		return CAM_SVS_VOTE;

	for (i = 0; i < CAM_MAX_VOTE; i++) {
		if (soc_info->clk_level_valid[i] &&
			soc_info->clk_rate[i][soc_info->src_clk_idx] >=
			clock_rate) {
			CAM_DBG(CAM_UTIL,
				"Clock rate %lld, selected clock level %d",
				clock_rate, i);
			return i;
		}
	}

	return CAM_TURBO_VOTE;
}
Loading