media: imx7-media-csi: add i.MX6UL support
i.MX7 and i.MX6UL/L have the same CSI controller. So add i.MX6UL/L support to imx7-media-csi driver. Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Fabio Estevam <festevam@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
0d90467348
commit
0486a18ce8
|
@ -22,11 +22,11 @@ config VIDEO_IMX_CSI
|
|||
A video4linux camera sensor interface driver for i.MX5/6.
|
||||
|
||||
config VIDEO_IMX7_CSI
|
||||
tristate "i.MX7 Camera Sensor Interface driver"
|
||||
tristate "i.MX6UL/L / i.MX7 Camera Sensor Interface driver"
|
||||
depends on VIDEO_IMX_MEDIA && VIDEO_DEV && I2C
|
||||
default y
|
||||
help
|
||||
Enable support for video4linux camera sensor interface driver for
|
||||
i.MX7.
|
||||
i.MX6UL/L or i.MX7.
|
||||
endmenu
|
||||
endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* V4L2 Capture CSI Subdev for Freescale i.MX7 SOC
|
||||
* V4L2 Capture CSI Subdev for Freescale i.MX6UL/L / i.MX7 SOC
|
||||
*
|
||||
* Copyright (c) 2019 Linaro Ltd
|
||||
*
|
||||
|
@ -765,6 +765,7 @@ static int imx7_csi_configure(struct imx7_csi *csi)
|
|||
struct v4l2_pix_format *out_pix = &vdev->fmt.fmt.pix;
|
||||
__u32 in_code = csi->format_mbus[IMX7_CSI_PAD_SINK].code;
|
||||
u32 cr1, cr18;
|
||||
int width = out_pix->width;
|
||||
|
||||
if (out_pix->field == V4L2_FIELD_INTERLACED) {
|
||||
imx7_csi_deinterlace_enable(csi, true);
|
||||
|
@ -774,15 +775,27 @@ static int imx7_csi_configure(struct imx7_csi *csi)
|
|||
imx7_csi_buf_stride_set(csi, 0);
|
||||
}
|
||||
|
||||
imx7_csi_set_imagpara(csi, out_pix->width, out_pix->height);
|
||||
cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
|
||||
|
||||
if (!csi->is_csi2) {
|
||||
if (out_pix->pixelformat == V4L2_PIX_FMT_UYVY ||
|
||||
out_pix->pixelformat == V4L2_PIX_FMT_YUYV)
|
||||
width *= 2;
|
||||
|
||||
imx7_csi_set_imagpara(csi, width, out_pix->height);
|
||||
|
||||
cr18 |= (BIT_BASEADDR_SWITCH_EN | BIT_BASEADDR_SWITCH_SEL |
|
||||
BIT_BASEADDR_CHG_ERR_EN);
|
||||
imx7_csi_reg_write(csi, cr18, CSI_CSICR18);
|
||||
|
||||
if (!csi->is_csi2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
imx7_csi_set_imagpara(csi, width, out_pix->height);
|
||||
|
||||
cr1 = imx7_csi_reg_read(csi, CSI_CSICR1);
|
||||
cr1 &= ~BIT_GCLK_MODE;
|
||||
|
||||
cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
|
||||
cr18 &= BIT_MIPI_DATA_FORMAT_MASK;
|
||||
cr18 |= BIT_DATA_FROM_MIPI;
|
||||
|
||||
|
@ -817,11 +830,9 @@ static void imx7_csi_enable(struct imx7_csi *csi)
|
|||
{
|
||||
imx7_csi_sw_reset(csi);
|
||||
|
||||
if (csi->is_csi2) {
|
||||
imx7_csi_dmareq_rff_enable(csi);
|
||||
imx7_csi_hw_enable_irq(csi);
|
||||
imx7_csi_hw_enable(csi);
|
||||
}
|
||||
imx7_csi_dmareq_rff_enable(csi);
|
||||
imx7_csi_hw_enable_irq(csi);
|
||||
imx7_csi_hw_enable(csi);
|
||||
}
|
||||
|
||||
static void imx7_csi_disable(struct imx7_csi *csi)
|
||||
|
@ -1302,6 +1313,7 @@ static int imx7_csi_remove(struct platform_device *pdev)
|
|||
|
||||
static const struct of_device_id imx7_csi_of_match[] = {
|
||||
{ .compatible = "fsl,imx7-csi" },
|
||||
{ .compatible = "fsl,imx6ul-csi" },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, imx7_csi_of_match);
|
||||
|
|
Loading…
Reference in New Issue