All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] media: rcar-vin: Add support for R-Car E3
@ 2018-11-05 11:19 Jacopo Mondi
  2018-11-05 11:19 ` [PATCH 1/6] media: dt-bindings: rcar-vin: Add R8A77990 support Jacopo Mondi
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Jacopo Mondi @ 2018-11-05 11:19 UTC (permalink / raw)
  To: niklas.soderlund, laurent.pinchart, kieran.bingham
  Cc: Jacopo Mondi, linux-media, linux-renesas-soc

Hello,
    this series add support for the R-Car E3 R8A77990 SoC to the rcar-vin
and rcar-csi2 driver.

Nothing new compared to v2, except for the last two patches, which updates
PHTW tables to the latest SoC manual revision, and add a SoC-specific number
of CSI-2 channels to handle the E3 case properly, as this is the only SoC
in mainline with a number of CSI-2 channels < 4.

Most patches are already reviewed-by and acked-by, so I expect this to
be easy to have accepted.

Tested on E3 Ebisu board capturing frames from the HDMI input in different
resolutions (up to 1280x800). Testing requires Niklas' series to allow using
a numer of data lanes < 4 for ADV748x, PFC and DTS updates.

A branch for testing is available at:
git://jmondi.org/linux ebisu/v4.20-rc1/test

Thanks
   j

Jacopo Mondi (6):
  media: dt-bindings: rcar-vin: Add R8A77990 support
  media: rcar-vin: Add support for R-Car R8A77990
  media: dt-bindings: rcar-csi2: Add R8A77990
  media: rcar-csi2: Add R8A77990 support
  media: rcar: rcar-csi2: Update V3M/E3 PHTW tables
  media: rcar-csi2: Handle per-SoC number of channels

 .../devicetree/bindings/media/rcar_vin.txt         |  1 +
 .../bindings/media/renesas,rcar-csi2.txt           |  1 +
 drivers/media/platform/rcar-vin/rcar-core.c        | 20 +++++
 drivers/media/platform/rcar-vin/rcar-csi2.c        | 95 ++++++++++++++--------
 4 files changed, 82 insertions(+), 35 deletions(-)

--
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/6] media: dt-bindings: rcar-vin: Add R8A77990 support
  2018-11-05 11:19 [PATCH 0/6] media: rcar-vin: Add support for R-Car E3 Jacopo Mondi
@ 2018-11-05 11:19 ` Jacopo Mondi
  2018-11-05 11:19 ` [PATCH 2/6] media: rcar-vin: Add support for R-Car R8A77990 Jacopo Mondi
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Jacopo Mondi @ 2018-11-05 11:19 UTC (permalink / raw)
  To: niklas.soderlund, laurent.pinchart, kieran.bingham
  Cc: Jacopo Mondi, linux-media, linux-renesas-soc, robh+dt, devicetree

Add compatible string for R-Car E3 R8A77990 to the list of SoCs supported by
rcar-vin driver.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 Documentation/devicetree/bindings/media/rcar_vin.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/media/rcar_vin.txt b/Documentation/devicetree/bindings/media/rcar_vin.txt
index d329a4e..7c878ca 100644
--- a/Documentation/devicetree/bindings/media/rcar_vin.txt
+++ b/Documentation/devicetree/bindings/media/rcar_vin.txt
@@ -24,6 +24,7 @@ on Gen3 platforms to a CSI-2 receiver.
    - "renesas,vin-r8a7796" for the R8A7796 device
    - "renesas,vin-r8a77965" for the R8A77965 device
    - "renesas,vin-r8a77970" for the R8A77970 device
+   - "renesas,vin-r8a77990" for the R8A77990 device
    - "renesas,vin-r8a77995" for the R8A77995 device
    - "renesas,rcar-gen2-vin" for a generic R-Car Gen2 or RZ/G1 compatible
      device.
--
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/6] media: rcar-vin: Add support for R-Car R8A77990
  2018-11-05 11:19 [PATCH 0/6] media: rcar-vin: Add support for R-Car E3 Jacopo Mondi
  2018-11-05 11:19 ` [PATCH 1/6] media: dt-bindings: rcar-vin: Add R8A77990 support Jacopo Mondi
