aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2014-05-08 17:57:35 -0400
committerKukjin Kim <kgene.kim@samsung.com>2014-05-25 16:21:46 -0400
commitff6a9c039dc7da12fcfc70c28ccc9893d85f8e1f (patch)
tree01f1bc8c00038723e573b1c694dd36153da8842d /drivers/cpuidle
parentce4305d2a5ad76d80c8edfd2f847ae34bcda32ab (diff)
ARM: EXYNOS: Move the driver to drivers/cpuidle directory
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Tomasz Figa <t.figa@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'drivers/cpuidle')
-rw-r--r--drivers/cpuidle/Kconfig.arm6
-rw-r--r--drivers/cpuidle/Makefile1
-rw-r--r--drivers/cpuidle/cpuidle-exynos.c99
3 files changed, 106 insertions, 0 deletions
diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm
index 97ccc31dbdd8..695507ae345a 100644
--- a/drivers/cpuidle/Kconfig.arm
+++ b/drivers/cpuidle/Kconfig.arm
@@ -44,3 +44,9 @@ config ARM_AT91_CPUIDLE
44 depends on ARCH_AT91 44 depends on ARCH_AT91
45 help 45 help
46 Select this to enable cpuidle for AT91 processors 46 Select this to enable cpuidle for AT91 processors
47
48config ARM_EXYNOS_CPUIDLE
49 bool "Cpu Idle Driver for the Exynos processors"
50 depends on ARCH_EXYNOS
51 help
52 Select this to enable cpuidle for Exynos processors
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index f71ae1b373c5..0d1540adaf78 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_ARM_KIRKWOOD_CPUIDLE) += cpuidle-kirkwood.o
13obj-$(CONFIG_ARM_ZYNQ_CPUIDLE) += cpuidle-zynq.o 13obj-$(CONFIG_ARM_ZYNQ_CPUIDLE) += cpuidle-zynq.o
14obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o 14obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o
15obj-$(CONFIG_ARM_AT91_CPUIDLE) += cpuidle-at91.o 15obj-$(CONFIG_ARM_AT91_CPUIDLE) += cpuidle-at91.o
16obj-$(CONFIG_ARM_EXYNOS_CPUIDLE) += cpuidle-exynos.o
16 17
17############################################################################### 18###############################################################################
18# POWERPC drivers 19# POWERPC drivers
diff --git a/drivers/cpuidle/cpuidle-exynos.c b/drivers/cpuidle/cpuidle-exynos.c
new file mode 100644
index 000000000000..7c0151263828
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-exynos.c
@@ -0,0 +1,99 @@
1/* linux/arch/arm/mach-exynos/cpuidle.c
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/cpuidle.h>
12#include <linux/cpu_pm.h>
13#include <linux/export.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16
17#include <asm/proc-fns.h>
18#include <asm/suspend.h>
19#include <asm/cpuidle.h>
20
21static void (*exynos_enter_aftr)(void);
22
23static int idle_finisher(unsigned long flags)
24{
25 exynos_enter_aftr();
26 cpu_do_idle();
27
28 return 1;
29}
30
31static int exynos_enter_core0_aftr(struct cpuidle_device *dev,
32 struct cpuidle_driver *drv,
33 int index)
34{
35 cpu_pm_enter();
36 cpu_suspend(0, idle_finisher);
37 cpu_pm_exit();
38
39 return index;
40}
41
42static int exynos_enter_lowpower(struct cpuidle_device *dev,
43 struct cpuidle_driver *drv,
44 int index)
45{
46 int new_index = index;
47
48 /* AFTR can only be entered when cores other than CPU0 are offline */
49 if (num_online_cpus() > 1 || dev->cpu != 0)
50 new_index = drv->safe_state_index;
51
52 if (new_index == 0)
53 return arm_cpuidle_simple_enter(dev, drv, new_index);
54 else
55 return exynos_enter_core0_aftr(dev, drv, new_index);
56}
57
58static struct cpuidle_driver exynos_idle_driver = {
59 .name = "exynos_idle",
60 .owner = THIS_MODULE,
61 .states = {
62 [0] = ARM_CPUIDLE_WFI_STATE,
63 [1] = {
64 .enter = exynos_enter_lowpower,
65 .exit_latency = 300,
66 .target_residency = 100000,
67 .flags = CPUIDLE_FLAG_TIME_VALID,
68 .name = "C1",
69 .desc = "ARM power down",
70 },
71 },
72 .state_count = 2,
73 .safe_state_index = 0,
74};
75
76static int exynos_cpuidle_probe(struct platform_device *pdev)
77{
78 int ret;
79
80 exynos_enter_aftr = (void *)(pdev->dev.platform_data);
81
82 ret = cpuidle_register(&exynos_idle_driver, NULL);
83 if (ret) {
84 dev_err(&pdev->dev, "failed to register cpuidle driver\n");
85 return ret;
86 }
87
88 return 0;
89}
90
91static struct platform_driver exynos_cpuidle_driver = {
92 .probe = exynos_cpuidle_probe,
93 .driver = {
94 .name = "exynos_cpuidle",
95 .owner = THIS_MODULE,
96 },
97};
98
99module_platform_driver(exynos_cpuidle_driver);