From: Jonas Karlman <jonas@kwiboo.se>
To: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
Ye Zhang <ye.zhang@rock-chips.com>,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
Sebastian Reichel <sebastian.reichel@collabora.com>,
linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
kernel@collabora.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 3/6] thermal: rockchip: Support RK3576 SoC in the thermal driver
Date: Mon, 17 Mar 2025 12:47:52 +0100 [thread overview]
Message-ID: <ba057235-85d4-4635-87ad-741e369904f3@kwiboo.se> (raw)
In-Reply-To: <4994384.31r3eYUQgx@workhorse>
Hi Nicolas,
On 2025-03-17 09:28, Nicolas Frattaroli wrote:
> On Saturday, 15 March 2025 09:20:07 Central European Standard Time Jonas
> Karlman wrote:
>> Hi Nicolas,
>
> Hi Jonas,
>
>>
>> On 2025-02-28 21:06, Nicolas Frattaroli wrote:
>>> From: Ye Zhang <ye.zhang@rock-chips.com>
>>>
>>> The RK3576 SoC has six TS-ADC channels: TOP, BIG_CORE, LITTLE_CORE,
>>> DDR, NPU and GPU.
>>>
>>> Signed-off-by: Ye Zhang <ye.zhang@rock-chips.com>
>>> [ported to mainline, reworded commit message]
>>> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
>>> ---
>>>
>>> drivers/thermal/rockchip_thermal.c | 42
>>> ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
>>>
>>> diff --git a/drivers/thermal/rockchip_thermal.c
>>> b/drivers/thermal/rockchip_thermal.c index
>>> a8ad85feb68fbb7ec8d79602b16c47838ecb3c00..bec1930bebd87859a7e519cfc9f05e1
>>> 0b1c31e87 100644 --- a/drivers/thermal/rockchip_thermal.c
>>> +++ b/drivers/thermal/rockchip_thermal.c
>>> @@ -1061,6 +1061,22 @@ static void rk_tsadcv3_tshut_mode(int chn, void
>>> __iomem *regs,>
>>> writel_relaxed(val_cru, regs + TSADCV3_HSHUT_CRU_INT_EN);
>>>
>>> }
>>>
>>> +static void rk_tsadcv4_tshut_mode(int chn, void __iomem *regs,
>>> + enum tshut_mode mode)
>>> +{
>>> + u32 val_gpio, val_cru;
>>> +
>>> + if (mode == TSHUT_MODE_GPIO) {
>>> + val_gpio = TSADCV2_INT_SRC_EN(chn) |
> TSADCV2_INT_SRC_EN_MASK(chn);
>>> + val_cru = TSADCV2_INT_SRC_EN_MASK(chn);
>>> + } else {
>>> + val_cru = TSADCV2_INT_SRC_EN(chn) |
> TSADCV2_INT_SRC_EN_MASK(chn);
>>> + val_gpio = TSADCV2_INT_SRC_EN_MASK(chn);
>>> + }
>>> + writel_relaxed(val_gpio, regs + TSADCV3_HSHUT_GPIO_INT_EN);
>>> + writel_relaxed(val_cru, regs + TSADCV3_HSHUT_CRU_INT_EN);
>>> +}
>>
>> This function is identical to rk_tsadcv3_tshut_mode() in mainline.
>>
>> Should the v3 function be renamed to v4 in mainline to match vendor
>> kernel to avoid confusion?
>
> Good catch. Yes, I'll add a patch to rename the function before introducing
> new changes in v4, and get rid of the duplicate function.
Great.
>
>>
>>> +
>>>
>>> static const struct rockchip_tsadc_chip px30_tsadc_data = {
>>>
>>> /* cpu, gpu */
>>> .chn_offset = 0,
>>>
>>> @@ -1284,6 +1300,28 @@ static const struct rockchip_tsadc_chip
>>> rk3568_tsadc_data = {>
>>> },
>>>
>>> };
>>>
>>> +static const struct rockchip_tsadc_chip rk3576_tsadc_data = {
>>> + /* top, big_core, little_core, ddr, npu, gpu */
>>> + .chn_offset = 0,
>>> + .chn_num = 6, /* six channels for tsadc */
>>> + .tshut_mode = TSHUT_MODE_GPIO, /* default TSHUT via GPIO give PMIC
> */
>>> + .tshut_polarity = TSHUT_LOW_ACTIVE, /* default TSHUT LOW ACTIVE */
>>> + .tshut_temp = 95000,
>>
>> Here the default is GPIO and 95 deg, in DT node the default is override
>> to CRU and 120 deg.
>>
>> Any reason that is not the default here?
>
> No reason, other than that this is what most Rockchip SoCs seem to do. RK3588
> does the same thing. The hardware power-on-reset state is to not have any
> tshut, so whatever the "default" should be is entirely made up by the driver
> in either case.
>
> For the sake of being consistent, I'll keep it the same in v4, as RK3588 does.
> Otherwise, we'll have RK3576 and RK3588 do different things. If someone wants
> to change the default, then ideally this would be done in a follow-up series
> to make it consistent for all SoCs.
>
> If that's alright with you, then I'll send out a v4.
Sounds good, I was mostly wondering because I am preparing patches for
RK3528 and it felt strange to define one default in driver and directly
override that default in DT to something different.
Also noticed that this driver log a warning when the DT props are
missing, something that probably should be downgraded as the props are
optional in DT schema. Something for another series.
Regards,
Jonas
>
>>
>> Regards,
>> Jonas
>>
>
> Regards,
> Nicolas Frattaroli
>
>>> + .initialize = rk_tsadcv8_initialize,
>>> + .irq_ack = rk_tsadcv4_irq_ack,
>>> + .control = rk_tsadcv4_control,
>>> + .get_temp = rk_tsadcv4_get_temp,
>>> + .set_alarm_temp = rk_tsadcv3_alarm_temp,
>>> + .set_tshut_temp = rk_tsadcv3_tshut_temp,
>>> + .set_tshut_mode = rk_tsadcv4_tshut_mode,
>>> + .table = {
>>> + .id = rk3588_code_table,
>>> + .length = ARRAY_SIZE(rk3588_code_table),
>>> + .data_mask = TSADCV4_DATA_MASK,
>>> + .mode = ADC_INCREMENT,
>>> + },
>>> +};
>>> +
>>>
>>> static const struct rockchip_tsadc_chip rk3588_tsadc_data = {
>>>
>>> /* top, big_core0, big_core1, little_core, center, gpu, npu */
>>> .chn_offset = 0,
>>>
>>> @@ -1342,6 +1380,10 @@ static const struct of_device_id
>>> of_rockchip_thermal_match[] = {>
>>> .compatible = "rockchip,rk3568-tsadc",
>>> .data = (void *)&rk3568_tsadc_data,
>>>
>>> },
>>>
>>> + {
>>> + .compatible = "rockchip,rk3576-tsadc",
>>> + .data = (void *)&rk3576_tsadc_data,
>>> + },
>>>
>>> {
>>>
>>> .compatible = "rockchip,rk3588-tsadc",
>>> .data = (void *)&rk3588_tsadc_data,
>
>
>
>
next prev parent reply other threads:[~2025-03-17 11:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 20:06 [PATCH v3 0/6] RK3576 thermal sensor support, including OTP trim adjustments Nicolas Frattaroli
2025-02-28 20:06 ` [PATCH v3 1/6] dt-bindings: rockchip-thermal: Add RK3576 compatible Nicolas Frattaroli
2025-02-28 20:06 ` [PATCH v3 2/6] arm64: dts: rockchip: Add thermal nodes to RK3576 Nicolas Frattaroli
2025-02-28 20:06 ` [PATCH v3 3/6] thermal: rockchip: Support RK3576 SoC in the thermal driver Nicolas Frattaroli
2025-03-15 8:20 ` Jonas Karlman
2025-03-17 8:28 ` Nicolas Frattaroli
2025-03-17 11:47 ` Jonas Karlman [this message]
2025-02-28 20:06 ` [PATCH v3 4/6] dt-bindings: thermal: rockchip: document otp thermal trim Nicolas Frattaroli
2025-03-03 14:26 ` Rob Herring (Arm)
2025-02-28 20:06 ` [PATCH v3 5/6] arm64: dts: rockchip: Add thermal trim OTP and tsadc nodes Nicolas Frattaroli
2025-02-28 20:06 ` [PATCH v3 6/6] thermal: rockchip: support reading trim values from OTP Nicolas Frattaroli
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=ba057235-85d4-4635-87ad-741e369904f3@kwiboo.se \
--to=jonas@kwiboo.se \
--cc=conor+dt@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=kernel@collabora.com \
--cc=krzk+dt@kernel.org \
--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=nicolas.frattaroli@collabora.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.com \
--cc=sebastian.reichel@collabora.com \
--cc=ye.zhang@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