From patchwork Thu Sep 20 09:11:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10607167 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-2.web.codeaurora.org (Postfix) with ESMTP id A82CF1390 for ; Thu, 20 Sep 2018 09:12:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 981DC2CC13 for ; Thu, 20 Sep 2018 09:12:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A5642CC26; Thu, 20 Sep 2018 09:12:29 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 EEFB82CC21 for ; Thu, 20 Sep 2018 09:12:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387428AbeITOy4 (ORCPT ); Thu, 20 Sep 2018 10:54:56 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46105 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731678AbeITOyz (ORCPT ); Thu, 20 Sep 2018 10:54:55 -0400 Received: by mail-wr1-f68.google.com with SMTP id a108-v6so8565833wrc.13 for ; Thu, 20 Sep 2018 02:12:26 -0700 (PDT) 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:in-reply-to :references; bh=Nx/oFJUqavrXoksHdEJWvyNDiQ0daeQdzoA/Hbd2oZo=; b=Cu+O7X5DR63Vhm3NYjeIA031XpCuMFqzPXPSbm1JscZIyShUo+UlIjOCxFBFxd4wKC iLtN77WOXmTZqvYzX+/KwoIwmRXWr+UKokoyG6+nCNOKYxoXYx3KUoD5Lq8RDQUTPYUv ojGy3K81RuuyUxbdzIO37Zn5JbrLMYgQTlvk9zmNyVOE/w2waqWqCO4n7DhvJ1lXvHKs Hw6BCGeSR+0AIEUxs47ERMn0qUloT87r0X6nHKkzWGZyypHVkMN/qrHeql4sUis0zWli r4BGoCkpptrHeGlbNFB6vuK0PSP+iwc3kumhb4pD6MJKv2qLMm8P80gdYIZjAw+M78Qy 5u7w== X-Gm-Message-State: APzg51D3xBl4grlux4ltcVtClFkXA0XeOgN9ZJs98p8mz7VEUZZCFQ9/ zZAUun0J8wwC7CwKxKhqwUkevw== X-Google-Smtp-Source: ANB0VdboOXKqdKuQcoiow54OZfeDcUZXA/WThVMYKhtjqaLWPWIBesfk7E4sP+3O3xqyjJMO9PEGtQ== X-Received: by 2002:a5d:4990:: with SMTP id r16-v6mr32669229wrq.116.1537434745938; Thu, 20 Sep 2018 02:12:25 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-mxp-t.redhat.com. [149.6.153.186]) by smtp.gmail.com with ESMTPSA id 34-v6sm35501691wra.20.2018.09.20.02.12.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Sep 2018 02:12:25 -0700 (PDT) From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, sgruszka@redhat.com, linux-mediatek@lists.infradead.org Subject: [PATCH 02/20] mt76: add stbc entries to mt76_rate_power Date: Thu, 20 Sep 2018 11:11:49 +0200 Message-Id: <15d756db7fef57befcc2e2e28e640be10493df88.1537433365.git.lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: 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 From: Felix Fietkau Add stbc tx power eeprom parsing support for mt76x2 driver. Signed-off-by: Felix Fietkau Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76.h | 3 ++- drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c | 2 ++ drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c | 1 + drivers/net/wireless/mediatek/mt76/mt76x2_phy_common.c | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index b4980959efa7..9febace6ef23 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -423,10 +423,11 @@ struct mt76_rate_power { struct { s8 cck[4]; s8 ofdm[8]; + s8 stbc[8]; s8 ht[16]; s8 vht[10]; }; - s8 all[38]; + s8 all[46]; }; }; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c b/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c index 2cd0d8200a57..45f3439a6563 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_debugfs.c @@ -59,6 +59,8 @@ static int read_txpower(struct seq_file *file, void *data) ARRAY_SIZE(dev->rate_power.cck)); mt76_seq_puts_array(file, "OFDM", dev->rate_power.ofdm, ARRAY_SIZE(dev->rate_power.ofdm)); + mt76_seq_puts_array(file, "STBC", dev->rate_power.stbc, + ARRAY_SIZE(dev->rate_power.stbc)); mt76_seq_puts_array(file, "HT", dev->rate_power.ht, ARRAY_SIZE(dev->rate_power.ht)); mt76_seq_puts_array(file, "VHT", dev->rate_power.vht, diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c index 1753bcb36356..807bf46e0dd9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_eeprom.c @@ -461,6 +461,7 @@ void mt76x2_get_rate_power(struct mt76x2_dev *dev, struct mt76_rate_power *t, val = mt76x2_eeprom_get(dev, MT_EE_TX_POWER_HT_MCS4); t->ht[4] = t->ht[5] = mt76x2_rate_power_val(val); t->ht[6] = t->ht[7] = mt76x2_rate_power_val(val >> 8); + memcpy(t->stbc, t->ht, sizeof(t->stbc)); val = mt76x2_eeprom_get(dev, MT_EE_TX_POWER_HT_MCS8); t->ht[8] = t->ht[9] = mt76x2_rate_power_val(val); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_phy_common.c b/drivers/net/wireless/mediatek/mt76/mt76x2_phy_common.c index 3b704a70fad1..42ca855c7579 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2_phy_common.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2_phy_common.c @@ -227,9 +227,9 @@ void mt76x2_phy_set_txpower(struct mt76x2_dev *dev) mt76_wr(dev, MT_TX_PWR_CFG_2, mt76x2_tx_power_mask(t.ht[4], t.ht[6], t.ht[8], t.ht[10])); mt76_wr(dev, MT_TX_PWR_CFG_3, - mt76x2_tx_power_mask(t.ht[12], t.ht[14], t.ht[0], t.ht[2])); + mt76x2_tx_power_mask(t.ht[12], t.ht[14], t.stbc[0], t.stbc[2])); mt76_wr(dev, MT_TX_PWR_CFG_4, - mt76x2_tx_power_mask(t.ht[4], t.ht[6], 0, 0)); + mt76x2_tx_power_mask(t.stbc[4], t.stbc[6], 0, 0)); mt76_wr(dev, MT_TX_PWR_CFG_7, mt76x2_tx_power_mask(t.ofdm[6], t.vht[8], t.ht[6], t.vht[8])); mt76_wr(dev, MT_TX_PWR_CFG_8,