2 * linux/arch/arm/mach-omap2/pm.c
4 * OMAP Power Management Common Routines
6 * Copyright (C) 2005 Texas Instruments, Inc.
7 * Copyright (C) 2006-2008 Nokia Corporation
10 * Richard Woodruff <r-woodruff2@ti.com>
13 * Amit Kucheria <amit.kucheria@nokia.com>
14 * Igor Stoppa <igor.stoppa@nokia.com>
17 * Based on pm.c for omap1
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License version 2 as
21 * published by the Free Software Foundation.
24 #include <linux/suspend.h>
25 #include <linux/time.h>
26 #include <linux/platform_device.h>
29 #include <asm/mach/time.h>
30 #include <asm/atomic.h>
32 #include <plat/powerdomain.h>
33 #include <plat/omapdev.h>
35 #include "prm-regbits-34xx.h"
38 atomic_t sleep_block
= ATOMIC_INIT(0);
40 static ssize_t
idle_show(struct kobject
*, struct kobj_attribute
*, char *);
41 static ssize_t
idle_store(struct kobject
*k
, struct kobj_attribute
*,
42 const char *buf
, size_t n
);
44 static ssize_t
idle_show(struct kobject
*kobj
, struct kobj_attribute
*attr
,
50 static ssize_t
idle_store(struct kobject
*kobj
, struct kobj_attribute
*attr
,
51 const char *buf
, size_t n
)
55 if (sscanf(buf
, "%hu", &value
) != 1 ||
56 (value
!= 0 && value
!= 1)) {
57 printk(KERN_ERR
"idle_store: Invalid value\n");
64 void omap2_block_sleep(void)
66 atomic_inc(&sleep_block
);
69 void omap2_allow_sleep(void)
73 i
= atomic_dec_return(&sleep_block
);
77 unsigned get_last_off_on_transaction_id(struct device
*dev
)
79 struct platform_device
*pdev
= to_platform_device(dev
);
80 struct omapdev
*odev
= omapdev_find_pdev(pdev
);
81 struct powerdomain
*pwrdm
;
84 pwrdm
= omapdev_get_pwrdm(odev
);
86 return pwrdm
->state_counter
[0];
92 static int __init
omap_pm_init(void)
98 late_initcall(omap_pm_init
);