From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Baochen Qiang <quic_bqiang@quicinc.com>
Cc: ath11k@lists.infradead.org, mhi@lists.linux.dev,
linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 2/3] net: qrtr: support suspend/hibernation
Date: Mon, 26 Feb 2024 17:50:55 +0530 [thread overview]
Message-ID: <20240226122055.GE8422@thinkpad> (raw)
In-Reply-To: <20240221030026.10553-3-quic_bqiang@quicinc.com>
On Wed, Feb 21, 2024 at 11:00:25AM +0800, Baochen Qiang wrote:
> MHI devices may not be destroyed during suspend/hibernation, so need
> to unprepare/prepare MHI channels throughout the transition.
>
Again, below content should go to the comment section, not in the commit
message.
Please add only relevant content in the commit message.
- Mani
> The RFC version adds new API to MHI stack with which an MHI controller
> driver can do unprepare/prepare directly by itself, see
>
> https://patchwork.kernel.org/project/linux-wireless/patch/20231127162022.518834-3-kvalo@kernel.org/
>
> Although it works well Mani pointed out that the design is not good
> because MHI channels are managed by MHI client driver thus should not
> be touched by others. See the discussion
>
> https://lore.kernel.org/mhi/20231127162022.518834-1-kvalo@kernel.org/
>
> This version changes to add suspend/resume callbacks to achieve the
> same purpose. The suspend callback is called in the late suspend stage,
> this means MHI channels are still alive at suspend stage, and that makes
> it possible for an MHI controller driver to communicate with others over
> those channels at suspend stage. While the resume callback is called in
> the early resume stage, for a similar reason.
>
> Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30
>
> Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
> ---
> net/qrtr/mhi.c | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/net/qrtr/mhi.c b/net/qrtr/mhi.c
> index 9ced13c0627a..b54a6c2113e9 100644
> --- a/net/qrtr/mhi.c
> +++ b/net/qrtr/mhi.c
> @@ -118,6 +118,32 @@ static const struct mhi_device_id qcom_mhi_qrtr_id_table[] = {
> };
> MODULE_DEVICE_TABLE(mhi, qcom_mhi_qrtr_id_table);
>
> +static int qcom_mhi_qrtr_pm_suspend_late(struct device *dev)
> +{
> + struct mhi_device *mhi_dev = container_of(dev, struct mhi_device, dev);
> +
> + mhi_unprepare_from_transfer(mhi_dev);
> +
> + return 0;
> +}
> +
> +static int qcom_mhi_qrtr_pm_resume_early(struct device *dev)
> +{
> + struct mhi_device *mhi_dev = container_of(dev, struct mhi_device, dev);
> + int rc;
> +
> + rc = mhi_prepare_for_transfer_autoqueue(mhi_dev);
> + if (rc)
> + dev_err(dev, "failed to prepare for autoqueue transfer %d\n", rc);
> +
> + return rc;
> +}
> +
> +static const struct dev_pm_ops __maybe_unused qcom_mhi_qrtr_pm_ops = {
> + SET_LATE_SYSTEM_SLEEP_PM_OPS(qcom_mhi_qrtr_pm_suspend_late,
> + qcom_mhi_qrtr_pm_resume_early)
> +};
> +
> static struct mhi_driver qcom_mhi_qrtr_driver = {
> .probe = qcom_mhi_qrtr_probe,
> .remove = qcom_mhi_qrtr_remove,
> @@ -126,6 +152,9 @@ static struct mhi_driver qcom_mhi_qrtr_driver = {
> .id_table = qcom_mhi_qrtr_id_table,
> .driver = {
> .name = "qcom_mhi_qrtr",
> +#ifdef CONFIG_PM
> + .pm = &qcom_mhi_qrtr_pm_ops,
> +#endif
> },
> };
>
> --
> 2.25.1
>
>
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2024-02-26 12:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 3:00 [PATCH 0/3] wifi: ath11k: hibernation support Baochen Qiang
2024-02-21 3:00 ` [PATCH 1/3] bus: mhi: host: add mhi_power_down_no_destroy() Baochen Qiang
2024-02-21 17:22 ` Jeff Johnson
2024-02-26 12:15 ` Manivannan Sadhasivam
2024-02-27 6:29 ` Baochen Qiang
2024-02-21 3:00 ` [PATCH 2/3] net: qrtr: support suspend/hibernation Baochen Qiang
2024-02-21 18:24 ` Jeff Johnson
2024-02-22 7:48 ` Baochen Qiang
2024-02-26 12:20 ` Manivannan Sadhasivam [this message]
2024-02-21 3:00 ` [PATCH 3/3] wifi: ath11k: support hibernation Baochen Qiang
2024-02-21 18:35 ` Jeff Johnson
2024-02-23 2:30 ` [PATCH 0/3] wifi: ath11k: hibernation support Baochen Qiang
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=20240226122055.GE8422@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=ath11k@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mhi@lists.linux.dev \
--cc=quic_bqiang@quicinc.com \
/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).