4 #include <linux/types.h>
5 #include <linux/init.h>
6 #include <linux/device.h>
7 #include <linux/rk_screen.h>
10 struct adc_platform_data {
13 int (*get_base_volt)(void);
21 struct rk30_i2c_platform_data {
24 #define I2C_RK29_ADAP 0
25 #define I2C_RK30_ADAP 1
30 int (*io_deinit)(void);
31 int (*check_idle)(int);
38 unsigned int cs_iomux_mode;
41 struct rk29xx_spi_platform_data {
42 int (*io_init)(struct spi_cs_gpio*, int);
43 int (*io_deinit)(struct spi_cs_gpio*, int);
44 int (*io_fix_leakage_bug)(void);
45 int (*io_resume_leakage_bug)(void);
46 struct spi_cs_gpio *chipselect_gpios;
54 int (*io_deinit)(void);
55 int (*pwm_suspend)(void);
56 int (*pwm_resume)(void);
57 int min_brightness; /* 0 ~ 255 */
58 unsigned int delay_ms; /* in milliseconds */
63 unsigned long io_addr;
65 unsigned long disable;
72 PMIC_TYPE_TPS65910 =2,
76 extern __sramdata int g_pmic_type;
77 #define pmic_is_wm8326() (g_pmic_type == PMIC_TYPE_WM8326)
78 #define pmic_is_tps65910() (g_pmic_type == PMIC_TYPE_TPS65910)
79 #define pmic_is_act8931() (g_pmic_type == PMIC_TYPE_ACT8931)
88 struct rk29_fb_setting_info {
99 enum rk_disp_prop prop; //display device property,like PRMRY,EXTEND
101 struct rk29lcd_info *lcd_info;
102 int (*io_init)(struct rk29_fb_setting_info *fb_setting);
103 int (*io_deinit)(void);
104 int (*io_enable)(void);
105 int (*io_disable)(void);
106 void (*set_screen_info)(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info );
109 struct rksdmmc_iomux {
110 char *name; //set the MACRO of gpio
115 struct rksdmmc_gpio {
116 int io; //set the address of gpio
118 int enable; // disable = !enable //set the default value,i.e,GPIO_HIGH or GPIO_LOW
119 struct rksdmmc_iomux iomux;
123 struct rksdmmc_gpio_board {
124 struct rksdmmc_gpio clk_gpio;
125 struct rksdmmc_gpio cmd_gpio;
126 struct rksdmmc_gpio data0_gpio;
127 struct rksdmmc_gpio data1_gpio;
128 struct rksdmmc_gpio data2_gpio;
129 struct rksdmmc_gpio data3_gpio;
131 struct rksdmmc_gpio detect_irq;
132 struct rksdmmc_gpio power_en_gpio;
133 struct rksdmmc_gpio write_prt;
134 struct rksdmmc_gpio sdio_irq_gpio;
138 struct rksdmmc_gpio_wifi_moudle {
139 struct rksdmmc_gpio power_n; //PMU_EN
140 struct rksdmmc_gpio reset_n; //SYSRET_B, DAIRST
141 struct rksdmmc_gpio vddio; //power source
142 struct rksdmmc_gpio bgf_int_b;
143 struct rksdmmc_gpio wifi_int_b;
144 struct rksdmmc_gpio gps_sync;
145 struct rksdmmc_gpio ANTSEL2; //pin5--ANTSEL2
146 struct rksdmmc_gpio ANTSEL3; //pin6--ANTSEL3
147 struct rksdmmc_gpio GPS_LAN; //pin33--GPS_LAN
151 struct rk29_sdmmc_platform_data {
152 unsigned int host_caps;
153 unsigned int host_ocr_avail;
154 unsigned int use_dma:1;
156 int (*io_init)(void);
157 int (*io_deinit)(void);
158 void (*set_iomux)(int device_id, unsigned int bus_width);//added by xbw at 2011-10-13
159 int (*status)(struct device *);
160 int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
162 int insert_card_level;
165 int enable_sd_wakeup;
167 int write_prt_enalbe_level;
168 unsigned int sdio_INT_gpio;
169 struct rksdmmc_gpio det_pin_info;
170 int (*sd_vcc_reset)(void);
173 struct gsensor_platform_data {
177 signed char orientation[9];
178 int (*get_pendown_state)(void);
179 int (*init_platform_hw)(void);
180 int (*gsensor_platform_sleep)(void);
181 int (*gsensor_platform_wakeup)(void);
182 void (*exit_platform_hw)(void);
185 struct ft5606_platform_data {
186 int (*get_pendown_state)(void);
187 int (*init_platform_hw)(void);
188 int (*platform_sleep)(void);
189 int (*platform_wakeup)(void);
190 void (*exit_platform_hw)(void);
193 struct akm8975_platform_data {
194 short m_layout[4][3][3];
195 char project_name[64];
199 struct sensor_platform_data {
204 int irq_enable; //if irq_enable=1 then use irq else use polling
205 int poll_delay_ms; //polling
210 unsigned char address;
211 signed char orientation[9];
212 short m_layout[4][3][3];
213 char project_name[64];
214 int (*init_platform_hw)(void);
215 void (*exit_platform_hw)(void);
216 int (*power_on)(void);
217 int (*power_off)(void);
220 /* Platform data for the board id */
221 struct board_id_platform_data {
224 int (*init_platform_hw)(void);
225 int (*exit_platform_hw)(void);
226 int (*init_parameter)(int id);
231 struct goodix_platform_data {
235 int (*get_pendown_state)(void);
236 int (*init_platform_hw)(void);
237 int (*platform_sleep)(void);
238 int (*platform_wakeup)(void);
239 void (*exit_platform_hw)(void);
242 struct ct360_platform_data {
246 void (*hw_init)(void);
247 void (*shutdown)(int);
251 struct cm3217_platform_data {
254 int (*init_platform_hw)(void);
255 void (*exit_platform_hw)(void);
260 int (*iomux_init)(void);
261 int (*iomux_deinit)(void);
262 int (*irda_pwr_ctl)(int en);
265 struct rk29_gpio_expander_info {
266 unsigned int gpio_num;
267 unsigned int pin_type; //GPIO_IN or GPIO_OUT
268 unsigned int pin_value; //GPIO_HIGH or GPIO_LOW
272 struct rk29_vmac_platform_data {
273 int (*vmac_register_set)(void);
274 int (*rmii_io_init)(void);
275 int (*rmii_io_deinit)(void);
276 int (*rmii_power_control)(int enable);
277 int(*rmii_speed_switch)(int speed);
280 struct rk30_adc_battery_platform_data {
281 int (*io_init)(void);
282 int (*io_deinit)(void);
283 int (*is_dc_charging)(void);
284 int (*charging_ok)(void);
286 int (*is_usb_charging)(void);
287 int spport_usb_charging ;
288 int (*control_usb_charging)(int);
297 int ctrl_charge_led_pin;
298 int ctrl_charge_enable;
299 void (*ctrl_charge_led)(int);
304 int charge_set_level;
309 int dc_det_pin_pull; //pull up/down enable/disbale
310 int batt_low_pin_pull;
311 int charge_ok_pin_pull;
312 int charge_set_pin_pull;
314 int low_voltage_protection; // low voltage protection
316 int charging_sleep; // don't have lock,if chargeing_sleep = 0;else have lock
318 int is_reboot_charging;
319 int save_capacity; //save capacity to /data/bat_last_capacity.dat, suggested use
321 int reference_voltage; // the rK2928 is 3300;RK3066 and rk29 are 2500;rk3066B is 1800;
322 int pull_up_res; //divider resistance , pull-up resistor
323 int pull_down_res; //divider resistance , pull-down resistor
325 int time_down_discharge; //the time of capactiy drop 1% --discharge
326 int time_up_charge; //the time of capacity up 1% ---charging
330 int *discharge_table;
333 int *board_batt_table;
338 #define BOOT_MODE_NORMAL 0
339 #define BOOT_MODE_FACTORY2 1
340 #define BOOT_MODE_RECOVERY 2
341 #define BOOT_MODE_CHARGE 3
342 #define BOOT_MODE_POWER_TEST 4
343 #define BOOT_MODE_OFFMODE_CHARGING 5
344 #define BOOT_MODE_REBOOT 6
345 #define BOOT_MODE_PANIC 7
346 int board_boot_mode(void);
348 /* for USB detection */
349 #ifdef CONFIG_USB_GADGET
350 int __init board_usb_detect_init(unsigned gpio);
352 static int inline board_usb_detect_init(unsigned gpio) { return 0; }
355 #ifdef CONFIG_RK_EARLY_PRINTK
356 void __init rk29_setup_early_printk(void);
358 static void inline rk29_setup_early_printk(void) {}
361 /* for wakeup Android */
362 void rk28_send_wakeup_key(void);
364 /* for reserved memory
365 * function: board_mem_reserve_add
366 * return value: start address of reserved memory */
367 phys_addr_t __init board_mem_reserve_add(char *name, size_t size);
368 void __init board_mem_reserved(void);
371 * For DDR frequency scaling setup. Board code something like this:
373 * This array _must_ be sorted in ascending frequency (without DDR_FREQ_*) order.
374 * 必须按频率(不必考虑DDR_FREQ_*)递增。
375 *static struct cpufreq_frequency_table dvfs_ddr_table[] = {
376 * {.frequency = 200 * 1000 + DDR_FREQ_SUSPEND, .index = xxxx * 1000},
377 * {.frequency = 200 * 1000 + DDR_FREQ_IDLE, .index = xxxx * 1000},
378 * {.frequency = 300 * 1000 + DDR_FREQ_VIDEO, .index = xxxx * 1000},
379 * {.frequency = 400 * 1000 + DDR_FREQ_NORMAL, .index = xxxx * 1000},
380 * {.frequency = CPUFREQ_TABLE_END},
384 DDR_FREQ_NORMAL = 1, // default
385 DDR_FREQ_VIDEO, // when video is playing
386 DDR_FREQ_IDLE, // when screen is idle
387 DDR_FREQ_SUSPEND, // when early suspend