diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-07 13:13:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-07 13:13:52 -0500 |
commit | 3c00303206c3a1ccd86579efdc90bc35f140962e (patch) | |
tree | 66170c84b5ddaeb102aea3530517a26657b6ea29 /arch/arm/mach-davinci | |
parent | 83dbb15e9cd78a3619e3db36777e2f81d09b2914 (diff) | |
parent | efb90582c575084723cc14302c1300cb26c7e01f (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
cpuidle: Single/Global registration of idle states
cpuidle: Split cpuidle_state structure and move per-cpu statistics fields
cpuidle: Remove CPUIDLE_FLAG_IGNORE and dev->prepare()
cpuidle: Move dev->last_residency update to driver enter routine; remove dev->last_state
ACPI: Fix CONFIG_ACPI_DOCK=n compiler warning
ACPI: Export FADT pm_profile integer value to userspace
thermal: Prevent polling from happening during system suspend
ACPI: Drop ACPI_NO_HARDWARE_INIT
ACPI atomicio: Convert width in bits to bytes in __acpi_ioremap_fast()
PNPACPI: Simplify disabled resource registration
ACPI: Fix possible recursive locking in hwregs.c
ACPI: use kstrdup()
mrst pmu: update comment
tools/power turbostat: less verbose debugging
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r-- | arch/arm/mach-davinci/cpuidle.c | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c index 60d2f4871afa..a30c7c5a6d83 100644 --- a/arch/arm/mach-davinci/cpuidle.c +++ b/arch/arm/mach-davinci/cpuidle.c | |||
@@ -79,9 +79,11 @@ static struct davinci_ops davinci_states[DAVINCI_CPUIDLE_MAX_STATES] = { | |||
79 | 79 | ||
80 | /* Actual code that puts the SoC in different idle states */ | 80 | /* Actual code that puts the SoC in different idle states */ |
81 | static int davinci_enter_idle(struct cpuidle_device *dev, | 81 | static int davinci_enter_idle(struct cpuidle_device *dev, |
82 | struct cpuidle_state *state) | 82 | struct cpuidle_driver *drv, |
83 | int index) | ||
83 | { | 84 | { |
84 | struct davinci_ops *ops = cpuidle_get_statedata(state); | 85 | struct cpuidle_state_usage *state_usage = &dev->states_usage[index]; |
86 | struct davinci_ops *ops = cpuidle_get_statedata(state_usage); | ||
85 | struct timeval before, after; | 87 | struct timeval before, after; |
86 | int idle_time; | 88 | int idle_time; |
87 | 89 | ||
@@ -99,13 +101,17 @@ static int davinci_enter_idle(struct cpuidle_device *dev, | |||
99 | local_irq_enable(); | 101 | local_irq_enable(); |
100 | idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + | 102 | idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + |
101 | (after.tv_usec - before.tv_usec); | 103 | (after.tv_usec - before.tv_usec); |
102 | return idle_time; | 104 | |
105 | dev->last_residency = idle_time; | ||
106 | |||
107 | return index; | ||
103 | } | 108 | } |
104 | 109 | ||
105 | static int __init davinci_cpuidle_probe(struct platform_device *pdev) | 110 | static int __init davinci_cpuidle_probe(struct platform_device *pdev) |
106 | { | 111 | { |
107 | int ret; | 112 | int ret; |
108 | struct cpuidle_device *device; | 113 | struct cpuidle_device *device; |
114 | struct cpuidle_driver *driver = &davinci_idle_driver; | ||
109 | struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; | 115 | struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; |
110 | 116 | ||
111 | device = &per_cpu(davinci_cpuidle_device, smp_processor_id()); | 117 | device = &per_cpu(davinci_cpuidle_device, smp_processor_id()); |
@@ -117,32 +123,33 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev) | |||
117 | 123 | ||
118 | ddr2_reg_base = pdata->ddr2_ctlr_base; | 124 | ddr2_reg_base = pdata->ddr2_ctlr_base; |
119 | 125 | ||
120 | ret = cpuidle_register_driver(&davinci_idle_driver); | ||
121 | if (ret) { | ||
122 | dev_err(&pdev->dev, "failed to register driver\n"); | ||
123 | return ret; | ||
124 | } | ||
125 | |||
126 | /* Wait for interrupt state */ | 126 | /* Wait for interrupt state */ |
127 | device->states[0].enter = davinci_enter_idle; | 127 | driver->states[0].enter = davinci_enter_idle; |
128 | device->states[0].exit_latency = 1; | 128 | driver->states[0].exit_latency = 1; |
129 | device->states[0].target_residency = 10000; | 129 | driver->states[0].target_residency = 10000; |
130 | device->states[0].flags = CPUIDLE_FLAG_TIME_VALID; | 130 | driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID; |
131 | strcpy(device->states[0].name, "WFI"); | 131 | strcpy(driver->states[0].name, "WFI"); |
132 | strcpy(device->states[0].desc, "Wait for interrupt"); | 132 | strcpy(driver->states[0].desc, "Wait for interrupt"); |
133 | 133 | ||
134 | /* Wait for interrupt and DDR self refresh state */ | 134 | /* Wait for interrupt and DDR self refresh state */ |
135 | device->states[1].enter = davinci_enter_idle; | 135 | driver->states[1].enter = davinci_enter_idle; |
136 | device->states[1].exit_latency = 10; | 136 | driver->states[1].exit_latency = 10; |
137 | device->states[1].target_residency = 10000; | 137 | driver->states[1].target_residency = 10000; |
138 | device->states[1].flags = CPUIDLE_FLAG_TIME_VALID; | 138 | driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID; |
139 | strcpy(device->states[1].name, "DDR SR"); | 139 | strcpy(driver->states[1].name, "DDR SR"); |
140 | strcpy(device->states[1].desc, "WFI and DDR Self Refresh"); | 140 | strcpy(driver->states[1].desc, "WFI and DDR Self Refresh"); |
141 | if (pdata->ddr2_pdown) | 141 | if (pdata->ddr2_pdown) |
142 | davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN; | 142 | davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN; |
143 | cpuidle_set_statedata(&device->states[1], &davinci_states[1]); | 143 | cpuidle_set_statedata(&device->states_usage[1], &davinci_states[1]); |
144 | 144 | ||
145 | device->state_count = DAVINCI_CPUIDLE_MAX_STATES; | 145 | device->state_count = DAVINCI_CPUIDLE_MAX_STATES; |
146 | driver->state_count = DAVINCI_CPUIDLE_MAX_STATES; | ||
147 | |||
148 | ret = cpuidle_register_driver(&davinci_idle_driver); | ||
149 | if (ret) { | ||
150 | dev_err(&pdev->dev, "failed to register driver\n"); | ||
151 | return ret; | ||
152 | } | ||
146 | 153 | ||
147 | ret = cpuidle_register_device(device); | 154 | ret = cpuidle_register_device(device); |
148 | if (ret) { | 155 | if (ret) { |