-
-
Save openedev/de3745ee8fde3e302b7b49db54e2cfaa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c b/drivers/gpu/drm/sun4i/sun4i_dotclock.c | |
index 778562b31598..32d84c10f876 100644 | |
--- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c | |
+++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c | |
@@ -74,14 +74,17 @@ static long sun4i_dclk_round_rate(struct clk_hw *hw, unsigned long rate, | |
struct sun4i_dclk *dclk = hw_to_dclk(hw); | |
struct sun4i_tcon *tcon = dclk->tcon; | |
unsigned long best_parent = 0; | |
+ u64 ideal = (u64)rate * tcon->dclk_mul; | |
u8 best_div = 1; | |
int i; | |
printk("%s: min_div = %d max_div = %d, rate = %d\n", __func__, tcon->dclk_min_div, tcon->dclk_max_div, rate); | |
for (i = tcon->dclk_min_div; i <= tcon->dclk_max_div; i++) { | |
- u64 ideal = (u64)rate * i; | |
unsigned long rounded; | |
+ if (!tcon->dclk_mul) | |
+ ideal = (u64)rate * i; | |
+ | |
/* | |
* ideal has overflowed the max value that can be stored in an | |
* unsigned long, and every clk operation we might do on a | |
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c | |
index 94f24c5e2dc5..d742bf07c200 100644 | |
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c | |
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c | |
@@ -267,7 +267,7 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon, | |
const struct drm_display_mode *mode) | |
{ | |
/* Configure the dot clock */ | |
- clk_set_rate(tcon->dclk, mode->crtc_clock * 1000); | |
+ clk_set_rate_exclusive(tcon->dclk, mode->crtc_clock * 1000); | |
/* Set the resolution */ | |
regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG, | |
@@ -338,8 +338,9 @@ static void sun4i_tcon0_mode_set_cpu(struct sun4i_tcon *tcon, | |
u32 block_space, start_delay; | |
u32 tcon_div; | |
- tcon->dclk_min_div = bpp/lanes; | |
- tcon->dclk_max_div = bpp/lanes; | |
+ tcon->dclk_min_div = 4; | |
+ tcon->dclk_max_div = 127; | |
+ tcon->dclk_mul = bpp / lanes; | |
sun4i_tcon0_mode_set_common(tcon, mode); | |
@@ -409,6 +410,7 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon, | |
tcon->dclk_min_div = 7; | |
tcon->dclk_max_div = 7; | |
+ tcon->dclk_mul = 1; | |
sun4i_tcon0_mode_set_common(tcon, mode); | |
/* Set dithering if needed */ | |
@@ -488,6 +490,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, | |
tcon->dclk_min_div = 6; | |
tcon->dclk_max_div = 127; | |
+ tcon->dclk_mul = 1; | |
sun4i_tcon0_mode_set_common(tcon, mode); | |
/* Set dithering if needed */ | |
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h | |
index 7062c30eb6c7..603559cb93c0 100644 | |
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h | |
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h | |
@@ -248,6 +248,7 @@ struct sun4i_tcon { | |
struct clk *dclk; | |
u8 dclk_max_div; | |
u8 dclk_min_div; | |
+ u8 dclk_mul; | |
/* Reset control */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment