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

Commit 78e8a1d8 authored by Sridhar Gujje's avatar Sridhar Gujje
Browse files

Merge commit 'f0ce15af' into msm-4.9-PC112



* commit 'f0ce15af':
  msm: camera: icp: Add packet validation
  msm: camera: isp: Check open count and VFE_HW state
  msm: camera: Update sleep time range for csiphy device
  msm:camera: Add support for sequential write and erase

Change-Id: I6bf2d8a487b9dc3b2c27592dd1efca692c651222
Signed-off-by: default avatarAbhijit Trivedi <abhijitt@codeaurora.org>
Signed-off-by: default avatarSridhar Gujje <sgujje@codeaurora.org>
parents e3d045af f0ce15af
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -2834,8 +2834,23 @@ static int cam_icp_mgr_pkt_validation(struct cam_packet *packet)
			packet->header.op_code & 0xff);
		return -EINVAL;
	}
	CAM_DBG(CAM_ICP, "number of cmd/patch info: %u %u",
			packet->num_cmd_buf, packet->num_patches);

	if (packet->num_io_configs > IPE_IO_IMAGES_MAX) {
		CAM_ERR(CAM_ICP, "Invalid number of io configs: %d %d",
			IPE_IO_IMAGES_MAX, packet->num_io_configs);
		return -EINVAL;
	}

	if (packet->num_cmd_buf > CAM_ICP_CTX_MAX_CMD_BUFFERS) {
		CAM_ERR(CAM_ICP, "Invalid number of cmd buffers: %d %d",
			CAM_ICP_CTX_MAX_CMD_BUFFERS, packet->num_cmd_buf);
		return -EINVAL;
	}

	CAM_DBG(CAM_ICP, "number of cmd/patch info: %u %u %u %u",
			packet->num_cmd_buf,
			packet->num_io_configs, IPE_IO_IMAGES_MAX,
			packet->num_patches);
	return 0;
}

+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@
#define CAM_ICP_CTX_STATE_ACQUIRED  0x2
#define CAM_ICP_CTX_STATE_RELEASE   0x3

#define CAM_ICP_CTX_MAX_CMD_BUFFERS 0x2

/**
 * struct icp_hfi_mem_info
 * @qtbl: Memory info of queue table
+11 −4
Original line number Diff line number Diff line
@@ -1037,16 +1037,23 @@ static int cam_ife_csid_enable_hw(struct cam_ife_csid_hw *csid_hw)

static int cam_ife_csid_disable_hw(struct cam_ife_csid_hw *csid_hw)
{
	int rc = 0;
	int rc = -EINVAL;
	struct cam_hw_soc_info             *soc_info;
	struct cam_ife_csid_reg_offset     *csid_reg;

	/* Check for refcount */
	if (!csid_hw->hw_info->open_count) {
		CAM_WARN(CAM_ISP, "Unbalanced disable_hw");
		return rc;
	}

	/*  Decrement ref Count */
	if (csid_hw->hw_info->open_count)
	csid_hw->hw_info->open_count--;
	if (csid_hw->hw_info->open_count)

	if (csid_hw->hw_info->open_count) {
		rc = 0;
		return rc;
	}

	soc_info = &csid_hw->hw_info->soc_info;
	csid_reg = csid_hw->csid_info->csid_reg;
+48 −26
Original line number Diff line number Diff line
@@ -273,7 +273,8 @@ static int cam_vfe_top_clock_update(
	}

	if (hw_info->hw_state != CAM_HW_STATE_POWER_UP) {
		CAM_DBG(CAM_ISP, "VFE:%d Not ready to set clocks yet :%d",
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"VFE:%d Not ready to set clocks yet :%d",
			res->hw_intf->hw_idx,
			hw_info->hw_state);
	} else
@@ -321,7 +322,8 @@ static int cam_vfe_top_bw_update(
	}

	if (hw_info->hw_state != CAM_HW_STATE_POWER_UP) {
		CAM_DBG(CAM_ISP, "VFE:%d Not ready to set BW yet :%d",
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"VFE:%d Not ready to set BW yet :%d",
			res->hw_intf->hw_idx,
			hw_info->hw_state);
	} else
