Lines Matching +full:in +full:- +full:band

1 // SPDX-License-Identifier: ISC
10 struct mt76_dev *mdev = &dev->mt76; in mt7915_eeprom_load_precal()
11 u8 *eeprom = mdev->eeprom.data; in mt7915_eeprom_load_precal()
15 if (!dev->flash_mode) in mt7915_eeprom_load_precal()
22 dev->cal = devm_kzalloc(mdev->dev, val, GFP_KERNEL); in mt7915_eeprom_load_precal()
23 if (!dev->cal) in mt7915_eeprom_load_precal()
24 return -ENOMEM; in mt7915_eeprom_load_precal()
26 offs = is_mt7915(&dev->mt76) ? MT_EE_PRECAL : MT_EE_PRECAL_V2; in mt7915_eeprom_load_precal()
28 return mt76_get_of_eeprom(mdev, dev->cal, offs, val); in mt7915_eeprom_load_precal()
33 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_check_eeprom()
36 #define CHECK_EEPROM_ERR(match) (match ? 0 : -EINVAL) in mt7915_check_eeprom()
39 return CHECK_EEPROM_ERR(is_mt7915(&dev->mt76)); in mt7915_check_eeprom()
41 return CHECK_EEPROM_ERR(is_mt7916(&dev->mt76)); in mt7915_check_eeprom()
43 return CHECK_EEPROM_ERR(is_mt7981(&dev->mt76)); in mt7915_check_eeprom()
45 return CHECK_EEPROM_ERR(is_mt7986(&dev->mt76)); in mt7915_check_eeprom()
47 return -EINVAL; in mt7915_check_eeprom()
53 switch (mt76_chip(&dev->mt76)) { in mt7915_eeprom_name()
55 return dev->dbdc_support ? in mt7915_eeprom_name()
58 /* mt7981 only supports mt7976 and only in DBDC mode */ in mt7915_eeprom_name()
84 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_load_default()
88 ret = request_firmware(&fw, mt7915_eeprom_name(dev), dev->mt76.dev); in mt7915_eeprom_load_default()
92 if (!fw || !fw->data) { in mt7915_eeprom_load_default()
93 dev_err(dev->mt76.dev, "Invalid default bin\n"); in mt7915_eeprom_load_default()
94 ret = -EINVAL; in mt7915_eeprom_load_default()
98 memcpy(eeprom, fw->data, mt7915_eeprom_size(dev)); in mt7915_eeprom_load_default()
99 dev->flash_mode = true; in mt7915_eeprom_load_default()
112 ret = mt76_eeprom_init(&dev->mt76, eeprom_size); in mt7915_eeprom_load()
117 dev->flash_mode = true; in mt7915_eeprom_load()
129 return -EINVAL; in mt7915_eeprom_load()
145 struct mt7915_dev *dev = phy->dev; in mt7915_eeprom_parse_band_config()
146 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_parse_band_config()
147 u8 band = phy->mt76->band_idx; in mt7915_eeprom_parse_band_config() local
150 val = eeprom[MT_EE_WIFI_CONF + band]; in mt7915_eeprom_parse_band_config()
153 if (!is_mt7915(&dev->mt76)) { in mt7915_eeprom_parse_band_config()
156 phy->mt76->cap.has_5ghz = true; in mt7915_eeprom_parse_band_config()
159 phy->mt76->cap.has_6ghz = true; in mt7915_eeprom_parse_band_config()
162 phy->mt76->cap.has_5ghz = true; in mt7915_eeprom_parse_band_config()
163 phy->mt76->cap.has_6ghz = true; in mt7915_eeprom_parse_band_config()
166 phy->mt76->cap.has_2ghz = true; in mt7915_eeprom_parse_band_config()
169 } else if (val == MT_EE_BAND_SEL_DEFAULT && dev->dbdc_support) { in mt7915_eeprom_parse_band_config()
170 val = band ? MT_EE_BAND_SEL_5GHZ : MT_EE_BAND_SEL_2GHZ; in mt7915_eeprom_parse_band_config()
175 phy->mt76->cap.has_5ghz = true; in mt7915_eeprom_parse_band_config()
178 phy->mt76->cap.has_2ghz = true; in mt7915_eeprom_parse_band_config()
181 phy->mt76->cap.has_2ghz = true; in mt7915_eeprom_parse_band_config()
182 phy->mt76->cap.has_5ghz = true; in mt7915_eeprom_parse_band_config()
190 u8 path, nss, nss_max = 4, *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_parse_hw_cap()
191 struct mt76_phy *mphy = phy->mt76; in mt7915_eeprom_parse_hw_cap()
192 u8 band = phy->mt76->band_idx; in mt7915_eeprom_parse_hw_cap() local
197 if (is_mt7915(&dev->mt76)) { in mt7915_eeprom_parse_hw_cap()
202 eeprom[MT_EE_WIFI_CONF + band]); in mt7915_eeprom_parse_hw_cap()
210 if (dev->dbdc_support) { in mt7915_eeprom_parse_hw_cap()
211 if (is_mt7915(&dev->mt76)) { in mt7915_eeprom_parse_hw_cap()
215 if (band) in mt7915_eeprom_parse_hw_cap()
220 eeprom[MT_EE_WIFI_CONF + 2 + band]); in mt7915_eeprom_parse_hw_cap()
223 if (!is_mt798x(&dev->mt76)) in mt7915_eeprom_parse_hw_cap()
231 mphy->chainmask = BIT(path) - 1; in mt7915_eeprom_parse_hw_cap()
232 if (band) in mt7915_eeprom_parse_hw_cap()
233 mphy->chainmask <<= dev->chainshift; in mt7915_eeprom_parse_hw_cap()
234 mphy->antenna_mask = BIT(nss) - 1; in mt7915_eeprom_parse_hw_cap()
235 dev->chainmask |= mphy->chainmask; in mt7915_eeprom_parse_hw_cap()
236 dev->chainshift = hweight8(dev->mphy.chainmask); in mt7915_eeprom_parse_hw_cap()
245 if (ret != -EINVAL) in mt7915_eeprom_init()
248 dev_warn(dev->mt76.dev, "eeprom load fail, use default bin\n"); in mt7915_eeprom_init()
258 mt7915_eeprom_parse_hw_cap(dev, &dev->phy); in mt7915_eeprom_init()
260 memcpy(dev->mphy.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR, in mt7915_eeprom_init()
262 memcpy(dev->mphy.macaddr, (u8 *)dev->mt76.eeprom.data + MT_EE_MAC_ADDR, in mt7915_eeprom_init()
266 mt76_eeprom_override(&dev->mphy); in mt7915_eeprom_init()
275 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_get_target_power()
280 return -EINVAL; in mt7915_eeprom_get_target_power()
282 tssi_on = mt7915_tssi_enabled(dev, chan->band); in mt7915_eeprom_get_target_power()
283 is_7976 = mt7915_check_adie(dev, false) || is_mt7916(&dev->mt76); in mt7915_eeprom_get_target_power()
285 if (chan->band == NL80211_BAND_2GHZ) { in mt7915_eeprom_get_target_power()
296 } else if (chan->band == NL80211_BAND_5GHZ) { in mt7915_eeprom_get_target_power()
297 int group = mt7915_get_channel_group_5g(chan->hw_value, is_7976); in mt7915_eeprom_get_target_power()
310 int group = mt7915_get_channel_group_6g(chan->hw_value); in mt7915_eeprom_get_target_power()
319 s8 mt7915_eeprom_get_power_delta(struct mt7915_dev *dev, int band) in mt7915_eeprom_get_power_delta() argument
321 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_get_power_delta()
324 bool is_7976 = mt7915_check_adie(dev, false) || is_mt7916(&dev->mt76); in mt7915_eeprom_get_power_delta()
326 if (band == NL80211_BAND_2GHZ) in mt7915_eeprom_get_power_delta()
328 else if (band == NL80211_BAND_5GHZ) in mt7915_eeprom_get_power_delta()
340 return val & MT_EE_RATE_DELTA_SIGN ? delta : -delta; in mt7915_eeprom_get_power_delta()