From patchwork Tue Oct 18 08:29:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 9381625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8368C60839 for ; Tue, 18 Oct 2016 08:39:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71B93293FF for ; Tue, 18 Oct 2016 08:39:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 668B72940E; Tue, 18 Oct 2016 08:39:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0FD28293FF for ; Tue, 18 Oct 2016 08:39:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 14B956E3B7; Tue, 18 Oct 2016 08:39:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 605 seconds by postgrey-1.35 at gabe; Tue, 18 Oct 2016 08:39:45 UTC Received: from mail.free-electrons.com (up.free-electrons.com [163.172.77.33]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E9C06E3B7 for ; Tue, 18 Oct 2016 08:39:45 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 4D9A3228F3; Tue, 18 Oct 2016 10:29:42 +0200 (CEST) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 28407228EE; Tue, 18 Oct 2016 10:29:42 +0200 (CEST) From: Maxime Ripard To: Daniel Vetter , David Airlie 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: Cc: Thomas Petazzoni , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Hans de Goede , Chen-Yu Tsai , Laurent Pinchart , Maxime Ripard , linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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,