~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-tegra/cpuidle-tegra114.c

Version: ~ [ linux-5.3-rc5 ] ~ [ linux-5.2.9 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.67 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.139 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.189 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.189 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.72 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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 <asm/firmware.h>
 18 #include <linux/tick.h>
 19 #include <linux/cpuidle.h>
 20 #include <linux/cpu_pm.h>
 21 #include <linux/kernel.h>
 22 #include <linux/module.h>
 23 
 24 #include <asm/cpuidle.h>
 25 #include <asm/smp_plat.h>
 26 #include <asm/suspend.h>
 27 #include <asm/psci.h>
 28 
 29 #include "cpuidle.h"
 30 #include "pm.h"
 31 #include "sleep.h"
 32 
 33 #ifdef CONFIG_PM_SLEEP
 34 #define TEGRA114_MAX_STATES 2
 35 #else
 36 #define TEGRA114_MAX_STATES 1
 37 #endif
 38 
 39 #ifdef CONFIG_PM_SLEEP
 40 static int tegra114_idle_power_down(struct cpuidle_device *dev,
 41                                     struct cpuidle_driver *drv,
 42                                     int index)
 43 {
 44         local_fiq_disable();
 45 
 46         tegra_set_cpu_in_lp2();
 47         cpu_pm_enter();
 48 
 49         call_firmware_op(prepare_idle);
 50 
 51         /* Do suspend by ourselves if the firmware does not implement it */
 52         if (call_firmware_op(do_idle, 0) == -ENOSYS)
 53                 cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
 54 
 55         cpu_pm_exit();
 56         tegra_clear_cpu_in_lp2();
 57 
 58         local_fiq_enable();
 59 
 60         return index;
 61 }
 62 
 63 static void tegra114_idle_enter_freeze(struct cpuidle_device *dev,
 64                                        struct cpuidle_driver *drv,
 65                                        int index)
 66 {
 67        tegra114_idle_power_down(dev, drv, index);
 68 }
 69 #endif
 70 
 71 static struct cpuidle_driver tegra_idle_driver = {
 72         .name = "tegra_idle",
 73         .owner = THIS_MODULE,
 74         .state_count = TEGRA114_MAX_STATES,
 75         .states = {
 76                 [0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
 77 #ifdef CONFIG_PM_SLEEP
 78                 [1] = {
 79                         .enter                  = tegra114_idle_power_down,
 80                         .enter_freeze           = tegra114_idle_enter_freeze,
 81                         .exit_latency           = 500,
 82                         .target_residency       = 1000,
 83                         .flags                  = CPUIDLE_FLAG_TIMER_STOP,
 84                         .power_usage            = 0,
 85                         .name                   = "powered-down",
 86                         .desc                   = "CPU power gated",
 87                 },
 88 #endif
 89         },
 90 };
 91 
 92 int __init tegra114_cpuidle_init(void)
 93 {
 94         if (!psci_smp_available())
 95                 return cpuidle_register(&tegra_idle_driver, NULL);
 96 
 97         return 0;
 98 }
 99 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp