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 16#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM) 17static int r8a7740_pd_a4s_suspend(void) 18{ 19 /* 20 * The A4S domain contains the CPU core and therefore it should 21 * only be turned off if the CPU is not in use. 22 */ 23 return -EBUSY; 24} 25 26static int r8a7740_pd_a3sp_suspend(void) 27{ 28 /* 29 * Serial consoles make use of SCIF hardware located in A3SP, 30 * keep such power domain on if "no_console_suspend" is set. 31 */ 32 return console_suspend_enabled ? 0 : -EBUSY; 33} 34 35static struct rmobile_pm_domain r8a7740_pm_domains[] = { 36 { 37 .genpd.name = "A4LC", 38 .bit_shift = 1, 39 }, { 40 .genpd.name = "A4S", 41 .bit_shift = 10, 42 .gov = &pm_domain_always_on_gov, 43 .no_debug = true, 44 .suspend = r8a7740_pd_a4s_suspend, 45 }, { 46 .genpd.name = "A3SP", 47 .bit_shift = 11, 48 .gov = &pm_domain_always_on_gov, 49 .no_debug = true, 50 .suspend = r8a7740_pd_a3sp_suspend, 51 }, 52}; 53 54void __init r8a7740_init_pm_domains(void) 55{ 56 rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains)); 57 pm_genpd_add_subdomain_names("A4S", "A3SP"); 58} 59#endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */ 60 61#ifdef CONFIG_SUSPEND 62static int r8a7740_enter_suspend(suspend_state_t suspend_state) 63{ 64 cpu_do_idle(); 65 return 0; 66} 67 68static void r8a7740_suspend_init(void) 69{ 70 shmobile_suspend_ops.enter = r8a7740_enter_suspend; 71} 72#else 73static void r8a7740_suspend_init(void) {} 74#endif 75 76void __init r8a7740_pm_init(void) 77{ 78 r8a7740_suspend_init(); 79} 80