[PATCH 4/5] drm/sun4i: Compute TCON1 mode from tv mode

From: Maxime Ripard
Date: Tue Oct 18 2016 - 04:30:14 EST


Since the mode passed in mode_set is probably going to be a scaled down
version of the TV mode, we cannot just use it.

Instead, try to retrieve the actual mode we want to set, and generate a drm
mode from that.

Signed-off-by: Maxime Ripard <maxime.ripard@xxxxxxxxxxxxxxxxxx>
---
drivers/gpu/drm/sun4i/sun4i_tv.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index 6f8077013be3..f99886462cb8 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -401,8 +401,13 @@ static void sun4i_tv_mode_set(struct drm_encoder *encoder,
struct sun4i_drv *drv = tv->drv;
struct sun4i_tcon *tcon = drv->tcon;
const struct tv_mode *tv_mode = sun4i_tv_find_tv_by_mode(mode);
+ struct drm_display_mode tv_drm_mode = { 0 };

- sun4i_tcon1_mode_set(tcon, mode);
+ strcpy(tv_drm_mode.name, "TV");
+ sun4i_tv_mode_to_drm_mode(tv_mode, &tv_drm_mode);
+ drm_mode_set_crtcinfo(&tv_drm_mode, CRTC_INTERLACE_HALVE_V);
+
+ sun4i_tcon1_mode_set(tcon, &tv_drm_mode);

/* Enable and map the DAC to the output */
regmap_update_bits(tv->regs, SUN4I_TVE_EN_REG,
--
git-series 0.8.10