From patchwork Tue Aug 14 13:50:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 10565629 X-Patchwork-Delegate: horms@verge.net.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C931F1390 for ; Tue, 14 Aug 2018 13:50:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB1AE29DC0 for ; Tue, 14 Aug 2018 13:50:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B94C929D8C; Tue, 14 Aug 2018 13:50:45 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4412429DC0 for ; Tue, 14 Aug 2018 13:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732747AbeHNQh7 (ORCPT ); Tue, 14 Aug 2018 12:37:59 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.82]:27965 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732699AbeHNQh7 (ORCPT ); Tue, 14 Aug 2018 12:37:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1534254643; s=strato-dkim-0002; d=fpond.eu; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=7e/NjPtDRZiDyjkqVJy7GKpwZ88dlVAtyVFKi4PWReE=; b=tGZFlJnIUVWGViH5DXI5ZH7sUub0WPC7llf/32/eQL+boo+KVVIOQVQYiuhL/ec44O +QRtHvhbmolR8sd8VFZvoTm3uvvFQZJDR3yZN5VCGXdiiA2s7JCbK0W3m6dUbplLRTZM dAH24If0c8PWF2HAAJLBNNZPQ9ej+mvvmSFoaBK5TZuE7OBfAqcAOjsat8XXluALV8uu aeZUMPHhQnQ6LiKV5VyvzE8Jo9/Z/GKYzDNmFLtxvAnQ2aMzGR8vq/GiDxsEOFjCA5Ts OyxOKff+rH8LyQvoj1k+sUiZukXOA9R+EiYhKO7Q7IvSTuaCh1Hq1eF3vhR/zKiJGQ5U /P3g== X-RZG-AUTH: ":OWANVUa4dPFUgKR/3dpvnYP0Np73dmm4I5W0/AvA67Ot4fvR82tad/Qd" X-RZG-CLASS-ID: mo00 Received: from groucho.site by smtp.strato.de (RZmta 43.18 DYNA|AUTH) with ESMTPSA id w02b1cu7EDoe0JG (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Tue, 14 Aug 2018 15:50:40 +0200 (CEST) From: Ulrich Hecht To: laurent.pinchart@ideasonboard.com Cc: linux-renesas-soc@vger.kernel.org, dri-devel@lists.freedesktop.org, jacopo+renesas@jmondi.org, kieran.bingham+renesas@ideasonboard.com, Ulrich Hecht Subject: [PROTO][PATCH 08/10] drm: rcar-du: lvds: Handle LVDS interface reset Date: Tue, 14 Aug 2018 15:50:02 +0200 Message-Id: <1534254604-24204-9-git-send-email-uli+renesas@fpond.eu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534254604-24204-1-git-send-email-uli+renesas@fpond.eu> References: <1534254604-24204-1-git-send-email-uli+renesas@fpond.eu> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jacopo Mondi The processor manual prescribes to clear reset of LVDS interface in CPG/MSSR module before display on, and to assert the same reset line at display off time, to have the module resuming in a known state. The module is said to be in "standby state" at initialization time, and this requires, according to section 37.3.7 of the manual, to de-assert the reset to have it functional. Based on the original patch from Koji Matsuoka Signed-off-by: Jacopo Mondi Signed-off-by: Ulrich Hecht --- drivers/gpu/drm/rcar-du/rcar_lvds.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c index cd55576..f6a4f9c 100644 --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -55,6 +56,7 @@ struct rcar_lvds { void __iomem *mmio; struct clk *clock; + struct reset_control *rst; bool enabled; struct drm_display_mode display_mode; @@ -385,6 +387,12 @@ static void rcar_lvds_enable(struct drm_bridge *bridge) if (ret < 0) return; + ret = reset_control_deassert(lvds->rst); + if (ret < 0) { + clk_disable_unprepare(lvds->clock); + return; + } + /* * Hardcode the channels and control signals routing for now. * @@ -476,6 +484,7 @@ static void rcar_lvds_disable(struct drm_bridge *bridge) rcar_lvds_write(lvds, LVDCR1, 0); rcar_lvds_write(lvds, LVDPLLCR, 0); + reset_control_assert(lvds->rst); clk_disable_unprepare(lvds->clock); lvds->enabled = false; @@ -692,6 +701,12 @@ static int rcar_lvds_probe(struct platform_device *pdev) return PTR_ERR(lvds->clock); } + lvds->rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); + if (IS_ERR(lvds->rst)) { + dev_err(&pdev->dev, "failed to get reset\n"); + return PTR_ERR(lvds->rst); + } + drm_bridge_add(&lvds->bridge); return 0;