All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Ryder Lee <ryder.lee@mediatek.com>, Felix Fietkau <nbd@nbd.name>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>,
	Shayne Chen <shayne.chen@mediatek.com>,
	Evelyn Tsai <evelyn.tsai@mediatek.com>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	Peter Chiu <chui-hao.chiu@mediatek.com>
Subject: RE: [PATCH 1/2] wifi: mt76: mt7915: enable mt7986 and mt7916 pre-calibration support
Date: Thu, 26 Oct 2023 09:03:24 +0000	[thread overview]
Message-ID: <7a3a38a0c8b54757a4ab090aa7422d6c@realtek.com> (raw)
In-Reply-To: <f21b261373fc221b8370264c44ee751fa85cf41c.1698274193.git.ryder.lee@mediatek.com>



> -----Original Message-----
> From: Ryder Lee <ryder.lee@mediatek.com>
> Sent: Thursday, October 26, 2023 7:34 AM
> To: Felix Fietkau <nbd@nbd.name>; linux-wireless@vger.kernel.org
> Cc: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>; Shayne Chen <shayne.chen@mediatek.com>; Evelyn Tsai
> <evelyn.tsai@mediatek.com>; linux-mediatek@lists.infradead.org; Peter Chiu <chui-hao.chiu@mediatek.com>;
> Ryder Lee <ryder.lee@mediatek.com>
> Subject: [PATCH 1/2] wifi: mt76: mt7915: enable mt7986 and mt7916 pre-calibration support
> 
> From: Peter Chiu <chui-hao.chiu@mediatek.com>
> 
> Add pre-calibration for mt7986 and mt7916. Their group cal size are
> 54k and 94k for 2G + 5G and 2G + 6G, respectively. DPD size is 300k.

s/\([256]\)G/\1GHz/

> 
> Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
>  .../wireless/mediatek/mt76/mt7915/eeprom.c    |  11 +-
>  .../wireless/mediatek/mt76/mt7915/eeprom.h    |  34 +++++-
>  .../net/wireless/mediatek/mt76/mt7915/mcu.c   | 100 ++++++++++++++----
>  3 files changed, 114 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h
> b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h
> index f3e56817d36e..84c1903b2a6c 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h

[...]

> @@ -155,6 +164,27 @@ mt7915_tssi_enabled(struct mt7915_dev *dev, enum nl80211_band band)
>                 return val & MT_EE_WIFI_CONF7_TSSI0_5G;
>  }
> 
> +static inline u32
> +mt7915_get_cal_group_size(struct mt7915_dev *dev)
> +{
> +       if (is_mt7915(&dev->mt76)) {
> +               return MT_EE_CAL_GROUP_SIZE_7915;
> +       } else if (is_mt7916(&dev->mt76)) {
> +               u8 *eep = dev->mt76.eeprom.data;
> +               u32 val = eep[MT_EE_WIFI_CONF + 1];
> +
> +               val = FIELD_GET(MT_EE_WIFI_CONF0_BAND_SEL, val);

val = u32_get_bits(val, MT_EE_WIFI_CONF0_BAND_SEL);

> +
> +               return (val == MT_EE_V2_BAND_SEL_6GHZ) ?
> +                       MT_EE_CAL_GROUP_SIZE_7916_6G :
> +                       MT_EE_CAL_GROUP_SIZE_7916;

shouldn't it align open parenthesis?

return val == MT_EE_V2_BAND_SEL_6GHZ ?
       MT_EE_CAL_GROUP_SIZE_7916_6G :
       MT_EE_CAL_GROUP_SIZE_7916;

> +       } else if (mt7915_check_adie(dev, false)) {
> +               return MT_EE_CAL_GROUP_SIZE_7976;
> +       } else {
> +               return MT_EE_CAL_GROUP_SIZE_7975;
> +       }
> +}
> +
>  extern const u8 mt7915_sku_group_len[MAX_SKU_RATE_GROUP_NUM];
> 
>  #endif
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> index b22f06d4411a..da3ee9f91704 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> @@ -2904,9 +2904,10 @@ static int mt7915_mcu_set_pre_cal(struct mt7915_dev *dev, u8 idx,
>  int mt7915_mcu_apply_group_cal(struct mt7915_dev *dev)
>  {
>         u8 idx = 0, *cal = dev->cal, *eep = dev->mt76.eeprom.data;
> -       u32 total = MT_EE_CAL_GROUP_SIZE;
> +       u32 total = mt7915_get_cal_group_size(dev);
> +       u32 offs = is_mt7915(&dev->mt76) ? MT_EE_DO_PRE_CAL : MT_EE_DO_PRE_CAL_V2;

in reverse X'mas tree order?

> 
> -       if (!(eep[MT_EE_DO_PRE_CAL] & MT_EE_WIFI_CAL_GROUP))
> +       if (!(eep[offs] & MT_EE_WIFI_CAL_GROUP))
>                 return 0;
> 
>         /*
> @@ -2942,9 +2943,9 @@ static int mt7915_find_freq_idx(const u16 *freqs, int n_freqs, u16 cur)
>         return -1;
>  }
> 
> -static int mt7915_dpd_freq_idx(u16 freq, u8 bw)
> +static int mt7915_dpd_freq_idx(struct mt7915_dev *dev, u16 freq, u8 bw)
>  {
> -       static const u16 freq_list[] = {
> +       const u16 freq_list_v1[] = {

Without 'static', it will unnecessarily make a copy to stack at runtime.

>                 5180, 5200, 5220, 5240,
>                 5260, 5280, 5300, 5320,
>                 5500, 5520, 5540, 5560,
> @@ -2952,65 +2953,118 @@ static int mt7915_dpd_freq_idx(u16 freq, u8 bw)
>                 5660, 5680, 5700, 5745,
>                 5765, 5785, 5805, 5825
>         };
> -       int offset_2g = ARRAY_SIZE(freq_list);
> -       int idx;
> +       const u16 freq_list_v2[] = {

static const

> +               /* 6G BW20 */
> +               5955, 5975, 5995, 6015,
> +               6035, 6055, 6075, 6095,
> +               6115, 6135, 6155, 6175,
> +               6195, 6215, 6235, 6255,
> +               6275, 6295, 6315, 6335,
> +               6355, 6375, 6395, 6415,
> +               6435, 6455, 6475, 6495,
> +               6515, 6535, 6555, 6575,
> +               6595, 6615, 6635, 6655,
> +               6675, 6695, 6715, 6735,
> +               6755, 6775, 6795, 6815,
> +               6835, 6855, 6875, 6895,
> +               6915, 6935, 6955, 6975,
> +               6995, 7015, 7035, 7055,
> +               7075, 7095, 7115,
> +               /* 6G BW160 */
> +               6025, 6185, 6345, 6505,
> +               6665, 6825, 6985,
> +               /* 5G BW20 */
> +               5180, 5200, 5220, 5240,
> +               5260, 5280, 5300, 5320,
> +               5500, 5520, 5540, 5560,
> +               5580, 5600, 5620, 5640,
> +               5660, 5680, 5700, 5720,
> +               5745, 5765, 5785, 5805,
> +               5825, 5845, 5865, 5885,
> +               /* 5G BW160 */
> +               5250, 5570, 5815
> +       };

[...]


      parent reply	other threads:[~2023-10-26  9:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 23:34 [PATCH 1/2] wifi: mt76: mt7915: enable mt7986 and mt7916 pre-calibration support Ryder Lee
2023-10-25 23:34 ` [PATCH 2/2] wifi: mt76: mt7915: fix missing CH144 support for mt7915 pre-calibration Ryder Lee
2023-10-26  9:03 ` Ping-Ke Shih [this message]

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=7a3a38a0c8b54757a4ab090aa7422d6c@realtek.com \
    --to=pkshih@realtek.com \
    --cc=chui-hao.chiu@mediatek.com \
    --cc=evelyn.tsai@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=shayne.chen@mediatek.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.