public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] media: rcar: Minor cleanups and improvements
@ 2025-01-20 13:10 Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 01/10] media: rcar-csi2: Move Y8 entry to a better place Tomi Valkeinen
                   ` (10 more replies)
  0 siblings, 11 replies; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-20 13:10 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tomi Valkeinen

I've started looking at multi-stream support, and came up with these
while working towards streams.

 Tomi

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
Tomi Valkeinen (10):
      media: rcar-csi2: Move Y8 entry to a better place
      media: rcar-csi2: Add RAW10 and RAW12 formats
      media: rcar-isp: Add RAW8, RAW10 and RAW12 formats
      media: rcar-csi2: Use v4l2_get_link_freq()
      media: rcar-vin: Use v4l2_subdev_{enable|disable}_streams()
      media: rcar-isp: Use v4l2_subdev_{enable|disable}_streams()
      media: rcar-csi2: Use v4l2_subdev_{enable|disable}_streams()
      media: rcar-isp: Convert to subdev state
      media: rcar-isp: Convert to .{enable|disable}_streams
      media: rcar-csi2: Convert to .{enable|disable}_streams

 drivers/media/platform/renesas/rcar-csi2.c         | 118 ++++++++++-----
 drivers/media/platform/renesas/rcar-isp.c          | 162 +++++++++++++--------
 drivers/media/platform/renesas/rcar-vin/rcar-dma.c |   4 +-
 3 files changed, 190 insertions(+), 94 deletions(-)
---
base-commit: 94794b5ce4d90ab134b0b101a02fddf6e74c437d
change-id: 20250120-rcar-media-impro-2c37c1036e19

Best regards,
-- 
Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>


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

* [PATCH 01/10] media: rcar-csi2: Move Y8 entry to a better place
  2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
@ 2025-01-20 13:10 ` Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 02/10] media: rcar-csi2: Add RAW10 and RAW12 formats Tomi Valkeinen
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-20 13:10 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tomi Valkeinen

Move the Y8 entry before Y10, so that the entries are in a bit more
logical order.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/platform/renesas/rcar-csi2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
index 0a53dd47d7bf..be930ebca3f5 100644
--- a/drivers/media/platform/renesas/rcar-csi2.c
+++ b/drivers/media/platform/renesas/rcar-csi2.c
@@ -636,6 +636,10 @@ static const struct rcar_csi2_format rcar_csi2_formats[] = {
 		.code = MEDIA_BUS_FMT_YUYV10_2X10,
 		.datatype = MIPI_CSI2_DT_YUV422_8B,
 		.bpp = 20,
+	}, {
+		.code = MEDIA_BUS_FMT_Y8_1X8,
+		.datatype = MIPI_CSI2_DT_RAW8,
+		.bpp = 8,
 	}, {
 		.code = MEDIA_BUS_FMT_Y10_1X10,
 		.datatype = MIPI_CSI2_DT_RAW10,
@@ -656,10 +660,6 @@ static const struct rcar_csi2_format rcar_csi2_formats[] = {
 		.code = MEDIA_BUS_FMT_SRGGB8_1X8,
 		.datatype = MIPI_CSI2_DT_RAW8,
 		.bpp = 8,
-	}, {
-		.code = MEDIA_BUS_FMT_Y8_1X8,
-		.datatype = MIPI_CSI2_DT_RAW8,
-		.bpp = 8,
 	},
 };
 

-- 
2.43.0


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

* [PATCH 02/10] media: rcar-csi2: Add RAW10 and RAW12 formats
  2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 01/10] media: rcar-csi2: Move Y8 entry to a better place Tomi Valkeinen
@ 2025-01-20 13:10 ` Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 03/10] media: rcar-isp: Add RAW8, " Tomi Valkeinen
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-20 13:10 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tomi Valkeinen

Add RAW10 and RAW12 formats. We only need to add the entries to the
rcar_csi2_format list.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/platform/renesas/rcar-csi2.c | 32 ++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
index be930ebca3f5..52d4e333c735 100644
--- a/drivers/media/platform/renesas/rcar-csi2.c
+++ b/drivers/media/platform/renesas/rcar-csi2.c
@@ -660,6 +660,38 @@ static const struct rcar_csi2_format rcar_csi2_formats[] = {
 		.code = MEDIA_BUS_FMT_SRGGB8_1X8,
 		.datatype = MIPI_CSI2_DT_RAW8,
 		.bpp = 8,
+	}, {
+		.code = MEDIA_BUS_FMT_SBGGR10_1X10,
+		.datatype = MIPI_CSI2_DT_RAW10,
+		.bpp = 10,
+	}, {
+		.code = MEDIA_BUS_FMT_SGBRG10_1X10,
+		.datatype = MIPI_CSI2_DT_RAW10,
+		.bpp = 10,
+	}, {
+		.code = MEDIA_BUS_FMT_SGRBG10_1X10,
+		.datatype = MIPI_CSI2_DT_RAW10,
+		.bpp = 10,
+	}, {
+		.code = MEDIA_BUS_FMT_SRGGB10_1X10,
+		.datatype = MIPI_CSI2_DT_RAW10,
+		.bpp = 10,
+	}, {
+		.code = MEDIA_BUS_FMT_SBGGR12_1X12,
+		.datatype = MIPI_CSI2_DT_RAW12,
+		.bpp = 12,
+	}, {
+		.code = MEDIA_BUS_FMT_SGBRG12_1X12,
+		.datatype = MIPI_CSI2_DT_RAW12,
+		.bpp = 12,
+	}, {
+		.code = MEDIA_BUS_FMT_SGRBG12_1X12,
+		.datatype = MIPI_CSI2_DT_RAW12,
+		.bpp = 12,
+	}, {
+		.code = MEDIA_BUS_FMT_SRGGB12_1X12,
+		.datatype = MIPI_CSI2_DT_RAW12,
+		.bpp = 12,
 	},
 };
 

-- 
2.43.0


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

* [PATCH 03/10] media: rcar-isp: Add RAW8, RAW10 and RAW12 formats
  2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 01/10] media: rcar-csi2: Move Y8 entry to a better place Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 02/10] media: rcar-csi2: Add RAW10 and RAW12 formats Tomi Valkeinen
@ 2025-01-20 13:10 ` Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 04/10] media: rcar-csi2: Use v4l2_get_link_freq() Tomi Valkeinen
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-20 13:10 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tomi Valkeinen

