From: Andrew Halaney <ahalaney@redhat.com>
To: Adrien Thierry <athierry@redhat.com>
Cc: Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org
Subject: Re: [PATCH v2 2/2] phy: qcom-snps-femto-v2: add system sleep PM ops
Date: Wed, 21 Jun 2023 15:32:57 -0500 [thread overview]
Message-ID: <20230621203257.tvcubvn3xitzgnt5@halaney-x13s> (raw)
In-Reply-To: <20230605184455.34832-3-athierry@redhat.com>
On Mon, Jun 05, 2023 at 02:44:54PM -0400, Adrien Thierry wrote:
> Add the system sleep suspend and resume callbacks, reusing the same code
> as the runtime suspend and resume callbacks.
It would be nice (imo) to reference the downstream driver you used as a
reference if you spin a v3.
>
> Signed-off-by: Adrien Thierry <athierry@redhat.com>
> ---
> I'm still a bit confused as to what the difference is between
> suspend/resume PM ops and the struct usb_phy set_suspend() callback.
> Please tell me if I should be populating the latter instead.
My understanding is usb_phy is a legacy thing, and that the generic phys
are the way to go (which this is).
Looking at dwc3 for example, you can see it uses:
phy_power_off(dwc->usb3_generic_phy);
phy_power_off(dwc->usb2_generic_phy);
usb_phy_set_suspend(dwc->usb3_phy, 1);
usb_phy_set_suspend(dwc->usb2_phy, 1);
so it handles both the generic phy (like this) and the usb_phy.
This driver doesn't implement the power_off callback, but phy_power_off
is also pm_runtime aware, so calling phy_power_off in a controller still
achieves similar behavior (although I'm following right
phy_init/phy_exit also are pm_runtime aware, so I think it would be at
that point that the ops get called).
This all assumes a user enables pm_runtime in sysfs for this driver.
>
> drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> index ce1d2f8b568a..378a5029f61e 100644
> --- a/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> +++ b/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
> @@ -179,7 +179,7 @@ static inline void qcom_snps_hsphy_write_mask(void __iomem *base, u32 offset,
> readl_relaxed(base + offset);
> }
>
> -static int qcom_snps_hsphy_suspend(struct qcom_snps_hsphy *hsphy)
> +static int qcom_snps_hsphy_do_suspend(struct qcom_snps_hsphy *hsphy)
> {
> dev_dbg(&hsphy->phy->dev, "Suspend QCOM SNPS PHY\n");
>
> @@ -199,7 +199,7 @@ static int qcom_snps_hsphy_suspend(struct qcom_snps_hsphy *hsphy)
> return 0;
> }
>
> -static int qcom_snps_hsphy_resume(struct qcom_snps_hsphy *hsphy)
> +static int qcom_snps_hsphy_do_resume(struct qcom_snps_hsphy *hsphy)
> {
> int ret;
>
> @@ -214,25 +214,25 @@ static int qcom_snps_hsphy_resume(struct qcom_snps_hsphy *hsphy)
> return 0;
> }
>
> -static int __maybe_unused qcom_snps_hsphy_runtime_suspend(struct device *dev)
> +static int __maybe_unused qcom_snps_hsphy_suspend(struct device *dev)
> {
> struct qcom_snps_hsphy *hsphy = dev_get_drvdata(dev);
>
> if (!hsphy->phy_initialized)
> return 0;
>
> - qcom_snps_hsphy_suspend(hsphy);
> + qcom_snps_hsphy_do_suspend(hsphy);
Deserves its own patch, but can you return qcom_snps_hsphy_do_suspend/resume
as part of your clean up in this series?
> return 0;
> }
>
> -static int __maybe_unused qcom_snps_hsphy_runtime_resume(struct device *dev)
> +static int __maybe_unused qcom_snps_hsphy_resume(struct device *dev)
> {
> struct qcom_snps_hsphy *hsphy = dev_get_drvdata(dev);
>
> if (!hsphy->phy_initialized)
> return 0;
>
> - qcom_snps_hsphy_resume(hsphy);
> + qcom_snps_hsphy_do_resume(hsphy);
> return 0;
> }
>
> @@ -518,8 +518,10 @@ static const struct of_device_id qcom_snps_hsphy_of_match_table[] = {
> MODULE_DEVICE_TABLE(of, qcom_snps_hsphy_of_match_table);
>
> static const struct dev_pm_ops qcom_snps_hsphy_pm_ops = {
> - SET_RUNTIME_PM_OPS(qcom_snps_hsphy_runtime_suspend,
> - qcom_snps_hsphy_runtime_resume, NULL)
> + SET_RUNTIME_PM_OPS(qcom_snps_hsphy_suspend,
> + qcom_snps_hsphy_resume, NULL)
> + SET_SYSTEM_SLEEP_PM_OPS(qcom_snps_hsphy_suspend,
> + qcom_snps_hsphy_resume)
> };
>
> static void qcom_snps_hsphy_override_param_update_val(
> --
> 2.40.1
>
next prev parent reply other threads:[~2023-06-21 20:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 18:44 [PATCH v2 0/2] Clock fixes for qcom-snps-femto-v2 PHY driver Adrien Thierry
2023-06-05 18:44 ` [PATCH v2 1/2] phy: qcom-snps-femto-v2: properly enable ref clock Adrien Thierry
2023-06-05 23:14 ` Konrad Dybcio
2023-06-06 13:55 ` Andrew Halaney
2023-06-06 14:35 ` Adrien Thierry
2023-06-09 15:30 ` Konrad Dybcio
2023-06-21 19:48 ` Andrew Halaney
2023-06-05 18:44 ` [PATCH v2 2/2] phy: qcom-snps-femto-v2: add system sleep PM ops Adrien Thierry
2023-06-21 20:32 ` Andrew Halaney [this message]
2023-06-13 18:15 ` [PATCH v2 0/2] Clock fixes for qcom-snps-femto-v2 PHY driver Adrien Thierry
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=20230621203257.tvcubvn3xitzgnt5@halaney-x13s \
--to=ahalaney@redhat.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=athierry@redhat.com \
--cc=kishon@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=vkoul@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;
as well as URLs for NNTP newsgroup(s).