linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] PM / devfreq: tegra30: Improve initial hardware resetting
@ 2020-09-27 20:51 ` Dmitry Osipenko
  2020-09-28  3:20   ` Chanwoo Choi
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Osipenko @ 2020-09-27 20:51 UTC (permalink / raw)
  To: Thierry Reding, MyungJoo Ham, Kyungmin Park, Chanwoo Choi,
	Jonathan Hunter
  Cc: linux-pm, linux-tegra, linux-kernel

It's safe to enable the ACTMON clock at any time during driver probing,
even if we don't know the state of hardware, because it's used only for
collecting and processing stats, and interrupt is kept disabled. This
allows us to slightly improve code which performs initial hardware
resetting by making use of a single reset_control_reset() instead of
assert/deassert pair. Secondly, a potential error of the reset-control
API is handled nicely now.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/devfreq/tegra30-devfreq.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c
index dedd39de7367..f5e74c2ede85 100644
--- a/drivers/devfreq/tegra30-devfreq.c
+++ b/drivers/devfreq/tegra30-devfreq.c
@@ -822,8 +822,6 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	reset_control_assert(tegra->reset);
-
 	err = clk_prepare_enable(tegra->clock);
 	if (err) {
 		dev_err(&pdev->dev,
@@ -831,7 +829,11 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	reset_control_deassert(tegra->reset);
+	err = reset_control_reset(tegra->reset);
+	if (err) {
+		dev_err(&pdev->dev, "Failed to reset hardware: %d\n", err);
+		goto disable_clk;
+	}
 
 	rate = clk_round_rate(tegra->emc_clock, ULONG_MAX);
 	if (rate < 0) {
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] PM / devfreq: tegra30: Improve initial hardware resetting
  2020-09-27 20:51 ` [PATCH v1] PM / devfreq: tegra30: Improve initial hardware resetting Dmitry Osipenko
@ 2020-09-28  3:20   ` Chanwoo Choi
  0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2020-09-28  3:20 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding, MyungJoo Ham, Kyungmin Park,
	Jonathan Hunter
  Cc: linux-pm, linux-tegra, linux-kernel

On 9/28/20 5:51 AM, Dmitry Osipenko wrote:
> It's safe to enable the ACTMON clock at any time during driver probing,
> even if we don't know the state of hardware, because it's used only for
> collecting and processing stats, and interrupt is kept disabled. This
> allows us to slightly improve code which performs initial hardware
> resetting by making use of a single reset_control_reset() instead of
> assert/deassert pair. Secondly, a potential error of the reset-control
> API is handled nicely now.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/devfreq/tegra30-devfreq.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c
> index dedd39de7367..f5e74c2ede85 100644
> --- a/drivers/devfreq/tegra30-devfreq.c
> +++ b/drivers/devfreq/tegra30-devfreq.c
> @@ -822,8 +822,6 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> -	reset_control_assert(tegra->reset);
> -
>  	err = clk_prepare_enable(tegra->clock);
>  	if (err) {
>  		dev_err(&pdev->dev,
> @@ -831,7 +829,11 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> -	reset_control_deassert(tegra->reset);
> +	err = reset_control_reset(tegra->reset);
> +	if (err) {
> +		dev_err(&pdev->dev, "Failed to reset hardware: %d\n", err);
> +		goto disable_clk;
> +	}
>  
>  	rate = clk_round_rate(tegra->emc_clock, ULONG_MAX);
>  	if (rate < 0) {
> 

Applied it. Thanks.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-28  3:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200927205217epcas1p1f4fffea5e9df2ca3b6e3ac13d46156e3@epcas1p1.samsung.com>
2020-09-27 20:51 ` [PATCH v1] PM / devfreq: tegra30: Improve initial hardware resetting Dmitry Osipenko
2020-09-28  3:20   ` Chanwoo Choi

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).