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

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-imx/cpuidle-imx6q.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * Copyright (C) 2012 Freescale Semiconductor, Inc.
  4  */
  5 
  6 #include <linux/context_tracking.h>
  7 #include <linux/cpuidle.h>
  8 #include <linux/module.h>
  9 #include <asm/cpuidle.h>
 10 
 11 #include <soc/imx/cpuidle.h>
 12 
 13 #include "common.h"
 14 #include "cpuidle.h"
 15 #include "hardware.h"
 16 
 17 static int num_idle_cpus = 0;
 18 static DEFINE_RAW_SPINLOCK(cpuidle_lock);
 19 
 20 static __cpuidle int imx6q_enter_wait(struct cpuidle_device *dev,
 21                                       struct cpuidle_driver *drv, int index)
 22 {
 23         raw_spin_lock(&cpuidle_lock);
 24         if (++num_idle_cpus == num_online_cpus())
 25                 imx6_set_lpm(WAIT_UNCLOCKED);
 26         raw_spin_unlock(&cpuidle_lock);
 27 
 28         ct_cpuidle_enter();
 29         cpu_do_idle();
 30         ct_cpuidle_exit();
 31 
 32         raw_spin_lock(&cpuidle_lock);
 33         if (num_idle_cpus-- == num_online_cpus())
 34                 imx6_set_lpm(WAIT_CLOCKED);
 35         raw_spin_unlock(&cpuidle_lock);
 36 
 37         return index;
 38 }
 39 
 40 static struct cpuidle_driver imx6q_cpuidle_driver = {
 41         .name = "imx6q_cpuidle",
 42         .owner = THIS_MODULE,
 43         .states = {
 44                 /* WFI */
 45                 ARM_CPUIDLE_WFI_STATE,
 46                 /* WAIT */
 47                 {
 48                         .exit_latency = 50,
 49                         .target_residency = 75,
 50                         .flags = CPUIDLE_FLAG_TIMER_STOP | CPUIDLE_FLAG_RCU_IDLE,
 51                         .enter = imx6q_enter_wait,
 52                         .name = "WAIT",
 53                         .desc = "Clock off",
 54                 },
 55         },
 56         .state_count = 2,
 57         .safe_state_index = 0,
 58 };
 59 
 60 /*
 61  * i.MX6 Q/DL has an erratum (ERR006687) that prevents the FEC from waking the
 62  * CPUs when they are in wait(unclocked) state. As the hardware workaround isn't
 63  * applicable to all boards, disable the deeper idle state when the workaround
 64  * isn't present and the FEC is in use.
 65  */
 66 void imx6q_cpuidle_fec_irqs_used(void)
 67 {
 68         cpuidle_driver_state_disabled(&imx6q_cpuidle_driver, 1, true);
 69 }
 70 EXPORT_SYMBOL_GPL(imx6q_cpuidle_fec_irqs_used);
 71 
 72 void imx6q_cpuidle_fec_irqs_unused(void)
 73 {
 74         cpuidle_driver_state_disabled(&imx6q_cpuidle_driver, 1, false);
 75 }
 76 EXPORT_SYMBOL_GPL(imx6q_cpuidle_fec_irqs_unused);
 77 
 78 int __init imx6q_cpuidle_init(void)
 79 {
 80         /* Set INT_MEM_CLK_LPM bit to get a reliable WAIT mode support */
 81         imx6_set_int_mem_clk_lpm(true);
 82 
 83         return cpuidle_register(&imx6q_cpuidle_driver, NULL);
 84 }
 85 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php