1 From e43d09e8749afa7fdfdd83439690d304b5acc98d Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 28 Mar 2023 13:43:43 +0100
4 Subject: [PATCH] media: bcm2835-unicam: Start and stop media_pipeline
7 media_pipeline_start and media_pipeline_stop now validate that
8 the pipeline is being started and stopped with the same pipe
10 When running with embedded metadata (eg imx477 and imx708), the
11 start typically happens from the metadata pad, whilst stop is
12 always from the image pad.
14 Always pass the image pad to media_pipeline_start to ensure
15 that the calls are balanced.
17 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
19 drivers/media/platform/bcm2835/bcm2835-unicam.c | 6 ++++--
20 1 file changed, 4 insertions(+), 2 deletions(-)
22 --- a/drivers/media/platform/bcm2835/bcm2835-unicam.c
23 +++ b/drivers/media/platform/bcm2835/bcm2835-unicam.c
24 @@ -2524,7 +2524,8 @@ static int unicam_start_streaming(struct
28 - ret = media_pipeline_start(node->video_dev.entity.pads, &node->pipe);
29 + ret = media_pipeline_start(dev->node[IMAGE_PAD].video_dev.entity.pads,
30 + &dev->node[IMAGE_PAD].pipe);
32 unicam_err(dev, "Failed to start media pipeline: %d\n", ret);
34 @@ -2618,7 +2619,8 @@ err_vpu_clock:
35 unicam_err(dev, "failed to reset the VPU clock\n");
36 clk_disable_unprepare(dev->vpu_clock);
38 - media_pipeline_stop(node->video_dev.entity.pads);
39 + if (node->pad_id == IMAGE_PAD)
40 + media_pipeline_stop(dev->node[IMAGE_PAD].video_dev.entity.pads);
42 unicam_runtime_put(dev);