From: 손신 <shin.son@samsung.com>
To: "'Tudor Ambarus'" <tudor.ambarus@linaro.org>,
"'Daniel Lezcano'" <daniel.lezcano@linaro.org>,
"'Bartlomiej Zolnierkiewicz'" <bzolnier@gmail.com>,
"'Krzysztof Kozlowski'" <krzk@kernel.org>,
"'Rafael J . Wysocki'" <rafael@kernel.org>,
"'Zhang Rui'" <rui.zhang@intel.com>,
"'Lukasz Luba'" <lukasz.luba@arm.com>,
"'Rob Herring'" <robh@kernel.org>,
"'Conor Dooley'" <conor+dt@kernel.org>,
"'Alim Akhtar'" <alim.akhtar@samsung.com>
Cc: "'Henrik Grimler'" <henrik@grimler.se>,
linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
"'Peter\ Griffin'" <peter.griffin@linaro.org>,
"'André Draszik'" <andre.draszik@linaro.org>,
"'William McVicker'" <willmcvicker@google.com>,
jyescas@google.com, shin.son@samsung.com
Subject: RE: [PATCH v7 RESEND 2/3] thermal: exynos_tmu: Support new hardware and update TMU interface
Date: Mon, 24 Nov 2025 20:41:16 +0900 [thread overview]
Message-ID: <000b01dc5d37$3f6f5e80$be4e1b80$@samsung.com> (raw)
In-Reply-To: <12346382-7718-4942-a497-4de278b1d5a0@linaro.org>
Hello, Tudor Ambarus.
> -----Original Message-----
> From: Tudor Ambarus [mailto:tudor.ambarus@linaro.org]
> Sent: Monday, November 24, 2025 7:43 PM
> To: 손신 <shin.son@samsung.com>; 'Daniel Lezcano'
> <daniel.lezcano@linaro.org>; 'Bartlomiej Zolnierkiewicz'
> <bzolnier@gmail.com>; 'Krzysztof Kozlowski' <krzk@kernel.org>; 'Rafael J .
> Wysocki' <rafael@kernel.org>; 'Zhang Rui' <rui.zhang@intel.com>; 'Lukasz
> Luba' <lukasz.luba@arm.com>; 'Rob Herring' <robh@kernel.org>; 'Conor
> Dooley' <conor+dt@kernel.org>; 'Alim Akhtar' <alim.akhtar@samsung.com>
> Cc: 'Henrik Grimler' <henrik@grimler.se>; linux-pm@vger.kernel.org; linux-
> samsung-soc@vger.kernel.org; devicetree@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Peter Griffin
> <peter.griffin@linaro.org>; André Draszik <andre.draszik@linaro.org>;
> William McVicker <willmcvicker@google.com>; jyescas@google.com
> Subject: Re: [PATCH v7 RESEND 2/3] thermal: exynos_tmu: Support new
> hardware and update TMU interface
>
> Hi, Shin,
>
> On 11/24/25 12:06 PM, 손신 wrote:
> >>> +static void update_con_reg(struct exynos_tmu_data *data) {
> >>> + u32 val, t_buf_vref_sel, t_buf_slope_sel;
> >>> +
> >>> + val = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
> >>> + t_buf_vref_sel = (val >> EXYNOSAUTOV920_TMU_T_BUF_VREF_SEL_SHIFT)
> >>> + & EXYNOSAUTOV920_TMU_T_BUF_VREF_SEL_MASK;
> >>> + t_buf_slope_sel = (val >> EXYNOSAUTOV920_TMU_T_BUF_SLOPE_SEL_SHIFT)
> >>> + & EXYNOSAUTOV920_TMU_T_BUF_SLOPE_SEL_MASK;
> >>> +
> >>> + val = readl(data->base + EXYNOSAUTOV920_TMU_REG_CONTROL);
> >>> + val &= ~(EXYNOS_TMU_REF_VOLTAGE_MASK <<
> >> EXYNOS_TMU_REF_VOLTAGE_SHIFT);
> >>> + val |= (t_buf_vref_sel << EXYNOS_TMU_REF_VOLTAGE_SHIFT);
> >>> + val &= ~(EXYNOS_TMU_BUF_SLOPE_SEL_MASK <<
> >> EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT);
> >>> + val |= (t_buf_slope_sel << EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT);
> >>> + writel(val, data->base + EXYNOSAUTOV920_TMU_REG_CONTROL);
> >>> +
> >>> + val = readl(data->base + EXYNOSAUTOV920_TMU_REG_CONTROL1);
> >>> + val &= ~(EXYNOSAUTOV920_TMU_NUM_PROBE_MASK <<
> >> EXYNOSAUTOV920_TMU_NUM_PROBE_SHIFT);
> >>> + val &= ~(EXYNOSAUTOV920_TMU_LPI_MODE_MASK <<
> >> EXYNOSAUTOV920_TMU_LPI_MODE_SHIFT);
> >>> + val |= (data->sensor_count << EXYNOSAUTOV920_TMU_NUM_PROBE_SHIFT);
> >>> + writel(val, data->base + EXYNOSAUTOV920_TMU_REG_CONTROL1);
> >>> +
> >>> + writel(1, data->base + EXYNOSAUTOV920_TMU_SAMPLING_INTERVAL);
> >>> + writel(EXYNOSAUTOV920_TMU_AVG_CON_UPDATE, data->base +
> >> EXYNOSAUTOV920_TMU_REG_AVG_CONTROL);
> >>> + writel(EXYNOSAUTOV920_TMU_COUNTER_VALUE0_UPDATE,
> >>> + data->base + EXYNOSAUTOV920_TMU_REG_COUNTER_VALUE0);
> >>> + writel(EXYNOSAUTOV920_TMU_COUNTER_VALUE1_UPDATE,
> >>> + data->base + EXYNOSAUTOV920_TMU_REG_COUNTER_VALUE1);
> >>> +}
> >>> +
> >> This is unreadable; please make it understandable for those who don’t
> >> have the documentation (explicit static inline functions, comments,
> etc ...).
> > I'll restructure this code by introducing explicit static inline helper
> functions and proper comments to improve readability.
>
> We likely shouldn't use inlines here, see Linus's reply from 2006:
> https://lore.kernel.org/all/Pine.LNX.4.64.0601021105000.3668@g5.osdl.org/T
> /#u
>
> I guess you can make this easier to read if you use FIELD_GET/SET from
> bitfield.h. Other improvement would be using the regmap api.
>
> Shin, a bit unrelated with the patch, but I wanted to let you know that I
> started looking at the GS101 TMU. I assume it's very similar with the TMU
> on exynosautov920. Do you know if they share the same IP version?
>
> I noticed GS101 uses ACPM calls to communicate with the TMU. Why did you
> choose to not use ACPM for exynosautov920 TMU?
>
> Thanks!
> ta
I will adopt FIELD_GET/FIELD_PREP to simplify the bitfield handling, and I will avoid using inline functions excessively as suggested.
Regarding ACPM, I did not introduce it earlier because I was trying to align the implementation with the existing framework.
However, if we move toward a separate driver, I will reconsider whether ACPM integration makes sense there.
Would it be possible to get your feedback again when I prepare the next revision of the driver?
Plus, the GS101 TMU driver isn't upstream yet, right?
Could you share where I can find the example code you mentioned? Thank you in advance.
Best regards,
Shin
next prev parent reply other threads:[~2025-11-24 11:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20251113064032epcas2p316f2b271e581d03b729a5944d9624d49@epcas2p3.samsung.com>
2025-11-13 6:40 ` [PATCH v7 RESEND 0/3] Add exynosautov920 thermal support Shin Son
[not found] ` <CGME20251113064040epcas2p2df8da3f9c5a2c41c6aedc37d37b366de@epcas2p2.samsung.com>
2025-11-13 6:40 ` [PATCH v7 RESEND 1/3] dt-bindings: thermal: samsung: Adjust '#thermal-sensor-cells' to 1 Shin Son
[not found] ` <CGME20251113064044epcas2p1b87addb21473eca7cc52052e4e2e9237@epcas2p1.samsung.com>
2025-11-13 6:40 ` [PATCH v7 RESEND 2/3] thermal: exynos_tmu: Support new hardware and update TMU interface Shin Son
2025-11-20 19:43 ` Daniel Lezcano
2025-11-24 10:06 ` 손신
2025-11-24 10:35 ` Daniel Lezcano
2025-11-24 11:04 ` 손신
2025-11-24 11:08 ` Daniel Lezcano
2025-11-24 11:42 ` 손신
2025-11-24 10:43 ` Tudor Ambarus
2025-11-24 11:16 ` Daniel Lezcano
2025-11-24 11:41 ` 손신 [this message]
2025-11-24 12:24 ` Tudor Ambarus
2025-11-25 8:23 ` 손신
2025-11-25 9:15 ` Tudor Ambarus
2025-11-26 7:19 ` 손신
2025-11-26 9:21 ` Tudor Ambarus
2025-11-27 3:07 ` 손신
2025-11-27 9:04 ` Tudor Ambarus
2025-12-01 1:38 ` 손신
2025-12-01 9:54 ` Youngmin Nam
2025-12-02 0:31 ` 손신
[not found] ` <CGME20251113064049epcas2p2194df7393ea60912eec18077bbddf637@epcas2p2.samsung.com>
2025-11-13 6:40 ` [PATCH v7 RESEND 3/3] arm64: dts: exynosautov920: Add multiple sensors Shin Son
2025-10-30 7:07 [PATCH v7 RESEND 0/3] Add exynosautov920 thermal support Shin Son
[not found] ` <CGME20251030070716epcas2p2d51319c14272c316bd6b581a3fdcb512@epcas2p2.samsung.com>
2025-10-30 7:07 ` [PATCH v7 RESEND 2/3] thermal: exynos_tmu: Support new hardware and update TMU interface Shin Son
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='000b01dc5d37$3f6f5e80$be4e1b80$@samsung.com' \
--to=shin.son@samsung.com \
--cc=alim.akhtar@samsung.com \
--cc=andre.draszik@linaro.org \
--cc=bzolnier@gmail.com \
--cc=conor+dt@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=henrik@grimler.se \
--cc=jyescas@google.com \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=peter.griffin@linaro.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.com \
--cc=tudor.ambarus@linaro.org \
--cc=willmcvicker@google.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).