1 From 4ffdf70996826a87fceb78f2399c98e8a4c6aa89 Mon Sep 17 00:00:00 2001
2 From: Dom Cobley <popcornmix@gmail.com>
3 Date: Mon, 19 Apr 2021 19:30:26 +0100
4 Subject: [PATCH] rpivid: Switch to new clock api
6 Signed-off-by: Dom Cobley <popcornmix@gmail.com>
8 drivers/staging/media/rpivid/rpivid.h | 1 +
9 drivers/staging/media/rpivid/rpivid_video.c | 11 +++--------
10 2 files changed, 4 insertions(+), 8 deletions(-)
12 --- a/drivers/staging/media/rpivid/rpivid.h
13 +++ b/drivers/staging/media/rpivid/rpivid.h
14 @@ -172,6 +172,7 @@ struct rpivid_dev {
15 void __iomem *base_h265;
18 + struct clk_request *hevc_req;
20 struct rpivid_hw_irq_ctrl ic_active1;
21 struct rpivid_hw_irq_ctrl ic_active2;
22 --- a/drivers/staging/media/rpivid/rpivid_video.c
23 +++ b/drivers/staging/media/rpivid/rpivid_video.c
24 @@ -499,8 +499,8 @@ static int rpivid_start_streaming(struct
25 if (V4L2_TYPE_IS_OUTPUT(vq->type) && dev->dec_ops->start)
26 ret = dev->dec_ops->start(ctx);
28 - ret = clk_set_rate(dev->clock, max_hevc_clock);
30 + dev->hevc_req = clk_request_start(dev->clock, max_hevc_clock);
31 + if (!dev->hevc_req) {
32 dev_err(dev->dev, "Failed to set clock rate\n");
35 @@ -520,18 +520,13 @@ static void rpivid_stop_streaming(struct
37 struct rpivid_ctx *ctx = vb2_get_drv_priv(vq);
38 struct rpivid_dev *dev = ctx->dev;
39 - long min_hevc_clock = clk_round_rate(dev->clock, 0);
42 if (V4L2_TYPE_IS_OUTPUT(vq->type) && dev->dec_ops->stop)
43 dev->dec_ops->stop(ctx);
45 rpivid_queue_cleanup(vq, VB2_BUF_STATE_ERROR);
47 - ret = clk_set_rate(dev->clock, min_hevc_clock);
49 - dev_err(dev->dev, "Failed to set minimum clock rate\n");
51 + clk_request_done(dev->hevc_req);
52 clk_disable_unprepare(dev->clock);