[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6c4e6934-c0f0-7838-4dbc-3a639dfd06d0@kontron.de>
Date: Mon, 3 May 2021 15:27:46 +0200
From: Frieder Schrempf <frieder.schrempf@...tron.de>
To: "Peng Fan (OSS)" <peng.fan@....nxp.com>, robh+dt@...nel.org,
shawnguo@...nel.org, s.hauer@...gutronix.de
Cc: kernel@...gutronix.de, festevam@...il.com, linux-imx@....com,
p.zabel@...gutronix.de, l.stach@...gutronix.de, krzk@...nel.org,
agx@...xcpu.org, marex@...x.de, andrew.smirnov@...il.com,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, ping.bai@....com, aford173@...il.com,
abel.vesa@....com
Subject: Re: [PATCH 02/16] soc: imx: gpcv2: move domain mapping to domain
driver probe
On 29.04.21 09:30, Peng Fan (OSS) wrote:
> From: Lucas Stach <l.stach@...gutronix.de>
>
> As long as the power domain driver is active we want power control
> over the domain (which is what the mapping bit requests), so there
> is no point in whacking it for every power control action, simply
> set the bit in driver probe and clear it when the driver is removed.
>
> Signed-off-by: Lucas Stach <l.stach@...gutronix.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@...tron.de>
> ---
> drivers/soc/imx/gpcv2.c | 22 +++++++++++++---------
> 1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
> index 512e6f4acafd..552d3e6bee52 100644
> --- a/drivers/soc/imx/gpcv2.c
> +++ b/drivers/soc/imx/gpcv2.c
> @@ -140,14 +140,11 @@ static int imx_gpc_pu_pgc_sw_pxx_req(struct generic_pm_domain *genpd,
> int i, ret = 0;
> u32 pxx_req;
>
> - regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING,
> - domain->bits.map, domain->bits.map);
> -
> if (has_regulator && on) {
> ret = regulator_enable(domain->regulator);
> if (ret) {
> dev_err(domain->dev, "failed to enable regulator\n");
> - goto unmap;
> + return ret;
> }
> }
>
> @@ -203,9 +200,7 @@ static int imx_gpc_pu_pgc_sw_pxx_req(struct generic_pm_domain *genpd,
> /* Preserve earlier error code */
> ret = ret ?: err;
> }
> -unmap:
> - regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING,
> - domain->bits.map, 0);
> +
> return ret;
> }
>
> @@ -499,10 +494,13 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
> if (ret)
> return dev_err_probe(domain->dev, ret, "Failed to get domain's clocks\n");
>
> + regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING,
> + domain->bits.map, domain->bits.map);
> +
> ret = pm_genpd_init(&domain->genpd, NULL, true);
> if (ret) {
> dev_err(domain->dev, "Failed to init power domain\n");
> - goto out_put_clocks;
> + goto out_domain_unmap;
> }
>
> ret = of_genpd_add_provider_simple(domain->dev->of_node,
> @@ -516,7 +514,9 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
>
> out_genpd_remove:
> pm_genpd_remove(&domain->genpd);
> -out_put_clocks:
> +out_domain_unmap:
> + regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING,
> + domain->bits.map, 0);
> imx_pgc_put_clocks(domain);
>
> return ret;
> @@ -528,6 +528,10 @@ static int imx_pgc_domain_remove(struct platform_device *pdev)
>
> of_genpd_del_provider(domain->dev->of_node);
> pm_genpd_remove(&domain->genpd);
> +
> + regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING,
> + domain->bits.map, 0);
> +
> imx_pgc_put_clocks(domain);
>
> return 0;
>
Powered by blists - more mailing lists