bcm27xx: switch to 5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.10 / 950-0540-bcm2835-unicam-Switch-to-new-clock-api.patch
1 From 20d6f2f3e034889bcadb960e6ee4d6822d9dbcd7 Mon Sep 17 00:00:00 2001
2 From: Dom Cobley <popcornmix@gmail.com>
3 Date: Tue, 13 Apr 2021 16:48:35 +0100
4 Subject: [PATCH] bcm2835-unicam: Switch to new clock api
5
6 Signed-off-by: Dom Cobley <popcornmix@gmail.com>
7 ---
8 drivers/media/platform/bcm2835/bcm2835-unicam.c | 13 ++++++-------
9 1 file changed, 6 insertions(+), 7 deletions(-)
10
11 --- a/drivers/media/platform/bcm2835/bcm2835-unicam.c
12 +++ b/drivers/media/platform/bcm2835/bcm2835-unicam.c
13 @@ -426,6 +426,8 @@ struct unicam_device {
14 struct clk *clock;
15 /* vpu clock handle */
16 struct clk *vpu_clock;
17 + /* vpu clock request */
18 + struct clk_request *vpu_req;
19 /* clock status for error handling */
20 bool clocks_enabled;
21 /* V4l2 device */
22 @@ -1691,8 +1693,8 @@ static int unicam_start_streaming(struct
23 unicam_dbg(1, dev, "Running with %u data lanes\n",
24 dev->active_data_lanes);
25
26 - ret = clk_set_min_rate(dev->vpu_clock, MIN_VPU_CLOCK_RATE);
27 - if (ret) {
28 + dev->vpu_req = clk_request_start(dev->vpu_clock, MIN_VPU_CLOCK_RATE);
29 + if (!dev->vpu_req) {
30 unicam_err(dev, "failed to set up VPU clock\n");
31 goto err_pm_put;
32 }
33 @@ -1748,8 +1750,7 @@ err_disable_unicam:
34 unicam_disable(dev);
35 clk_disable_unprepare(dev->clock);
36 err_vpu_clock:
37 - if (clk_set_min_rate(dev->vpu_clock, 0))
38 - unicam_err(dev, "failed to reset the VPU clock\n");
39 + clk_request_done(dev->vpu_req);
40 clk_disable_unprepare(dev->vpu_clock);
41 err_pm_put:
42 unicam_runtime_put(dev);
43 @@ -1779,9 +1780,7 @@ static void unicam_stop_streaming(struct
44 unicam_disable(dev);
45
46 if (dev->clocks_enabled) {
47 - if (clk_set_min_rate(dev->vpu_clock, 0))
48 - unicam_err(dev, "failed to reset the min VPU clock\n");
49 -
50 + clk_request_done(dev->vpu_req);
51 clk_disable_unprepare(dev->vpu_clock);
52 clk_disable_unprepare(dev->clock);
53 dev->clocks_enabled = false;