mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-02-13 20:01:55 +00:00
56 lines
1.9 KiB
Diff
56 lines
1.9 KiB
Diff
From 6ff017a1ba4c11909953dac00868b77d67e849a4 Mon Sep 17 00:00:00 2001
|
|
From: Dom Cobley <popcornmix@gmail.com>
|
|
Date: Mon, 22 Feb 2021 18:50:50 +0000
|
|
Subject: [PATCH 371/552] rpivid: Request maximum hevc clock
|
|
|
|
Query maximum and minimum clock from driver
|
|
and use those
|
|
|
|
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
|
|
---
|
|
drivers/staging/media/rpivid/rpivid_video.c | 9 ++++++++-
|
|
1 file changed, 8 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/drivers/staging/media/rpivid/rpivid_video.c b/drivers/staging/media/rpivid/rpivid_video.c
|
|
index 3b9e51ca05b3..b377c17dfb21 100644
|
|
--- a/drivers/staging/media/rpivid/rpivid_video.c
|
|
+++ b/drivers/staging/media/rpivid/rpivid_video.c
|
|
@@ -490,6 +490,7 @@ static int rpivid_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|
{
|
|
struct rpivid_ctx *ctx = vb2_get_drv_priv(vq);
|
|
struct rpivid_dev *dev = ctx->dev;
|
|
+ long max_hevc_clock = clk_round_rate(dev->clock, ULONG_MAX);
|
|
int ret = 0;
|
|
|
|
if (ctx->src_fmt.pixelformat != V4L2_PIX_FMT_HEVC_SLICE)
|
|
@@ -498,7 +499,7 @@ static int rpivid_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|
if (V4L2_TYPE_IS_OUTPUT(vq->type) && dev->dec_ops->start)
|
|
ret = dev->dec_ops->start(ctx);
|
|
|
|
- ret = clk_set_rate(dev->clock, 500 * 1000 * 1000);
|
|
+ ret = clk_set_rate(dev->clock, max_hevc_clock);
|
|
if (ret) {
|
|
dev_err(dev->dev, "Failed to set clock rate\n");
|
|
goto out;
|
|
@@ -519,12 +520,18 @@ static void rpivid_stop_streaming(struct vb2_queue *vq)
|
|
{
|
|
struct rpivid_ctx *ctx = vb2_get_drv_priv(vq);
|
|
struct rpivid_dev *dev = ctx->dev;
|
|
+ long min_hevc_clock = clk_round_rate(dev->clock, 0);
|
|
+ int ret;
|
|
|
|
if (V4L2_TYPE_IS_OUTPUT(vq->type) && dev->dec_ops->stop)
|
|
dev->dec_ops->stop(ctx);
|
|
|
|
rpivid_queue_cleanup(vq, VB2_BUF_STATE_ERROR);
|
|
|
|
+ ret = clk_set_rate(dev->clock, min_hevc_clock);
|
|
+ if (ret)
|
|
+ dev_err(dev->dev, "Failed to set minimum clock rate\n");
|
|
+
|
|
clk_disable_unprepare(dev->clock);
|
|
}
|
|
|
|
--
|
|
2.33.0
|
|
|