linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: rcar-vin: require master VIN only for CSI source
@ 2022-02-02 10:47 Nikita Yushchenko
  2022-02-02 11:11 ` Niklas Söderlund
  0 siblings, 1 reply; 3+ messages in thread
From: Nikita Yushchenko @ 2022-02-02 10:47 UTC (permalink / raw)
  To: Niklas Söderlund, Mauro Carvalho Chehab
  Cc: linux-media, linux-renesas-soc, linux-kernel, Vladimir Barinov,
	Nikita Yushchenko

Hardware limitations on VINs that can be used at the same time cover only
CSI data source. For parallel source, any single VIN can work.

This patch moves check for master VIN availability in
rvin_csi2_link_notify() below processing the parallel case.

This fixes media-ctl usage on KF board when both CSI and parallel cameras
are in use on the same system. In such a setup, VINs 0-3 are used for
CSI cameras and VIN5 is used for parallel camera.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
---
 drivers/media/platform/rcar-vin/rcar-core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
index 0186ae235113..038ee187f95a 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -826,11 +826,6 @@ static int rvin_csi2_link_notify(struct media_link *link, u32 flags,
 	vin = container_of(vdev, struct rvin_dev, vdev);
 	master_id = rvin_group_id_to_master(vin->id);
 
-	if (WARN_ON(!group->vin[master_id])) {
-		ret = -ENODEV;
-		goto out;
-	}
-
 	/* Build a mask for already enabled links. */
 	for (i = master_id; i < master_id + 4; i++) {
 		if (!group->vin[i])
@@ -878,6 +873,11 @@ static int rvin_csi2_link_notify(struct media_link *link, u32 flags,
 		goto out;
 	}
 
+	if (WARN_ON(!group->vin[master_id])) {
+		ret = -ENODEV;
+		goto out;
+	}
+
 	channel = rvin_group_csi_pad_to_channel(link->source->index);
 	mask_new = mask & rvin_csi2_get_mask(vin, csi_id, channel);
 	vin_dbg(vin, "Try link change mask: 0x%x new: 0x%x\n", mask, mask_new);
-- 
2.30.2


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

* Re: [PATCH] media: rcar-vin: require master VIN only for CSI source
  2022-02-02 10:47 [PATCH] media: rcar-vin: require master VIN only for CSI source Nikita Yushchenko
@ 2022-02-02 11:11 ` Niklas Söderlund
  2022-02-02 11:25   ` Nikita Yushchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Niklas Söderlund @ 2022-02-02 11:11 UTC (permalink / raw)
  To: Nikita Yushchenko
  Cc: Mauro Carvalho Chehab, linux-media, linux-renesas-soc,
	linux-kernel, Vladimir Barinov

Hi Nikita,

Thanks for your work.

On 2022-02-02 13:47:00 +0300, Nikita Yushchenko wrote:
> Hardware limitations on VINs that can be used at the same time cover only
> CSI data source. For parallel source, any single VIN can work.
> 
> This patch moves check for master VIN availability in
> rvin_csi2_link_notify() below processing the parallel case.
> 
> This fixes media-ctl usage on KF board when both CSI and parallel cameras
> are in use on the same system. In such a setup, VINs 0-3 are used for
> CSI cameras and VIN5 is used for parallel camera.

I agree this issue needs to be addressed and I think the use-case is 
covered in the patch 1/3 in the VIN routing series [1]. I don't have 
access to King Fisher hardware so I can't test it, if you do could you 
test that series and see if it fix the issue?

1. [PATCH v3 0/3] media: rcar-{csi2,vin}: Move to full Virtual Channel routing per CSI-2 IP
   https://lore.kernel.org/linux-renesas-soc/20220124124858.571363-4-niklas.soderlund+renesas@ragnatech.se/T/

> 
> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> ---
>  drivers/media/platform/rcar-vin/rcar-core.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
> index 0186ae235113..038ee187f95a 100644
> --- a/drivers/media/platform/rcar-vin/rcar-core.c
> +++ b/drivers/media/platform/rcar-vin/rcar-core.c
> @@ -826,11 +826,6 @@ static int rvin_csi2_link_notify(struct media_link *link, u32 flags,
>  	vin = container_of(vdev, struct rvin_dev, vdev);
>  	master_id = rvin_group_id_to_master(vin->id);
>  
> -	if (WARN_ON(!group->vin[master_id])) {
> -		ret = -ENODEV;
> -		goto out;
> -	}
> -
>  	/* Build a mask for already enabled links. */
>  	for (i = master_id; i < master_id + 4; i++) {
>  		if (!group->vin[i])
> @@ -878,6 +873,11 @@ static int rvin_csi2_link_notify(struct media_link *link, u32 flags,
>  		goto out;
>  	}
>  
> +	if (WARN_ON(!group->vin[master_id])) {
> +		ret = -ENODEV;
> +		goto out;
> +	}
> +
>  	channel = rvin_group_csi_pad_to_channel(link->source->index);
>  	mask_new = mask & rvin_csi2_get_mask(vin, csi_id, channel);
>  	vin_dbg(vin, "Try link change mask: 0x%x new: 0x%x\n", mask, mask_new);
> -- 
> 2.30.2
> 

-- 
Kind Regards,
Niklas Söderlund

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

* Re: [PATCH] media: rcar-vin: require master VIN only for CSI source
  2022-02-02 11:11 ` Niklas Söderlund
@ 2022-02-02 11:25   ` Nikita Yushchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Nikita Yushchenko @ 2022-02-02 11:25 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Mauro Carvalho Chehab, linux-media, linux-renesas-soc,
	linux-kernel, Vladimir Barinov

Hi.

> I agree this issue needs to be addressed and I think the use-case is
> covered in the patch 1/3 in the VIN routing series [1].

Indeed, that patch moves the check to CSI-only path, which is exactly what I tried to do. Thank you!

> I don't have
> access to King Fisher hardware so I can't test it, if you do could you
> test that series and see if it fix the issue?

Right now I don't have all needed hw to run the test that reproduced the issue. If/when I get access to 
hw, I will try it.

Nikita

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

end of thread, other threads:[~2022-02-02 11:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 10:47 [PATCH] media: rcar-vin: require master VIN only for CSI source Nikita Yushchenko
2022-02-02 11:11 ` Niklas Söderlund
2022-02-02 11:25   ` Nikita Yushchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).