Lines Matching refs:dev
8 static int mt7915_eeprom_load_precal(struct mt7915_dev *dev) in mt7915_eeprom_load_precal() argument
10 struct mt76_dev *mdev = &dev->mt76; 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()
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()
31 static int mt7915_check_eeprom(struct mt7915_dev *dev) in mt7915_check_eeprom() argument
33 u8 *eeprom = dev->mt76.eeprom.data; 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()
51 static char *mt7915_eeprom_name(struct mt7915_dev *dev) in mt7915_eeprom_name() argument
53 switch (mt76_chip(&dev->mt76)) { in mt7915_eeprom_name()
55 return dev->dbdc_support ? in mt7915_eeprom_name()
61 switch (mt7915_check_adie(dev, true)) { in mt7915_eeprom_name()
82 mt7915_eeprom_load_default(struct mt7915_dev *dev) in mt7915_eeprom_load_default() argument
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()
93 dev_err(dev->mt76.dev, "Invalid default bin\n"); 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()
107 static int mt7915_eeprom_load(struct mt7915_dev *dev) in mt7915_eeprom_load() argument
110 u16 eeprom_size = mt7915_eeprom_size(dev); in mt7915_eeprom_load()
112 ret = mt76_eeprom_init(&dev->mt76, eeprom_size); in mt7915_eeprom_load()
117 dev->flash_mode = true; in mt7915_eeprom_load()
123 ret = mt7915_mcu_get_eeprom_free_block(dev, &free_block_num); in mt7915_eeprom_load()
134 ret = mt7915_mcu_get_eeprom(dev, i * eeprom_blk_size); in mt7915_eeprom_load()
140 return mt7915_check_eeprom(dev); in mt7915_eeprom_load()
145 struct mt7915_dev *dev = phy->dev; in mt7915_eeprom_parse_band_config() local
146 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_parse_band_config()
153 if (!is_mt7915(&dev->mt76)) { in mt7915_eeprom_parse_band_config()
169 } else if (val == MT_EE_BAND_SEL_DEFAULT && dev->dbdc_support) { in mt7915_eeprom_parse_band_config()
187 void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev, in mt7915_eeprom_parse_hw_cap() argument
190 u8 path, nss, nss_max = 4, *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_parse_hw_cap()
197 if (is_mt7915(&dev->mt76)) { 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()
223 if (!is_mt798x(&dev->mt76)) in mt7915_eeprom_parse_hw_cap()
233 mphy->chainmask <<= dev->chainshift; 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()
239 int mt7915_eeprom_init(struct mt7915_dev *dev) in mt7915_eeprom_init() argument
243 ret = mt7915_eeprom_load(dev); in mt7915_eeprom_init()
248 dev_warn(dev->mt76.dev, "eeprom load fail, use default bin\n"); in mt7915_eeprom_init()
249 ret = mt7915_eeprom_load_default(dev); in mt7915_eeprom_init()
254 ret = mt7915_eeprom_load_precal(dev); in mt7915_eeprom_init()
258 mt7915_eeprom_parse_hw_cap(dev, &dev->phy); in mt7915_eeprom_init()
259 memcpy(dev->mphy.macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR, in mt7915_eeprom_init()
262 mt76_eeprom_override(&dev->mphy); in mt7915_eeprom_init()
267 int mt7915_eeprom_get_target_power(struct mt7915_dev *dev, in mt7915_eeprom_get_target_power() argument
271 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_get_target_power()
278 tssi_on = mt7915_tssi_enabled(dev, chan->band); in mt7915_eeprom_get_target_power()
279 is_7976 = mt7915_check_adie(dev, false) || is_mt7916(&dev->mt76); in mt7915_eeprom_get_target_power()
315 s8 mt7915_eeprom_get_power_delta(struct mt7915_dev *dev, int band) in mt7915_eeprom_get_power_delta() argument
317 u8 *eeprom = dev->mt76.eeprom.data; in mt7915_eeprom_get_power_delta()
320 bool is_7976 = mt7915_check_adie(dev, false) || is_mt7916(&dev->mt76); in mt7915_eeprom_get_power_delta()