public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Kever Yang <kever.yang@rock-chips.com>
To: "Daniel Lezcano" <daniel.lezcano@linaro.org>,
	"Heiko Stübner" <heiko@sntech.de>
Cc: linux-rockchip@lists.infradead.org,
	Shaohan Yao <shaohan.yao@rock-chips.com>,
	linux-pm@vger.kernel.org, Lukasz Luba <lukasz.luba@arm.com>,
	linux-kernel@vger.kernel.org, Zhang Rui <rui.zhang@intel.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] thermal: rockchip: Support the rk3562 SoC in thermal driver
Date: Thu, 27 Feb 2025 19:26:21 +0800	[thread overview]
Message-ID: <d77bfb17-d875-4bd2-abb4-e9ff012d7bfc@rock-chips.com> (raw)
In-Reply-To: <e36a5771-d277-41d3-af9c-c5841c4060a2@linaro.org>

Hi Daniel,

On 2025/2/19 03:43, Daniel Lezcano wrote:
> On 11/02/2025 11:19, Heiko Stübner wrote:
>> Hey Daniel,
>>
>> Am Dienstag, 11. Februar 2025, 10:36:09 MEZ schrieb Daniel Lezcano:
>>> On 24/12/2024 10:40, Kever Yang wrote:
>>>> From: Shaohan Yao <shaohan.yao@rock-chips.com>
>>>>
>>>> There are one Temperature Sensor on rk3562, channel 0 is for chip.
>>>
>>> A bit stingy in terms of description, no ?
>>>
>>>
>>>> Signed-off-by: Shaohan Yao <shaohan.yao@rock-chips.com>
>>>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>> [...]
>>>> +static const struct tsadc_table rk3562_code_table[] = {
>>>> +    {0, -40000},
>>>> +    {1419, -40000},
>>>> +    {1428, -35000},
>>>> +    {1436, -30000},
>>>> +    {1445, -25000},
>>>> +    {1453, -20000},
>>>> +    {1462, -15000},
>>>> +    {1470, -10000},
>>>> +    {1479, -5000},
>>>> +    {1487, 0},
>>>> +    {1496, 5000},
>>>> +    {1504, 10000},
>>>> +    {1512, 15000},
>>>> +    {1521, 20000},
>>>> +    {1529, 25000},
>>>> +    {1538, 30000},
>>>> +    {1546, 35000},
>>>> +    {1555, 40000},
>>>> +    {1563, 45000},
>>>> +    {1572, 50000},
>>>> +    {1580, 55000},
>>>> +    {1589, 60000},
>>>> +    {1598, 65000},
>>>> +    {1606, 70000},
>>>> +    {1615, 75000},
>>>> +    {1623, 80000},
>>>> +    {1632, 85000},
>>>> +    {1640, 90000},
>>>> +    {1648, 95000},
>>>> +    {1657, 100000},
>>>> +    {1666, 105000},
>>>> +    {1674, 110000},
>>>> +    {1682, 115000},
>>>> +    {1691, 120000},
>>>> +    {1699, 125000},
>>>> +    {TSADCV2_DATA_MASK, 125000},
>>>> +};
>>>
>>> May be it is time to optimize all these tables out of the memory 
>>> driver?
>>>
>>> It is the 9th table introduced.
>>
>> just to see if we think differently, what do you have in mind?
>>
>> For me the adc-to-temperature conversion _is_ part of the hw-block 
>> itself,
>> so should likely not spill into the devicetree, but you're right, 
>> defining
>> a big table for each soc also isn't really great.
>>
>> For the rk3562 in question, the stepping seems to be 8,9,8,9,....
>> where for the rk3568 the value stepping seems to be 32,36,32,36,...
>> and it looks similar for the other socs too, with the driver is already
>> interpolating between values it seems.
>>
>> So even just halving (or more) all the big tables (dropping every second
>> entry for example) should not really loose us real granularity.
>
> It can be just a formula to be reused in the adc_to_temp, temp_to_adc 
> or precompute the table from the formula:
>
> For instance the following formulas:
>
> rk3588_code_table:
>
>     y = ((x^2 + 23315x - 5949300) * 100) / 2457
>
> rk3568_code_table:
>
>     y = ((x^2 - 2660x + 1547712) * 625) / 2448
I can understand, it looks much better if we can use the formula instead 
of the table.

We got all these data from different vendor/foundry ,  some of vendor do 
provide the formula while others not.

And I think there is a key issue is that the formula may not fit for all 
the situation, sometimes need to calibrate

after chips are out, only the table is available in this case.

And in this case, we send the table as-is from the vendor.


Thanks,

- Kever

>
> etc ...
>
>

  reply	other threads:[~2025-02-27 13:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-24  9:40 [PATCH 1/2] dt-bindings: rockchip-thermal: Support the RK3562 SoC compatible Kever Yang
2024-12-24  9:40 ` [PATCH 2/2] thermal: rockchip: Support the rk3562 SoC in thermal driver Kever Yang
2025-02-11  9:36   ` Daniel Lezcano
2025-02-11 10:19     ` Heiko Stübner
2025-02-18 19:43       ` Daniel Lezcano
2025-02-27 11:26         ` Kever Yang [this message]
2025-02-20  5:28     ` Dragan Simic

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=d77bfb17-d875-4bd2-abb4-e9ff012d7bfc@rock-chips.com \
    --to=kever.yang@rock-chips.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=lukasz.luba@arm.com \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=shaohan.yao@rock-chips.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