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

Commit 81808188 authored by Abhishek Kondaveeti's avatar Abhishek Kondaveeti Committed by Gerrit - the friendly Code Review server
Browse files

msm: isp: Add support for VFE resolution limit



Read VFE resolution limitation from VFE fuse register
and restrict sensor output accordingly.

Change-Id: I735016e8fa2f2cb54754301f1c0c66757d8579c5
Signed-off-by: default avatarAbhishek Kondaveeti <akondave@codeaurora.org>
parent a1c3a94c
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ Required properties for child node:
    Only needed for child node.
    - "vfe" - Required.
    - "vfe_vbif" - Optional for "vfe32". Required for "vfe40".
    - "vfe_fuse" - Optional.
- interrupts : should contain the vfe interrupt.
- interrupt-names : should specify relevant names to each interrupts
  property defined.
@@ -52,9 +53,10 @@ Example:
vfe0: qcom,vfe0@fda10000 {
	cell-index = <0>;
	compatible = "qcom,vfe44";
	reg = <0xfda10000 0x1000>;
		<0xfda40000 0x200>;
	reg-names = "vfe", "vfe_vbif";
	reg = <0xfda10000 0x1000>,
		<0xfda40000 0x200>,
		<0xa4174 0x8>;
	reg-names = "vfe", "vfe_vbif", "vfe_fuse";
	interrupts = <0 57 0>;
	interrupt-names = "vfe";
	vdd-supply = <&gdsc_vfe>;
@@ -105,9 +107,10 @@ vfe0: qcom,vfe0@fda10000 {
vfe1: qcom,vfe1@fda14000 {
	cell-index = <1>;
	compatible = "qcom,vfe44";
	reg = <0xfda14000 0x1000>;
		<0xfda40000 0x200>;
	reg-names = "vfe", "vfe_vbif";
	reg = <0xfda14000 0x1000>,
		<0xfda40000 0x200>,
		<0xa4174 0x8>;
	reg-names = "vfe", "vfe_vbif", "vfe_fuse";
	interrupts = <0 58 0>;
	interrupt-names = "vfe";
	vdd-supply = <&gdsc_vfe>;
+1 −0
Original line number Diff line number Diff line
@@ -762,6 +762,7 @@ struct vfe_device {
	uint32_t is_split;
	uint32_t dual_vfe_enable;
	unsigned long page_fault_addr;
	uint32_t vfe_hw_limit;

	/* Debug variables */
	int dump_reg;
+15 −2
Original line number Diff line number Diff line
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2017, 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
@@ -2597,6 +2597,8 @@ int msm_vfe47_enable_regulators(struct vfe_device *vfe_dev, int enable)
int msm_vfe47_get_platform_data(struct vfe_device *vfe_dev)
{
	int rc = 0;
	void __iomem *vfe_fuse_base;
	uint32_t vfe_fuse_base_size;

	vfe_dev->vfe_base = msm_camera_get_reg_base(vfe_dev->pdev, "vfe", 0);
	if (!vfe_dev->vfe_base)
@@ -2621,7 +2623,18 @@ int msm_vfe47_get_platform_data(struct vfe_device *vfe_dev)
		rc = -ENOMEM;
		goto get_res_fail;
	}

	vfe_dev->vfe_hw_limit = 0;
	vfe_fuse_base = msm_camera_get_reg_base(vfe_dev->pdev,
					"vfe_fuse", 0);
	vfe_fuse_base_size = msm_camera_get_res_size(vfe_dev->pdev,
						"vfe_fuse");
	if (vfe_fuse_base) {
		if (vfe_fuse_base_size)
			vfe_dev->vfe_hw_limit =
				(msm_camera_io_r(vfe_fuse_base) >> 7) & 0x3;
		msm_camera_put_reg_base(vfe_dev->pdev, vfe_fuse_base,
				"vfe_fuse", 0);
	}
	rc = vfe_dev->hw_info->vfe_ops.platform_ops.get_regulators(vfe_dev);
	if (rc)
		goto get_regulator_fail;
+14 −0
Original line number Diff line number Diff line
@@ -1359,6 +1359,20 @@ static int msm_isp_send_hw_cmd(struct vfe_device *vfe_dev,
		vfe_dev->vfe_ub_policy = *cfg_data;
		break;
	}
	case GET_VFE_HW_LIMIT: {
		uint32_t *hw_limit = NULL;

		if (cmd_len < sizeof(uint32_t)) {
			pr_err("%s:%d failed: invalid cmd len %u exp %zu\n",
				__func__, __LINE__, cmd_len,
				sizeof(uint32_t));
			return -EINVAL;
		}

		hw_limit = (uint32_t *)cfg_data;
		*hw_limit = vfe_dev->vfe_hw_limit;
		break;
	}
	}
	return 0;
}
+7 −3
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@

#define ISP_STATS_STREAM_BIT  0x80000000

#define VFE_HW_LIMIT 1

struct msm_vfe_cfg_cmd_list;

enum ISP_START_PIXEL_PATTERN {
@@ -462,6 +464,7 @@ enum msm_vfe_reg_cfg_type {
	VFE_HW_UPDATE_UNLOCK,
	SET_WM_UB_SIZE,
	SET_UB_POLICY,
	GET_VFE_HW_LIMIT,
};

struct msm_vfe_cfg_cmd2 {
@@ -886,6 +889,7 @@ enum msm_isp_ioctl_cmd_code {
	MSM_ISP_FETCH_ENG_MULTI_PASS_START,
	MSM_ISP_MAP_BUF_START_MULTI_PASS_FE,
	MSM_ISP_CFG_HW_STATE,
	MSM_ISP_AHB_CLK_CFG,
};

#define VIDIOC_MSM_VFE_REG_CFG \
@@ -988,9 +992,6 @@ enum msm_isp_ioctl_cmd_code {
	_IOWR('V', MSM_ISP_UNMAP_BUF, \
		struct msm_isp_unmap_buf_req)

#define VIDIOC_MSM_ISP_AHB_CLK_CFG \
	_IOWR('V', BASE_VIDIOC_PRIVATE+25, struct msm_isp_ahb_clk_cfg)

#define VIDIOC_MSM_ISP_FETCH_ENG_MULTI_PASS_START \
	_IOWR('V', MSM_ISP_FETCH_ENG_MULTI_PASS_START, \
		struct msm_vfe_fetch_eng_multi_pass_start)
@@ -1002,4 +1003,7 @@ enum msm_isp_ioctl_cmd_code {
#define VIDIOC_MSM_ISP_CFG_HW_STATE \
	_IOWR('V', MSM_ISP_CFG_HW_STATE, \
		struct msm_vfe_axi_stream_cfg_cmd)

#define VIDIOC_MSM_ISP_AHB_CLK_CFG \
	_IOWR('V', MSM_ISP_AHB_CLK_CFG, struct msm_isp_ahb_clk_cfg)
#endif /* __MSMB_ISP__ */