Linux wireless drivers development
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Ben Greear <greearb@candelatech.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] wifi: mt76: mt7921: Support temp sensor.
Date: Thu, 18 May 2023 23:51:27 +0200	[thread overview]
Message-ID: <ZGad36FQEK2/MduJ@localhost.localdomain> (raw)
In-Reply-To: <43d01aa8-b594-2770-59d0-13e6388c5758@candelatech.com>

[-- Attachment #1: Type: text/plain, Size: 2442 bytes --]

> On 5/18/23 13:42, Lorenzo Bianconi wrote:
> > > From: Ben Greear <greearb@candelatech.com>
> > > 
> > > Allow sensors tool to read radio's temperature, example:
> > > 
> > > mt7921_phy17-pci-1800
> > > Adapter: PCI adapter
> > > temp1:        +72.0°C
> > > 
> > > Signed-off-by: Ben Greear <greearb@candelatech.com>
> > > ---
> > >   .../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(+)
> > > 
> > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/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 <linux/etherdevice.h>
> > > +#include <linux/hwmon.h>
> > > +#include <linux/hwmon-sysfs.h>
> > > +#include <linux/thermal.h>
> > >   #include <linux/firmware.h>
> > >   #include "mt7921.h"
> > >   #include "../mt76_connac2_mac.h"
> > > @@ -58,6 +61,50 @@ static const struct ieee80211_iface_combination if_comb_chanctx[] = {
> > >   	}
> > >   };
> > > +static ssize_t mt7921_thermal_temp_show(struct device *dev,
> > > +					struct device_attribute *attr,
> > > +					char *buf)
> > > +{
> > > +	struct mt7921_phy *phy = dev_get_drvdata(dev);
> > > +	int i = to_sensor_dev_attr(attr)->index;
> > > +	int temperature;
> > > +
> > > +	switch (i) {
> > 
> > nit: you can drop i and just use to_sensor_dev_attr(attr)->index
> > 
> > > +	case 0:
> > 
> > I think you need to wake the device up here running mt7921_mutex_acquire
> > before sending the mcu command.
> 
> I need to wake it up and acquire a mutex, or does acquiring the mutex wake it
> automatically?

acquiring the lock with mt7921_mutex_acquire() will wake the device up.

> 
> 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?
> 
> Do you know if 7921 supports the other options like 7915?

nope.

Regards,
Lorenzo

> 
> Thanks,
> Ben
> 
> 
> -- 
> Ben Greear <greearb@candelatech.com>
> Candela Technologies Inc  http://www.candelatech.com
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-05-18 21:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18 20:07 [PATCH] wifi: mt76: mt7921: Support temp sensor greearb
2023-05-18 20:42 ` Lorenzo Bianconi
2023-05-18 21:01   ` Ben Greear
2023-05-18 21:51     ` Lorenzo Bianconi [this message]
2023-05-19 14:19 ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZGad36FQEK2/MduJ@localhost.localdomain \
    --to=lorenzo@kernel.org \
    --cc=greearb@candelatech.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox