Skip to content

Commit

Permalink
mt76: mac80211: add LED label property support
Browse files Browse the repository at this point in the history
Make LED label customizable in the device tree.

Signed-off-by: Kazuhiro Ito <[email protected]>
  • Loading branch information
ikazuhiro committed Dec 23, 2022
1 parent 5b509e8 commit 69489f7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,12 @@ static int mt76_led_init(struct mt76_phy *phy)
{
struct mt76_dev *dev = phy->dev;
struct ieee80211_hw *hw = phy->hw;
const char *led_label;

if (!phy->leds.cdev.brightness_set && !phy->leds.cdev.blink_set)
return 0;

snprintf(phy->leds.name, sizeof(phy->leds.name), "mt76-%s",
wiphy_name(hw->wiphy));

phy->leds.cdev.name = phy->leds.name;
phy->leds.cdev.name = NULL;
phy->leds.cdev.default_trigger =
ieee80211_create_tpt_led_trigger(hw,
IEEE80211_TPT_LEDTRIG_FL_RADIO,
Expand All @@ -221,10 +219,19 @@ static int mt76_led_init(struct mt76_phy *phy)
phy->leds.pin = led_pin;
phy->leds.al = of_property_read_bool(np,
"led-active-low");
if (!of_property_read_string(np, "label", &led_label)) {
phy->leds.cdev.name = led_label;
}
of_node_put(np);
}
}

if (!phy->leds.cdev.name) {
snprintf(phy->leds.name, sizeof(phy->leds.name), "mt76-%s",
wiphy_name(hw->wiphy));
phy->leds.cdev.name = phy->leds.name;
}

return led_classdev_register(dev->dev, &phy->leds.cdev);
}

Expand Down

0 comments on commit 69489f7

Please sign in to comment.