Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1528448 > unrolled thread

[PATCH v2 5/5] thermal: rockchip: handle set_trips without the trip points

Started byCaesar Wang <wxt@rock-chips.com>
First post2016-11-23 15:40 +0100
Last post2016-11-23 19:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 5/5] thermal: rockchip: handle set_trips without the trip points Caesar Wang <wxt@rock-chips.com> - 2016-11-23 15:40 +0100
    Re: [PATCH v2 5/5] thermal: rockchip: handle set_trips without the  trip points Brian Norris <briannorris@chromium.org> - 2016-11-23 19:50 +0100

#1528448 — [PATCH v2 5/5] thermal: rockchip: handle set_trips without the trip points

FromCaesar Wang <wxt@rock-chips.com>
Date2016-11-23 15:40 +0100
Subject[PATCH v2 5/5] thermal: rockchip: handle set_trips without the trip points
Message-ID<sGGSl-65N-1@gated-at.bofh.it>
In some cases, some sensors didn't need the trip points, the
set_trips will return {-INT_MAX, INT_MAX} to trigger thermal alarm.

Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---

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 0d50df7..f873053 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

[toc] | [next] | [standalone]


#1528694 — Re: [PATCH v2 5/5] thermal: rockchip: handle set_trips without the trip points

FromBrian Norris <briannorris@chromium.org>
Date2016-11-23 19:50 +0100
SubjectRe: [PATCH v2 5/5] thermal: rockchip: handle set_trips without the trip points
Message-ID<sGKMi-5s-29@gated-at.bofh.it>
In reply to#1528448
On Wed, Nov 23, 2016 at 10:29:34PM +0800, Caesar Wang wrote:
> In some cases, some sensors didn't need the trip points, the
> set_trips will return {-INT_MAX, INT_MAX} to trigger thermal alarm.
> 
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
> ---
> 
> Changes in v2:
> - Fixes something as Brian comments on
>   https://patchwork.kernel.org/patch/9440989.
> 
> Changes in v1: None

I think this looks better.

Reviewed-by: Brian Norris <briannorris@chromium.org>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web