Temperature Sensors on SOC or board?

Are there any temperature sensors on the board and the SOC of BPI-R2? I don’t see any temperature information the SOC datasheet.

Thanks

The SoC has a thermal sensor to measure “CPU Temperature”. Is this what you ask for?

Yes, I was trying to find that information in the publicly available datasheet but I couldn’t find anything. lmsensors also doesn’t seem to detect anything so I assumed that it was not implemented.

Do you know where I can get a datasheet or more information on the thermal sensor to program it and expose it to lmsensors?

Thanks

i tried that too, but can’t get it working: Lm-sensors support

Thanks for the link, that provided just enough information to find related registers in the datasheet. The address seems wrong in the dts. It doesn’t seem to agree with the datasheet. I did find some auxadc and thermal sensor registers and I’ll take a look at the code links you posted in that thread to see if I can figure out how to program this thing

Thanks

Hi, frank-w

after spending tons of time on hacking auxadc and thermal driver on 4.16 kernel.

finally, I found a way to read from the internal thermal device on CPU, which is

cat /sys/class/thermal/thermal_zone0/temp

but I can’t fully make sure whether it’s definitely accurate temperature on CPU. it seems to depend on a good k-value burned on efuse inside the soc. But you can have a try if it is fitting your use.

hi, tried this (with 4.14) in post #10 of my linked thread:

root@bpi-r2:~# cat /sys/class/thermal/thermal_zone0/temp                        
0

did you only do this with 4.16 or did you changed anything (like address mentioned by dsiq)?

i didn’t change anything, do you make sure you have enabled mtk auxadc driver ? and compare again dts between 4.14 you used and 4.16 stable tree.

i have build that as module but maybe i had not loaded it (looking onto lsmod from that thread)

[19:29] root@bpi-r2-e:~# lsmod | grep -e 'thermal\|aux'
mtk_thermal            16384  0
thermal_sys            61440  1 mtk_thermal
mt6577_auxadc          16384  0


[19:27] root@bpi-r2-e:~# cat /sys/class/thermal/thermal_zone0/temp 
cat: /sys/class/thermal/thermal_zone0/temp: Invalid argument

by comparing the dts, i’ve found nothing auxadc-related…which nodes are used for that? auxadc seems to be defined in mt7623.dtsi and this block have no difference between 4.14 and 4.16 as far as i see

auxadc: adc@11001000 {
	compatible = "mediatek,mt7623-auxadc",
		     "mediatek,mt2701-auxadc";
	reg = <0 0x11001000 0 0x1000>;
	clocks = <&pericfg CLK_PERI_AUXADC>;
	clock-names = "main";
	#io-channel-cells = <1>;
};

4.16:

auxadc: adc@11001000 {
	compatible = "mediatek,mt7623-auxadc",
		     "mediatek,mt2701-auxadc";
	reg = <0 0x11001000 0 0x1000>;
	clocks = <&pericfg CLK_PERI_AUXADC>;
	clock-names = "main";
	#io-channel-cells = <1>;
};

please check three nodes and their driver if they are all being setup correctly

thermal https://elixir.bootlin.com/linux/v4.17-rc4/source/arch/arm/boot/dts/mt7623.dtsi#L479

auxadc https://elixir.bootlin.com/linux/v4.17-rc4/source/arch/arm/boot/dts/mt7623.dtsi#L351

efuse https://elixir.bootlin.com/linux/v4.17-rc4/source/arch/arm/boot/dts/mt7623.dtsi#L314

It happens to work over here with mainline v4.17-rc1:

[root@alarm ~]# cat /sys/class/thermal/thermal_zone0/temp
43450
[root@alarm ~]# cat /sys/class/thermal/thermal_zone0/temp
43685
[root@alarm ~]# cat /sys/class/thermal/thermal_zone0/temp
43333
[root@alarm ~]# cat /sys/class/thermal/thermal_zone0/temp
43450
[root@alarm ~]# uname -a
Linux alarm 4.17.0-rc1-00021-ga27fc14219f2 #3 SMP Tue Apr 17 00:32:12 CEST 2018 armv7l GNU/Linux

Not sure what the numbers mean, though. If you want I could compare some things.

that means 43.450 Celsius (°C). you can run some busy application to see if the number is getting higher.

these numbers look like milli degrees celcius…

thermal (4.14):

thermal: thermal@1100b000 {
	#thermal-sensor-cells = <1>;
	compatible = "mediatek,mt7623-thermal",
		     "mediatek,mt2701-thermal";
	reg = <0 0x1100b000 0 0x1000>;
	interrupts = <0 70 IRQ_TYPE_LEVEL_LOW>;
	clocks = <&pericfg CLK_PERI_THERM>, <&pericfg CLK_PERI_AUXADC>;
	clock-names = "therm", "auxadc";
	resets = <&pericfg MT2701_PERI_THERM_SW_RST>;
	reset-names = "therm";
	mediatek,auxadc = <&auxadc>;
	mediatek,apmixedsys = <&apmixedsys>;
	nvmem-cells = <&thermal_calibration_data>;
	nvmem-cell-names = "calibration-data";
};

efuse (4.14):

efuse: efuse@10206000 {
	compatible = "mediatek,mt7623-efuse",
		     "mediatek,mt8173-efuse";
	reg = <0 0x10206000 0 0x1000>;
	#address-cells = <1>;
	#size-cells = <1>;
	thermal_calibration_data: calib@424 {
		reg = <0x424 0xc>;
	};
};

dtsi seems to be the same, as far as i see

Here any idea how i can trace the problem? Maybe something driver (auxadc,efuse,thermal) is changed…