Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v3.16-rc3 99 lines 2.2 kB view raw
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);