From: Ping-Ke Shih <pkshih@realtek.com>
To: Allan Wang <allan.wang@mediatek.com>,
"nbd@nbd.name" <nbd@nbd.name>,
"lorenzo@kernel.org" <lorenzo@kernel.org>
Cc: "deren.wu@mediatek.com" <deren.wu@mediatek.com>,
"mingyen.hsieh@mediatek.com" <mingyen.hsieh@mediatek.com>,
"Sean.Wang@mediatek.com" <Sean.Wang@mediatek.com>,
"Soul.Huang@mediatek.com" <Soul.Huang@mediatek.com>,
"Leon.Yen@mediatek.com" <Leon.Yen@mediatek.com>,
"Michael.Lo@mediatek.com" <Michael.Lo@mediatek.com>,
"Eric-SY.Chang@mediatek.com" <Eric-SY.Chang@mediatek.com>,
"km.lin@mediatek.com" <km.lin@mediatek.com>,
"robin.chiu@mediatek.com" <robin.chiu@mediatek.com>,
"ch.yeh@mediatek.com" <ch.yeh@mediatek.com>,
"posh.sun@mediatek.com" <posh.sun@mediatek.com>,
"Quan.Zhou@mediatek.com" <Quan.Zhou@mediatek.com>,
"Ryder.Lee@mediatek.com" <Ryder.Lee@mediatek.com>,
"Shayne.Chen@mediatek.com" <Shayne.Chen@mediatek.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>
Subject: RE: [PATCH] wifi: mt76: mt7925: add rfkill_poll for hardware rfkill
Date: Mon, 5 May 2025 09:32:19 +0000 [thread overview]
Message-ID: <794916dfd01545579d2fe7f523b5b29a@realtek.com> (raw)
In-Reply-To: <20250505073734.3923790-1-allan.wang@mediatek.com>
Allan Wang <allan.wang@mediatek.com> wrote:
[...]
> @@ -2205,6 +2208,18 @@ static void mt7925_unassign_vif_chanctx(struct ieee80211_hw *hw,
> mutex_unlock(&dev->mt76.mutex);
> }
>
> +static void mt7925_rfkill_poll(struct ieee80211_hw *hw)
> +{
> + struct mt792x_phy *phy = mt792x_hw_phy(hw);
> + int ret = 0;
no need initializer.
> +
> + mt792x_mutex_acquire(phy->dev);
> + ret = mt7925_mcu_wf_rf_pin_ctrl(phy);
> + mt792x_mutex_release(phy->dev);
> +
> + wiphy_rfkill_set_hw_state(hw->wiphy, ret ? false : true);
wiphy_rfkill_set_hw_state(hw->wiphy, ret == 0);
or
wiphy_rfkill_set_hw_state(hw->wiphy, !ret);
> +}
> +
> const struct ieee80211_ops mt7925_ops = {
> .tx = mt792x_tx,
> .start = mt7925_start,
> @@ -2265,6 +2280,7 @@ const struct ieee80211_ops mt7925_ops = {
> .link_info_changed = mt7925_link_info_changed,
> .change_vif_links = mt7925_change_vif_links,
> .change_sta_links = mt7925_change_sta_links,
> + .rfkill_poll = mt7925_rfkill_poll,
> };
> EXPORT_SYMBOL_GPL(mt7925_ops);
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> index 286f602623c0..31fa092d2c8c 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> @@ -3633,6 +3633,45 @@ int mt7925_mcu_set_rate_txpower(struct mt76_phy *phy)
> return 0;
> }
>
> +int mt7925_mcu_wf_rf_pin_ctrl(struct mt792x_phy *phy)
> +{
> +#define UNI_CMD_RADIO_STATUS_GET 0
> + struct mt792x_dev *dev = phy->dev;
> + struct sk_buff *skb;
> + int ret;
> +
Should avoid empty line in declarations?
> + struct {
> + __le16 tag;
> + __le16 len;
> + u8 rsv[4];
> + } __packed req = {
> + .tag = UNI_CMD_RADIO_STATUS_GET,
> + .len = cpu_to_le16(sizeof(req)),
> + };
> +
> + struct mt7925_radio_status_event {
> + __le16 tag;
> + __le16 len;
> +
> + u8 data;
> + u8 rsv[3];
> + } __packed * status;
I remember this should be "__packed *status", but checkpatch reports
false-alarm.
> +
> + ret = mt76_mcu_send_and_get_msg(&dev->mt76,
> + MCU_UNI_CMD(RADIO_STATUS),
> + &req, sizeof(req), true, &skb);
> + if (ret)
> + return ret;
> +
> + skb_pull(skb, sizeof(struct tlv));
> + status = (struct mt7925_radio_status_event *)skb->data;
> + ret = (int)status->data;
I feel int casting is unnecessary.
> +
> + dev_kfree_skb(skb);
> +
> + return ret;
> +}
> +
> int mt7925_mcu_set_rxfilter(struct mt792x_dev *dev, u32 fif,
> u8 bit_op, u32 bit_map)
> {
[...]
prev parent reply other threads:[~2025-05-05 9:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-05 7:37 [PATCH] wifi: mt76: mt7925: add rfkill_poll for hardware rfkill Allan Wang
2025-05-05 9:32 ` Ping-Ke Shih [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=794916dfd01545579d2fe7f523b5b29a@realtek.com \
--to=pkshih@realtek.com \
--cc=Eric-SY.Chang@mediatek.com \
--cc=Leon.Yen@mediatek.com \
--cc=Michael.Lo@mediatek.com \
--cc=Quan.Zhou@mediatek.com \
--cc=Ryder.Lee@mediatek.com \
--cc=Sean.Wang@mediatek.com \
--cc=Shayne.Chen@mediatek.com \
--cc=Soul.Huang@mediatek.com \
--cc=allan.wang@mediatek.com \
--cc=ch.yeh@mediatek.com \
--cc=deren.wu@mediatek.com \
--cc=km.lin@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=mingyen.hsieh@mediatek.com \
--cc=nbd@nbd.name \
--cc=posh.sun@mediatek.com \
--cc=robin.chiu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.