@@ -364,7 +366,8 @@ static int cam_vfe_top_bw_control(
	}

	if (hw_info->hw_state != CAM_HW_STATE_POWER_UP) {
		CAM_DBG(CAM_ISP, "VFE:%d Not ready to set BW yet :%d",
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"VFE:%d Not ready to set BW yet :%d",
			res->hw_intf->hw_idx,
			hw_info->hw_state);
	} else {
@@ -517,6 +520,7 @@ int cam_vfe_top_start(void *device_priv,
{
	struct cam_vfe_top_ver2_priv            *top_priv;
	struct cam_isp_resource_node            *mux_res;
	struct cam_hw_info                      *hw_info = NULL;
	int rc = 0;

	if (!device_priv || !start_args) {
@@ -526,25 +530,34 @@ int cam_vfe_top_start(void *device_priv,

	top_priv = (struct cam_vfe_top_ver2_priv *)device_priv;
	mux_res = (struct cam_isp_resource_node *)start_args;
	hw_info = (struct cam_hw_info  *)mux_res->hw_intf->hw_priv;

	if (hw_info->hw_state == CAM_HW_STATE_POWER_UP) {
		rc = cam_vfe_top_set_hw_clk_rate(top_priv);
		if (rc) {
		CAM_ERR(CAM_ISP, "set_hw_clk_rate failed, rc=%d", rc);
			CAM_ERR(CAM_ISP,
				"set_hw_clk_rate failed, rc=%d", rc);
			return rc;
		}

		rc = cam_vfe_top_set_axi_bw_vote(top_priv, true);
		if (rc) {
		CAM_ERR(CAM_ISP, "set_axi_bw_vote failed, rc=%d", rc);
			CAM_ERR(CAM_ISP,
				"set_axi_bw_vote failed, rc=%d", rc);
			return rc;
		}

		if (mux_res->start) {
			rc = mux_res->start(mux_res);
		} else {
		CAM_ERR(CAM_ISP, "Invalid res id:%d", mux_res->res_id);
			CAM_ERR(CAM_ISP,
				"Invalid res id:%d", mux_res->res_id);
			rc = -EINVAL;
		}
	} else {
		CAM_ERR(CAM_ISP, "VFE HW not powered up");
		rc = -EPERM;
	}

	return rc;
}
@@ -554,6 +567,7 @@ int cam_vfe_top_stop(void *device_priv,
{
	struct cam_vfe_top_ver2_priv            *top_priv;
	struct cam_isp_resource_node            *mux_res;
	struct cam_hw_info                      *hw_info = NULL;
	int i, rc = 0;

	if (!device_priv || !stop_args) {
@@ -563,6 +577,7 @@ int cam_vfe_top_stop(void *device_priv,

	top_priv = (struct cam_vfe_top_ver2_priv   *)device_priv;
	mux_res = (struct cam_isp_resource_node *)stop_args;
	hw_info = (struct cam_hw_info  *)mux_res->hw_intf->hw_priv;

	if (mux_res->res_id == CAM_ISP_HW_VFE_IN_CAMIF ||
		(mux_res->res_id >= CAM_ISP_HW_VFE_IN_RDI0 &&
@@ -585,17 +600,24 @@ int cam_vfe_top_stop(void *device_priv,
			}
		}

		if (hw_info->hw_state == CAM_HW_STATE_POWER_UP) {
			rc = cam_vfe_top_set_hw_clk_rate(top_priv);
			if (rc) {
			CAM_ERR(CAM_ISP, "set_hw_clk_rate failed, rc=%d", rc);
				CAM_ERR(CAM_ISP,
					"set_hw_clk_rate failed, rc=%d", rc);
				return rc;
			}

			rc = cam_vfe_top_set_axi_bw_vote(top_priv, true);
			if (rc) {
			CAM_ERR(CAM_ISP, "set_axi_bw_vote failed, rc=%d", rc);
				CAM_ERR(CAM_ISP,
					"set_axi_bw_vote failed, rc=%d", rc);
				return rc;
			}
		} else {
			CAM_ERR(CAM_ISP, "VFE HW not powered up");
			rc = -EPERM;
		}
	}

	return rc;
+18 −3
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, 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
@@ -71,9 +71,9 @@ void cam_csiphy_reset(struct csiphy_device *csiphy_dev)
			csiphy_reset_reg[i].reg_addr);

		usleep_range(csiphy_dev->ctrl_reg->
			csiphy_reset_reg[i].delay * 100,
			csiphy_reset_reg[i].delay * 1000,
			csiphy_dev->ctrl_reg->
			csiphy_reset_reg[i].delay * 100 + 1000);
			csiphy_reset_reg[i].delay * 1000 + 10);
	}
}

@@ -285,6 +285,10 @@ int32_t cam_csiphy_config_dev(struct csiphy_device *csiphy_dev)
					csiphybase +
					csiphy_dev->ctrl_reg->
					csiphy_common_reg[i].reg_addr);
				usleep_range(csiphy_dev->ctrl_reg->
					csiphy_common_reg[i].delay*1000,
					csiphy_dev->ctrl_reg->
					csiphy_common_reg[i].delay*1000 + 10);
			break;
			case CSIPHY_DEFAULT_PARAMS:
				cam_io_w_mb(csiphy_dev->ctrl_reg->
@@ -292,6 +296,10 @@ int32_t cam_csiphy_config_dev(struct csiphy_device *csiphy_dev)
					csiphybase +
					csiphy_dev->ctrl_reg->
					csiphy_common_reg[i].reg_addr);
				usleep_range(csiphy_dev->ctrl_reg->
					csiphy_common_reg[i].delay*1000,
					csiphy_dev->ctrl_reg->
					csiphy_common_reg[i].delay*1000 + 10);
			break;
			default:
			break;
@@ -506,6 +514,13 @@ int32_t cam_csiphy_core_cfg(void *phy_dev,
		bridge_params.media_entity_flag = 0;
		bridge_params.priv = csiphy_dev;

		if (csiphy_acq_params.combo_mode >= 2) {
			CAM_ERR(CAM_CSIPHY, "Invalid combo_mode %d",
				csiphy_acq_params.combo_mode);
			rc = -EINVAL;
			goto release_mutex;
		}

		csiphy_acq_dev.device_handle =
			cam_create_device_hdl(&bridge_params);
		csiphy_dev->bridge_intf.
Loading