Skip to content

Instantly share code, notes, and snippets.

@openedev
Created July 20, 2019 07:26
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/3b0b3d35ced6d89f5be0831f1cc9d840 to your computer and use it in GitHub Desktop.
Save openedev/3b0b3d35ced6d89f5be0831f1cc9d840 to your computer and use it in GitHub Desktop.
DSI - 1
diff --git a/drivers/gpu/drm/sun4i/sun4i_dotclock.c b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
index 778562b31598..4e59f672455f 100644
--- a/drivers/gpu/drm/sun4i/sun4i_dotclock.c
+++ b/drivers/gpu/drm/sun4i/sun4i_dotclock.c
@@ -95,10 +95,11 @@ static long sun4i_dclk_round_rate(struct clk_hw *hw, unsigned long rate,
rounded = clk_hw_round_rate(clk_hw_get_parent(hw),
ideal);
- printk("ideal = %d, rounded = %d\n", ideal, rounded);
+ printk("ideal = %d, rounded = %d, i = %d\n", ideal, rounded, i);
if (rounded == ideal) {
best_parent = rounded;
best_div = i;
+ printk("= BEST DIVIDER %d\n", best_div);
goto out;
}
@@ -106,6 +107,7 @@ static long sun4i_dclk_round_rate(struct clk_hw *hw, unsigned long rate,
abs(rate - best_parent / best_div)) {
best_parent = rounded;
best_div = i;
+ printk("!= BEST DIVIDER %d\n", best_div);
}
}
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 94f24c5e2dc5..7342de739cad 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -266,9 +266,6 @@ static int sun4i_tcon_get_clk_delay(const struct drm_display_mode *mode,
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);
-
/* Set the resolution */
regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG,
SUN4I_TCON0_BASIC0_X(mode->crtc_hdisplay) |
@@ -338,8 +335,11 @@ 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 = 4;
+
+ /* Configure the dot clock */
+ clk_set_rate(tcon->dclk, mode->crtc_clock * bpp / lanes * 1000);
sun4i_tcon0_mode_set_common(tcon, mode);
@@ -409,6 +409,10 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
tcon->dclk_min_div = 7;
tcon->dclk_max_div = 7;
+
+ /* Configure the dot clock */
+ clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
+
sun4i_tcon0_mode_set_common(tcon, mode);
/* Set dithering if needed */
@@ -488,6 +492,10 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
tcon->dclk_min_div = 6;
tcon->dclk_max_div = 127;
+
+ /* Configure the dot clock */
+ clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
+
sun4i_tcon0_mode_set_common(tcon, mode);
/* Set dithering if needed */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment