Merge tag 'v3.10.103' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / mach / mt_freqhopping_drv.h
CommitLineData
6fa3eb70
S
1#ifndef __FREQHOPPING_DRV_H
2#define __FREQHOPPING_DRV_H
3
4#include <linux/proc_fs.h>
5#include "mach/mt_freqhopping.h"
6
7// move to /mediatek/platform/prj, can config. by prj.
8//#define MEMPLL_SSC 0
9//#define MAINPLL_SSC 1
10
11/* Export API */
12int mt_freqhopping_devctl(unsigned int cmd, void* args);
13
14struct mt_fh_hal_proc_func{
15
16 int (*clk_gen_read)(char *, char **, off_t, int, int *, void *);
17 int (*clk_gen_write)(struct file *,const char *, unsigned long, void *);
18 int (*dramc_read)(struct seq_file* m, void* v); //(char *, char **, off_t, int, int *, void *);
19 int (*dramc_write)(struct file *,const char *, unsigned long, void *);
20 int (*dumpregs_read)(struct seq_file* m, void* v);//(char *, char **, off_t, int, int *, void *);
21 int (*dvfs_read)(struct seq_file* m, void* v); //(char *, char **, off_t, int, int *, void *);
22 int (*dvfs_write)(struct file *,const char *, unsigned long, void *);
23
24};
25
26struct mt_fh_hal_driver{
27
28 fh_pll_t *fh_pll;
29 struct freqhopping_ssc *fh_usrdef;
30 unsigned int mempll;
31 unsigned int lvdspll;
32 unsigned int mainpll;
33 unsigned int msdcpll;
34 unsigned int mmpll;
35 unsigned int vencpll;
36 unsigned int pll_cnt;
37
38 struct mt_fh_hal_proc_func proc;
39
40 void (*mt_fh_hal_init)(void);
41 int (*mt_fh_hal_ctrl)(struct freqhopping_ioctl* , bool);
42 void (*mt_fh_lock)(unsigned long *);
43 void (*mt_fh_unlock)(unsigned long *);
44 int (*mt_fh_get_init)(void);
45 void (*mt_fh_popod_restore)(void);
46 void (*mt_fh_popod_save)(void);
47
48 int (*mt_l2h_mempll)(void);
49 int (*mt_h2l_mempll)(void);
50 int (*mt_dfs_armpll)(unsigned int , unsigned int);
51 int (*mt_dfs_mmpll)(unsigned int);
52 int (*mt_dfs_vencpll)(unsigned int);
53 int (*mt_dfs_mpll)(unsigned int);
54 int (*mt_is_support_DFS_mode)(void);
55 int (*mt_l2h_dvfs_mempll)(void);
56 int (*mt_h2l_dvfs_mempll)(void);
57 int (*mt_dram_overclock)(int);
58 int (*mt_get_dramc)(void);
59 void (*mt_fh_default_conf)(void);
60
61 void (*ioctl)(unsigned int ctlid, void* );
62};
63
64//define ctlid for ioctl()
65#define FH_IO_PROC_READ 0x001
66
67enum FH_DEVCTL_CMD_ID {
68 FH_DCTL_CMD_ID = 0x1000,
69 FH_DCTL_CMD_DVFS = 0x1001,
70 FH_DCTL_CMD_DVFS_SSC_ENABLE = 0x1002,
71 FH_DCTL_CMD_DVFS_SSC_DISABLE = 0x1003,
72 FH_DCTL_CMD_SSC_ENABLE = 0x1004,
73 FH_DCTL_CMD_SSC_DISABLE = 0x1005,
74 FH_DCTL_CMD_MAX
75};
76
77
78//define structure for correspoinding ctlid
79typedef struct{
80 struct seq_file* m;
81 void* v;
82 fh_pll_t * pll;
83}FH_IO_PROC_READ_T;
84
85struct mt_fh_hal_driver* mt_get_fh_hal_drv(void);
86
87#define FH_BUG_ON(x) \
88do { \
89 if((x)){ \
90 printk("BUGON %s:%d %s:%d\n",__FUNCTION__,__LINE__,current->comm,current->pid); \
91 } \
92} while(0);
93
94#endif