From: Taniya Das <taniya.das@oss.qualcomm.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Brian Masney <bmasney@redhat.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Linus Walleij <linusw@kernel.org>,
Richard Cochran <richardcochran@gmail.com>,
Konrad Dybcio <konradybcio@kernel.org>,
Ajit Pandey <ajit.pandey@oss.qualcomm.com>,
Imran Shaik <imran.shaik@oss.qualcomm.com>,
Jagadeesh Kona <jagadeesh.kona@oss.qualcomm.com>,
linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH 2/5] clk: qcom: Add a driver for PDM GP_MN fractional clock divider
Date: Thu, 15 Oct 2026 12:45:37 +0530 [thread overview]
Message-ID: <0691ab2d-1ca5-4140-af77-05bbf718d205@oss.qualcomm.com> (raw)
In-Reply-To: <h7ai3qajk4yq2jgvy6etqpchxuxo56sxtvcgvh7xhodw6jkias@ayn2thdck4ct>
On 6/8/2026 9:01 AM, Dmitry Baryshkov wrote:
>> +static int gp_mnd_clk_set_rate(struct clk_hw *hw, unsigned long rate,
>> + unsigned long parent_rate)
>> +{
>> + struct clk_gp_mnd *gp = to_clk_gp_mnd(hw);
>> + unsigned long m = 0, n = 0;
>> + unsigned int d_val, n_val;
>> + int ret;
>> +
>> + rational_best_approximation(rate, parent_rate,
>> + (unsigned long)GP_MND_MAX_M,
>> + (unsigned long)GP_MND_MAX_N,
>> + &m, &n);
>> +
>> + if (!m || !n)
>> + return -EINVAL;
>> +
>> + /*
>> + * When N = 2M + 1 the valid D range [M+1, M] is empty; no duty
>> + * cycle can satisfy M < D < (N - M). Reject before touching hw.
>> + */
>> + if (n == 2 * m + 1)
>> + return -EINVAL;
>> +
>> + ret = clk_prepare_enable(gp->pdm_ahb_clk);
> Can we use CLK_OPS_PARENT_ENABLE or pm_clk instead? Having to manually
> toggle the clock looks like a coomplete overkill.
>
Sorry for the delayed response. Yes, I will model it as pm_clk.
>> + if (ret)
>> + return ret;
>> +
>> +
>> + ret = of_property_read_string_index(dev->of_node,
>> + "clock-output-names", 0,
>> + &init.name);
> Do we need it? Can we generate the name instead?
Yes, I will generate the name.
>
>> + if (ret)
>> + return dev_err_probe(dev, ret, "missing clock-output-names\n");
>> +
>> + gp->hw.init = &init;
>> +
>> + pin = devm_pinctrl_get(dev);
>> + if (IS_ERR(pin))
>> + return dev_err_probe(dev, PTR_ERR(pin), "missing pinctrl device\n");
>> +
>> + pin_default_state = pinctrl_lookup_state(pin, "active");
>> + if (IS_ERR(pin_default_state))
>> + return dev_err_probe(dev, PTR_ERR(pin_default_state),
>> + "missing pinctrl default state\n");
> Isn't it done by default for you?
>
Yeah, I will move it to default.
>> +
>> + ret = pinctrl_select_state(pin, pin_default_state);
>> + if (ret)
>> + return dev_err_probe(dev, ret,
>> + "failed to select pinctrl default state\n");
>> +
>> + ret = devm_clk_hw_register(dev, &gp->hw);
>> + if (ret)
>> + return dev_err_probe(dev, ret,
>> + "failed to register gp_mnd clock\n");
>> +
>> + return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, &gp->hw);
>> +}
>> +
>> +static const struct of_device_id clk_gp_mnd_match_table[] = {
>> + { .compatible = "qcom,clk-gp-mnd" },
>> + { }
>> +};
>> +MODULE_DEVICE_TABLE(of, clk_gp_mnd_match_table);
>> +
>> +static struct platform_driver clk_gp_mnd_driver = {
>> + .probe = clk_gp_mnd_probe,
>> + .driver = {
>> + .name = "qcom-clk-gp-mnd",
>> + .of_match_table = clk_gp_mnd_match_table,
>> + },
>> +};
>> +module_platform_driver(clk_gp_mnd_driver);
>> +
>> +MODULE_DESCRIPTION("Qualcomm PDM GP_MND clock divider driver");
>> +MODULE_LICENSE("GPL");
--
Thanks,
Taniya Das
next prev parent reply other threads:[~2026-10-15 7:15 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 15:21 [PATCH 0/5] clk: qcom: Add PDM GP_MN fractional clock divider driver and DT support Taniya Das
2026-06-02 15:21 ` [PATCH 1/5] dt-bindings: clock: qcom: Add bindings for PDM GP_MN clock divider Taniya Das
2026-06-03 15:25 ` sashiko-bot
2026-06-09 13:24 ` Konrad Dybcio
2026-10-15 7:15 ` Taniya Das
2026-06-09 13:25 ` Konrad Dybcio
2026-10-15 7:15 ` Taniya Das
2026-06-02 15:21 ` [PATCH 2/5] clk: qcom: Add a driver for PDM GP_MN fractional " Taniya Das
2026-06-03 15:25 ` sashiko-bot
2026-06-08 3:31 ` Dmitry Baryshkov
2026-10-15 7:15 ` Taniya Das [this message]
2026-06-02 15:21 ` [PATCH 3/5] pinctrl: qcom: Add gp_mn mux function for QCS8300, SA8775P and SC7280 Taniya Das
2026-06-08 22:43 ` Linus Walleij
2026-10-15 7:14 ` Taniya Das
2026-10-15 8:28 ` Linus Walleij
2026-06-09 13:27 ` Konrad Dybcio
2026-10-15 7:14 ` Taniya Das
2026-06-02 15:21 ` [PATCH 4/5] arm64: dts: qcom: Add gp_mn pin state for GP M/N clock output Taniya Das
2026-06-03 15:25 ` sashiko-bot
2026-06-08 7:22 ` Luca Weiss
2026-10-15 10:44 ` Taniya Das
2026-06-09 13:28 ` Konrad Dybcio
2026-10-15 7:14 ` Taniya Das
2026-06-02 15:21 ` [PATCH 5/5] arm64: dts: qcom: Add GP M/N clock controller node for SA8775P and QCS8300 Taniya Das
2026-06-03 15:25 ` sashiko-bot
2026-06-08 7:32 ` Luca Weiss
2026-10-15 10:45 ` Taniya Das
2026-06-08 7:33 ` Luca Weiss
2026-10-15 7:14 ` Taniya Das
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=0691ab2d-1ca5-4140-af77-05bbf718d205@oss.qualcomm.com \
--to=taniya.das@oss.qualcomm.com \
--cc=ajit.pandey@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=bmasney@redhat.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=imran.shaik@oss.qualcomm.com \
--cc=jagadeesh.kona@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.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