[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGuA+ooEHPiHuGYXOh7s68HRTv9HSr-BexFsCLUPWTMQ3szCfg@mail.gmail.com>
Date: Thu, 15 Sep 2022 18:58:13 +0200
From: Balsam CHIHI <bchihi@...libre.com>
To: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
Cc: rafael@...nel.org, rui.zhang@...el.com, daniel.lezcano@...aro.org,
amitk@...nel.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, khilman@...libre.com,
mka@...omium.org, robh+dt@...nel.org, krzk+dt@...nel.org,
matthias.bgg@...il.com, p.zabel@...gutronix.de,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, james.lo@...iatek.com,
fan.chen@...iatek.com, louis.yu@...iatek.com,
rex-bc.chen@...iatek.com, abailon@...libre.com
Subject: Re: [PATCH v9,4/7] thermal: mediatek: Add LVTS driver for mt8192
thermal zones
Hi Angelo,
> > +static int soc_temp_lvts_read_temp(void *data, int *temperature)
> > +{
> > + struct soc_temp_tz *lvts_tz = (struct soc_temp_tz *)data;
> > + struct lvts_data *lvts_data = lvts_tz->lvts_data;
> > + struct device *dev = lvts_data->dev;
> > + unsigned int msr_raw;
> > +
> > + msr_raw = readl(lvts_data->reg[lvts_tz->id]) & MRS_RAW_MASK;
> > + if (msr_raw == 0) {
> > + /* Prevents a false critical temperature trap */
> > + *temperature = 0;
> > + dev_dbg(dev, "LVTS not yet ready\n");
>
> ...and you're not returning an error code, despite this function was called
> while LVTS is still not ready? :-)
>
if I add "return -ENAVAIL;" here, I will get the following errors on boot :
[ 0.292094] thermal thermal_zone0: failed to read out thermal zone (-119)
[ 0.293019] thermal thermal_zone1: failed to read out thermal zone (-119)
[ 0.294158] thermal thermal_zone6: failed to read out thermal zone (-119)
[ 0.295697] thermal thermal_zone9: failed to read out thermal zone (-119)
[ 0.296600] thermal thermal_zone10: failed to read out thermal zone (-119)
[ 0.297698] thermal thermal_zone15: failed to read out thermal zone (-119)
[ 0.298625] thermal thermal_zone16: failed to read out thermal zone (-119)
I just preferred : *temperature = 0; to avoid a false critical temperature trap,
and "return 0;" to suppress these errors.
After that (first read at boot when LVTS is not fully ready),
"msr_raw" will be always != 0.
And I did not want to add a "delay" or a "sleep".
Please let me know if you have any suggestions that could fix it in a
better way.
> > +
> > + } else
> > + *temperature = lvts_raw_to_temp(&lvts_data->coeff, msr_raw);
> > +
> > + return 0;
> > +}
Best regards,
Balsam
Powered by blists - more mailing lists