linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal
@ 2016-02-15  7:33 Caesar Wang
  2016-02-15  7:33 ` [RESEND PATCH 1/8] clk: rockchip: add id of the tsadc clock found on rk3228 SoCs Caesar Wang
                   ` (8 more replies)
  0 siblings, 9 replies; 18+ messages in thread
From: Caesar Wang @ 2016-02-15  7:33 UTC (permalink / raw)
  To: Heiko Stuebner, edubezval
  Cc: huangtao, Michael Turquette, linux-pm, Stephen Boyd, zhangqing,
	linux-kernel, linux-rockchip, Dmitry Torokhov, Jeffy Chen,
	Zhang Rui, linux-clk, linux-arm-kernel, Caesar Wang

Hello Eduardo, Heiko, Michael & Stephen:

This series pacthes to support the rk3228 SoCs thermal.

They have the following patches to work on rk3228 SoCs.

1a6f334 clk: rockchip: add id of the tsadc clock found on rk3228 SoCs
8cf2d1b clk: rockchip: add the tsadc clocks found on rk3228 SoCs
bd2720c thermal: rockchip: fix a impossible condition caused by the warning
df9c1bd thermal: rockchip: fix calculation error for code_to_temp
fb11fbd thermal: rockchip: the rename compatibles for rockchip SoCs
b907b75 thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399
bdc79c0 ARM: dts: rockchip: add the thermal main info found on rk3228
22ea3c3 ARM: dts: rockchip: enable the tsadc for rk3228 evb

Verified on https://github.com/Caesar-github/rockchip/tree/rk3228-thermal-tests.
This series patches are based on
Linux version 4.5.0-rc4+ (wxt@ubuntu) (...) (GCC) ) #204 SMP Mon Feb 15 14:12:16 CST 6

Tests:

1) Get the temperature in every 500ms.

while true;do ls >/dev/null; done&
while true; do grep "" /sys/class/thermal/thermal_zone0/temp; sleep
.5; done &

2) critical tests
**
/sys/devices/virtual/thermal/thermal_zone0 # cat temp
33000
/sys/devices/virtual/thermal/thermal_zone0 # echo 30000 > trip_point_2_temp
[  988.114192] thermal thermal_zone0: critical temperature reached(33 C),shutting down
...
shutdown
-
**via modify the dts over-temperature protectiong value to trigger otp pin.

Verified on rk3228/rk3288/rk3368 SoCs.
---

Hi Michael,Stephen
PATCH[1/8-2/8]:
Add the tsadc needed clocks for rk3228 SoCs

Hi Eduardo,
PATCH[3/8]:
To fix a build warning came from Dan Carpenter report smatch check,
Thanks.
As the patch exists in https://patchwork.kernel.org/patch/7757311/

PATCH[4/8]:
fix calculation error for code_to_temp
That's a error since the copy causes.

PATCH[5/8]:
the rename compatibles for rockchip SoCs
As the more and more rockchip SOCs are supported in thermal driver. this pacth
supposed to be compatible for better.

PATCH[6/8]:
fix the tsadc sequence output on rk3228/rk3399
Fixes the tsadc sequence output since the rk3228/rk3399 SoCs design.

Hi Heiko,
PATCH[7/8-8/8]: thermal DTS
1) add the thermal main info found on rk3228
2) enable the tsadc for rk3228 evb

I'd appreciate if someone have free time to review that. :)



Caesar Wang (7):
  clk: rockchip: add id of the tsadc clock found on rk3228 SoCs
  clk: rockchip: add the tsadc clocks found on rk3228 SoCs
  thermal: rockchip: fix a impossible condition caused by the warning
  thermal: rockchip: the rename compatibles for rockchip SoCs
  thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399
  ARM: dts: rockchip: add the thermal main info found on rk3228
  ARM: dts: rockchip: enable the tsadc for rk3228 evb

