From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Georgi Djakov <georgi.djakov@linaro.org>
Cc: sboyd@codeaurora.org, jassisinghbrar@gmail.com, robh@kernel.org,
mturquette@baylibre.com, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v10 6/6] clk: qcom: Add APCS clock controller support
Date: Mon, 4 Dec 2017 22:01:30 -0800 [thread overview]
Message-ID: <20171205060129.GI28761@minitux> (raw)
In-Reply-To: <20171201170224.25053-7-georgi.djakov@linaro.org>
On Fri 01 Dec 09:02 PST 2017, Georgi Djakov wrote:
[..]
> diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c
> new file mode 100644
> index 000000000000..f71039ff2347
> --- /dev/null
> +++ b/drivers/clk/qcom/apcs-msm8916.c
> @@ -0,0 +1,149 @@
> +/*
> + * Qualcomm APCS clock controller driver
> + *
> + * Copyright (c) 2017, Linaro Limited
> + * Author: Georgi Djakov <georgi.djakov@linaro.org>
> + *
> + * SPDX-License-Identifier: GPL-2.0
The SPDX-License-Identifier should be on the first line in the file,
commented by //
> + */
> +
[..]
> +static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev)
> +{
> + struct device *dev = pdev->dev.parent;
Call this "parent" instead.
> + struct device_node *np = dev->of_node;
> + struct clk_regmap_mux_div *a53cc;
> + struct regmap *regmap;
> + struct clk_init_data init = { };
> + int ret;
> +
> + regmap = dev_get_regmap(dev, NULL);
> + if (IS_ERR(regmap)) {
> + ret = PTR_ERR(regmap);
> + dev_err(dev, "failed to get regmap: %d\n", ret);
dev_* prints should be on &pdev->dev and not on parent device.
> + return ret;
> + }
> +
> + a53cc = devm_kzalloc(dev, sizeof(*a53cc), GFP_KERNEL);
Perform this allocation on behalf of this device (i.e. &pdev->dev and
not parent)
> + if (!a53cc)
> + return -ENOMEM;
> +
> + init.name = "a53mux";
> + init.parent_names = gpll0_a53cc;
> + init.num_parents = ARRAY_SIZE(gpll0_a53cc);
> + init.ops = &clk_regmap_mux_div_ops;
> + init.flags = CLK_SET_RATE_PARENT;
> +
> + a53cc->clkr.hw.init = &init;
> + a53cc->clkr.regmap = regmap;
> + a53cc->reg_offset = 0x50;
> + a53cc->hid_width = 5;
> + a53cc->hid_shift = 0;
> + a53cc->src_width = 3;
> + a53cc->src_shift = 8;
> + a53cc->parent_map = gpll0_a53cc_map;
> +
> + a53cc->pclk = devm_clk_get(dev, NULL);
> + if (IS_ERR(a53cc->pclk)) {
> + ret = PTR_ERR(a53cc->pclk);
> + dev_err(dev, "failed to get clk: %d\n", ret);
> + return ret;
> + }
> +
> + a53cc->clk_nb.notifier_call = a53cc_notifier_cb;
> + ret = clk_notifier_register(a53cc->pclk, &a53cc->clk_nb);
> + if (ret) {
> + dev_err(dev, "failed to register clock notifier: %d\n", ret);
> + return ret;
> + }
> +
> + ret = devm_clk_register_regmap(dev, &a53cc->clkr);
This you can do on the &pdev->dev, it won't find a regmap on this node
and will try the parent.
> + if (ret) {
> + dev_err(dev, "failed to register regmap clock: %d\n", ret);
> + goto err;
> + }
> +
> + ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get,
Be explicit here and do parent->of_node.
> + &a53cc->clkr.hw);
> + if (ret) {
> + dev_err(dev, "failed to add clock provider: %d\n", ret);
> + goto err;
> + }
> +
> + platform_set_drvdata(pdev, a53cc);
> +
> + return 0;
> +
> +err:
> + clk_notifier_unregister(a53cc->pclk, &a53cc->clk_nb);
> + return ret;
> +}
> +
> +static int qcom_apcs_msm8916_clk_remove(struct platform_device *pdev)
> +{
> + struct clk_regmap_mux_div *a53cc = platform_get_drvdata(pdev);
> +
> + clk_notifier_unregister(a53cc->pclk, &a53cc->clk_nb);
> + of_clk_del_provider(pdev->dev.of_node);
You registered the provider on pdev->dev->parent.of_node.
> +
> + return 0;
> +}
> +
Regards,
Bjorn
next prev parent reply other threads:[~2017-12-05 6:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-01 17:02 [PATCH v10 0/6] Add support for Qualcomm A53 CPU clock Georgi Djakov
2017-12-01 17:02 ` [PATCH v10 1/6] mailbox: qcom: Convert APCS IPC driver to use regmap Georgi Djakov
2017-12-01 17:02 ` [PATCH v10 2/6] mailbox: qcom: Create APCS child device for clock controller Georgi Djakov
2017-12-05 6:01 ` Bjorn Andersson
2017-12-01 17:02 ` [PATCH v10 3/6] clk: qcom: Add A53 PLL support Georgi Djakov
2017-12-05 6:03 ` Bjorn Andersson
2017-12-01 17:02 ` [PATCH v10 4/6] clk: qcom: Add regmap mux-div clocks support Georgi Djakov
2017-12-01 17:02 ` [PATCH v10 5/6] dt-bindings: mailbox: qcom: Document the APCS clock binding Georgi Djakov
2017-12-04 21:49 ` Rob Herring
2017-12-05 5:49 ` Bjorn Andersson
2017-12-01 17:02 ` [PATCH v10 6/6] clk: qcom: Add APCS clock controller support Georgi Djakov
2017-12-05 6:01 ` Bjorn Andersson [this message]
2017-12-05 15:33 ` Georgi Djakov
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=20171205060129.GI28761@minitux \
--to=bjorn.andersson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=georgi.djakov@linaro.org \
--cc=jassisinghbrar@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=sboyd@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;
as well as URLs for NNTP newsgroup(s).