pm-r8a7740.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * r8a7740 power management support
  3. *
  4. * Copyright (C) 2012 Renesas Solutions Corp.
  5. * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file "COPYING" in the main directory of this archive
  9. * for more details.
  10. */
  11. #include <linux/console.h>
  12. #include <linux/suspend.h>
  13. #include "common.h"
  14. #include "pm-rmobile.h"
  15. #if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
  16. static int r8a7740_pd_a4s_suspend(void)
  17. {
  18. /*
  19. * The A4S domain contains the CPU core and therefore it should
  20. * only be turned off if the CPU is not in use.
  21. */
  22. return -EBUSY;
  23. }
  24. static int r8a7740_pd_a3sp_suspend(void)
  25. {
  26. /*
  27. * Serial consoles make use of SCIF hardware located in A3SP,
  28. * keep such power domain on if "no_console_suspend" is set.
  29. */
  30. return console_suspend_enabled ? 0 : -EBUSY;
  31. }
  32. static struct rmobile_pm_domain r8a7740_pm_domains[] = {
  33. {
  34. .genpd.name = "A4LC",
  35. .bit_shift = 1,
  36. }, {
  37. .genpd.name = "A4S",
  38. .bit_shift = 10,
  39. .gov = &pm_domain_always_on_gov,
  40. .no_debug = true,
  41. .suspend = r8a7740_pd_a4s_suspend,
  42. }, {
  43. .genpd.name = "A3SP",
  44. .bit_shift = 11,
  45. .gov = &pm_domain_always_on_gov,
  46. .no_debug = true,
  47. .suspend = r8a7740_pd_a3sp_suspend,
  48. },
  49. };
  50. void __init r8a7740_init_pm_domains(void)
  51. {
  52. rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains));
  53. pm_genpd_add_subdomain_names("A4S", "A3SP");
  54. }
  55. #endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */
  56. #ifdef CONFIG_SUSPEND
  57. static int r8a7740_enter_suspend(suspend_state_t suspend_state)
  58. {
  59. cpu_do_idle();
  60. return 0;
  61. }
  62. static void r8a7740_suspend_init(void)
  63. {
  64. shmobile_suspend_ops.enter = r8a7740_enter_suspend;
  65. }
  66. #else
  67. static void r8a7740_suspend_init(void) {}
  68. #endif
  69. void __init r8a7740_pm_init(void)
  70. {
  71. r8a7740_suspend_init();
  72. }