summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Renner Berthing <kernel@esmil.dk>2021-09-21 00:49:31 +0300
committerEmil Renner Berthing <kernel@esmil.dk>2021-09-27 03:08:16 +0300
commit82a2b0ed26eb03eee03853b8e4955bec36014f16 (patch)
tree9e311e5a9eb4b35a696c3df08ef764aa7990837f
parent86e57722a7b563bdffbb68c9b7ea5aec80d4551c (diff)
downloadlinux-82a2b0ed26eb03eee03853b8e4955bec36014f16.tar.xz
drm/starfive: Use actual clock rate
Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
-rw-r--r--drivers/gpu/drm/starfive/starfive_drm_lcdc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/starfive/starfive_drm_lcdc.c b/drivers/gpu/drm/starfive/starfive_drm_lcdc.c
index 705118b2891b..1e3c0156c0f6 100644
--- a/drivers/gpu/drm/starfive/starfive_drm_lcdc.c
+++ b/drivers/gpu/drm/starfive/starfive_drm_lcdc.c
@@ -2,7 +2,9 @@
/*
* Copyright (C) 2021 StarFive Technology Co., Ltd.
*/
+#include <linux/clk.h>
#include <linux/module.h>
+#include <linux/units.h>
#include <drm/drm_crtc.h>
#include "starfive_drm_lcdc.h"
#include "starfive_drm_vpp.h"
@@ -394,7 +396,7 @@ void lcdc_run(struct starfive_crtc *sf_crtc, uint32_t winMode, uint32_t lcdTrig)
static int sf_fb_lcdc_clk_cfg(struct starfive_crtc *sf_crtc, struct drm_crtc_state *state)
{
- u32 reg_val = 1485000 / state->mode.clock;
+ u32 reg_val = clk_get_rate(sf_crtc->clk_vout_src) / (state->mode.clock * HZ_PER_KHZ);
u32 tmp_val;
dev_dbg(sf_crtc->dev, "%s: reg_val = %u\n", __func__, reg_val);