From: Caesar Wang <wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
To: rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org,
linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
smbarber-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Caesar Wang <wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Subject: [PATCH v3 5/5] thermal: rockchip: handle set_trips without the trip points
Date: Mon, 28 Nov 2016 19:12:04 +0800 [thread overview]
Message-ID: <1480331524-18741-6-git-send-email-wxt@rock-chips.com> (raw)
In-Reply-To: <1480331524-18741-1-git-send-email-wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
In some cases, some sensors didn't need the trip points, the
set_trips will pass {-INT_MAX, INT_MAX} to trigger tsadc alarm in the end,
ignore this case and disable the high temperature interrupt.
Signed-off-by: Caesar Wang <wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Reviewed-by: Brian Norris <briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
Changes in v3:
- change the commit.
- Fixes something as Brian comments on
Changes in v2:
- Fixes something as Brian comments on
https://patchwork.kernel.org/patch/9440989.
Changes in v1: None
drivers/thermal/rockchip_thermal.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 660ed3b..56c663c 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -675,7 +675,21 @@ static int rk_tsadcv2_get_temp(const struct chip_tsadc_table *table,
static int rk_tsadcv2_alarm_temp(const struct chip_tsadc_table *table,
int chn, void __iomem *regs, int temp)
{
- u32 alarm_value, int_en;
+ u32 alarm_value;
+ u32 int_en, int_clr;
+
+ /*
+ * In some cases, some sensors didn't need the trip points, the
+ * set_trips will pass {-INT_MAX, INT_MAX} to trigger tsadc alarm
+ * in the end, ignore this case and disable the high temperature
+ * interrupt.
+ */
+ if (temp == INT_MAX) {
+ int_clr = readl_relaxed(regs + TSADCV2_INT_EN);
+ int_clr &= ~TSADCV2_INT_SRC_EN(chn);
+ writel_relaxed(int_clr, regs + TSADCV2_INT_EN);
+ return 0;
+ }
/* Make sure the value is valid */
alarm_value = rk_tsadcv2_temp_to_code(table, temp);
--
2.7.4
prev parent reply other threads:[~2016-11-28 11:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-28 11:11 [PATCH v3 0/5] thermal: fixes the rockchip thermal Caesar Wang
2016-11-28 11:12 ` [PATCH v3 3/5] thermal: rockchip: fixes invalid temperature case Caesar Wang
2016-11-28 18:47 ` Brian Norris
2016-11-29 1:45 ` Eduardo Valentin
[not found] ` <20161129014553.GA3097-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2016-11-29 21:57 ` Brian Norris
2016-11-30 5:02 ` Eduardo Valentin
2016-11-30 5:59 ` Brian Norris
2016-11-30 6:26 ` Eduardo Valentin
2016-12-12 10:46 ` Caesar Wang
[not found] ` <1480331524-18741-1-git-send-email-wxt-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-11-28 11:12 ` [PATCH v3 1/5] thermal: rockchip: improve conversion error messages Caesar Wang
2016-11-29 1:51 ` Eduardo Valentin
2016-11-29 5:47 ` Brian Norris
2016-11-30 5:04 ` Eduardo Valentin
2016-12-12 10:47 ` Caesar Wang
2016-11-28 11:12 ` [PATCH v3 2/5] thermal: rockchip: don't pass table structs by value Caesar Wang
2016-11-28 11:12 ` [PATCH v3 4/5] thermal: rockchip: optimize the conversion table Caesar Wang
2016-11-29 1:48 ` Eduardo Valentin
2016-11-30 6:29 ` Eduardo Valentin
2016-12-12 10:48 ` Caesar Wang
2016-11-28 11:12 ` Caesar Wang [this message]
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=1480331524-18741-6-git-send-email-wxt@rock-chips.com \
--to=wxt-tnx95d0mmh7dzftrwevzcw@public.gmane.org \
--cc=briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=smbarber-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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