diff options
Diffstat (limited to 'arch/arm/mach-omap1/pm.c')
-rw-r--r-- | arch/arm/mach-omap1/pm.c | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c index db37f49da5ac..dd712f109738 100644 --- a/arch/arm/mach-omap1/pm.c +++ b/arch/arm/mach-omap1/pm.c | |||
@@ -37,7 +37,8 @@ | |||
37 | 37 | ||
38 | #include <linux/suspend.h> | 38 | #include <linux/suspend.h> |
39 | #include <linux/sched.h> | 39 | #include <linux/sched.h> |
40 | #include <linux/proc_fs.h> | 40 | #include <linux/debugfs.h> |
41 | #include <linux/seq_file.h> | ||
41 | #include <linux/interrupt.h> | 42 | #include <linux/interrupt.h> |
42 | #include <linux/sysfs.h> | 43 | #include <linux/sysfs.h> |
43 | #include <linux/module.h> | 44 | #include <linux/module.h> |
@@ -423,23 +424,12 @@ void omap1_pm_suspend(void) | |||
423 | omap_rev()); | 424 | omap_rev()); |
424 | } | 425 | } |
425 | 426 | ||
426 | #if defined(DEBUG) && defined(CONFIG_PROC_FS) | 427 | #ifdef CONFIG_DEBUG_FS |
427 | static int g_read_completed; | ||
428 | |||
429 | /* | 428 | /* |
430 | * Read system PM registers for debugging | 429 | * Read system PM registers for debugging |
431 | */ | 430 | */ |
432 | static int omap_pm_read_proc( | 431 | static int omap_pm_debug_show(struct seq_file *m, void *v) |
433 | char *page_buffer, | ||
434 | char **my_first_byte, | ||
435 | off_t virtual_start, | ||
436 | int length, | ||
437 | int *eof, | ||
438 | void *data) | ||
439 | { | 432 | { |
440 | int my_buffer_offset = 0; | ||
441 | char * const my_base = page_buffer; | ||
442 | |||
443 | ARM_SAVE(ARM_CKCTL); | 433 | ARM_SAVE(ARM_CKCTL); |
444 | ARM_SAVE(ARM_IDLECT1); | 434 | ARM_SAVE(ARM_IDLECT1); |
445 | ARM_SAVE(ARM_IDLECT2); | 435 | ARM_SAVE(ARM_IDLECT2); |
@@ -480,10 +470,7 @@ static int omap_pm_read_proc( | |||
480 | MPUI1610_SAVE(EMIFS_CONFIG); | 470 | MPUI1610_SAVE(EMIFS_CONFIG); |
481 | } | 471 | } |
482 | 472 | ||
483 | if (virtual_start == 0) { | 473 | seq_printf(m, |
484 | g_read_completed = 0; | ||
485 | |||
486 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | ||
487 | "ARM_CKCTL_REG: 0x%-8x \n" | 474 | "ARM_CKCTL_REG: 0x%-8x \n" |
488 | "ARM_IDLECT1_REG: 0x%-8x \n" | 475 | "ARM_IDLECT1_REG: 0x%-8x \n" |
489 | "ARM_IDLECT2_REG: 0x%-8x \n" | 476 | "ARM_IDLECT2_REG: 0x%-8x \n" |
@@ -513,8 +500,8 @@ static int omap_pm_read_proc( | |||
513 | ULPD_SHOW(ULPD_STATUS_REQ), | 500 | ULPD_SHOW(ULPD_STATUS_REQ), |
514 | ULPD_SHOW(ULPD_POWER_CTRL)); | 501 | ULPD_SHOW(ULPD_POWER_CTRL)); |
515 | 502 | ||
516 | if (cpu_is_omap7xx()) { | 503 | if (cpu_is_omap7xx()) { |
517 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | 504 | seq_printf(m, |
518 | "MPUI7XX_CTRL_REG 0x%-8x \n" | 505 | "MPUI7XX_CTRL_REG 0x%-8x \n" |
519 | "MPUI7XX_DSP_STATUS_REG: 0x%-8x \n" | 506 | "MPUI7XX_DSP_STATUS_REG: 0x%-8x \n" |
520 | "MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n" | 507 | "MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n" |
@@ -527,8 +514,8 @@ static int omap_pm_read_proc( | |||
527 | MPUI7XX_SHOW(MPUI_DSP_API_CONFIG), | 514 | MPUI7XX_SHOW(MPUI_DSP_API_CONFIG), |
528 | MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG), | 515 | MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG), |
529 | MPUI7XX_SHOW(EMIFS_CONFIG)); | 516 | MPUI7XX_SHOW(EMIFS_CONFIG)); |
530 | } else if (cpu_is_omap15xx()) { | 517 | } else if (cpu_is_omap15xx()) { |
531 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | 518 | seq_printf(m, |
532 | "MPUI1510_CTRL_REG 0x%-8x \n" | 519 | "MPUI1510_CTRL_REG 0x%-8x \n" |
533 | "MPUI1510_DSP_STATUS_REG: 0x%-8x \n" | 520 | "MPUI1510_DSP_STATUS_REG: 0x%-8x \n" |
534 | "MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n" | 521 | "MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n" |
@@ -541,8 +528,8 @@ static int omap_pm_read_proc( | |||
541 | MPUI1510_SHOW(MPUI_DSP_API_CONFIG), | 528 | MPUI1510_SHOW(MPUI_DSP_API_CONFIG), |
542 | MPUI1510_SHOW(EMIFF_SDRAM_CONFIG), | 529 | MPUI1510_SHOW(EMIFF_SDRAM_CONFIG), |
543 | MPUI1510_SHOW(EMIFS_CONFIG)); | 530 | MPUI1510_SHOW(EMIFS_CONFIG)); |
544 | } else if (cpu_is_omap16xx()) { | 531 | } else if (cpu_is_omap16xx()) { |
545 | my_buffer_offset += sprintf(my_base + my_buffer_offset, | 532 | seq_printf(m, |
546 | "MPUI1610_CTRL_REG 0x%-8x \n" | 533 | "MPUI1610_CTRL_REG 0x%-8x \n" |
547 | "MPUI1610_DSP_STATUS_REG: 0x%-8x \n" | 534 | "MPUI1610_DSP_STATUS_REG: 0x%-8x \n" |
548 | "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n" | 535 | "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n" |
@@ -555,28 +542,37 @@ static int omap_pm_read_proc( | |||
555 | MPUI1610_SHOW(MPUI_DSP_API_CONFIG), | 542 | MPUI1610_SHOW(MPUI_DSP_API_CONFIG), |
556 | MPUI1610_SHOW(EMIFF_SDRAM_CONFIG), | 543 | MPUI1610_SHOW(EMIFF_SDRAM_CONFIG), |
557 | MPUI1610_SHOW(EMIFS_CONFIG)); | 544 | MPUI1610_SHOW(EMIFS_CONFIG)); |
558 | } | ||
559 | |||
560 | g_read_completed++; | ||
561 | } else if (g_read_completed >= 1) { | ||
562 | *eof = 1; | ||
563 | return 0; | ||
564 | } | 545 | } |
565 | g_read_completed++; | ||
566 | 546 | ||
567 | *my_first_byte = page_buffer; | 547 | return 0; |
568 | return my_buffer_offset; | 548 | } |
549 | |||
550 | static int omap_pm_debug_open(struct inode *inode, struct file *file) | ||
551 | { | ||
552 | return single_open(file, omap_pm_debug_show, | ||
553 | &inode->i_private); | ||
569 | } | 554 | } |
570 | 555 | ||
571 | static void omap_pm_init_proc(void) | 556 | static const struct file_operations omap_pm_debug_fops = { |
557 | .open = omap_pm_debug_open, | ||
558 | .read = seq_read, | ||
559 | .llseek = seq_lseek, | ||
560 | .release = seq_release, | ||
561 | }; | ||
562 | |||
563 | static void omap_pm_init_debugfs(void) | ||
572 | { | 564 | { |
573 | /* XXX Appears to leak memory */ | 565 | struct dentry *d; |
574 | create_proc_read_entry("driver/omap_pm", | 566 | |
575 | S_IWUSR | S_IRUGO, NULL, | 567 | d = debugfs_create_dir("pm_debug", NULL); |
576 | omap_pm_read_proc, NULL); | 568 | if (!d) |
569 | return; | ||
570 | |||
571 | (void) debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO, | ||
572 | d, NULL, &omap_pm_debug_fops); | ||
577 | } | 573 | } |
578 | 574 | ||
579 | #endif /* DEBUG && CONFIG_PROC_FS */ | 575 | #endif /* CONFIG_DEBUG_FS */ |
580 | 576 | ||
581 | /* | 577 | /* |
582 | * omap_pm_prepare - Do preliminary suspend work. | 578 | * omap_pm_prepare - Do preliminary suspend work. |
@@ -701,8 +697,8 @@ static int __init omap_pm_init(void) | |||
701 | 697 | ||
702 | suspend_set_ops(&omap_pm_ops); | 698 | suspend_set_ops(&omap_pm_ops); |
703 | 699 | ||
704 | #if defined(DEBUG) && defined(CONFIG_PROC_FS) | 700 | #ifdef CONFIG_DEBUG_FS |
705 | omap_pm_init_proc(); | 701 | omap_pm_init_debugfs(); |
706 | #endif | 702 | #endif |
707 | 703 | ||
708 | #ifdef CONFIG_OMAP_32K_TIMER | 704 | #ifdef CONFIG_OMAP_32K_TIMER |