bcm2835-unicam: Switch to new clock api
authorDom Cobley <popcornmix@gmail.com>
Tue, 13 Apr 2021 15:48:35 +0000 (16:48 +0100)
committerDom Cobley <popcornmix@gmail.com>
Mon, 21 Mar 2022 16:04:13 +0000 (16:04 +0000)
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
drivers/media/platform/bcm2835/bcm2835-unicam.c

index db99d15..a603891 100644 (file)
@@ -429,6 +429,8 @@ struct unicam_device {
        struct clk *clock;
        /* vpu clock handle */
        struct clk *vpu_clock;
+       /* vpu clock request */
+       struct clk_request *vpu_req;
        /* clock status for error handling */
        bool clocks_enabled;
        /* V4l2 device */
@@ -1694,8 +1696,8 @@ static int unicam_start_streaming(struct vb2_queue *vq, unsigned int count)
        unicam_dbg(1, dev, "Running with %u data lanes\n",
                   dev->active_data_lanes);
 
-       ret = clk_set_min_rate(dev->vpu_clock, MIN_VPU_CLOCK_RATE);
-       if (ret) {
+       dev->vpu_req = clk_request_start(dev->vpu_clock, MIN_VPU_CLOCK_RATE);
+       if (!dev->vpu_req) {
                unicam_err(dev, "failed to set up VPU clock\n");
                goto err_pm_put;
        }
@@ -1751,8 +1753,7 @@ err_disable_unicam:
        unicam_disable(dev);
        clk_disable_unprepare(dev->clock);
 err_vpu_clock:
-       if (clk_set_min_rate(dev->vpu_clock, 0))
-               unicam_err(dev, "failed to reset the VPU clock\n");
+       clk_request_done(dev->vpu_req);
        clk_disable_unprepare(dev->vpu_clock);
 err_pm_put:
        unicam_runtime_put(dev);
@@ -1782,9 +1783,7 @@ static void unicam_stop_streaming(struct vb2_queue *vq)
                unicam_disable(dev);
 
                if (dev->clocks_enabled) {
-                       if (clk_set_min_rate(dev->vpu_clock, 0))
-                               unicam_err(dev, "failed to reset the min VPU clock\n");
-
+                       clk_request_done(dev->vpu_req);
                        clk_disable_unprepare(dev->vpu_clock);
                        clk_disable_unprepare(dev->clock);
                        dev->clocks_enabled = false;