From: Brian Norris <briannorris@chromium.org>
To: Caesar Wang <wxt@rock-chips.com>
Cc: heiko@sntech.de, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, smbarber@chromium.org,
edubezval@gmail.com, linux-rockchip@lists.infradead.org,
rui.zhang@intel.com
Subject: Re: [PATCH 3/5] thermal: rockchip: fixes invalid temperature case
Date: Tue, 22 Nov 2016 20:36:43 -0800 [thread overview]
Message-ID: <20161123043642.GA28948@google.com> (raw)
In-Reply-To: <b2736d4e-120e-cbb9-3371-838c8f36c752@rock-chips.com>
On Wed, Nov 23, 2016 at 11:03:33AM +0800, Caesar Wang wrote:
> 在 2016年11月23日 10:33, Brian Norris 写道:
> >IIUC, "too high" should not be interpreted as TSADCV2_DATA_MASK on
> >rk3288, should it? That corresponds to -40C, which means you'll be
> >triggering the alarm temperature at a very *low* temperature, not a very
> >high one, no?
>
> The "too high" will correspond to -40C on rk3288, but shouldn't
> trigger the alarm temperature.
>
> Due to the alarm or tshut function will handle it.
>
> e.g.:
> static void rk_tsadcv2_alarm_temp(const struct chip_tsadc_table *table,
> int chn, void __iomem *regs, int temp)
> {
> u32 alarm_value, int_en;
>
> /* Make sure the value is valid */
> alarm_value = rk_tsadcv2_temp_to_code(table, temp);
> if (alarm_value == table->data_mask)
> return;
Ah, right. I keep forgetting about this odd error handling.
That's still the wrong error handling though; the right response is
never to avoid doing anything (and therefore returning "success" to the
thermal core). You need to either program a high (or low) trip value, or
else report an error (i.e., allow rk_tsadcv2_alarm_temp() to return an
error code back to the calling function). Otherwise, this:
echo -45000 > trip_0_temp
will succeed without error, and:
cat trip_0_temp
-45000
will return the cached temperature from of-thermal, even though the trip
point is programmed to something else entirely.
Brian
next prev parent reply other threads:[~2016-11-23 4:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 12:34 [PATCH 0/5] thermal: rockchip: optimization to improve the driver Caesar Wang
2016-11-22 12:34 ` [PATCH 1/5] thermal: rockchip: improve conversion error messages Caesar Wang
2016-11-22 12:34 ` [PATCH 2/5] thermal: rockchip: don't pass table structs by value Caesar Wang
2016-11-22 12:34 ` [PATCH 3/5] thermal: rockchip: fixes invalid temperature case Caesar Wang
2016-11-22 20:57 ` Brian Norris
2016-11-22 21:52 ` Brian Norris
[not found] ` <20161122215240.GA52900-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2016-11-23 2:06 ` Caesar Wang
2016-11-23 2:33 ` Brian Norris
2016-11-23 3:03 ` Caesar Wang
2016-11-23 4:36 ` Brian Norris [this message]
2016-11-22 12:34 ` [PATCH 4/5] thermal: rockchip: optimize the conversion table Caesar Wang
2016-11-22 21:47 ` Brian Norris
2016-11-22 12:34 ` [PATCH 5/5] thermal: rockchip: handle the set_trips without the trip points Caesar Wang
2016-11-22 20:51 ` Brian Norris
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=20161123043642.GA28948@google.com \
--to=briannorris@chromium.org \
--cc=edubezval@gmail.com \
--cc=heiko@sntech.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=rui.zhang@intel.com \
--cc=smbarber@chromium.org \
--cc=wxt@rock-chips.com \
/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;
as well as URLs for NNTP newsgroup(s).