From: Jonathan Cameron <jic23@kernel.org>
To: Tony Lindgren <tony@atomide.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org, linux-omap@vger.kernel.org,
Marcel Partap <mpartap@gmx.net>,
Michael Scott <michael.scott@linaro.org>,
Sebastian Reichel <sre@kernel.org>
Subject: Re: [PATCH 2/3] iio: adc: cpcap: Fix die temperature
Date: Sat, 20 May 2017 17:39:03 +0100 [thread overview]
Message-ID: <8559e4a5-c005-1cd4-df34-b62f5b6b7853@kernel.org> (raw)
In-Reply-To: <20170520163525.GM10472@atomide.com>
On 20/05/17 17:35, Tony Lindgren wrote:
> * Jonathan Cameron <jic23@kernel.org> [170520 08:58]:
>> On 19/05/17 04:40, Tony Lindgren wrote:
>>> It seems that "MC13783 Power Management and Audio Ciruit User's Guide"
>>> MC1378UG.pdf documents several similar components as in the CPCAP PMIC.
>>>
>>> Chapter "9.5.5 Die Temperature and UID" says that the die temperature
>>> value is 282 at 25C with LSB of -1.14C. Converting CPCAP PMIC channel3
>>> values with following seems to produce values that make sense for a
>>> PMIC die:
>>>
>>> temperature = 25000 + ((regval - 282) * 114)
>>>
>>> As we don't have any other documentation, let's assume the die
>>> temperature is unconfigured in the Motorola mapphone Linux kernel
>>> and the current temperature conversion table should be only used
>>> for the battery thermistor and not for the die temperature.
>> Is there any route we have available to confirm this? I.e. doe anyone
>> have one where we can check plausibility?
>
> Well there is also a tmp105 sensor for SoC temperature on board
> that I used for some sanity checks :) For the Motorola kernel, it
> seems it's doing all the interesting ADC stuff in user space for
> battery estimates. So if ch3 is used, it must be using the raw
> values. My guess is that ch3 is only used by the PMIC firmware to
> automatically cut off power if it gets too hot.
>
> The temperature values seem to make sense now when compared against
> the tmp105 values.. The following output is from an idle device with
> charger connected with reasonably full battery:
>
> $ ./test-d4-temperature
> tmp105: 37187 bat ch0: 33675 die ch3: 46888
> tmp105: 37187 bat ch0: 33820 die ch3: 41074
> tmp105: 37187 bat ch0: 33525 die ch3: 40390
> tmp105: 37125 bat ch0: 33675 die ch3: 40162
> tmp105: 37125 bat ch0: 34410 die ch3: 40048
> tmp105: 37125 bat ch0: 34555 die ch3: 40162
> tmp105: 37125 bat ch0: 33525 die ch3: 40390
> ...
>
> Add some load with two instances of dd if=/dev/urandom of=/dev/null:
>
> $ ./test-d4-temperature
> tmp105: 44250 bat ch0: 37240 die ch3: 51790
> tmp105: 44250 bat ch0: 34705 die ch3: 48940
> tmp105: 44250 bat ch0: 34705 die ch3: 48484
> tmp105: 44250 bat ch0: 34850 die ch3: 48370
> tmp105: 44312 bat ch0: 37585 die ch3: 48142
> tmp105: 44312 bat ch0: 36895 die ch3: 48484
> tmp105: 44375 bat ch0: 34705 die ch3: 48484
> tmp105: 44375 bat ch0: 36895 die ch3: 48484
> ...
>
> So ch3 for the PMIC die temperature seems to follow the load
> numbers and makes sense as it provides power to all the devices.
> The first value of ch3 often is all over the map though, probably
> no way around that..
>
> The script I'm using is:
>
> #!/bin/sh
>
> while [ 1 ]; do
> echo -n "tmp105: $(cat /sys/class/hwmon/hwmon0/temp1_input) "
> echo -n "bat ch0: $(cat /sys/bus/iio/devices/iio:device0/in_temp0_input) "
> echo "die ch3: $(cat /sys/bus/iio/devices/iio:device0/in_temp3_input)"
> sleep 1
> done
>
> Regards,
>
> Tony
>
thanks for the info.
I'm happy with the it looks plausible on real hardware answer.
Jonathan
next prev parent reply other threads:[~2017-05-20 16:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 3:40 [PATCH 0/3] Few non-critical cpcap ADC fixes Tony Lindgren
2017-05-19 3:40 ` [PATCH 1/3] iio: adc: cpcap: Fix default register values and battery temperature Tony Lindgren
2017-05-20 5:52 ` Matt Ranostay
2017-05-20 15:51 ` Jonathan Cameron
2017-05-20 16:02 ` Tony Lindgren
2017-05-19 3:40 ` [PATCH 2/3] iio: adc: cpcap: Fix die temperature Tony Lindgren
2017-05-20 15:55 ` Jonathan Cameron
2017-05-20 16:35 ` Tony Lindgren
2017-05-20 16:39 ` Jonathan Cameron [this message]
2017-05-19 3:40 ` [PATCH 3/3] iio: adc: cpcap: Remove hung interrupt quirk Tony Lindgren
2017-05-20 12:29 ` Sebastian Reichel
2017-05-20 15:56 ` Jonathan Cameron
-- strict thread matches above, loose matches on Subject: below --
2017-05-23 0:51 [PATCHv2 0/3] Few non-critical cpcap ADC fixes Tony Lindgren
2017-05-23 0:51 ` [PATCH 2/3] iio: adc: cpcap: Fix die temperature Tony Lindgren
2017-05-24 19:19 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8559e4a5-c005-1cd4-df34-b62f5b6b7853@kernel.org \
--to=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=michael.scott@linaro.org \
--cc=mpartap@gmx.net \
--cc=pmeerw@pmeerw.net \
--cc=sre@kernel.org \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).