mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] media: mali-c55: Require an enabled link to start a video node
@ 2026-11-05 23:15 David Carlier
  2026-11-09  9:26 ` Linus Walleij
  2026-11-09 15:52 ` Jacopo Mondi
  0 siblings, 2 replies; 3+ messages in thread
From: David Carlier @ 2026-11-05 23:15 UTC (permalink / raw)
  To: jacopo.mondi, dan.scally
  Cc: nayden.kanchev, mchehab, hverkuil+cisco, linusw, linux-media,
	linux-kernel, David Carlier

mali_c55_pipeline_ready() skips queues whose link is disabled, but such
a queue can still start streaming on its own, as the video node pads
lack MEDIA_PAD_FL_MUST_CONNECT. Stopping it later sees a ready pipeline
and disables the ISP under the connected queues still capturing.

Mark the video node pads MUST_CONNECT so that starting a disconnected
node fails with -ENOLINK.

Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
Signed-off-by: David Carlier <devnexen@gmail.com>
---
Changes in v2:
- Add missing Signed-off-by.
- Cc stable, as d5f281f3dd29 is in the stable tree.

Build tested only (W=1, checkpatch --strict clean). Not tested on
hardware; the disconnected-node STREAMON/STREAMOFF sequence is from
code reading.
 drivers/media/platform/arm/mali-c55/mali-c55-capture.c | 2 +-
 drivers/media/platform/arm/mali-c55/mali-c55-params.c  | 2 +-
 drivers/media/platform/arm/mali-c55/mali-c55-stats.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-capture.c b/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
index ff01553026fb..2dbce550d089 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
@@ -855,7 +855,7 @@ static int mali_c55_register_cap_dev(struct mali_c55 *mali_c55,
 		goto err_destroy_mutex;
 	}
 
-	cap_dev->pad.flags = MEDIA_PAD_FL_SINK;
+	cap_dev->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT;
 	ret = media_entity_pads_init(&cap_dev->vdev.entity, 1, &cap_dev->pad);
 	if (ret)
 		goto err_destroy_mutex;
diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-params.c b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
index 16e895e3488e..0888dc4a340e 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-params.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
@@ -1014,7 +1014,7 @@ int mali_c55_register_params(struct mali_c55 *mali_c55)
 	INIT_LIST_HEAD(&params->buffers.queue);
 	spin_lock_init(&params->buffers.lock);
 
-	params->pad.flags = MEDIA_PAD_FL_SOURCE;
+	params->pad.flags = MEDIA_PAD_FL_SOURCE | MEDIA_PAD_FL_MUST_CONNECT;
 	ret = media_entity_pads_init(&params->vdev.entity, 1, &params->pad);
 	if (ret)
 		goto err_destroy_mutex;
diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-stats.c b/drivers/media/platform/arm/mali-c55/mali-c55-stats.c
index a9c28b090b2a..a9172781925c 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-stats.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-stats.c
@@ -275,7 +275,7 @@ int mali_c55_register_stats(struct mali_c55 *mali_c55)
 	INIT_LIST_HEAD(&stats->buffers.queue);
 	spin_lock_init(&stats->buffers.lock);
 
-	stats->pad.flags = MEDIA_PAD_FL_SINK;
+	stats->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT;
 	ret = media_entity_pads_init(&stats->vdev.entity, 1, &stats->pad);
 	if (ret)
 		goto err_destroy_mutex;
-- 
2.55.0


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

* Re: [PATCH v2] media: mali-c55: Require an enabled link to start a video node
  2026-11-05 23:15 [PATCH v2] media: mali-c55: Require an enabled link to start a video node David Carlier
@ 2026-11-09  9:26 ` Linus Walleij
  2026-11-09 15:52 ` Jacopo Mondi
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2026-11-09  9:26 UTC (permalink / raw)
  To: David Carlier
  Cc: jacopo.mondi, dan.scally, nayden.kanchev, mchehab,
	hverkuil+cisco, linux-media, linux-kernel

On Fri, Nov 6, 2026 at 12:16 AM David Carlier <devnexen@gmail.com> wrote:

> mali_c55_pipeline_ready() skips queues whose link is disabled, but such
> a queue can still start streaming on its own, as the video node pads
> lack MEDIA_PAD_FL_MUST_CONNECT. Stopping it later sees a ready pipeline
> and disables the ISP under the connected queues still capturing.
>
> Mark the video node pads MUST_CONNECT so that starting a disconnected
> node fails with -ENOLINK.
>
> Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
> Signed-off-by: David Carlier <devnexen@gmail.com>

