From: "Quan Zhou (周全)" <Quan.Zhou@mediatek.com>
To: "lorenzo@kernel.org" <lorenzo@kernel.org>
Cc: "linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"Shengxi Xu (徐胜喜)" <shengxi.xu@mediatek.com>,
"Deren Wu (武德仁)" <Deren.Wu@mediatek.com>,
"Shayne Chen (陳軒丞)" <Shayne.Chen@mediatek.com>,
"nbd@nbd.name" <nbd@nbd.name>,
"Sean Wang" <Sean.Wang@mediatek.com>,
"Hao Zhang (张浩)" <hao.zhang@mediatek.com>,
"Ryder Lee" <Ryder.Lee@mediatek.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] wifi: mt76: mt7921e: add LED control support
Date: Wed, 10 Apr 2024 12:20:32 +0000 [thread overview]
Message-ID: <48ad87ce5300a8c1570c5ec244f5b5773386538c.camel@mediatek.com> (raw)
In-Reply-To: <ZhZrAyc84-VCdrdw@lore-desk>
On Wed, 2024-04-10 at 12:33 +0200, Lorenzo Bianconi wrote:
> [...]
>
> > +static void mt7921_stop(struct ieee80211_hw *hw)
> > +{
> > + struct mt792x_dev *dev = mt792x_hw_dev(hw);
> > + int err = 0;
> > +
> > + mt792x_mutex_acquire(dev);
> > + if (mt76_is_mmio(&dev->mt76))
> > + err = mt7921_mcu_radio_led_ctrl(dev,
> > EXT_CMD_RADIO_OFF_LED);
> > + mt792x_mutex_release(dev);
>
> you can avoid waking the device up here if it is not a pci one,
> right?
>
> Regards,
> Lorenzo
>
Hi Lorenzo:
Yes, no need wake device if it not pcie one,
I will fix & resend.
B.R
> > + if (err)
> > + return;
> > +
> > + mt792x_stop(hw);
> > +}
> > +
> > static int
> > mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif
> > *vif)
> > {
> > @@ -1372,7 +1396,7 @@ static void mt7921_mgd_complete_tx(struct
> > ieee80211_hw *hw,
> > const struct ieee80211_ops mt7921_ops = {
> > .tx = mt792x_tx,
> > .start = mt7921_start,
> > - .stop = mt792x_stop,
> > + .stop = mt7921_stop,
> > .add_interface = mt7921_add_interface,
> > .remove_interface = mt792x_remove_interface,
> > .config = mt7921_config,
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
> > b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
> > index 8b4ce32a2cd1..2ebf0ffe78d5 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
> > @@ -606,6 +606,20 @@ int mt7921_run_firmware(struct mt792x_dev
> > *dev)
> > }
> > EXPORT_SYMBOL_GPL(mt7921_run_firmware);
> >
> > +int mt7921_mcu_radio_led_ctrl(struct mt792x_dev *dev, u8 value)
> > +{
> > + struct {
> > + u8 ctrlid;
> > + u8 rsv[3];
> > + } __packed req = {
> > + .ctrlid = value,
> > + };
> > +
> > + return mt76_mcu_send_msg(&dev->mt76,
> > MCU_EXT_CMD(ID_RADIO_ON_OFF_CTRL),
> > + &req, sizeof(req), false);
> > +}
> > +EXPORT_SYMBOL_GPL(mt7921_mcu_radio_led_ctrl);
> > +
> > int mt7921_mcu_set_tx(struct mt792x_dev *dev, struct ieee80211_vif
> > *vif)
> > {
> > struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
> > b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
> > index 3016636d18c6..07023eb9e5b5 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
> > @@ -27,6 +27,10 @@
> > #define MCU_UNI_EVENT_ROC 0x27
> > #define MCU_UNI_EVENT_CLC 0x80
> >
> > +#define EXT_CMD_RADIO_LED_CTRL_ENABLE 0x1
> > +#define EXT_CMD_RADIO_ON_LED 0x2
> > +#define EXT_CMD_RADIO_OFF_LED 0x3
> > +
> > enum {
> > UNI_ROC_ACQUIRE,
> > UNI_ROC_ABORT,
> > @@ -196,6 +200,7 @@ int mt7921_mcu_fw_log_2_host(struct mt792x_dev
> > *dev, u8 ctrl);
> > void mt7921_mcu_rx_event(struct mt792x_dev *dev, struct sk_buff
> > *skb);
> > int mt7921_mcu_set_rxfilter(struct mt792x_dev *dev, u32 fif,
> > u8 bit_op, u32 bit_map);
> > +int mt7921_mcu_radio_led_ctrl(struct mt792x_dev *dev, u8 value);
> >
> > static inline u32
> > mt7921_reg_map_l1(struct mt792x_dev *dev, u32 addr)
> > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
> > b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
> > index 0b69b225bc16..f768e9389ac6 100644
> > --- a/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
> > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/pci.c
> > @@ -427,6 +427,10 @@ static int mt7921_pci_suspend(struct device
> > *device)
> > wait_event_timeout(dev->wait,
> > !dev->regd_in_progress, 5 * HZ);
> >
> > + err = mt7921_mcu_radio_led_ctrl(dev, EXT_CMD_RADIO_OFF_LED);
> > + if (err < 0)
> > + goto restore_suspend;
> > +
> > err = mt76_connac_mcu_set_hif_suspend(mdev, true);
> > if (err)
> > goto restore_suspend;
> > @@ -525,9 +529,11 @@ static int mt7921_pci_resume(struct device
> > *device)
> > mt76_connac_mcu_set_deep_sleep(&dev->mt76, false);
> >
> > err = mt76_connac_mcu_set_hif_suspend(mdev, false);
> > + if (err < 0)
> > + goto failed;
> >
> > mt7921_regd_update(dev);
> > -
> > + err = mt7921_mcu_radio_led_ctrl(dev, EXT_CMD_RADIO_ON_LED);
> > failed:
> > pm->suspended = false;
> >
> > --
> > 2.18.0
> >
prev parent reply other threads:[~2024-04-10 12:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 8:58 [PATCH] wifi: mt76: mt7921e: add LED control support Quan Zhou
2024-04-10 10:33 ` Lorenzo Bianconi
2024-04-10 12:20 ` Quan Zhou (周全) [this message]
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=48ad87ce5300a8c1570c5ec244f5b5773386538c.camel@mediatek.com \
--to=quan.zhou@mediatek.com \
--cc=Deren.Wu@mediatek.com \
--cc=Ryder.Lee@mediatek.com \
--cc=Sean.Wang@mediatek.com \
--cc=Shayne.Chen@mediatek.com \
--cc=hao.zhang@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=shengxi.xu@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 read-only IMAP folder(s) and NNTP newsgroup(s).