@ 2018-11-05 11:19 ` Jacopo Mondi
  2018-11-05 11:19 ` [PATCH 3/6] media: dt-bindings: rcar-csi2: Add R8A77990 Jacopo Mondi
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Jacopo Mondi @ 2018-11-05 11:19 UTC (permalink / raw)
  To: niklas.soderlund, laurent.pinchart, kieran.bingham
  Cc: Jacopo Mondi, linux-media, linux-renesas-soc

Add R-Car E3 R8A77990 SoC to the rcar-vin supported ones.
Based on the experimental patch from Magnus Damm.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/platform/rcar-vin/rcar-core.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
index f476b2f..cae2166 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -1088,6 +1088,22 @@ static const struct rvin_info rcar_info_r8a77970 = {
 	.routes = rcar_info_r8a77970_routes,
 };
 
+static const struct rvin_group_route rcar_info_r8a77990_routes[] = {
+	{ .csi = RVIN_CSI40, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
+	{ .csi = RVIN_CSI40, .channel = 0, .vin = 5, .mask = BIT(2) },
+	{ .csi = RVIN_CSI40, .channel = 1, .vin = 4, .mask = BIT(2) },
+	{ .csi = RVIN_CSI40, .channel = 1, .vin = 5, .mask = BIT(1) | BIT(3) },
+	{ /* Sentinel */ }
+};
+
+static const struct rvin_info rcar_info_r8a77990 = {
+	.model = RCAR_GEN3,
+	.use_mc = true,
+	.max_width = 4096,
+	.max_height = 4096,
+	.routes = rcar_info_r8a77990_routes,
+};
+
 static const struct rvin_group_route rcar_info_r8a77995_routes[] = {
 	{ /* Sentinel */ }
 };
@@ -1146,6 +1162,10 @@ static const struct of_device_id rvin_of_id_table[] = {
 		.data = &rcar_info_r8a77970,
 	},
 	{
+		.compatible = "renesas,vin-r8a77990",
+		.data = &rcar_info_r8a77990,
+	},
+	{
 		.compatible = "renesas,vin-r8a77995",
 		.data = &rcar_info_r8a77995,
 	},
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/6] media: dt-bindings: rcar-csi2: Add R8A77990
  2018-11-05 11:19 [PATCH 0/6] media: rcar-vin: Add support for R-Car E3 Jacopo Mondi
  2018-11-05 11:19 ` [PATCH 1/6] media: dt-bindings: rcar-vin: Add R8A77990 support Jacopo Mondi
  2018-11-05 11:19 ` [PATCH 2/6] media: rcar-vin: Add support for R-Car R8A77990 Jacopo Mondi
@ 2018-11-05 11:19 ` Jacopo Mondi
  2018-11-05 11:19 ` [PATCH 4/6] media: rcar-csi2: Add R8A77990 support Jacopo Mondi
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Jacopo Mondi @ 2018-11-05 11:19 UTC (permalink / raw)
  To: niklas.soderlund, laurent.pinchart, kieran.bingham
  Cc: Jacopo Mondi, linux-media, linux-renesas-soc, robh+dt, devicetree

Add compatible string for R-Car E3 R8A77990 to the list of supported SoCs.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt b/Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt
index 2d385b6..2824489 100644
--- a/Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt
+++ b/Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt
@@ -12,6 +12,7 @@ Mandatory properties
    - "renesas,r8a7796-csi2" for the R8A7796 device.
    - "renesas,r8a77965-csi2" for the R8A77965 device.
    - "renesas,r8a77970-csi2" for the R8A77970 device.
+   - "renesas,r8a77990-csi2" for the R8A77990 device.

  - reg: the register base and size for the device registers
  - interrupts: the interrupt for the device
--
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/6] media: rcar-csi2: Add R8A77990 support
  2018-11-05 11:19 [PATCH 0/6] media: rcar-vin: Add support for R-Car E3 Jacopo Mondi
                   ` (2 preceding siblings ...)
  2018-11-05 11:19 ` [PATCH 3/6] media: dt-bindings: rcar-csi2: Add R8A77990 Jacopo Mondi
@ 2018-11-05 11:19 ` Jacopo Mondi
  2018-11-05 11:19 ` [PATCH 5/6] media: rcar: rcar-csi2: Update V3M/E3 PHTW tables Jacopo Mondi
  2018-11-05 11:19 ` [PATCH 6/6] media: rcar-csi2: Handle per-SoC number of channels Jacopo Mondi
  5 siblings, 0 replies; 9+ messages in thread
From: Jacopo Mondi @ 2018-11-05 11:19 UTC (permalink / raw)
  To: niklas.soderlund, laurent.pinchart, kieran.bingham
  Cc: Jacopo Mondi, linux-media, linux-renesas-soc

Add support for R-Car E3 R8A77965 to R-Car CSI-2 driver.
Based on the experimental patch from Magnus Damm.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/platform/rcar-vin/rcar-csi2.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c
index b0044a0..695686b 100644
--- a/drivers/media/platform/rcar-vin/rcar-csi2.c
+++ b/drivers/media/platform/rcar-vin/rcar-csi2.c
@@ -963,6 +963,11 @@ static const struct rcar_csi2_info rcar_csi2_info_r8a77970 = {
 	.confirm_start = rcsi2_confirm_start_v3m_e3,
 };
 
+static const struct rcar_csi2_info rcar_csi2_info_r8a77990 = {
+	.init_phtw = rcsi2_init_phtw_v3m_e3,
+	.confirm_start = rcsi2_confirm_start_v3m_e3,
+};
+
 static const struct of_device_id rcar_csi2_of_table[] = {
 	{
 		.compatible = "renesas,r8a7795-csi2",
@@ -980,6 +985,10 @@ static const struct of_device_id rcar_csi2_of_table[] = {
 		.compatible = "renesas,r8a77970-csi2",
 		.data = &rcar_csi2_info_r8a77970,
 	},
+	{
+		.compatible = "renesas,r8a77990-csi2",
+		.data = &rcar_csi2_info_r8a77990,
+	},
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, rcar_csi2_of_table);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/6] media: rcar: rcar-csi2: Update V3M/E3 PHTW tables
  2018-11-05 11:19 [PATCH 0/6] media: rcar-vin: Add support for R-Car E3 Jacopo Mondi
                   ` (3 preceding siblings ...)
  2018-11-05 11:19 ` [PATCH 4/6] media: rcar-csi2: Add R8A77990 support Jacopo Mondi
@ 2018-11-05 11:19 ` Jacopo Mondi
  2018-11-05 11:54   ` Laurent Pinchart
  2018-11-05 11:19 ` [PATCH 6/6] media: rcar-csi2: Handle per-SoC number of channels Jacopo Mondi
  5 siblings, 1 reply; 9+ messages in thread
From: Jacopo Mondi @ 2018-11-05 11:19 UTC (permalink / raw)
  To: niklas.soderlund, laurent.pinchart, kieran.bingham
  Cc: Jacopo Mondi, linux-media, linux-renesas-soc

Update PHTW tables for V3M and E3 SoCs to the latest datasheet release.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/platform/rcar-vin/rcar-csi2.c | 71 ++++++++++++++++-------------
 1 file changed, 39 insertions(+), 32 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c
index 695686b..5689a60 100644
--- a/drivers/media/platform/rcar-vin/rcar-csi2.c
+++ b/drivers/media/platform/rcar-vin/rcar-csi2.c
@@ -152,38 +152,45 @@ static const struct rcsi2_mbps_reg phtw_mbps_h3_v3h_m3n[] = {
 };
 
 static const struct rcsi2_mbps_reg phtw_mbps_v3m_e3[] = {
-	{ .mbps =   80, .reg = 0x00 },
-	{ .mbps =   90, .reg = 0x20 },
-	{ .mbps =  100, .reg = 0x40 },
-	{ .mbps =  110, .reg = 0x02 },
-	{ .mbps =  130, .reg = 0x22 },
-	{ .mbps =  140, .reg = 0x42 },
-	{ .mbps =  150, .reg = 0x04 },
-	{ .mbps =  170, .reg = 0x24 },
-	{ .mbps =  180, .reg = 0x44 },
-	{ .mbps =  200, .reg = 0x06 },
-	{ .mbps =  220, .reg = 0x26 },
-	{ .mbps =  240, .reg = 0x46 },
-	{ .mbps =  250, .reg = 0x08 },
-	{ .mbps =  270, .reg = 0x28 },
-	{ .mbps =  300, .reg = 0x0a },
-	{ .mbps =  330, .reg = 0x2a },
-	{ .mbps =  360, .reg = 0x4a },
-	{ .mbps =  400, .reg = 0x0c },
-	{ .mbps =  450, .reg = 0x2c },
-	{ .mbps =  500, .reg = 0x0e },
-	{ .mbps =  550, .reg = 0x2e },
-	{ .mbps =  600, .reg = 0x10 },
-	{ .mbps =  650, .reg = 0x30 },
-	{ .mbps =  700, .reg = 0x12 },
-	{ .mbps =  750, .reg = 0x32 },
-	{ .mbps =  800, .reg = 0x52 },
-	{ .mbps =  850, .reg = 0x72 },
-	{ .mbps =  900, .reg = 0x14 },
-	{ .mbps =  950, .reg = 0x34 },
-	{ .mbps = 1000, .reg = 0x54 },
-	{ .mbps = 1050, .reg = 0x74 },
-	{ .mbps = 1125, .reg = 0x16 },
+	{ .mbps =   89, .reg = 0x00 },
+	{ .mbps =   99, .reg = 0x20 },
+	{ .mbps =  109, .reg = 0x40 },
+	{ .mbps =  129, .reg = 0x02 },
+	{ .mbps =  139, .reg = 0x22 },
+	{ .mbps =  149, .reg = 0x42 },
+	{ .mbps =  169, .reg = 0x04 },
+	{ .mbps =  179, .reg = 0x24 },
+	{ .mbps =  199, .reg = 0x44 },
+	{ .mbps =  219, .reg = 0x06 },
+	{ .mbps =  239, .reg = 0x26 },
+	{ .mbps =  249, .reg = 0x46 },
+	{ .mbps =  269, .reg = 0x08 },
+	{ .mbps =  299, .reg = 0x28 },
+	{ .mbps =  329, .reg = 0x0a },
+	{ .mbps =  359, .reg = 0x2a },
+	{ .mbps =  399, .reg = 0x4a },
+	{ .mbps =  449, .reg = 0x0c },
+	{ .mbps =  499, .reg = 0x2c },
+	{ .mbps =  549, .reg = 0x0e },
+	{ .mbps =  599, .reg = 0x2e },
+	{ .mbps =  649, .reg = 0x10 },
+	{ .mbps =  699, .reg = 0x30 },
+	{ .mbps =  749, .reg = 0x12 },
+	{ .mbps =  799, .reg = 0x32 },
+	{ .mbps =  849, .reg = 0x52 },
+	{ .mbps =  899, .reg = 0x72 },
+	{ .mbps =  949, .reg = 0x14 },
+	{ .mbps =  999, .reg = 0x34 },
+	{ .mbps = 1049, .reg = 0x54 },
+	{ .mbps = 1099, .reg = 0x74 },
+	{ .mbps = 1149, .reg = 0x16 },
+	{ .mbps = 1199, .reg = 0x36 },
+	{ .mbps = 1249, .reg = 0x56 },
+	{ .mbps = 1299, .reg = 0x76 },
+	{ .mbps = 1349, .reg = 0x18 },
+	{ .mbps = 1399, .reg = 0x38 },
+	{ .mbps = 1449, .reg = 0x58 },
+	{ .mbps = 1500, .reg = 0x78 },
 	{ /* sentinel */ },
 };
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/6] media: rcar-csi2: Handle per-SoC number of channels
  2018-11-05 11:19 [PATCH 0/6] media: rcar-vin: Add support for R-Car E3 Jacopo Mondi
                   ` (4 preceding siblings ...)
  2018-11-05 11:19 ` [PATCH 5/6] media: rcar: rcar-csi2: Update V3M/E3 PHTW tables Jacopo Mondi
@ 2018-11-05 11:19 ` Jacopo Mondi
  2018-11-05 11:41   ` Laurent Pinchart
  5 siblings, 1 reply; 9+ messages in thread
From: Jacopo Mondi @ 2018-11-05 11:19 UTC (permalink / raw)
  To: niklas.soderlund, laurent.pinchart, kieran.bingham
  Cc: Jacopo Mondi, linux-media, linux-renesas-soc

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.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 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 5689a60..95a3dd4 100644
--- a/drivers/media/platform/rcar-vin/rcar-csi2.c
+++ b/drivers/media/platform/rcar-vin/rcar-csi2.c
@@ -349,6 +349,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;
 };
 
