Lines Matching refs:dev

32 mt7601u_efuse_read(struct mt7601u_dev *dev, u16 addr, u8 *data,  in mt7601u_efuse_read()  argument
38 val = mt76_rr(dev, MT_EFUSE_CTRL); in mt7601u_efuse_read()
44 mt76_wr(dev, MT_EFUSE_CTRL, val); in mt7601u_efuse_read()
46 if (!mt76_poll(dev, MT_EFUSE_CTRL, MT_EFUSE_CTRL_KICK, 0, 1000)) in mt7601u_efuse_read()
49 val = mt76_rr(dev, MT_EFUSE_CTRL); in mt7601u_efuse_read()
59 val = mt76_rr(dev, MT_EFUSE_DATA(i)); in mt7601u_efuse_read()
67 mt7601u_efuse_physical_size_check(struct mt7601u_dev *dev) in mt7601u_efuse_physical_size_check() argument
75 ret = mt7601u_efuse_read(dev, MT_EE_USAGE_MAP_START + i * 16, in mt7601u_efuse_physical_size_check()
90 …dev_err(dev->dev, "Error: your device needs default EEPROM file and this driver doesn't support it… in mt7601u_efuse_physical_size_check()
98 mt7601u_has_tssi(struct mt7601u_dev *dev, u8 *eeprom) in mt7601u_has_tssi() argument
106 mt7601u_set_chip_cap(struct mt7601u_dev *dev, u8 *eeprom) in mt7601u_set_chip_cap() argument
114 dev->ee->tssi_enabled = mt7601u_has_tssi(dev, eeprom) && in mt7601u_set_chip_cap()
118 dev_err(dev->dev, in mt7601u_set_chip_cap()
126 dev_err(dev->dev, in mt7601u_set_chip_cap()
130 static void mt7601u_set_channel_target_power(struct mt7601u_dev *dev, in mt7601u_set_channel_target_power() argument
136 dev_warn(dev->dev, "Error: EEPROM trgt power invalid %hhx!\n", in mt7601u_set_channel_target_power()
141 memset(dev->ee->chan_pwr, trgt_pwr, sizeof(dev->ee->chan_pwr)); in mt7601u_set_channel_target_power()
145 mt7601u_set_channel_power(struct mt7601u_dev *dev, u8 *eeprom) in mt7601u_set_channel_power() argument
150 val = mt7601u_rr(dev, MT_TX_ALC_CFG_0); in mt7601u_set_channel_power()
153 if (mt7601u_has_tssi(dev, eeprom)) { in mt7601u_set_channel_power()
154 mt7601u_set_channel_target_power(dev, eeprom, max_pwr); in mt7601u_set_channel_power()
164 dev->ee->chan_pwr[i] = power; in mt7601u_set_channel_power()
169 mt7601u_set_country_reg(struct mt7601u_dev *dev, u8 *eeprom) in mt7601u_set_country_reg() argument
190 dev_info(dev->dev, in mt7601u_set_country_reg()
197 dev->ee->reg = chan_bounds[idx]; in mt7601u_set_country_reg()
205 mt7601u_set_rf_freq_off(struct mt7601u_dev *dev, u8 *eeprom) in mt7601u_set_rf_freq_off() argument
209 dev->ee->rf_freq_off = field_validate(eeprom[MT_EE_FREQ_OFFSET]); in mt7601u_set_rf_freq_off()
213 dev->ee->rf_freq_off -= comp & 0x7f; in mt7601u_set_rf_freq_off()
215 dev->ee->rf_freq_off += comp; in mt7601u_set_rf_freq_off()
219 mt7601u_set_rssi_offset(struct mt7601u_dev *dev, u8 *eeprom) in mt7601u_set_rssi_offset() argument
222 s8 *rssi_offset = dev->ee->rssi_offset; in mt7601u_set_rssi_offset()
228 dev_warn(dev->dev, in mt7601u_set_rssi_offset()
237 mt7601u_extra_power_over_mac(struct mt7601u_dev *dev) in mt7601u_extra_power_over_mac() argument
241 val = ((mt7601u_rr(dev, MT_TX_PWR_CFG_1) & 0x0000ff00) >> 8); in mt7601u_extra_power_over_mac()
242 val |= ((mt7601u_rr(dev, MT_TX_PWR_CFG_2) & 0x0000ff00) << 8); in mt7601u_extra_power_over_mac()
243 mt7601u_wr(dev, MT_TX_PWR_CFG_7, val); in mt7601u_extra_power_over_mac()
245 val = ((mt7601u_rr(dev, MT_TX_PWR_CFG_4) & 0x0000ff00) >> 8); in mt7601u_extra_power_over_mac()
246 mt7601u_wr(dev, MT_TX_PWR_CFG_9, val); in mt7601u_extra_power_over_mac()
263 mt7601u_save_power_rate(struct mt7601u_dev *dev, s8 delta, u32 val, int i) in mt7601u_save_power_rate() argument
265 struct mt7601u_rate_power *t = &dev->ee->power_rate_table; in mt7601u_save_power_rate()
272 dev->ee->real_cck_bw20[0] = t->cck[0].bw20; in mt7601u_save_power_rate()
273 dev->ee->real_cck_bw20[1] = t->cck[1].bw20; in mt7601u_save_power_rate()
309 mt7601u_config_tx_power_per_rate(struct mt7601u_dev *dev, u8 *eeprom) in mt7601u_config_tx_power_per_rate() argument
320 mt7601u_save_power_rate(dev, bw40_delta, val, i); in mt7601u_config_tx_power_per_rate()
323 mt7601u_wr(dev, MT_TX_PWR_CFG_0 + i * 4, val); in mt7601u_config_tx_power_per_rate()
326 mt7601u_extra_power_over_mac(dev); in mt7601u_config_tx_power_per_rate()
330 mt7601u_init_tssi_params(struct mt7601u_dev *dev, u8 *eeprom) in mt7601u_init_tssi_params() argument
332 struct tssi_data *d = &dev->ee->tssi_data; in mt7601u_init_tssi_params()
334 if (!dev->ee->tssi_enabled) in mt7601u_init_tssi_params()
345 mt7601u_eeprom_init(struct mt7601u_dev *dev) in mt7601u_eeprom_init() argument
350 ret = mt7601u_efuse_physical_size_check(dev); in mt7601u_eeprom_init()
354 dev->ee = devm_kzalloc(dev->dev, sizeof(*dev->ee), GFP_KERNEL); in mt7601u_eeprom_init()
355 if (!dev->ee) in mt7601u_eeprom_init()
363 ret = mt7601u_efuse_read(dev, i, eeprom + i, MT_EE_READ); in mt7601u_eeprom_init()
369 dev_warn(dev->dev, in mt7601u_eeprom_init()
372 dev_info(dev->dev, "EEPROM ver:%02hhx fae:%02hhx\n", in mt7601u_eeprom_init()
375 mt7601u_set_macaddr(dev, eeprom + MT_EE_MAC_ADDR); in mt7601u_eeprom_init()
376 mt7601u_set_chip_cap(dev, eeprom); in mt7601u_eeprom_init()
377 mt7601u_set_channel_power(dev, eeprom); in mt7601u_eeprom_init()
378 mt7601u_set_country_reg(dev, eeprom); in mt7601u_eeprom_init()
379 mt7601u_set_rf_freq_off(dev, eeprom); in mt7601u_eeprom_init()
380 mt7601u_set_rssi_offset(dev, eeprom); in mt7601u_eeprom_init()
381 dev->ee->ref_temp = eeprom[MT_EE_REF_TEMP]; in mt7601u_eeprom_init()
382 dev->ee->lna_gain = eeprom[MT_EE_LNA_GAIN]; in mt7601u_eeprom_init()
384 mt7601u_config_tx_power_per_rate(dev, eeprom); in mt7601u_eeprom_init()
386 mt7601u_init_tssi_params(dev, eeprom); in mt7601u_eeprom_init()