Lines Matching +full:hw +full:- +full:blink

1 // SPDX-License-Identifier: ISC
57 dev = container_of(mphy->dev, struct mt7996_dev, mt76); in mt7996_led_set_config()
59 /* select TX blink mode, 2: only data frames */ in mt7996_led_set_config()
65 /* set LED Tx blink on/off time */ in mt7996_led_set_config()
72 if (mphy->leds.al) in mt7996_led_set_config()
110 int i, nss = hweight8(dev->mphy.antenna_mask); in mt7996_init_txpower()
112 int pwr_delta = mt7996_eeprom_get_power_delta(dev, sband->band); in mt7996_init_txpower()
115 for (i = 0; i < sband->n_channels; i++) { in mt7996_init_txpower()
116 struct ieee80211_channel *chan = &sband->channels[i]; in mt7996_init_txpower()
120 target_power = mt76_get_rate_power_limits(&dev->mphy, chan, in mt7996_init_txpower()
125 chan->max_power = min_t(int, chan->max_reg_power, in mt7996_init_txpower()
127 chan->orig_mpwr = target_power; in mt7996_init_txpower()
135 struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); in mt7996_regd_notifier() local
136 struct mt7996_dev *dev = mt7996_hw_dev(hw); in mt7996_regd_notifier()
137 struct mt7996_phy *phy = mt7996_hw_phy(hw); in mt7996_regd_notifier()
139 memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2)); in mt7996_regd_notifier()
140 dev->mt76.region = request->dfs_region; in mt7996_regd_notifier()
142 if (dev->mt76.region == NL80211_DFS_UNSET) in mt7996_regd_notifier()
145 mt7996_init_txpower(dev, &phy->mt76->sband_2g.sband); in mt7996_regd_notifier()
146 mt7996_init_txpower(dev, &phy->mt76->sband_5g.sband); in mt7996_regd_notifier()
147 mt7996_init_txpower(dev, &phy->mt76->sband_6g.sband); in mt7996_regd_notifier()
149 phy->mt76->dfs_state = MT_DFS_STATE_UNKNOWN; in mt7996_regd_notifier()
154 mt7996_init_wiphy(struct ieee80211_hw *hw) in mt7996_init_wiphy() argument
156 struct mt7996_phy *phy = mt7996_hw_phy(hw); in mt7996_init_wiphy()
158 struct mt76_dev *mdev = &phy->dev->mt76; in mt7996_init_wiphy()
160 struct wiphy *wiphy = hw->wiphy; in mt7996_init_wiphy()
161 u16 max_subframes = phy->dev->has_eht ? IEEE80211_MAX_AMPDU_BUF_EHT : in mt7996_init_wiphy()
164 hw->queues = 4; in mt7996_init_wiphy()
165 hw->max_rx_aggregation_subframes = max_subframes; in mt7996_init_wiphy()
166 hw->max_tx_aggregation_subframes = max_subframes; in mt7996_init_wiphy()
167 hw->netdev_features = NETIF_F_RXCSUM; in mt7996_init_wiphy()
169 hw->radiotap_timestamp.units_pos = in mt7996_init_wiphy()
172 phy->slottime = 9; in mt7996_init_wiphy()
174 hw->sta_data_size = sizeof(struct mt7996_sta); in mt7996_init_wiphy()
175 hw->vif_data_size = sizeof(struct mt7996_vif); in mt7996_init_wiphy()
177 wiphy->iface_combinations = if_comb; in mt7996_init_wiphy()
178 wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); in mt7996_init_wiphy()
179 wiphy->reg_notifier = mt7996_regd_notifier; in mt7996_init_wiphy()
180 wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; in mt7996_init_wiphy()
195 if (!mdev->dev->of_node || in mt7996_init_wiphy()
196 !of_property_read_bool(mdev->dev->of_node, in mt7996_init_wiphy()
197 "mediatek,disable-radar-background")) in mt7996_init_wiphy()
202 ieee80211_hw_set(hw, HAS_RATE_CONTROL); in mt7996_init_wiphy()
203 ieee80211_hw_set(hw, SUPPORTS_TX_ENCAP_OFFLOAD); in mt7996_init_wiphy()
204 ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD); in mt7996_init_wiphy()
205 ieee80211_hw_set(hw, WANT_MONITOR_VIF); in mt7996_init_wiphy()
207 hw->max_tx_fragments = 4; in mt7996_init_wiphy()
209 if (phy->mt76->cap.has_2ghz) { in mt7996_init_wiphy()
210 phy->mt76->sband_2g.sband.ht_cap.cap |= in mt7996_init_wiphy()
213 phy->mt76->sband_2g.sband.ht_cap.ampdu_density = in mt7996_init_wiphy()
217 if (phy->mt76->cap.has_5ghz) { in mt7996_init_wiphy()
218 phy->mt76->sband_5g.sband.ht_cap.cap |= in mt7996_init_wiphy()
222 phy->mt76->sband_5g.sband.vht_cap.cap |= in mt7996_init_wiphy()
227 phy->mt76->sband_5g.sband.ht_cap.ampdu_density = in mt7996_init_wiphy()
230 ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW); in mt7996_init_wiphy()
233 mt76_set_stream_caps(phy->mt76, true); in mt7996_init_wiphy()
237 wiphy->available_antennas_rx = phy->mt76->antenna_mask; in mt7996_init_wiphy()
238 wiphy->available_antennas_tx = phy->mt76->antenna_mask; in mt7996_init_wiphy()
263 /* filter out non-resp frames and get instanstaeous signal reporting */ in mt7996_mac_init_band()
296 i = dev->mphy.leds.pin ? MT_LED_GPIO_MUX3 : MT_LED_GPIO_MUX2; in mt7996_mac_init()
324 if (dev->dbdc_support) { in mt7996_txbf_init()
349 if ((band == MT_BAND1 && !dev->dbdc_support) || in mt7996_register_phy()
350 (band == MT_BAND2 && !dev->tbtc_support)) in mt7996_register_phy()
356 if (band == MT_BAND2 && dev->hif2) in mt7996_register_phy()
357 hif1_ofs = MT_WFDMA0_PCIE1(0) - MT_WFDMA0(0); in mt7996_register_phy()
359 mphy = mt76_alloc_phy(&dev->mt76, sizeof(*phy), &mt7996_ops, band); in mt7996_register_phy()
361 return -ENOMEM; in mt7996_register_phy()
363 phy = mphy->priv; in mt7996_register_phy()
364 phy->dev = dev; in mt7996_register_phy()
365 phy->mt76 = mphy; in mt7996_register_phy()
366 mphy->dev->phys[band] = mphy; in mt7996_register_phy()
368 INIT_DELAYED_WORK(&mphy->mac_work, mt7996_mac_work); in mt7996_register_phy()
376 memcpy(mphy->macaddr, dev->mt76.eeprom.data + mac_ofs, ETH_ALEN); in mt7996_register_phy()
378 memcpy(mphy->macaddr, (u8 *)dev->mt76.eeprom.data + mac_ofs, ETH_ALEN); in mt7996_register_phy()
383 if (!is_valid_ether_addr(mphy->macaddr)) { in mt7996_register_phy()
385 memcpy(mphy->macaddr, dev->mt76.eeprom.data + MT_EE_MAC_ADDR, in mt7996_register_phy()
387 memcpy(mphy->macaddr, (u8 *)dev->mt76.eeprom.data + MT_EE_MAC_ADDR, in mt7996_register_phy()
390 mphy->macaddr[0] |= 2; in mt7996_register_phy()
391 mphy->macaddr[0] ^= BIT(7); in mt7996_register_phy()
393 mphy->macaddr[0] ^= BIT(6); in mt7996_register_phy()
398 mt7996_init_wiphy(mphy->hw); in mt7996_register_phy()
399 ret = mt76_connac_init_tx_queues(phy->mt76, in mt7996_register_phy()
418 mphy->dev->phys[band] = NULL; in mt7996_register_phy()
419 ieee80211_free_hw(mphy->hw); in mt7996_register_phy()
431 mphy = phy->dev->mt76.phys[band]; in mt7996_unregister_phy()
433 ieee80211_free_hw(mphy->hw); in mt7996_unregister_phy()
434 phy->dev->mt76.phys[band] = NULL; in mt7996_unregister_phy()
444 mt7996_init_txpower(dev, &dev->mphy.sband_2g.sband); in mt7996_init_work()
445 mt7996_init_txpower(dev, &dev->mphy.sband_5g.sband); in mt7996_init_work()
446 mt7996_init_txpower(dev, &dev->mphy.sband_6g.sband); in mt7996_init_work()
465 INIT_WORK(&dev->init_work, mt7996_init_work); in mt7996_init_hardware()
467 dev->dbdc_support = true; in mt7996_init_hardware()
468 dev->tbtc_support = true; in mt7996_init_hardware()
474 set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state); in mt7996_init_hardware()
485 idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7996_WTBL_STA); in mt7996_init_hardware()
487 return -ENOSPC; in mt7996_init_hardware()
489 dev->mt76.global_wcid.idx = idx; in mt7996_init_hardware()
490 dev->mt76.global_wcid.hw_key_idx = -1; in mt7996_init_hardware()
491 dev->mt76.global_wcid.tx_info |= MT_WCID_TX_INFO_SET; in mt7996_init_hardware()
492 rcu_assign_pointer(dev->mt76.wcid[idx], &dev->mt76.global_wcid); in mt7996_init_hardware()
502 if (!phy->mt76->cap.has_5ghz) in mt7996_set_stream_vht_txbf_caps()
505 sts = hweight16(phy->mt76->chainmask); in mt7996_set_stream_vht_txbf_caps()
506 cap = &phy->mt76->sband_5g.sband.vht_cap.cap; in mt7996_set_stream_vht_txbf_caps()
510 FIELD_PREP(IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK, sts - 1); in mt7996_set_stream_vht_txbf_caps()
521 FIELD_PREP(IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK, sts - 1); in mt7996_set_stream_vht_txbf_caps()
528 struct ieee80211_he_cap_elem *elem = &he_cap->he_cap_elem; in mt7996_set_stream_he_txbf_caps()
529 int sts = hweight16(phy->mt76->chainmask); in mt7996_set_stream_he_txbf_caps()
537 elem->phy_cap_info[3] &= ~IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER; in mt7996_set_stream_he_txbf_caps()
538 elem->phy_cap_info[4] &= ~IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER; in mt7996_set_stream_he_txbf_caps()
542 elem->phy_cap_info[5] &= ~c; in mt7996_set_stream_he_txbf_caps()
546 elem->phy_cap_info[6] &= ~c; in mt7996_set_stream_he_txbf_caps()
548 elem->phy_cap_info[7] &= ~IEEE80211_HE_PHY_CAP7_MAX_NC_MASK; in mt7996_set_stream_he_txbf_caps()
553 elem->phy_cap_info[2] |= c; in mt7996_set_stream_he_txbf_caps()
558 elem->phy_cap_info[4] |= c; in mt7996_set_stream_he_txbf_caps()
567 elem->phy_cap_info[6] |= c; in mt7996_set_stream_he_txbf_caps()
573 elem->phy_cap_info[7] |= min_t(int, sts - 1, 2) << 3; in mt7996_set_stream_he_txbf_caps()
578 elem->phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER; in mt7996_set_stream_he_txbf_caps()
579 elem->phy_cap_info[4] |= IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER; in mt7996_set_stream_he_txbf_caps()
582 sts - 1) | in mt7996_set_stream_he_txbf_caps()
584 sts - 1); in mt7996_set_stream_he_txbf_caps()
585 elem->phy_cap_info[5] |= c; in mt7996_set_stream_he_txbf_caps()
589 elem->phy_cap_info[6] |= c; in mt7996_set_stream_he_txbf_caps()
593 elem->phy_cap_info[7] |= c; in mt7996_set_stream_he_txbf_caps()
601 struct ieee80211_sta_he_cap *he_cap = &data->he_cap; in mt7996_init_he_caps()
602 struct ieee80211_he_cap_elem *he_cap_elem = &he_cap->he_cap_elem; in mt7996_init_he_caps()
603 struct ieee80211_he_mcs_nss_supp *he_mcs = &he_cap->he_mcs_nss_supp; in mt7996_init_he_caps()
604 int i, nss = hweight8(phy->mt76->antenna_mask); in mt7996_init_he_caps()
614 he_cap->has_he = true; in mt7996_init_he_caps()
616 he_cap_elem->mac_cap_info[0] = IEEE80211_HE_MAC_CAP0_HTC_HE; in mt7996_init_he_caps()
617 he_cap_elem->mac_cap_info[3] = IEEE80211_HE_MAC_CAP3_OMI_CONTROL | in mt7996_init_he_caps()
619 he_cap_elem->mac_cap_info[4] = IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU; in mt7996_init_he_caps()
622 he_cap_elem->phy_cap_info[0] = in mt7996_init_he_caps()
625 he_cap_elem->phy_cap_info[0] = in mt7996_init_he_caps()
629 he_cap_elem->phy_cap_info[1] = IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD; in mt7996_init_he_caps()
630 he_cap_elem->phy_cap_info[2] = IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ | in mt7996_init_he_caps()
635 he_cap_elem->mac_cap_info[0] |= IEEE80211_HE_MAC_CAP0_TWT_RES; in mt7996_init_he_caps()
636 he_cap_elem->mac_cap_info[2] |= IEEE80211_HE_MAC_CAP2_BSR; in mt7996_init_he_caps()
637 he_cap_elem->mac_cap_info[4] |= IEEE80211_HE_MAC_CAP4_BQR; in mt7996_init_he_caps()
638 he_cap_elem->mac_cap_info[5] |= in mt7996_init_he_caps()
640 he_cap_elem->phy_cap_info[3] |= in mt7996_init_he_caps()
643 he_cap_elem->phy_cap_info[6] |= in mt7996_init_he_caps()
646 he_cap_elem->phy_cap_info[9] |= in mt7996_init_he_caps()
651 he_cap_elem->mac_cap_info[1] |= in mt7996_init_he_caps()
655 he_cap_elem->phy_cap_info[0] |= in mt7996_init_he_caps()
658 he_cap_elem->phy_cap_info[0] |= in mt7996_init_he_caps()
661 he_cap_elem->phy_cap_info[1] |= in mt7996_init_he_caps()
664 he_cap_elem->phy_cap_info[3] |= in mt7996_init_he_caps()
667 he_cap_elem->phy_cap_info[6] |= in mt7996_init_he_caps()
671 he_cap_elem->phy_cap_info[7] |= in mt7996_init_he_caps()
674 he_cap_elem->phy_cap_info[8] |= in mt7996_init_he_caps()
679 he_cap_elem->phy_cap_info[9] |= in mt7996_init_he_caps()
691 he_mcs->rx_mcs_80 = cpu_to_le16(mcs_map); in mt7996_init_he_caps()
692 he_mcs->tx_mcs_80 = cpu_to_le16(mcs_map); in mt7996_init_he_caps()
693 he_mcs->rx_mcs_160 = cpu_to_le16(mcs_map); in mt7996_init_he_caps()
694 he_mcs->tx_mcs_160 = cpu_to_le16(mcs_map); in mt7996_init_he_caps()
698 memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres)); in mt7996_init_he_caps()
699 if (he_cap_elem->phy_cap_info[6] & in mt7996_init_he_caps()
701 mt76_connac_gen_ppe_thresh(he_cap->ppe_thres, nss); in mt7996_init_he_caps()
703 he_cap_elem->phy_cap_info[9] |= in mt7996_init_he_caps()
719 data->he_6ghz_capa.capa = cpu_to_le16(cap); in mt7996_init_he_caps()
728 struct ieee80211_sta_eht_cap *eht_cap = &data->eht_cap; in mt7996_init_eht_caps()
729 struct ieee80211_eht_cap_elem_fixed *eht_cap_elem = &eht_cap->eht_cap_elem; in mt7996_init_eht_caps()
730 struct ieee80211_eht_mcs_nss_supp *eht_nss = &eht_cap->eht_mcs_nss_supp; in mt7996_init_eht_caps()
731 enum nl80211_chan_width width = phy->mt76->chandef.width; in mt7996_init_eht_caps()
732 int nss = hweight8(phy->mt76->antenna_mask); in mt7996_init_eht_caps()
733 int sts = hweight16(phy->mt76->chainmask); in mt7996_init_eht_caps()
736 if (!phy->dev->has_eht) in mt7996_init_eht_caps()
739 eht_cap->has_eht = true; in mt7996_init_eht_caps()
741 eht_cap_elem->mac_cap_info[0] = in mt7996_init_eht_caps()
745 eht_cap_elem->phy_cap_info[0] = in mt7996_init_eht_caps()
751 eht_cap_elem->phy_cap_info[0] |= in mt7996_init_eht_caps()
752 u8_encode_bits(u8_get_bits(sts - 1, BIT(0)), in mt7996_init_eht_caps()
755 eht_cap_elem->phy_cap_info[1] = in mt7996_init_eht_caps()
756 u8_encode_bits(u8_get_bits(sts - 1, GENMASK(2, 1)), in mt7996_init_eht_caps()
758 u8_encode_bits(sts - 1, in mt7996_init_eht_caps()
760 u8_encode_bits(sts - 1, in mt7996_init_eht_caps()
763 eht_cap_elem->phy_cap_info[2] = in mt7996_init_eht_caps()
764 u8_encode_bits(sts - 1, IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_80MHZ_MASK) | in mt7996_init_eht_caps()
765 u8_encode_bits(sts - 1, IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_160MHZ_MASK) | in mt7996_init_eht_caps()
766 u8_encode_bits(sts - 1, IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_320MHZ_MASK); in mt7996_init_eht_caps()
768 eht_cap_elem->phy_cap_info[3] = in mt7996_init_eht_caps()
777 eht_cap_elem->phy_cap_info[4] = in mt7996_init_eht_caps()
778 u8_encode_bits(min_t(int, sts - 1, 2), in mt7996_init_eht_caps()
781 eht_cap_elem->phy_cap_info[5] = in mt7996_init_eht_caps()
791 eht_cap_elem->phy_cap_info[6] = in mt7996_init_eht_caps()
796 eht_cap_elem->phy_cap_info[7] = in mt7996_init_eht_caps()
807 eht_nss->bw._##_bw.rx_tx_mcs9_max_nss = _val; \ in mt7996_init_eht_caps()
808 eht_nss->bw._##_bw.rx_tx_mcs11_max_nss = _val; \ in mt7996_init_eht_caps()
809 eht_nss->bw._##_bw.rx_tx_mcs13_max_nss = _val; \ in mt7996_init_eht_caps()
823 struct ieee80211_sband_iftype_data *data = phy->iftype[band]; in __mt7996_set_stream_he_eht_caps()
845 sband->iftype_data = data; in __mt7996_set_stream_he_eht_caps()
846 sband->n_iftype_data = n; in __mt7996_set_stream_he_eht_caps()
851 if (phy->mt76->cap.has_2ghz) in mt7996_set_stream_he_eht_caps()
852 __mt7996_set_stream_he_eht_caps(phy, &phy->mt76->sband_2g.sband, in mt7996_set_stream_he_eht_caps()
855 if (phy->mt76->cap.has_5ghz) in mt7996_set_stream_he_eht_caps()
856 __mt7996_set_stream_he_eht_caps(phy, &phy->mt76->sband_5g.sband, in mt7996_set_stream_he_eht_caps()
859 if (phy->mt76->cap.has_6ghz) in mt7996_set_stream_he_eht_caps()
860 __mt7996_set_stream_he_eht_caps(phy, &phy->mt76->sband_6g.sband, in mt7996_set_stream_he_eht_caps()
866 struct ieee80211_hw *hw = mt76_hw(dev); in mt7996_register_device() local
869 dev->phy.dev = dev; in mt7996_register_device()
870 dev->phy.mt76 = &dev->mt76.phy; in mt7996_register_device()
871 dev->mt76.phy.priv = &dev->phy; in mt7996_register_device()
872 INIT_WORK(&dev->rc_work, mt7996_mac_sta_rc_work); in mt7996_register_device()
873 INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7996_mac_work); in mt7996_register_device()
874 INIT_LIST_HEAD(&dev->sta_rc_list); in mt7996_register_device()
875 INIT_LIST_HEAD(&dev->twt_list); in mt7996_register_device()
877 init_waitqueue_head(&dev->reset_wait); in mt7996_register_device()
878 INIT_WORK(&dev->reset_work, mt7996_mac_reset_work); in mt7996_register_device()
879 INIT_WORK(&dev->dump_work, mt7996_mac_dump_work); in mt7996_register_device()
880 mutex_init(&dev->dump_mutex); in mt7996_register_device()
886 mt7996_init_wiphy(hw); in mt7996_register_device()
890 dev->mphy.leds.cdev.brightness_set = mt7996_led_set_brightness; in mt7996_register_device()
891 dev->mphy.leds.cdev.blink_set = mt7996_led_set_blink; in mt7996_register_device()
894 ret = mt76_register_device(&dev->mt76, true, mt76_rates, in mt7996_register_device()
899 ieee80211_queue_work(mt76_hw(dev), &dev->init_work); in mt7996_register_device()
909 dev->recovery.hw_init_done = true; in mt7996_register_device()
911 ret = mt7996_init_debugfs(&dev->phy); in mt7996_register_device()
923 mt76_unregister_device(&dev->mt76); in mt7996_unregister_device()
927 tasklet_disable(&dev->mt76.irq_tasklet); in mt7996_unregister_device()
929 mt76_free_device(&dev->mt76); in mt7996_unregister_device()