39 #include <linux/sched.h>
43 #include <linux/module.h>
47 #include <asm/system_misc.h>
53 #include <plat/clock.h>
60 #include <mach/irqs.h>
72 #ifdef CONFIG_OMAP_32K_TIMER
74 static unsigned short enable_dyn_sleep = 1;
79 return sprintf(buf,
"%hu\n", enable_dyn_sleep);
83 const char *
buf,
size_t n)
86 if (
sscanf(buf,
"%hu", &value) != 1 ||
87 (value != 0 && value != 1)) {
91 enable_dyn_sleep =
value;
96 __ATTR(sleep_while_idle, 0644, idle_show, idle_store);
100 static void (*omap_sram_suspend)(
unsigned long r0,
unsigned long r1) =
NULL;
116 #if defined(CONFIG_OMAP_MPU_TIMER) && !defined(CONFIG_OMAP_DM_TIMER)
117 #warning Enable 32kHz OS timer in order to allow sleep states in idle
118 use_idlect1 = use_idlect1 & ~(1 << 9);
121 while (enable_dyn_sleep) {
123 #ifdef CONFIG_CBUS_TAHVO_USB
124 extern int vbus_active;
135 #ifdef CONFIG_OMAP_DM_TIMER
140 use_idlect1 &= ~(1 << 6);
145 if ((use_idlect1 != ~0) || !do_sleep) {
153 __asm__ volatile (
"mcr p15, 0, r0, c7, c0, 4");
170 static void omap_pm_wakeup_setup(
void)
223 unsigned long arg0 = 0,
arg1 = 0;
320 omap_pm_wakeup_setup();
351 omap_sram_suspend(arg0,
arg1);
425 #if defined(DEBUG) && defined(CONFIG_PROC_FS)
426 static int g_read_completed;
431 static int omap_pm_read_proc(
433 char **my_first_byte,
439 int my_buffer_offset = 0;
440 char *
const my_base = page_buffer;
482 if (virtual_start == 0) {
483 g_read_completed = 0;
485 my_buffer_offset +=
sprintf(my_base + my_buffer_offset,
486 "ARM_CKCTL_REG: 0x%-8x \n"
487 "ARM_IDLECT1_REG: 0x%-8x \n"
488 "ARM_IDLECT2_REG: 0x%-8x \n"
489 "ARM_IDLECT3_REG: 0x%-8x \n"
490 "ARM_EWUPCT_REG: 0x%-8x \n"
491 "ARM_RSTCT1_REG: 0x%-8x \n"
492 "ARM_RSTCT2_REG: 0x%-8x \n"
493 "ARM_SYSST_REG: 0x%-8x \n"
494 "ULPD_IT_STATUS_REG: 0x%-4x \n"
495 "ULPD_CLOCK_CTRL_REG: 0x%-4x \n"
496 "ULPD_SOFT_REQ_REG: 0x%-4x \n"
497 "ULPD_DPLL_CTRL_REG: 0x%-4x \n"
498 "ULPD_STATUS_REQ_REG: 0x%-4x \n"
499 "ULPD_POWER_CTRL_REG: 0x%-4x \n",
516 my_buffer_offset +=
sprintf(my_base + my_buffer_offset,
517 "MPUI7XX_CTRL_REG 0x%-8x \n"
518 "MPUI7XX_DSP_STATUS_REG: 0x%-8x \n"
519 "MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
520 "MPUI7XX_DSP_API_CONFIG_REG: 0x%-8x \n"
521 "MPUI7XX_SDRAM_CONFIG_REG: 0x%-8x \n"
522 "MPUI7XX_EMIFS_CONFIG_REG: 0x%-8x \n",
530 my_buffer_offset +=
sprintf(my_base + my_buffer_offset,
531 "MPUI1510_CTRL_REG 0x%-8x \n"
532 "MPUI1510_DSP_STATUS_REG: 0x%-8x \n"
533 "MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
534 "MPUI1510_DSP_API_CONFIG_REG: 0x%-8x \n"
535 "MPUI1510_SDRAM_CONFIG_REG: 0x%-8x \n"
536 "MPUI1510_EMIFS_CONFIG_REG: 0x%-8x \n",
544 my_buffer_offset +=
sprintf(my_base + my_buffer_offset,
545 "MPUI1610_CTRL_REG 0x%-8x \n"
546 "MPUI1610_DSP_STATUS_REG: 0x%-8x \n"
547 "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
548 "MPUI1610_DSP_API_CONFIG_REG: 0x%-8x \n"
549 "MPUI1610_SDRAM_CONFIG_REG: 0x%-8x \n"
550 "MPUI1610_EMIFS_CONFIG_REG: 0x%-8x \n",
560 }
else if (g_read_completed >= 1) {
566 *my_first_byte = page_buffer;
567 return my_buffer_offset;
570 static void omap_pm_init_proc(
void)
573 create_proc_read_entry(
"driver/omap_pm",
575 omap_pm_read_proc,
NULL);
584 static int omap_pm_prepare(
void)
622 static void omap_pm_finish(
void)
633 static struct irqaction omap_wakeup_irq = {
634 .name =
"peripheral wakeup",
636 .handler = omap_wakeup_interrupt
642 .prepare = omap_pm_prepare,
643 .enter = omap_pm_enter,
644 .finish = omap_pm_finish,
648 static int __init omap_pm_init(
void)
651 #ifdef CONFIG_OMAP_32K_TIMER
658 printk(
"Power Management for TI OMAP.\n");
667 omap7xx_cpu_suspend_sz);
670 omap1510_cpu_suspend_sz);
673 omap1610_cpu_suspend_sz);
676 if (omap_sram_suspend ==
NULL) {
704 #if defined(DEBUG) && defined(CONFIG_PROC_FS)
708 #ifdef CONFIG_OMAP_32K_TIMER