All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Josef Schlehofer <pepe.schlehofer@gmail.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	Bitterblue Smith <rtl8821cerfe2@gmail.com>
Subject: RE: [PATCH rtw-next] wifi: rtw89: 8922a: redo channel RFK on a bad DPK result
Date: Fri, 27 Nov 2026 07:06:13 +0000	[thread overview]
Message-ID: <e743abd631724374b35f7789143c11e7@realtek.com> (raw)
In-Reply-To: <20261123193413.71430-1-pepe.schlehofer@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 5106 bytes --]


Josef Schlehofer <pepe.schlehofer@gmail.com> wrote:
> On RTL8922AU the channel calibration at AP start sometimes leaves path B
> with a bad DPK result while the firmware reports success. The DPK TX AGC
> of path B is then far below path A, or path B is not ok, and the AP
> hardly gets frames to its clients until it is restarted. The TSSI and
> IQK results of path B are off in the same runs.

Can you try if any difference from attached newer firmware?

> 
> Keep the DPK report the firmware sends and redo the whole channel
> calibration when a path is not ok or timed out, or the TX AGC of the two
> paths differs by more than 5, at most three times. The check runs only
> when the PHY owns both paths.

Is it necessary to redo whole calibration? Can it just redo DPK?

> 
> Tested on RTL8922AU over USB in AP mode: 12 bad first calibrations in
> 145 AP starts, all good on the second try. No stall in 105 starts with
> a client, against 4 of 80 without the patch.
> 
> Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
> ---
> The check comes from one adapter. Is the DPK TX AGC gap, path_ok and
> is_timeout the right thing to look at, or is there a better result the
> driver should check? Or should the firmware handle this?

Normally, we should check why the calibration fails instead of redo calibration.

> The report is
> kept in rfk_wait for now. Would rtwdev->dpk be better, like
> rtwdev->iqk?

It should be. But the struct is used by driver calibration for earlier chips.

> 
> The older chips do it differently. RTL8852B runs DPK in the driver and
> switches DPD off on a failed path, and rtw88 does the same on RTL8822C
> after checking the coefficients. Neither redoes the calibration. Here
> the firmware reports the bad path as ok in most runs, and TSSI and IQK
> of that path are off as well, so this patch redoes the whole channel
> calibration. Would switching DPD off on path B be preferred, at least
> after the third bad try? The H2C has a dpk_enable byte, I did not try
> it.

I'm not sure. Let's try the latest firmware. If the symptom is still
existing, we can collect log for analysis. 

[...]

> diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
> index 0f36185c19b..069bad16b78 100644
> --- a/drivers/net/wireless/realtek/rtw89/core.c
> +++ b/drivers/net/wireless/realtek/rtw89/core.c
> @@ -7113,6 +7113,7 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
> 
>         init_completion(&rtwdev->fw.req.completion);
>         init_completion(&rtwdev->rfk_wait.completion);
> +       init_completion(&rtwdev->rfk_wait.dpk_rpt.done);
> 
>         schedule_work(&rtwdev->load_firmware_work);
> 
> diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
> index 87a832b5c29..f65b4ba7eba 100644
> --- a/drivers/net/wireless/realtek/rtw89/core.h
> +++ b/drivers/net/wireless/realtek/rtw89/core.h
> @@ -6742,11 +6742,19 @@ struct rtw89_rfk_record {
>         enum rtw89_rfk_report_state states[NUM_OF_RTW89_RFK_REPORT_TYPES];
>  };
> 
> +struct rtw89_rfk_dpk_rpt {
> +       struct completion done;
> +       u8 path_ok[2];
> +       u8 txagc[2];
> +       u8 is_timeout[2];
> +};
> +
>  struct rtw89_rfk_wait_info {
>         struct completion completion;
>         ktime_t start_time;
>         enum rtw89_rfk_report_state state;
>         u8 version;
> +       struct rtw89_rfk_dpk_rpt dpk_rpt;
> 
>         int record_idx;
>         struct rtw89_rfk_record *record_ptr;
> diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
> index 9a7e032f7c8..0e6f36d4822 100644
> --- a/drivers/net/wireless/realtek/rtw89/phy.c
> +++ b/drivers/net/wireless/realtek/rtw89/phy.c
> @@ -3563,6 +3563,7 @@ static void rtw89_phy_c2h_rfk_rpt_log(struct rtw89_dev *rtwdev,
>         struct rtw89_c2h_rf_dack_rpt_log *dack;
>         struct rtw89_c2h_rf_tssi_rpt_log *tssi;
>         struct rtw89_c2h_rf_dpk_rpt_log *dpk;
> +       struct rtw89_rfk_dpk_rpt *dpk_rpt;
>         struct rtw89_c2h_rf_iqk_rpt_log *iqk;
>         int i, j, k;
> 
> @@ -3660,6 +3661,11 @@ static void rtw89_phy_c2h_rfk_rpt_log(struct rtw89_dev *rtwdev,
>                         goto out;
> 
>                 dpk = content;
> +               dpk_rpt = &rtwdev->rfk_wait.dpk_rpt;
> +               memcpy(dpk_rpt->path_ok, dpk->path_ok, sizeof(dpk_rpt->path_ok));
> +               memcpy(dpk_rpt->txagc, dpk->txagc, sizeof(dpk_rpt->txagc));
> +               memcpy(dpk_rpt->is_timeout, dpk->is_timeout, sizeof(dpk_rpt->is_timeout));

Prefer checking in-place, not store data.
Just record success or failure.

Reference to rtw89_wait_for_cond_prep().

> +               complete(&dpk_rpt->done);
>                 rtw89_debug(rtwdev, RTW89_DBG_RFK,
>                             "DPK ver:%d idx:%2ph band:%2ph bw:%2ph ch:%2ph path:%2ph\n",
>                             dpk->ver, dpk->idx, dpk->band, dpk->bw, dpk->ch, dpk->path_ok);

[...]

pw-bot: cr


[-- Attachment #2: rtw8922a_fw-5.bin --]
[-- Type: application/octet-stream, Size: 2030562 bytes --]

  reply	other threads:[~2026-11-27  7:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 19:34 [PATCH rtw-next] wifi: rtw89: 8922a: redo channel RFK on a bad DPK result Josef Schlehofer
2026-11-27  7:06 ` Ping-Ke Shih [this message]
2026-11-29  9:17   ` Josef Schlehofer
2026-11-30  6:26     ` Ping-Ke Shih
2026-11-30  9:29       ` Josef Schlehofer
2026-12-01  2:03         ` Ping-Ke Shih
2026-12-01 11:33           ` Josef Schlehofer

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=e743abd631724374b35f7789143c11e7@realtek.com \
    --to=pkshih@realtek.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pepe.schlehofer@gmail.com \
    --cc=rtl8821cerfe2@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.