linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kazuhiro Ito <kzhr@d1.dion.ne.jp>
To: linux-wireless@vger.kernel.org
Cc: Felix Fietkau <nbd@nbd.name>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Shayne Chen <shayne.chen@mediatek.com>,
	Sean Wang <sean.wang@mediatek.com>
Subject: [PATCH] wifi: mt76: Create throughput LED trigger always
Date: Mon, 08 Jan 2024 16:18:34 +0900	[thread overview]
Message-ID: <857ckk1eet.wl--xmue@d1.dion.ne.jp> (raw)

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@d1.dion.ne.jp>
---
 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


                 reply	other threads:[~2024-01-08  7:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=857ckk1eet.wl--xmue@d1.dion.ne.jp \
    --to=kzhr@d1.dion.ne.jp \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).