Commit 9e5d1581 authored by AngeloGioacchino Del Regno's avatar AngeloGioacchino Del Regno Committed by Mauro Carvalho Chehab
Browse files

media: camss: Add support for SDM630/636/660 camera subsystem



Add support for the Qualcomm SDM630/636/660 and SDA variants' camera
subsystem. These SoCs are equipped with:
- 3x CSI PHY 3-Phase v1.0 (downstream csiphy-v3.5)
- 4x CSID v5.0
- 2x ISPIF v3.0
- 2x VFE 4.8
As a note, this camera subsystem is very similar to the one that
is found in the MSM8998/APQ8098 SoCs.

Signed-off-by: default avatarAngeloGioacchino Del Regno <kholk11@gmail.com>
Reviewed-by: default avatarRobert Foss <robert.foss@linaro.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 3cba9d22
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -383,7 +383,8 @@ static u32 csid_src_pad_code(struct csid_device *csid, u32 sink_code,
			return 0;

		return sink_code;
	} else if (csid->camss->version == CAMSS_8x96) {
	} else if (csid->camss->version == CAMSS_8x96 ||
		   csid->camss->version == CAMSS_660) {
		switch (sink_code) {
		case MEDIA_BUS_FMT_SBGGR10_1X10:
		{
@@ -718,7 +719,8 @@ static int csid_set_stream(struct v4l2_subdev *sd, int enable)
		val |= df << CAMSS_CSID_CID_n_CFG_DECODE_FORMAT_SHIFT;
		val |= CAMSS_CSID_CID_n_CFG_RDI_MODE_RAW_DUMP;

		if (csid->camss->version == CAMSS_8x96) {
		if (csid->camss->version == CAMSS_8x96 ||
		    csid->camss->version == CAMSS_660) {
			u32 sink_code = csid->fmt[MSM_CSID_PAD_SINK].code;
			u32 src_code = csid->fmt[MSM_CSID_PAD_SRC].code;

@@ -1098,7 +1100,8 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
		csid->formats = csid_formats_8x16;
		csid->nformats =
				ARRAY_SIZE(csid_formats_8x16);
	} else if (camss->version == CAMSS_8x96) {
	} else if (camss->version == CAMSS_8x96 ||
		   camss->version == CAMSS_660) {
		csid->formats = csid_formats_8x96;
		csid->nformats =
				ARRAY_SIZE(csid_formats_8x96);
+2 −1
Original line number Diff line number Diff line
@@ -554,7 +554,8 @@ int msm_csiphy_subdev_init(struct camss *camss,
		csiphy->ops = &csiphy_ops_2ph_1_0;
		csiphy->formats = csiphy_formats_8x16;
		csiphy->nformats = ARRAY_SIZE(csiphy_formats_8x16);
	} else if (camss->version == CAMSS_8x96) {
	} else if (camss->version == CAMSS_8x96 ||
		   camss->version == CAMSS_660) {
		csiphy->ops = &csiphy_ops_3ph_1_0;
		csiphy->formats = csiphy_formats_8x96;
		csiphy->nformats = ARRAY_SIZE(csiphy_formats_8x96);
+10 −5
Original line number Diff line number Diff line
@@ -825,7 +825,8 @@ static int ispif_set_stream(struct v4l2_subdev *sd, int enable)
		ispif_select_csid(ispif, intf, csid, vfe, 1);
		ispif_select_cid(ispif, intf, cid, vfe, 1);
		ispif_config_irq(ispif, intf, vfe, 1);
		if (to_camss(ispif)->version == CAMSS_8x96)
		if (to_camss(ispif)->version == CAMSS_8x96 ||
		    to_camss(ispif)->version == CAMSS_660)
			ispif_config_pack(ispif,
					  line->fmt[MSM_ISPIF_PAD_SINK].code,
					  intf, cid, vfe, 1);
@@ -842,7 +843,8 @@ static int ispif_set_stream(struct v4l2_subdev *sd, int enable)
			return ret;

		mutex_lock(&ispif->config_lock);
		if (to_camss(ispif)->version == CAMSS_8x96)
		if (to_camss(ispif)->version == CAMSS_8x96 ||
		    to_camss(ispif)->version == CAMSS_660)
			ispif_config_pack(ispif,
					  line->fmt[MSM_ISPIF_PAD_SINK].code,
					  intf, cid, vfe, 0);
@@ -1098,7 +1100,8 @@ int msm_ispif_subdev_init(struct ispif_device *ispif,
	/* Number of ISPIF lines - same as number of CSID hardware modules */
	if (to_camss(ispif)->version == CAMSS_8x16)
		ispif->line_num = 2;
	else if (to_camss(ispif)->version == CAMSS_8x96)
	else if (to_camss(ispif)->version == CAMSS_8x96 ||
		 to_camss(ispif)->version == CAMSS_660)
		ispif->line_num = 4;
	else
		return -EINVAL;
@@ -1116,7 +1119,8 @@ int msm_ispif_subdev_init(struct ispif_device *ispif,
			ispif->line[i].formats = ispif_formats_8x16;
			ispif->line[i].nformats =
					ARRAY_SIZE(ispif_formats_8x16);
		} else if (to_camss(ispif)->version == CAMSS_8x96) {
		} else if (to_camss(ispif)->version == CAMSS_8x96 ||
			   to_camss(ispif)->version == CAMSS_660) {
			ispif->line[i].formats = ispif_formats_8x96;
			ispif->line[i].nformats =
					ARRAY_SIZE(ispif_formats_8x96);
@@ -1156,7 +1160,8 @@ int msm_ispif_subdev_init(struct ispif_device *ispif,
	if (to_camss(ispif)->version == CAMSS_8x16)
		ret = devm_request_irq(dev, ispif->irq, ispif_isr_8x16,
			       IRQF_TRIGGER_RISING, ispif->irq_name, ispif);
	else if (to_camss(ispif)->version == CAMSS_8x96)
	else if (to_camss(ispif)->version == CAMSS_8x96 ||
		 to_camss(ispif)->version == CAMSS_660)
		ret = devm_request_irq(dev, ispif->irq, ispif_isr_8x96,
			       IRQF_TRIGGER_RISING, ispif->irq_name, ispif);
	else
+14 −5
Original line number Diff line number Diff line
@@ -205,7 +205,8 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code,

			return sink_code;
		}
	else if (vfe->camss->version == CAMSS_8x96)
	else if (vfe->camss->version == CAMSS_8x96 ||
		 vfe->camss->version == CAMSS_660)
		switch (sink_code) {
		case MEDIA_BUS_FMT_YUYV8_2X8:
		{
@@ -1991,12 +1992,19 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe,
	vfe->isr_ops.comp_done = vfe_isr_comp_done;
	vfe->isr_ops.wm_done = vfe_isr_wm_done;

	if (camss->version == CAMSS_8x16)
	switch (camss->version) {
	case CAMSS_8x16:
		vfe->ops = &vfe_ops_4_1;
	else if (camss->version == CAMSS_8x96)
		break;
	case CAMSS_8x96:
		vfe->ops = &vfe_ops_4_7;
	else
		break;
	case CAMSS_660:
		vfe->ops = &vfe_ops_4_8;
		break;
	default:
		return -EINVAL;
	}

	/* Memory */

@@ -2095,7 +2103,8 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe,
				l->formats = formats_rdi_8x16;
				l->nformats = ARRAY_SIZE(formats_rdi_8x16);
			}
		} else if (camss->version == CAMSS_8x96) {
		} else if (camss->version == CAMSS_8x96 ||
			   camss->version == CAMSS_660) {
			if (i == VFE_LINE_PIX) {
				l->formats = formats_pix_8x96;
				l->nformats = ARRAY_SIZE(formats_pix_8x96);
+2 −1
Original line number Diff line number Diff line
@@ -970,7 +970,8 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
			video->formats = formats_rdi_8x16;
			video->nformats = ARRAY_SIZE(formats_rdi_8x16);
		}
	} else if (video->camss->version == CAMSS_8x96) {
	} else if (video->camss->version == CAMSS_8x96 ||
		   video->camss->version == CAMSS_660) {
		if (is_pix) {
			video->formats = formats_pix_8x96;
			video->nformats = ARRAY_SIZE(formats_pix_8x96);
Loading