hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/arch/arm/mach-imx/cpuidle-imx6q.c
....@@ -1,9 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2012 Freescale Semiconductor, Inc.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License version 2 as
6
- * published by the Free Software Foundation.
74 */
85
96 #include <linux/cpuidle.h>
....@@ -17,22 +14,24 @@
1714 #include "hardware.h"
1815
1916 static int num_idle_cpus = 0;
20
-static DEFINE_SPINLOCK(cpuidle_lock);
17
+static DEFINE_RAW_SPINLOCK(cpuidle_lock);
2118
2219 static int imx6q_enter_wait(struct cpuidle_device *dev,
2320 struct cpuidle_driver *drv, int index)
2421 {
25
- spin_lock(&cpuidle_lock);
22
+ raw_spin_lock(&cpuidle_lock);
2623 if (++num_idle_cpus == num_online_cpus())
2724 imx6_set_lpm(WAIT_UNCLOCKED);
28
- spin_unlock(&cpuidle_lock);
25
+ raw_spin_unlock(&cpuidle_lock);
2926
27
+ rcu_idle_enter();
3028 cpu_do_idle();
29
+ rcu_idle_exit();
3130
32
- spin_lock(&cpuidle_lock);
31
+ raw_spin_lock(&cpuidle_lock);
3332 if (num_idle_cpus-- == num_online_cpus())
3433 imx6_set_lpm(WAIT_CLOCKED);
35
- spin_unlock(&cpuidle_lock);
34
+ raw_spin_unlock(&cpuidle_lock);
3635
3736 return index;
3837 }
....@@ -47,7 +46,7 @@
4746 {
4847 .exit_latency = 50,
4948 .target_residency = 75,
50
- .flags = CPUIDLE_FLAG_TIMER_STOP,
49
+ .flags = CPUIDLE_FLAG_TIMER_STOP | CPUIDLE_FLAG_RCU_IDLE,
5150 .enter = imx6q_enter_wait,
5251 .name = "WAIT",
5352 .desc = "Clock off",
....@@ -65,13 +64,13 @@
6564 */
6665 void imx6q_cpuidle_fec_irqs_used(void)
6766 {
68
- imx6q_cpuidle_driver.states[1].disabled = true;
67
+ cpuidle_driver_state_disabled(&imx6q_cpuidle_driver, 1, true);
6968 }
7069 EXPORT_SYMBOL_GPL(imx6q_cpuidle_fec_irqs_used);
7170
7271 void imx6q_cpuidle_fec_irqs_unused(void)
7372 {
74
- imx6q_cpuidle_driver.states[1].disabled = false;
73
+ cpuidle_driver_state_disabled(&imx6q_cpuidle_driver, 1, false);
7574 }
7675 EXPORT_SYMBOL_GPL(imx6q_cpuidle_fec_irqs_unused);
7776