From: Yixun Lan <dlan@kernel.org>
To: Iker Pedrosa <ikerpedrosam@gmail.com>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Ulf Hansson <ulfh@kernel.org>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
devicetree@vger.kernel.org, linux-riscv@lists.infradead.org,
spacemit@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH 2/3] pmdomain: spacemit: Add power domain driver
Date: Sun, 4 Oct 2026 13:47:00 +0000 [thread overview]
Message-ID: <20261004134700-GKA83703@kernel.org> (raw)
In-Reply-To: <CABdCQ=OUTASG8JDBqnJAPJ5aTDUC-BQzCVcw0r=cxrb8CPUO2A@mail.gmail.com>
Hi Iker Pedrosa,
On 20:54 Fri 02 Oct , Iker Pedrosa wrote:
> El vie, 18 sept 2026 a las 7:49, Yixun Lan (<dlan@kernel.org>) escribió:
> > [...]
> > diff --git a/drivers/pmdomain/spacemit/pm_domains.c b/drivers/pmdomain/spacemit/pm_domains.c
> > new file mode 100644
> > index 000000000000..d563e4e4e232
> > --- /dev/null
> > +++ b/drivers/pmdomain/spacemit/pm_domains.c
> > [...]
> > +static struct spacemit_pmu *gpmu;
>
> Would it make sense to embed the 'struct spacemit_pmu' pointer directly into
> 'struct spacemit_pm_domain'? Other generic Power Domain drivers (Rockchip,
> QCOM, Renesas) use this pattern to keep domain callbacks self-contained and
> ready for multi-instance SoCs
>
> > [...]
> > +static int spacemit_pd_power_on(struct generic_pm_domain *domain)
> > +{
> > [...]
> > + regmap_read(gpmu->regmap, APMU_POWER_STATUS_REG, &val);
>
> Please check the return value of regmap_read()
>
It's not necessary, or it's not really useful to check return value here,
regmap_read() shouldn't fail here, it generally access the io memory
> > [...]
> > + if (ret < 0) {
> > + dev_err(&domain->dev, "power-off domain: %d, error\n", spd->pm_index);
>
> Typo: should this say "power-on domain" since this is inside
> spacemit_pd_power_on()?
>
will drop this logic, I just followed vendor driver which try to force power
off donmain before doing the power on operation if it's already in 'on' state..
while found it's not really necessary to do this during actual testing
> > [...]
> > +static bool spacemit_pm_get_state(struct spacemit_pmu *pmu,
> > + struct spacemit_pm_domain *pd)
> > +{
> > + const struct spacemit_pm_domain_param *p = pd->param;
> > + u32 reg, bit;
> > +
> > + regmap_read(pmu->regmap, APMU_POWER_STATUS_REG, ®);
>
> Please check the return value here as well
>
I don't think the check is useful, in rare case it should fail
> > + bit = p->use_hw ? BIT(pd->param->bit_hw_pwr_stat) :
> > + BIT(pd->param->bit_pwr_stat);
>
> Since 'p' is initialized to 'pd->param' above, you can use 'p->bit_hw_pwr_stat'
> and 'p->bit_pwr_stat' directly here
Yes, will do
--
Yixun Lan (dlan)
next prev parent reply other threads:[~2026-10-04 13:47 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 2:40 [PATCH 0/3] PM: spacemit: Add power domain support Yixun Lan
2026-09-18 2:40 ` [PATCH 1/3] dt-bindings: power: spacemit: Add power domain controller Yixun Lan
2026-09-28 18:30 ` Rob Herring
2026-09-18 2:40 ` [PATCH 2/3] pmdomain: spacemit: Add power domain driver Yixun Lan
2026-09-18 9:00 ` Icenowy Zheng
2026-09-18 23:01 ` Yixun Lan
2026-09-19 6:57 ` Icenowy Zheng
2026-09-19 9:59 ` Yixun Lan
2026-09-19 13:56 ` Icenowy Zheng
2026-09-19 23:13 ` Yixun Lan
2026-09-20 5:17 ` Icenowy Zheng
2026-09-20 8:00 ` Troy Mitchell
2026-09-20 12:56 ` Icenowy Zheng
2026-09-21 3:35 ` Yixun Lan
2026-09-21 3:39 ` Icenowy Zheng
2026-09-21 12:43 ` Yixun Lan
2026-09-21 3:41 ` Icenowy Zheng
2026-09-21 12:44 ` Yixun Lan
2026-10-02 18:54 ` Iker Pedrosa
2026-10-04 13:47 ` Yixun Lan [this message]
2026-09-18 2:40 ` [PATCH 3/3] dts: riscv: spacemit: Add power domain nodes Yixun Lan
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=20261004134700-GKA83703@kernel.org \
--to=dlan@kernel.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=ikerpedrosam@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=robh@kernel.org \
--cc=spacemit@lists.linux.dev \
--cc=ulfh@kernel.org \
/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
all inboxes | Powered by JetHome®