Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp257460ybt; Fri, 19 Jun 2020 00:56:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjXD2EgMqlNJhnzoYUSq6ApY/tmWmNIv8hdANBQyzx5HYsYlC19bksyB5FcrFuoTOHz9S0 X-Received: by 2002:a50:fa8d:: with SMTP id w13mr2051895edr.324.1592553400402; Fri, 19 Jun 2020 00:56:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592553400; cv=none; d=google.com; s=arc-20160816; b=MIkiTY5Tr+ulM4WTQluiT42/Ww68Ok0d1omZCvmy3XO50cKJO6raG8fKRI4QAYc95g VcTX+YYhXOPYaHVYvFhcuQKrUcoBxpET012FaLI3YCp6lxLtotW5Osh744x1vjVQBcpv YL3o1bnTMcYHGvhCBxAqNu3LvlcCOQgH86s+fb9CZ7z6LJVUKoYYZwWjO+yYFuJN/UYK +KSVW6ymrgahg4OeeS926Ej/3dyBEs17zCSInOqYbHFqR9HxcjSdxIEBj11ivrfZpJmW gNJFyqWT6wlVdw/hPG5hf3jvfsPcWQFg7wn+8yiESb4wwE9W9f+1UDYESG+o0/jGhHmm 6Gfg== 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=yCScZm5hGSqIDtxe5yip9trAR0uBsbBaiWT93V5VXyU=; b=mkCni5MrwRhdAPc2RCLLIKyxlwfs8c2wgZYwNMdwXLffGT951efvdFXgS/vlgluX8y nQYu/MqvEVIdQynpo0GdbNVnbbP5mKOhBZcwkH0NVvEySqIlCCOt3T3/G1y4lyn4caLJ eE9UyvRukQpXaWTL6zoMCUitIVKTwPVtCfJEhaDeTdTRbrr+8LU9TmzwGXD9RwcWdmfJ 6gXYKCQ9VHdaWTnDU3/2Utng6Kc27june8HS+dlrOFDnSMM2/LHtuqmGHREGFx8joR92 aGA4RJmvD6sqdl7pI4a66xrgUExVWc/boY0J0JIdnoNcp7tJFL0cizKCenc9Ao7ujHPj Q1Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=DUlcUq6d; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn11si3380412edb.170.2020.06.19.00.56.16; Fri, 19 Jun 2020 00:56:40 -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=pass header.i=@mediatek.com header.s=dk header.b=DUlcUq6d; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730921AbgFSHy4 (ORCPT + 99 others); Fri, 19 Jun 2020 03:54:56 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:24029 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730912AbgFSHy4 (ORCPT ); Fri, 19 Jun 2020 03:54:56 -0400 X-UUID: 370b5ad9e8f34137a091234fe470e0f1-20200619 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=yCScZm5hGSqIDtxe5yip9trAR0uBsbBaiWT93V5VXyU=; b=DUlcUq6dkWgzgOu0d1NcPLTxQgzl9cVaV/nJ0ew+COQZEQuyHAff/zNXfaUJabmDaLbmDcXFd1J/vrb1/2kV9GqQBSO/X5ZKlgoLdG39ZFVyJTZjJFmanwZmwaypMmmyFSMlF8HkQfitT0XuSax6242rG5ur38AyOKmMj7kKYb8=; X-UUID: 370b5ad9e8f34137a091234fe470e0f1-20200619 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 555669094; Fri, 19 Jun 2020 15:54:51 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 19 Jun 2020 15:54:49 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 19 Jun 2020 15:54:50 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , linux-mediatek , Shayne Chen Subject: [PATCH v2 3/3] mt76: mt7915: directly read per-rate tx power from registers Date: Fri, 19 Jun 2020 15:53:56 +0800 Message-ID: <20200619075356.21998-3-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200619075356.21998-1-shayne.chen@mediatek.com> References: <20200619075356.21998-1-shayne.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: BB28C464EF00E83DA12DC58DAD21739E824790DA141DC73D3EDFABE8294393302000:8 X-MTK: N Content-Transfer-Encoding: base64 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org SW4gdGhlIHByZXZpb3VzIHZlcnNpb24sIHRoZSB2YWx1ZXMgb2YgcGVyLXJhdGUgdHggcG93ZXIg YXJlIGNhbGN1bGF0ZWQNCmZyb20gU1cgc2lkZSw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