Blame view

drivers/sh/pm_runtime.c 1.46 KB
f14c4f141   Magnus Damm   ARM: mach-shmobil...
1
  /*
d03299ee6   Paul Mundt   drivers: sh: Kill...
2
   * Runtime PM support code
f14c4f141   Magnus Damm   ARM: mach-shmobil...
3
4
5
6
7
8
9
10
11
12
13
14
   *
   *  Copyright (C) 2009-2010 Magnus Damm
   *
   * This file is subject to the terms and conditions of the GNU General Public
   * License.  See the file "COPYING" in the main directory of this archive
   * for more details.
   */
  
  #include <linux/init.h>
  #include <linux/kernel.h>
  #include <linux/io.h>
  #include <linux/pm_runtime.h>
796204142   Rafael J. Wysocki   ARM / shmobile: U...
15
  #include <linux/pm_domain.h>
b5e8d269d   Rafael J. Wysocki   PM: Move clock-re...
16
  #include <linux/pm_clock.h>
f14c4f141   Magnus Damm   ARM: mach-shmobil...
17
18
19
20
  #include <linux/platform_device.h>
  #include <linux/clk.h>
  #include <linux/sh_clk.h>
  #include <linux/bitmap.h>
1d2b71f61   Rafael J. Wysocki   PM / Runtime: Add...
21
  #include <linux/slab.h>
f14c4f141   Magnus Damm   ARM: mach-shmobil...
22
23
  
  #ifdef CONFIG_PM_RUNTIME
f14c4f141   Magnus Damm   ARM: mach-shmobil...
24

38ade3a1f   Rafael J. Wysocki   shmobile: Use pow...
25
  static int default_platform_runtime_idle(struct device *dev)
f14c4f141   Magnus Damm   ARM: mach-shmobil...
26
27
28
29
  {
  	/* suspend synchronously to disable clocks immediately */
  	return pm_runtime_suspend(dev);
  }
564b905ab   Rafael J. Wysocki   PM / Domains: Ren...
30
  static struct dev_pm_domain default_pm_domain = {
38ade3a1f   Rafael J. Wysocki   shmobile: Use pow...
31
  	.ops = {
3d5c30367   Rafael J. Wysocki   PM: Rename clock ...
32
33
  		.runtime_suspend = pm_clk_suspend,
  		.runtime_resume = pm_clk_resume,
38ade3a1f   Rafael J. Wysocki   shmobile: Use pow...
34
35
36
37
  		.runtime_idle = default_platform_runtime_idle,
  		USE_PLATFORM_PM_SLEEP_OPS
  	},
  };
564b905ab   Rafael J. Wysocki   PM / Domains: Ren...
38
  #define DEFAULT_PM_DOMAIN_PTR	(&default_pm_domain)
1d2b71f61   Rafael J. Wysocki   PM / Runtime: Add...
39

85eb8c8d0   Rafael J. Wysocki   PM / Runtime: Gen...
40
  #else
f14c4f141   Magnus Damm   ARM: mach-shmobil...
41

564b905ab   Rafael J. Wysocki   PM / Domains: Ren...
42
  #define DEFAULT_PM_DOMAIN_PTR	NULL
f14c4f141   Magnus Damm   ARM: mach-shmobil...
43
44
  
  #endif /* CONFIG_PM_RUNTIME */
85eb8c8d0   Rafael J. Wysocki   PM / Runtime: Gen...
45
  static struct pm_clk_notifier_block platform_bus_notifier = {
564b905ab   Rafael J. Wysocki   PM / Domains: Ren...
46
  	.pm_domain = DEFAULT_PM_DOMAIN_PTR,
85eb8c8d0   Rafael J. Wysocki   PM / Runtime: Gen...
47
  	.con_ids = { NULL, },
f14c4f141   Magnus Damm   ARM: mach-shmobil...
48
49
50
51
  };
  
  static int __init sh_pm_runtime_init(void)
  {
3d5c30367   Rafael J. Wysocki   PM: Rename clock ...
52
  	pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
f14c4f141   Magnus Damm   ARM: mach-shmobil...
53
54
55
  	return 0;
  }
  core_initcall(sh_pm_runtime_init);
999a4d2a4   Magnus Damm   ARM: mach-shmobil...
56

999a4d2a4   Magnus Damm   ARM: mach-shmobil...
57
58
  static int __init sh_pm_runtime_late_init(void)
  {
796204142   Rafael J. Wysocki   ARM / shmobile: U...
59
  	pm_genpd_poweroff_unused();
999a4d2a4   Magnus Damm   ARM: mach-shmobil...
60
61
62
  	return 0;
  }
  late_initcall(sh_pm_runtime_late_init);