Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964933AbcJRIaK (ORCPT ); Tue, 18 Oct 2016 04:30:10 -0400 Received: from up.free-electrons.com ([163.172.77.33]:52508 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934102AbcJRI3o (ORCPT ); Tue, 18 Oct 2016 04:29:44 -0400 From: Maxime Ripard To: Daniel Vetter , David Airlie Cc: dri-devel@lists.freedesktop.org, Laurent Pinchart , Boris Brezillon , Thomas Petazzoni , linux-arm-kernel@lists.infradead.org, Hans de Goede , Chen-Yu Tsai , Maxime Ripard , linux-kernel@vger.kernel.org Subject: [PATCH 4/5] drm/sun4i: Compute TCON1 mode from tv mode Date: Tue, 18 Oct 2016 10:29:37 +0200 Message-Id: X-Mailer: git-send-email 2.9.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1193 Lines: 32 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 --- 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