Elaine Zhang (1):
  thermal: rockchip: fix calculation error for code_to_temp

 arch/arm/boot/dts/rk3228-evb.dts       |   7 +
 arch/arm/boot/dts/rk3228.dtsi          |  69 ++++++++++
 drivers/clk/rockchip/clk-rk3228.c      |   4 +-
 drivers/thermal/rockchip_thermal.c     | 239 +++++++++++++++++++--------------
 include/dt-bindings/clock/rk3228-cru.h |   2 +
 5 files changed, 216 insertions(+), 105 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [RESEND PATCH 1/8] clk: rockchip: add id of the tsadc clock found on rk3228 SoCs
  2016-02-15  7:33 [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Caesar Wang
@ 2016-02-15  7:33 ` Caesar Wang
  2016-02-16 22:43   ` Michael Turquette
  2016-02-26  1:12   ` Heiko Stuebner
  2016-02-15  7:33 ` [RESEND PATCH 2/8] clk: rockchip: add the tsadc clocks " Caesar Wang
                   ` (7 subsequent siblings)
  8 siblings, 2 replies; 18+ messages in thread
From: Caesar Wang @ 2016-02-15  7:33 UTC (permalink / raw)
  To: Heiko Stuebner, edubezval
  Cc: huangtao, Michael Turquette, linux-pm, Stephen Boyd, zhangqing,
	linux-kernel, linux-rockchip, Dmitry Torokhov, Jeffy Chen,
	Zhang Rui, linux-clk, linux-arm-kernel, Caesar Wang

This patch adds 'SCLK_TSADC' and 'PCLK_TSADC' id found on rk3228 SoCs.
That will be needed by TSADC controller.

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

 include/dt-bindings/clock/rk3228-cru.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/dt-bindings/clock/rk3228-cru.h b/include/dt-bindings/clock/rk3228-cru.h
index a78dd89..cd2e06b 100644
--- a/include/dt-bindings/clock/rk3228-cru.h
+++ b/include/dt-bindings/clock/rk3228-cru.h
@@ -29,6 +29,7 @@
 #define SCLK_SDMMC		68
 #define SCLK_SDIO		69
 #define SCLK_EMMC		71
+#define SCLK_TSADC		72
 #define SCLK_UART0		77
 #define SCLK_UART1		78
 #define SCLK_UART2		79
@@ -68,6 +69,7 @@
 #define PCLK_UART0		341
 #define PCLK_UART1		342
 #define PCLK_UART2		343
+#define PCLK_TSADC		344
 #define PCLK_PWM		350
 #define PCLK_TIMER		353
 #define PCLK_PERI		363
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RESEND PATCH 2/8] clk: rockchip: add the tsadc clocks found on rk3228 SoCs
  2016-02-15  7:33 [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Caesar Wang
  2016-02-15  7:33 ` [RESEND PATCH 1/8] clk: rockchip: add id of the tsadc clock found on rk3228 SoCs Caesar Wang
@ 2016-02-15  7:33 ` Caesar Wang
  2016-02-16 22:43   ` Michael Turquette
  2016-02-26  1:12   ` Heiko Stuebner
  2016-02-15  7:33 ` [RESEND PATCH 3/8] thermal: rockchip: fix a impossible condition caused by the warning Caesar Wang
                   ` (6 subsequent siblings)
  8 siblings, 2 replies; 18+ messages in thread
From: Caesar Wang @ 2016-02-15  7:33 UTC (permalink / raw)
  To: Heiko Stuebner, edubezval
  Cc: huangtao, Michael Turquette, linux-pm, Stephen Boyd, zhangqing,
	linux-kernel, linux-rockchip, Dmitry Torokhov, Jeffy Chen,
	Zhang Rui, linux-clk, linux-arm-kernel, Caesar Wang

This patch adds the needed clocks for rk3228 tsadc.

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

 drivers/clk/rockchip/clk-rk3228.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c
index c515915..ac014b9 100644
--- a/drivers/clk/rockchip/clk-rk3228.c
+++ b/drivers/clk/rockchip/clk-rk3228.c
@@ -424,7 +424,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
 	GATE(0, "sclk_otgphy1", "xin24m", 0,
 			RK2928_CLKGATE_CON(1), 6, GFLAGS),
 
-	COMPOSITE_NOMUX(0, "sclk_tsadc", "xin24m", 0,
+	COMPOSITE_NOMUX(SCLK_TSADC, "sclk_tsadc", "xin24m", 0,
 			RK2928_CLKSEL_CON(24), 6, 10, DFLAGS,
 			RK2928_CLKGATE_CON(2), 8, GFLAGS),
 
@@ -584,7 +584,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
 	GATE(PCLK_UART0, "pclk_uart0", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 12, GFLAGS),
 	GATE(PCLK_UART1, "pclk_uart1", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 13, GFLAGS),
 	GATE(PCLK_UART2, "pclk_uart2", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 14, GFLAGS),
-	GATE(0, "pclk_tsadc", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 15, GFLAGS),
+	GATE(PCLK_TSADC, "pclk_tsadc", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 15, GFLAGS),
 	GATE(PCLK_GRF, "pclk_grf", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(10), 0, GFLAGS),
 	GATE(0, "pclk_cru", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(10), 1, GFLAGS),
 	GATE(0, "pclk_sgrf", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(10), 2, GFLAGS),
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RESEND PATCH 3/8] thermal: rockchip: fix a impossible condition caused by the warning
  2016-02-15  7:33 [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Caesar Wang
  2016-02-15  7:33 ` [RESEND PATCH 1/8] clk: rockchip: add id of the tsadc clock found on rk3228 SoCs Caesar Wang
  2016-02-15  7:33 ` [RESEND PATCH 2/8] clk: rockchip: add the tsadc clocks " Caesar Wang
@ 2016-02-15  7:33 ` Caesar Wang
  2016-02-15  7:33 ` [RESEND PATCH 4/8] thermal: rockchip: fix calculation error for code_to_temp Caesar Wang
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Caesar Wang @ 2016-02-15  7:33 UTC (permalink / raw)
  To: Heiko Stuebner, edubezval
  Cc: huangtao, Michael Turquette, linux-pm, Stephen Boyd, zhangqing,
	linux-kernel, linux-rockchip, Dmitry Torokhov, Jeffy Chen,
	Zhang Rui, linux-clk, linux-arm-kernel, Caesar Wang

As the Dan report the smatch check the thermal driver warning:
drivers/thermal/rockchip_thermal.c:551 rockchip_configure_from_dt()
warn: impossible condition '(thermal->tshut_temp > ((~0 >> 1))) =>
(s32min-s32max > s32max)'

Although The shut_temp read from DT is u32,the temperature is currently
represented as int not long in the thermal driver.
Let's change to make shut_temp instead of the thermal->tshut_temp for
the condition.

Fixes: commit 437df2172e8d
("thermal: rockchip: consistently use int for temperatures")

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---

 drivers/thermal/rockchip_thermal.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index b58e3fb..433085a 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -693,15 +693,14 @@ static int rockchip_configure_from_dt(struct device *dev,
 			 thermal->chip->tshut_temp);
 		thermal->tshut_temp = thermal->chip->tshut_temp;
 	} else {
+		if (shut_temp > INT_MAX) {
+			dev_err(dev, "Invalid tshut temperature specified: %d\n",
+				shut_temp);
+			return -ERANGE;
+		}
 		thermal->tshut_temp = shut_temp;
 	}
 
-	if (thermal->tshut_temp > INT_MAX) {
-		dev_err(dev, "Invalid tshut temperature specified: %d\n",
-			thermal->tshut_temp);
-		return -ERANGE;
-	}
-
 	if (of_property_read_u32(np, "rockchip,hw-tshut-mode", &tshut_mode)) {
 		dev_warn(dev,
 			 "Missing tshut mode property, using default (%s)\n",
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RESEND PATCH 4/8] thermal: rockchip: fix calculation error for code_to_temp
  2016-02-15  7:33 [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Caesar Wang
                   ` (2 preceding siblings ...)
  2016-02-15  7:33 ` [RESEND PATCH 3/8] thermal: rockchip: fix a impossible condition caused by the warning Caesar Wang
@ 2016-02-15  7:33 ` Caesar Wang
  2016-02-15  7:33 ` [RESEND PATCH 5/8] thermal: rockchip: the rename compatibles for rockchip SoCs Caesar Wang
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Caesar Wang @ 2016-02-15  7:33 UTC (permalink / raw)
  To: Heiko Stuebner, edubezval
  Cc: huangtao, Michael Turquette, linux-pm, Stephen Boyd, zhangqing,
	linux-kernel, linux-rockchip, Dmitry Torokhov, Jeffy Chen,
	Zhang Rui, linux-clk, linux-arm-kernel, Caesar Wang

From: Elaine Zhang <zhangqing@rock-chips.com>

the calculation use a global table, not their own table.
so adapt the table to the correct one.

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

 drivers/thermal/rockchip_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 433085a..5c58d48 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -411,7 +411,7 @@ static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code,
 	 * temperature between 2 table entries is linear and interpolate
 	 * to produce less granular result.
 	 */
-	num = table.id[mid].temp - v2_code_table[mid - 1].temp;
+	num = table.id[mid].temp - table.id[mid - 1].temp;
 	num *= abs(table.id[mid - 1].code - code);
 	denom = abs(table.id[mid - 1].code - table.id[mid].code);
 	*temp = table.id[mid - 1].temp + (num / denom);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RESEND PATCH 5/8] thermal: rockchip: the rename compatibles for rockchip SoCs
  2016-02-15  7:33 [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Caesar Wang
                   ` (3 preceding siblings ...)
  2016-02-15  7:33 ` [RESEND PATCH 4/8] thermal: rockchip: fix calculation error for code_to_temp Caesar Wang
@ 2016-02-15  7:33 ` Caesar Wang
  2016-02-15  7:33 ` [RESEND PATCH 6/8] thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399 Caesar Wang
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Caesar Wang @ 2016-02-15  7:33 UTC (permalink / raw)
  To: Heiko Stuebner, edubezval
  Cc: huangtao, Michael Turquette, linux-pm, Stephen Boyd, zhangqing,
	linux-kernel, linux-rockchip, Dmitry Torokhov, Jeffy Chen,
	Zhang Rui, linux-clk, linux-arm-kernel, Caesar Wang

This patch renames to be more adapter compatibles since more and more
SoCs are supported in thermal driver.

Reported-by: Huang,Tao <huangtao@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---

 drivers/thermal/rockchip_thermal.c | 50 +++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 5c58d48..9cdef62 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -58,8 +58,8 @@ enum sensor_id {
 
 /**
  * The conversion table has the adc value and temperature.
- * ADC_DECREMENT: the adc value is of diminishing.(e.g. v2_code_table)
- * ADC_INCREMENT: the adc value is incremental.(e.g. v3_code_table)
+ * ADC_DECREMENT: the adc value is of diminishing.(e.g. rk3288_code_table)
+ * ADC_INCREMENT: the adc value is incremental.(e.g. rk3368_code_table)
  */
 enum adc_sort_mode {
 	ADC_DECREMENT = 0,
@@ -135,7 +135,13 @@ struct rockchip_thermal_data {
 	enum tshut_polarity tshut_polarity;
 };
 
-/* TSADC Sensor info define: */
+/**
+ * TSADC Sensor Register description:
+ *
+ * TSADCV2_* are used for RK3288 SoCs, the other chips can reuse it.
+ * TSADCV3_* are used for newer SoCs than RK3288. (e.g: RK3228, RK3399)
+ *
+ */
 #define TSADCV2_AUTO_CON			0x04
 #define TSADCV2_INT_EN				0x08
 #define TSADCV2_INT_PD				0x0c
@@ -154,8 +160,8 @@ struct rockchip_thermal_data {
 #define TSADCV2_SHUT_2GPIO_SRC_EN(chn)		BIT(4 + (chn))
 #define TSADCV2_SHUT_2CRU_SRC_EN(chn)		BIT(8 + (chn))
 
-#define TSADCV1_INT_PD_CLEAR_MASK		~BIT(16)
 #define TSADCV2_INT_PD_CLEAR_MASK		~BIT(8)
+#define TSADCV3_INT_PD_CLEAR_MASK		~BIT(16)
 
 #define TSADCV2_DATA_MASK			0xfff
 #define TSADCV3_DATA_MASK			0x3ff
@@ -177,7 +183,7 @@ struct tsadc_table {
  * linearly interpolated.
  * Code to Temperature mapping should be updated based on sillcon results.
  */
-static const struct tsadc_table v1_code_table[] = {
+static const struct tsadc_table rk3228_code_table[] = {
 	{TSADCV3_DATA_MASK, -40000},
 	{436, -40000},
 	{431, -35000},
@@ -215,7 +221,7 @@ static const struct tsadc_table v1_code_table[] = {
 	{264, 125000},
 };
 
-static const struct tsadc_table v2_code_table[] = {
+static const struct tsadc_table rk3288_code_table[] = {
 	{TSADCV2_DATA_MASK, -40000},
 	{3800, -40000},
 	{3792, -35000},
@@ -253,7 +259,7 @@ static const struct tsadc_table v2_code_table[] = {
 	{3421, 125000},
 };
 
-static const struct tsadc_table v3_code_table[] = {
+static const struct tsadc_table rk3368_code_table[] = {
 	{0, -40000},
 	{106, -40000},
 	{108, -35000},
@@ -292,7 +298,7 @@ static const struct tsadc_table v3_code_table[] = {
 	{TSADCV3_DATA_MASK, 125000},
 };
 
-static const struct tsadc_table v4_code_table[] = {
+static const struct tsadc_table rk3399_code_table[] = {
 	{TSADCV3_DATA_MASK, -40000},
 	{431, -40000},
 	{426, -35000},
@@ -453,20 +459,20 @@ static void rk_tsadcv2_initialize(void __iomem *regs,
 		       regs + TSADCV2_HIGHT_TSHUT_DEBOUNCE);
 }
 
-static void rk_tsadcv1_irq_ack(void __iomem *regs)
+static void rk_tsadcv2_irq_ack(void __iomem *regs)
 {
 	u32 val;
 
 	val = readl_relaxed(regs + TSADCV2_INT_PD);
-	writel_relaxed(val & TSADCV1_INT_PD_CLEAR_MASK, regs + TSADCV2_INT_PD);
+	writel_relaxed(val & TSADCV2_INT_PD_CLEAR_MASK, regs + TSADCV2_INT_PD);
 }
 
-static void rk_tsadcv2_irq_ack(void __iomem *regs)
+static void rk_tsadcv3_irq_ack(void __iomem *regs)
 {
 	u32 val;
 
 	val = readl_relaxed(regs + TSADCV2_INT_PD);
-	writel_relaxed(val & TSADCV2_INT_PD_CLEAR_MASK, regs + TSADCV2_INT_PD);
+	writel_relaxed(val & TSADCV3_INT_PD_CLEAR_MASK, regs + TSADCV2_INT_PD);
 }
 
 static void rk_tsadcv2_control(void __iomem *regs, bool enable)
@@ -531,15 +537,15 @@ static const struct rockchip_tsadc_chip rk3228_tsadc_data = {
 	.tshut_temp = 95000,
 
 	.initialize = rk_tsadcv2_initialize,
-	.irq_ack = rk_tsadcv1_irq_ack,
+	.irq_ack = rk_tsadcv3_irq_ack,
 	.control = rk_tsadcv2_control,
 	.get_temp = rk_tsadcv2_get_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
 
 	.table = {
-		.id = v1_code_table,
-		.length = ARRAY_SIZE(v1_code_table),
+		.id = rk3228_code_table,
+		.length = ARRAY_SIZE(rk3228_code_table),
 		.data_mask = TSADCV3_DATA_MASK,
 		.mode = ADC_DECREMENT,
 	},
@@ -562,8 +568,8 @@ static const struct rockchip_tsadc_chip rk3288_tsadc_data = {
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
 
 	.table = {
-		.id = v2_code_table,
-		.length = ARRAY_SIZE(v2_code_table),
+		.id = rk3288_code_table,
+		.length = ARRAY_SIZE(rk3288_code_table),
 		.data_mask = TSADCV2_DATA_MASK,
 		.mode = ADC_DECREMENT,
 	},
@@ -586,8 +592,8 @@ static const struct rockchip_tsadc_chip rk3368_tsadc_data = {
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
 
 	.table = {
-		.id = v3_code_table,
-		.length = ARRAY_SIZE(v3_code_table),
+		.id = rk3368_code_table,
+		.length = ARRAY_SIZE(rk3368_code_table),
 		.data_mask = TSADCV3_DATA_MASK,
 		.mode = ADC_INCREMENT,
 	},
@@ -603,15 +609,15 @@ static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
 	.tshut_temp = 95000,
 
 	.initialize = rk_tsadcv2_initialize,
-	.irq_ack = rk_tsadcv1_irq_ack,
+	.irq_ack = rk_tsadcv3_irq_ack,
 	.control = rk_tsadcv2_control,
 	.get_temp = rk_tsadcv2_get_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
 
 	.table = {
-		.id = v4_code_table,
-		.length = ARRAY_SIZE(v4_code_table),
+		.id = rk3399_code_table,
+		.length = ARRAY_SIZE(rk3399_code_table),
 		.data_mask = TSADCV3_DATA_MASK,
 		.mode = ADC_DECREMENT,
 	},
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RESEND PATCH 6/8] thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399
  2016-02-15  7:33 [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Caesar Wang
                   ` (4 preceding siblings ...)
  2016-02-15  7:33 ` [RESEND PATCH 5/8] thermal: rockchip: the rename compatibles for rockchip SoCs Caesar Wang
@ 2016-02-15  7:33 ` Caesar Wang
  2016-02-15  7:33 ` [RESEND PATCH 7/8] ARM: dts: rockchip: add the thermal main info found on rk3228 Caesar Wang
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: Caesar Wang @ 2016-02-15  7:33 UTC (permalink / raw)
  To: Heiko Stuebner, edubezval
  Cc: huangtao, Michael Turquette, linux-pm, Stephen Boyd, zhangqing,
	linux-kernel, linux-rockchip, Dmitry Torokhov, Jeffy Chen,
	Zhang Rui, linux-clk, linux-arm-kernel, Caesar Wang

As the TRM says, add the tsadc_q_sel to control the temperature-code
sequence since the rk3228/rk3399 need set this bit (1024 - tsadc_q)
as output.

Fixes: commit
b0d7033 "thermal: rockchip: Support the RK3399 SoCs in thermal driver"
7b02a5e "thermal: rockchip: Support the RK3228 SoCs in thermal driver"

Reported-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---

 drivers/thermal/rockchip_thermal.c | 176 +++++++++++++++++++++----------------
 1 file changed, 102 insertions(+), 74 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 9cdef62..233a564 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -155,6 +155,13 @@ struct rockchip_thermal_data {
 #define TSADCV2_AUTO_EN				BIT(0)
 #define TSADCV2_AUTO_SRC_EN(chn)		BIT(4 + (chn))
 #define TSADCV2_AUTO_TSHUT_POLARITY_HIGH	BIT(8)
+/**
+ * TSADCV1_AUTO_Q_SEL_EN:
+ * whether select (1024 - tsadc_q) as output
+ * 1'b0:use tsadc_q as output(temperature-code is rising sequence)
+ * 1'b1:use(1024 - tsadc_q) as output (temperature-code is falling sequence)
+ */
+#define TSADCV3_AUTO_Q_SEL_EN			BIT(1)
 
 #define TSADCV2_INT_SRC_EN(chn)			BIT(chn)
 #define TSADCV2_SHUT_2GPIO_SRC_EN(chn)		BIT(4 + (chn))
@@ -184,41 +191,42 @@ struct tsadc_table {
  * Code to Temperature mapping should be updated based on sillcon results.
  */
 static const struct tsadc_table rk3228_code_table[] = {
-	{TSADCV3_DATA_MASK, -40000},
-	{436, -40000},
-	{431, -35000},
-	{426, -30000},
-	{421, -25000},
-	{416, -20000},
-	{411, -15000},
-	{406, -10000},
-	{401, -5000},
-	{395, 0},
-	{390, 5000},
-	{385, 10000},
-	{380, 15000},
-	{375, 20000},
-	{370, 25000},
-	{364, 30000},
-	{359, 35000},
-	{354, 40000},
-	{349, 45000},
-	{343, 50000},
-	{338, 55000},
-	{333, 60000},
-	{328, 65000},
-	{322, 70000},
-	{317, 75000},
-	{312, 80000},
-	{307, 85000},
-	{301, 90000},
-	{296, 95000},
-	{291, 100000},
-	{286, 105000},
-	{280, 110000},
-	{275, 115000},
-	{270, 120000},
-	{264, 125000},
+	{0, -40000},
+	{588, -40000},
+	{593, -35000},
+	{598, -30000},
+	{603, -25000},
+	{608, -20000},
+	{613, -15000},
+	{618, -10000},
+	{623, -5000},
+	{629, 0},
+	{634, 5000},
+	{639, 10000},
+	{644, 15000},
+	{649, 20000},
+	{654, 25000},
+	{660, 30000},
+	{665, 35000},
+	{670, 40000},
+	{675, 45000},
+	{681, 50000},
+	{686, 55000},
+	{691, 60000},
+	{696, 65000},
+	{702, 70000},
+	{707, 75000},
+	{712, 80000},
+	{717, 85000},
+	{723, 90000},
+	{728, 95000},
+	{733, 100000},
+	{738, 105000},
+	{744, 110000},
+	{749, 115000},
+	{754, 120000},
+	{760, 125000},
+	{TSADCV2_DATA_MASK, 125000},
 };
 
 static const struct tsadc_table rk3288_code_table[] = {
@@ -299,41 +307,42 @@ static const struct tsadc_table rk3368_code_table[] = {
 };
 
 static const struct tsadc_table rk3399_code_table[] = {
-	{TSADCV3_DATA_MASK, -40000},
-	{431, -40000},
-	{426, -35000},
-	{421, -30000},
-	{415, -25000},
-	{410, -20000},
-	{405, -15000},
-	{399, -10000},
-	{394, -5000},
-	{389, 0},
-	{383, 5000},
-	{378, 10000},
-	{373, 15000},
-	{367, 20000},
-	{362, 25000},
-	{357, 30000},
-	{351, 35000},
-	{346, 40000},
-	{340, 45000},
-	{335, 50000},
-	{330, 55000},
-	{324, 60000},
-	{319, 65000},
-	{313, 70000},
-	{308, 75000},
-	{302, 80000},
-	{297, 85000},
-	{291, 90000},
-	{286, 95000},
-	{281, 100000},
-	{275, 105000},
-	{270, 110000},
-	{264, 115000},
-	{259, 120000},
-	{253, 125000},
+	{0, -40000},
+	{593, -40000},
+	{598, -35000},
+	{603, -30000},
+	{609, -25000},
+	{614, -20000},
+	{619, -15000},
+	{625, -10000},
+	{630, -5000},
+	{635, 0},
+	{641, 5000},
+	{646, 10000},
+	{651, 15000},
+	{657, 20000},
+	{662, 25000},
+	{667, 30000},
+	{673, 35000},
+	{678, 40000},
+	{684, 45000},
+	{689, 50000},
+	{694, 55000},
+	{700, 60000},
+	{705, 65000},
+	{711, 70000},
+	{716, 75000},
+	{722, 80000},
+	{727, 85000},
+	{733, 90000},
+	{738, 95000},
+	{743, 100000},
+	{749, 105000},
+	{754, 110000},
+	{760, 115000},
+	{765, 120000},
+	{771, 125000},
+	{TSADCV3_DATA_MASK, 125000},
 };
 
 static u32 rk_tsadcv2_temp_to_code(struct chip_tsadc_table table,
@@ -488,6 +497,25 @@ static void rk_tsadcv2_control(void __iomem *regs, bool enable)
 	writel_relaxed(val, regs + TSADCV2_AUTO_CON);
 }
 
+/**
+ * @rk_tsadcv3_control:
+ * TSADC controller works at auto mode, and some SoCs need set the tsadc_q_sel
+ * bit on TSADCV2_AUTO_CON[1]. The (1024 - tsadc_q) as output adc value if
+ * setting this bit to enable.
+ */
+static void rk_tsadcv3_control(void __iomem *regs, bool enable)
+{
+	u32 val;
+
+	val = readl_relaxed(regs + TSADCV2_AUTO_CON);
+	if (enable)
+		val |= TSADCV2_AUTO_EN | TSADCV3_AUTO_Q_SEL_EN;
+	else
+		val &= ~TSADCV2_AUTO_EN;
+
+	writel_relaxed(val, regs + TSADCV2_AUTO_CON);
+}
+
 static int rk_tsadcv2_get_temp(struct chip_tsadc_table table,
 			       int chn, void __iomem *regs, int *temp)
 {
@@ -538,7 +566,7 @@ static const struct rockchip_tsadc_chip rk3228_tsadc_data = {
 
 	.initialize = rk_tsadcv2_initialize,
 	.irq_ack = rk_tsadcv3_irq_ack,
-	.control = rk_tsadcv2_control,
+	.control = rk_tsadcv3_control,
 	.get_temp = rk_tsadcv2_get_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
@@ -547,7 +575,7 @@ static const struct rockchip_tsadc_chip rk3228_tsadc_data = {
 		.id = rk3228_code_table,
 		.length = ARRAY_SIZE(rk3228_code_table),
 		.data_mask = TSADCV3_DATA_MASK,
-		.mode = ADC_DECREMENT,
+		.mode = ADC_INCREMENT,
 	},
 };
 
@@ -610,7 +638,7 @@ static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
 
 	.initialize = rk_tsadcv2_initialize,
 	.irq_ack = rk_tsadcv3_irq_ack,
-	.control = rk_tsadcv2_control,
+	.control = rk_tsadcv3_control,
 	.get_temp = rk_tsadcv2_get_temp,
 	.set_tshut_temp = rk_tsadcv2_tshut_temp,
 	.set_tshut_mode = rk_tsadcv2_tshut_mode,
@@ -619,7 +647,7 @@ static const struct rockchip_tsadc_chip rk3399_tsadc_data = {
 		.id = rk3399_code_table,
 		.length = ARRAY_SIZE(rk3399_code_table),
 		.data_mask = TSADCV3_DATA_MASK,
-		.mode = ADC_DECREMENT,
+		.mode = ADC_INCREMENT,
 	},
 };
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RESEND PATCH 7/8] ARM: dts: rockchip: add the thermal main info found on rk3228
  2016-02-15  7:33 [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Caesar Wang
                   ` (5 preceding siblings ...)
  2016-02-15  7:33 ` [RESEND PATCH 6/8] thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399 Caesar Wang
@ 2016-02-15  7:33 ` Caesar Wang
  2016-03-01 10:03   ` Heiko Stübner
  2016-02-15  7:33 ` [RESEND PATCH 8/8] ARM: dts: rockchip: enable the tsadc for rk3228 evb Caesar Wang
  2016-02-15 23:25 ` [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Heiko Stuebner
  8 siblings, 1 reply; 18+ messages in thread
From: Caesar Wang @ 2016-02-15  7:33 UTC (permalink / raw)
  To: Heiko Stuebner, edubezval
  Cc: huangtao, Michael Turquette, linux-pm, Stephen Boyd, zhangqing,
	linux-kernel, linux-rockchip, Dmitry Torokhov, Jeffy Chen,
	Zhang Rui, linux-clk, linux-arm-kernel, Caesar Wang

This patch adds the thermal needed main information for rk3228 SoCS.

Basically has the following content:

1) TSADC controller:
Add the needed attributes for rk3036 TSADC controller.

Especially for the TSHUT, in some cases if we are unable to shut it down
in orderly fashion (says: kernel is stuck holding a lock or similar), then
hardware TSHUT will reset it.
If the temperature is over 95C over a period of time the thermal shutdown
of the tsadc is invoked with can either reset the entire chip via the CRU,
or notify the PMIC via a GPIO. This should be set in the specific board.

2) Thermal zones:
Add the needed device mode for thermal generic framework.
Detail in Documentation/devicetree/bindings/thermal/thermal.txt.

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

 arch/arm/boot/dts/rk3228.dtsi | 69 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/arch/arm/boot/dts/rk3228.dtsi b/arch/arm/boot/dts/rk3228.dtsi
index 119ff12..4084081 100644
--- a/arch/arm/boot/dts/rk3228.dtsi
+++ b/arch/arm/boot/dts/rk3228.dtsi
@@ -43,6 +43,7 @@
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/pinctrl/rockchip.h>
 #include <dt-bindings/clock/rk3228-cru.h>
+#include <dt-bindings/thermal/thermal.h>
 #include "skeleton.dtsi"
 
 / {
@@ -69,6 +70,7 @@
 				/* KHz    uV */
 				 816000 1000000
 			>;
+			#cooling-cells = <2>; /* min followed by max */
 			clock-latency = <40000>;
 			clocks = <&cru ARMCLK>;
 		};
@@ -247,6 +249,63 @@
 		assigned-clock-rates = <594000000>;
 	};
 
+	thermal-zones {
+		cpu_thermal: cpu-thermal {
+			polling-delay-passive = <100>; /* milliseconds */
+			polling-delay = <5000>; /* milliseconds */
+
+			thermal-sensors = <&tsadc 0>;
+
+			trips {
+				cpu_alert0: cpu_alert0 {
+					temperature = <70000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "passive";
+				};
+				cpu_alert1: cpu_alert1 {
+					temperature = <75000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "passive";
+				};
+				cpu_crit: cpu_crit {
+					temperature = <90000>; /* millicelsius */
+					hysteresis = <2000>; /* millicelsius */
+					type = "critical";
+				};
+			};
+
+			cooling-maps {
+				map0 {
+					trip = <&cpu_alert0>;
+					cooling-device =
+						<&cpu0 THERMAL_NO_LIMIT 6>;
+				};
+				map1 {
+					trip = <&cpu_alert1>;
+					cooling-device =
+						<&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+	};
+
+	tsadc: tsadc@11150000 {
+		compatible = "rockchip,rk3228-tsadc";
+		reg = <0x11150000 0x100>;
+		interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru SCLK_TSADC>, <&cru PCLK_TSADC>;
+		clock-names = "tsadc", "apb_pclk";
+		resets = <&cru SRST_TSADC>;
+		reset-names = "tsadc-apb";
+		pinctrl-names = "init", "default", "sleep";
+		pinctrl-0 = <&otp_gpio>;
+		pinctrl-1 = <&otp_out>;
+		pinctrl-2 = <&otp_gpio>;
+		#thermal-sensor-cells = <0>;
+		rockchip,hw-tshut-temp = <95000>;
+		status = "disabled";
+	};
+
 	emmc: dwmmc@30020000 {
 		compatible = "rockchip,rk3288-dw-mshc";
 		reg = <0x30020000 0x4000>;
@@ -394,6 +453,16 @@
 			};
 		};
 
+		tsadc {
+			otp_gpio: otp-gpio {
+				rockchip,pins = <0 24 RK_FUNC_GPIO &pcfg_pull_none>;
+			};
+
+			otp_out: otp-out {
+				rockchip,pins = <0 24 RK_FUNC_2 &pcfg_pull_none>;
+			};
+		};
+
 		uart0 {
 			uart0_xfer: uart0-xfer {
 				rockchip,pins = <2 26 RK_FUNC_1 &pcfg_pull_none>,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [RESEND PATCH 8/8] ARM: dts: rockchip: enable the tsadc for rk3228 evb
  2016-02-15  7:33 [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Caesar Wang
                   ` (6 preceding siblings ...)
  2016-02-15  7:33 ` [RESEND PATCH 7/8] ARM: dts: rockchip: add the thermal main info found on rk3228 Caesar Wang
@ 2016-02-15  7:33 ` Caesar Wang
  2016-03-01 10:03   ` Heiko Stübner
  2016-02-15 23:25 ` [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Heiko Stuebner
  8 siblings, 1 reply; 18+ messages in thread
From: Caesar Wang @ 2016-02-15  7:33 UTC (permalink / raw)
  To: Heiko Stuebner, edubezval
  Cc: huangtao, Michael Turquette, linux-pm, Stephen Boyd, zhangqing,
	linux-kernel, linux-rockchip, Dmitry Torokhov, Jeffy Chen,
	Zhang Rui, linux-clk, linux-arm-kernel, Caesar Wang

This patch enables the tsadc for rk3228 evb board.

The rk3228 evb board uses the CRU to reset the chip since it hasn't the
PMIC to connect it, and TSHUT is low active on evb board.

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

---

 arch/arm/boot/dts/rk3228-evb.dts | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/rk3228-evb.dts b/arch/arm/boot/dts/rk3228-evb.dts
index e3898b8..c75cc41 100644
--- a/arch/arm/boot/dts/rk3228-evb.dts
+++ b/arch/arm/boot/dts/rk3228-evb.dts
@@ -61,6 +61,13 @@
 	status = "okay";
 };
 
+&tsadc {
+	status = "okay";
+
+	rockchip,hw-tshut-mode = <0>; /* tshut mode 0:CRU 1:GPIO */
+	rockchip,hw-tshut-polarity = <1>; /* tshut polarity 0:LOW 1:HIGH */
+};
+
 &uart2 {
 	status = "okay";
 };
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal
  2016-02-15  7:33 [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Caesar Wang
                   ` (7 preceding siblings ...)
  2016-02-15  7:33 ` [RESEND PATCH 8/8] ARM: dts: rockchip: enable the tsadc for rk3228 evb Caesar Wang
@ 2016-02-15 23:25 ` Heiko Stuebner
  2016-02-26  1:16   ` Heiko Stuebner
  8 siblings, 1 reply; 18+ messages in thread
From: Heiko Stuebner @ 2016-02-15 23:25 UTC (permalink / raw)
  To: Caesar Wang, edubezval
  Cc: huangtao, Michael Turquette, linux-pm, Stephen Boyd, zhangqing,
	linux-kernel, linux-rockchip, Dmitry Torokhov, Jeffy Chen,
	Zhang Rui, linux-clk, linux-arm-kernel

Am Montag, 15. Februar 2016, 15:33:25 schrieb Caesar Wang:
> Hello Eduardo, Heiko, Michael & Stephen:
> 
> This series pacthes to support the rk3228 SoCs thermal.
> 
> They have the following patches to work on rk3228 SoCs.
> 

> 1a6f334 clk: rockchip: add id of the tsadc clock found on rk3228 SoCs
> 8cf2d1b clk: rockchip: add the tsadc clocks found on rk3228 SoCs
> bdc79c0 ARM: dts: rockchip: add the thermal main info found on rk3228
> 22ea3c3 ARM: dts: rockchip: enable the tsadc for rk3228 evb

clk and devicetree patches look good and I'll pick those up once Eduardo is 
ok with (and has taken) the thermal-specific changes:

> bd2720c thermal: rockchip: fix a impossible condition caused by the
> warning df9c1bd thermal: rockchip: fix calculation error for code_to_temp
> fb11fbd thermal: rockchip: the rename compatibles for rockchip SoCs
> b907b75 thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399


Heiko

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RESEND PATCH 1/8] clk: rockchip: add id of the tsadc clock found on rk3228 SoCs
  2016-02-15  7:33 ` [RESEND PATCH 1/8] clk: rockchip: add id of the tsadc clock found on rk3228 SoCs Caesar Wang
@ 2016-02-16 22:43   ` Michael Turquette
  2016-02-26  1:12   ` Heiko Stuebner
  1 sibling, 0 replies; 18+ messages in thread
From: Michael Turquette @ 2016-02-16 22:43 UTC (permalink / raw)
  To: Caesar Wang, Heiko Stuebner, edubezval
  Cc: huangtao, linux-pm, Stephen Boyd, zhangqing, linux-kernel,
	linux-rockchip, Dmitry Torokhov, Jeffy Chen, Zhang Rui,
	linux-clk, linux-arm-kernel, Caesar Wang

Quoting Caesar Wang (2016-02-14 23:33:26)
> This patch adds 'SCLK_TSADC' and 'PCLK_TSADC' id found on rk3228 SoCs.
> That will be needed by TSADC controller.
> 
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

Acked-by: Michael Turquette <mturquette@baylibre.com>

> ---
> 
>  include/dt-bindings/clock/rk3228-cru.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/dt-bindings/clock/rk3228-cru.h b/include/dt-bindings/clock/rk3228-cru.h
> index a78dd89..cd2e06b 100644
> --- a/include/dt-bindings/clock/rk3228-cru.h
> +++ b/include/dt-bindings/clock/rk3228-cru.h
> @@ -29,6 +29,7 @@
>  #define SCLK_SDMMC             68
>  #define SCLK_SDIO              69
>  #define SCLK_EMMC              71
> +#define SCLK_TSADC             72
>  #define SCLK_UART0             77
>  #define SCLK_UART1             78
>  #define SCLK_UART2             79
> @@ -68,6 +69,7 @@
>  #define PCLK_UART0             341
>  #define PCLK_UART1             342
>  #define PCLK_UART2             343
> +#define PCLK_TSADC             344
>  #define PCLK_PWM               350
>  #define PCLK_TIMER             353
>  #define PCLK_PERI              363
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RESEND PATCH 2/8] clk: rockchip: add the tsadc clocks found on rk3228 SoCs
  2016-02-15  7:33 ` [RESEND PATCH 2/8] clk: rockchip: add the tsadc clocks " Caesar Wang
@ 2016-02-16 22:43   ` Michael Turquette
  2016-02-26  1:12   ` Heiko Stuebner
  1 sibling, 0 replies; 18+ messages in thread
From: Michael Turquette @ 2016-02-16 22:43 UTC (permalink / raw)
  To: Caesar Wang, Heiko Stuebner, edubezval
  Cc: huangtao, linux-pm, Stephen Boyd, zhangqing, linux-kernel,
	linux-rockchip, Dmitry Torokhov, Jeffy Chen, Zhang Rui,
	linux-clk, linux-arm-kernel, Caesar Wang

Quoting Caesar Wang (2016-02-14 23:33:27)
> This patch adds the needed clocks for rk3228 tsadc.
> 
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

Acked-by: Michael Turquette <mturquette@baylibre.com>

> ---
> 
>  drivers/clk/rockchip/clk-rk3228.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c
> index c515915..ac014b9 100644
> --- a/drivers/clk/rockchip/clk-rk3228.c
> +++ b/drivers/clk/rockchip/clk-rk3228.c
> @@ -424,7 +424,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
>         GATE(0, "sclk_otgphy1", "xin24m", 0,
>                         RK2928_CLKGATE_CON(1), 6, GFLAGS),
>  
> -       COMPOSITE_NOMUX(0, "sclk_tsadc", "xin24m", 0,
> +       COMPOSITE_NOMUX(SCLK_TSADC, "sclk_tsadc", "xin24m", 0,
>                         RK2928_CLKSEL_CON(24), 6, 10, DFLAGS,
>                         RK2928_CLKGATE_CON(2), 8, GFLAGS),
>  
> @@ -584,7 +584,7 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = {
>         GATE(PCLK_UART0, "pclk_uart0", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 12, GFLAGS),
>         GATE(PCLK_UART1, "pclk_uart1", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 13, GFLAGS),
>         GATE(PCLK_UART2, "pclk_uart2", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 14, GFLAGS),
> -       GATE(0, "pclk_tsadc", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 15, GFLAGS),
> +       GATE(PCLK_TSADC, "pclk_tsadc", "pclk_cpu", 0, RK2928_CLKGATE_CON(9), 15, GFLAGS),
>         GATE(PCLK_GRF, "pclk_grf", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(10), 0, GFLAGS),
>         GATE(0, "pclk_cru", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(10), 1, GFLAGS),
>         GATE(0, "pclk_sgrf", "pclk_cpu", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(10), 2, GFLAGS),
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RESEND PATCH 1/8] clk: rockchip: add id of the tsadc clock found on rk3228 SoCs
  2016-02-15  7:33 ` [RESEND PATCH 1/8] clk: rockchip: add id of the tsadc clock found on rk3228 SoCs Caesar Wang
  2016-02-16 22:43   ` Michael Turquette
@ 2016-02-26  1:12   ` Heiko Stuebner
  1 sibling, 0 replies; 18+ messages in thread
From: Heiko Stuebner @ 2016-02-26  1:12 UTC (permalink / raw)
  To: Caesar Wang
  Cc: edubezval, huangtao, Michael Turquette, linux-pm, Stephen Boyd,
	zhangqing, linux-kernel, linux-rockchip, Dmitry Torokhov,
	Jeffy Chen, Zhang Rui, linux-clk, linux-arm-kernel

Am Montag, 15. Februar 2016, 15:33:26 schrieb Caesar Wang:
> This patch adds 'SCLK_TSADC' and 'PCLK_TSADC' id found on rk3228 SoCs.
> That will be needed by TSADC controller.
> 
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

applied to my clk-branch with Mike's Ack


Thanks
Heiko

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RESEND PATCH 2/8] clk: rockchip: add the tsadc clocks found on rk3228 SoCs
  2016-02-15  7:33 ` [RESEND PATCH 2/8] clk: rockchip: add the tsadc clocks " Caesar Wang
  2016-02-16 22:43   ` Michael Turquette
@ 2016-02-26  1:12   ` Heiko Stuebner
  1 sibling, 0 replies; 18+ messages in thread
From: Heiko Stuebner @ 2016-02-26  1:12 UTC (permalink / raw)
  To: Caesar Wang
  Cc: edubezval, huangtao, Michael Turquette, linux-pm, Stephen Boyd,
	zhangqing, linux-kernel, linux-rockchip, Dmitry Torokhov,
	Jeffy Chen, Zhang Rui, linux-clk, linux-arm-kernel

Am Montag, 15. Februar 2016, 15:33:27 schrieb Caesar Wang:
> This patch adds the needed clocks for rk3228 tsadc.
> 
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

applied to my clk-branch with Mike's Ack


Thanks
Heiko

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal
  2016-02-15 23:25 ` [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Heiko Stuebner
@ 2016-02-26  1:16   ` Heiko Stuebner
  2016-03-01  4:39     ` Eduardo Valentin
  0 siblings, 1 reply; 18+ messages in thread
From: Heiko Stuebner @ 2016-02-26  1:16 UTC (permalink / raw)
  To: Caesar Wang, edubezval
  Cc: huangtao, Michael Turquette, linux-pm, Stephen Boyd, zhangqing,
	linux-kernel, linux-rockchip, Dmitry Torokhov, Jeffy Chen,
	Zhang Rui, linux-clk, linux-arm-kernel

Am Dienstag, 16. Februar 2016, 00:25:39 schrieb Heiko Stuebner:
> Am Montag, 15. Februar 2016, 15:33:25 schrieb Caesar Wang:
> > 1a6f334 clk: rockchip: add id of the tsadc clock found on rk3228 SoCs
> > 8cf2d1b clk: rockchip: add the tsadc clocks found on rk3228 SoCs
> > bdc79c0 ARM: dts: rockchip: add the thermal main info found on rk3228
> > 22ea3c3 ARM: dts: rockchip: enable the tsadc for rk3228 evb
> 
> clk and devicetree patches look good and I'll pick those up once Eduardo
> is
> ok with (and has taken) the thermal-specific changes:
> > bd2720c thermal: rockchip: fix a impossible condition caused by the
> > warning df9c1bd thermal: rockchip: fix calculation error for
> > code_to_temp
> > fb11fbd thermal: rockchip: the rename compatibles for rockchip SoCs
> > b907b75 thermal: rockchip: fix the tsadc sequence output on
> > rk3228/rk3399

@Eduardo: any opinion on the patches related to the thermal driver itself?


Thanks
Heiko

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal
  2016-02-26  1:16   ` Heiko Stuebner
@ 2016-03-01  4:39     ` Eduardo Valentin
  0 siblings, 0 replies; 18+ messages in thread
From: Eduardo Valentin @ 2016-03-01  4:39 UTC (permalink / raw)
  To: Heiko Stuebner
  Cc: Caesar Wang, huangtao, Michael Turquette, linux-pm, Stephen Boyd,
	zhangqing, linux-kernel, linux-rockchip, Dmitry Torokhov,
	Jeffy Chen, Zhang Rui, linux-clk, linux-arm-kernel

On Fri, Feb 26, 2016 at 02:16:58AM +0100, Heiko Stuebner wrote:
> Am Dienstag, 16. Februar 2016, 00:25:39 schrieb Heiko Stuebner:
> > Am Montag, 15. Februar 2016, 15:33:25 schrieb Caesar Wang:
> > > 1a6f334 clk: rockchip: add id of the tsadc clock found on rk3228 SoCs
> > > 8cf2d1b clk: rockchip: add the tsadc clocks found on rk3228 SoCs
> > > bdc79c0 ARM: dts: rockchip: add the thermal main info found on rk3228
> > > 22ea3c3 ARM: dts: rockchip: enable the tsadc for rk3228 evb
> > 
> > clk and devicetree patches look good and I'll pick those up once Eduardo
> > is
> > ok with (and has taken) the thermal-specific changes:
> > > bd2720c thermal: rockchip: fix a impossible condition caused by the
> > > warning df9c1bd thermal: rockchip: fix calculation error for
> > > code_to_temp
> > > fb11fbd thermal: rockchip: the rename compatibles for rockchip SoCs
> > > b907b75 thermal: rockchip: fix the tsadc sequence output on
> > > rk3228/rk3399
> 
> @Eduardo: any opinion on the patches related to the thermal driver itself?


Not really, adding them to my fixes branches. Thanks.

> 
> 
> Thanks
> Heiko
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RESEND PATCH 7/8] ARM: dts: rockchip: add the thermal main info found on rk3228
  2016-02-15  7:33 ` [RESEND PATCH 7/8] ARM: dts: rockchip: add the thermal main info found on rk3228 Caesar Wang
@ 2016-03-01 10:03   ` Heiko Stübner
  0 siblings, 0 replies; 18+ messages in thread
From: Heiko Stübner @ 2016-03-01 10:03 UTC (permalink / raw)
  To: Caesar Wang
  Cc: edubezval, huangtao, Michael Turquette, linux-pm, Stephen Boyd,
	zhangqing, linux-kernel, linux-rockchip, Dmitry Torokhov,
	Jeffy Chen, Zhang Rui, linux-clk, linux-arm-kernel

Am Montag, 15. Februar 2016, 15:33:32 schrieb Caesar Wang:
> This patch adds the thermal needed main information for rk3228 SoCS.
> 
> Basically has the following content:
> 
> 1) TSADC controller:
> Add the needed attributes for rk3036 TSADC controller.
> 
> Especially for the TSHUT, in some cases if we are unable to shut it down
> in orderly fashion (says: kernel is stuck holding a lock or similar), then
> hardware TSHUT will reset it.
> If the temperature is over 95C over a period of time the thermal shutdown
> of the tsadc is invoked with can either reset the entire chip via the CRU,
> or notify the PMIC via a GPIO. This should be set in the specific board.
> 
> 2) Thermal zones:
> Add the needed device mode for thermal generic framework.
> Detail in Documentation/devicetree/bindings/thermal/thermal.txt.
> 
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

applied to my dts32 branch for 4.6


Thanks
Heiko

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [RESEND PATCH 8/8] ARM: dts: rockchip: enable the tsadc for rk3228 evb
  2016-02-15  7:33 ` [RESEND PATCH 8/8] ARM: dts: rockchip: enable the tsadc for rk3228 evb Caesar Wang
@ 2016-03-01 10:03   ` Heiko Stübner
  0 siblings, 0 replies; 18+ messages in thread
From: Heiko Stübner @ 2016-03-01 10:03 UTC (permalink / raw)
  To: Caesar Wang
  Cc: edubezval, huangtao, Michael Turquette, linux-pm, Stephen Boyd,
	zhangqing, linux-kernel, linux-rockchip, Dmitry Torokhov,
	Jeffy Chen, Zhang Rui, linux-clk, linux-arm-kernel

Am Montag, 15. Februar 2016, 15:33:33 schrieb Caesar Wang:
> This patch enables the tsadc for rk3228 evb board.
> 
> The rk3228 evb board uses the CRU to reset the chip since it hasn't the
> PMIC to connect it, and TSHUT is low active on evb board.
> 
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

applied to my dts32 branch for 4.6


Thanks
Heiko

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2016-03-01 10:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-15  7:33 [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Caesar Wang
2016-02-15  7:33 ` [RESEND PATCH 1/8] clk: rockchip: add id of the tsadc clock found on rk3228 SoCs Caesar Wang
2016-02-16 22:43   ` Michael Turquette
2016-02-26  1:12   ` Heiko Stuebner
2016-02-15  7:33 ` [RESEND PATCH 2/8] clk: rockchip: add the tsadc clocks " Caesar Wang
2016-02-16 22:43   ` Michael Turquette
2016-02-26  1:12   ` Heiko Stuebner
2016-02-15  7:33 ` [RESEND PATCH 3/8] thermal: rockchip: fix a impossible condition caused by the warning Caesar Wang
2016-02-15  7:33 ` [RESEND PATCH 4/8] thermal: rockchip: fix calculation error for code_to_temp Caesar Wang
2016-02-15  7:33 ` [RESEND PATCH 5/8] thermal: rockchip: the rename compatibles for rockchip SoCs Caesar Wang
2016-02-15  7:33 ` [RESEND PATCH 6/8] thermal: rockchip: fix the tsadc sequence output on rk3228/rk3399 Caesar Wang
2016-02-15  7:33 ` [RESEND PATCH 7/8] ARM: dts: rockchip: add the thermal main info found on rk3228 Caesar Wang
2016-03-01 10:03   ` Heiko Stübner
2016-02-15  7:33 ` [RESEND PATCH 8/8] ARM: dts: rockchip: enable the tsadc for rk3228 evb Caesar Wang
2016-03-01 10:03   ` Heiko Stübner
2016-02-15 23:25 ` [RESEND PATCH 0/8] Support and fixes the rk3228 SoCS for thermal Heiko Stuebner
2016-02-26  1:16   ` Heiko Stuebner
2016-03-01  4:39     ` Eduardo Valentin

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).