1750a7eeeSPaul Mundt /* 2d03299eeSPaul Mundt * Runtime PM support code 3750a7eeeSPaul Mundt * 4750a7eeeSPaul Mundt * Copyright (C) 2009-2010 Magnus Damm 5750a7eeeSPaul Mundt * 6750a7eeeSPaul Mundt * This file is subject to the terms and conditions of the GNU General Public 7750a7eeeSPaul Mundt * License. See the file "COPYING" in the main directory of this archive 8750a7eeeSPaul Mundt * for more details. 9750a7eeeSPaul Mundt */ 10750a7eeeSPaul Mundt 11750a7eeeSPaul Mundt #include <linux/init.h> 12750a7eeeSPaul Mundt #include <linux/kernel.h> 13750a7eeeSPaul Mundt #include <linux/io.h> 14750a7eeeSPaul Mundt #include <linux/pm_runtime.h> 15750a7eeeSPaul Mundt #include <linux/pm_domain.h> 16750a7eeeSPaul Mundt #include <linux/pm_clock.h> 17750a7eeeSPaul Mundt #include <linux/platform_device.h> 18750a7eeeSPaul Mundt #include <linux/clk.h> 19750a7eeeSPaul Mundt #include <linux/sh_clk.h> 20750a7eeeSPaul Mundt #include <linux/bitmap.h> 21750a7eeeSPaul Mundt #include <linux/slab.h> 22750a7eeeSPaul Mundt 23750a7eeeSPaul Mundt static struct dev_pm_domain default_pm_domain = { 24750a7eeeSPaul Mundt .ops = { 25*d2c4b43dSRajendra Nayak USE_PM_CLK_RUNTIME_OPS 26750a7eeeSPaul Mundt USE_PLATFORM_PM_SLEEP_OPS 27750a7eeeSPaul Mundt }, 28750a7eeeSPaul Mundt }; 29750a7eeeSPaul Mundt 30750a7eeeSPaul Mundt static struct pm_clk_notifier_block platform_bus_notifier = { 31*d2c4b43dSRajendra Nayak .pm_domain = &default_pm_domain, 32750a7eeeSPaul Mundt .con_ids = { NULL, }, 33750a7eeeSPaul Mundt }; 34750a7eeeSPaul Mundt 35750a7eeeSPaul Mundt static int __init sh_pm_runtime_init(void) 36750a7eeeSPaul Mundt { 373c90c55dSGeert Uytterhoeven if (IS_ENABLED(CONFIG_ARCH_SHMOBILE_MULTI)) { 383c90c55dSGeert Uytterhoeven if (!of_machine_is_compatible("renesas,emev2") && 393c90c55dSGeert Uytterhoeven !of_machine_is_compatible("renesas,r7s72100") && 40a5cb514fSGeert Uytterhoeven #ifndef CONFIG_PM_GENERIC_DOMAINS_OF 41230f259fSGeert Uytterhoeven !of_machine_is_compatible("renesas,r8a73a4") && 423c90c55dSGeert Uytterhoeven !of_machine_is_compatible("renesas,r8a7740") && 4341b4b3bcSGeert Uytterhoeven !of_machine_is_compatible("renesas,sh73a0") && 44a5cb514fSGeert Uytterhoeven #endif 453c90c55dSGeert Uytterhoeven !of_machine_is_compatible("renesas,r8a7778") && 463c90c55dSGeert Uytterhoeven !of_machine_is_compatible("renesas,r8a7779") && 473c90c55dSGeert Uytterhoeven !of_machine_is_compatible("renesas,r8a7790") && 483c90c55dSGeert Uytterhoeven !of_machine_is_compatible("renesas,r8a7791") && 492f35fb3cSGeert Uytterhoeven !of_machine_is_compatible("renesas,r8a7792") && 502f35fb3cSGeert Uytterhoeven !of_machine_is_compatible("renesas,r8a7793") && 5100170528SGeert Uytterhoeven !of_machine_is_compatible("renesas,r8a7794")) 523c90c55dSGeert Uytterhoeven return 0; 533c90c55dSGeert Uytterhoeven } 543c90c55dSGeert Uytterhoeven 55750a7eeeSPaul Mundt pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier); 56750a7eeeSPaul Mundt return 0; 57750a7eeeSPaul Mundt } 58750a7eeeSPaul Mundt core_initcall(sh_pm_runtime_init); 59