Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1619647rwd; Thu, 18 May 2023 14:54:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4PTK5np4PhjWEEVaSFuFQ3TuMEcsHVrrbqhB9jQe1PUkqIS4EAfh5odwbuXyoJ3D0F1CC1 X-Received: by 2002:a05:6a00:c8d:b0:63c:1be4:5086 with SMTP id a13-20020a056a000c8d00b0063c1be45086mr399792pfv.6.1684446852831; Thu, 18 May 2023 14:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684446852; cv=none; d=google.com; s=arc-20160816; b=04nfUG7S/d3hXcf/zlctwdFtRnm60c2dKCrNy27OULqsscsyYF1K0Q5IjLXarQW4l2 Bq8TCK3ISTzZsmhKC3RpEGEbpo7GL7bMB4JkVAKmGuLUot+7goypxS6k7gAFeoIaul1p hs3UQ9OOXcs0TdFGIMQWzYPzlrhWZrovOuUjQskoncLtF4FZMtP43KG3U7puMyMwNEej tpJIldi25LjKf+N9hwWeSauMalQWhYLkVseHKlWfuC/snIw+zvRGo7imyWs88vvCfhV6 nk/JBhlH4N2kZuCBxep3QZQcfA4ZcqyY+ooudOhWm/ofBpSEcMZOK688UuW4P6DU3djP Lphg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zG+zrlzP5mwE0M8Rhsv3OYmPcEMdq7DMJ8rJhDrtnAA=; b=i4Pr/HsV+7dvaEEGyv4n1fPQHSWyQG1MyhNKnIutPYGcy7kU2Jzi8NAsIm37+KnIOJ v7dBWRiaxj5if+4/RemMpW65lhw83DtC3XzkHaWQvYezBkJerkF8MTQuYP2Kkup6WETM 28fnNtxjfkdjeGaKFAuNX65hTLSpYNoOQTk1ylI4WkuNvYs9uP+7TrSRBfEkgk4ady9C Bd80n9dsuu0aEHOBHmsOlvZle3RboEA8rttvjQ924Q4/BbvWprGKScA/GSWMDOnoea76 jXzIQWtvnjRwMeOKfhOqVLvN9h/+kXC9y0Y8hXbSsc1y9tSsLC8/LSZE0xywbNCfgRcn a4pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N1LntZtY; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e1-20020aa798c1000000b006462cc07d9esi2708575pfm.300.2023.05.18.14.54.01; Thu, 18 May 2023 14:54:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=N1LntZtY; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230002AbjERVuY (ORCPT + 62 others); Thu, 18 May 2023 17:50:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230087AbjERVuX (ORCPT ); Thu, 18 May 2023 17:50:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 610ECE7A for ; Thu, 18 May 2023 14:50:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DAB1D65265 for ; Thu, 18 May 2023 21:50:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8B9DC433D2; Thu, 18 May 2023 21:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684446621; bh=d4QQ61ZSMghe8tSspFIwBhXqAKHIUixZPK8avoQLJWI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N1LntZtYFmae3HC1DnGr5+Ml1tYRaldtoj8Iv1vIJNakOirfHORp1ofTd2Vv53cxm o4Tm/UiZmWx+QvvjeAHxQ2wJk9LtXjplGt9Ow4N2ivapAtf1CNSVY+7wx+ZgoBGLhT k9GUrnOu+4UfFjU8n49lXMgvtsT5BRf17nKAeYm+1pYeK1kbPzkNIc+Ye3BYgyFMFX +iz971/OpM5WsEdy27ovn7NxRDhVKD08OAieMG5ZUjGbElHimNH23YHgNZIwQ8UwJA BuILusmxkTxmf22ueI9upLudeJAgMZK2z+VJ1QT0M/w27b/mNdfC1h/WeZkUNFwaKm X5MxsLlM/8L6g== Date: Thu, 18 May 2023 23:51:27 +0200 From: Lorenzo Bianconi To: Ben Greear Cc: linux-wireless@vger.kernel.org Subject: Re: [PATCH] wifi: mt76: mt7921: Support temp sensor. Message-ID: References: <20230518200718.1367381-1-greearb@candelatech.com> <43d01aa8-b594-2770-59d0-13e6388c5758@candelatech.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="C6NMl48XVxljFi9E" Content-Disposition: inline In-Reply-To: <43d01aa8-b594-2770-59d0-13e6388c5758@candelatech.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --C6NMl48XVxljFi9E Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > On 5/18/23 13:42, Lorenzo Bianconi wrote: > > > From: Ben Greear > > >=20 > > > Allow sensors tool to read radio's temperature, example: > > >=20 > > > mt7921_phy17-pci-1800 > > > Adapter: PCI adapter > > > temp1: +72.0=B0C > > >=20 > > > Signed-off-by: Ben Greear > > > --- > > > .../net/wireless/mediatek/mt76/mt7921/init.c | 53 ++++++++++++++++= +++ > > > .../net/wireless/mediatek/mt76/mt7921/mcu.c | 17 ++++++ > > > .../wireless/mediatek/mt76/mt7921/mt7921.h | 1 + > > > 3 files changed, 71 insertions(+) > > >=20 > > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drive= rs/net/wireless/mediatek/mt76/mt7921/init.c > > > index c15ce1a19000..18f0f2dfbbcf 100644 > > > --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c > > > +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c > > > @@ -2,6 +2,9 @@ > > > /* Copyright (C) 2020 MediaTek Inc. */ > > > #include > > > +#include > > > +#include > > > +#include > > > #include > > > #include "mt7921.h" > > > #include "../mt76_connac2_mac.h" > > > @@ -58,6 +61,50 @@ static const struct ieee80211_iface_combination if= _comb_chanctx[] =3D { > > > } > > > }; > > > +static ssize_t mt7921_thermal_temp_show(struct device *dev, > > > + struct device_attribute *attr, > > > + char *buf) > > > +{ > > > + struct mt7921_phy *phy =3D dev_get_drvdata(dev); > > > + int i =3D to_sensor_dev_attr(attr)->index; > > > + int temperature; > > > + > > > + switch (i) { > >=20 > > nit: you can drop i and just use to_sensor_dev_attr(attr)->index > >=20 > > > + case 0: > >=20 > > I think you need to wake the device up here running mt7921_mutex_acquire > > before sending the mcu command. >=20 > I need to wake it up and acquire a mutex, or does acquiring the mutex wak= e it > automatically? acquiring the lock with mt7921_mutex_acquire() will wake the device up. >=20 > And, mt7915 has some other logic in this area. I left the switch logic in > to match that, thinking maybe later we can add the other options to 7921? >=20 > Do you know if 7921 supports the other options like 7915? nope. Regards, Lorenzo >=20 > Thanks, > Ben >=20 >=20 > --=20 > Ben Greear > Candela Technologies Inc http://www.candelatech.com >=20 >=20 --C6NMl48XVxljFi9E Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCZGad3AAKCRA6cBh0uS2t rKpRAP45Q8ZJSJ861BW/+1ZNwmE5X85hvzWDVsKKDr/NKKPZNAEAtZd2ZwzS8Mvb IgPiZiSAzc4BeRq+j9BeZPrSiSnPJgM= =wmMR -----END PGP SIGNATURE----- --C6NMl48XVxljFi9E--