@@ -483,13 +484,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 |
@@ -518,7 +520,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) |
@@ -947,32 +950,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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 6/6] media: rcar-csi2: Handle per-SoC number of channels
  2018-11-05 11:19 ` [PATCH 6/6] media: rcar-csi2: Handle per-SoC number of channels Jacopo Mondi
@ 2018-11-05 11:41   ` Laurent Pinchart
  0 siblings, 0 replies; 9+ messages in thread
From: Laurent Pinchart @ 2018-11-05 11:41 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: niklas.soderlund, kieran.bingham, linux-media, linux-renesas-soc

Hi Jacopo,

Thank you for the patch.

On Monday, 5 November 2018 13:19:11 EET Jacopo Mondi wrote:
> 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.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  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 5689a60..95a3dd4 100644
> --- a/drivers/media/platform/rcar-vin/rcar-csi2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c
> @@ -349,6 +349,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;
>  };
> 
> @@ -483,13 +484,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 |
> @@ -518,7 +520,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)

I would write this as

	if (priv->info->num_channels > 2)

in order to later support configuration of virtual channels and data types 
that could result in the output channels 2 and 3 being disabled.

Apart from this,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +		rcsi2_write(priv, VCDT2_REG, vcdt2);
>  	/* Lanes are zero indexed. */
>  	rcsi2_write(priv, LSWAP_REG,
>  		    LSWAP_L0SEL(priv->lane_swap[0] - 1) |
> @@ -947,32 +950,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[] = {

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 5/6] media: rcar: rcar-csi2: Update V3M/E3 PHTW tables
  2018-11-05 11:19 ` [PATCH 5/6] media: rcar: rcar-csi2: Update V3M/E3 PHTW tables Jacopo Mondi
@ 2018-11-05 11:54   ` Laurent Pinchart
  0 siblings, 0 replies; 9+ messages in thread
From: Laurent Pinchart @ 2018-11-05 11:54 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: niklas.soderlund, kieran.bingham, linux-media, linux-renesas-soc

Hi Jacopo,

Thank you for the patch.

On Monday, 5 November 2018 13:19:10 EET Jacopo Mondi wrote:
> Update PHTW tables for V3M and E3 SoCs to the latest datasheet release.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  drivers/media/platform/rcar-vin/rcar-csi2.c | 71 +++++++++++++++-----------
>  1 file changed, 39 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c
> b/drivers/media/platform/rcar-vin/rcar-csi2.c index 695686b..5689a60 100644
> --- a/drivers/media/platform/rcar-vin/rcar-csi2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c
> @@ -152,38 +152,45 @@ static const struct rcsi2_mbps_reg
> phtw_mbps_h3_v3h_m3n[] = { };
> 
>  static const struct rcsi2_mbps_reg phtw_mbps_v3m_e3[] = {
> -	{ .mbps =   80, .reg = 0x00 },
> -	{ .mbps =   90, .reg = 0x20 },
> -	{ .mbps =  100, .reg = 0x40 },
> -	{ .mbps =  110, .reg = 0x02 },
> -	{ .mbps =  130, .reg = 0x22 },
> -	{ .mbps =  140, .reg = 0x42 },
> -	{ .mbps =  150, .reg = 0x04 },
> -	{ .mbps =  170, .reg = 0x24 },
> -	{ .mbps =  180, .reg = 0x44 },
> -	{ .mbps =  200, .reg = 0x06 },
> -	{ .mbps =  220, .reg = 0x26 },
> -	{ .mbps =  240, .reg = 0x46 },
> -	{ .mbps =  250, .reg = 0x08 },
> -	{ .mbps =  270, .reg = 0x28 },
> -	{ .mbps =  300, .reg = 0x0a },
> -	{ .mbps =  330, .reg = 0x2a },
> -	{ .mbps =  360, .reg = 0x4a },
> -	{ .mbps =  400, .reg = 0x0c },
> -	{ .mbps =  450, .reg = 0x2c },
> -	{ .mbps =  500, .reg = 0x0e },
> -	{ .mbps =  550, .reg = 0x2e },
> -	{ .mbps =  600, .reg = 0x10 },
> -	{ .mbps =  650, .reg = 0x30 },
> -	{ .mbps =  700, .reg = 0x12 },
> -	{ .mbps =  750, .reg = 0x32 },
> -	{ .mbps =  800, .reg = 0x52 },
> -	{ .mbps =  850, .reg = 0x72 },
> -	{ .mbps =  900, .reg = 0x14 },
> -	{ .mbps =  950, .reg = 0x34 },
> -	{ .mbps = 1000, .reg = 0x54 },
> -	{ .mbps = 1050, .reg = 0x74 },
> -	{ .mbps = 1125, .reg = 0x16 },
> +	{ .mbps =   89, .reg = 0x00 },
> +	{ .mbps =   99, .reg = 0x20 },
> +	{ .mbps =  109, .reg = 0x40 },
> +	{ .mbps =  129, .reg = 0x02 },
> +	{ .mbps =  139, .reg = 0x22 },
> +	{ .mbps =  149, .reg = 0x42 },
> +	{ .mbps =  169, .reg = 0x04 },
> +	{ .mbps =  179, .reg = 0x24 },
> +	{ .mbps =  199, .reg = 0x44 },
> +	{ .mbps =  219, .reg = 0x06 },
> +	{ .mbps =  239, .reg = 0x26 },
> +	{ .mbps =  249, .reg = 0x46 },
> +	{ .mbps =  269, .reg = 0x08 },
> +	{ .mbps =  299, .reg = 0x28 },
> +	{ .mbps =  329, .reg = 0x0a },
> +	{ .mbps =  359, .reg = 0x2a },
> +	{ .mbps =  399, .reg = 0x4a },
> +	{ .mbps =  449, .reg = 0x0c },
> +	{ .mbps =  499, .reg = 0x2c },
> +	{ .mbps =  549, .reg = 0x0e },
> +	{ .mbps =  599, .reg = 0x2e },
> +	{ .mbps =  649, .reg = 0x10 },
> +	{ .mbps =  699, .reg = 0x30 },
> +	{ .mbps =  749, .reg = 0x12 },
> +	{ .mbps =  799, .reg = 0x32 },
> +	{ .mbps =  849, .reg = 0x52 },
> +	{ .mbps =  899, .reg = 0x72 },
> +	{ .mbps =  949, .reg = 0x14 },
> +	{ .mbps =  999, .reg = 0x34 },
> +	{ .mbps = 1049, .reg = 0x54 },
> +	{ .mbps = 1099, .reg = 0x74 },
> +	{ .mbps = 1149, .reg = 0x16 },
> +	{ .mbps = 1199, .reg = 0x36 },
> +	{ .mbps = 1249, .reg = 0x56 },
> +	{ .mbps = 1299, .reg = 0x76 },
> +	{ .mbps = 1349, .reg = 0x18 },
> +	{ .mbps = 1399, .reg = 0x38 },
> +	{ .mbps = 1449, .reg = 0x58 },
> +	{ .mbps = 1500, .reg = 0x78 },
>  	{ /* sentinel */ },
>  };

In the latest datasheet version I can find, the frequencies go up to 1125 MHz 
only. I've verified values up to that point, but not beyond it.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-11-05 21:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05 11:19 [PATCH 0/6] media: rcar-vin: Add support for R-Car E3 Jacopo Mondi
2018-11-05 11:19 ` [PATCH 1/6] media: dt-bindings: rcar-vin: Add R8A77990 support Jacopo Mondi
2018-11-05 11:19 ` [PATCH 2/6] media: rcar-vin: Add support for R-Car R8A77990 Jacopo Mondi
2018-11-05 11:19 ` [PATCH 3/6] media: dt-bindings: rcar-csi2: Add R8A77990 Jacopo Mondi
2018-11-05 11:19 ` [PATCH 4/6] media: rcar-csi2: Add R8A77990 support Jacopo Mondi
2018-11-05 11:19 ` [PATCH 5/6] media: rcar: rcar-csi2: Update V3M/E3 PHTW tables Jacopo Mondi
2018-11-05 11:54   ` Laurent Pinchart
2018-11-05 11:19 ` [PATCH 6/6] media: rcar-csi2: Handle per-SoC number of channels Jacopo Mondi
2018-11-05 11:41   ` Laurent Pinchart

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.