import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / power_gs / mt8127 / mt_power_gs_idle.c
1 #include <linux/init.h>
2 #include <linux/module.h>
3 #include <linux/kernel.h>
4 #include <linux/version.h>
5
6 #include <mach/mt_typedefs.h>
7 #include <mach/mt_power_gs.h>
8
9 extern unsigned int *mt8127_power_gs_idle;
10 extern unsigned int mt8127_power_gs_idle_len;
11
12 extern unsigned int *mt6323_power_gs_idle;
13 extern unsigned int mt6323_power_gs_idle_len;
14
15 unsigned int mt6333_power_gs_idle[] = {
16 // Buck
17 0x009F, 0x0080, 0x0000,
18 0x00A0, 0x0007, 0x0003,
19 0x006D, 0x007f, 0x0010,
20 };
21
22 static bool mt_idle_chk_golden = 0;
23
24 void mt_power_gs_dump_idle(void)
25 {
26 if (TRUE == mt_idle_chk_golden)
27 {
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));
32 }
33 }
34
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)
37 {
38 int len = 0;
39 char *p = buf;
40
41 p += sprintf(p, "mt_power_gs : idle\n");
42
43 mt_power_gs_dump_idle();
44
45 len = p - buf;
46 return len;
47 }
48 #else
49 static int dump_idle_read(struct file *flip, char __user *buf, size_t count, loff_t *offset)
50 {
51 int len = 0;
52 char *p = buf;
53
54 p += sprintf(p, "mt_power_gs : idle\n");
55
56 mt_power_gs_dump_idle();
57
58 len = p - buf;
59 return len;
60 }
61
62 static const struct file_operations idle_proc_fops = {
63 .owner = THIS_MODULE,
64 .read = dump_idle_read,
65 };
66 #endif
67
68 static void __exit mt_power_gs_idle_exit(void)
69 {
70 //return 0;
71 }
72
73 static int __init mt_power_gs_idle_init(void)
74 {
75 struct proc_dir_entry *mt_entry = NULL;
76
77 if (!mt_power_gs_dir)
78 {
79 printk("[%s]: mkdir /proc/mt_power_gs failed\n", __FUNCTION__);
80 }
81 else
82 {
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);
85 if (mt_entry)
86 {
87 mt_entry->read_proc = dump_idle_read;
88 }
89 #else
90 mt_entry = proc_create("dump_idle", S_IRUGO | S_IWUSR | S_IWGRP, mt_power_gs_dir, &idle_proc_fops);
91 if (!mt_entry)
92 {
93 printk("[%s]: create proc file /proc/mt_power_gs/dump_idle failed\n", __FUNCTION__);
94 }
95 #endif
96 }
97
98 return 0;
99 }
100
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);
104
105 MODULE_DESCRIPTION("MT8127 Power Golden Setting - idle");