Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2745294ybi; Sun, 26 May 2019 07:06:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOrtPtirT6tTWsNl8lb5quT4iDrwZZ72V+0zdkMHVqOZjMm5JtP08Wai0BJCll/Qhjkn+D X-Received: by 2002:a17:902:2d:: with SMTP id 42mr122652989pla.34.1558879569223; Sun, 26 May 2019 07:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558879569; cv=none; d=google.com; s=arc-20160816; b=X1AbpbZgf/+bOS4GihgYGah6gqHv6IClprPDi/qEuriCPqK36DAodYXrtg0sMM/g1f d982YcDGQAbD6Z6ksCbNw1GhgZeaEqlgA0wsT6Fft8Gpql0H/OvFvSjYX7k+ASXhK1GV oTrPSbeF5Tt2HINl3hXAd8ofQ5EpY9VE1uCwPW/dnhothHlJHgebKXfjVZlrwDn4QUDy xBzgiZYxHv7yNPurnncY1LNaFE/1cP9uLQmt9LKgH9EGfGe9z09G8eR6wIco8Ksn03aM 6DkCoYj4LAF3dFJLBPwiMwEjpLmpL6RAvLjFUNnBBw6zWlI3PSDYGou3afuC8RzlkY6w kI2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=81y6JIeJo3CN1istXhYsmubRetks8+AwK293r0ZQCC8=; b=C7wzNXgxle5rH/HWyrGHV9BEJ3S0vtcQqfa39MJzlNdC2/xO//r/C94WAmpOfQTSoL WXPNbiZHa5x6InkS+6fnbMR7HZ9xPp25++G0ApLiQGQV6YWmP6p04sy9oM8rchKjqdqR mRrdVa0z+Zxg8zDJb3lxtz8ou66jr0PCmlD+MZCLgoPmtoYeezo8dMiKrq4ym+Pryo3d Xea5DiG/7+hPHLHH3pyulaeZtjLs4s+pCE8boWOaLBs4JSPnS8MFxIgUyt0vt5P0CT61 Z/14gj7D9euGTbuj1kPpj0nlAjYtE419P0ENaF893Z7aJufIvzkiLzJtBH/rxn1rozw1 /Svg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TdB+bNC2; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k24si14191764pfk.195.2019.05.26.07.05.45; Sun, 26 May 2019 07:06:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TdB+bNC2; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727818AbfEZOFc (ORCPT + 99 others); Sun, 26 May 2019 10:05:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:33930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727767AbfEZOFc (ORCPT ); Sun, 26 May 2019 10:05:32 -0400 Received: from lore-desk-wlan.lan (unknown [151.66.36.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CEF5B2085A; Sun, 26 May 2019 14:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558879532; bh=MDHJhHzMw7bEpHnOFH/Eoypul4YQM7NGfu76/SLURg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TdB+bNC2ebgIshh8tv55v+0qeb/H+OXJE6jDCk8/cquDBZHLNhUurwVUt+LGWRUGh AOKZlY/X+ISpU8AkQkdcU5UA/1ZAsePOkbcnuKUw/2xGioyUNoS1xjcdx42FVN3Qlc 9beuJsTM26rME8TNuUT/7miKRookxr84jvMfOb+E= From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org, ryder.lee@mediatek.com, royluo@google.com Subject: [PATCH 1/4] mt76: generalize mt76_get_txpower for 4x4:4 devices Date: Sun, 26 May 2019 16:05:10 +0200 Message-Id: X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Genralize mt76_get_txpower routine for 4x4:4 capable devices in order to be reused in mt7615 driver Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mac80211.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index e70507a4b14d..f9e83971902e 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -766,10 +766,21 @@ int mt76_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, *dbm = DIV_ROUND_UP(dev->txpower_cur, 2); /* convert from per-chain power to combined - * output on 2x2 devices + * output power */ - if (n_chains > 1) + switch (n_chains) { + case 4: + *dbm += 6; + break; + case 3: + *dbm += 4; + break; + case 2: *dbm += 3; + break; + default: + break; + } return 0; } -- 2.21.0