mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Evan Green <evgreen@chromium.org>
To: Kishon Vijay Abraham I <kishon@ti.com>,
	Rob Herring <robh+dt@kernel.org>,
	Andy Gross <andy.gross@linaro.org>
Cc: Douglas Anderson <dianders@chromium.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Evan Green <evgreen@chromium.org>, Rob Herring <robh@kernel.org>,
	Can Guo <cang@codeaurora.org>,
	linux-kernel@vger.kernel.org,
	Vivek Gautam <vivek.gautam@codeaurora.org>,
	Manu Gautam <mgautam@codeaurora.org>
Subject: [PATCH v1 4/4] phy: qcom-qmp: Expose provided clocks to DT
Date: Thu, 29 Nov 2018 14:13:57 -0800	[thread overview]
Message-ID: <20181129221357.67417-5-evgreen@chromium.org> (raw)
In-Reply-To: <20181129221357.67417-1-evgreen@chromium.org>

Register a simple clock provider for the PHY pipe clock sources so that
device tree users can point at these clocks via phandles to the lane
nodes.

Signed-off-by: Evan Green <evgreen@chromium.org>
---

 drivers/phy/qualcomm/phy-qcom-qmp.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index 8204d55e2d650..b4006818e1b65 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -1542,6 +1542,11 @@ static int qcom_qmp_phy_clk_init(struct device *dev)
 	return devm_clk_bulk_get(dev, num, qmp->clks);
 }
 
+static void phy_pipe_clk_release_provider(void *res)
+{
+	of_clk_del_provider(res);
+}
+
 /*
  * Register a fixed rate pipe clock.
  *
@@ -1588,7 +1593,23 @@ static int phy_pipe_clk_register(struct qcom_qmp *qmp, struct device_node *np)
 	fixed->fixed_rate = 125000000;
 	fixed->hw.init = &init;
 
-	return devm_clk_hw_register(qmp->dev, &fixed->hw);
+	ret = devm_clk_hw_register(qmp->dev, &fixed->hw);
+	if (ret)
+		return ret;
+
+	ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get, &fixed->hw);
+	if (ret)
+		return ret;
+
+	/*
+	 * Roll a devm action because the clock provider is the child node, but
+	 * the child node is not actually a device.
+	 */
+	ret = devm_add_action(qmp->dev, phy_pipe_clk_release_provider, np);
+	if (ret)
+		phy_pipe_clk_release_provider(np);
+
+	return ret;
 }
 
 static const struct phy_ops qcom_qmp_phy_gen_ops = {
-- 
2.18.1


  parent reply	other threads:[~2018-11-29 22:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29 22:13 [PATCH v1 0/4] phy: qcom-qmp: Fix clock-cells binding and provider Evan Green
2018-11-29 22:13 ` [PATCH v1 1/4] dt-bindings: phy-qcom-qmp: Move #clock-cells to child Evan Green
2018-12-03 22:37   ` Stephen Boyd
2018-11-29 22:13 ` [PATCH v1 2/4] arm64: dts: qcom: msm8996: Fix QMP PHY #clock-cells Evan Green
2018-12-03 22:37   ` Stephen Boyd
2018-12-07  8:32   ` Vivek Gautam
2018-11-29 22:13 ` [PATCH v1 3/4] arm64: dts: qcom: sdm845: " Evan Green
2018-12-03 22:37   ` Stephen Boyd
2018-11-29 22:13 ` Evan Green [this message]
2018-12-03 22:38   ` [PATCH v1 4/4] phy: qcom-qmp: Expose provided clocks to DT Stephen Boyd
2018-12-03 23:12     ` Evan Green
2018-12-07  8:34   ` Vivek Gautam
2018-12-04  8:12 ` [PATCH v1 0/4] phy: qcom-qmp: Fix clock-cells binding and provider Kishon Vijay Abraham I
2018-12-04 12:37   ` Vivek Gautam
2018-12-07  4:43     ` Kishon Vijay Abraham I
2018-12-07  6:25       ` Vivek Gautam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181129221357.67417-5-evgreen@chromium.org \
    --to=evgreen@chromium.org \
    --cc=andy.gross@linaro.org \
    --cc=cang@codeaurora.org \
    --cc=dianders@chromium.org \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgautam@codeaurora.org \
    --cc=robh+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=swboyd@chromium.org \
    --cc=vivek.gautam@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®