Skip to content

Commit

Permalink
mt76: mac80211: Enable to specify LED name in Device Tree
Browse files Browse the repository at this point in the history
Make LED name customizable in Device Tree.  color, function and label
properties are available.

Signed-off-by: Kazuhiro Ito <[email protected]>
  • Loading branch information
ikazuhiro committed Dec 30, 2023
1 parent bebd9cf commit 497dc9f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ static int mt76_led_init(struct mt76_phy *phy)
struct mt76_dev *dev = phy->dev;
struct ieee80211_hw *hw = phy->hw;
struct device_node *np = dev->dev->of_node;
struct led_init_data init_data;

if (!phy->leds.cdev.brightness_set && !phy->leds.cdev.blink_set)
return 0;
Expand All @@ -212,6 +213,11 @@ static int mt76_led_init(struct mt76_phy *phy)
return 0;
}

init_data.fwnode = &np->fwnode;
init_data.default_label = NULL;
init_data.devicename = NULL;
init_data.devname_mandatory = false;

if (phy == &dev->phy) {
int led_pin;

Expand All @@ -238,7 +244,7 @@ static int mt76_led_init(struct mt76_phy *phy)
dev_info(dev->dev,
"registering led '%s'\n", phy->leds.name);

return led_classdev_register(dev->dev, &phy->leds.cdev);
return led_classdev_register_ext(dev->dev, &phy->leds.cdev, np ? &init_data : NULL);
}

static void mt76_led_cleanup(struct mt76_phy *phy)
Expand Down

0 comments on commit 497dc9f

Please sign in to comment.