From patchwork Wed Jul 31 16:32:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?S=C3=A9bastien_Szymanski?= X-Patchwork-Id: 57822 Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hsrnb-0004lr-Aj; Wed, 31 Jul 2019 16:49:59 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728154AbfGaQt5 (ORCPT + 1 other); Wed, 31 Jul 2019 12:49:57 -0400 Received: from 10.mo177.mail-out.ovh.net ([46.105.73.133]:33917 "EHLO 10.mo177.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727041AbfGaQt5 (ORCPT ); Wed, 31 Jul 2019 12:49:57 -0400 X-Greylist: delayed 602 seconds by postgrey-1.27 at vger.kernel.org; Wed, 31 Jul 2019 12:49:56 EDT Received: from player756.ha.ovh.net (unknown [10.109.159.222]) by mo177.mail-out.ovh.net (Postfix) with ESMTP id 77ACF1061E5 for ; Wed, 31 Jul 2019 18:33:17 +0200 (CEST) Received: from armadeus.com (lfbn-1-7591-179.w90-126.abo.wanadoo.fr [90.126.248.179]) (Authenticated sender: sebastien.szymanski@armadeus.com) by player756.ha.ovh.net (Postfix) with ESMTPSA id B74A77ADA712; Wed, 31 Jul 2019 16:32:56 +0000 (UTC) From: =?utf-8?q?S=C3=A9bastien_Szymanski?= To: Rui Miguel Silva , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Steve Longerbeam , Philipp Zabel Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Greg Kroah-Hartman , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org, =?utf-8?q?S=C3=A9bastien_Szymanski?= Subject: [PATCH v3 1/3] ARM: dts: imx6ul: Add csi node Date: Wed, 31 Jul 2019 18:32:57 +0200 Message-Id: <20190731163257.32448-1-sebastien.szymanski@armadeus.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Ovh-Tracer-Id: 14036875616662541351 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrleehgddutdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add csi node for i.MX6UL SoC. Reviewed-by: Fabio Estevam Signed-off-by: Sébastien Szymanski --- Changes for v3: - none Changes for v2: - only "mclk" clock is required now. arch/arm/boot/dts/imx6ul.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index 81d4b4925127..56cfcf0e5084 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -957,6 +957,15 @@ }; }; + csi: csi@21c4000 { + compatible = "fsl,imx6ul-csi", "fsl,imx7-csi"; + reg = <0x021c4000 0x4000>; + interrupts = ; + clocks = <&clks IMX6UL_CLK_CSI>; + clock-names = "mclk"; + status = "disabled"; + }; + lcdif: lcdif@21c8000 { compatible = "fsl,imx6ul-lcdif", "fsl,imx28-lcdif"; reg = <0x021c8000 0x4000>; From patchwork Wed Jul 31 16:33:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?S=C3=A9bastien_Szymanski?= X-Patchwork-Id: 57823 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hstss-0003ut-JZ; Wed, 31 Jul 2019 19:03:34 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728595AbfGaTDd (ORCPT + 1 other); Wed, 31 Jul 2019 15:03:33 -0400 Received: from 5.mo4.mail-out.ovh.net ([188.165.44.50]:38198 "EHLO 5.mo4.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726556AbfGaTDc (ORCPT ); Wed, 31 Jul 2019 15:03:32 -0400 X-Greylist: delayed 4199 seconds by postgrey-1.27 at vger.kernel.org; Wed, 31 Jul 2019 15:03:31 EDT Received: from player776.ha.ovh.net (unknown [10.108.57.226]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 3B4C31FC3F2 for ; Wed, 31 Jul 2019 18:33:47 +0200 (CEST) Received: from armadeus.com (lfbn-1-7591-179.w90-126.abo.wanadoo.fr [90.126.248.179]) (Authenticated sender: sebastien.szymanski@armadeus.com) by player776.ha.ovh.net (Postfix) with ESMTPSA id A3C58878DD52; Wed, 31 Jul 2019 16:33:28 +0000 (UTC) From: =?utf-8?q?S=C3=A9bastien_Szymanski?= To: Rui Miguel Silva , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Steve Longerbeam , Philipp Zabel Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Greg Kroah-Hartman , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org, =?utf-8?q?S=C3=A9bastien_Szymanski?= Subject: [PATCH v3 2/3] media: imx7-media-csi: add i.MX6UL support Date: Wed, 31 Jul 2019 18:33:30 +0200 Message-Id: <20190731163330.32532-1-sebastien.szymanski@armadeus.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Ovh-Tracer-Id: 14045319867170182183 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrleehgddutdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 Reviewed-by: Rui Miguel Silva Reviewed-by: Fabio Estevam --- Changes for v3: - rebase on Linux v5.3-rc2 - remove csi_soc_id var as it's not needed anymore thanks to commit e0c76a7d3428 ("media: imx7-media-csi: get csi upstream endpoint") Changes for v2: - rebase on top of linuxtv/master - mention i.MX6UL/L in header and Kconfig help text - rename csi_type to csi_soc_id drivers/staging/media/imx/Kconfig | 4 +-- drivers/staging/media/imx/imx7-media-csi.c | 30 +++++++++++++++------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/staging/media/imx/Kconfig b/drivers/staging/media/imx/Kconfig index 4c726345dc25..f51476243016 100644 --- a/drivers/staging/media/imx/Kconfig +++ b/drivers/staging/media/imx/Kconfig @@ -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 diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 500b4c08d967..4ca79ff4c9b3 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -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); From patchwork Wed Jul 31 16:33:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?S=C3=A9bastien_Szymanski?= X-Patchwork-Id: 57821 X-Patchwork-Delegate: sakari.ailus@iki.fi Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hsrg4-0004Re-Dm; Wed, 31 Jul 2019 16:42:12 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730295AbfGaQmK (ORCPT + 1 other); Wed, 31 Jul 2019 12:42:10 -0400 Received: from 1.mo2.mail-out.ovh.net ([46.105.63.121]:49757 "EHLO 1.mo2.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730085AbfGaQmJ (ORCPT ); Wed, 31 Jul 2019 12:42:09 -0400 X-Greylist: delayed 472 seconds by postgrey-1.27 at vger.kernel.org; Wed, 31 Jul 2019 12:42:08 EDT Received: from player697.ha.ovh.net (unknown [10.108.57.53]) by mo2.mail-out.ovh.net (Postfix) with ESMTP id 38F061A6CED for ; Wed, 31 Jul 2019 18:34:15 +0200 (CEST) Received: from armadeus.com (lfbn-1-7591-179.w90-126.abo.wanadoo.fr [90.126.248.179]) (Authenticated sender: sebastien.szymanski@armadeus.com) by player697.ha.ovh.net (Postfix) with ESMTPSA id 580F38831A9A; Wed, 31 Jul 2019 16:33:56 +0000 (UTC) From: =?utf-8?q?S=C3=A9bastien_Szymanski?= To: Rui Miguel Silva , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Steve Longerbeam , Philipp Zabel Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Greg Kroah-Hartman , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org, =?utf-8?q?S=C3=A9bastien_Szymanski?= , Rob Herring Subject: [PATCH v3 3/3] media: dt-bindings: imx7-csi: add i.MX6UL/L support Date: Wed, 31 Jul 2019 18:33:58 +0200 Message-Id: <20190731163358.32622-1-sebastien.szymanski@armadeus.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Ovh-Tracer-Id: 14053201162921464871 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrleehgddutdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Document "fsl,imx6ul-csi" entry. Reviewed-by: Rob Herring Signed-off-by: Sébastien Szymanski Reviewed-by: Fabio Estevam --- Changes for v3: - none Changes for v2: - New patch to document new "fsl,imx6ul-csi" entry. Documentation/devicetree/bindings/media/imx7-csi.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/imx7-csi.txt b/Documentation/devicetree/bindings/media/imx7-csi.txt index 443aef07356e..d80ceefa0c00 100644 --- a/Documentation/devicetree/bindings/media/imx7-csi.txt +++ b/Documentation/devicetree/bindings/media/imx7-csi.txt @@ -9,7 +9,7 @@ to connect directly to external CMOS image sensors. Required properties: -- compatible : "fsl,imx7-csi"; +- compatible : "fsl,imx7-csi" or "fsl,imx6ul-csi"; - reg : base address and length of the register set for the device; - interrupts : should contain CSI interrupt; - clocks : list of clock specifiers, see