netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Piotr Raczynski <piotr.raczynski@intel.com>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: <chandrashekar.devegowda@intel.com>, <linuxwwan@intel.com>,
	<chiranjeevi.rapolu@linux.intel.com>, <haijun.liu@mediatek.com>,
	<m.chetan.kumar@linux.intel.com>,
	<ricardo.martinez@linux.intel.com>,
	"Loic Poulain" <loic.poulain@linaro.org>,
	Sergey Ryazanov <ryazanov.s.a@gmail.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: wwan: t7xx: Ensure init is completed before system sleep
Date: Tue, 16 May 2023 12:42:35 +0200	[thread overview]
Message-ID: <ZGNeG1O1yS229nPO@nimitz> (raw)
In-Reply-To: <20230516080327.359825-1-kai.heng.feng@canonical.com>

On Tue, May 16, 2023 at 04:03:27PM +0800, Kai-Heng Feng wrote:
> When the system attempts to sleep while mtk_t7xx is not ready, the driver
> cannot put the device to sleep:
> [   12.472918] mtk_t7xx 0000:57:00.0: [PM] Exiting suspend, modem in invalid state
> [   12.472936] mtk_t7xx 0000:57:00.0: PM: pci_pm_suspend(): t7xx_pci_pm_suspend+0x0/0x20 [mtk_t7xx] returns -14
> [   12.473678] mtk_t7xx 0000:57:00.0: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x1b0 returns -14
> [   12.473711] mtk_t7xx 0000:57:00.0: PM: failed to suspend async: error -14
> [   12.764776] PM: Some devices failed to suspend, or early wake event detected
> 
> Mediatek confirmed the device can take a rather long time to complete
> its initialization, so wait for up to 20 seconds until init is done.
> 
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

Does it fix any issue? Anyway target tree would help here I guess.

[...]

> +static int t7xx_pci_pm_prepare(struct device *dev)
> +{
> +	struct pci_dev *pdev = to_pci_dev(dev);
> +	struct t7xx_pci_dev *t7xx_dev;
> +
> +	t7xx_dev = pci_get_drvdata(pdev);
> +	if (!wait_for_completion_timeout(&t7xx_dev->init_done, 20 * HZ))

#define T7XX_INIT_TIMEOUT or something similar wouldn't do any harm here.

> +		dev_warn(dev, "Not ready for system sleep.\n");
> +
> +	return 0;

So in case of a timeout you still return 0, is that OK?

[...]
Thanks, Piotr.

  reply	other threads:[~2023-05-16 10:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16  8:03 [PATCH] net: wwan: t7xx: Ensure init is completed before system sleep Kai-Heng Feng
2023-05-16 10:42 ` Piotr Raczynski [this message]
2023-05-17  4:28   ` Kai-Heng Feng

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=ZGNeG1O1yS229nPO@nimitz \
    --to=piotr.raczynski@intel.com \
    --cc=chandrashekar.devegowda@intel.com \
    --cc=chiranjeevi.rapolu@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=haijun.liu@mediatek.com \
    --cc=johannes@sipsolutions.net \
    --cc=kai.heng.feng@canonical.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxwwan@intel.com \
    --cc=loic.poulain@linaro.org \
    --cc=m.chetan.kumar@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ricardo.martinez@linux.intel.com \
    --cc=ryazanov.s.a@gmail.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).