diff options
author | Joseph Lo <josephl@nvidia.com> | 2013-01-21 04:49:06 -0500 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2013-01-29 13:01:23 -0500 |
commit | 51dc5259e8e1a05b9224e0c3ad61ebc3dc17d885 (patch) | |
tree | 02654cf268a2fa641dcecc4a3de9a9e4356b18d2 | |
parent | 2da139657b108ab4485640178dd4d7f3ca931065 (diff) |
ARM: tegra: add Tegra114 ARM_CPUIDLE_WFI_STATE support
Adding the generic ARM_CPUIDLE_WFI_STATE support for Tegra114.
Signed-off-by: Joseph Lo <josephl@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/cpuidle-tegra114.c | 61 | ||||
-rw-r--r-- | arch/arm/mach-tegra/cpuidle.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-tegra/cpuidle.h | 6 |
4 files changed, 73 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 8165b0a477da..f6b46ae2b7f8 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile | |||
@@ -30,6 +30,9 @@ obj-$(CONFIG_TEGRA_PCI) += pcie.o | |||
30 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-dt-tegra20.o | 30 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-dt-tegra20.o |
31 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o | 31 | obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o |
32 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += board-dt-tegra114.o | 32 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += board-dt-tegra114.o |
33 | ifeq ($(CONFIG_CPU_IDLE),y) | ||
34 | obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o | ||
35 | endif | ||
33 | 36 | ||
34 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-harmony-pcie.o | 37 | obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += board-harmony-pcie.o |
35 | 38 | ||
diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c new file mode 100644 index 000000000000..0f4e8c483b34 --- /dev/null +++ b/arch/arm/mach-tegra/cpuidle-tegra114.c | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013, NVIDIA Corporation. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/cpuidle.h> | ||
20 | |||
21 | #include <asm/cpuidle.h> | ||
22 | |||
23 | static struct cpuidle_driver tegra_idle_driver = { | ||
24 | .name = "tegra_idle", | ||
25 | .owner = THIS_MODULE, | ||
26 | .en_core_tk_irqen = 1, | ||
27 | .state_count = 1, | ||
28 | .states = { | ||
29 | [0] = ARM_CPUIDLE_WFI_STATE_PWR(600), | ||
30 | }, | ||
31 | }; | ||
32 | |||
33 | static DEFINE_PER_CPU(struct cpuidle_device, tegra_idle_device); | ||
34 | |||
35 | int __init tegra114_cpuidle_init(void) | ||
36 | { | ||
37 | int ret; | ||
38 | unsigned int cpu; | ||
39 | struct cpuidle_device *dev; | ||
40 | struct cpuidle_driver *drv = &tegra_idle_driver; | ||
41 | |||
42 | ret = cpuidle_register_driver(&tegra_idle_driver); | ||
43 | if (ret) { | ||
44 | pr_err("CPUidle driver registration failed\n"); | ||
45 | return ret; | ||
46 | } | ||
47 | |||
48 | for_each_possible_cpu(cpu) { | ||
49 | dev = &per_cpu(tegra_idle_device, cpu); | ||
50 | dev->cpu = cpu; | ||
51 | |||
52 | dev->state_count = drv->state_count; | ||
53 | ret = cpuidle_register_device(dev); | ||
54 | if (ret) { | ||
55 | pr_err("CPU%u: CPUidle device registration failed\n", | ||
56 | cpu); | ||
57 | return ret; | ||
58 | } | ||
59 | } | ||
60 | return 0; | ||
61 | } | ||
diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c index d0651397aec7..4b744c4661e2 100644 --- a/arch/arm/mach-tegra/cpuidle.c +++ b/arch/arm/mach-tegra/cpuidle.c | |||
@@ -38,6 +38,9 @@ static int __init tegra_cpuidle_init(void) | |||
38 | case TEGRA30: | 38 | case TEGRA30: |
39 | ret = tegra30_cpuidle_init(); | 39 | ret = tegra30_cpuidle_init(); |
40 | break; | 40 | break; |
41 | case TEGRA114: | ||
42 | ret = tegra114_cpuidle_init(); | ||
43 | break; | ||
41 | default: | 44 | default: |
42 | ret = -ENODEV; | 45 | ret = -ENODEV; |
43 | break; | 46 | break; |
diff --git a/arch/arm/mach-tegra/cpuidle.h b/arch/arm/mach-tegra/cpuidle.h index 496204d34e55..d733f75d0208 100644 --- a/arch/arm/mach-tegra/cpuidle.h +++ b/arch/arm/mach-tegra/cpuidle.h | |||
@@ -29,4 +29,10 @@ int tegra30_cpuidle_init(void); | |||
29 | static inline int tegra30_cpuidle_init(void) { return -ENODEV; } | 29 | static inline int tegra30_cpuidle_init(void) { return -ENODEV; } |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #ifdef CONFIG_ARCH_TEGRA_114_SOC | ||
33 | int tegra114_cpuidle_init(void); | ||
34 | #else | ||
35 | static inline int tegra114_cpuidle_init(void) { return -ENODEV; } | ||
36 | #endif | ||
37 | |||
32 | #endif | 38 | #endif |