1 #include <linux/init.h>
2 #include <linux/module.h>
3 #include <linux/kernel.h>
4 #include <linux/version.h>
6 #include <mach/mt_typedefs.h>
7 #include <mach/mt_power_gs.h>
9 extern unsigned int *mt8127_power_gs_idle
;
10 extern unsigned int mt8127_power_gs_idle_len
;
12 extern unsigned int *mt6323_power_gs_idle
;
13 extern unsigned int mt6323_power_gs_idle_len
;
15 unsigned int mt6333_power_gs_idle
[] = {
17 0x009F, 0x0080, 0x0000,
18 0x00A0, 0x0007, 0x0003,
19 0x006D, 0x007f, 0x0010,
22 static bool mt_idle_chk_golden
= 0;
24 void mt_power_gs_dump_idle(void)
26 if (TRUE
== mt_idle_chk_golden
)
28 mt_power_gs_compare("Idle", \
29 mt8127_power_gs_idle
, mt8127_power_gs_idle_len
, \
30 mt6323_power_gs_idle
, mt6323_power_gs_idle_len
, \
31 mt6333_power_gs_idle
, sizeof(mt6333_power_gs_idle
));
35 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
36 static int dump_idle_read(char *buf
, char **start
, off_t off
, int count
, int *eof
, void *data
)
41 p
+= sprintf(p
, "mt_power_gs : idle\n");
43 mt_power_gs_dump_idle();
49 static int dump_idle_read(struct file
*flip
, char __user
*buf
, size_t count
, loff_t
*offset
)
54 p
+= sprintf(p
, "mt_power_gs : idle\n");
56 mt_power_gs_dump_idle();
62 static const struct file_operations idle_proc_fops
= {
64 .read
= dump_idle_read
,
68 static void __exit
mt_power_gs_idle_exit(void)
73 static int __init
mt_power_gs_idle_init(void)
75 struct proc_dir_entry
*mt_entry
= NULL
;
79 printk("[%s]: mkdir /proc/mt_power_gs failed\n", __FUNCTION__
);
83 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
84 mt_entry
= create_proc_entry("dump_idle", S_IRUGO
| S_IWUSR
| S_IWGRP
, mt_power_gs_dir
);
87 mt_entry
->read_proc
= dump_idle_read
;
90 mt_entry
= proc_create("dump_idle", S_IRUGO
| S_IWUSR
| S_IWGRP
, mt_power_gs_dir
, &idle_proc_fops
);
93 printk("[%s]: create proc file /proc/mt_power_gs/dump_idle failed\n", __FUNCTION__
);
101 module_param(mt_idle_chk_golden
, bool, 0644);
102 module_init(mt_power_gs_idle_init
);
103 module_exit(mt_power_gs_idle_exit
);
105 MODULE_DESCRIPTION("MT8127 Power Golden Setting - idle");