From patchwork Fri Jan 12 23:10:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10161845 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 9D2EA602B3 for ; Fri, 12 Jan 2018 23:10:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C7E228A19 for ; Fri, 12 Jan 2018 23:10:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EC9128A21; Fri, 12 Jan 2018 23:10:11 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 2507E28A19 for ; Fri, 12 Jan 2018 23:10:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B98B36EAA2; Fri, 12 Jan 2018 23:10:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from galahad.ideasonboard.com (galahad.ideasonboard.com [185.26.127.97]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8AB136EAA2 for ; Fri, 12 Jan 2018 23:10:07 +0000 (UTC) Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id 2CC2C20064; Sat, 13 Jan 2018 00:09:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1515798560; bh=uNXsWqp2XE4S49hoiE1v4jRscs1BSk1E0A3PUeHwGb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TdvbMIbrCF9deq8MVGBkclvEYC0q1ijn68ADXL20kyCM19Of4wF4+of/QDvLo3PJh ipFu/Qx57S8RXO5FL42EbNLMK5wBr2Nn9i5FyM3lp/QsBZOZno17bBYIB3EWUnjpwb c9NhZye1fUoCVrbTr8r3VupvWzHFIq7hoPB4basU= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/2] drm: rcar-du: lvds: Fix LVDS startup on R-Car gen2 Date: Sat, 13 Jan 2018 01:10:02 +0200 Message-Id: <20180112231002.26213-1-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <11845752.a3eY2rs97p@avalon> References: <11845752.a3eY2rs97p@avalon> Cc: linux-renesas-soc@vger.kernel.org, Sergei Shtylyov 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 From: Sergei Shtylyov According to the latest revision 2.00 of the R-Car gen2 manual, the LVDS must be enabled and the bias crcuit enabled after the LVDS I/O pins are enabled, not before. Fix the gen2 LVDS startup sequence accordingly. While at it, also fix the comment preceding the first LVDCR0 write that still talks about hardcoding the LVDS mode 0. Fixes: 90374b5c25c9 ("drm/rcar-du: Add internal LVDS encoder support") Signed-off-by: Sergei Shtylyov Reviewed-by: Laurent Pinchart [Set the mode and input at the same time as the BEN and LVEN bits] Tested-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) Hi Sergei, For your convenience (and if you agree with bundling mode setup with the first write as explained in my review of patch 1/2), here's the updated version of patch 2/2 that I have taken in my development branch. If you're fine with it I'll keep it, otherwise we can continue the review discussion. diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c b/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c index abbb7b25129a..b37c255c3d93 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c @@ -59,20 +59,20 @@ static void rcar_du_lvdsenc_start_gen2(struct rcar_du_lvdsenc *lvds, rcar_lvds_write(lvds, LVDPLLCR, pllcr); + /* Turn all the channels on. */ + rcar_lvds_write(lvds, LVDCR1, + LVDCR1_CHSTBY(3) | LVDCR1_CHSTBY(2) | + LVDCR1_CHSTBY(1) | LVDCR1_CHSTBY(0) | LVDCR1_CLKSTBY); + /* - * Select the input, hardcode mode 0, enable LVDS operation and turn - * bias circuitry on. + * Set the LVDS mode, select the input, enable LVDS operation, + * and turn bias circuitry on. */ lvdcr0 = (lvds->mode << LVDCR0_LVMD_SHIFT) | LVDCR0_BEN | LVDCR0_LVEN; if (rcrtc->index == 2) lvdcr0 |= LVDCR0_DUSEL; rcar_lvds_write(lvds, LVDCR0, lvdcr0); - /* Turn all the channels on. */ - rcar_lvds_write(lvds, LVDCR1, - LVDCR1_CHSTBY(3) | LVDCR1_CHSTBY(2) | - LVDCR1_CHSTBY(1) | LVDCR1_CHSTBY(0) | LVDCR1_CLKSTBY); - /* * Turn the PLL on, wait for the startup delay, and turn the output * on.