linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/5] thermal: fixes the rockchip thermal
@ 2016-12-12 11:05 Caesar Wang
  2016-12-12 11:05 ` [PATCH v4 1/5] thermal: rockchip: improve conversion error messages Caesar Wang
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Caesar Wang @ 2016-12-12 11:05 UTC (permalink / raw)
  To: edubezval, rui.zhang
  Cc: linux-rockchip, linux-pm, briannorris, linux-kernel, smbarber,
	Caesar Wang

There are five patches posted for upstream.
89267b5 thermal: rockchip: improve conversion error messages
a0b5649 thermal: rockchip: don't pass table structs by value
bceed92 thermal: rockchip: fixes invalid temperature case
30be6d0 thermal: rockchip: optimize the conversion table
35636e9 thermal: rockchip: handle the set_trips without the trip points.
--

History version:
V1:
https://lkml.org/lkml/2016/11/22/250
V2:
https://lkml.org/lkml/2016/11/23/348
V3:
http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1281432.html
---

Brain posted the below patches for upstream.
89267b5 thermal: rockchip: improve conversion error messages
a0b5649 thermal: rockchip: don't pass table structs by value
That make sense to improve efficiency

Caesar post the below patches for upstream.
bceed92 thermal: rockchip: fixes invalid temperature case
30be6d0 thermal: rockchip: optimize the conversion table
35636e9 thermal: rockchip: handle the set_trips without the trip points.
That will fixes some issues in special cases.
--

Anyway, this series patches should can improve the rockchip thermal driver.


Changes in v4:
- As Eduardo and Brian commnets on
  https://patchwork.kernel.org/patch/9449301
- Print a better name.
- As Eduardo commented on https://patchwork.kernel.org/patch/9449313/
- remove the Brain's review for previous version, since the new version
  update something.

Changes in v3:
- fix trivial thing for error message nd return value.
- change the commit.
- Fixes something as Brian comments on

Changes in v2:
- As Brian commnets that restructure this to pass error codes back to the
  upper layers.
- Improve the commit message.
- improve the commit as Brian commnets on https://patchwork.kernel.org/patch/9440985
- Fixes something as Brian comments on
  https://patchwork.kernel.org/patch/9440989.

Changes in v1:
- The original Brian posted on https://patchwork.kernel.org/patch/9437686
  Note: it'd probably be even nicer to know which sensor this was, but we've
  kinda abstracted that one away by this point...
- The original Brian posted on https://patchwork.kernel.org/patch/9437687

Brian Norris (2):
  thermal: rockchip: improve conversion error messages
  thermal: rockchip: don't pass table structs by value

Caesar Wang (3):
  thermal: rockchip: fixes invalid temperature case
  thermal: rockchip: optimize the conversion table
  thermal: rockchip: handle set_trips without the trip points

 drivers/thermal/rockchip_thermal.c | 153 ++++++++++++++++++++++++-------------
 1 file changed, 100 insertions(+), 53 deletions(-)

-- 
2.7.4

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

* [PATCH v4 1/5] thermal: rockchip: improve conversion error messages
  2016-12-12 11:05 [PATCH v4 0/5] thermal: fixes the rockchip thermal Caesar Wang
@ 2016-12-12 11:05 ` Caesar Wang
  2016-12-12 11:05 ` [PATCH v4 2/5] thermal: rockchip: don't pass table structs by value Caesar Wang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Caesar Wang @ 2016-12-12 11:05 UTC (permalink / raw)
  To: edubezval, rui.zhang
  Cc: linux-rockchip, linux-pm, briannorris, linux-kernel, smbarber,
	Caesar Wang

From: Brian Norris <briannorris@chromium.org>

These error messages don't give much information about what went wrong.
It would be nice, for one, to see what invalid temperature was being
requested when conversion fails. It's also good to return an error when
we can't handle a conversion properly.

While we're at it, fix the grammar too.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>

---

Changes in v4:
- As Eduardo and Brian commnets on
  https://patchwork.kernel.org/patch/9449301

Changes in v3: None
Changes in v2: None
Changes in v1:
- The original Brian posted on https://patchwork.kernel.org/patch/9437686
  Note: it'd probably be even nicer to know which sensor this was, but we've
  kinda abstracted that one away by this point...

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

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index b811b0f..3bbc97c 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -424,7 +424,8 @@ static u32 rk_tsadcv2_temp_to_code(struct chip_tsadc_table table,
 	}
 
 exit:
-	pr_err("Invalid the conversion, error=%d\n", error);
+	pr_err("%s: invalid temperature, temp=%d error=%d\n",
+	       __func__, temp, error);
 	return error;
 }
 
@@ -475,7 +476,8 @@ static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code,
 		}
 		break;
 	default:
-		pr_err("Invalid the conversion table\n");
+		pr_err("%s: unknown table mode: %d\n", __func__, table.mode);
+		return -EINVAL;
 	}
 
 	/*
-- 
2.7.4

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

* [PATCH v4 2/5] thermal: rockchip: don't pass table structs by value
  2016-12-12 11:05 [PATCH v4 0/5] thermal: fixes the rockchip thermal Caesar Wang
  2016-12-12 11:05 ` [PATCH v4 1/5] thermal: rockchip: improve conversion error messages Caesar Wang
@ 2016-12-12 11:05 ` Caesar Wang
  2016-12-12 11:05 ` [PATCH v4 3/5] thermal: rockchip: fixes invalid temperature case Caesar Wang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Caesar Wang @ 2016-12-12 11:05 UTC (permalink / raw)
  To: edubezval, rui.zhang
  Cc: linux-rockchip, linux-pm, briannorris, linux-kernel, smbarber,
	Caesar Wang

From: Brian Norris <briannorris@chromium.org>

This driver passes struct chip_tsadc_table by value throughout; this is
inefficient, and AFAICT, there is no reason for it. Let's pass pointers
instead.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---

Changes in v4: None
Changes in v3: None
Changes in v2: None
Changes in v1:
- The original Brian posted on https://patchwork.kernel.org/patch/9437687

 drivers/thermal/rockchip_thermal.c | 80 +++++++++++++++++++-------------------
 1 file changed, 40 insertions(+), 40 deletions(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 3bbc97c..415e0ce 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -118,11 +118,11 @@ struct rockchip_tsadc_chip {
 	void (*control)(void __iomem *reg, bool on);
 
 	/* Per-sensor methods */
-	int (*get_temp)(struct chip_tsadc_table table,
+	int (*get_temp)(const struct chip_tsadc_table *table,
 			int chn, void __iomem *reg, int *temp);
-	void (*set_alarm_temp)(struct chip_tsadc_table table,
+	void (*set_alarm_temp)(const struct chip_tsadc_table *table,
 			       int chn, void __iomem *reg, int temp);
-	void (*set_tshut_temp)(struct chip_tsadc_table table,
+	void (*set_tshut_temp)(const struct chip_tsadc_table *table,
 			       int chn, void __iomem *reg, int temp);
 	void (*set_tshut_mode)(int chn, void __iomem *reg, enum tshut_mode m);
 
@@ -397,26 +397,26 @@ static const struct tsadc_table rk3399_code_table[] = {
 	{TSADCV3_DATA_MASK, 125000},
 };
 
-static u32 rk_tsadcv2_temp_to_code(struct chip_tsadc_table table,
+static u32 rk_tsadcv2_temp_to_code(const struct chip_tsadc_table *table,
 				   int temp)
 {
 	int high, low, mid;
 	u32 error = 0;
 
 	low = 0;
-	high = table.length - 1;
+	high = table->length - 1;
 	mid = (high + low) / 2;
 
 	/* Return mask code data when the temp is over table range */
-	if (temp < table.id[low].temp || temp > table.id[high].temp) {
-		error = table.data_mask;
+	if (temp < table->id[low].temp || temp > table->id[high].temp) {
+		error = table->data_mask;
 		goto exit;
 	}
 
 	while (low <= high) {
-		if (temp == table.id[mid].temp)
-			return table.id[mid].code;
-		else if (temp < table.id[mid].temp)
+		if (temp == table->id[mid].temp)
+			return table->id[mid].code;
+		else if (temp < table->id[mid].temp)
 			high = mid - 1;
 		else
 			low = mid + 1;
@@ -429,28 +429,28 @@ static u32 rk_tsadcv2_temp_to_code(struct chip_tsadc_table table,
 	return error;
 }
 
-static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code,
-				   int *temp)
+static int rk_tsadcv2_code_to_temp(const struct chip_tsadc_table *table,
+				   u32 code, int *temp)
 {
 	unsigned int low = 1;
-	unsigned int high = table.length - 1;
+	unsigned int high = table->length - 1;
 	unsigned int mid = (low + high) / 2;
 	unsigned int num;
 	unsigned long denom;
 
-	WARN_ON(table.length < 2);
+	WARN_ON(table->length < 2);
 
-	switch (table.mode) {
+	switch (table->mode) {
 	case ADC_DECREMENT:
-		code &= table.data_mask;
-		if (code < table.id[high].code)
+		code &= table->data_mask;
+		if (code < table->id[high].code)
 			return -EAGAIN;		/* Incorrect reading */
 
 		while (low <= high) {
-			if (code >= table.id[mid].code &&
-			    code < table.id[mid - 1].code)
+			if (code >= table->id[mid].code &&
+			    code < table->id[mid - 1].code)
 				break;
-			else if (code < table.id[mid].code)
+			else if (code < table->id[mid].code)
 				low = mid + 1;
 			else
 				high = mid - 1;
@@ -459,15 +459,15 @@ static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code,
 		}
 		break;
 	case ADC_INCREMENT:
-		code &= table.data_mask;
-		if (code < table.id[low].code)
+		code &= table->data_mask;
+		if (code < table->id[low].code)
 			return -EAGAIN;		/* Incorrect reading */
 
 		while (low <= high) {
-			if (code <= table.id[mid].code &&
-			    code > table.id[mid - 1].code)
+			if (code <= table->id[mid].code &&
+			    code > table->id[mid - 1].code)
 				break;
-			else if (code > table.id[mid].code)
+			else if (code > table->id[mid].code)
 				low = mid + 1;
 			else
 				high = mid - 1;
@@ -476,7 +476,7 @@ static int rk_tsadcv2_code_to_temp(struct chip_tsadc_table table, u32 code,
 		}
 		break;
 	default:
-		pr_err("%s: unknown table mode: %d\n", __func__, table.mode);
+		pr_err("%s: unknown table mode: %d\n", __func__, table->mode);
 		return -EINVAL;
 	}
 
@@ -486,10 +486,10 @@ 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 - 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);
+	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);
 
 	return 0;
 }
@@ -640,7 +640,7 @@ static void rk_tsadcv3_control(void __iomem *regs, bool enable)
 	writel_relaxed(val, regs + TSADCV2_AUTO_CON);
 }
 
-static int rk_tsadcv2_get_temp(struct chip_tsadc_table table,
+static int rk_tsadcv2_get_temp(const struct chip_tsadc_table *table,
 			       int chn, void __iomem *regs, int *temp)
 {
 	u32 val;
@@ -650,17 +650,17 @@ static int rk_tsadcv2_get_temp(struct chip_tsadc_table table,
 	return rk_tsadcv2_code_to_temp(table, val, temp);
 }
 
-static void rk_tsadcv2_alarm_temp(struct chip_tsadc_table table,
+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)
+	if (alarm_value == table->data_mask)
 		return;
 
-	writel_relaxed(alarm_value & table.data_mask,
+	writel_relaxed(alarm_value & table->data_mask,
 		       regs + TSADCV2_COMP_INT(chn));
 
 	int_en = readl_relaxed(regs + TSADCV2_INT_EN);
@@ -668,14 +668,14 @@ static void rk_tsadcv2_alarm_temp(struct chip_tsadc_table table,
 	writel_relaxed(int_en, regs + TSADCV2_INT_EN);
 }
 
-static void rk_tsadcv2_tshut_temp(struct chip_tsadc_table table,
+static void rk_tsadcv2_tshut_temp(const struct chip_tsadc_table *table,
 				  int chn, void __iomem *regs, int temp)
 {
 	u32 tshut_value, val;
 
 	/* Make sure the value is valid */
 	tshut_value = rk_tsadcv2_temp_to_code(table, temp);
-	if (tshut_value == table.data_mask)
+	if (tshut_value == table->data_mask)
 		return;
 
 	writel_relaxed(tshut_value, regs + TSADCV2_COMP_SHUT(chn));
@@ -885,7 +885,7 @@ static int rockchip_thermal_set_trips(void *_sensor, int low, int high)
 	dev_dbg(&thermal->pdev->dev, "%s: sensor %d: low: %d, high %d\n",
 		__func__, sensor->id, low, high);
 
-	tsadc->set_alarm_temp(tsadc->table,
+	tsadc->set_alarm_temp(&tsadc->table,
 			      sensor->id, thermal->regs, high);
 
 	return 0;
@@ -898,7 +898,7 @@ static int rockchip_thermal_get_temp(void *_sensor, int *out_temp)
 	const struct rockchip_tsadc_chip *tsadc = sensor->thermal->chip;
 	int retval;
 
-	retval = tsadc->get_temp(tsadc->table,
+	retval = tsadc->get_temp(&tsadc->table,
 				 sensor->id, thermal->regs, out_temp);
 	dev_dbg(&thermal->pdev->dev, "sensor %d - temp: %d, retval: %d\n",
 		sensor->id, *out_temp, retval);
@@ -984,7 +984,7 @@ rockchip_thermal_register_sensor(struct platform_device *pdev,
 	int error;
 
 	tsadc->set_tshut_mode(id, thermal->regs, thermal->tshut_mode);
-	tsadc->set_tshut_temp(tsadc->table, id, thermal->regs,
+	tsadc->set_tshut_temp(&tsadc->table, id, thermal->regs,
 			      thermal->tshut_temp);
 
 	sensor->thermal = thermal;
@@ -1198,7 +1198,7 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev)
 
 		thermal->chip->set_tshut_mode(id, thermal->regs,
 					      thermal->tshut_mode);
-		thermal->chip->set_tshut_temp(thermal->chip->table,
+		thermal->chip->set_tshut_temp(&thermal->chip->table,
 					      id, thermal->regs,
 					      thermal->tshut_temp);
 	}
-- 
2.7.4

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

* [PATCH v4 3/5] thermal: rockchip: fixes invalid temperature case
  2016-12-12 11:05 [PATCH v4 0/5] thermal: fixes the rockchip thermal Caesar Wang
  2016-12-12 11:05 ` [PATCH v4 1/5] thermal: rockchip: improve conversion error messages Caesar Wang
  2016-12-12 11:05 ` [PATCH v4 2/5] thermal: rockchip: don't pass table structs by value Caesar Wang
@ 2016-12-12 11:05 ` Caesar Wang
  2016-12-12 11:05 ` [PATCH v4 4/5] thermal: rockchip: optimize the conversion table Caesar Wang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Caesar Wang @ 2016-12-12 11:05 UTC (permalink / raw)
  To: edubezval, rui.zhang
  Cc: linux-rockchip, linux-pm, briannorris, linux-kernel, smbarber,
	Caesar Wang

The temp_to_code function will return 0 when we set the temperature to a
invalid value (e.g. 61C, 62C, 63C....), that's unpractical. This patch
will prevent this case happening. That will return the max analog value to
indicate the temperature is invalid or over table temperature range.

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

Changes in v4: None
Changes in v3:
- fix trivial thing for error message nd return value.

Changes in v2:
- As Brian commnets that restructure this to pass error codes back to the
  upper layers.
- Improve the commit message.

Changes in v1: None

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

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index 415e0ce..f027b86 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -120,10 +120,10 @@ struct rockchip_tsadc_chip {
 	/* Per-sensor methods */
 	int (*get_temp)(const struct chip_tsadc_table *table,
 			int chn, void __iomem *reg, int *temp);
-	void (*set_alarm_temp)(const struct chip_tsadc_table *table,
-			       int chn, void __iomem *reg, int temp);
-	void (*set_tshut_temp)(const struct chip_tsadc_table *table,
-			       int chn, void __iomem *reg, int temp);
+	int (*set_alarm_temp)(const struct chip_tsadc_table *table,
+			      int chn, void __iomem *reg, int temp);
+	int (*set_tshut_temp)(const struct chip_tsadc_table *table,
+			      int chn, void __iomem *reg, int temp);
 	void (*set_tshut_mode)(int chn, void __iomem *reg, enum tshut_mode m);
 
 	/* Per-table methods */
@@ -401,17 +401,15 @@ static u32 rk_tsadcv2_temp_to_code(const struct chip_tsadc_table *table,
 				   int temp)
 {
 	int high, low, mid;
-	u32 error = 0;
+	u32 error = table->data_mask;
 
 	low = 0;
 	high = table->length - 1;
 	mid = (high + low) / 2;
 
 	/* Return mask code data when the temp is over table range */
-	if (temp < table->id[low].temp || temp > table->id[high].temp) {
-		error = table->data_mask;
+	if (temp < table->id[low].temp || temp > table->id[high].temp)
 		goto exit;
-	}
 
 	while (low <= high) {
 		if (temp == table->id[mid].temp)
@@ -650,15 +648,15 @@ static int rk_tsadcv2_get_temp(const struct chip_tsadc_table *table,
 	return rk_tsadcv2_code_to_temp(table, val, temp);
 }
 
-static void rk_tsadcv2_alarm_temp(const struct chip_tsadc_table *table,
-				  int chn, void __iomem *regs, int temp)
+static int 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;
+		return -ERANGE;
 
 	writel_relaxed(alarm_value & table->data_mask,
 		       regs + TSADCV2_COMP_INT(chn));
@@ -666,23 +664,27 @@ static void rk_tsadcv2_alarm_temp(const struct chip_tsadc_table *table,
 	int_en = readl_relaxed(regs + TSADCV2_INT_EN);
 	int_en |= TSADCV2_INT_SRC_EN(chn);
 	writel_relaxed(int_en, regs + TSADCV2_INT_EN);
+
+	return 0;
 }
 
-static void rk_tsadcv2_tshut_temp(const struct chip_tsadc_table *table,
-				  int chn, void __iomem *regs, int temp)
+static int rk_tsadcv2_tshut_temp(const struct chip_tsadc_table *table,
+				 int chn, void __iomem *regs, int temp)
 {
 	u32 tshut_value, val;
 
 	/* Make sure the value is valid */
 	tshut_value = rk_tsadcv2_temp_to_code(table, temp);
 	if (tshut_value == table->data_mask)
-		return;
+		return -ERANGE;
 
 	writel_relaxed(tshut_value, regs + TSADCV2_COMP_SHUT(chn));
 
 	/* TSHUT will be valid */
 	val = readl_relaxed(regs + TSADCV2_AUTO_CON);
 	writel_relaxed(val | TSADCV2_AUTO_SRC_EN(chn), regs + TSADCV2_AUTO_CON);
+
+	return 0;
 }
 
 static void rk_tsadcv2_tshut_mode(int chn, void __iomem *regs,
@@ -885,10 +887,8 @@ static int rockchip_thermal_set_trips(void *_sensor, int low, int high)
 	dev_dbg(&thermal->pdev->dev, "%s: sensor %d: low: %d, high %d\n",
 		__func__, sensor->id, low, high);
 
-	tsadc->set_alarm_temp(&tsadc->table,
-			      sensor->id, thermal->regs, high);
-
-	return 0;
+	return tsadc->set_alarm_temp(&tsadc->table,
+				     sensor->id, thermal->regs, high);
 }
 
 static int rockchip_thermal_get_temp(void *_sensor, int *out_temp)
@@ -984,8 +984,12 @@ rockchip_thermal_register_sensor(struct platform_device *pdev,
 	int error;
 
 	tsadc->set_tshut_mode(id, thermal->regs, thermal->tshut_mode);
-	tsadc->set_tshut_temp(&tsadc->table, id, thermal->regs,
+
+	error = tsadc->set_tshut_temp(&tsadc->table, id, thermal->regs,
 			      thermal->tshut_temp);
+	if (error)
+		dev_err(&pdev->dev, "%s: invalid tshut=%d, error=%d\n",
+			__func__, thermal->tshut_temp, error);
 
 	sensor->thermal = thermal;
 	sensor->id = id;
@@ -1198,9 +1202,13 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev)
 
 		thermal->chip->set_tshut_mode(id, thermal->regs,
 					      thermal->tshut_mode);
-		thermal->chip->set_tshut_temp(&thermal->chip->table,
+
+		error = thermal->chip->set_tshut_temp(&thermal->chip->table,
 					      id, thermal->regs,
 					      thermal->tshut_temp);
+		if (error)
+			dev_err(&pdev->dev, "%s: invalid tshut=%d, error=%d\n",
+				__func__, thermal->tshut_temp, error);
 	}
 
 	thermal->chip->control(thermal->regs, true);
-- 
2.7.4

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

* [PATCH v4 4/5] thermal: rockchip: optimize the conversion table
  2016-12-12 11:05 [PATCH v4 0/5] thermal: fixes the rockchip thermal Caesar Wang
                   ` (2 preceding siblings ...)
  2016-12-12 11:05 ` [PATCH v4 3/5] thermal: rockchip: fixes invalid temperature case Caesar Wang
@ 2016-12-12 11:05 ` Caesar Wang
  2016-12-12 11:05 ` [PATCH v4 5/5] thermal: rockchip: handle set_trips without the trip points Caesar Wang
  2016-12-30 16:11 ` [PATCH v4 0/5] thermal: fixes the rockchip thermal ayaka
  5 siblings, 0 replies; 14+ messages in thread
From: Caesar Wang @ 2016-12-12 11:05 UTC (permalink / raw)
  To: edubezval, rui.zhang
  Cc: linux-rockchip, linux-pm, briannorris, linux-kernel, smbarber,
	Caesar Wang

In order to support the valid temperature can conver to analog value.
The rockchip thermal driver has not supported the all valid temperature
to convert the analog value. (e.g.: 61C, 62C, 63C....)

For example:
In some cases, we need adjust the trip point.
$cd /sys/class/thermal/thermal_zone*
$echo 68000 > trip_point_0_temp
That will return the max analogic value indicates the invalid before
posting this patch.

So, this patch will optimize the conversion table to support the other
cases.

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

Changes in v4:
- Print a better name.
- As Eduardo commented on https://patchwork.kernel.org/patch/9449313/
- remove the Brain's review for previous version, since the new version
  update something.

Changes in v3: None
Changes in v2:
- improve the commit as Brian commnets on https://patchwork.kernel.org/patch/9440985

Changes in v1: None

 drivers/thermal/rockchip_thermal.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
index f027b86..cacc12b 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -317,6 +317,7 @@ static const struct tsadc_table rk3288_code_table[] = {
 	{3452, 115000},
 	{3437, 120000},
 	{3421, 125000},
+	{0, 125000},
 };
 
 static const struct tsadc_table rk3368_code_table[] = {
@@ -401,10 +402,12 @@ static u32 rk_tsadcv2_temp_to_code(const struct chip_tsadc_table *table,
 				   int temp)
 {
 	int high, low, mid;
+	unsigned long num;
+	unsigned int denom;
 	u32 error = table->data_mask;
 
 	low = 0;
-	high = table->length - 1;
+	high = (table->length - 1) - 1; /* ignore the last check for table */
 	mid = (high + low) / 2;
 
 	/* Return mask code data when the temp is over table range */
@@ -421,6 +424,26 @@ static u32 rk_tsadcv2_temp_to_code(const struct chip_tsadc_table *table,
 		mid = (low + high) / 2;
 	}
 
+	/*
+	 * The conversion code granularity provided by the table. Let's
+	 * assume that the relationship between temperature and
+	 * analog value between 2 table entries is linear and interpolate
+	 * to produce less granular result.
+	 */
+	num = abs(table->id[mid + 1].code - table->id[mid].code);
+	num *= temp - table->id[mid].temp;
+	denom = table->id[mid + 1].temp - table->id[mid].temp;
+
+	switch (table->mode) {
+	case ADC_DECREMENT:
+		return table->id[mid].code - (num / denom);
+	case ADC_INCREMENT:
+		return table->id[mid].code + (num / denom);
+	default:
+		pr_err("%s: unknown table mode: %d\n", __func__, table->mode);
+		return error;
+	}
+
 exit:
 	pr_err("%s: invalid temperature, temp=%d error=%d\n",
 	       __func__, temp, error);
-- 
2.7.4

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

* [PATCH v4 5/5] thermal: rockchip: handle set_trips without the trip points
  2016-12-12 11:05 [PATCH v4 0/5] thermal: fixes the rockchip thermal Caesar Wang
                   ` (3 preceding siblings ...)
  2016-12-12 11:05 ` [PATCH v4 4/5] thermal: rockchip: optimize the conversion table Caesar Wang
@ 2016-12-12 11:05 ` Caesar Wang
  2016-12-30 16:11 ` [PATCH v4 0/5] thermal: fixes the rockchip thermal ayaka
  5 siblings, 0 replies; 14+ messages in thread
From: Caesar Wang @ 2016-12-12 11:05 UTC (permalink / raw)
  To: edubezval, rui.zhang
  Cc: linux-rockchip, linux-pm, briannorris, linux-kernel, smbarber,
	Caesar Wang

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@rock-chips.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
---

Changes in v4: None
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 cacc12b..cbbf0ce 100644
--- a/drivers/thermal/rockchip_thermal.c
+++ b/drivers/thermal/rockchip_thermal.c
@@ -674,7 +674,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

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

* Re: [PATCH v4 0/5] thermal: fixes the rockchip thermal
  2016-12-12 11:05 [PATCH v4 0/5] thermal: fixes the rockchip thermal Caesar Wang
                   ` (4 preceding siblings ...)
  2016-12-12 11:05 ` [PATCH v4 5/5] thermal: rockchip: handle set_trips without the trip points Caesar Wang
@ 2016-12-30 16:11 ` ayaka
  2017-01-02 13:16   ` Caesar Wang
  5 siblings, 1 reply; 14+ messages in thread
From: ayaka @ 2016-12-30 16:11 UTC (permalink / raw)
  To: Caesar Wang, edubezval, rui.zhang
  Cc: linux-pm, briannorris, linux-kernel, smbarber, linux-rockchip, randy.li


BTW, Caesar have you ever met this at RK3288 at booting time?
[    8.430582] thermal thermal_zone1: critical temperature reached(125 
C),shutting down
[    8.439038] thermal thermal_zone2: critical temperature reached(125 
C),shutting down
[    8.456344] thermal thermal_zone1: critical temperature reached(125 
C),shutting down
[    8.465298] thermal thermal_zone2: critical temperature reached(125 
C),shutting down

On 12/12/2016 07:05 PM, Caesar Wang wrote:
> There are five patches posted for upstream.
> 89267b5 thermal: rockchip: improve conversion error messages
> a0b5649 thermal: rockchip: don't pass table structs by value
> bceed92 thermal: rockchip: fixes invalid temperature case
> 30be6d0 thermal: rockchip: optimize the conversion table
> 35636e9 thermal: rockchip: handle the set_trips without the trip points.
> --
>
> History version:
> V1:
> https://lkml.org/lkml/2016/11/22/250
> V2:
> https://lkml.org/lkml/2016/11/23/348
> V3:
> http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1281432.html
> ---
>
> Brain posted the below patches for upstream.
> 89267b5 thermal: rockchip: improve conversion error messages
> a0b5649 thermal: rockchip: don't pass table structs by value
> That make sense to improve efficiency
>
> Caesar post the below patches for upstream.
> bceed92 thermal: rockchip: fixes invalid temperature case
> 30be6d0 thermal: rockchip: optimize the conversion table
> 35636e9 thermal: rockchip: handle the set_trips without the trip points.
> That will fixes some issues in special cases.
> --
>
> Anyway, this series patches should can improve the rockchip thermal driver.
>
>
> Changes in v4:
> - As Eduardo and Brian commnets on
>    https://patchwork.kernel.org/patch/9449301
> - Print a better name.
> - As Eduardo commented on https://patchwork.kernel.org/patch/9449313/
> - remove the Brain's review for previous version, since the new version
>    update something.
>
> Changes in v3:
> - fix trivial thing for error message nd return value.
> - change the commit.
> - Fixes something as Brian comments on
>
> Changes in v2:
> - As Brian commnets that restructure this to pass error codes back to the
>    upper layers.
> - Improve the commit message.
> - improve the commit as Brian commnets on https://patchwork.kernel.org/patch/9440985
> - Fixes something as Brian comments on
>    https://patchwork.kernel.org/patch/9440989.
>
> Changes in v1:
> - The original Brian posted on https://patchwork.kernel.org/patch/9437686
>    Note: it'd probably be even nicer to know which sensor this was, but we've
>    kinda abstracted that one away by this point...
> - The original Brian posted on https://patchwork.kernel.org/patch/9437687
>
> Brian Norris (2):
>    thermal: rockchip: improve conversion error messages
>    thermal: rockchip: don't pass table structs by value
>
> Caesar Wang (3):
>    thermal: rockchip: fixes invalid temperature case
>    thermal: rockchip: optimize the conversion table
>    thermal: rockchip: handle set_trips without the trip points
>
>   drivers/thermal/rockchip_thermal.c | 153 ++++++++++++++++++++++++-------------
>   1 file changed, 100 insertions(+), 53 deletions(-)
>

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

* Re: [PATCH v4 0/5] thermal: fixes the rockchip thermal
  2016-12-30 16:11 ` [PATCH v4 0/5] thermal: fixes the rockchip thermal ayaka
@ 2017-01-02 13:16   ` Caesar Wang
  2017-01-02 23:57     ` Randy Li
  0 siblings, 1 reply; 14+ messages in thread
From: Caesar Wang @ 2017-01-02 13:16 UTC (permalink / raw)
  To: ayaka
  Cc: edubezval, rui.zhang, linux-pm, briannorris, linux-kernel,
	smbarber, linux-rockchip, randy.li

在 2016年12月31日 00:11, ayaka 写道:
>
> BTW, Caesar have you ever met this at RK3288 at booting time?
> [    8.430582] thermal thermal_zone1: critical temperature reached(125 
> C),shutting down
> [    8.439038] thermal thermal_zone2: critical temperature reached(125 
> C),shutting down
> [    8.456344] thermal thermal_zone1: critical temperature reached(125 
> C),shutting down
> [    8.465298] thermal thermal_zone2: critical temperature reached(125 
> C),shutting down

125C? the thermal zone isn't the upstream kernel, what's the kernel 
version?
Anyway, look like,  the TSHUT issue. Do you have the below patches for 
your linux kernel?
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/380446.html


-Caesar

>
> On 12/12/2016 07:05 PM, Caesar Wang wrote:
>> There are five patches posted for upstream.
>> 89267b5 thermal: rockchip: improve conversion error messages
>> a0b5649 thermal: rockchip: don't pass table structs by value
>> bceed92 thermal: rockchip: fixes invalid temperature case
>> 30be6d0 thermal: rockchip: optimize the conversion table
>> 35636e9 thermal: rockchip: handle the set_trips without the trip points.
>> -- 
>>
>> History version:
>> V1:
>> https://lkml.org/lkml/2016/11/22/250
>> V2:
>> https://lkml.org/lkml/2016/11/23/348
>> V3:
>> http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1281432.html
>> ---
>>
>> Brain posted the below patches for upstream.
>> 89267b5 thermal: rockchip: improve conversion error messages
>> a0b5649 thermal: rockchip: don't pass table structs by value
>> That make sense to improve efficiency
>>
>> Caesar post the below patches for upstream.
>> bceed92 thermal: rockchip: fixes invalid temperature case
>> 30be6d0 thermal: rockchip: optimize the conversion table
>> 35636e9 thermal: rockchip: handle the set_trips without the trip points.
>> That will fixes some issues in special cases.
>> -- 
>>
>> Anyway, this series patches should can improve the rockchip thermal 
>> driver.
>>
>>
>> Changes in v4:
>> - As Eduardo and Brian commnets on
>>    https://patchwork.kernel.org/patch/9449301
>> - Print a better name.
>> - As Eduardo commented on https://patchwork.kernel.org/patch/9449313/
>> - remove the Brain's review for previous version, since the new version
>>    update something.
>>
>> Changes in v3:
>> - fix trivial thing for error message nd return value.
>> - change the commit.
>> - Fixes something as Brian comments on
>>
>> Changes in v2:
>> - As Brian commnets that restructure this to pass error codes back to 
>> the
>>    upper layers.
>> - Improve the commit message.
>> - improve the commit as Brian commnets on 
>> https://patchwork.kernel.org/patch/9440985
>> - Fixes something as Brian comments on
>>    https://patchwork.kernel.org/patch/9440989.
>>
>> Changes in v1:
>> - The original Brian posted on 
>> https://patchwork.kernel.org/patch/9437686
>>    Note: it'd probably be even nicer to know which sensor this was, 
>> but we've
>>    kinda abstracted that one away by this point...
>> - The original Brian posted on 
>> https://patchwork.kernel.org/patch/9437687
>>
>> Brian Norris (2):
>>    thermal: rockchip: improve conversion error messages
>>    thermal: rockchip: don't pass table structs by value
>>
>> Caesar Wang (3):
>>    thermal: rockchip: fixes invalid temperature case
>>    thermal: rockchip: optimize the conversion table
>>    thermal: rockchip: handle set_trips without the trip points
>>
>>   drivers/thermal/rockchip_thermal.c | 153 
>> ++++++++++++++++++++++++-------------
>>   1 file changed, 100 insertions(+), 53 deletions(-)
>>
>
>
>
>

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

* Re: [PATCH v4 0/5] thermal: fixes the rockchip thermal
  2017-01-02 13:16   ` Caesar Wang
@ 2017-01-02 23:57     ` Randy Li
  2017-01-03  1:02       ` Caesar Wang
  0 siblings, 1 reply; 14+ messages in thread
From: Randy Li @ 2017-01-02 23:57 UTC (permalink / raw)
  To: Caesar Wang, ayaka
  Cc: linux-pm, briannorris, linux-kernel, smbarber, edubezval,
	linux-rockchip, rui.zhang



On 01/02/2017 09:16 PM, Caesar Wang wrote:
> 在 2016年12月31日 00:11, ayaka 写道:
>>
>> BTW, Caesar have you ever met this at RK3288 at booting time?
>> [    8.430582] thermal thermal_zone1: critical temperature 
>> reached(125 C),shutting down
>> [    8.439038] thermal thermal_zone2: critical temperature 
>> reached(125 C),shutting down
>> [    8.456344] thermal thermal_zone1: critical temperature 
>> reached(125 C),shutting down
>> [    8.465298] thermal thermal_zone2: critical temperature 
>> reached(125 C),shutting down
>
> 125C? the thermal zone isn't the upstream kernel, what's the kernel 
> version?
They have been merged into the linux-next.
> Anyway, look like,  the TSHUT issue. Do you have the below patches for 
> your linux kernel?
> http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/380446.html 
>
No, could you resubmit those patches ?
>
>
> -Caesar
>
>>
>> On 12/12/2016 07:05 PM, Caesar Wang wrote:
>>> There are five patches posted for upstream.
>>> 89267b5 thermal: rockchip: improve conversion error messages
>>> a0b5649 thermal: rockchip: don't pass table structs by value
>>> bceed92 thermal: rockchip: fixes invalid temperature case
>>> 30be6d0 thermal: rockchip: optimize the conversion table
>>> 35636e9 thermal: rockchip: handle the set_trips without the trip 
>>> points.
>>> -- 
>>>
>>> History version:
>>> V1:
>>> https://lkml.org/lkml/2016/11/22/250
>>> V2:
>>> https://lkml.org/lkml/2016/11/23/348
>>> V3:
>>> http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1281432.html 
>>>
>>> ---
>>>
>>> Brain posted the below patches for upstream.
>>> 89267b5 thermal: rockchip: improve conversion error messages
>>> a0b5649 thermal: rockchip: don't pass table structs by value
>>> That make sense to improve efficiency
>>>
>>> Caesar post the below patches for upstream.
>>> bceed92 thermal: rockchip: fixes invalid temperature case
>>> 30be6d0 thermal: rockchip: optimize the conversion table
>>> 35636e9 thermal: rockchip: handle the set_trips without the trip 
>>> points.
>>> That will fixes some issues in special cases.
>>> -- 
>>>
>>> Anyway, this series patches should can improve the rockchip thermal 
>>> driver.
>>>
>>>
>>> Changes in v4:
>>> - As Eduardo and Brian commnets on
>>>    https://patchwork.kernel.org/patch/9449301
>>> - Print a better name.
>>> - As Eduardo commented on https://patchwork.kernel.org/patch/9449313/
>>> - remove the Brain's review for previous version, since the new version
>>>    update something.
>>>
>>> Changes in v3:
>>> - fix trivial thing for error message nd return value.
>>> - change the commit.
>>> - Fixes something as Brian comments on
>>>
>>> Changes in v2:
>>> - As Brian commnets that restructure this to pass error codes back 
>>> to the
>>>    upper layers.
>>> - Improve the commit message.
>>> - improve the commit as Brian commnets on 
>>> https://patchwork.kernel.org/patch/9440985
>>> - Fixes something as Brian comments on
>>>    https://patchwork.kernel.org/patch/9440989.
>>>
>>> Changes in v1:
>>> - The original Brian posted on 
>>> https://patchwork.kernel.org/patch/9437686
>>>    Note: it'd probably be even nicer to know which sensor this was, 
>>> but we've
>>>    kinda abstracted that one away by this point...
>>> - The original Brian posted on 
>>> https://patchwork.kernel.org/patch/9437687
>>>
>>> Brian Norris (2):
>>>    thermal: rockchip: improve conversion error messages
>>>    thermal: rockchip: don't pass table structs by value
>>>
>>> Caesar Wang (3):
>>>    thermal: rockchip: fixes invalid temperature case
>>>    thermal: rockchip: optimize the conversion table
>>>    thermal: rockchip: handle set_trips without the trip points
>>>
>>>   drivers/thermal/rockchip_thermal.c | 153 
>>> ++++++++++++++++++++++++-------------
>>>   1 file changed, 100 insertions(+), 53 deletions(-)
>>>
>>
>>
>>
>>
>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* Re: [PATCH v4 0/5] thermal: fixes the rockchip thermal
  2017-01-02 23:57     ` Randy Li
@ 2017-01-03  1:02       ` Caesar Wang
  2017-01-03  1:13         ` Randy Li
  0 siblings, 1 reply; 14+ messages in thread
From: Caesar Wang @ 2017-01-03  1:02 UTC (permalink / raw)
  To: Randy Li, ayaka
  Cc: Caesar Wang, linux-pm, briannorris, linux-kernel, smbarber,
	edubezval, linux-rockchip, rui.zhang


在 2017年01月03日 07:57, Randy Li 写道:
>
> On 01/02/2017 09:16 PM, Caesar Wang wrote:
>> 在 2016年12月31日 00:11, ayaka 写道:
>>>
>>> BTW, Caesar have you ever met this at RK3288 at booting time?
>>> [    8.430582] thermal thermal_zone1: critical temperature 
>>> reached(125 C),shutting down
>>> [    8.439038] thermal thermal_zone2: critical temperature 
>>> reached(125 C),shutting down
>>> [    8.456344] thermal thermal_zone1: critical temperature 
>>> reached(125 C),shutting down
>>> [    8.465298] thermal thermal_zone2: critical temperature 
>>> reached(125 C),shutting down
>>
>> 125C? the thermal zone isn't the upstream kernel, what's the kernel 
>> version?
> They have been merged into the linux-next.

Really?
I saw the 90 degree is the critical temperature on rk3288 dts .
kernel$ vi arch/arm/boot/dts/rk3288.dtsi
             cpu_crit: cpu_crit {
                     temperature = <90000>; /* millicelsius */
                     hysteresis = <2000>; /* millicelsius */
                     type = "critical";
                 };

>> Anyway, look like,  the TSHUT issue. Do you have the below patches 
>> for your linux kernel?
>> http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/380446.html 
>>
> No, could you resubmit those patches ?

These patches had merged for upstream.

-Caesar

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

* Re: [PATCH v4 0/5] thermal: fixes the rockchip thermal
  2017-01-03  1:02       ` Caesar Wang
@ 2017-01-03  1:13         ` Randy Li
  2017-01-03 16:30           ` ayaka
  0 siblings, 1 reply; 14+ messages in thread
From: Randy Li @ 2017-01-03  1:13 UTC (permalink / raw)
  To: Caesar Wang
  Cc: ayaka, Caesar Wang, linux-pm, briannorris, linux-kernel,
	smbarber, edubezval, linux-rockchip, rui.zhang



On 01/03/2017 09:02 AM, Caesar Wang wrote:
>
> 在 2017年01月03日 07:57, Randy Li 写道:
>>
>> On 01/02/2017 09:16 PM, Caesar Wang wrote:
>>> 在 2016年12月31日 00:11, ayaka 写道:
>>>>
>>>> BTW, Caesar have you ever met this at RK3288 at booting time?
>>>> [    8.430582] thermal thermal_zone1: critical temperature
>>>> reached(125 C),shutting down
>>>> [    8.439038] thermal thermal_zone2: critical temperature
>>>> reached(125 C),shutting down
>>>> [    8.456344] thermal thermal_zone1: critical temperature
>>>> reached(125 C),shutting down
>>>> [    8.465298] thermal thermal_zone2: critical temperature
>>>> reached(125 C),shutting down
>>>
>>> 125C? the thermal zone isn't the upstream kernel, what's the kernel
>>> version?
>> They have been merged into the linux-next.
>
> Really?
> I saw the 90 degree is the critical temperature on rk3288 dts .
Yes I do.
> kernel$ vi arch/arm/boot/dts/rk3288.dtsi
>             cpu_crit: cpu_crit {
>                     temperature = <90000>; /* millicelsius */
>                     hysteresis = <2000>; /* millicelsius */
>                     type = "critical";
>                 };
>
>>> Anyway, look like,  the TSHUT issue. Do you have the below patches
>>> for your linux kernel?
>>> http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/380446.html
>>>
>> No, could you resubmit those patches ?
>
> These patches had merged for upstream.
Sorry, it is my fault, I mistake that commit. Those patches are merged 
in next-20161224. I would bring a board for you later.
>
> -Caesar
>
>

-- 
Randy Li
The third produce department
===========================================================================
This email message, including any attachments, is for the sole
use of the intended recipient(s) and may contain confidential and
privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply e-mail and destroy all copies of the original
message. [Fuzhou Rockchip Electronics, INC. China mainland]
===========================================================================

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

* Re: [PATCH v4 0/5] thermal: fixes the rockchip thermal
  2017-01-03  1:13         ` Randy Li
@ 2017-01-03 16:30           ` ayaka
  2017-01-14 16:54             ` Eduardo Valentin
  0 siblings, 1 reply; 14+ messages in thread
From: ayaka @ 2017-01-03 16:30 UTC (permalink / raw)
  To: Caesar Wang
  Cc: Randy Li, Caesar Wang, linux-pm, briannorris, linux-kernel,
	smbarber, edubezval, linux-rockchip, rui.zhang



On 01/03/2017 09:13 AM, Randy Li wrote:
>
>
> On 01/03/2017 09:02 AM, Caesar Wang wrote:
>>
>> 在 2017年01月03日 07:57, Randy Li 写道:
>>>
>>> On 01/02/2017 09:16 PM, Caesar Wang wrote:
>>>> 在 2016年12月31日 00:11, ayaka 写道:
>>>>>
>>>>> BTW, Caesar have you ever met this at RK3288 at booting time?
>>>>> [    8.430582] thermal thermal_zone1: critical temperature
>>>>> reached(125 C),shutting down
>>>>> [    8.439038] thermal thermal_zone2: critical temperature
>>>>> reached(125 C),shutting down
>>>>> [    8.456344] thermal thermal_zone1: critical temperature
>>>>> reached(125 C),shutting down
>>>>> [    8.465298] thermal thermal_zone2: critical temperature
>>>>> reached(125 C),shutting down
>>>>
>>>> 125C? the thermal zone isn't the upstream kernel, what's the kernel
>>>> version?
>>> They have been merged into the linux-next.
>>
>> Really?
>> I saw the 90 degree is the critical temperature on rk3288 dts .
> Yes I do.
>> kernel$ vi arch/arm/boot/dts/rk3288.dtsi
>>             cpu_crit: cpu_crit {
>>                     temperature = <90000>; /* millicelsius */
>>                     hysteresis = <2000>; /* millicelsius */
>>                     type = "critical";
>>                 };
>>
>>>> Anyway, look like,  the TSHUT issue. Do you have the below patches
>>>> for your linux kernel?
>>>> http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/380446.html 
>>>>
>>>>
>>> No, could you resubmit those patches ?
>>
>> These patches had merged for upstream.
> Sorry, it is my fault, I mistake that commit. Those patches are merged 
> in next-20161224. I would bring a board for you later.
I check the schematic, the otp interrupt is not used at firefly reload 
nor connected to the control of PMIC.
I also check power supply, the power is PD_PERI domain comes from 
VD_LOGIC which is always on all the platform.
It more likely the tsadc doesn't report correctly temperature value?
>>
>> -Caesar
>>
>>
>

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

* Re: [PATCH v4 0/5] thermal: fixes the rockchip thermal
  2017-01-03 16:30           ` ayaka
@ 2017-01-14 16:54             ` Eduardo Valentin
  2017-01-15  3:35               ` ayaka
  0 siblings, 1 reply; 14+ messages in thread
From: Eduardo Valentin @ 2017-01-14 16:54 UTC (permalink / raw)
  To: ayaka
  Cc: Caesar Wang, Randy Li, Caesar Wang, linux-pm, briannorris,
	linux-kernel, smbarber, linux-rockchip, rui.zhang

Folks,

On Wed, Jan 04, 2017 at 12:30:40AM +0800, ayaka wrote:
> 
> 
> On 01/03/2017 09:13 AM, Randy Li wrote:
> >
> >
> >On 01/03/2017 09:02 AM, Caesar Wang wrote:
> >>
> >>在 2017年01月03日 07:57, Randy Li 写道:
> >>>
> >>>On 01/02/2017 09:16 PM, Caesar Wang wrote:
> >>>>在 2016年12月31日 00:11, ayaka 写道:
> >>>>>
> >>>>>BTW, Caesar have you ever met this at RK3288 at booting time?
> >>>>>[    8.430582] thermal thermal_zone1: critical temperature
> >>>>>reached(125 C),shutting down
> >>>>>[    8.439038] thermal thermal_zone2: critical temperature
> >>>>>reached(125 C),shutting down
> >>>>>[    8.456344] thermal thermal_zone1: critical temperature
> >>>>>reached(125 C),shutting down
> >>>>>[    8.465298] thermal thermal_zone2: critical temperature
> >>>>>reached(125 C),shutting down
> >>>>
> >>>>125C? the thermal zone isn't the upstream kernel, what's the kernel
> >>>>version?
> >>>They have been merged into the linux-next.
> >>
> >>Really?
> >>I saw the 90 degree is the critical temperature on rk3288 dts .
> >Yes I do.
> >>kernel$ vi arch/arm/boot/dts/rk3288.dtsi
> >>            cpu_crit: cpu_crit {
> >>                    temperature = <90000>; /* millicelsius */
> >>                    hysteresis = <2000>; /* millicelsius */
> >>                    type = "critical";
> >>                };
> >>
> >>>>Anyway, look like,  the TSHUT issue. Do you have the below patches
> >>>>for your linux kernel?
> >>>>http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/380446.html
> >>>>
> >>>>
> >>>No, could you resubmit those patches ?
> >>
> >>These patches had merged for upstream.
> >Sorry, it is my fault, I mistake that commit. Those patches are merged in
> >next-20161224. I would bring a board for you later.
> I check the schematic, the otp interrupt is not used at firefly reload nor
> connected to the control of PMIC.
> I also check power supply, the power is PD_PERI domain comes from VD_LOGIC
> which is always on all the platform.
> It more likely the tsadc doesn't report correctly temperature value?

Folks, I got a bit confused about this discussion. I have put these
patches into linux-next, as I did not see anything wrong with them. And
I was about to send to next -rc. 

Are these correct or not? Is it fine to move forward with them?

I believe for tomorrows rc is a bit too late, but I think they could
still go to the next rc.

BR,

> >>
> >>-Caesar
> >>
> >>
> >
> 

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

* Re: [PATCH v4 0/5] thermal: fixes the rockchip thermal
  2017-01-14 16:54             ` Eduardo Valentin
@ 2017-01-15  3:35               ` ayaka
  0 siblings, 0 replies; 14+ messages in thread
From: ayaka @ 2017-01-15  3:35 UTC (permalink / raw)
  To: Eduardo Valentin
  Cc: Caesar Wang, Randy Li, Caesar Wang, linux-pm, briannorris,
	linux-kernel, smbarber, linux-rockchip, rui.zhang



On 01/15/2017 12:54 AM, Eduardo Valentin wrote:
> Folks,
>
> On Wed, Jan 04, 2017 at 12:30:40AM +0800, ayaka wrote:
>>
>> On 01/03/2017 09:13 AM, Randy Li wrote:
>>>
>>> On 01/03/2017 09:02 AM, Caesar Wang wrote:
>>>> 在 2017年01月03日 07:57, Randy Li 写道:
>>>>> On 01/02/2017 09:16 PM, Caesar Wang wrote:
>>>>>> 在 2016年12月31日 00:11, ayaka 写道:
>>>>>>> BTW, Caesar have you ever met this at RK3288 at booting time?
>>>>>>> [    8.430582] thermal thermal_zone1: critical temperature
>>>>>>> reached(125 C),shutting down
>>>>>>> [    8.439038] thermal thermal_zone2: critical temperature
>>>>>>> reached(125 C),shutting down
>>>>>>> [    8.456344] thermal thermal_zone1: critical temperature
>>>>>>> reached(125 C),shutting down
>>>>>>> [    8.465298] thermal thermal_zone2: critical temperature
>>>>>>> reached(125 C),shutting down
>>>>>> 125C? the thermal zone isn't the upstream kernel, what's the kernel
>>>>>> version?
>>>>> They have been merged into the linux-next.
>>>> Really?
>>>> I saw the 90 degree is the critical temperature on rk3288 dts .
>>> Yes I do.
>>>> kernel$ vi arch/arm/boot/dts/rk3288.dtsi
>>>>             cpu_crit: cpu_crit {
>>>>                     temperature = <90000>; /* millicelsius */
>>>>                     hysteresis = <2000>; /* millicelsius */
>>>>                     type = "critical";
>>>>                 };
>>>>
>>>>>> Anyway, look like,  the TSHUT issue. Do you have the below patches
>>>>>> for your linux kernel?
>>>>>> http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/380446.html
>>>>>>
>>>>>>
>>>>> No, could you resubmit those patches ?
>>>> These patches had merged for upstream.
>>> Sorry, it is my fault, I mistake that commit. Those patches are merged in
>>> next-20161224. I would bring a board for you later.
>> I check the schematic, the otp interrupt is not used at firefly reload nor
>> connected to the control of PMIC.
>> I also check power supply, the power is PD_PERI domain comes from VD_LOGIC
>> which is always on all the platform.
>> It more likely the tsadc doesn't report correctly temperature value?
> Folks, I got a bit confused about this discussion. I have put these
> patches into linux-next, as I did not see anything wrong with them. And
> I was about to send to next -rc.
>
> Are these correct or not? Is it fine to move forward with them?
Yes, but you need to merge the other patch the Caesar just sent, or it 
would stop the booting sequence at rk3288.
>
> I believe for tomorrows rc is a bit too late, but I think they could
> still go to the next rc.
>
> BR,
>
>>>> -Caesar
>>>>
>>>>

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

end of thread, other threads:[~2017-01-15  3:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-12 11:05 [PATCH v4 0/5] thermal: fixes the rockchip thermal Caesar Wang
2016-12-12 11:05 ` [PATCH v4 1/5] thermal: rockchip: improve conversion error messages Caesar Wang
2016-12-12 11:05 ` [PATCH v4 2/5] thermal: rockchip: don't pass table structs by value Caesar Wang
2016-12-12 11:05 ` [PATCH v4 3/5] thermal: rockchip: fixes invalid temperature case Caesar Wang
2016-12-12 11:05 ` [PATCH v4 4/5] thermal: rockchip: optimize the conversion table Caesar Wang
2016-12-12 11:05 ` [PATCH v4 5/5] thermal: rockchip: handle set_trips without the trip points Caesar Wang
2016-12-30 16:11 ` [PATCH v4 0/5] thermal: fixes the rockchip thermal ayaka
2017-01-02 13:16   ` Caesar Wang
2017-01-02 23:57     ` Randy Li
2017-01-03  1:02       ` Caesar Wang
2017-01-03  1:13         ` Randy Li
2017-01-03 16:30           ` ayaka
2017-01-14 16:54             ` Eduardo Valentin
2017-01-15  3:35               ` ayaka

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