Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp5879506imm; Sat, 19 May 2018 11:35:20 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrDjqQwWgfxmX9LV1aNz5NeGo6gXJksgEpLMfZkOwpLV1jeh7cFuwdzfR/z49Zc+7tSF/b2 X-Received: by 2002:a65:6645:: with SMTP id z5-v6mr11276503pgv.43.1526754919943; Sat, 19 May 2018 11:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526754919; cv=none; d=google.com; s=arc-20160816; b=aj5EZ2yatgQ4LFXKDG0A9s3YdMn2GbbVYrXbA3X+EPTL/kLezUQSwUc0eGgrpiKKgi psYiBDYxIArofx3FYI0tViLfN/PBQOU56M9fdPAL8vi38TX3cWlyJXS0WRxb2cItu1sR bGV7JesXmQvUiGGpE6eNSClhB/6ErnLPYnWi4bFrNZtGAL+qbJ1YJ52xyJ8GOutEQBvY bBGkFA/Ke6uHdL3mo8KBifQyLx3qM6F6aA3or2w+fWLbfWCKyvxc9FCh4bEIX0hBjjfc FBn5dqcC37HvFiVrqVbYz1spmwDel6bdIHgU3xV3rytj7IF7fpYUWZdXC3wXWQx8YlDp mmeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=mdCajFct5R2u8k4DxsNJfu+qqoy/gihFNgJAvlU18tw=; b=tc3p7/eqISvo0iCF6pvGK4JUqFYV3Aubts+o3fg7WgEEqfeTZeLFcDEBbOH1A6N1DX QwKlGVoGqkni+9QKBKP1wcnElGqR7eqveZ27gB61OUlekp0gAsbgNQ8w3lZK2L1VTjD8 lUbEYw0+Bikt7hJAQ6xFqoxgqDQgO7X7/hhfcv+lLiXz+CrPqeJ2ytiIB6bg6cVK7WLH ArwhfcLteQkBkDsq50THjpafJAXmU8HinLLJCn3CH37jlCJfS2yq7TLgiWdyaxFC0T6H R4QG6KnYzq1qI1jA2h0bHHStwlt/Y4jB3S+mpVKFgYmse1Sdp0qzXEV/5aIvTwvAFUMt OjlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2-v6si1786829pgf.432.2018.05.19.11.35.05; Sat, 19 May 2018 11:35:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752794AbeESSeW (ORCPT + 99 others); Sat, 19 May 2018 14:34:22 -0400 Received: from mailout7.siol.net ([213.250.19.134]:34810 "EHLO mail.siol.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752674AbeESScz (ORCPT ); Sat, 19 May 2018 14:32:55 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTP id E1673520802; Sat, 19 May 2018 20:32:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta10.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta10.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id wy_jTFiNIkVj; Sat, 19 May 2018 20:32:53 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Postfix) with ESMTPS id 6027F52047D; Sat, 19 May 2018 20:32:53 +0200 (CEST) Received: from localhost.localdomain (unknown [194.152.15.144]) (Authenticated sender: 031275009) by mail.siol.net (Postfix) with ESMTPSA id EB636520802; Sat, 19 May 2018 20:32:50 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org, robh+dt@kernel.org Cc: mark.rutland@arm.com, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH 11/15] drm/sun4i: DW HDMI PHY: Add support for second PLL Date: Sat, 19 May 2018 20:31:23 +0200 Message-Id: <20180519183127.2718-12-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180519183127.2718-1-jernej.skrabec@siol.net> References: <20180519183127.2718-1-jernej.skrabec@siol.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some DW HDMI PHYs like those found in A64 and R40 SoCs, can select between two clock parents. Add code which reads second PLL from DT. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 ++ drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h index 79154f0f674a..801a17222762 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -147,6 +147,7 @@ struct sun8i_hdmi_phy; struct sun8i_hdmi_phy_variant { bool has_phy_clk; + bool has_second_pll; void (*phy_init)(struct sun8i_hdmi_phy *phy); void (*phy_disable)(struct dw_hdmi *hdmi, struct sun8i_hdmi_phy *phy); @@ -160,6 +161,7 @@ struct sun8i_hdmi_phy { struct clk *clk_mod; struct clk *clk_phy; struct clk *clk_pll0; + struct clk *clk_pll1; unsigned int rcal; struct regmap *regs; struct reset_control *rst_phy; diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c index 5a52fc489a9d..deba47ed69d8 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -472,10 +472,19 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node) goto err_put_clk_mod; } + if (phy->variant->has_second_pll) { + phy->clk_pll1 = of_clk_get_by_name(node, "pll-1"); + if (IS_ERR(phy->clk_pll1)) { + dev_err(dev, "Could not get pll-1 clock\n"); + ret = PTR_ERR(phy->clk_pll1); + goto err_put_clk_pll0; + } + } + ret = sun8i_phy_clk_create(phy, dev); if (ret) { dev_err(dev, "Couldn't create the PHY clock\n"); - goto err_put_clk_pll0; + goto err_put_clk_pll1; } } @@ -483,7 +492,7 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node) if (IS_ERR(phy->rst_phy)) { dev_err(dev, "Could not get phy reset control\n"); ret = PTR_ERR(phy->rst_phy); - goto err_put_clk_pll0; + goto err_put_clk_pll1; } ret = reset_control_deassert(phy->rst_phy); @@ -514,9 +523,10 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node) reset_control_assert(phy->rst_phy); err_put_rst_phy: reset_control_put(phy->rst_phy); +err_put_clk_pll1: + clk_put(phy->clk_pll1); err_put_clk_pll0: - if (phy->variant->has_phy_clk) - clk_put(phy->clk_pll0); + clk_put(phy->clk_pll0); err_put_clk_mod: clk_put(phy->clk_mod); err_put_clk_bus: @@ -536,8 +546,8 @@ void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi) reset_control_put(phy->rst_phy); - if (phy->variant->has_phy_clk) - clk_put(phy->clk_pll0); + clk_put(phy->clk_pll0); + clk_put(phy->clk_pll1); clk_put(phy->clk_mod); clk_put(phy->clk_bus); } -- 2.17.0