Skip to content

Instantly share code, notes, and snippets.

@openedev
Created July 20, 2019 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save openedev/7e2c33248b372d29be9979e06d483673 to your computer and use it in GitHub Desktop.
Save openedev/7e2c33248b372d29be9979e06d483673 to your computer and use it in GitHub Desktop.
diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
index 778562b31598..56ef24b21448 100644
--- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c
+++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
@@ -75,11 +75,11 @@ static long sun4i_dclk_round_rate(struct clk_hw *hw, unsigned long rate,
struct sun4i_tcon *tcon = dclk->tcon;
unsigned long best_parent = 0;
u8 best_div = 1;
+ u64 ideal = (u64)rate * tcon->dclk_mul;
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;
/*
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 94f24c5e2dc5..82c62542c010 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -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 */
struct reset_control *lcd_rst;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment