Linux-Wireless Archive on lore.kernel.org
 help / color / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: <yhchuang@realtek.com>
Cc: <linux-wireless@vger.kernel.org>, <briannorris@chromium.org>
Subject: Re: [PATCH 01/10] rtw88: add power tracking support
Date: Wed, 09 Oct 2019 11:17:55 +0300
Message-ID: <87lftugwng.fsf@tynnyri.adurom.net> (raw)
In-Reply-To: <20191008082101.2494-2-yhchuang@realtek.com> (yhchuang's message of "Tue, 8 Oct 2019 16:20:52 +0800")

<yhchuang@realtek.com> writes:

> From: Tzu-En Huang <tehuang@realtek.com>
>
> The temperature of the chip can affect the output power
> of the RF components. Hence driver requires to compensate
> the power by adjusting the power index recorded in the
> power swing table.
>
> And if the difference of current thermal value to the
> default thermal value exceeds a threshold, the RF IQK
> should be triggered to re-calibrate the characteristics
> of the RF components, to keep the output IQ vectors of
> the RF components orthogonal enough.
>
> Signed-off-by: Tzu-En Huang <tehuang@realtek.com>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>

[...]

> +/* This table stores the values of TX power that will be adjusted by power
> + * tracking.
> + *
> + * For 5G bands, there are 3 different settings.
> + * For 2G there are cck rate and ofdm rate with different settings.
> + */
> +struct rtw_pwr_track_tbl {
> +	const u8 *pwrtrk_5gb_n[RTW_PWRTRACK_5G_BAND_SIZE];
> +	const u8 *pwrtrk_5gb_p[RTW_PWRTRACK_5G_BAND_SIZE];
> +	const u8 *pwrtrk_5ga_n[RTW_PWRTRACK_5G_BAND_SIZE];
> +	const u8 *pwrtrk_5ga_p[RTW_PWRTRACK_5G_BAND_SIZE];
> +	const u8 *pwrtrk_2gb_n;
> +	const u8 *pwrtrk_2gb_p;
> +	const u8 *pwrtrk_2ga_n;
> +	const u8 *pwrtrk_2ga_p;
> +	const u8 *pwrtrk_2g_cckb_n;
> +	const u8 *pwrtrk_2g_cckb_p;
> +	const u8 *pwrtrk_2g_ccka_n;
> +	const u8 *pwrtrk_2g_ccka_p;
> +};

[...]

> +void rtw_phy_config_swing_table(struct rtw_dev *rtwdev,
> +				struct rtw_swing_table *swing_table)
> +{
> +	const struct rtw_pwr_track_tbl *tbl = rtwdev->chip->pwr_track_tbl;
> +	u8 channel = rtwdev->hal.current_channel;
> +
> +	if (channel >= 1 && channel <= 14) {
> +		if (rtwdev->dm_info.tx_rate <= DESC_RATE11M) {
> +			swing_table->tup[0] = (u8 *)tbl->pwrtrk_2g_ccka_p;
> +			swing_table->tdown[0] = (u8 *)tbl->pwrtrk_2g_ccka_n;
> +			swing_table->tup[1] = (u8 *)tbl->pwrtrk_2g_cckb_p;
> +			swing_table->tdown[1] = (u8 *)tbl->pwrtrk_2g_cckb_n;
> +		} else {
> +			swing_table->tup[0] = (u8 *)tbl->pwrtrk_2ga_p;
> +			swing_table->tdown[0] = (u8 *)tbl->pwrtrk_2ga_n;
> +			swing_table->tup[1] = (u8 *)tbl->pwrtrk_2gb_p;
> +			swing_table->tdown[1] = (u8 *)tbl->pwrtrk_2gb_n;
> +		}

This is ugly and immeadiately caught my attention, don't cast away the
const. It's const for a reason and if you cast it away you most likely
you create a bug somewhere. It's better to avoid casting as much as
possible as they get abused so easily.

I stopped reviewing here, will continue later.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

  reply index

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08  8:20 [PATCH 00/10] rtw88: minor throughput improvement yhchuang
2019-10-08  8:20 ` [PATCH 01/10] rtw88: add power tracking support yhchuang
2019-10-09  8:17   ` Kalle Valo [this message]
2019-10-08  8:20 ` [PATCH 02/10] rtw88: Enable 802.11ac beamformee support yhchuang
2019-10-14  9:38   ` Kalle Valo
2019-10-08  8:20 ` [PATCH 03/10] rtw88: config 8822c multicast address in MAC init flow yhchuang
2019-10-14  9:08   ` Kalle Valo
2019-10-08  8:20 ` [PATCH 04/10] rtw88: add set_bitrate_mask support yhchuang
2019-10-08  8:20 ` [PATCH 05/10] rtw88: update regulatory settings implementaion yhchuang
2019-10-14  9:39   ` Kalle Valo
2019-10-08  8:20 ` [PATCH 06/10] rtw88: add NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 support yhchuang
2019-10-14  9:11   ` Kalle Valo
2019-10-08  8:20 ` [PATCH 07/10] rtw88: Use rtw_write8_set to set SYS_FUNC yhchuang
2019-10-08  8:20 ` [PATCH 08/10] rtw88: pci: config phy after chip info is setup yhchuang
2019-10-08  8:21 ` [PATCH 09/10] rtw88: coex: Set 4 slot mode for A2DP yhchuang
2019-10-08  8:21 ` [PATCH 10/10] rtw88: add phy_info debugfs to show Tx/Rx physical status yhchuang
2019-10-14  9:45 ` [PATCH 00/10] rtw88: minor throughput improvement Kalle Valo
2019-10-15  3:23   ` Tony Chuang

Reply instructions:

You may reply publically 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=87lftugwng.fsf@tynnyri.adurom.net \
    --to=kvalo@codeaurora.org \
    --cc=briannorris@chromium.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=yhchuang@realtek.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

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org
	public-inbox-index linux-wireless

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git