Skip to contentSkip to conversation

thermal/drivers/hisi: Remove confusing error message

PATCH In review Daniel Lezcano 4 participants 12 messages Jul 7, 2017 – Dec 5, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal/drivers/hisi: Remove confusing error message

The sensor id is unknown at init time and we use all id in the authorized MAX_SENSORS interval to register the sensor. On this SoC there is one thermal-zone with one sensor on it. No need to spit on the console everytime we failed to register thermal sensors, information which is deliberaly known as it is part of the discovery process.

hisi_thermal f7030700.tsensor: failed to register sensor id 0: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor: -19 hisi_thermal f7030700.tsensor: failed to register sensor id 1: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor: -19 hisi_thermal f7030700.tsensor: failed to register sensor id 3: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor: -19

Remove the error messages.

---
 drivers/thermal/hisi_thermal.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/thermal/hisi_thermal.c +6 -6
index f642966..2cc98c6 100644
@@ -187,6 +187,9 @@ static int hisi_thermal_get_temp(void *_sensor, int *temp)
 
 	dev_dbg(&data->pdev->dev, "id=%d, irq=%d, temp=%d, thres=%d\n",
 		sensor->id, data->irq_enabled, *temp, sensor->thres_temp);
+
+	printk("id=%d, irq=%d, temp=%d, thres=%d\n",
+		sensor->id, data->irq_enabled, *temp, sensor->thres_temp);
 	/*
 	 * Bind irq to sensor for two cases:
 	 *   Reenable alarm IRQ if temperature below threshold;
@@ -260,8 +263,6 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev,
 	if (IS_ERR(sensor->tzd)) {
 		ret = PTR_ERR(sensor->tzd);
 		sensor->tzd = NULL;
-		dev_err(&pdev->dev, "failed to register sensor id %d: %d\n",
-			sensor->id, ret);
 		return ret;
 	}
 
@@ -352,10 +353,9 @@ static int hisi_thermal_probe(struct platform_device *pdev)
 		ret = hisi_thermal_register_sensor(pdev, data,
 						   &data->sensors[i], i);
 		if (ret)
-			dev_err(&pdev->dev,
-				"failed to register thermal sensor: %d\n", ret);
-		else
-			hisi_thermal_toggle_sensor(&data->sensors[i], true);
+			continue;
+
+		hisi_thermal_toggle_sensor(&data->sensors[i], true);
 	}
 
 	return 0;
Signature · 1 line
2.7.4
reviewer
#1 lore raw
Quoted 41 lines · Daniel Lezcano

The sensor id is unknown at init time and we use all id in the authorized
MAX_SENSORS interval to register the sensor. On this SoC there is one thermal-zone with one sensor on it. No need to spit on the console everytime we
failed to register thermal sensors, information which is deliberaly known as it
is part of the discovery process.

 hisi_thermal f7030700.tsensor: failed to register sensor id 0: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor:
-19
 hisi_thermal f7030700.tsensor: failed to register sensor id 1: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor:
-19
 hisi_thermal f7030700.tsensor: failed to register sensor id 3: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor:
-19

Remove the error messages.

---
 drivers/thermal/hisi_thermal.c | 12 ++++++------

 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/thermal/hisi_thermal.c +0 -0
index f642966..2cc98c6 100644
@@ -187,6 +187,9 @@ static int hisi_thermal_get_temp(void *_sensor,
 int *temp)


  dev_dbg(&data->pdev->dev, "id=%d, irq=%d, temp=%d, thres=%d\n",
  sensor->id, data->irq_enabled, *temp, sensor-

Quoted 1 line

thres_temp);

drivers/thermal/hisi_thermal.c +3 -0
+
+	printk("id=%d, irq=%d, temp=%d, thres=%d\n",
+		sensor->id, data->irq_enabled, *temp, sensor-
Quoted 1 line
Quoted 1 line

thres_temp);

what's this printk for?

Quoted 29 lines

  /*
   * Bind irq to sensor for two cases:
   *   Reenable alarm IRQ if temperature below threshold;

drivers/thermal/hisi_thermal.c +0 -2
@@ -260,8 +263,6 @@ static int hisi_thermal_register_sensor(struct
 platform_device *pdev,
  	if (IS_ERR(sensor->tzd)) {
  		ret = PTR_ERR(sensor->tzd);
  		sensor->tzd = NULL;
-		dev_err(&pdev->dev, "failed to register sensor id
 %d: %d\n",
-			sensor->id, ret);
  		return ret;

  }

drivers/thermal/hisi_thermal.c +0 -0
@@ -352,10 +353,9 @@ static int hisi_thermal_probe(struct
 platform_device *pdev)
  		ret = hisi_thermal_register_sensor(pdev, data,

     &data-

Quoted 1 line

sensors[i], i);

  if (ret)

drivers/thermal/hisi_thermal.c +0 -2
-			dev_err(&pdev->dev,
-				"failed to register thermal sensor:

%d\n", ret);

drivers/thermal/hisi_thermal.c +0 -2
-		else
-			hisi_thermal_toggle_sensor(&data-
Quoted 1 line

sensors[i], true);

drivers/thermal/hisi_thermal.c +3 -0
+			continue;
+
+		hisi_thermal_toggle_sensor(&data->sensors[i], true);
Quoted 3 lines

  }

  return 0;

With these removed, is there any other information in dmesg that suggests this failure?

thanks,
rui

#2 lore raw
Quoted 38 lines · Zhang Rui
Quoted 37 lines · Daniel Lezcano

The sensor id is unknown at init time and we use all id in the authorized
MAX_SENSORS interval to register the sensor. On this SoC there is one thermal-zone with one sensor on it. No need to spit on the console everytime we
failed to register thermal sensors, information which is deliberaly known as it
is part of the discovery process.

hisi_thermal f7030700.tsensor: failed to register sensor id 0: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor:
-19
hisi_thermal f7030700.tsensor: failed to register sensor id 1: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor:
-19
hisi_thermal f7030700.tsensor: failed to register sensor id 3: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor:
-19

Remove the error messages.

---
 drivers/thermal/hisi_thermal.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/thermal/hisi_thermal.c +0 -0
index f642966..2cc98c6 100644
@@ -187,6 +187,9 @@ static int hisi_thermal_get_temp(void *_sensor,
 int *temp)
 
 	dev_dbg(&data->pdev->dev, "id=%d, irq=%d, temp=%d,
 thres=%d\n",
 		sensor->id, data->irq_enabled, *temp, sensor-
Quoted 7 lines
Quoted 5 lines
drivers/thermal/hisi_thermal.c +3 -0
 > thres_temp);
+
+	printk("id=%d, irq=%d, temp=%d, thres=%d\n",
+		sensor->id, data->irq_enabled, *temp, sensor-
Quoted 1 line

thres_temp);

what's this printk for?

Argh. It shouldn't be there.

Quoted 31 lines
Quoted 31 lines
drivers/thermal/hisi_thermal.c +0 -2
 	/*
 	 * Bind irq to sensor for two cases:
 	 *   Reenable alarm IRQ if temperature below threshold;
@@ -260,8 +263,6 @@ static int hisi_thermal_register_sensor(struct
 platform_device *pdev,
 	if (IS_ERR(sensor->tzd)) {
 		ret = PTR_ERR(sensor->tzd);
 		sensor->tzd = NULL;
-		dev_err(&pdev->dev, "failed to register sensor id
 %d: %d\n",
-			sensor->id, ret);
 		return ret;
drivers/thermal/hisi_thermal.c +0 -4
 	}
@@ -352,10 +353,9 @@ static int hisi_thermal_probe(struct
 platform_device *pdev)
 		ret = hisi_thermal_register_sensor(pdev, data,
 						   &data-
 > sensors[i], i);
 		if (ret)
-			dev_err(&pdev->dev,
-				"failed to register thermal sensor:
 %d\n", ret);
-		else
-			hisi_thermal_toggle_sensor(&data-
Quoted 1 line

sensors[i], true);

drivers/thermal/hisi_thermal.c +3 -0
+			continue;
+
+		hisi_thermal_toggle_sensor(&data->sensors[i], true);
 	}
Quoted 4 lines
Quoted 1 line

return 0;

With these removed, is there any other information in dmesg that suggests this failure?

The problem is there are always failures showed in dmesg. The init function is based on the assumption there is HISI_MAX_SENSORS sensors which is not true for the hi6220 and that raises at boot time errors.

Why HISI_MAX_SENSORS(=4) while there is only one on hi6220 AFAIK? and this driver is only used for hi6220 (now).

That ends up with 3 errors in dmesg for nothing.

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
reviewer
#3 lore raw
Quoted 103 lines · Daniel Lezcano
Quoted 51 lines · Zhang Rui
Quoted 49 lines · Daniel Lezcano

The sensor id is unknown at init time and we use all id in the authorized
MAX_SENSORS interval to register the sensor. On this SoC there is one
thermal-zone with one sensor on it. No need to spit on the console
everytime we
failed to register thermal sensors, information which is deliberaly
known as it
is part of the discovery process.

 hisi_thermal f7030700.tsensor: failed to register sensor id 0:
-19
 hisi_thermal f7030700.tsensor: failed to register thermal sensor:
-19
 hisi_thermal f7030700.tsensor: failed to register sensor id 1:
-19
 hisi_thermal f7030700.tsensor: failed to register thermal sensor:
-19
 hisi_thermal f7030700.tsensor: failed to register sensor id 3:
-19
 hisi_thermal f7030700.tsensor: failed to register thermal sensor:
-19

Remove the error messages.

---
 drivers/thermal/hisi_thermal.c | 12 ++++++------

 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/thermal/hisi_thermal.c +0 -0
index f642966..2cc98c6 100644
@@ -187,6 +187,9 @@ static int hisi_thermal_get_temp(void
 *_sensor,
 int *temp)


  dev_dbg(&data->pdev->dev, "id=%d, irq=%d, temp=%d, thres=%d\n",
  sensor->id, data->irq_enabled, *temp, sensor-

Quoted 1 line
Quoted 7 lines
Quoted 6 lines
Quoted 1 line

thres_temp);

drivers/thermal/hisi_thermal.c +3 -0
+
+	printk("id=%d, irq=%d, temp=%d, thres=%d\n",
+		sensor->id, data->irq_enabled, *temp, sensor-
Quoted 2 lines

thres_temp);

what's this printk for?

Argh. It shouldn't be there.

Quoted 33 lines
Quoted 33 lines

  /*
   * Bind irq to sensor for two cases:
   *   Reenable alarm IRQ if temperature below threshold;

drivers/thermal/hisi_thermal.c +0 -0
@@ -260,8 +263,6 @@ static int

hisi_thermal_register_sensor(struct
platform_device *pdev,
  if (IS_ERR(sensor->tzd)) {
  ret = PTR_ERR(sensor->tzd);
  sensor->tzd = NULL;

drivers/thermal/hisi_thermal.c +0 -1
-		dev_err(&pdev->dev, "failed to register sensor

id
%d: %d\n",

drivers/thermal/hisi_thermal.c +0 -1
-			sensor->id, ret);

  return ret;
  }

drivers/thermal/hisi_thermal.c +0 -0
@@ -352,10 +353,9 @@ static int hisi_thermal_probe(struct
 platform_device *pdev)
  		ret = hisi_thermal_register_sensor(pdev, data,

     &data-

Quoted 2 lines

sensors[i], i);

  if (ret)

drivers/thermal/hisi_thermal.c +0 -2
-			dev_err(&pdev->dev,
-				"failed to register thermal

sensor:
%d\n", ret);

drivers/thermal/hisi_thermal.c +0 -2
-		else
-			hisi_thermal_toggle_sensor(&data-
Quoted 2 lines

sensors[i], true);

Quoted 9 lines
Quoted 7 lines
drivers/thermal/hisi_thermal.c +3 -0
+			continue;
+
+		hisi_thermal_toggle_sensor(&data->sensors[i],

true);
  }

  return 0;

With these removed, is there any other information in dmesg that suggests this failure?

Quoted 7 lines

The problem is there are always failures showed in dmesg. The init function is based on the assumption there is HISI_MAX_SENSORS sensors which is not true for the hi6220 and that raises at boot time errors.

Why HISI_MAX_SENSORS(=4) while there is only one on hi6220 AFAIK? and this driver is only used for hi6220 (now).

right, I think we should remove one error log, and then change the HISI_MAX_SENSORS to reflect the reality instead.

XinWei and Leo,
can you please help check this?

thanks,
rui

Quoted 6 lines

That ends up with 3 errors in dmesg for nothing.

#4 lore raw

On Tue, Aug 08, 2017 at 08:48:51PM +0800, Zhang Rui wrote:

[...]

Quoted 28 lines
Quoted 28 lines
Quoted 15 lines
Quoted 15 lines
(quoted diff) +0 -0
@@ -352,10 +353,9 @@ static int hisi_thermal_probe(struct
 platform_device *pdev)
  		ret = hisi_thermal_register_sensor(pdev, data,

     &data-

Quoted 2 lines

sensors[i], i);

  if (ret)

(quoted diff) +0 -2
-			dev_err(&pdev->dev,
-				"failed to register thermal

sensor:
%d\n", ret);

(quoted diff) +0 -2
-		else
-			hisi_thermal_toggle_sensor(&data-
Quoted 2 lines

sensors[i], true);

Quoted 9 lines
Quoted 7 lines
(quoted diff) +3 -0
+			continue;
+
+		hisi_thermal_toggle_sensor(&data->sensors[i],

true);
  }

  return 0;

With these removed, is there any other information in dmesg that suggests this failure?

The problem is there are always failures showed in dmesg. The init function is based on the assumption there is HISI_MAX_SENSORS sensors which is not true for the hi6220 and that raises at boot time errors.

Quoted 8 lines
Quoted 3 lines

Why HISI_MAX_SENSORS(=4) while there is only one on hi6220 AFAIK? and this driver is only used for hi6220 (now).

right, I think we should remove one error log, and then change the HISI_MAX_SENSORS to reflect the reality instead.

XinWei and Leo,
can you please help check this?

Sure.

Here I am a bit confusion and I think this is a common question for SoC thermal driver.

Hi6220 does has 4 thermal sensors, but we now only use one sensor of them (thermal sensor id 2) to bind with thermal zone and other three sensors are not bound to any thermal zone. So this is the reason the booting reports the failure.

I think changing HISI_MAX_SENSORS value cannot resolve this issue, due we are using thermal id 2. How about below change? We change to use warning for sensors without binding, and remove redundant log.

drivers/thermal/hisi_thermal.c +4 -3
index 9c3ce34..6d34980 100644
@@ -260,8 +260,6 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev,
        if (IS_ERR(sensor->tzd)) {
                ret = PTR_ERR(sensor->tzd);
                sensor->tzd = NULL;
-               dev_err(&pdev->dev, "failed to register sensor id %d: %d\n",
-                       sensor->id, ret);
                return ret;
        }
 
@@ -351,7 +349,10 @@ static int hisi_thermal_probe(struct platform_device *pdev)
        for (i = 0; i < HISI_MAX_SENSORS; ++i) {
                ret = hisi_thermal_register_sensor(pdev, data,
                                                   &data->sensors[i], i);
-               if (ret)
+               if (ret == -ENODEV)
+                       dev_warn(&pdev->dev,
+                                "thermal sensor %d has not bound\n", i);
+               else if (ret)
                        dev_err(&pdev->dev,
                                "failed to register thermal sensor: %d\n", ret);
                else

Thanks,
Leo Yan

reviewer
#5 lore raw
Quoted 63 lines · Leo Yan

On Tue, Aug 08, 2017 at 08:48:51PM +0800, Zhang Rui wrote:

[...]

Quoted 44 lines
Quoted 40 lines
Quoted 25 lines
Quoted 25 lines
(quoted diff) +0 -0
@@ -352,10 +353,9 @@ static int hisi_thermal_probe(struct
 platform_device *pdev)
  		ret = hisi_thermal_register_sensor(pdev,
 data,

     &data-

Quoted 3 lines

sensors[i], i);

  if (ret)

(quoted diff) +0 -2
-			dev_err(&pdev->dev,
-				"failed to register thermal

sensor:
%d\n", ret);

(quoted diff) +0 -2
-		else
-			hisi_thermal_toggle_sensor(&data-
Quoted 3 lines

sensors[i], true);

(quoted diff) +3 -0
+			continue;
+
+		hisi_thermal_toggle_sensor(&data-
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

sensors[i],

true);
  }

  return 0;

With these removed, is there any other information in dmesg that
suggests this failure?

The problem is there are always failures showed in dmesg. The init
function is based on the assumption there is HISI_MAX_SENSORS sensors
which is not true for the hi6220 and that raises at boot time errors.

Quoted 4 lines

Why HISI_MAX_SENSORS(=4) while there is only one on hi6220 AFAIK? and
this driver is only used for hi6220 (now).

Quoted 5 lines

right, I think we should remove one error log, and then change the HISI_MAX_SENSORS to reflect the reality instead.

XinWei and Leo,
can you please help check this?

Sure.

Here I am a bit confusion and I think this is a common question for SoC thermal driver.

Hi6220 does has 4 thermal sensors, but we now only use one sensor of them (thermal sensor id 2) to bind with thermal zone and other three sensors are not bound to any thermal zone. So this is the reason the booting reports the failure.

Quoted 5 lines

I think changing HISI_MAX_SENSORS value cannot resolve this issue, due
we are using thermal id 2. How about below change? We change to use warning for sensors without binding, and remove redundant log.

Now we will get three "thermal sensor %d has not bound" messages for every normal probe, and an extra "failed to register thermal sensor:" for a real failure probe?

If that's the case, as we are not using the sensors on purpose, why not keep silence for -ENODEV?

thanks,
rui

Quoted 35 lines
drivers/thermal/hisi_thermal.c +0 -2
index 9c3ce34..6d34980 100644
@@ -260,8 +260,6 @@ static int hisi_thermal_register_sensor(struct
 platform_device *pdev,
         if (IS_ERR(sensor->tzd)) {
                 ret = PTR_ERR(sensor->tzd);
                 sensor->tzd = NULL;
-               dev_err(&pdev->dev, "failed to register sensor id %d:
 %d\n",
-                       sensor->id, ret);
                 return ret;

        }

drivers/thermal/hisi_thermal.c +4 -1
@@ -351,7 +349,10 @@ static int hisi_thermal_probe(struct
 platform_device *pdev)
         for (i = 0; i < HISI_MAX_SENSORS; ++i) {
                 ret = hisi_thermal_register_sensor(pdev, data,
                                                    &data->sensors[i], 
 i);
-               if (ret)
+               if (ret == -ENODEV)
+                       dev_warn(&pdev->dev,
+                                "thermal sensor %d has not bound\n",
 i);
+               else if (ret)

                        dev_err(&pdev->dev,
                                "failed to register thermal sensor:
%d\n", ret);
                else

Thanks,
Leo Yan

#6 lore raw
In reply to Leo Yan
Quoted 46 lines · Leo Yan

On Tue, Aug 08, 2017 at 08:48:51PM +0800, Zhang Rui wrote:

[...]

Quoted 28 lines
Quoted 28 lines
Quoted 21 lines
Quoted 21 lines
(quoted diff) +0 -0
@@ -352,10 +353,9 @@ static int hisi_thermal_probe(struct
 platform_device *pdev)
 		ret = hisi_thermal_register_sensor(pdev, data,
 						   &data-
Quoted 2 lines

sensors[i], i);

(quoted diff) +0 -2
 		if (ret)
-			dev_err(&pdev->dev,
-				"failed to register thermal

sensor:
%d\n", ret);

(quoted diff) +0 -2
-		else
-			hisi_thermal_toggle_sensor(&data-
Quoted 2 lines

sensors[i], true);

(quoted diff) +3 -0
+			continue;
+
+		hisi_thermal_toggle_sensor(&data->sensors[i],

true);
}

Quoted 3 lines
Quoted 1 line

return 0;

With these removed, is there any other information in dmesg that suggests this failure?

The problem is there are always failures showed in dmesg. The init function is based on the assumption there is HISI_MAX_SENSORS sensors which is not true for the hi6220 and that raises at boot time errors.

Quoted 8 lines
Quoted 3 lines

Why HISI_MAX_SENSORS(=4) while there is only one on hi6220 AFAIK? and this driver is only used for hi6220 (now).

right, I think we should remove one error log, and then change the HISI_MAX_SENSORS to reflect the reality instead.

XinWei and Leo,
can you please help check this?

Sure.

Here I am a bit confusion and I think this is a common question for SoC thermal driver.

Quoted 8 lines

Hi6220 does has 4 thermal sensors, but we now only use one sensor of them (thermal sensor id 2) to bind with thermal zone and other three sensors are not bound to any thermal zone. So this is the reason the booting reports the failure.

I think changing HISI_MAX_SENSORS value cannot resolve this issue, due we are using thermal id 2. How about below change? We change to use warning for sensors without binding, and remove redundant log.

Hi Leo,

a cleanest solution would be either:

- add the 3 missing thermal sensors in the DT and default to the id 2

or

- remove all the code assuming 4 sensors and deal with the one unique
sensor

No ?

Quoted 29 lines
drivers/thermal/hisi_thermal.c +4 -3
index 9c3ce34..6d34980 100644
@@ -260,8 +260,6 @@ static int hisi_thermal_register_sensor(struct platform_device *pdev,
        if (IS_ERR(sensor->tzd)) {
                ret = PTR_ERR(sensor->tzd);
                sensor->tzd = NULL;
-               dev_err(&pdev->dev, "failed to register sensor id %d: %d\n",
-                       sensor->id, ret);
                return ret;
        }
 
@@ -351,7 +349,10 @@ static int hisi_thermal_probe(struct platform_device *pdev)
        for (i = 0; i < HISI_MAX_SENSORS; ++i) {
                ret = hisi_thermal_register_sensor(pdev, data,
                                                   &data->sensors[i], i);
-               if (ret)
+               if (ret == -ENODEV)
+                       dev_warn(&pdev->dev,
+                                "thermal sensor %d has not bound\n", i);
+               else if (ret)
                        dev_err(&pdev->dev,
                                "failed to register thermal sensor: %d\n", ret);
                else

Thanks,
Leo Yan

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#7 lore raw

Hi Daniel,

On Mon, Aug 21, 2017 at 12:06:17PM +0200, Daniel Lezcano wrote:

[...]

Quoted 5 lines

Hi Leo,

a cleanest solution would be either:

- add the 3 missing thermal sensors in the DT and default to the id 2

Yeah, so do you think below change works for you?

---8<---

ARM64: dts: hisilicon: add missed thermal sensors for Hi6220

The thermal driver tries to register four sensors but the DT only binds one sensor (sensor ID 2) with thermal zone, as result the thermal driver reports failure for missed thermal sensor binding.

This patch adds missed thermal sensor for Hi6220, so can dismiss the booting failure log.

arch/arm64/boot/dts/hisilicon/hi6220.dtsi +18 -0
index eacbe0d..44c2bc7 100644
@@ -833,6 +833,18 @@
 
                thermal-zones {
 
+                       local: local {
+                               polling-delay = <0>;
+                               polling-delay-passive = <0>;
+                               thermal-sensors = <&tsensor 0>;
+                       };
+
+                       cls1: cls1 {
+                               polling-delay = <0>;
+                               polling-delay-passive = <0>;
+                               thermal-sensors = <&tsensor 1>;
+                       };
+
                        cls0: cls0 {
                                polling-delay = <1000>;
                                polling-delay-passive = <100>;
@@ -862,6 +874,12 @@
                                        };
                                };
                        };
+
+                       gpu: gpu {
+                               polling-delay = <0>;
+                               polling-delay-passive = <0>;
+                               thermal-sensors = <&tsensor 3>;
+                       };
                };
 
 
Quoted 4 lines

or

- remove all the code assuming 4 sensors and deal with the one unique
sensor

I personally prefer to avoid doing this, if only register one unique sensor this will let us have no flexiblity for trying multiple sensors on this platform.

[...]

Thanks,
Leo Yan

#8 lore raw
Quoted 6 lines · Leo Yan

Hi Daniel,

On Mon, Aug 21, 2017 at 12:06:17PM +0200, Daniel Lezcano wrote:

[...]

Quoted 7 lines
Quoted 5 lines

Hi Leo,

a cleanest solution would be either:

- add the 3 missing thermal sensors in the DT and default to the id 2

Yeah, so do you think below change works for you?

Isn't it possible to set the delay also ? so we don't have to send another patch if we want to use one of those instead of 2.

Quoted 49 lines

---8<---

ARM64: dts: hisilicon: add missed thermal sensors for Hi6220

The thermal driver tries to register four sensors but the DT only binds one sensor (sensor ID 2) with thermal zone, as result the thermal driver reports failure for missed thermal sensor binding.

This patch adds missed thermal sensor for Hi6220, so can dismiss the booting failure log.

arch/arm64/boot/dts/hisilicon/hi6220.dtsi +18 -0
index eacbe0d..44c2bc7 100644
@@ -833,6 +833,18 @@
 
                thermal-zones {
 
+                       local: local {
+                               polling-delay = <0>;
+                               polling-delay-passive = <0>;
+                               thermal-sensors = <&tsensor 0>;
+                       };
+
+                       cls1: cls1 {
+                               polling-delay = <0>;
+                               polling-delay-passive = <0>;
+                               thermal-sensors = <&tsensor 1>;
+                       };
+
                        cls0: cls0 {
                                polling-delay = <1000>;
                                polling-delay-passive = <100>;
@@ -862,6 +874,12 @@
                                        };
                                };
                        };
+
+                       gpu: gpu {
+                               polling-delay = <0>;
+                               polling-delay-passive = <0>;
+                               thermal-sensors = <&tsensor 3>;
+                       };
                };
 
 
Quoted 2 lines

or

Quoted 6 lines
Quoted 2 lines

- remove all the code assuming 4 sensors and deal with the one unique
sensor

I personally prefer to avoid doing this, if only register one unique sensor this will let us have no flexiblity for trying multiple sensors on this platform.

Ok, I will on the other side give a cleanup in the driver to optimize the sensors lookup.

Thanks
-- Daniel

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#9 lore raw
Quoted 9 lines · Daniel Lezcano
Quoted 8 lines · Leo Yan

Hi Daniel,

On Mon, Aug 21, 2017 at 12:06:17PM +0200, Daniel Lezcano wrote:

[...]

Quoted 2 lines

Hi Leo,

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

a cleanest solution would be either:

- add the 3 missing thermal sensors in the DT and default to the id 2

Yeah, so do you think below change works for you?

Isn't it possible to set the delay also ? so we don't have to send another patch if we want to use one of those instead of 2.

Yeah, this makes sense for me. Have shared updated DT binding patch with you, you could stack it with your changes.

Thanks for the suggestion.

[...]

Thanks,
Leo Yan

#10 lore raw
In reply to Daniel Lezcano

Hello,

Catching up on old patches.

Quoted 6 lines · Daniel Lezcano

The sensor id is unknown at init time and we use all id in the authorized MAX_SENSORS interval to register the sensor. On this SoC there is one thermal-zone with one sensor on it. No need to spit on the console everytime we failed to register thermal sensors, information which is deliberaly known as it is part of the discovery process.

Quoted 8 lines

hisi_thermal f7030700.tsensor: failed to register sensor id 0: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor: -19 hisi_thermal f7030700.tsensor: failed to register sensor id 1: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor: -19 hisi_thermal f7030700.tsensor: failed to register sensor id 3: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor: -19

Remove the error messages

Is this still needed? I am assuming no.
.

Quoted 4 lines
---
 drivers/thermal/hisi_thermal.c | 12 ++++++------
#11 lore raw
Quoted 17 lines · Eduardo Valentin

Hello,

Catching up on old patches.

Quoted 13 lines · Daniel Lezcano

The sensor id is unknown at init time and we use all id in the authorized MAX_SENSORS interval to register the sensor. On this SoC there is one thermal-zone with one sensor on it. No need to spit on the console everytime we failed to register thermal sensors, information which is deliberaly known as it is part of the discovery process.

hisi_thermal f7030700.tsensor: failed to register sensor id 0: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor: -19 hisi_thermal f7030700.tsensor: failed to register sensor id 1: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor: -19 hisi_thermal f7030700.tsensor: failed to register sensor id 3: -19 hisi_thermal f7030700.tsensor: failed to register thermal sensor: -19

Quoted 3 lines
Quoted 1 line

Remove the error messages

Is this still needed? I am assuming no.

Right, no longer needed.

-- Daniel

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog