From: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
To: Stian Knudsen <stian@pokerfj.es>,
Jeff Johnson <jjohnson@kernel.org>,
ath12k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] wifi: ath12k: restore country code during resume
Date: Mon, 20 Jul 2026 13:00:32 +0800 [thread overview]
Message-ID: <df37460e-f8ba-4e11-b412-4aa8b17cd32e@oss.qualcomm.com> (raw)
In-Reply-To: <20260717130254.36732-1-stian@pokerfj.es>
On 7/17/2026 9:02 PM, Stian Knudsen wrote:
> The country code configured before suspend is lost after resume:
> the device is powered down in suspend_late and powered back up in
> resume_early, so firmware reboots with its default regulatory
> settings and the previously set country code is no longer applied.
>
> On WCN7850 the firmware comes back in the world regulatory domain
> (country 00) and takes ~7 seconds to rediscover the country code
> from AP beacons, part of a ~16 second total delay before wifi
> reconnects after resume.
>
> Restore it by resending WMI_SET_CURRENT_COUNTRY_CMDID during resume
> if a country code was set before suspend, i.e. when ar->alpha2 is
> valid. This follows the same approach as ath11k commit 7f0343b7b871
> ("wifi: ath11k: restore country code during resume").
>
> Note that only single_pdev_only devices support suspend/resume (see
> ath12k_core_continue_suspend_resume()), so handling the first and
> only pdev is sufficient.
>
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
>
Fixes: 8d5f4da8d70b ("wifi: ath12k: support suspend/resume") ?
> Suggested-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
> Link: https://lore.kernel.org/r/-_iDJ_M5RrqACWB0qmtleg@pokerfj.es
> Signed-off-by: Stian Knudsen <stian@pokerfj.es>
> ---
> drivers/net/wireless/ath/ath12k/core.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
> --- a/drivers/net/wireless/ath/ath12k/core.c
> +++ b/drivers/net/wireless/ath/ath12k/core.c
> @@ -197,6 +197,7 @@ EXPORT_SYMBOL(ath12k_core_resume_early);
>
> int ath12k_core_resume(struct ath12k_base *ab)
> {
> + struct ath12k *ar;
> long time_left;
> int ret;
>
> @@ -211,6 +212,26 @@ int ath12k_core_resume(struct ath12k_base *ab)
> return -ETIMEDOUT;
> }
>
> + /* So far only single_pdev_only devices can reach here,
> + * so it is valid to handle the first, and the only, pdev.
> + */
> + ar = ab->pdevs[0].ar;
> + if (ab->hw_params->current_cc_support &&
> + ar->alpha2[0] != 0 && ar->alpha2[1] != 0) {
> + struct wmi_set_current_country_arg arg = {};
> +
> + memcpy(&arg.alpha2, ar->alpha2, 2);
> +
> + reinit_completion(&ar->regd_update_completed);
> +
> + ret = ath12k_wmi_send_set_current_country_cmd(ar, &arg);
> + if (ret) {
> + ath12k_warn(ab, "failed to set country code during resume: %d\n",
> + ret);
> + return ret;
> + }
> + }
> +
> return 0;
> }
> EXPORT_SYMBOL(ath12k_core_resume);
> --
> 2.50.0
next prev parent reply other threads:[~2026-07-20 5:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 13:02 [PATCH] wifi: ath12k: restore country code during resume Stian Knudsen
2026-07-20 5:00 ` Baochen Qiang [this message]
2026-07-20 12:09 ` [PATCH v2] " Stian Knudsen
2026-07-21 7:31 ` Baochen Qiang
2026-07-24 0:15 ` Jeff Johnson
2026-07-24 2:51 ` 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=df37460e-f8ba-4e11-b412-4aa8b17cd32e@oss.qualcomm.com \
--to=baochen.qiang@oss.qualcomm.com \
--cc=ath12k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=stian@pokerfj.es \
/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