Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp621973ybp; Wed, 9 Oct 2019 01:21:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVerUPVZQDLUJrjWLmuuiiVhMFLxb26/8W35gOvWeShy5kXuRuJUzuQG6DItXEo+KRZRr6 X-Received: by 2002:a17:906:cd11:: with SMTP id oz17mr1611755ejb.71.1570609272347; Wed, 09 Oct 2019 01:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570609272; cv=none; d=google.com; s=arc-20160816; b=Avw0l7I93RYVgCS1mTpQwPy2pvdqAiZ+US4UxUsMOY+9XZFMvifXe8gCJ5iYdojXwC ppq/vSyAY1p24Rh8gKmhf4aHWh0NZqu4pSIaDT6NbUA2Ebp6FAsahwubCJQak8nVMhUG R0K93dvr6aLrXrlwsTIW0bFolR26lxqDB2nQUnzwq9nkEUVf2Gd055kppkNQJXJCC7jn SaZGKFr3EUgJWth8Vd0CDtdvx9+CoqGQAp72P6KNTI8pYLxuJ1xrfemrL00Vx58+8KxP RPrtzr4ZBav+ecQSIjOnCnArTSh3iZfwhcms2gdQlYifvFKEqlmoz3Cu0P3tCYd3VcM0 r1QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dmarc-filter :dkim-signature:dkim-signature; bh=5PXNseSVv79D2/9MEF/U/PTvzamVa/Re+fWzUvHH+aY=; b=G2+YNpIWCEmaI2beHoO6b9ADclZtQFzzmR/xye4pH9x7JcM0m8ccM5QEdagU5AarB7 r/Bol5G1n5oJnmKpn/2N+1AwNGfXk2m41MCQoD+7nqh3KNO78GFi5RNPeA0Vwn0xyBEi o2pB2/L0cxKaGV1vjm7bU6MMHbKiYOn4XFj7HYmxWK441oQu5/4076ATMXFllNiy1Cvy ObFf9eJA5cXzev8po+coXzoMRryV0OVgszSHYkYpfvRf4xmF/ISUJeXbn9cwwkKweguA V5Us2MXgUdRtdYFJIF96+0nKrMXmD3CYcO/o9mRcIDJyW5eWMWDndPLGuimpwAfnCjjh jt0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=mzog6kXR; dkim=pass header.i=@codeaurora.org header.s=default header.b=WVxSZ0Jh; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w26si896391edd.305.2019.10.09.01.20.48; Wed, 09 Oct 2019 01:21:12 -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=@codeaurora.org header.s=default header.b=mzog6kXR; dkim=pass header.i=@codeaurora.org header.s=default header.b=WVxSZ0Jh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726734AbfJIISD (ORCPT + 99 others); Wed, 9 Oct 2019 04:18:03 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50810 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbfJIISD (ORCPT ); Wed, 9 Oct 2019 04:18:03 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 852DC61AE2; Wed, 9 Oct 2019 08:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1570609081; bh=v7/qoxEYUqSqeBHpUrY9F8NJZnv7GOuopmgaO3pONlo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=mzog6kXRYTP/ilZSvKnaSZmhGdQplWtOELiWI+zU7gSCmiGIjUZl7IUaoCLxkwOlX l2yZgkSfNHRwbLiBwr35o5mPJ6Zth9Xoi7njOPc/OQdqLZWTB9ZFPf0j65Cmi2QTTm tJJ1ghakFXS8dyO/W6ojk7XqpwTrx/tUc9ZU5dkQ= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from tynnyri.adurom.net (tynnyri.adurom.net [51.15.11.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kvalo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B3EC061AD9; Wed, 9 Oct 2019 08:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1570609079; bh=v7/qoxEYUqSqeBHpUrY9F8NJZnv7GOuopmgaO3pONlo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=WVxSZ0Jhj1n1NkbltnDvRGkokZepLSX8lfjy+vTqXbARV+6ZIJ9FjYXSmcnIWjjBz atvOJQWpDOgA2NKfyPFPYLVbH66MYvTcZAtJfmlDeCat8t2d3YsFu5K5tTtIoravTf +zQLlqR45/xVTYhDmiahwCjcCgZSTuhgRIBI0soU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B3EC061AD9 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=kvalo@codeaurora.org From: Kalle Valo To: Cc: , Subject: Re: [PATCH 01/10] rtw88: add power tracking support References: <20191008082101.2494-1-yhchuang@realtek.com> <20191008082101.2494-2-yhchuang@realtek.com> Date: Wed, 09 Oct 2019 11:17:55 +0300 In-Reply-To: <20191008082101.2494-2-yhchuang@realtek.com> (yhchuang's message of "Tue, 8 Oct 2019 16:20:52 +0800") Message-ID: <87lftugwng.fsf@tynnyri.adurom.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org writes: > From: Tzu-En Huang > > The temperature of the chip can affect the output power > of the RF components. Hence driver requires to compensate > the power by adjusting the power index recorded in the > power swing table. > > And if the difference of current thermal value to the > default thermal value exceeds a threshold, the RF IQK > should be triggered to re-calibrate the characteristics > of the RF components, to keep the output IQ vectors of > the RF components orthogonal enough. > > Signed-off-by: Tzu-En Huang > Signed-off-by: Yan-Hsuan Chuang [...] > +/* This table stores the values of TX power that will be adjusted by power > + * tracking. > + * > + * For 5G bands, there are 3 different settings. > + * For 2G there are cck rate and ofdm rate with different settings. > + */ > +struct rtw_pwr_track_tbl { > + const u8 *pwrtrk_5gb_n[RTW_PWRTRACK_5G_BAND_SIZE]; > + const u8 *pwrtrk_5gb_p[RTW_PWRTRACK_5G_BAND_SIZE]; > + const u8 *pwrtrk_5ga_n[RTW_PWRTRACK_5G_BAND_SIZE]; > + const u8 *pwrtrk_5ga_p[RTW_PWRTRACK_5G_BAND_SIZE]; > + const u8 *pwrtrk_2gb_n; > + const u8 *pwrtrk_2gb_p; > + const u8 *pwrtrk_2ga_n; > + const u8 *pwrtrk_2ga_p; > + const u8 *pwrtrk_2g_cckb_n; > + const u8 *pwrtrk_2g_cckb_p; > + const u8 *pwrtrk_2g_ccka_n; > + const u8 *pwrtrk_2g_ccka_p; > +}; [...] > +void rtw_phy_config_swing_table(struct rtw_dev *rtwdev, > + struct rtw_swing_table *swing_table) > +{ > + const struct rtw_pwr_track_tbl *tbl = rtwdev->chip->pwr_track_tbl; > + u8 channel = rtwdev->hal.current_channel; > + > + if (channel >= 1 && channel <= 14) { > + if (rtwdev->dm_info.tx_rate <= DESC_RATE11M) { > + swing_table->tup[0] = (u8 *)tbl->pwrtrk_2g_ccka_p; > + swing_table->tdown[0] = (u8 *)tbl->pwrtrk_2g_ccka_n; > + swing_table->tup[1] = (u8 *)tbl->pwrtrk_2g_cckb_p; > + swing_table->tdown[1] = (u8 *)tbl->pwrtrk_2g_cckb_n; > + } else { > + swing_table->tup[0] = (u8 *)tbl->pwrtrk_2ga_p; > + swing_table->tdown[0] = (u8 *)tbl->pwrtrk_2ga_n; > + swing_table->tup[1] = (u8 *)tbl->pwrtrk_2gb_p; > + swing_table->tdown[1] = (u8 *)tbl->pwrtrk_2gb_n; > + } This is ugly and immeadiately caught my attention, don't cast away the const. It's const for a reason and if you cast it away you most likely you create a bug somewhere. It's better to avoid casting as much as possible as they get abused so easily. I stopped reviewing here, will continue later. -- https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches