095bb71b524d86dfe34b81ab7a2246cdca97c4f7
[openwrt/staging/pepe2k.git] /
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
5 with same node
6
7 media_pipeline_start and media_pipeline_stop now validate that
8 the pipeline is being started and stopped with the same pipe
9 and pad handles.
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.
13
14 Always pass the image pad to media_pipeline_start to ensure
15 that the calls are balanced.
16
17 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
18 ---
19 drivers/media/platform/bcm2835/bcm2835-unicam.c | 6 ++++--
20 1 file changed, 4 insertions(+), 2 deletions(-)
21
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
25 goto err_streaming;
26 }
27
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);
31 if (ret < 0) {
32 unicam_err(dev, "Failed to start media pipeline: %d\n", ret);
33 goto err_pm_put;
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);
37 error_pipeline:
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);
41 err_pm_put:
42 unicam_runtime_put(dev);
43 err_streaming: