import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / power_gs / mt8127 / mt_power_gs_2g_paging.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_2g_paging;
10 extern unsigned int mt8127_power_gs_2g_paging_len;
11
12 extern unsigned int *mt6323_power_gs_2g_paging;
13 extern unsigned int mt6323_power_gs_2g_paging_len;
14
15 unsigned int mt6333_power_gs_2g_paging[] = {
16 // Buck
17 0x009F, 0x0080, 0x0000,
18 0x00A0, 0x0007, 0x0003,
19 0x006D, 0x007f, 0x0010,
20 };
21
22 void mt_power_gs_dump_2g_paging(void)
23 {
24 mt_power_gs_compare("2G Paging", \
25 mt8127_power_gs_2g_paging, mt8127_power_gs_2g_paging_len, \
26 mt6323_power_gs_2g_paging, mt6323_power_gs_2g_paging_len, \
27 mt6333_power_gs_2g_paging, sizeof(mt6333_power_gs_2g_paging));
28 }
29
30 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
31 static int dump_2g_paging_read(char *buf, char **start, off_t off, int count, int *eof, void *data)
32 {
33 int len = 0;
34 char *p = buf;
35
36 p += sprintf(p, "mt_power_gs : 2g_paging\n");
37
38 mt_power_gs_dump_2g_paging();
39
40 len = p - buf;
41 return len;
42 }
43 #else
44 static ssize_t dump_2g_paging_read(struct file *flip, char __user *buf, size_t count, loff_t *offset)
45 {
46 int len = 0;
47 char *p = buf;
48
49 p += sprintf(p, "mt_power_gs : 2g_paging\n");
50
51 mt_power_gs_dump_2g_paging();
52
53 len = p - buf;
54 return len;
55 }
56
57 static const struct file_operations paging_2g_proc_fops = {
58 .owner = THIS_MODULE,
59 .read = dump_2g_paging_read,
60 };
61 #endif
62
63 static void __exit mt_power_gs_2g_paging_exit(void)
64 {
65 //return 0;
66 }
67
68 static int __init mt_power_gs_2g_paging_init(void)
69 {
70 struct proc_dir_entry *mt_entry = NULL;
71
72 if (!mt_power_gs_dir)
73 {
74 printk("[%s]: mkdir /proc/mt_power_gs failed\n", __FUNCTION__);
75 }
76 else
77 {
78 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
79 mt_entry = create_proc_entry("dump_2g_paging", S_IRUGO | S_IWUSR | S_IWGRP, mt_power_gs_dir);
80 if (mt_entry)
81 {
82 mt_entry->read_proc = dump_2g_paging_read;
83 }
84 #else
85 mt_entry = proc_create("dump_2g_paging", S_IRUGO | S_IWUSR | S_IWGRP, mt_power_gs_dir, &paging_2g_proc_fops);
86 if (!mt_entry)
87 {
88 printk("[%s]: create proc file /proc/mt_power_gs/dump_2g_paging failed\n", __FUNCTION__);
89 }
90 #endif
91 }
92
93 return 0;
94 }
95
96 module_init(mt_power_gs_2g_paging_init);
97 module_exit(mt_power_gs_2g_paging_exit);
98
99 MODULE_DESCRIPTION("MT8127 Power Golden Setting - 2G Paging");