* [PATCH] wifi: mt76: add ability to explicitly forbid LED registration with DT
@ 2023-08-24 17:08 Ryder Lee
2023-08-29 6:39 ` Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Ryder Lee @ 2023-08-24 17:08 UTC (permalink / raw)
To: Felix Fietkau, linux-wireless
Cc: Lorenzo Bianconi, Shayne Chen, Evelyn Tsai, linux-mediatek,
Ryder Lee, Alexey D . Filimonov
Add ability to explicitly forbid LED registration using DT led\status = "disabled".
Tested-by: Alexey D. Filimonov <alexey@filimonic.net>
Signed-off-by: Alexey D. Filimonov <alexey@filimonic.net>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mac80211.c | 39 ++++++++++++-------
1 file changed, 25 insertions(+), 14 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index c0ff36a98bed..f768d9aed456 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -198,10 +198,33 @@ 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;
if (!phy->leds.cdev.brightness_set && !phy->leds.cdev.blink_set)
return 0;
+ np = of_get_child_by_name(np, "led");
+ if (np) {
+ if (!of_device_is_available(np)) {
+ of_node_put(np);
+ dev_info(dev->dev,
+ "led registration was explicitly disabled by dts\n");
+ return 0;
+ }
+
+ if (phy == &dev->phy) {
+ int led_pin;
+
+ if (!of_property_read_u32(np, "led-sources", &led_pin))
+ phy->leds.pin = led_pin;
+
+ phy->leds.al =
+ of_property_read_bool(np, "led-active-low");
+ }
+
+ of_node_put(np);
+ }
+
snprintf(phy->leds.name, sizeof(phy->leds.name), "mt76-%s",
wiphy_name(hw->wiphy));
@@ -212,20 +235,8 @@ static int mt76_led_init(struct mt76_phy *phy)
mt76_tpt_blink,
ARRAY_SIZE(mt76_tpt_blink));
- if (phy == &dev->phy) {
- struct device_node *np = dev->dev->of_node;
-
- np = of_get_child_by_name(np, "led");
- if (np) {
- int led_pin;
-
- if (!of_property_read_u32(np, "led-sources", &led_pin))
- phy->leds.pin = led_pin;
- phy->leds.al = of_property_read_bool(np,
- "led-active-low");
- of_node_put(np);
- }
- }
+ dev_info(dev->dev,
+ "registering led '%s'\n", phy->leds.name);
return led_classdev_register(dev->dev, &phy->leds.cdev);
}
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] wifi: mt76: add ability to explicitly forbid LED registration with DT
2023-08-24 17:08 [PATCH] wifi: mt76: add ability to explicitly forbid LED registration with DT Ryder Lee
@ 2023-08-29 6:39 ` Kalle Valo
2023-08-29 15:03 ` Alexey
0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2023-08-29 6:39 UTC (permalink / raw)
To: Ryder Lee
Cc: Felix Fietkau, linux-wireless, Lorenzo Bianconi, Shayne Chen,
Evelyn Tsai, linux-mediatek, Alexey D . Filimonov
Ryder Lee <ryder.lee@mediatek.com> writes:
> Add ability to explicitly forbid LED registration using DT led\status = "disabled".
>
> Tested-by: Alexey D. Filimonov <alexey@filimonic.net>
> Signed-off-by: Alexey D. Filimonov <alexey@filimonic.net>
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Is this a generic Device Tree feature and already documented in DT
bindings?
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] wifi: mt76: add ability to explicitly forbid LED registration with DT
2023-08-29 6:39 ` Kalle Valo
@ 2023-08-29 15:03 ` Alexey
0 siblings, 0 replies; 3+ messages in thread
From: Alexey @ 2023-08-29 15:03 UTC (permalink / raw)
To: Kalle Valo, Ryder Lee
Cc: Felix Fietkau, linux-wireless, Lorenzo Bianconi, Shayne Chen,
Evelyn Tsai, linux-mediatek
DT specification 4.0, section "2.3 Standard Properties":
> DTSpec specifies a set of standard properties for device nodes
DT specification 4.0, paragraph "2.3.4 status":
> The status property indicates the operational status of a device.
> The lack of a status property should be treated as if the property
existed with the value of "okay".
On 2023-08-29 09:39, Kalle Valo wrote:
> Ryder Lee <ryder.lee@mediatek.com> writes:
>
>> Add ability to explicitly forbid LED registration using DT led\status = "disabled".
>>
>> Tested-by: Alexey D. Filimonov <alexey@filimonic.net>
>> Signed-off-by: Alexey D. Filimonov <alexey@filimonic.net>
>> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> Is this a generic Device Tree feature and already documented in DT
> bindings?
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-29 15:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-24 17:08 [PATCH] wifi: mt76: add ability to explicitly forbid LED registration with DT Ryder Lee
2023-08-29 6:39 ` Kalle Valo
2023-08-29 15:03 ` Alexey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox