Re: [PATCH v2 1/9] ARM: EXYNOS: cpuidle: fix AFTR mode check

From
Daniel Lezcano <hidden>
Date
2013-12-20 21:16:14
Also in
linux-pm, linux-samsung-soc, lkml
Reply to
Bartlomiej Zolnierkiewicz, 2013-12-20
On 12/20/2013 07:47 PM, Bartlomiej Zolnierkiewicz wrote:
quoted hunk ↗ jump to hunk
The EXYNOS cpuidle driver code assumes that cpuidle core will handle
dev->state_count smaller than drv->state_count but currently this is
untrue (dev->state_count is used only for handling cpuidle state sysfs
entries and drv->state_count is used for all other cases) and will not
be fixed in the future as dev->state_count is planned to be removed.

Fix the issue by checking for the max supported idle state in AFTR
state's ->enter handler (exynos4_enter_lowpower()) and entering AFTR
mode only when cores other than CPU0 are offline.

Signed-off-by: Bartlomiej Zolnierkiewicz <redacted>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Daniel Lezcano <redacted>
Cc: Kukjin Kim <redacted>
---
  arch/arm/mach-exynos/cpuidle.c | 8 ++------
  1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c
index da65b03..f57cb91 100644
--- a/arch/arm/mach-exynos/cpuidle.c
+++ b/arch/arm/mach-exynos/cpuidle.c
@@ -172,8 +172,8 @@ static int exynos4_enter_lowpower(struct cpuidle_device *dev,
  {
  	int new_index = index;

-	/* This mode only can be entered when other core's are offline */
-	if (num_online_cpus() > 1)
+	/* AFTR can only be entered when cores other than CPU0 are offline */
+	if (num_online_cpus() > 1 || dev->cpu != 0)
  		new_index = drv->safe_state_index;

  	if (new_index == 0)
@@ -235,10 +235,6 @@ static int exynos_cpuidle_probe(struct platform_device *pdev)
  		device = &per_cpu(exynos4_cpuidle_device, cpu_id);
  		device->cpu = cpu_id;

-		/* Support IDLE only */
-		if (cpu_id != 0)
-			device->state_count = 1;
-
  		ret = cpuidle_register_device(device);
  		if (ret) {
  			dev_err(&pdev->dev, "failed to register cpuidle device\n");
Hi Bartlomiej,

thanks for this cleanup. May be you can also add another patch to switch to the generic cpuidle_register function ?

Thanks
  -- Daniel

-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Thread (21 messages) 21 messages, 5 authors, last reply 2014-01-13
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help