All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
To: Ping-Ke Shih <pkshih@realtek.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Jes Sorensen <Jes.Sorensen@gmail.com>
Subject: Re: [PATCH 1/5] wifi: rtl8xxxu: Add central frequency offset tracking
Date: Fri, 21 Oct 2022 21:32:15 +0300	[thread overview]
Message-ID: <c3540f87-b124-2642-f53e-aa15704a54e8@gmail.com> (raw)
In-Reply-To: <6a91fd1b8d5e4bf3910366121ed92f3b@realtek.com>

On 21/10/2022 08:47, Ping-Ke Shih wrote:
> 
> 
>> -----Original Message-----
>> From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
>> Sent: Monday, October 17, 2022 1:27 AM
[...]
>> +
>> +	val32 &= ~0x007ff800;
>> +	val32 |= (crystal_cap | (crystal_cap << 6)) << 11;
>> +	rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32);
> 
> This could be clear:
> 
> #define XTAL1 GENMASK(22, 17)
> #define XTAL0 GENMASK(16, 11)
> 
> val32 &= ~(XTAL1 | XTAL2)
> val32 |= FIELD_PREP(XTAL1, crystal_cap) |
>          FIELD_PREP(XTAL0, crystal_cap);
> 

Ah, so that's what FIELD_PREP does.

>> +			if (priv->cfo_tracking.packet_count == 0xffffffff)
>> +				priv->cfo_tracking.packet_count = 0;
>> +			else
>> +				priv->cfo_tracking.packet_count++;
> 
> 'packet_count' is u32, so 0xffffffff + 1 will become 0. Then, just
> 
>    priv->cfo_tracking.packet_count++;
> 

I thought so, but I'm not *that* familiar with the C standard,
so I left it how I found it in one of the Realtek drivers.

>> +
>> +	if (crystal_cap > 0x3f)
>> +		crystal_cap = 0x3f;
>> +	else if (crystal_cap < 0)
>> +		crystal_cap = 0;
> 
> crystal_cap = clamp(crystal_cap, 0, 0x3f);
> 

Right, that's better.

Thanks for the reviews. I'll implement your suggestions.

  reply	other threads:[~2022-10-21 18:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 17:26 [PATCH 1/5] wifi: rtl8xxxu: Add central frequency offset tracking Bitterblue Smith
2022-10-16 17:28 ` [PATCH 2/5] wifi: rtl8xxxu: Fix the CCK RSSI calculation Bitterblue Smith
2022-10-16 17:29 ` [PATCH 3/5] wifi: rtl8xxxu: Recognise all possible chip cuts Bitterblue Smith
2022-10-21  5:31   ` Ping-Ke Shih
2022-10-21 17:36     ` Bitterblue Smith
2022-10-16 17:30 ` [PATCH 4/5] wifi: rtl8xxxu: Set IEEE80211_HW_SUPPORT_FAST_XMIT Bitterblue Smith
2022-10-16 17:31 ` [PATCH 5/5] wifi: rtl8xxxu: Use dev_info instead of pr_info Bitterblue Smith
2022-10-21  5:47 ` [PATCH 1/5] wifi: rtl8xxxu: Add central frequency offset tracking Ping-Ke Shih
2022-10-21 18:32   ` Bitterblue Smith [this message]
2022-10-21 20:22     ` Johannes Berg
2022-10-24  1:48     ` Ping-Ke Shih

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=c3540f87-b124-2642-f53e-aa15704a54e8@gmail.com \
    --to=rtl8821cerfe2@gmail.com \
    --cc=Jes.Sorensen@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pkshih@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
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.