Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac80211: Create throughput LED trigger always #854

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,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;
Expand Down Expand Up @@ -229,11 +237,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);
Expand Down Expand Up @@ -518,6 +522,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)
Expand All @@ -541,8 +546,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;
}
Expand Down Expand Up @@ -702,6 +709,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);
Expand Down Expand Up @@ -732,8 +740,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;
}
Expand Down