From: Matthias Brugger <matthias.bgg@gmail.com>
To: Weiyi Lu <weiyi.lu@mediatek.com>,
Enric Balletbo Serra <eballetbo@gmail.com>,
Nicolas Boichat <drinkcat@chromium.org>,
Rob Herring <robh@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com
Subject: Re: [PATCH v2 2/4] soc: mediatek: pm-domains: Add default power off flag
Date: Tue, 27 Oct 2020 11:25:55 +0100 [thread overview]
Message-ID: <32fbc5c6-88e4-7cdc-2491-5226d819db37@gmail.com> (raw)
In-Reply-To: <1603370857-30646-3-git-send-email-weiyi.lu@mediatek.com>
On 22/10/2020 14:47, Weiyi Lu wrote:
> For some power domain, like conn on MT8192, it should be default OFF.
> Because the power on/off control relies the function of connectivity chip
> and its firmware. And if project choose other chip vendor solution,
> those necessary connectivity functions will not provided.
>
> Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com>
> ---
> drivers/soc/mediatek/mtk-pm-domains.c | 23 +++++++++++++++++------
> 1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/soc/mediatek/mtk-pm-domains.c b/drivers/soc/mediatek/mtk-pm-domains.c
> index b7ccf94..50a7ae1 100644
> --- a/drivers/soc/mediatek/mtk-pm-domains.c
> +++ b/drivers/soc/mediatek/mtk-pm-domains.c
> @@ -24,6 +24,7 @@
> #define MTK_SCPD_ACTIVE_WAKEUP BIT(0)
> #define MTK_SCPD_FWAIT_SRAM BIT(1)
> #define MTK_SCPD_SRAM_ISO BIT(2)
> +#define MTK_SCPD_KEEP_DEFAULT_OFF BIT(3)
> #define MTK_SCPD_CAPS(_scpd, _x) ((_scpd)->data->caps & (_x))
>
> #define SPM_VDE_PWR_CON 0x0210
> @@ -506,17 +507,26 @@ static int scpsys_add_one_domain(struct scpsys *scpsys, struct device_node *node
> * software. The unused domains will be switched off during
> * late_init time.
> */
> - ret = scpsys_power_on(&pd->genpd);
> - if (ret < 0) {
> - dev_err_probe(scpsys->dev, ret, "failed to power on domain %pOFN\n", node);
> - goto err_unprepare_clocks;
> + if (MTK_SCPD_CAPS(pd, MTK_SCPD_KEEP_DEFAULT_OFF)) {
> + if (scpsys_domain_is_on(pd))
> + dev_warn(scpsys->dev,
> + "A default off power domain %pOFN has been ON\n", node);
> + } else {
> + ret = scpsys_power_on(&pd->genpd);
> + if (ret < 0) {
> + dev_err_probe(scpsys->dev, ret, "failed to power on domain %pOFN\n", node);
> + goto err_unprepare_clocks;
> + }
> }
>
> pd->genpd.name = node->name;
> pd->genpd.power_off = scpsys_power_off;
> pd->genpd.power_on = scpsys_power_on;
>
> - pm_genpd_init(&pd->genpd, NULL, false);
> + if (MTK_SCPD_CAPS(pd, MTK_SCPD_KEEP_DEFAULT_OFF))
> + pm_genpd_init(&pd->genpd, NULL, true);
> + else
> + pm_genpd_init(&pd->genpd, NULL, false);
>
> scpsys->domains[id] = &pd->genpd;
> return 0;
> @@ -603,7 +613,8 @@ static void scpsys_remove_one_domain(struct scpsys_domain *pd)
> "failed to remove domain '%s' : %d - state may be inconsistent\n",
> pd->genpd.name, ret);
>
> - scpsys_power_off(&pd->genpd);
> + if (!MTK_SCPD_CAPS(pd, MTK_SCPD_KEEP_DEFAULT_OFF))
> + scpsys_power_off(&pd->genpd);
Is that really needed? Turning the domain off when it's already off shouldn't hurt.
Regards,
Matthias
next prev parent reply other threads:[~2020-10-27 10:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-22 12:47 [PATCH v2 0/4] Mediatek MT8192 scpsys support Weiyi Lu
2020-10-22 12:47 ` [PATCH v2 1/4] dt-bindings: power: Add MT8192 power domains Weiyi Lu
2020-10-22 12:47 ` [PATCH v2 2/4] soc: mediatek: pm-domains: Add default power off flag Weiyi Lu
2020-10-27 10:25 ` Matthias Brugger [this message]
2020-10-22 12:47 ` [PATCH v2 3/4] soc: mediatek: pm-domains: Add support for mt8192 Weiyi Lu
2020-10-22 12:47 ` [PATCH v2 4/4] arm64: dts: mediatek: Add mt8192 power domains controller Weiyi Lu
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=32fbc5c6-88e4-7cdc-2491-5226d819db37@gmail.com \
--to=matthias.bgg@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=drinkcat@chromium.org \
--cc=eballetbo@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=robh@kernel.org \
--cc=srv_heupstream@mediatek.com \
--cc=weiyi.lu@mediatek.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
all inboxes | Powered by JetHome®