From patchwork Sat Feb 24 15:54:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10240417 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BC748602A0 for ; Sat, 24 Feb 2018 15:54:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB6C029BBA for ; Sat, 24 Feb 2018 15:54:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A04BB29BC9; Sat, 24 Feb 2018 15:54:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47D8029BBA for ; Sat, 24 Feb 2018 15:54:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751463AbeBXPyZ (ORCPT ); Sat, 24 Feb 2018 10:54:25 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:32848 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751131AbeBXPyY (ORCPT ); Sat, 24 Feb 2018 10:54:24 -0500 Received: by mail-wr0-f196.google.com with SMTP id s5so16976600wra.0 for ; Sat, 24 Feb 2018 07:54:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oNXo0/U5fZLH02sEkBxuZ2eC9+OsEZVh9lqOskzqEDs=; b=euOyVjM3ZJI/luYAtuKPsUv3DbACKjwwo5oo/5y65bVXcIV+hKpaY56yXiX+1IxWbS rR7Ge1QvzBvLQItLngrOTIq+4Aox8tZ2l4SHldk/L54O5b18bgPsZO5WXWG9F4u/gSN5 GsFhDyw+eja5go7bm5+OSFRfubhaEOfx6PRrQ0lrzAgZgm53HtZ9qGyUBrUFnm+BYprj IG4XGVjPmnyogYc5/ghtAjNH27xpxINY5IcNLl8LRdLZiIcR0fdfY3DvwDMFnnowEl9s gpqXcO40sczhPn+Ns/N7X+SA3NIzdUpFl09lQQW+2nGcYOsPhsBTQqrBiOvAdpKVlSmn BXVg== X-Gm-Message-State: APf1xPD5RtUpa8H8WExN85Bkx6xCnXTRSmEZEBoR6p4KmiQw0nQlitwP 350ZUbrTm2yXJEtACwVGb8o/y1nNFz+BWw== X-Google-Smtp-Source: AH8x226Z54ZxJ5eUO4zz0tGOSENP9XVESWjctAU9uzzng0d9QKYK7/8qfnRCQgcvDlkkVWFIXbSaJA== X-Received: by 10.223.128.227 with SMTP id 90mr5083588wrl.50.1519487663519; Sat, 24 Feb 2018 07:54:23 -0800 (PST) Received: from localhost.localdomain ([151.66.2.62]) by smtp.gmail.com with ESMTPSA id o204sm4307297wma.1.2018.02.24.07.54.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Feb 2018 07:54:22 -0800 (PST) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org Subject: [PATCH 1/3] mt76: initialize available_antennas_{tx,rx} info Date: Sat, 24 Feb 2018 16:54:12 +0100 Message-Id: <20180224155414.31063-2-lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.16.2 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Initialize available_antennas related info in wiphy data structure according to antenna_mask field; antenna_mask info is initialized in device specific code and will be used in mac80211 {set,get}_antenna callbacks Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mac80211.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt76.h | 2 ++ drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 85f8d324ebf8..ec94b86a37fd 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -262,6 +262,9 @@ int mt76_register_device(struct mt76_dev *dev, bool vht, wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR; + wiphy->available_antennas_tx = dev->antenna_mask; + wiphy->available_antennas_rx = dev->antenna_mask; + hw->txq_data_size = sizeof(struct mt76_txq); hw->max_tx_fragments = 16; diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index d2ce15093edd..15009d5b0531 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -253,6 +253,8 @@ struct mt76_dev { u32 rev; unsigned long state; + u8 antenna_mask; + struct mt76_sband sband_2g; struct mt76_sband sband_5g; struct debugfs_blob_wrapper eeprom; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c index 9dbf94947324..934c331d995e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_init.c @@ -857,6 +857,9 @@ int mt76x2_register_device(struct mt76x2_dev *dev) dev->mt76.led_cdev.brightness_set = mt76x2_led_set_brightness; dev->mt76.led_cdev.blink_set = mt76x2_led_set_blink; + /* init antenna configuration */ + dev->mt76.antenna_mask = 3; + ret = mt76_register_device(&dev->mt76, true, mt76x2_rates, ARRAY_SIZE(mt76x2_rates)); if (ret)