rk2928 : add interface for adc_battery
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rk2928 / include / mach / board.h
1 #ifndef __MACH_BOARD_H
2 #define __MACH_BOARD_H
3
4 #include <linux/device.h>
5 #include <linux/platform_device.h>
6 #include <linux/i2c.h>
7 #include <linux/types.h>
8 #include <linux/timer.h>
9 #include <linux/notifier.h>
10 #include <asm/setup.h>
11 #include <plat/board.h>
12 #include <mach/sram.h>
13 #include <linux/i2c-gpio.h>
14
15 #define GPIO_SWPORTA_DR  0x0000
16 #define GPIO_SWPORTA_DDR 0x0004
17
18 #define PMIC_TYPE_TPS65910      2
19 #define PMIC_TYPE_ACT8931       3
20
21 extern struct rk29_sdmmc_platform_data default_sdmmc0_data;
22 extern struct rk29_sdmmc_platform_data default_sdmmc1_data;
23
24 extern struct i2c_gpio_platform_data default_i2c_gpio_data; 
25
26 void __init rk2928_map_common_io(void);
27 void __init rk2928_init_irq(void);
28 void __init rk2928_map_io(void);
29 struct machine_desc;
30 void __init rk2928_fixup(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi);
31 void __init rk2928_clock_data_init(unsigned long gpll,unsigned long cpll,u32 flags);
32 void __init board_clock_init(void);
33 void __init rk2928_iomux_init(void);
34 void board_gpio_suspend(void);
35 void board_gpio_resume(void);
36 void __sramfunc board_pmu_suspend(void);
37 void __sramfunc board_pmu_resume(void);
38
39 extern struct sys_timer rk2928_timer;
40
41 //#if defined  CONFIG_BATTERY_RK30_ADC_FAC 
42 /* adc battery */
43 struct rk30_adc_battery_platform_data {
44         int (*io_init)(void);
45         int (*io_deinit)(void);
46         int (*is_dc_charging)(void);
47         int (*charging_ok)(void);
48
49         int (*is_usb_charging)(void);
50         int spport_usb_charging ;
51
52         int dc_det_pin;
53         int batt_low_pin;
54         int charge_ok_pin;
55         int charge_set_pin;
56
57         int dc_det_level;
58         int batt_low_level;
59         int charge_ok_level;
60         int charge_set_level;
61         
62         int adc_channel;
63
64         int dc_det_pin_pull;    //pull up/down enable/disbale
65         int batt_low_pin_pull;
66         int charge_ok_pin_pull;
67         int charge_set_pin_pull;
68
69         int low_voltage_protection; // low voltage protection
70
71         int charging_sleep; // don't have lock,if chargeing_sleep = 0;else have lock
72         
73
74         int save_capacity;  //save capacity to /data/bat_last_capacity.dat,  suggested use
75
76         int reference_voltage; // the rK2928 is 3300;RK3066 and rk29 are 2500;rk3066B is 1800;
77         int pull_up_res;      //divider resistance ,  pull-up resistor
78         int pull_down_res; //divider resistance , pull-down resistor
79
80         int time_down_discharge; //the time of capactiy drop 1% --discharge
81         int time_up_charge; //the time of capacity up 1% ---charging 
82
83
84 };
85 //#endif
86
87 #ifndef _LINUX_WLAN_PLAT_H_
88 struct wifi_platform_data {
89         int (*set_power)(int val);
90         int (*set_reset)(int val);
91         int (*set_carddetect)(int val);
92         void *(*mem_prealloc)(int section, unsigned long size);
93         int (*get_mac_addr)(unsigned char *buf);
94 };
95 #endif
96 #if defined (CONFIG_EETI_EGALAX)
97 struct eeti_egalax_platform_data{
98         u16     model;
99
100     int     (*get_pendown_state)(void);
101     int     (*init_platform_hw)(void);
102     int     (*eeti_egalax_platform_sleep)(void);
103     int     (*eeti_egalax_platform_wakeup)(void);
104     void    (*exit_platform_hw)(void);
105     int     standby_pin;
106     int     standby_value;
107     int     disp_on_pin;
108     int     disp_on_value;
109  
110 };
111 #endif
112 #if defined (CONFIG_TOUCHSCREEN_SITRONIX_A720)
113 struct ft5x0x_platform_data{
114           u16     model;
115     int     (*get_pendown_state)(void);
116     int     (*init_platform_hw)(void);
117     int     (*ft5x0x_platform_sleep)(void);
118     int     (*ft5x0x_platform_wakeup)(void);
119     void    (*exit_platform_hw)(void);
120 };
121 #endif
122
123 #if defined (CONFIG_TOUCHSCREEN_I30)
124 struct ft5306_platform_data {
125     int rest_pin;
126     int irq_pin ;
127     int     (*get_pendown_state)(void);
128     int     (*init_platform_hw)(void);
129     int     (*platform_sleep)(void);
130     int     (*platform_wakeup)(void);
131     void    (*exit_platform_hw)(void);
132 };
133 #endif
134 #if defined(CONFIG_TOUCHSCREEN_BYD693X)
135 struct byd_platform_data {
136         u16     model;
137         int     pwr_pin;
138         int       int_pin;
139         int     rst_pin;
140         int             pwr_on_value;
141         int     *tp_flag;
142
143         uint16_t screen_max_x;
144         uint16_t screen_max_y;
145         u8 swap_xy :1;
146         u8 xpol :1;
147         u8 ypol :1;     
148 };
149 #endif
150
151
152 #if defined (CONFIG_GPIOEXP_AW9523B)
153 struct gpio_exp_platform_data {
154     int     (*init_platform_hw)(void);
155     void    (*exit_platform_hw)(void);
156 };
157 #endif
158
159 #ifdef CONFIG_INPUT_AP321XX
160 struct ap321xx_platform_data {
161         int (*init_platform_hw)(void);
162         void (*exit_platform_hw)(void);
163 };
164 #endif
165
166 enum _periph_pll {
167         periph_pll_1485mhz = 148500000,
168         periph_pll_297mhz = 297000000,
169         periph_pll_300mhz = 300000000,
170         periph_pll_1188mhz = 1188000000, /* for box*/
171 };
172 enum _codec_pll {
173         codec_pll_360mhz = 360000000, /* for HDMI */
174         codec_pll_408mhz = 408000000,
175         codec_pll_456mhz = 456000000,
176         codec_pll_504mhz = 504000000,
177         codec_pll_552mhz = 552000000, /* for HDMI */
178         codec_pll_600mhz = 600000000,
179         codec_pll_742_5khz = 742500000,
180         codec_pll_798mhz = 798000000,
181         codec_pll_1064mhz = 1064000000,
182         codec_pll_1188mhz = 1188000000,
183 };
184
185 //max i2s rate
186 #define CLK_FLG_MAX_I2S_12288KHZ        (1<<1)
187 #define CLK_FLG_MAX_I2S_22579_2KHZ      (1<<2)
188 #define CLK_FLG_MAX_I2S_24576KHZ        (1<<3)
189 #define CLK_FLG_MAX_I2S_49152KHZ        (1<<4)
190
191 #define RK30_CLOCKS_DEFAULT_FLAGS (CLK_FLG_MAX_I2S_12288KHZ/*|CLK_FLG_EXT_27MHZ*/)
192 #define periph_pll_default periph_pll_297mhz
193 #define codec_pll_default codec_pll_798mhz
194 //#define codec_pll_default codec_pll_1064mhz
195
196
197 #endif