aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.15/950-0864-Revert-rpivid-Switch-to-new-clock-api.patch
blob: 8fe4a3d96f6680d3cc356c6c9e3c9f89b98cdb6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 775b90e37e5e418b19827eb696e5d034e7089f57 Mon Sep 17 00:00:00 2001
From: Maxime Ripard <maxime@cerno.tech>
Date: Wed, 16 Mar 2022 09:58:31 +0100
Subject: [PATCH] Revert "rpivid: Switch to new clock api"

This reverts commit ec7556e20c2c29c3df9493248a1a4d60ed20ae38.
---
 drivers/staging/media/rpivid/rpivid.h       |  1 -
 drivers/staging/media/rpivid/rpivid_video.c | 18 +++++-------------
 2 files changed, 5 insertions(+), 14 deletions(-)

--- a/drivers/staging/media/rpivid/rpivid.h
+++ b/drivers/staging/media/rpivid/rpivid.h
@@ -90,7 +90,6 @@ struct rpivid_ctx {
 	struct v4l2_pix_format_mplane	dst_fmt;
 	int dst_fmt_set;
 
-	struct clk_request		*clk_req;
 	int 				src_stream_on;
 	int 				dst_stream_on;
 
--- a/drivers/staging/media/rpivid/rpivid_video.c
+++ b/drivers/staging/media/rpivid/rpivid_video.c
@@ -545,13 +545,10 @@ static int rpivid_buf_prepare(struct vb2
 static void stop_clock(struct rpivid_dev *dev, struct rpivid_ctx *ctx)
 {
 	if (ctx->src_stream_on ||
-	    ctx->dst_stream_on ||
-	    !ctx->clk_req)
+	    ctx->dst_stream_on)
 		return;
 
-	clk_request_done(ctx->clk_req);
-	ctx->clk_req = NULL;
-
+	clk_set_min_rate(dev->clock, 0);
 	clk_disable_unprepare(dev->clock);
 }
 
@@ -561,22 +558,17 @@ static int start_clock(struct rpivid_dev
 	long max_hevc_clock;
 	int rv;
 
-	if (ctx->clk_req)
-		return 0;
-
 	max_hevc_clock = clk_round_rate(dev->clock, ULONG_MAX);
 
-	ctx->clk_req = clk_request_start(dev->clock, max_hevc_clock);
-	if (!ctx->clk_req) {
+	rv = clk_set_min_rate(dev->clock, max_hevc_clock);
+	if (rv) {
 		dev_err(dev->dev, "Failed to set clock rate\n");
-		return -EIO;
+		return rv;
 	}
 
 	rv = clk_prepare_enable(dev->clock);
 	if (rv) {
 		dev_err(dev->dev, "Failed to enable clock\n");
-		clk_request_done(ctx->clk_req);
-		ctx->clk_req = NULL;
 		return rv;
 	}