Lines Matching +full:tx +full:- +full:d +full:- +full:cal
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()
12 u32 offs = is_mt7915(&dev->mt76) ? MT_EE_DO_PRE_CAL : MT_EE_DO_PRE_CAL_V2; in mt7915_eeprom_load_precal()
16 if (!dev->flash_mode || !val) in mt7915_eeprom_load_precal()
21 dev->cal = devm_kzalloc(mdev->dev, size, GFP_KERNEL); in mt7915_eeprom_load_precal()
22 if (!dev->cal) in mt7915_eeprom_load_precal()
23 return -ENOMEM; in mt7915_eeprom_load_precal()
25 offs = is_mt7915(&dev->mt76) ? MT_EE_PRECAL : MT_EE_PRECAL_V2; in mt7915_eeprom_load_precal()
27 ret = mt76_get_of_data_from_mtd(mdev, dev->cal, offs, size); in mt7915_eeprom_load_precal()
31 ret = mt76_get_of_data_from_nvmem(mdev, dev->cal, "precal", size); in mt7915_eeprom_load_precal()
35 dev_warn(mdev->dev, "missing precal data, size=%d\n", size); in mt7915_eeprom_load_precal()
36 devm_kfree(mdev->dev, dev->cal); in mt7915_eeprom_load_precal()
37 dev->cal = NULL; in mt7915_eeprom_load_precal()
44 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_check_eeprom()
47 #define CHECK_EEPROM_ERR(match) (match ? 0 : -EINVAL) in mt7915_check_eeprom()
50 return CHECK_EEPROM_ERR(is_mt7915(&dev->mt76)); in mt7915_check_eeprom()
52 return CHECK_EEPROM_ERR(is_mt7916(&dev->mt76)); in mt7915_check_eeprom()
54 return CHECK_EEPROM_ERR(is_mt7981(&dev->mt76)); in mt7915_check_eeprom()
56 return CHECK_EEPROM_ERR(is_mt7986(&dev->mt76)); in mt7915_check_eeprom()
58 return -EINVAL; in mt7915_check_eeprom()
64 switch (mt76_chip(&dev->mt76)) { in mt7915_eeprom_name()
66 return dev->dbdc_support ? in mt7915_eeprom_name()
95 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_load_default()
99 ret = request_firmware(&fw, mt7915_eeprom_name(dev), dev->mt76.dev); in mt7915_eeprom_load_default()
103 if (!fw || !fw->data) { in mt7915_eeprom_load_default()
104 dev_err(dev->mt76.dev, "Invalid default bin\n"); in mt7915_eeprom_load_default()
105 ret = -EINVAL; in mt7915_eeprom_load_default()
109 memcpy(eeprom, fw->data, mt7915_eeprom_size(dev)); in mt7915_eeprom_load_default()
110 dev->flash_mode = true; in mt7915_eeprom_load_default()
123 ret = mt76_eeprom_init(&dev->mt76, eeprom_size); in mt7915_eeprom_load()
128 dev->flash_mode = true; in mt7915_eeprom_load()
140 return -EINVAL; in mt7915_eeprom_load()
156 struct mt7915_dev *dev = phy->dev; in mt7915_eeprom_parse_band_config()
157 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_parse_band_config()
158 u8 band = phy->mt76->band_idx; in mt7915_eeprom_parse_band_config()
164 if (!is_mt7915(&dev->mt76)) { in mt7915_eeprom_parse_band_config()
167 phy->mt76->cap.has_5ghz = true; in mt7915_eeprom_parse_band_config()
170 phy->mt76->cap.has_6ghz = true; in mt7915_eeprom_parse_band_config()
173 phy->mt76->cap.has_5ghz = true; in mt7915_eeprom_parse_band_config()
174 phy->mt76->cap.has_6ghz = true; in mt7915_eeprom_parse_band_config()
177 phy->mt76->cap.has_2ghz = true; in mt7915_eeprom_parse_band_config()
180 } else if (val == MT_EE_BAND_SEL_DEFAULT && dev->dbdc_support) { in mt7915_eeprom_parse_band_config()
186 phy->mt76->cap.has_5ghz = true; in mt7915_eeprom_parse_band_config()
189 phy->mt76->cap.has_2ghz = true; in mt7915_eeprom_parse_band_config()
192 phy->mt76->cap.has_2ghz = true; in mt7915_eeprom_parse_band_config()
193 phy->mt76->cap.has_5ghz = true; in mt7915_eeprom_parse_band_config()
201 u8 path, nss, nss_max = 4, *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_parse_hw_cap()
202 struct mt76_phy *mphy = phy->mt76; in mt7915_eeprom_parse_hw_cap()
203 u8 band = phy->mt76->band_idx; in mt7915_eeprom_parse_hw_cap()
207 /* read tx/rx path from eeprom */ in mt7915_eeprom_parse_hw_cap()
208 if (is_mt7915(&dev->mt76)) { in mt7915_eeprom_parse_hw_cap()
219 /* read tx/rx stream */ in mt7915_eeprom_parse_hw_cap()
221 if (dev->dbdc_support) { in mt7915_eeprom_parse_hw_cap()
222 if (is_mt7915(&dev->mt76)) { in mt7915_eeprom_parse_hw_cap()
234 if (!is_mt798x(&dev->mt76)) in mt7915_eeprom_parse_hw_cap()
242 mphy->chainmask = BIT(path) - 1; in mt7915_eeprom_parse_hw_cap()
244 mphy->chainmask <<= dev->chainshift; in mt7915_eeprom_parse_hw_cap()
245 mphy->antenna_mask = BIT(nss) - 1; in mt7915_eeprom_parse_hw_cap()
246 dev->chainmask |= mphy->chainmask; in mt7915_eeprom_parse_hw_cap()
247 dev->chainshift = hweight8(dev->mphy.chainmask); in mt7915_eeprom_parse_hw_cap()
256 if (ret != -EINVAL) in mt7915_eeprom_init()
259 dev_warn(dev->mt76.dev, "eeprom load fail, use default bin\n"); in mt7915_eeprom_init()
266 mt7915_eeprom_parse_hw_cap(dev, &dev->phy); in mt7915_eeprom_init()
267 memcpy(dev->mphy.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR, in mt7915_eeprom_init()
270 mt76_eeprom_override(&dev->mphy); in mt7915_eeprom_init()
279 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_get_target_power()
284 return -EINVAL; in mt7915_eeprom_get_target_power()
286 tssi_on = mt7915_tssi_enabled(dev, chan->band); in mt7915_eeprom_get_target_power()
287 is_7976 = mt7915_check_adie(dev, false) || is_mt7916(&dev->mt76); in mt7915_eeprom_get_target_power()
289 if (chan->band == NL80211_BAND_2GHZ) { in mt7915_eeprom_get_target_power()
300 } else if (chan->band == NL80211_BAND_5GHZ) { in mt7915_eeprom_get_target_power()
301 int group = mt7915_get_channel_group_5g(chan->hw_value, is_7976); in mt7915_eeprom_get_target_power()
314 int group = mt7915_get_channel_group_6g(chan->hw_value); in mt7915_eeprom_get_target_power()
325 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_get_power_delta()
328 bool is_7976 = mt7915_check_adie(dev, false) || is_mt7916(&dev->mt76); in mt7915_eeprom_get_power_delta()
344 return val & MT_EE_RATE_DELTA_SIGN ? delta : -delta; in mt7915_eeprom_get_power_delta()