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

Commit f9367e0f authored by Sreesudhan Ramakrish Ramkumar's avatar Sreesudhan Ramakrish Ramkumar Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: Add YUV formats for IO format to BPP mapping



Only bayer formats are considered to convert IO format to Bits Per
Pixel(BPP) mapping. For YUV sensor, error is returned. Add YUV
formats and handle negative error in caller.

Change-Id: Ibd72cc800d9b12f1dd9ec6bca91923a6c3bcfd17
Signed-off-by: default avatarSreesudhan Ramakrish Ramkumar <srramku@codeaurora.org>
parent 0dcf4ed8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ struct msm_vfe_axi_ops {
		uint32_t reload_mask);
	void (*enable_wm) (struct vfe_device *vfe_dev,
		uint8_t wm_idx, uint8_t enable);
	void (*cfg_io_format) (struct vfe_device *vfe_dev,
	int32_t (*cfg_io_format) (struct vfe_device *vfe_dev,
		enum msm_vfe_axi_stream_src stream_src,
		uint32_t io_format);
	void (*cfg_framedrop) (struct vfe_device *vfe_dev,
+12 −3
Original line number Diff line number Diff line
@@ -495,12 +495,17 @@ static void msm_vfe32_clear_framedrop(struct vfe_device *vfe_dev,
	}
}

static void msm_vfe32_cfg_io_format(struct vfe_device *vfe_dev,
static int32_t msm_vfe32_cfg_io_format(struct vfe_device *vfe_dev,
	enum msm_vfe_axi_stream_src stream_src, uint32_t io_format)
{
	int bpp, bpp_reg = 0, pack_fmt = 0, pack_reg = 0;
	uint32_t io_format_reg;
	bpp = msm_isp_get_bit_per_pixel(io_format);
	if (bpp < 0) {
		pr_err("%s:%d invalid io_format %d bpp %d", __func__, __LINE__,
			io_format, bpp);
		return -EINVAL;
	}

	switch (bpp) {
	case 8:
@@ -512,6 +517,9 @@ static void msm_vfe32_cfg_io_format(struct vfe_device *vfe_dev,
	case 12:
		bpp_reg = 1 << 1;
		break;
	default:
		pr_err("%s:%d invalid bpp %d", __func__, __LINE__, bpp);
		return -EINVAL;
	}

	if (stream_src == IDEAL_RAW) {
@@ -537,7 +545,7 @@ static void msm_vfe32_cfg_io_format(struct vfe_device *vfe_dev,
			break;
		default:
			pr_err("%s: invalid pack fmt!\n", __func__);
			return;
			return -EINVAL;
		}
	}

@@ -558,9 +566,10 @@ static void msm_vfe32_cfg_io_format(struct vfe_device *vfe_dev,
	case RDI_INTF_2:
	default:
		pr_err("%s: Invalid stream source\n", __func__);
		return;
		return -EINVAL;
	}
	msm_camera_io_w(io_format_reg, vfe_dev->vfe_base + 0x6F8);
	return 0;
}

static void msm_vfe32_cfg_camif(struct vfe_device *vfe_dev,
+12 −3
Original line number Diff line number Diff line
@@ -725,13 +725,18 @@ static void msm_vfe40_clear_framedrop(struct vfe_device *vfe_dev,
			VFE40_WM_BASE(stream_info->wm[i]) + 0x1C);
}

static void msm_vfe40_cfg_io_format(struct vfe_device *vfe_dev,
static int32_t msm_vfe40_cfg_io_format(struct vfe_device *vfe_dev,
	enum msm_vfe_axi_stream_src stream_src, uint32_t io_format)
{
	int bpp, bpp_reg = 0, pack_reg = 0;
	enum msm_isp_pack_fmt pack_fmt = 0;
	uint32_t io_format_reg; /*io format register bit*/
	bpp = msm_isp_get_bit_per_pixel(io_format);
	if (bpp < 0) {
		pr_err("%s:%d invalid io_format %d bpp %d", __func__, __LINE__,
			io_format, bpp);
		return -EINVAL;
	}

	switch (bpp) {
	case 8:
@@ -743,6 +748,9 @@ static void msm_vfe40_cfg_io_format(struct vfe_device *vfe_dev,
	case 12:
		bpp_reg = 1 << 1;
		break;
	default:
		pr_err("%s:%d invalid bpp %d", __func__, __LINE__, bpp);
		return -EINVAL;
	}

	if (stream_src == IDEAL_RAW) {
@@ -769,7 +777,7 @@ static void msm_vfe40_cfg_io_format(struct vfe_device *vfe_dev,
			break;
		default:
			pr_err("%s: invalid pack fmt!\n", __func__);
			return;
			return -EINVAL;
		}
	}

@@ -790,9 +798,10 @@ static void msm_vfe40_cfg_io_format(struct vfe_device *vfe_dev,
	case RDI_INTF_2:
	default:
		pr_err("%s: Invalid stream source\n", __func__);
		return;
		return -EINVAL;
	}
	msm_camera_io_w(io_format_reg, vfe_dev->vfe_base + 0x54);
	return 0;
}

static void msm_vfe40_cfg_camif(struct vfe_device *vfe_dev,
+12 −3
Original line number Diff line number Diff line
@@ -592,13 +592,18 @@ static void msm_vfe44_clear_framedrop(struct vfe_device *vfe_dev,
			VFE44_WM_BASE(stream_info->wm[i]) + 0x1C);
}

static void msm_vfe44_cfg_io_format(struct vfe_device *vfe_dev,
static int32_t msm_vfe44_cfg_io_format(struct vfe_device *vfe_dev,
	enum msm_vfe_axi_stream_src stream_src, uint32_t io_format)
{
	int bpp, bpp_reg = 0, pack_reg = 0;
	enum msm_isp_pack_fmt pack_fmt = 0;
	uint32_t io_format_reg; /*io format register bit*/
	bpp = msm_isp_get_bit_per_pixel(io_format);
	if (bpp < 0) {
		pr_err("%s:%d invalid io_format %d bpp %d", __func__, __LINE__,
			io_format, bpp);
		return -EINVAL;
	}

	switch (bpp) {
	case 8:
@@ -610,6 +615,9 @@ static void msm_vfe44_cfg_io_format(struct vfe_device *vfe_dev,
	case 12:
		bpp_reg = 1 << 1;
		break;
	default:
		pr_err("%s:%d invalid bpp %d", __func__, __LINE__, bpp);
		return -EINVAL;
	}

	if (stream_src == IDEAL_RAW) {
@@ -636,7 +644,7 @@ static void msm_vfe44_cfg_io_format(struct vfe_device *vfe_dev,
			break;
		default:
			pr_err("%s: invalid pack fmt!\n", __func__);
			return;
			return -EINVAL;
		}
	}

@@ -657,9 +665,10 @@ static void msm_vfe44_cfg_io_format(struct vfe_device *vfe_dev,
	case RDI_INTF_2:
	default:
		pr_err("%s: Invalid stream source\n", __func__);
		return;
		return -EINVAL;
	}
	msm_camera_io_w(io_format_reg, vfe_dev->vfe_base + 0x54);
	return 0;
}

static void msm_vfe44_cfg_camif(struct vfe_device *vfe_dev,
+10 −1
Original line number Diff line number Diff line
@@ -572,8 +572,17 @@ int msm_isp_request_axi_stream(struct vfe_device *vfe_dev, void *arg)

			io_format = stream_info->output_format;
		}
		vfe_dev->hw_info->vfe_ops.axi_ops.cfg_io_format(
		rc = vfe_dev->hw_info->vfe_ops.axi_ops.cfg_io_format(
			vfe_dev, stream_info->stream_src, io_format);
		if (rc) {
			pr_err("%s: cfg io format failed\n", __func__);
			msm_isp_axi_free_wm(&vfe_dev->axi_data,
				stream_info);
			msm_isp_axi_destroy_stream(&vfe_dev->axi_data,
				HANDLE_TO_IDX(
				stream_cfg_cmd->axi_stream_handle));
			return rc;
		}
	}

	msm_isp_calculate_framedrop(&vfe_dev->axi_data, stream_cfg_cmd);
Loading