It checks out:
Reviewed-by: Linus Walleij <linusw@kernel.org>

> Changes in v2:
> - Add missing Signed-off-by.
> - Cc stable, as d5f281f3dd29 is in the stable tree.

No Cc: stable@vger.kernel.org actually added?

But Jacopo can certainly add that when applying the patch.

Yours,
Linus Walleij

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

* Re: [PATCH v2] media: mali-c55: Require an enabled link to start a video node
  2026-11-05 23:15 [PATCH v2] media: mali-c55: Require an enabled link to start a video node David Carlier
  2026-11-09  9:26 ` Linus Walleij
@ 2026-11-09 15:52 ` Jacopo Mondi
  1 sibling, 0 replies; 3+ messages in thread
From: Jacopo Mondi @ 2026-11-09 15:52 UTC (permalink / raw)
  To: David Carlier
  Cc: jacopo.mondi, dan.scally, nayden.kanchev, mchehab,
	hverkuil+cisco, linusw, linux-media, linux-kernel

Hi David

On Thu, Nov 05, 2026 at 11:15:59PM +0000, David Carlier wrote:
> mali_c55_pipeline_ready() skips queues whose link is disabled, but such
> a queue can still start streaming on its own, as the video node pads

Can you elaborate on how this could happen ?

How can streaming start if you VIDIOC_STREAMON() on a capture device
without an enabled link to the resizer subdev ?

> lack MEDIA_PAD_FL_MUST_CONNECT. Stopping it later sees a ready pipeline
> and disables the ISP under the connected queues still capturing.
>
> Mark the video node pads MUST_CONNECT so that starting a disconnected
> node fails with -ENOLINK.
>
> Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
> Signed-off-by: David Carlier <devnexen@gmail.com>
> ---
> Changes in v2:
> - Add missing Signed-off-by.
> - Cc stable, as d5f281f3dd29 is in the stable tree.
>
> Build tested only (W=1, checkpatch --strict clean). Not tested on
> hardware; the disconnected-node STREAMON/STREAMOFF sequence is from
> code reading.
>  drivers/media/platform/arm/mali-c55/mali-c55-capture.c | 2 +-
>  drivers/media/platform/arm/mali-c55/mali-c55-params.c  | 2 +-
>  drivers/media/platform/arm/mali-c55/mali-c55-stats.c   | 2 +-

Why not the resizer ?

>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-capture.c b/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
> index ff01553026fb..2dbce550d089 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
> @@ -855,7 +855,7 @@ static int mali_c55_register_cap_dev(struct mali_c55 *mali_c55,
>  		goto err_destroy_mutex;
>  	}
>
> -	cap_dev->pad.flags = MEDIA_PAD_FL_SINK;
> +	cap_dev->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT;
>  	ret = media_entity_pads_init(&cap_dev->vdev.entity, 1, &cap_dev->pad);
>  	if (ret)
>  		goto err_destroy_mutex;
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-params.c b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> index 16e895e3488e..0888dc4a340e 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> @@ -1014,7 +1014,7 @@ int mali_c55_register_params(struct mali_c55 *mali_c55)
>  	INIT_LIST_HEAD(&params->buffers.queue);
>  	spin_lock_init(&params->buffers.lock);
>
> -	params->pad.flags = MEDIA_PAD_FL_SOURCE;
> +	params->pad.flags = MEDIA_PAD_FL_SOURCE | MEDIA_PAD_FL_MUST_CONNECT;
>  	ret = media_entity_pads_init(&params->vdev.entity, 1, &params->pad);
>  	if (ret)
>  		goto err_destroy_mutex;
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-stats.c b/drivers/media/platform/arm/mali-c55/mali-c55-stats.c
> index a9c28b090b2a..a9172781925c 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-stats.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-stats.c
> @@ -275,7 +275,7 @@ int mali_c55_register_stats(struct mali_c55 *mali_c55)
>  	INIT_LIST_HEAD(&stats->buffers.queue);
>  	spin_lock_init(&stats->buffers.lock);
>
> -	stats->pad.flags = MEDIA_PAD_FL_SINK;
> +	stats->pad.flags = MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT;
>  	ret = media_entity_pads_init(&stats->vdev.entity, 1, &stats->pad);
>  	if (ret)
>  		goto err_destroy_mutex;
> --
> 2.55.0
>
>

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

end of thread, other threads:[~2026-11-09 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 23:15 [PATCH v2] media: mali-c55: Require an enabled link to start a video node David Carlier
2026-11-09  9:26 ` Linus Walleij
2026-11-09 15:52 ` Jacopo Mondi

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

all inboxes | Powered by JetHome®