mbox series

[0/2] thermal: rcar_gen3_thermal: Read calibration from fuses

Message ID 20211011225802.11497-1-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
Headers show
Series thermal: rcar_gen3_thermal: Read calibration from fuses | expand

Message

Niklas Söderlund Oct. 11, 2021, 10:58 p.m. UTC
Hello Morimoto-san,

This series allows the Gen3 thermal driver to read its calibration
values (THCODE and PTAT) from the fuses, if set. If the values are not
set the driver fall-back to the previously used pseudo values from the
datasheet.

I don't have access to a system where the fuses are set but I have been 
told that you Morimoto-san do have access to one. Would it be possible 
for you to test this series for me?

The test case is a rather straight forward boot test. The patches are 
based on recent changes to the driver but everything is included in 
v5.15-rc4. If you have time to build and boot these patches on top of 
that and just check two things I would be very happy.

1. Check that the driver uses the fused values, this is showed by the 
   log message, dev_info(dev, "Using fused calibration values\n"); is 
   trigged when the driver probe.

2. Check the temperature readings in sysfs are reasonable, the values are 
   in millidegree Celsius. On my system that uses the coefficients from 
   the driver I have 41-42 degrees Celsius at the moment.

   # grep . /sys/class/thermal/thermal_zone*/temp
   /sys/class/thermal/thermal_zone0/temp:41000
   /sys/class/thermal/thermal_zone1/temp:42000
   /sys/class/thermal/thermal_zone2/temp:41000

If these two checks are OK for you I think this patch is ready to be 
consumed. Thanks for your help!

Patch 1/2 prepare for reading the values from fuses by moving the
storage of the values used during calculation from global const to
members of the private data structures. While patch 2/2 populates the
private members with data from the fuses if available.

Niklas Söderlund (2):
  thermal: rcar_gen3_thermal: Store thcode and ptat in priv data
  thermal: rcar_gen3_thermal: Read calibration from hardware

 drivers/thermal/rcar_gen3_thermal.c | 113 +++++++++++++++++++++-------
 1 file changed, 86 insertions(+), 27 deletions(-)

Comments

Kuninori Morimoto Oct. 12, 2021, 3:11 a.m. UTC | #1
Hi Niklas

Thank you for the patches.

> 1. Check that the driver uses the fused values, this is showed by the
>    log message, dev_info(dev, "Using fused calibration values\n"); is
>    trigged when the driver probe.
>
> 2. Check the temperature readings in sysfs are reasonable, the values are
>    in millidegree Celsius. On my system that uses the coefficients from
>    the driver I have 41-42 degrees Celsius at the moment.
>
>    # grep . /sys/class/thermal/thermal_zone*/temp
>    /sys/class/thermal/thermal_zone0/temp:41000
>    /sys/class/thermal/thermal_zone1/temp:42000
>    /sys/class/thermal/thermal_zone2/temp:41000

I checkout:ed v5.15-rc4, and apply your patches.
This is the result

--- log ----
	...
	[    1.516781] i2c-rcar e6510000.i2c: probed
	[    1.532108] i2c-rcar e66d8000.i2c: probed
=>	[    1.539314] rcar_gen3_thermal e6198000.thermal: Using fused calibration values
	[    1.551116] rcar_gen3_thermal e6198000.thermal: TSC0: Loaded 1 trip points
	[    1.562274] rcar_gen3_thermal e6198000.thermal: TSC1: Loaded 1 trip points
	[    1.573413] rcar_gen3_thermal e6198000.thermal: TSC2: Loaded 2 trip points
	[    1.595676] random: fast init done
	[    1.612993] NET: Registered PF_PACKET protocol family
	...
	# login
=>	# grep . /sys/class/thermal/thermal_zone*/temp 
	/sys/class/thermal/thermal_zone0/temp:37000
	/sys/class/thermal/thermal_zone1/temp:38500
	/sys/class/thermal/thermal_zone2/temp:38500

I'm happy if these are the expected.

Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thank you for your help !!

Best regards
---
Kuninori Morimoto
Niklas Söderlund Oct. 12, 2021, 8:24 a.m. UTC | #2
Hello Morimoro-san,

Thanks for your test.

On 2021-10-12 12:11:01 +0900, Kuninori Morimoto wrote:
> 
> Hi Niklas
> 
> Thank you for the patches.
> 
> > 1. Check that the driver uses the fused values, this is showed by the
> >    log message, dev_info(dev, "Using fused calibration values\n"); is
> >    trigged when the driver probe.
> >
> > 2. Check the temperature readings in sysfs are reasonable, the values are
> >    in millidegree Celsius. On my system that uses the coefficients from
> >    the driver I have 41-42 degrees Celsius at the moment.
> >
> >    # grep . /sys/class/thermal/thermal_zone*/temp
> >    /sys/class/thermal/thermal_zone0/temp:41000
> >    /sys/class/thermal/thermal_zone1/temp:42000
> >    /sys/class/thermal/thermal_zone2/temp:41000
> 
> I checkout:ed v5.15-rc4, and apply your patches.
> This is the result
> 
> --- log ----
> 	...
> 	[    1.516781] i2c-rcar e6510000.i2c: probed
> 	[    1.532108] i2c-rcar e66d8000.i2c: probed
> =>	[    1.539314] rcar_gen3_thermal e6198000.thermal: Using fused calibration values
> 	[    1.551116] rcar_gen3_thermal e6198000.thermal: TSC0: Loaded 1 trip points
> 	[    1.562274] rcar_gen3_thermal e6198000.thermal: TSC1: Loaded 1 trip points
> 	[    1.573413] rcar_gen3_thermal e6198000.thermal: TSC2: Loaded 2 trip points
> 	[    1.595676] random: fast init done
> 	[    1.612993] NET: Registered PF_PACKET protocol family
> 	...
> 	# login
> =>	# grep . /sys/class/thermal/thermal_zone*/temp 
> 	/sys/class/thermal/thermal_zone0/temp:37000
> 	/sys/class/thermal/thermal_zone1/temp:38500
> 	/sys/class/thermal/thermal_zone2/temp:38500
> 
> I'm happy if these are the expected.
> 
> Tested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

These are reasonable temperature readings, unless you moved to an igloo 
to live with the penguins :-)

Thanks again for locating a board and taking the time to test this 
series much appreciated!

> 
> Thank you for your help !!
> 
> Best regards
> ---
> Kuninori Morimoto