Skip to content

Commit 4396393

Browse files
wensmripard
authored andcommitted
drm/sun4i: tcon: Set RGB DCLK min. divider based on hardware model
In commit 0b8e7bb ("drm/sun4i: tcon: Set min division of TCON0_DCLK to 1.") it was assumed that all TCON variants support a minimum divider of 1 if only DCLK was used. However, the oldest generation of hardware only supports minimum divider of 4 if only DCLK is used. If a divider of 1 was used on this old hardware, some scrolling artifact would appear. A divider of 2 seemed OK, but a divider of 3 had artifacts as well. Set the minimum divider when outputing to parallel RGB based on the hardware model, with a minimum of 4 for the oldest (A10/A10s/A13/A20) hardware, and a minimum of 1 for the rest. A value is not set for the TCON variants lacking channel 0. This fixes the scrolling artifacts seen on my A13 tablet. Fixes: 0b8e7bb ("drm/sun4i: tcon: Set min division of TCON0_DCLK to 1.") Cc: <[email protected]> # 5.4.x Signed-off-by: Chen-Yu Tsai <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c4e4fcc commit 4396393

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

drivers/gpu/drm/sun4i/sun4i_tcon.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
489489

490490
WARN_ON(!tcon->quirks->has_channel_0);
491491

492-
tcon->dclk_min_div = 1;
492+
tcon->dclk_min_div = tcon->quirks->dclk_min_div;
493493
tcon->dclk_max_div = 127;
494494
sun4i_tcon0_mode_set_common(tcon, mode);
495495

@@ -1426,12 +1426,14 @@ static int sun8i_r40_tcon_tv_set_mux(struct sun4i_tcon *tcon,
14261426
static const struct sun4i_tcon_quirks sun4i_a10_quirks = {
14271427
.has_channel_0 = true,
14281428
.has_channel_1 = true,
1429+
.dclk_min_div = 4,
14291430
.set_mux = sun4i_a10_tcon_set_mux,
14301431
};
14311432

14321433
static const struct sun4i_tcon_quirks sun5i_a13_quirks = {
14331434
.has_channel_0 = true,
14341435
.has_channel_1 = true,
1436+
.dclk_min_div = 4,
14351437
.set_mux = sun5i_a13_tcon_set_mux,
14361438
};
14371439

@@ -1440,30 +1442,35 @@ static const struct sun4i_tcon_quirks sun6i_a31_quirks = {
14401442
.has_channel_1 = true,
14411443
.has_lvds_alt = true,
14421444
.needs_de_be_mux = true,
1445+
.dclk_min_div = 1,
14431446
.set_mux = sun6i_tcon_set_mux,
14441447
};
14451448

14461449
static const struct sun4i_tcon_quirks sun6i_a31s_quirks = {
14471450
.has_channel_0 = true,
14481451
.has_channel_1 = true,
14491452
.needs_de_be_mux = true,
1453+
.dclk_min_div = 1,
14501454
};
14511455

14521456
static const struct sun4i_tcon_quirks sun7i_a20_quirks = {
14531457
.has_channel_0 = true,
14541458
.has_channel_1 = true,
1459+
.dclk_min_div = 4,
14551460
/* Same display pipeline structure as A10 */
14561461
.set_mux = sun4i_a10_tcon_set_mux,
14571462
};
14581463

14591464
static const struct sun4i_tcon_quirks sun8i_a33_quirks = {
14601465
.has_channel_0 = true,
14611466
.has_lvds_alt = true,
1467+
.dclk_min_div = 1,
14621468
};
14631469

14641470
static const struct sun4i_tcon_quirks sun8i_a83t_lcd_quirks = {
14651471
.supports_lvds = true,
14661472
.has_channel_0 = true,
1473+
.dclk_min_div = 1,
14671474
};
14681475

14691476
static const struct sun4i_tcon_quirks sun8i_a83t_tv_quirks = {
@@ -1477,11 +1484,13 @@ static const struct sun4i_tcon_quirks sun8i_r40_tv_quirks = {
14771484

14781485
static const struct sun4i_tcon_quirks sun8i_v3s_quirks = {
14791486
.has_channel_0 = true,
1487+
.dclk_min_div = 1,
14801488
};
14811489

14821490
static const struct sun4i_tcon_quirks sun9i_a80_tcon_lcd_quirks = {
1483-
.has_channel_0 = true,
1484-
.needs_edp_reset = true,
1491+
.has_channel_0 = true,
1492+
.needs_edp_reset = true,
1493+
.dclk_min_div = 1,
14851494
};
14861495

14871496
static const struct sun4i_tcon_quirks sun9i_a80_tcon_tv_quirks = {

drivers/gpu/drm/sun4i/sun4i_tcon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ struct sun4i_tcon_quirks {
224224
bool needs_de_be_mux; /* sun6i needs mux to select backend */
225225
bool needs_edp_reset; /* a80 edp reset needed for tcon0 access */
226226
bool supports_lvds; /* Does the TCON support an LVDS output? */
227+
u8 dclk_min_div; /* minimum divider for TCON0 DCLK */
227228

228229
/* callback to handle tcon muxing options */
229230
int (*set_mux)(struct sun4i_tcon *, const struct drm_encoder *);

0 commit comments

Comments
 (0)