arm64: dts: Revert "specify console via command line"
[linux/fpc-iii.git] / arch / arm / mach-tegra / cpuidle-tegra114.c
blob5118f777fd66acef453e94fbb8ebab95de3e4638
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
4 */
6 #include <asm/firmware.h>
7 #include <linux/tick.h>
8 #include <linux/cpuidle.h>
9 #include <linux/cpu_pm.h>
10 #include <linux/kernel.h>
11 #include <linux/module.h>
13 #include <linux/firmware/trusted_foundations.h>
15 #include <asm/cpuidle.h>
16 #include <asm/smp_plat.h>
17 #include <asm/suspend.h>
18 #include <asm/psci.h>
20 #include "cpuidle.h"
21 #include "pm.h"
22 #include "sleep.h"
24 #ifdef CONFIG_PM_SLEEP
25 #define TEGRA114_MAX_STATES 2
26 #else
27 #define TEGRA114_MAX_STATES 1
28 #endif
30 #ifdef CONFIG_PM_SLEEP
31 static int tegra114_idle_power_down(struct cpuidle_device *dev,
32 struct cpuidle_driver *drv,
33 int index)
35 local_fiq_disable();
37 tegra_set_cpu_in_lp2();
38 cpu_pm_enter();
40 call_firmware_op(prepare_idle, TF_PM_MODE_LP2_NOFLUSH_L2);
42 /* Do suspend by ourselves if the firmware does not implement it */
43 if (call_firmware_op(do_idle, 0) == -ENOSYS)
44 cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
46 cpu_pm_exit();
47 tegra_clear_cpu_in_lp2();
49 local_fiq_enable();
51 return index;
54 static void tegra114_idle_enter_s2idle(struct cpuidle_device *dev,
55 struct cpuidle_driver *drv,
56 int index)
58 tegra114_idle_power_down(dev, drv, index);
60 #endif
62 static struct cpuidle_driver tegra_idle_driver = {
63 .name = "tegra_idle",
64 .owner = THIS_MODULE,
65 .state_count = TEGRA114_MAX_STATES,
66 .states = {
67 [0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
68 #ifdef CONFIG_PM_SLEEP
69 [1] = {
70 .enter = tegra114_idle_power_down,
71 .enter_s2idle = tegra114_idle_enter_s2idle,
72 .exit_latency = 500,
73 .target_residency = 1000,
74 .flags = CPUIDLE_FLAG_TIMER_STOP,
75 .power_usage = 0,
76 .name = "powered-down",
77 .desc = "CPU power gated",
79 #endif
83 int __init tegra114_cpuidle_init(void)
85 if (!psci_smp_available())
86 return cpuidle_register(&tegra_idle_driver, NULL);
88 return 0;