Add RAW8, RAW10 and RAW12 formats.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/platform/renesas/rcar-isp.c | 48 +++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/media/platform/renesas/rcar-isp.c b/drivers/media/platform/renesas/rcar-isp.c
index c515278e3be5..121fa7524ee1 100644
--- a/drivers/media/platform/renesas/rcar-isp.c
+++ b/drivers/media/platform/renesas/rcar-isp.c
@@ -76,6 +76,54 @@ static const struct rcar_isp_format rcar_isp_formats[] = {
 		.code = MEDIA_BUS_FMT_YUYV10_2X10,
 		.datatype = MIPI_CSI2_DT_YUV422_8B,
 		.procmode = 0x0c,
+	}, {
+		.code = MEDIA_BUS_FMT_SBGGR8_1X8,
+		.datatype = MIPI_CSI2_DT_RAW8,
+		.procmode = 0x00,
+	}, {
+		.code = MEDIA_BUS_FMT_SGBRG8_1X8,
+		.datatype = MIPI_CSI2_DT_RAW8,
+		.procmode = 0x00,
+	}, {
+		.code = MEDIA_BUS_FMT_SGRBG8_1X8,
+		.datatype = MIPI_CSI2_DT_RAW8,
+		.procmode = 0x00,
+	}, {
+		.code = MEDIA_BUS_FMT_SRGGB8_1X8,
+		.datatype = MIPI_CSI2_DT_RAW8,
+		.procmode = 0x00,
+	}, {
+		.code = MEDIA_BUS_FMT_SBGGR10_1X10,
+		.datatype = MIPI_CSI2_DT_RAW10,
+		.procmode = 0x01,
+	}, {
+		.code = MEDIA_BUS_FMT_SGBRG10_1X10,
+		.datatype = MIPI_CSI2_DT_RAW10,
+		.procmode = 0x01,
+	}, {
+		.code = MEDIA_BUS_FMT_SGRBG10_1X10,
+		.datatype = MIPI_CSI2_DT_RAW10,
+		.procmode = 0x01,
+	}, {
+		.code = MEDIA_BUS_FMT_SRGGB10_1X10,
+		.datatype = MIPI_CSI2_DT_RAW10,
+		.procmode = 0x01,
+	}, {
+		.code = MEDIA_BUS_FMT_SBGGR12_1X12,
+		.datatype = MIPI_CSI2_DT_RAW12,
+		.procmode = 0x02,
+	}, {
+		.code = MEDIA_BUS_FMT_SGBRG12_1X12,
+		.datatype = MIPI_CSI2_DT_RAW12,
+		.procmode = 0x02,
+	}, {
+		.code = MEDIA_BUS_FMT_SGRBG12_1X12,
+		.datatype = MIPI_CSI2_DT_RAW12,
+		.procmode = 0x02,
+	}, {
+		.code = MEDIA_BUS_FMT_SRGGB12_1X12,
+		.datatype = MIPI_CSI2_DT_RAW12,
+		.procmode = 0x02,
 	},
 };
 

-- 
2.43.0


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

* [PATCH 04/10] media: rcar-csi2: Use v4l2_get_link_freq()
  2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
                   ` (2 preceding siblings ...)
  2025-01-20 13:10 ` [PATCH 03/10] media: rcar-isp: Add RAW8, " Tomi Valkeinen
@ 2025-01-20 13:10 ` Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 05/10] media: rcar-vin: Use v4l2_subdev_{enable|disable}_streams() Tomi Valkeinen
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-20 13:10 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tomi Valkeinen

Instead of directly using V4L2_CID_PIXEL_RATE and calculating the mbps
from that, use v4l2_get_link_freq(), which also supports
V4L2_CID_LINK_FREQ.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/platform/renesas/rcar-csi2.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
index 52d4e333c735..84e6194fed6c 100644
--- a/drivers/media/platform/renesas/rcar-csi2.c
+++ b/drivers/media/platform/renesas/rcar-csi2.c
@@ -8,6 +8,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
+#include <linux/math64.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_graph.h>
@@ -15,6 +16,7 @@
 #include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/sys_soc.h>
+#include <linux/units.h>
 
 #include <media/mipi-csi2.h>
 #include <media/v4l2-ctrls.h>
@@ -953,7 +955,7 @@ static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
 			   unsigned int lanes)
 {
 	struct v4l2_subdev *source;
-	struct v4l2_ctrl *ctrl;
+	s64 freq;
 	u64 mbps;
 
 	if (!priv->remote)
@@ -961,21 +963,17 @@ static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp,
 
 	source = priv->remote;
 
-	/* Read the pixel rate control from remote. */
-	ctrl = v4l2_ctrl_find(source->ctrl_handler, V4L2_CID_PIXEL_RATE);
-	if (!ctrl) {
-		dev_err(priv->dev, "no pixel rate control in subdev %s\n",
-			source->name);
-		return -EINVAL;
+	freq = v4l2_get_link_freq(source->ctrl_handler, bpp, 2 * lanes);
+	if (freq < 0) {
+		int ret = (int)freq;
+
+		dev_err(priv->dev, "failed to get link freq for %s: %d\n",
+			source->name, ret);
+
+		return ret;
 	}
 
-	/*
-	 * Calculate the phypll in mbps.
-	 * link_freq = (pixel_rate * bits_per_sample) / (2 * nr_of_lanes)
-	 * bps = link_freq * 2
-	 */
-	mbps = v4l2_ctrl_g_ctrl_int64(ctrl) * bpp;
-	do_div(mbps, lanes * 1000000);
+	mbps = div_u64(freq * 2, MEGA);
 
 	/* Adjust for C-PHY, divide by 2.8. */
 	if (priv->cphy)

-- 
2.43.0


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

* [PATCH 05/10] media: rcar-vin: Use v4l2_subdev_{enable|disable}_streams()
  2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
                   ` (3 preceding siblings ...)
  2025-01-20 13:10 ` [PATCH 04/10] media: rcar-csi2: Use v4l2_get_link_freq() Tomi Valkeinen
@ 2025-01-20 13:10 ` Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 06/10] media: rcar-isp: " Tomi Valkeinen
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-20 13:10 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tomi Valkeinen

Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream
op directly. This allows the called subdev to drop the legacy s_stream
op.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
index 8773998101ff..8de871240440 100644
--- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
+++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c
@@ -1397,7 +1397,7 @@ static int rvin_set_stream(struct rvin_dev *vin, int on)
 
 	if (!on) {
 		video_device_pipeline_stop(&vin->vdev);
-		return v4l2_subdev_call(sd, video, s_stream, 0);
+		return v4l2_subdev_disable_streams(sd, pad->index, BIT_ULL(0));
 	}
 
 	ret = rvin_mc_validate_format(vin, sd, pad);
