From: Sam Protsenko <semen.protsenko@linaro.org>
To: Mateusz Majewski <m.majewski2@samsung.com>
Cc: 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,
Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
"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>,
Conor Dooley <conor+dt@kernel.org>,
Alim Akhtar <alim.akhtar@samsung.com>
Subject: Re: [PATCH 5/6] drivers/thermal/exynos: add initial Exynos 850 support
Date: Wed, 24 Jul 2024 19:56:12 -0500 [thread overview]
Message-ID: <CAPLW+4ktoygdOcy1_isdhsWvfnziR+wzhs8OtUwsn7E2y7HFzQ@mail.gmail.com> (raw)
In-Reply-To: <20240724153058.914693-1-m.majewski2@samsung.com>
On Wed, Jul 24, 2024 at 10:31 AM Mateusz Majewski
<m.majewski2@samsung.com> wrote:
>
> > I'd suggest to group all the definitions here as such:
> >
> > #define REG1_OFFSET
> > #define REG1_FIELD1_OFFSET
> > #define REG1_FIELD2_OFFSET
> > ...empty line...
> > #define REG2_OFFSET
> > #define REG2_FIELD1_OFFSET
> > #define REG2_FIELD2_OFFSET
> > ...etc...
> >
> > Or otherwise each shift/mask constant should contain its register name
> > as a prefix, to avoid confusion. But right now it's kinda hard to
> > understand what belongs to what :) But that's just a nitpick.
>
> I came up with this:
>
> /* Exynos850 specific registers */
> #define EXYNOS850_TMU_REG_CURRENT_TEMP0_1 0x40
> #define EXYNOS850_TMU_REG_THD_TEMP0_RISE 0x50
> #define EXYNOS850_TMU_REG_THD_TEMP0_FALL 0x60
> #define EXYNOS850_TMU_TEMP_SHIFT 9
>
> #define EXYNOS850_TMU_TRIMINFO_SHIFT 4
> #define EXYNOS850_TMU_TRIMINFO_OFFSET(n) \
> (EXYNOS_TMU_REG_TRIMINFO + (n) * EXYNOS850_TMU_TRIMINFO_SHIFT)
> #define EXYNOS850_TMU_T_TRIM0_SHIFT 18
>
> #define EXYNOS850_TMU_REG_CONTROL1 0x24
> #define EXYNOS850_TMU_LPI_MODE_MASK 1
> #define EXYNOS850_TMU_LPI_MODE_SHIFT 10
>
> #define EXYNOS850_TMU_REG_COUNTER_VALUE0 0x30
> #define EXYNOS850_TMU_EN_TEMP_SEN_OFF_MASK 0xffff
> #define EXYNOS850_TMU_EN_TEMP_SEN_OFF_SHIFT 0
>
> #define EXYNOS850_TMU_REG_COUNTER_VALUE1 0x34
> #define EXYNOS850_TMU_CLK_SENSE_ON_MASK 0xffff
> #define EXYNOS850_TMU_CLK_SENSE_ON_SHIFT 16
>
> #define EXYNOS850_TMU_REG_AVG_CON 0x38
> #define EXYNOS850_TMU_AVG_MODE_MASK 0x7
> #define EXYNOS850_TMU_DEM_ENABLE BIT(4)
>
> #define EXYNOS850_TMU_REG_TRIM0 0x3c
> #define EXYNOS850_TMU_TRIM0_MASK 0xf
> #define EXYNOS850_TMU_VBEI_TRIM_SHIFT 8
> #define EXYNOS850_TMU_VREF_TRIM_SHIFT 12
> #define EXYNOS850_TMU_BGRI_TRIM_SHIFT 20
>
> #define EXYNOS850_TMU_TEM1051X_SENSE_VALUE 0x028a
> #define EXYNOS850_TMU_TEM1456X_SENSE_VALUE 0x0a28
>
Looks better, thanks!
> This also omits some definitions that were in v1, as they had the same
> value and they were the same thing anyway. For instance, I dropped
> EXYNOS850_TMU_T_BUF_VREF_SEL_MASK in favor of
> EXYNOS_TMU_REF_VOLTAGE_MASK, and have a single EXYNOS850_TMU_TRIM0_MASK
> instead of EXYNOS850_TMU_BGRI_TRIM_MASK, EXYNOS850_TMU_VREF_TRIM_MASK,
> EXYNOS850_TMU_VBEI_TRIM_MASK and EXYNOS850_TMU_T_TRIM0_MASK. Also,
>
> > Suggest using GENMASK() macro whenever possible.
>
> This would make me have a separate mask for each of these again. Maybe
> if this driver gets refactored in the future to use u32_get_bits() and
> so on this would make more sense?
Sure, that was just a suggestion, don't have a strong opinion on that
one. If you don't like it, feel free to skip it for now.
next prev parent reply other threads:[~2024-07-25 0:56 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240719120944eucas1p29318fb588150b15f60f637fbea48271f@eucas1p2.samsung.com>
2024-07-19 12:08 ` [PATCH 0/6] Add initial Exynos 850 support to the thermal driver Mateusz Majewski
[not found] ` <CGME20240719120945eucas1p2aa5e35f78daa7ec1ea07f512180db468@eucas1p2.samsung.com>
2024-07-19 12:08 ` [PATCH 1/6] drivers/thermal/exynos: use DEFINE_SIMPLE_DEV_PM_OPS Mateusz Majewski
2024-07-22 18:41 ` Sam Protsenko
2024-07-24 6:04 ` Anand Moon
[not found] ` <CGME20240719120945eucas1p16058905c95c92840679831ae3383a67a@eucas1p1.samsung.com>
2024-07-19 12:08 ` [PATCH 2/6] drivers/thermal/exynos: use tmu_temp_mask consistently Mateusz Majewski
2024-07-22 19:03 ` Sam Protsenko
[not found] ` <CGME20240719120946eucas1p1b565fa653d33aa2155cd3bb172c29d14@eucas1p1.samsung.com>
2024-07-19 12:08 ` [PATCH 3/6] drivers/thermal/exynos: check IS_ERR(data->clk) consistently Mateusz Majewski
2024-07-22 21:03 ` Sam Protsenko
2024-07-23 14:17 ` Mateusz Majewski
2024-07-23 14:51 ` Sam Protsenko
[not found] ` <CGME20240719120947eucas1p1344134823e100feaf49238de0e226431@eucas1p1.samsung.com>
2024-07-19 12:08 ` [PATCH 4/6] dt-bindings: thermal: samsung,exynos: add exynos850-tmu string Mateusz Majewski
2024-07-22 21:26 ` Sam Protsenko
[not found] ` <CGME20240719120948eucas1p13f3dc8f3aba56027da720d36c6057040@eucas1p1.samsung.com>
2024-07-19 12:08 ` [PATCH 5/6] drivers/thermal/exynos: add initial Exynos 850 support Mateusz Majewski
2024-07-23 0:02 ` Sam Protsenko
2024-07-23 14:16 ` Mateusz Majewski
2024-07-23 15:23 ` Sam Protsenko
2024-07-23 16:47 ` Sam Protsenko
2024-07-24 15:30 ` Mateusz Majewski
2024-07-25 0:42 ` Sam Protsenko
2024-07-24 15:30 ` Mateusz Majewski
2024-07-25 0:56 ` Sam Protsenko [this message]
[not found] ` <CGME20240719120949eucas1p1b061c716ac55b4a79ba57c407c0b2d91@eucas1p1.samsung.com>
2024-07-19 12:08 ` [PATCH 6/6] dt-bindings: thermal: samsung,exynos: remove outdated information on trip point count Mateusz Majewski
2024-07-22 21:34 ` Sam Protsenko
2024-07-23 3:08 ` Rob Herring
2024-07-23 14:17 ` Mateusz Majewski
2024-07-23 19:24 ` Rob Herring
2024-07-24 15:31 ` Mateusz Majewski
2024-07-22 18:39 ` [PATCH 0/6] Add initial Exynos 850 support to the thermal driver Sam Protsenko
2024-07-23 14:16 ` Mateusz Majewski
2024-07-23 14:44 ` Sam Protsenko
2024-07-24 15:31 ` Mateusz Majewski
2024-07-25 1:06 ` Sam Protsenko
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=CAPLW+4ktoygdOcy1_isdhsWvfnziR+wzhs8OtUwsn7E2y7HFzQ@mail.gmail.com \
--to=semen.protsenko@linaro.org \
--cc=alim.akhtar@samsung.com \
--cc=bzolnier@gmail.com \
--cc=conor+dt@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--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=m.majewski2@samsung.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.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).