15 #include <linux/module.h>
17 #include <linux/sched.h>
19 #include <linux/sysctl.h>
20 #include <linux/errno.h>
22 #include <asm/uaccess.h>
49 static unsigned long __irq_mask;
54 static void __default_power_switch_setup(
void)
57 __irq_mask = *(
unsigned long *)0xfeff9820;
58 *(
unsigned long *)0xfeff9820 = 0xfffe0000;
64 static void __default_power_switch_cleanup(
void)
66 *(
unsigned long *)0xfeff9820 = __irq_mask;
72 static int __default_power_switch_check(
void)
127 #define CTL_PM_SUSPEND 1
128 #define CTL_PM_CMODE 2
132 static int user_atoi(
char __user *ubuf,
size_t len)
154 void __user *
buffer,
size_t *lenp, loff_t *fpos)
161 mode = user_atoi(buffer, *lenp);
174 static int try_set_cmode(
int new_cmode)
178 if (!(clock_cmodes_permitted & (1<<new_cmode)))
200 static int cmode_procctl(
ctl_table *ctl,
int write,
201 void __user *buffer,
size_t *lenp, loff_t *fpos)
208 new_cmode = user_atoi(buffer, *lenp);
210 return try_set_cmode(new_cmode)?:*lenp;
213 static int try_set_p0(
int new_p0)
215 unsigned long flags, clkc;
217 if (new_p0 < 0 || new_p0 > 1)
243 static int try_set_cm(
int new_cm)
245 unsigned long flags, clkc;
247 if (new_cm < 0 || new_cm > 1)
272 static int p0_procctl(
ctl_table *ctl,
int write,
273 void __user *buffer,
size_t *lenp, loff_t *fpos)
280 new_p0 = user_atoi(buffer, *lenp);
282 return try_set_p0(new_p0)?:*lenp;
285 static int cm_procctl(
ctl_table *ctl,
int write,
286 void __user *buffer,
size_t *lenp, loff_t *fpos)
293 new_cm = user_atoi(buffer, *lenp);
295 return try_set_cm(new_cm)?:*lenp;
305 .proc_handler = sysctl_pm_do_suspend,
310 .maxlen =
sizeof(
int),
317 .maxlen =
sizeof(
int),
324 .maxlen =
sizeof(
int),
344 static int __init pm_init(
void)