@@ -1408,7 +1408,7 @@ static int rvin_set_stream(struct rvin_dev *vin, int on)
 	if (ret)
 		return ret;
 
-	ret = v4l2_subdev_call(sd, video, s_stream, 1);
+	ret = v4l2_subdev_enable_streams(sd, pad->index, BIT_ULL(0));
 	if (ret == -ENOIOCTLCMD)
 		ret = 0;
 	if (ret)

-- 
2.43.0


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

* [PATCH 06/10] media: rcar-isp: Use v4l2_subdev_{enable|disable}_streams()
  2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
                   ` (4 preceding siblings ...)
  2025-01-20 13:10 ` [PATCH 05/10] media: rcar-vin: Use v4l2_subdev_{enable|disable}_streams() Tomi Valkeinen
@ 2025-01-20 13:10 ` Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 07/10] media: rcar-csi2: " Tomi Valkeinen
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-20 13:10 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tomi Valkeinen

Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream
op directly. This allows the called subdev to drop the legacy s_stream
op.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/platform/renesas/rcar-isp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/renesas/rcar-isp.c b/drivers/media/platform/renesas/rcar-isp.c
index 121fa7524ee1..385fafb2318f 100644
--- a/drivers/media/platform/renesas/rcar-isp.c
+++ b/drivers/media/platform/renesas/rcar-isp.c
@@ -169,6 +169,7 @@ struct rcar_isp {
 
 	struct v4l2_async_notifier notifier;
 	struct v4l2_subdev *remote;
+	unsigned int remote_pad;
 
 	struct mutex lock; /* Protects mf and stream_count. */
 	struct v4l2_mbus_framefmt mf;
@@ -267,7 +268,8 @@ static int risp_start(struct rcar_isp *isp)
 	/* Start ISP. */
 	risp_write(isp, ISPSTART_REG, ISPSTART_START);
 
-	ret = v4l2_subdev_call(isp->remote, video, s_stream, 1);
+	ret = v4l2_subdev_enable_streams(isp->remote, isp->remote_pad,
+					 BIT_ULL(0));
 	if (ret)
 		risp_power_off(isp);
 
@@ -276,7 +278,7 @@ static int risp_start(struct rcar_isp *isp)
 
 static void risp_stop(struct rcar_isp *isp)
 {
-	v4l2_subdev_call(isp->remote, video, s_stream, 0);
+	v4l2_subdev_disable_streams(isp->remote, isp->remote_pad, BIT_ULL(0));
 
 	/* Stop ISP. */
 	risp_write(isp, ISPSTART_REG, ISPSTART_STOP);
@@ -387,6 +389,7 @@ static int risp_notify_bound(struct v4l2_async_notifier *notifier,
 	}
 
 	isp->remote = subdev;
+	isp->remote_pad = pad;
 
 	dev_dbg(isp->dev, "Bound %s pad: %d\n", subdev->name, pad);
 

-- 
2.43.0


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

* [PATCH 07/10] media: rcar-csi2: Use v4l2_subdev_{enable|disable}_streams()
  2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
                   ` (5 preceding siblings ...)
  2025-01-20 13:10 ` [PATCH 06/10] media: rcar-isp: " Tomi Valkeinen
@ 2025-01-20 13:10 ` Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 08/10] media: rcar-isp: Convert to subdev state Tomi Valkeinen
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-20 13:10 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tomi Valkeinen

Use v4l2_subdev_{enable|disable}_streams() instead of calling s_stream
op directly. This allows the called subdev to drop the legacy s_stream
op.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/platform/renesas/rcar-csi2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
index 84e6194fed6c..ff27a8845969 100644
--- a/drivers/media/platform/renesas/rcar-csi2.c
+++ b/drivers/media/platform/renesas/rcar-csi2.c
@@ -1577,7 +1577,8 @@ static int rcsi2_start(struct rcar_csi2 *priv, struct v4l2_subdev_state *state)
 		return ret;
 	}
 
