1 From 01bb5e9e33358d6aa4f2bba838dfc180798a12e7 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 0437/1085] media: bcm2835-unicam: Start and stop
5 media_pipeline with same node
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 @@ -2550,7 +2550,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 @@ -2644,7 +2645,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);