linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: Ryder Lee <ryder.lee@mediatek.com>,
	Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Cc: Roy Luo <royluo@google.com>,
	linux-wireless@vger.kernel.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	Shayne Chen <shayne.chen@mediatek.com>
Subject: Re: [PATCH 2/2] mt76: mt7615: add set_antenna callback
Date: Sun, 22 Dec 2019 15:13:20 +0100	[thread overview]
Message-ID: <a29cf0f3-6f7d-9fe5-8d5f-70712963366d@nbd.name> (raw)
In-Reply-To: <6b3ac6736c0cfa12492f383ec9cfcaad91bfb965.1576381077.git.ryder.lee@mediatek.com>

On 2019-12-15 04:56, Ryder Lee wrote:
> Add a set_antenna callback to setup per phy tx/rx streams.
> 
> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
>  .../net/wireless/mediatek/mt76/mt7615/main.c  | 30 +++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> index 759a66997c6f..70791544a088 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> @@ -48,6 +48,8 @@ static int mt7615_start(struct ieee80211_hw *hw)
>  		mt7615_mcu_set_mac_enable(dev, 1, true);
>  	}
>  
> +	mt7615_mcu_set_chan_info(phy, MCU_EXT_CMD_SET_RX_PATH);
> +
>  	set_bit(MT76_STATE_RUNNING, &phy->mt76->state);
>  
>  	if (running)
This chunk needs to be moved to the first patch to avoid creating a
regression.

> @@ -635,6 +637,33 @@ mt7615_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
>  	mt7615_mac_set_timing(phy);
>  }
>  
> +static int
> +mt7615_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
> +{
> +	struct mt7615_dev *dev = mt7615_hw_dev(hw);
> +	struct mt7615_phy *phy = mt7615_hw_phy(hw);
> +	int max_nss = hweight8(hw->wiphy->available_antennas_tx);
> +	bool ext_phy = phy != &dev->phy;
> +
> +	if (!tx_ant || tx_ant != rx_ant || ffs(tx_ant) > max_nss)
> +		return -EINVAL;
> +
> +	if ((BIT(hweight8(tx_ant)) - 1) != tx_ant)
> +		tx_ant = BIT(ffs(tx_ant) - 1) - 1;
> +
> +	mutex_lock(&dev->mt76.mutex);
> +
> +	phy->mt76->antenna_mask = tx_ant;
> +	phy->chainmask = ext_phy ? tx_ant << 2 : tx_ant;
> +
> +	mt76_set_stream_caps(&dev->mt76, true);
> +	mt7615_mcu_set_chan_info(phy, MCU_EXT_CMD_SET_RX_PATH);
This call is unnecessary, because antenna settings can only be changed
when the device is not running.

- Felix

      reply	other threads:[~2019-12-22 14:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-15  3:56 [PATCH 1/2] mt76: mt7615: rework set_channel function Ryder Lee
2019-12-15  3:56 ` [PATCH 2/2] mt76: mt7615: add set_antenna callback Ryder Lee
2019-12-22 14:13   ` Felix Fietkau [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=a29cf0f3-6f7d-9fe5-8d5f-70712963366d@nbd.name \
    --to=nbd@nbd.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=royluo@google.com \
    --cc=ryder.lee@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).