[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5b7rv52cqu55jn5ku6hy6m7u7yn37i4iviaj4eutlgudw7mpny@w3vhaulnmi2p>
Date: Tue, 28 Oct 2025 09:17:25 -0500
From: Bjorn Andersson <andersson@...nel.org>
To: Prashanth K <prashanth.k@....qualcomm.com>
Cc: Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>, linux-arm-msm@...r.kernel.org, linux-phy@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] phy: qualcomm: m31-eusb2: Add runtime pm ops
On Mon, Oct 27, 2025 at 11:54:58AM +0530, Prashanth K wrote:
> Add runtime power management operation callbacks for M31 EUSB2 PHY.
> Enable/disable the clocks based on the runtime suspend/resume calls.
Please start with describing which problem this solves.
Regards,
Bjorn
>
> Signed-off-by: Prashanth K <prashanth.k@....qualcomm.com>
> ---
> drivers/phy/qualcomm/phy-qcom-m31-eusb2.c | 40 +++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c b/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c
> index 0a0d2d9fc846..1aeb5e3de07c 100644
> --- a/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c
> +++ b/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c
> @@ -240,6 +240,34 @@ static const struct phy_ops m31eusb2_phy_gen_ops = {
> .owner = THIS_MODULE,
> };
>
> +static int m31eusb2_phy_runtime_suspend(struct device *dev)
> +{
> + struct m31eusb2_phy *phy = dev_get_drvdata(dev);
> +
> + dev_dbg(dev, "Suspending M31 eUSB2 Phy\n");
> + clk_disable_unprepare(phy->clk);
> +
> + return 0;
> +}
> +
> +static int m31eusb2_phy_runtime_resume(struct device *dev)
> +{
> + struct m31eusb2_phy *phy = dev_get_drvdata(dev);
> + int ret = 0;
> +
> + dev_dbg(dev, "Resuming M31 eUSB2 Phy\n");
> + ret = clk_prepare_enable(phy->clk);
> + if (ret)
> + dev_err(dev, "failed to enable ref clock, %d\n", ret);
> +
> + return ret;
> +}
> +
> +static const struct dev_pm_ops m31eusb2_phy_pm_ops = {
> + SET_RUNTIME_PM_OPS(m31eusb2_phy_runtime_suspend,
> + m31eusb2_phy_runtime_resume, NULL)
> +};
> +
> static int m31eusb2_phy_probe(struct platform_device *pdev)
> {
> struct phy_provider *phy_provider;
> @@ -270,6 +298,17 @@ static int m31eusb2_phy_probe(struct platform_device *pdev)
> return dev_err_probe(dev, PTR_ERR(phy->clk),
> "failed to get clk\n");
>
> + dev_set_drvdata(dev, phy);
> + pm_runtime_set_active(dev);
> + pm_runtime_enable(dev);
> +
> + /*
> + * Prevent runtime pm from being ON by default. Users can enable
> + * it using power/control in sysfs.
> + */
> + pm_runtime_forbid(dev);
> +
> +
> phy->phy = devm_phy_create(dev, NULL, &m31eusb2_phy_gen_ops);
> if (IS_ERR(phy->phy))
> return dev_err_probe(dev, PTR_ERR(phy->phy),
> @@ -313,6 +352,7 @@ static struct platform_driver m31eusb2_phy_driver = {
> .probe = m31eusb2_phy_probe,
> .driver = {
> .name = "qcom-m31eusb2-phy",
> + .pm = &m31eusb2_phy_pm_ops,
> .of_match_table = m31eusb2_phy_id_table,
> },
> };
> --
> 2.34.1
>
>
Powered by blists - more mailing lists