Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2658606ybt; Tue, 16 Jun 2020 11:31:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0O9FjF9Ynhy3Uz9vfbix1tV84HytDZI09tZP0736IWpjKJApBlksFtNHGsv8c23grs2Do X-Received: by 2002:a17:906:4ada:: with SMTP id u26mr4247959ejt.368.1592332296947; Tue, 16 Jun 2020 11:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592332296; cv=none; d=google.com; s=arc-20160816; b=FIk5ZC5z0GvzPavrDpS09nzxHMn742Bw/iDexra8FceJ42Uvwas+DhgDVpe+D9Nsa2 DosI90L61q+1VDMcTiJ0GQZ3/Nfdiqx1xttr/6O8NyLYMqpZhHA5v79Qf8pzlWe8FnCO gV/5NkmE7xvThpll6YpJUVIWq8EmWojJjUaU8czq2oTpJOLRAMVfeB4PQAOtWsc0IxgK oGFSJqrXWpinD9eVLYgpZA+zCGqwPt/usRUPqnDmrZLTpeO5lecLdpASSBc7qu5F/4zV mOlfbvDRfFWu5t5iOstEAPe5a/KAwkf8B/d8igkU3h4R7hkVQKnpIiKzwKR2+lswcI7u I4bQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=C6fAYcaiQIpVTe71DHEgip3+//5em+XqQgl4agyLyjQ=; b=Z9Eg6wVBtpql354Ya5FRMz0gcg40R7A/WmuOn1bJXJZ/QeJisREe5Tvvl+DYwYv3L2 0Bq5laIplgsrabZS/kXT8WMftcfNAXJLQkICJ5D4U57KvoIxzERkSJ7r39+yZE7xD67x WDVbzMzEn5lKq3y0W5fJjOVenvIEtjib05D7S84GbOohMSko3NbCEGNn+SGBZh63ZE7l OIVJOMuBknPXlHkqeDH2NhGynoPxSu1zvUDZAsfWzJQryZAPg/G3CcM/ZTRVTtg0Ulhx TiMDGo7JHY/LInATtnRJOxN6fwk5t4IGGPsvxXvDUJZmBxBR0+PrAlbTksANOobxvvq8 n+9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=AynvihS3; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u21si11018103edx.269.2020.06.16.11.31.01; Tue, 16 Jun 2020 11:31:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=AynvihS3; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728271AbgFPS2c (ORCPT + 99 others); Tue, 16 Jun 2020 14:28:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727114AbgFPS2b (ORCPT ); Tue, 16 Jun 2020 14:28:31 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1339C061573 for ; Tue, 16 Jun 2020 11:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=C6fAYcaiQIpVTe71DHEgip3+//5em+XqQgl4agyLyjQ=; b=AynvihS3HJxYHnu0j3ja0KMhTl +L42BQrgxgWFbfpe/Hdchu8OxpXBtNoUS+IfBrSr9oOtQ8oSMKedeF20kFxkA5oaRyemCOkOZvYhJ MhvBZRfrarykXxylW0a0FDvWIdBpqVhG5Bm7vjDGyyH5PfyisPgDaRSuHzadom3IEa6U=; Received: from p54ae948c.dip0.t-ipconnect.de ([84.174.148.140] helo=nf.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1jlGJr-00054q-Pw; Tue, 16 Jun 2020 20:28:23 +0200 Subject: Re: [PATCH 3/4] mt76: mt7915: add support for DT rate power limits To: Shayne Chen Cc: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , linux-mediatek References: <9ae2b6233284b60206e3513f7bf2eb03d2fbd724.1592276165.git.ryder.lee@mediatek.com> <279b29408c742c4b043e7af11217dcd5eeb7b8c2.1592276165.git.ryder.lee@mediatek.com> From: Felix Fietkau Autocrypt: addr=nbd@nbd.name; prefer-encrypt=mutual; keydata= xsDiBEah5CcRBADIY7pu4LIv3jBlyQ/2u87iIZGe6f0f8pyB4UjzfJNXhJb8JylYYRzIOSxh ExKsdLCnJqsG1PY1mqTtoG8sONpwsHr2oJ4itjcGHfn5NJSUGTbtbbxLro13tHkGFCoCr4Z5 Pv+XRgiANSpYlIigiMbOkide6wbggQK32tC20QxUIwCg4k6dtV/4kwEeiOUfErq00TVqIiEE AKcUi4taOuh/PQWx/Ujjl/P1LfJXqLKRPa8PwD4j2yjoc9l+7LptSxJThL9KSu6gtXQjcoR2 vCK0OeYJhgO4kYMI78h1TSaxmtImEAnjFPYJYVsxrhay92jisYc7z5R/76AaELfF6RCjjGeP wdalulG+erWju710Bif7E1yjYVWeA/9Wd1lsOmx6uwwYgNqoFtcAunD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eRGAAn1ee RjMaxwtSdaCKMw3j33ZbsWS4 Message-ID: <779faac5-5922-80e6-299d-769e795ea419@nbd.name> Date: Tue, 16 Jun 2020 20:28:23 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <279b29408c742c4b043e7af11217dcd5eeb7b8c2.1592276165.git.ryder.lee@mediatek.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2020-06-16 14:46, Shayne Chen wrote: > Add support to limit per-rate max txpower from DT. > > Tested-by: Evelyn Tsai > Signed-off-by: Shayne Chen > --- > .../wireless/mediatek/mt76/mt7915/eeprom.h | 2 +- > .../net/wireless/mediatek/mt76/mt7915/mcu.c | 38 +++++++++++++++++-- > 2 files changed, 35 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h > index 4e31d6ab4fa6..284de8b4e0a4 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h > +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.h > @@ -120,6 +120,6 @@ mt7915_tssi_enabled(struct mt7915_dev *dev, enum nl80211_band band) > return eep[MT_EE_WIFI_CONF + 7] & MT_EE_WIFI_CONF_TSSI0_2G; > } > > -extern const struct sku_group mt7915_sku_groups[]; > +extern const struct sku_group mt7915_sku_groups[MAX_SKU_RATE_GROUP_NUM]; > > #endif > diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c > index 349163d0b7f2..c5e9893cbd87 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c > @@ -3171,15 +3171,45 @@ int mt7915_mcu_set_sku(struct mt7915_phy *phy) > .format_id = 4, > .dbdc_idx = phy != &dev->phy, > }; > - int i; > - s8 *delta; > + struct mt76_power_limits limits_array; > + s8 *delta, *la = (s8 *)&limits_array; > + int i, idx; > > delta = dev->rate_power[mphy->chandef.chan->band]; > mphy->txpower_cur = hw->conf.power_level * 2 + > delta[MT7915_SKU_MAX_DELTA_IDX]; I think the delta needs to be subtracted instead of added here. > - for (i = 0; i < MT7915_SKU_RATE_NUM; i++) > - req.val[i] = hw->conf.power_level * 2 + delta[i]; > + mt76_get_rate_power_limits(mphy, mphy->chandef.chan, > + &limits_array, mphy->txpower_cur); This should set mphy->txpower_cur to the return code of mt76_get_rate_power_limits. The nss delta is added in the core mt76 code before reporting to user space. - Felix