bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0864-Revert-rpivid-Switch-to-new-clock-api.patch
1 From 775b90e37e5e418b19827eb696e5d034e7089f57 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Wed, 16 Mar 2022 09:58:31 +0100
4 Subject: [PATCH] Revert "rpivid: Switch to new clock api"
5
6 This reverts commit ec7556e20c2c29c3df9493248a1a4d60ed20ae38.
7 ---
8 drivers/staging/media/rpivid/rpivid.h | 1 -
9 drivers/staging/media/rpivid/rpivid_video.c | 18 +++++-------------
10 2 files changed, 5 insertions(+), 14 deletions(-)
11
12 --- a/drivers/staging/media/rpivid/rpivid.h
13 +++ b/drivers/staging/media/rpivid/rpivid.h
14 @@ -90,7 +90,6 @@ struct rpivid_ctx {
15 struct v4l2_pix_format_mplane dst_fmt;
16 int dst_fmt_set;
17
18 - struct clk_request *clk_req;
19 int src_stream_on;
20 int dst_stream_on;
21
22 --- a/drivers/staging/media/rpivid/rpivid_video.c
23 +++ b/drivers/staging/media/rpivid/rpivid_video.c
24 @@ -545,13 +545,10 @@ static int rpivid_buf_prepare(struct vb2
25 static void stop_clock(struct rpivid_dev *dev, struct rpivid_ctx *ctx)
26 {
27 if (ctx->src_stream_on ||
28 - ctx->dst_stream_on ||
29 - !ctx->clk_req)
30 + ctx->dst_stream_on)
31 return;
32
33 - clk_request_done(ctx->clk_req);
34 - ctx->clk_req = NULL;
35 -
36 + clk_set_min_rate(dev->clock, 0);
37 clk_disable_unprepare(dev->clock);
38 }
39
40 @@ -561,22 +558,17 @@ static int start_clock(struct rpivid_dev
41 long max_hevc_clock;
42 int rv;
43
44 - if (ctx->clk_req)
45 - return 0;
46 -
47 max_hevc_clock = clk_round_rate(dev->clock, ULONG_MAX);
48
49 - ctx->clk_req = clk_request_start(dev->clock, max_hevc_clock);
50 - if (!ctx->clk_req) {
51 + rv = clk_set_min_rate(dev->clock, max_hevc_clock);
52 + if (rv) {
53 dev_err(dev->dev, "Failed to set clock rate\n");
54 - return -EIO;
55 + return rv;
56 }
57
58 rv = clk_prepare_enable(dev->clock);
59 if (rv) {
60 dev_err(dev->dev, "Failed to enable clock\n");
61 - clk_request_done(ctx->clk_req);
62 - ctx->clk_req = NULL;
63 return rv;
64 }
65