diff options
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_tcon.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index c3d92d537240..8045871335b5 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <drm/drm_encoder.h> | 17 | #include <drm/drm_encoder.h> |
18 | #include <drm/drm_modes.h> | 18 | #include <drm/drm_modes.h> |
19 | #include <drm/drm_of.h> | 19 | #include <drm/drm_of.h> |
20 | #include <drm/drm_panel.h> | ||
21 | 20 | ||
22 | #include <uapi/drm/drm_mode.h> | 21 | #include <uapi/drm/drm_mode.h> |
23 | 22 | ||
@@ -350,9 +349,6 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon, | |||
350 | static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, | 349 | static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, |
351 | const struct drm_display_mode *mode) | 350 | const struct drm_display_mode *mode) |
352 | { | 351 | { |
353 | struct drm_panel *panel = tcon->panel; | ||
354 | struct drm_connector *connector = panel->connector; | ||
355 | struct drm_display_info display_info = connector->display_info; | ||
356 | unsigned int bp, hsync, vsync; | 352 | unsigned int bp, hsync, vsync; |
357 | u8 clk_delay; | 353 | u8 clk_delay; |
358 | u32 val = 0; | 354 | u32 val = 0; |
@@ -410,27 +406,6 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, | |||
410 | if (mode->flags & DRM_MODE_FLAG_PVSYNC) | 406 | if (mode->flags & DRM_MODE_FLAG_PVSYNC) |
411 | val |= SUN4I_TCON0_IO_POL_VSYNC_POSITIVE; | 407 | val |= SUN4I_TCON0_IO_POL_VSYNC_POSITIVE; |
412 | 408 | ||
413 | /* | ||
414 | * On A20 and similar SoCs, the only way to achieve Positive Edge | ||
415 | * (Rising Edge), is setting dclk clock phase to 2/3(240°). | ||
416 | * By default TCON works in Negative Edge(Falling Edge), | ||
417 | * this is why phase is set to 0 in that case. | ||
418 | * Unfortunately there's no way to logically invert dclk through | ||
419 | * IO_POL register. | ||
420 | * The only acceptable way to work, triple checked with scope, | ||
421 | * is using clock phase set to 0° for Negative Edge and set to 240° | ||
422 | * for Positive Edge. | ||
423 | * On A33 and similar SoCs there would be a 90° phase option, | ||
424 | * but it divides also dclk by 2. | ||
425 | * Following code is a way to avoid quirks all around TCON | ||
426 | * and DOTCLOCK drivers. | ||
427 | */ | ||
428 | if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE) | ||
429 | clk_set_phase(tcon->dclk, 240); | ||
430 | |||
431 | if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE) | ||
432 | clk_set_phase(tcon->dclk, 0); | ||
433 | |||
434 | regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG, | 409 | regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG, |
435 | SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | SUN4I_TCON0_IO_POL_VSYNC_POSITIVE, | 410 | SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | SUN4I_TCON0_IO_POL_VSYNC_POSITIVE, |
436 | val); | 411 | val); |