-	ret = v4l2_subdev_call(priv->remote, video, s_stream, 1);
+	ret = v4l2_subdev_enable_streams(priv->remote, priv->remote_pad,
+					 BIT_ULL(0));
 	if (ret) {
 		rcsi2_enter_standby(priv);
 		return ret;
@@ -1589,7 +1590,7 @@ static int rcsi2_start(struct rcar_csi2 *priv, struct v4l2_subdev_state *state)
 static void rcsi2_stop(struct rcar_csi2 *priv)
 {
 	rcsi2_enter_standby(priv);
-	v4l2_subdev_call(priv->remote, video, s_stream, 0);
+	v4l2_subdev_disable_streams(priv->remote, priv->remote_pad, BIT_ULL(0));
 }
 
 static int rcsi2_s_stream(struct v4l2_subdev *sd, int enable)

-- 
2.43.0


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

* [PATCH 08/10] media: rcar-isp: Convert to subdev state
  2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
                   ` (6 preceding siblings ...)
  2025-01-20 13:10 ` [PATCH 07/10] media: rcar-csi2: " Tomi Valkeinen
@ 2025-01-20 13:10 ` Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 09/10] media: rcar-isp: Convert to .{enable|disable}_streams Tomi Valkeinen
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-20 13:10 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tomi Valkeinen

Convert to subdev state. This allows us to drop the internal mutex and
risp_get_pad_format(), and add streams support in the future.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/platform/renesas/rcar-isp.c | 70 ++++++++++++-------------------
 1 file changed, 27 insertions(+), 43 deletions(-)

diff --git a/drivers/media/platform/renesas/rcar-isp.c b/drivers/media/platform/renesas/rcar-isp.c
index 385fafb2318f..d4eaabb45e07 100644
--- a/drivers/media/platform/renesas/rcar-isp.c
+++ b/drivers/media/platform/renesas/rcar-isp.c
@@ -171,8 +171,6 @@ struct rcar_isp {
 	struct v4l2_subdev *remote;
 	unsigned int remote_pad;
 
-	struct mutex lock; /* Protects mf and stream_count. */
-	struct v4l2_mbus_framefmt mf;
 	int stream_count;
 };
 
@@ -219,14 +217,19 @@ static void risp_power_off(struct rcar_isp *isp)
 	pm_runtime_put(isp->dev);
 }
 
-static int risp_start(struct rcar_isp *isp)
+static int risp_start(struct rcar_isp *isp, struct v4l2_subdev_state *state)
 {
+	const struct v4l2_mbus_framefmt *fmt;
 	const struct rcar_isp_format *format;
 	unsigned int vc;
 	u32 sel_csi = 0;
 	int ret;
 
-	format = risp_code_to_fmt(isp->mf.code);
+	fmt = v4l2_subdev_state_get_format(state, RCAR_ISP_SINK);
+	if (!fmt)
+		return -EINVAL;
+
+	format = risp_code_to_fmt(fmt->code);
 	if (!format) {
 		dev_err(isp->dev, "Unsupported bus format\n");
 		return -EINVAL;
@@ -289,9 +292,10 @@ static void risp_stop(struct rcar_isp *isp)
 static int risp_s_stream(struct v4l2_subdev *sd, int enable)
 {
 	struct rcar_isp *isp = sd_to_isp(sd);
+	struct v4l2_subdev_state *state;
 	int ret = 0;
 
-	mutex_lock(&isp->lock);
+	state = v4l2_subdev_lock_and_get_active_state(sd);
 
 	if (!isp->remote) {
 		ret = -ENODEV;
@@ -299,7 +303,7 @@ static int risp_s_stream(struct v4l2_subdev *sd, int enable)
 	}
 
 	if (enable && isp->stream_count == 0) {
-		ret = risp_start(isp);
+		ret = risp_start(isp, state);
 		if (ret)
 			goto out;
 	} else if (!enable && isp->stream_count == 1) {
@@ -308,7 +312,7 @@ static int risp_s_stream(struct v4l2_subdev *sd, int enable)
 
 	isp->stream_count += enable ? 1 : -1;
 out:
-	mutex_unlock(&isp->lock);
+	v4l2_subdev_unlock_state(state);
 
 	return ret;
 }
@@ -318,50 +322,28 @@ static const struct v4l2_subdev_video_ops risp_video_ops = {
 };
 
 static int risp_set_pad_format(struct v4l2_subdev *sd,
-			       struct v4l2_subdev_state *sd_state,
+			       struct v4l2_subdev_state *state,
 			       struct v4l2_subdev_format *format)
 {
-	struct rcar_isp *isp = sd_to_isp(sd);
 	struct v4l2_mbus_framefmt *framefmt;
 
-	mutex_lock(&isp->lock);
+	if (format->pad > RCAR_ISP_SINK)
+		return v4l2_subdev_get_fmt(sd, state, format);
 
 	if (!risp_code_to_fmt(format->format.code))
 		format->format.code = rcar_isp_formats[0].code;
 
-	if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
-		isp->mf = format->format;
-	} else {
-		framefmt = v4l2_subdev_state_get_format(sd_state, 0);
+	for (unsigned int i = 0; i < RCAR_ISP_NUM_PADS; i++) {
+		framefmt = v4l2_subdev_state_get_format(state, i);
 		*framefmt = format->format;
 	}
 
-	mutex_unlock(&isp->lock);
-
-	return 0;
-}
-
-static int risp_get_pad_format(struct v4l2_subdev *sd,
-			       struct v4l2_subdev_state *sd_state,
-			       struct v4l2_subdev_format *format)
-{
-	struct rcar_isp *isp = sd_to_isp(sd);
-
-	mutex_lock(&isp->lock);
-
-	if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
-		format->format = isp->mf;
-	else
-		format->format = *v4l2_subdev_state_get_format(sd_state, 0);
-
-	mutex_unlock(&isp->lock);
-
 	return 0;
 }
 
 static const struct v4l2_subdev_pad_ops risp_pad_ops = {
 	.set_fmt = risp_set_pad_format,
-	.get_fmt = risp_get_pad_format,
+	.get_fmt = v4l2_subdev_get_fmt,
 	.link_validate = v4l2_subdev_link_validate_default,
 };
 
@@ -500,12 +482,10 @@ static int risp_probe(struct platform_device *pdev)
 
 	isp->dev = &pdev->dev;
 
-	mutex_init(&isp->lock);
-
 	ret = risp_probe_resources(isp, pdev);
 	if (ret) {
 		dev_err(isp->dev, "Failed to get resources\n");
-		goto error_mutex;
+		return ret;
 	}
 
 	platform_set_drvdata(pdev, isp);
@@ -536,20 +516,25 @@ static int risp_probe(struct platform_device *pdev)
 	if (ret)
 		goto error_notifier;
 
+	ret = v4l2_subdev_init_finalize(&isp->subdev);
+	if (ret)
+		goto error_notifier;
+
 	ret = v4l2_async_register_subdev(&isp->subdev);
 	if (ret < 0)
-		goto error_notifier;
+		goto error_subdev;
 
 	dev_info(isp->dev, "Using CSI-2 input: %u\n", isp->csi_input);
 
 	return 0;
+
+error_subdev:
+	v4l2_subdev_cleanup(&isp->subdev);
 error_notifier:
 	v4l2_async_nf_unregister(&isp->notifier);
 	v4l2_async_nf_cleanup(&isp->notifier);
 error_pm:
 	pm_runtime_disable(&pdev->dev);
-error_mutex:
-	mutex_destroy(&isp->lock);
 
 	return ret;
 }
@@ -562,10 +547,9 @@ static void risp_remove(struct platform_device *pdev)
 	v4l2_async_nf_cleanup(&isp->notifier);
 
 	v4l2_async_unregister_subdev(&isp->subdev);
+	v4l2_subdev_cleanup(&isp->subdev);
 
 	pm_runtime_disable(&pdev->dev);
-
-	mutex_destroy(&isp->lock);
 }
 
 static struct platform_driver rcar_isp_driver = {

-- 
2.43.0


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

* [PATCH 09/10] media: rcar-isp: Convert to .{enable|disable}_streams
  2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
                   ` (7 preceding siblings ...)
  2025-01-20 13:10 ` [PATCH 08/10] media: rcar-isp: Convert to subdev state Tomi Valkeinen
@ 2025-01-20 13:10 ` Tomi Valkeinen
  2025-01-20 13:10 ` [PATCH 10/10] media: rcar-csi2: " Tomi Valkeinen
  2025-01-21 21:24 ` [PATCH 00/10] media: rcar: Minor cleanups and improvements Niklas Söderlund
  10 siblings, 0 replies; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-20 13:10 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tomi Valkeinen

Drop the legacy .s_stream and convert to .{enable|disable}_streams.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/platform/renesas/rcar-isp.c | 49 +++++++++++++++++++------------
 1 file changed, 31 insertions(+), 18 deletions(-)

diff --git a/drivers/media/platform/renesas/rcar-isp.c b/drivers/media/platform/renesas/rcar-isp.c
index d4eaabb45e07..4bc89d4757fa 100644
--- a/drivers/media/platform/renesas/rcar-isp.c
+++ b/drivers/media/platform/renesas/rcar-isp.c
@@ -289,37 +289,49 @@ static void risp_stop(struct rcar_isp *isp)
 	risp_power_off(isp);
 }
 
-static int risp_s_stream(struct v4l2_subdev *sd, int enable)
+static int risp_enable_streams(struct v4l2_subdev *sd,
+			       struct v4l2_subdev_state *state, u32 source_pad,
+			       u64 source_streams_mask)
 {
 	struct rcar_isp *isp = sd_to_isp(sd);
-	struct v4l2_subdev_state *state;
 	int ret = 0;
 
-	state = v4l2_subdev_lock_and_get_active_state(sd);
+	if (source_streams_mask != 1)
+		return -EINVAL;
 
-	if (!isp->remote) {
-		ret = -ENODEV;
-		goto out;
-	}
+	if (!isp->remote)
+		return -ENODEV;
 
-	if (enable && isp->stream_count == 0) {
+	if (isp->stream_count == 0) {
 		ret = risp_start(isp, state);
 		if (ret)
-			goto out;
-	} else if (!enable && isp->stream_count == 1) {
-		risp_stop(isp);
+			return ret;
 	}
 
-	isp->stream_count += enable ? 1 : -1;
-out:
-	v4l2_subdev_unlock_state(state);
+	isp->stream_count += 1;
 
 	return ret;
 }
 
-static const struct v4l2_subdev_video_ops risp_video_ops = {
-	.s_stream = risp_s_stream,
-};
+static int risp_disable_streams(struct v4l2_subdev *sd,
+				struct v4l2_subdev_state *state, u32 source_pad,
+				u64 source_streams_mask)
+{
+	struct rcar_isp *isp = sd_to_isp(sd);
+
+	if (source_streams_mask != 1)
+		return -EINVAL;
+
+	if (!isp->remote)
+		return -ENODEV;
+
+	if (isp->stream_count == 1)
+		risp_stop(isp);
+
+	isp->stream_count -= 1;
+
+	return 0;
+}
 
 static int risp_set_pad_format(struct v4l2_subdev *sd,
 			       struct v4l2_subdev_state *state,
@@ -342,13 +354,14 @@ static int risp_set_pad_format(struct v4l2_subdev *sd,
 }
 
 static const struct v4l2_subdev_pad_ops risp_pad_ops = {
+	.enable_streams = risp_enable_streams,
+	.disable_streams = risp_disable_streams,
 	.set_fmt = risp_set_pad_format,
 	.get_fmt = v4l2_subdev_get_fmt,
 	.link_validate = v4l2_subdev_link_validate_default,
 };
 
 static const struct v4l2_subdev_ops rcar_isp_subdev_ops = {
-	.video	= &risp_video_ops,
 	.pad	= &risp_pad_ops,
 };
 

-- 
2.43.0


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

* [PATCH 10/10] media: rcar-csi2: Convert to .{enable|disable}_streams
  2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
                   ` (8 preceding siblings ...)
  2025-01-20 13:10 ` [PATCH 09/10] media: rcar-isp: Convert to .{enable|disable}_streams Tomi Valkeinen
@ 2025-01-20 13:10 ` Tomi Valkeinen
  2025-01-21 21:24 ` [PATCH 00/10] media: rcar: Minor cleanups and improvements Niklas Söderlund
  10 siblings, 0 replies; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-20 13:10 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Tomi Valkeinen

Drop the legacy .s_stream and convert to .{enable|disable}_streams.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
---
 drivers/media/platform/renesas/rcar-csi2.c | 49 ++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 16 deletions(-)

diff --git a/drivers/media/platform/renesas/rcar-csi2.c b/drivers/media/platform/renesas/rcar-csi2.c
index ff27a8845969..38a3149f9724 100644
--- a/drivers/media/platform/renesas/rcar-csi2.c
+++ b/drivers/media/platform/renesas/rcar-csi2.c
@@ -1593,28 +1593,47 @@ static void rcsi2_stop(struct rcar_csi2 *priv)
 	v4l2_subdev_disable_streams(priv->remote, priv->remote_pad, BIT_ULL(0));
 }
 
-static int rcsi2_s_stream(struct v4l2_subdev *sd, int enable)
+static int rcsi2_enable_streams(struct v4l2_subdev *sd,
+				struct v4l2_subdev_state *state, u32 source_pad,
+				u64 source_streams_mask)
 {
 	struct rcar_csi2 *priv = sd_to_csi2(sd);
-	struct v4l2_subdev_state *state;
 	int ret = 0;
 
+	if (source_streams_mask != 1)
+		return -EINVAL;
+
 	if (!priv->remote)
 		return -ENODEV;
 
-	state = v4l2_subdev_lock_and_get_active_state(&priv->subdev);
-
-	if (enable && priv->stream_count == 0) {
+	if (priv->stream_count == 0) {
 		ret = rcsi2_start(priv, state);
 		if (ret)
-			goto out;
-	} else if (!enable && priv->stream_count == 1) {
-		rcsi2_stop(priv);
+			return ret;
 	}
 
-	priv->stream_count += enable ? 1 : -1;
-out:
-	v4l2_subdev_unlock_state(state);
+	priv->stream_count += 1;
+
+	return ret;
+}
+
+static int rcsi2_disable_streams(struct v4l2_subdev *sd,
+				 struct v4l2_subdev_state *state,
+				 u32 source_pad, u64 source_streams_mask)
+{
+	struct rcar_csi2 *priv = sd_to_csi2(sd);
+	int ret = 0;
+
+	if (source_streams_mask != 1)
+		return -EINVAL;
+
+	if (!priv->remote)
+		return -ENODEV;
+
+	if (priv->stream_count == 1)
+		rcsi2_stop(priv);
+
+	priv->stream_count -= 1;
 
 	return ret;
 }
@@ -1641,17 +1660,15 @@ static int rcsi2_set_pad_format(struct v4l2_subdev *sd,
 	return 0;
 }
 
-static const struct v4l2_subdev_video_ops rcar_csi2_video_ops = {
-	.s_stream = rcsi2_s_stream,
-};
-
 static const struct v4l2_subdev_pad_ops rcar_csi2_pad_ops = {
+	.enable_streams = rcsi2_enable_streams,
+	.disable_streams = rcsi2_disable_streams,
+
 	.set_fmt = rcsi2_set_pad_format,
 	.get_fmt = v4l2_subdev_get_fmt,
 };
 
 static const struct v4l2_subdev_ops rcar_csi2_subdev_ops = {
-	.video	= &rcar_csi2_video_ops,
 	.pad	= &rcar_csi2_pad_ops,
 };
 

-- 
2.43.0


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

* Re: [PATCH 00/10] media: rcar: Minor cleanups and improvements
  2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
                   ` (9 preceding siblings ...)
  2025-01-20 13:10 ` [PATCH 10/10] media: rcar-csi2: " Tomi Valkeinen
@ 2025-01-21 21:24 ` Niklas Söderlund
  2025-01-22  8:02   ` Tomi Valkeinen
  10 siblings, 1 reply; 16+ messages in thread
From: Niklas Söderlund @ 2025-01-21 21:24 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Mauro Carvalho Chehab, linux-media, linux-renesas-soc,
	linux-kernel

Hi Tomi,

Thanks for a great cleanup series!

On 2025-01-20 15:10:33 +0200, Tomi Valkeinen wrote:
> I've started looking at multi-stream support, and came up with these
> while working towards streams.
> 
>  Tomi
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>

I have tested this in Gen2, Gen3 and Gen4 without noticing any 
regressions. The log is now spammed with the helpful suggestion that the 
CSI-2 TX subdevices shall implement V4L2_CID_LINK_FREQ control. This is 
annoying but out of scope for this series, but would be nice at some 
point.

  [   37.421531] v4l2_get_link_freq: Link frequency estimated using pixel rate: result might be inaccurate
  [   37.430991] v4l2_get_link_freq: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver

For the whole series,

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
> Tomi Valkeinen (10):
>       media: rcar-csi2: Move Y8 entry to a better place
>       media: rcar-csi2: Add RAW10 and RAW12 formats
>       media: rcar-isp: Add RAW8, RAW10 and RAW12 formats
>       media: rcar-csi2: Use v4l2_get_link_freq()
>       media: rcar-vin: Use v4l2_subdev_{enable|disable}_streams()
>       media: rcar-isp: Use v4l2_subdev_{enable|disable}_streams()
>       media: rcar-csi2: Use v4l2_subdev_{enable|disable}_streams()
>       media: rcar-isp: Convert to subdev state
>       media: rcar-isp: Convert to .{enable|disable}_streams
>       media: rcar-csi2: Convert to .{enable|disable}_streams
> 
>  drivers/media/platform/renesas/rcar-csi2.c         | 118 ++++++++++-----
>  drivers/media/platform/renesas/rcar-isp.c          | 162 +++++++++++++--------
>  drivers/media/platform/renesas/rcar-vin/rcar-dma.c |   4 +-
>  3 files changed, 190 insertions(+), 94 deletions(-)
> ---
> base-commit: 94794b5ce4d90ab134b0b101a02fddf6e74c437d
> change-id: 20250120-rcar-media-impro-2c37c1036e19
> 
> Best regards,
> -- 
> Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
> 

-- 
Kind Regards,
Niklas Söderlund

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

* Re: [PATCH 00/10] media: rcar: Minor cleanups and improvements
  2025-01-21 21:24 ` [PATCH 00/10] media: rcar: Minor cleanups and improvements Niklas Söderlund
@ 2025-01-22  8:02   ` Tomi Valkeinen
  2025-01-22  9:21     ` Niklas Söderlund
  0 siblings, 1 reply; 16+ messages in thread
From: Tomi Valkeinen @ 2025-01-22  8:02 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Mauro Carvalho Chehab, linux-media, linux-renesas-soc,
	linux-kernel

Hi,

On 21/01/2025 23:24, Niklas Söderlund wrote:
> Hi Tomi,
> 
> Thanks for a great cleanup series!
> 
> On 2025-01-20 15:10:33 +0200, Tomi Valkeinen wrote:
>> I've started looking at multi-stream support, and came up with these
>> while working towards streams.
>>
>>   Tomi
>>
>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
> 
> I have tested this in Gen2, Gen3 and Gen4 without noticing any
> regressions. The log is now spammed with the helpful suggestion that the
> CSI-2 TX subdevices shall implement V4L2_CID_LINK_FREQ control. This is
> annoying but out of scope for this series, but would be nice at some
> point.
> 
>    [   37.421531] v4l2_get_link_freq: Link frequency estimated using pixel rate: result might be inaccurate
>    [   37.430991] v4l2_get_link_freq: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver

Which drivers need fixing? The staging max96712 is one (there seems to 
be a TODO there about it), and adv748x? I'm not going to work on that 
right now, but just collecting the details.

> For the whole series,
> 
> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Thanks!

  Tomi


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

* Re: [PATCH 00/10] media: rcar: Minor cleanups and improvements
  2025-01-22  8:02   ` Tomi Valkeinen
@ 2025-01-22  9:21     ` Niklas Söderlund
  2025-01-22 11:57       ` Jacopo Mondi
  0 siblings, 1 reply; 16+ messages in thread
From: Niklas Söderlund @ 2025-01-22  9:21 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: Mauro Carvalho Chehab, linux-media, linux-renesas-soc,
	linux-kernel

On 2025-01-22 10:02:59 +0200, Tomi Valkeinen wrote:
> Hi,
> 
> On 21/01/2025 23:24, Niklas Söderlund wrote:
> > Hi Tomi,
> > 
> > Thanks for a great cleanup series!
> > 
> > On 2025-01-20 15:10:33 +0200, Tomi Valkeinen wrote:
> > > I've started looking at multi-stream support, and came up with these
> > > while working towards streams.
> > > 
> > >   Tomi
> > > 
> > > Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
> > 
> > I have tested this in Gen2, Gen3 and Gen4 without noticing any
> > regressions. The log is now spammed with the helpful suggestion that the
> > CSI-2 TX subdevices shall implement V4L2_CID_LINK_FREQ control. This is
> > annoying but out of scope for this series, but would be nice at some
> > point.
> > 
> >    [   37.421531] v4l2_get_link_freq: Link frequency estimated using pixel rate: result might be inaccurate
> >    [   37.430991] v4l2_get_link_freq: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver
> 
> Which drivers need fixing? The staging max96712 is one (there seems to be a
> TODO there about it), and adv748x? I'm not going to work on that right now,
> but just collecting the details.

Indeed adv748x is the other driver needing work here. The problem as I 
recall it is that V4L2_CID_LINK_FREQ is a menu control, and adv748x 
selects it link freq based on what it is outputting. But it's been some 
time since I looked at this, maybe I recall incorrectly.

> 
> > For the whole series,
> > 
> > Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> > Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> 
> Thanks!
> 
>  Tomi
> 

-- 
Kind Regards,
Niklas Söderlund

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

* Re: [PATCH 00/10] media: rcar: Minor cleanups and improvements
  2025-01-22  9:21     ` Niklas Söderlund
@ 2025-01-22 11:57       ` Jacopo Mondi
  2025-01-22 17:07         ` Niklas Söderlund
  0 siblings, 1 reply; 16+ messages in thread
From: Jacopo Mondi @ 2025-01-22 11:57 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Tomi Valkeinen, Mauro Carvalho Chehab, linux-media,
	linux-renesas-soc, linux-kernel

Hi Niklas,

On Wed, Jan 22, 2025 at 10:21:28AM +0100, Niklas Söderlund wrote:
> On 2025-01-22 10:02:59 +0200, Tomi Valkeinen wrote:
> > Hi,
> >
> > On 21/01/2025 23:24, Niklas Söderlund wrote:
> > > Hi Tomi,
> > >
> > > Thanks for a great cleanup series!
> > >
> > > On 2025-01-20 15:10:33 +0200, Tomi Valkeinen wrote:
> > > > I've started looking at multi-stream support, and came up with these
> > > > while working towards streams.
> > > >
> > > >   Tomi
> > > >
> > > > Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
> > >
> > > I have tested this in Gen2, Gen3 and Gen4 without noticing any
> > > regressions. The log is now spammed with the helpful suggestion that the
> > > CSI-2 TX subdevices shall implement V4L2_CID_LINK_FREQ control. This is
> > > annoying but out of scope for this series, but would be nice at some
> > > point.
> > >
> > >    [   37.421531] v4l2_get_link_freq: Link frequency estimated using pixel rate: result might be inaccurate
> > >    [   37.430991] v4l2_get_link_freq: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver
> >
> > Which drivers need fixing? The staging max96712 is one (there seems to be a
> > TODO there about it), and adv748x? I'm not going to work on that right now,
> > but just collecting the details.
>
> Indeed adv748x is the other driver needing work here. The problem as I
> recall it is that V4L2_CID_LINK_FREQ is a menu control, and adv748x
> selects it link freq based on what it is outputting. But it's been some
> time since I looked at this, maybe I recall incorrectly.
>

Would this series help ?
https://patchwork.kernel.org/project/linux-media/list/?series=926905

> >
> > > For the whole series,
> > >
> > > Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> > > Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> >
> > Thanks!
> >
> >  Tomi
> >
>
> --
> Kind Regards,
> Niklas Söderlund
>

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

* Re: [PATCH 00/10] media: rcar: Minor cleanups and improvements
  2025-01-22 11:57       ` Jacopo Mondi
@ 2025-01-22 17:07         ` Niklas Söderlund
  0 siblings, 0 replies; 16+ messages in thread
From: Niklas Söderlund @ 2025-01-22 17:07 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: Tomi Valkeinen, Mauro Carvalho Chehab, linux-media,
	linux-renesas-soc, linux-kernel

Hello Jacopo,

On 2025-01-22 12:57:13 +0100, Jacopo Mondi wrote:
> Hi Niklas,
> 
> On Wed, Jan 22, 2025 at 10:21:28AM +0100, Niklas Söderlund wrote:
> > On 2025-01-22 10:02:59 +0200, Tomi Valkeinen wrote:
> > > Hi,
> > >
> > > On 21/01/2025 23:24, Niklas Söderlund wrote:
> > > > Hi Tomi,
> > > >
> > > > Thanks for a great cleanup series!
> > > >
> > > > On 2025-01-20 15:10:33 +0200, Tomi Valkeinen wrote:
> > > > > I've started looking at multi-stream support, and came up with these
> > > > > while working towards streams.
> > > > >
> > > > >   Tomi
> > > > >
> > > > > Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
> > > >
> > > > I have tested this in Gen2, Gen3 and Gen4 without noticing any
> > > > regressions. The log is now spammed with the helpful suggestion that the
> > > > CSI-2 TX subdevices shall implement V4L2_CID_LINK_FREQ control. This is
> > > > annoying but out of scope for this series, but would be nice at some
> > > > point.
> > > >
> > > >    [   37.421531] v4l2_get_link_freq: Link frequency estimated using pixel rate: result might be inaccurate
> > > >    [   37.430991] v4l2_get_link_freq: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver
> > >
> > > Which drivers need fixing? The staging max96712 is one (there seems to be a
> > > TODO there about it), and adv748x? I'm not going to work on that right now,
> > > but just collecting the details.
> >
> > Indeed adv748x is the other driver needing work here. The problem as I
> > recall it is that V4L2_CID_LINK_FREQ is a menu control, and adv748x
> > selects it link freq based on what it is outputting. But it's been some
> > time since I looked at this, maybe I recall incorrectly.
> >
> 
> Would this series help ?
> https://patchwork.kernel.org/project/linux-media/list/?series=926905

I think it would, it seems to perfectly fit the adv748x situation, 
awesome!

> 
> > >
> > > > For the whole series,
> > > >
> > > > Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> > > > Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> > >
> > > Thanks!
> > >
> > >  Tomi
> > >
> >
> > --
> > Kind Regards,
> > Niklas Söderlund
> >

-- 
Kind Regards,
Niklas Söderlund

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

end of thread, other threads:[~2025-01-22 17:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-20 13:10 [PATCH 00/10] media: rcar: Minor cleanups and improvements Tomi Valkeinen
2025-01-20 13:10 ` [PATCH 01/10] media: rcar-csi2: Move Y8 entry to a better place Tomi Valkeinen
2025-01-20 13:10 ` [PATCH 02/10] media: rcar-csi2: Add RAW10 and RAW12 formats Tomi Valkeinen
2025-01-20 13:10 ` [PATCH 03/10] media: rcar-isp: Add RAW8, " Tomi Valkeinen
2025-01-20 13:10 ` [PATCH 04/10] media: rcar-csi2: Use v4l2_get_link_freq() Tomi Valkeinen
2025-01-20 13:10 ` [PATCH 05/10] media: rcar-vin: Use v4l2_subdev_{enable|disable}_streams() Tomi Valkeinen
2025-01-20 13:10 ` [PATCH 06/10] media: rcar-isp: " Tomi Valkeinen
2025-01-20 13:10 ` [PATCH 07/10] media: rcar-csi2: " Tomi Valkeinen
2025-01-20 13:10 ` [PATCH 08/10] media: rcar-isp: Convert to subdev state Tomi Valkeinen
2025-01-20 13:10 ` [PATCH 09/10] media: rcar-isp: Convert to .{enable|disable}_streams Tomi Valkeinen
2025-01-20 13:10 ` [PATCH 10/10] media: rcar-csi2: " Tomi Valkeinen
2025-01-21 21:24 ` [PATCH 00/10] media: rcar: Minor cleanups and improvements Niklas Söderlund
2025-01-22  8:02   ` Tomi Valkeinen
2025-01-22  9:21     ` Niklas Söderlund
2025-01-22 11:57       ` Jacopo Mondi
2025-01-22 17:07         ` Niklas Söderlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox