Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Oct 2016 12:12:15 -0300 (ADT)
From:      Jared McNeill <jmcneill@invisible.ca>
To:        Milan Obuch <freebsd-arm@dino.sk>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: aw_thermal breakage on Allwinner H3 SoC
Message-ID:  <alpine.DEB.2.11.1610251208390.641@dis.invisible.ca>
In-Reply-To: <alpine.DEB.2.11.1610251058480.641@dis.invisible.ca>
References:  <20161024165820.16e6dd6f@zeta.dino.sk> <alpine.DEB.2.11.1610251058480.641@dis.invisible.ca>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Does this patch help? It uses the same values as the BSP for sun8iw7p1 
found here:
https://github.com/friendlyarm/h3_lichee/blob/master/linux-3.4/drivers/thermal/sunxi-temperature.c#L1287

With this patch my NanoPi NEO shows around 39C when idle.

Cheers,
Jared

On Tue, 25 Oct 2016, Jared McNeill wrote:

> Hi Milan --
>
> There appears to be an inconsistency between the temperature conversion 
> formula in the H3 datasheet and the BSP. I'm looking into it..
>
> Cheers,
> Jared
>
>
> On Mon, 24 Oct 2016, Milan Obuch wrote:
>
>> Hi,
>> 
>> today I svnup'ped sources for 12-CURRENT I use to test on Orange Pi One
>> to svn revision 307846 and there was no aw_thermal device anymore.
>> After some fiddling I found reason is in aw_sid.c, namely in function
>> aw_sid_read_tscalib. I managed to get it working, somehow, giving the
>> patch in attachment. This way "sun8i-h3-sid" is defined and attaches,
>> which in turn makes aw_thermal attached and working, a bit.
>> 
>> Almost identical patch, without the last chunk was necessary in past,
>> but now behavior changed a bit - namely, sysctl dev.aw_thermal.0.cpu
>> shows 99C right after start, now, running for almost six hours idle,
>> 100C. This is surely wrong. SoC is not that hot given I can put my
>> finger on it without risk of being immediatelly burned. Before this
>> change it showed some 49 degrees right after power on and rises slowly
>> up to 60 - 63 degrees. This values were not correct, too, temperature
>> is maybe 45 degrees or so according to my finger integrated
>> thermometer :)
>> 
>> Did anybody test this on H3 based board? If yes, is there anything
>> special to be put into FDT definition file?
>> 
>> Has anybody a clue what's going on? If someone has an idea what to
>> check, I am ready to check it, but currently have not much experience
>> with sensors in SoC.
>> 
>> Regards,
>> Milan
>> 
> _______________________________________________
> freebsd-arm@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"
>
>
[-- Attachment #2 --]
diff --git a/sys/arm/allwinner/aw_thermal.c b/sys/arm/allwinner/aw_thermal.c
index b36de1a..8986dcf 100644
--- a/sys/arm/allwinner/aw_thermal.c
+++ b/sys/arm/allwinner/aw_thermal.c
@@ -108,9 +108,9 @@ __FBSDID("$FreeBSD$");
 #define	H3_ADC_ACQUIRE_TIME	0x3f
 #define	H3_FILTER		0x6
 #define	H3_INTC			0x191000
-#define	H3_TEMP_BASE		2794000
+#define	H3_TEMP_BASE		1794000
 #define	H3_TEMP_MUL		1000
-#define	H3_TEMP_DIV		-14882
+#define	H3_TEMP_DIV		-8253
 #define	H3_CLK_RATE		4000000
 
 #define	TEMP_C_TO_K		273
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.DEB.2.11.1610251208390.641>