[PATCH] thermal: rockchip: Extract TSADC conversion tables into a header file
Dragan Simic
dsimic at manjaro.org
Thu Feb 27 09:01:00 PST 2025
Hello Lukasz,
On 2025-02-27 15:42, Lukasz Luba wrote:
> On 2/26/25 13:42, Dragan Simic wrote:
>> Move the TSADC code-to-temperature mapping tables from the Rockchip
>> thermal
>> driver to a separate header file, to no longer have the somewhat
>> cluttering
>> mapping data as part of the driver itself. [1]
>>
>> These mapping tables come verbatim from the SoC technical reference
>> manuals
>> (TRMs) and the downstream kernel code, [2] and may be updated at some
>> point
>> in the future, according to the manufacturer test results, [3] so
>> extracting
>> the tables into a separate header file not just improves the
>> readability of
>> the driver code, but introduces a clear separation.
>>
>> Improve the wording of the moved comment block, sprinkle a few short
>> comments
>> over the newly introduced header file, and move the already existing
>> single
>> stray #include directive in the driver code to its beginning.
>>
>> [1]
>> https://lore.kernel.org/linux-rockchip/7f17cc55-a741-4bb8-9513-0580ca6fedd3@linaro.org/T/#u
>> [2]
>> https://raw.githubusercontent.com/rockchip-linux/kernel/f8b9431ee38ed561650be7092ab93f564598daa9/drivers/thermal/rockchip_thermal.c
>> [3]
>> https://lore.kernel.org/linux-rockchip/b4ab86b56177a234f3738c477693e858@manjaro.org/T/#u
>
> I think Daniel was more thinking something about saving the
> memory in the kernel. I see how this patch can help the readability
> of the driver code, but that doesn't help much to not occupy the kernel
> data. The driver will be built with that memory and the distro would
> run on some platform with particular chip. The other chips data won't
> be needed.
Thanks for your response! Yes, carrying all that data in the kernel
memory, out of which only one variant actually gets used at runtime,
is far from optimal.
> Why not to have that information in the DT?
> That would save the memory and be configurable for only needed
> platform.
> Please have a look into the generic thermal ADC driver and related
> DT entry, which is used e.g. here [1].
> That table looks similar to your info.
Let me have a detailed look into all that, please, and I'll come back
with some further thoughts.
> [1]
> https://elixir.bootlin.com/linux/v6.13.4/source/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi#L136
More information about the Linux-rockchip
mailing list