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
6 Signed-off-by: Dom Cobley <popcornmix@gmail.com>
8 drivers/media/platform/bcm2835/bcm2835-unicam.c | 13 ++++++-------
9 1 file changed, 6 insertions(+), 7 deletions(-)
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 {
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 */
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);
26 - ret = clk_set_min_rate(dev->vpu_clock, MIN_VPU_CLOCK_RATE);
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");
33 @@ -1748,8 +1750,7 @@ err_disable_unicam:
35 clk_disable_unprepare(dev->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);
42 unicam_runtime_put(dev);
43 @@ -1779,9 +1780,7 @@ static void unicam_stop_streaming(struct
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");
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;