All of lore.kernel.org
 help / color / mirror / Atom feed
From: fabrizio.castro@bp.renesas.com (Fabrizio Castro)
To: cip-dev@lists.cip-project.org
Subject: [cip-dev] [PATCH 4.19.y 11/29] media: rcar-csi2: Handle per-SoC number of channels
Date: Wed,  1 May 2019 11:22:05 +0100	[thread overview]
Message-ID: <1556706143-11898-12-git-send-email-fabrizio.castro@bp.renesas.com> (raw)
In-Reply-To: <1556706143-11898-1-git-send-email-fabrizio.castro@bp.renesas.com>

From: Jacopo Mondi <jacopo+renesas@jmondi.org>

commit 87c6f1b57f61e83392dcb6b2e4398d444e83c7c8 upstream.

The R-Car CSI-2 interface has a number of selectable 'channels' that
provides pixel data to the VINs during image acquisition.

Each channel can be used to match a CSI-2 data type and a CSI-2 virtual
channel to be routed to output path.

Different SoCs have different number of channels, with R-Car E3 being the
notable exception supporting only 2 of them.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
---
 drivers/media/platform/rcar-vin/rcar-csi2.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c
index 631f91f..9d8357b 100644
--- a/drivers/media/platform/rcar-vin/rcar-csi2.c
+++ b/drivers/media/platform/rcar-vin/rcar-csi2.c
@@ -342,6 +342,7 @@ struct rcar_csi2_info {
 	int (*confirm_start)(struct rcar_csi2 *priv);
 	const struct rcsi2_mbps_reg *hsfreqrange;
 	unsigned int csi0clkfreqrange;
+	unsigned int num_channels;
 	bool clear_ulps;
 };
 
@@ -476,13 +477,14 @@ static int rcsi2_start(struct rcar_csi2 *priv)
 	format = rcsi2_code_to_fmt(priv->mf.code);
 
 	/*
-	 * Enable all Virtual Channels.
+	 * Enable all supported CSI-2 channels with virtual channel and
+	 * data type matching.
 	 *
 	 * NOTE: It's not possible to get individual datatype for each
 	 *       source virtual channel. Once this is possible in V4L2
 	 *       it should be used here.
 	 */
