There are devices which have wlan LED outside mt76. We need to enable throughput LED trigger even if mt76's LED is disabled to make external LED blink as if internal one. Signed-off-by: Kazuhiro Ito <kzhr@xxxxxxxxxxxxx> --- drivers/net/wireless/mediatek/mt76/mac80211.c | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 8a3a90d1bfac..a7bd6e24aac2 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -193,7 +193,15 @@ static const struct cfg80211_sar_capa mt76_sar_capa = { .freq_ranges = &mt76_sar_freq_ranges[0], }; -static int mt76_led_init(struct mt76_phy *phy) +static const char * mt76_create_tpt_led_trigger(struct ieee80211_hw * hw) +{ + return ieee80211_create_tpt_led_trigger(hw, + IEEE80211_TPT_LEDTRIG_FL_RADIO, + mt76_tpt_blink, + ARRAY_SIZE(mt76_tpt_blink)); +} + +static int mt76_led_init(struct mt76_phy *phy, const char *trigger) { struct mt76_dev *dev = phy->dev; struct ieee80211_hw *hw = phy->hw; @@ -228,11 +236,7 @@ static int mt76_led_init(struct mt76_phy *phy) wiphy_name(hw->wiphy)); phy->leds.cdev.name = phy->leds.name; - phy->leds.cdev.default_trigger = - ieee80211_create_tpt_led_trigger(hw, - IEEE80211_TPT_LEDTRIG_FL_RADIO, - mt76_tpt_blink, - ARRAY_SIZE(mt76_tpt_blink)); + phy->leds.cdev.default_trigger = trigger; dev_info(dev->dev, "registering led '%s'\n", phy->leds.name); @@ -517,6 +521,7 @@ int mt76_register_phy(struct mt76_phy *phy, bool vht, struct ieee80211_rate *rates, int n_rates) { int ret; + const char *trigger; ret = mt76_phy_init(phy, phy->hw); if (ret) @@ -540,8 +545,10 @@ int mt76_register_phy(struct mt76_phy *phy, bool vht, return ret; } + trigger = mt76_create_tpt_led_trigger(phy->hw); + if (IS_ENABLED(CONFIG_MT76_LEDS)) { - ret = mt76_led_init(phy); + ret = mt76_led_init(phy, trigger); if (ret) return ret; } @@ -701,6 +708,7 @@ int mt76_register_device(struct mt76_dev *dev, bool vht, struct ieee80211_hw *hw = dev->hw; struct mt76_phy *phy = &dev->phy; int ret; + const char *trigger; dev_set_drvdata(dev->dev, dev); mt76_wcid_init(&dev->global_wcid); @@ -731,8 +739,10 @@ int mt76_register_device(struct mt76_dev *dev, bool vht, mt76_check_sband(&dev->phy, &phy->sband_5g, NL80211_BAND_5GHZ); mt76_check_sband(&dev->phy, &phy->sband_6g, NL80211_BAND_6GHZ); + trigger = mt76_create_tpt_led_trigger(hw); + if (IS_ENABLED(CONFIG_MT76_LEDS)) { - ret = mt76_led_init(phy); + ret = mt76_led_init(phy, trigger); if (ret) return ret; } -- 2.43.0