@@ -291,18 +291,6 @@ static int sun4i_tcon_get_clk_delay(const struct drm_display_mode *mode,
291
291
return delay ;
292
292
}
293
293
294
- static void sun4i_tcon0_mode_set_common (struct sun4i_tcon * tcon ,
295
- const struct drm_display_mode * mode )
296
- {
297
- /* Configure the dot clock */
298
- clk_set_rate (tcon -> dclk , mode -> crtc_clock * 1000 );
299
-
300
- /* Set the resolution */
301
- regmap_write (tcon -> regs , SUN4I_TCON0_BASIC0_REG ,
302
- SUN4I_TCON0_BASIC0_X (mode -> crtc_hdisplay ) |
303
- SUN4I_TCON0_BASIC0_Y (mode -> crtc_vdisplay ));
304
- }
305
-
306
294
static void sun4i_tcon0_mode_set_dithering (struct sun4i_tcon * tcon ,
307
295
const struct drm_connector * connector )
308
296
{
@@ -367,10 +355,18 @@ static void sun4i_tcon0_mode_set_cpu(struct sun4i_tcon *tcon,
367
355
u32 block_space , start_delay ;
368
356
u32 tcon_div ;
369
357
358
+ /*
359
+ * dclk is required to run at 1/4 the DSI per-lane bit rate.
360
+ */
370
361
tcon -> dclk_min_div = SUN6I_DSI_TCON_DIV ;
371
362
tcon -> dclk_max_div = SUN6I_DSI_TCON_DIV ;
363
+ clk_set_rate (tcon -> dclk , mode -> crtc_clock * 1000 * (bpp / lanes )
364
+ / SUN6I_DSI_TCON_DIV );
372
365
373
- sun4i_tcon0_mode_set_common (tcon , mode );
366
+ /* Set the resolution */
367
+ regmap_write (tcon -> regs , SUN4I_TCON0_BASIC0_REG ,
368
+ SUN4I_TCON0_BASIC0_X (mode -> crtc_hdisplay ) |
369
+ SUN4I_TCON0_BASIC0_Y (mode -> crtc_vdisplay ));
374
370
375
371
/* Set dithering if needed */
376
372
sun4i_tcon0_mode_set_dithering (tcon , sun4i_tcon_get_connector (encoder ));
@@ -438,7 +434,12 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
438
434
439
435
tcon -> dclk_min_div = 7 ;
440
436
tcon -> dclk_max_div = 7 ;
441
- sun4i_tcon0_mode_set_common (tcon , mode );
437
+ clk_set_rate (tcon -> dclk , mode -> crtc_clock * 1000 );
438
+
439
+ /* Set the resolution */
440
+ regmap_write (tcon -> regs , SUN4I_TCON0_BASIC0_REG ,
441
+ SUN4I_TCON0_BASIC0_X (mode -> crtc_hdisplay ) |
442
+ SUN4I_TCON0_BASIC0_Y (mode -> crtc_vdisplay ));
442
443
443
444
/* Set dithering if needed */
444
445
sun4i_tcon0_mode_set_dithering (tcon , sun4i_tcon_get_connector (encoder ));
@@ -515,7 +516,12 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
515
516
516
517
tcon -> dclk_min_div = tcon -> quirks -> dclk_min_div ;
517
518
tcon -> dclk_max_div = 127 ;
518
- sun4i_tcon0_mode_set_common (tcon , mode );
519
+ clk_set_rate (tcon -> dclk , mode -> crtc_clock * 1000 );
520
+
521
+ /* Set the resolution */
522
+ regmap_write (tcon -> regs , SUN4I_TCON0_BASIC0_REG ,
523
+ SUN4I_TCON0_BASIC0_X (mode -> crtc_hdisplay ) |
524
+ SUN4I_TCON0_BASIC0_Y (mode -> crtc_vdisplay ));
519
525
520
526
/* Set dithering if needed */
521
527
sun4i_tcon0_mode_set_dithering (tcon , connector );
0 commit comments