From patchwork Thu Mar 1 18:10:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10252205 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 31E8360365 for ; Thu, 1 Mar 2018 18:10:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23C7A22AFC for ; Thu, 1 Mar 2018 18:10:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17EB02846D; Thu, 1 Mar 2018 18:10:23 +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 8BA6622AFC for ; Thu, 1 Mar 2018 18:10:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A74C16ED1A; Thu, 1 Mar 2018 18:10:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A10F6ED1A for ; Thu, 1 Mar 2018 18:10:20 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id r80so9629182lfe.13 for ; Thu, 01 Mar 2018 10:10:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=subject:from:to:references:organization:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=v4IjPV7E8K1cbTWyhxoT5X4TFgpWmNN4uj7c52Z7cI4=; b=sjrPVH8JHQXt8n+U5n0D70u8rR9rZMAgSANcayHLzECrenSgQ7dOq6UMkPPa4JowuW skyff/EFvpm1RgSab3iusJ7agO/B5q6Z2JqsV2k4493kr2Pj/WxD8LNaPHai+gqfHdTq Np3fRwWqHY8I47GLoCVIakmYiK2eE+MJgSMMMWB49AiM3vk8Ja6pSYEydbEfp002Majq /nHe9DdxfG/lb87A5N0ByRanfj6FIVok8O+vHufkVxDm/m9/dv0MAYXhbcqB79hrcXHD +E3rI2/irUZ7jLoEG3dJNLkl5O79Gcngaqucu/a2oJ0am/x9NaNuxQPyyCk2q/dAIId4 zkag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=v4IjPV7E8K1cbTWyhxoT5X4TFgpWmNN4uj7c52Z7cI4=; b=oTL2D8pdVcQ1sCDIpalrUoehKNFj6u/2bya2gZf1Q5r5T8yl8ZHDMacKrwYChou/Pw IL5vV0vEYTXLI79yL/i98kiylW/4TFg5J7QchobBTXtzgrf98/qcihekwcbilXdUlf5z 4xLYW0l8vTtZQWp558S+AJ4koO/b7HUxBlNLa7M00lke6Dsra26c/tvVsKg4qFjI/EaR nxEeSbGYgDZKFhpFV+1Jd42YVB76AOJHVXbfx8B8D4PYOfoOUZ0zRfiJfefsauBB7931 zi99NaWdSaHJGkGLR5lDv23ppAQE1krZitbN9JBtKfB5RDodQk/F5kI4F2MZLLdTGAlj /H6g== X-Gm-Message-State: APf1xPAn38MWGD5kpOoY6mEF1/RRXopQB9bGCcVL8sdLWXNo4kh0F3XF JSbqfq+aBSCQJpzSSo3Pc2xK2Ih9U/U= X-Google-Smtp-Source: AG47ELs5pUgwP4akbNn76vOlCZ61ZnB59aZmGwjXCU52OQ0sadPnQ6fhmxbH0JvFb1/rn31beEhRxA== X-Received: by 10.46.1.150 with SMTP id f22mr1914802lji.107.1519927818809; Thu, 01 Mar 2018 10:10:18 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.87.127]) by smtp.gmail.com with ESMTPSA id g23sm969638ljg.4.2018.03.01.10.10.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 10:10:18 -0800 (PST) Subject: [PATCH v2 2/2] drm: rcar-du: lvds: add R8A77970 support From: Sergei Shtylyov To: Laurent Pinchart , David Airlie , dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org References: Organization: Cogent Embedded Message-ID: <5b92565f-3857-af0f-a953-3588cfbe331d@cogentembedded.com> Date: Thu, 1 Mar 2018 21:10:16 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-MW X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add support for the R-Car V3M (R8A77970) SoC to the LVDS encoder driver. Note that there are some differences with the other R-Car gen3 SoCs, e.g. LVDPLLCR has the same layout as in the R-Car gen2 SoCs... Signed-off-by: Sergei Shtylyov Reviewed-by: Laurent Pinchart --- Changes in version 2: - shortened the comment to #define RCAR_LVDS_QUIRK_GEN2_PLLCR and applied this quitk to all R-Car gen2 SoCs, thus simplifying the check for the gen2 LVDPLLCR layout; - renamed RCAR_LVDS_QUIRK_PHY to RCAR_LVDS_QUIRK_GEN3_LVEN, reworded the comment to this #define; - removed the 'quirks' variable from rcar_lvds_enable(); - resolved rejects atop of the recent version of the LVDS driver. drivers/gpu/drm/rcar-du/rcar_lvds.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) Index: linux/drivers/gpu/drm/rcar-du/rcar_lvds.c =================================================================== --- linux.orig/drivers/gpu/drm/rcar-du/rcar_lvds.c +++ linux/drivers/gpu/drm/rcar-du/rcar_lvds.c @@ -32,6 +32,9 @@ enum rcar_lvds_mode { }; #define RCAR_LVDS_QUIRK_LANES (1 << 0) /* LVDS lanes 1 and 3 inverted */ +#define RCAR_LVDS_QUIRK_GEN2_PLLCR (1 << 1) /* LVDPLLCR has gen2 layout */ +#define RCAR_LVDS_QUIRK_GEN3_LVEN (1 << 2) /* LVEN bit needs to be set */ + /* on R8A77970/R8A7799x */ struct rcar_lvds_device_info { unsigned int gen; @@ -191,7 +194,7 @@ static void rcar_lvds_enable(struct drm_ rcar_lvds_write(lvds, LVDCHCR, lvdhcr); /* PLL clock configuration. */ - if (lvds->info->gen < 3) + if (lvds->info->quirks & RCAR_LVDS_QUIRK_GEN2_PLLCR) lvdpllcr = rcar_lvds_lvdpllcr_gen2(mode->clock); else lvdpllcr = rcar_lvds_lvdpllcr_gen3(mode->clock); @@ -224,6 +227,12 @@ static void rcar_lvds_enable(struct drm_ rcar_lvds_write(lvds, LVDCR0, lvdcr0); } + if (lvds->info->quirks & RCAR_LVDS_QUIRK_GEN3_LVEN) { + /* Turn on the LVDS PHY. */ + lvdcr0 |= LVDCR0_LVEN; + rcar_lvds_write(lvds, LVDCR0, lvdcr0); + } + /* Wait for the startup delay. */ usleep_range(100, 150); @@ -485,17 +494,23 @@ static int rcar_lvds_remove(struct platf static const struct rcar_lvds_device_info rcar_lvds_gen2_info = { .gen = 2, + .quirks = RCAR_LVDS_QUIRK_GEN2_PLLCR, }; static const struct rcar_lvds_device_info rcar_lvds_r8a7790_info = { .gen = 2, - .quirks = RCAR_LVDS_QUIRK_LANES, + .quirks = RCAR_LVDS_QUIRK_GEN2_PLLCR | RCAR_LVDS_QUIRK_LANES, }; static const struct rcar_lvds_device_info rcar_lvds_gen3_info = { .gen = 3, }; +static const struct rcar_lvds_device_info rcar_lvds_r8a77970_info = { + .gen = 3, + .quirks = RCAR_LVDS_QUIRK_GEN2_PLLCR | RCAR_LVDS_QUIRK_GEN3_LVEN, +}; + static const struct of_device_id rcar_lvds_of_table[] = { { .compatible = "renesas,r8a7743-lvds", .data = &rcar_lvds_gen2_info }, { .compatible = "renesas,r8a7790-lvds", .data = &rcar_lvds_r8a7790_info }, @@ -503,6 +518,7 @@ static const struct of_device_id rcar_lv { .compatible = "renesas,r8a7793-lvds", .data = &rcar_lvds_gen2_info }, { .compatible = "renesas,r8a7795-lvds", .data = &rcar_lvds_gen3_info }, { .compatible = "renesas,r8a7796-lvds", .data = &rcar_lvds_gen3_info }, + { .compatible = "renesas,r8a77970-lvds", .data = &rcar_lvds_r8a77970_info }, { } };