-	for (i = 0; i < 4; i++) {
+	for (i = 0; i < priv->info->num_channels; i++) {
 		u32 vcdt_part;
 
 		vcdt_part = VCDT_SEL_VC(i) | VCDT_VCDTN_EN | VCDT_SEL_DTN_ON |
@@ -511,7 +513,8 @@ static int rcsi2_start(struct rcar_csi2 *priv)
 	rcsi2_write(priv, FLD_REG, FLD_FLD_NUM(2) | FLD_FLD_EN4 |
 		    FLD_FLD_EN3 | FLD_FLD_EN2 | FLD_FLD_EN);
 	rcsi2_write(priv, VCDT_REG, vcdt);
-	rcsi2_write(priv, VCDT2_REG, vcdt2);
+	if (vcdt2)
+		rcsi2_write(priv, VCDT2_REG, vcdt2);
 	/* Lanes are zero indexed. */
 	rcsi2_write(priv, LSWAP_REG,
 		    LSWAP_L0SEL(priv->lane_swap[0] - 1) |
@@ -936,32 +939,38 @@ static const struct rcar_csi2_info rcar_csi2_info_r8a7795 = {
 	.init_phtw = rcsi2_init_phtw_h3_v3h_m3n,
 	.hsfreqrange = hsfreqrange_h3_v3h_m3n,
 	.csi0clkfreqrange = 0x20,
+	.num_channels = 4,
 	.clear_ulps = true,
 };
 
 static const struct rcar_csi2_info rcar_csi2_info_r8a7795es1 = {
 	.hsfreqrange = hsfreqrange_m3w_h3es1,
+	.num_channels = 4,
 };
 
 static const struct rcar_csi2_info rcar_csi2_info_r8a7796 = {
 	.hsfreqrange = hsfreqrange_m3w_h3es1,
+	.num_channels = 4,
 };
 
 static const struct rcar_csi2_info rcar_csi2_info_r8a77965 = {
 	.init_phtw = rcsi2_init_phtw_h3_v3h_m3n,
 	.hsfreqrange = hsfreqrange_h3_v3h_m3n,
 	.csi0clkfreqrange = 0x20,
+	.num_channels = 4,
 	.clear_ulps = true,
 };
 
 static const struct rcar_csi2_info rcar_csi2_info_r8a77970 = {
 	.init_phtw = rcsi2_init_phtw_v3m_e3,
 	.confirm_start = rcsi2_confirm_start_v3m_e3,
+	.num_channels = 4,
 };
 
 static const struct rcar_csi2_info rcar_csi2_info_r8a77990 = {
 	.init_phtw = rcsi2_init_phtw_v3m_e3,
 	.confirm_start = rcsi2_confirm_start_v3m_e3,
+	.num_channels = 2,
 };
 
 static const struct of_device_id rcar_csi2_of_table[] = {
-- 
2.7.4

  parent reply	other threads:[~2019-05-01 10:22 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-01 10:21 [cip-dev] [PATCH 4.19.y 00/29] Add further support for the RZ/G2M Fabrizio Castro
2019-05-01 10:21 ` [cip-dev] [PATCH 4.19.y 01/29] iommu/ipmmu-vmsa: Hook up R8A774A1 DT maching code Fabrizio Castro
2019-05-01 10:21 ` [cip-dev] [PATCH 4.19.y 02/29] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC revisions Fabrizio Castro
2019-05-02 21:27   ` Pavel Machek
2019-05-03  9:34     ` Fabrizio Castro
2019-05-07  2:11       ` Nobuhiro Iwamatsu
2019-05-01 10:21 ` [cip-dev] [PATCH 4.19.y 03/29] iommu/ipmmu-vmsa: Hook up r8a774c0 DT matching code Fabrizio Castro
2019-05-01 10:21 ` [cip-dev] [PATCH 4.19.y 04/29] dt-bindings: iommu: ipmmu-vmsa: Add r8a774a1 support Fabrizio Castro
2019-05-01 10:21 ` [cip-dev] [PATCH 4.19.y 05/29] dt-bindings: iommu: ipmmu-vmsa: Add r8a774c0 support Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 06/29] arm64: dts: renesas: r8a774c0: Add IPMMU device nodes Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 07/29] media: rcar-vin: Add support for R-Car R8A77990 Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 08/29] media: rcar-vin: Add support for RZ/G2E Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 09/29] media: rcar-csi2: Add R8A77990 support Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 10/29] media: rcar: rcar-csi2: Update V3M/E3 PHTW tables Fabrizio Castro
2019-05-01 10:22 ` Fabrizio Castro [this message]
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 12/29] media: rcar-csi2: Fix PHTW table values for E3/V3M Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 13/29] media: rcar-csi2: Add support for RZ/G2E Fabrizio Castro
2019-05-02 21:29   ` Pavel Machek
2019-05-03  9:40     ` Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 14/29] media: dt-bindings: rcar-vin: Add R8A774C0 support Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 15/29] media: dt-bindings: rcar-csi2: Add r8a774c0 Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 16/29] arm64: dts: renesas: r8a774c0: Add VIN and CSI-2 device nodes Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 17/29] ASoC: rsnd: Add r8a774a1 support Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 18/29] ASoC: rsnd: Add r8a774c0 support Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 19/29] arm64: dts: renesas: r8a774c0: Add audio support Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 20/29] dt-bindings: pwm: rcar: Add r8a774a1 support Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 21/29] dt-bindings: pwm: rcar: Add r8a774c0 support Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 22/29] arm64: dts: renesas: r8a774c0: Add PWM support Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 23/29] arm64: dts: renesas: r8a774c0: Connect RZ/G2E SYS-DMAC to IPMMU Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 24/29] arm64: dts: renesas: r8a774c0: Connect RZ/G2E AVB " Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 25/29] arm64: dts: renesas: r8a774c0: Connect RZ/G2E Audio-DMAC " Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 26/29] thermal: rcar_thermal: add R8A774C0 support Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 27/29] dt-bindings: thermal: rcar-thermal: " Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 28/29] arm64: dts: renesas: r8a774c0: Add thermal support Fabrizio Castro
2019-05-01 10:22 ` [cip-dev] [PATCH 4.19.y 29/29] arm64: defconfig: Enable R-Car thermal driver Fabrizio Castro
2019-05-02 21:34   ` Pavel Machek
2019-05-03 10:25     ` Fabrizio Castro
2019-05-01 20:48 ` [cip-dev] [PATCH 4.19.y 00/29] Add further support for the RZ/G2M Pavel Machek
2019-05-02 21:32 ` Pavel Machek
2019-05-07  1:44   ` nobuhiro1.iwamatsu at toshiba.co.jp
2019-05-07  9:14 ` Chris Paterson
2019-05-07 14:38   ` Fabrizio Castro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1556706143-11898-12-git-send-email-fabrizio.castro@bp.renesas.com \
    --to=fabrizio.castro@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.