1 /* arch/arm/mach-rk30/board-rk30-sdk.c
3 * Copyright (C) 2012 ROCKCHIP, Inc.
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/input.h>
21 #include <linux/delay.h>
22 #include <linux/i2c.h>
23 #include <linux/skbuff.h>
24 #include <linux/spi/spi.h>
25 #include <linux/mmc/host.h>
26 #include <linux/ion.h>
27 #include <linux/cpufreq.h>
28 #include <linux/clk.h>
29 #include <mach/dvfs.h>
31 #include <asm/setup.h>
32 #include <asm/mach-types.h>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
35 #include <asm/mach/flash.h>
36 #include <asm/hardware/gic.h>
38 #include <mach/board.h>
39 #include <mach/hardware.h>
41 #include <mach/gpio.h>
42 #include <mach/iomux.h>
44 #include <linux/regulator/machine.h>
45 #include <linux/rfkill-rk.h>
46 #include <linux/sensor-dev.h>
47 #include <linux/mfd/tps65910.h>
48 #include <linux/regulator/rk29-pwm-regulator.h>
49 #include "../../../drivers/headset_observe/rk_headset.h"
51 #if defined(CONFIG_HDMI_RK30)
52 #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
56 #ifdef CONFIG_TOUCHSCREEN_GT82X_IIC
57 #include <linux/goodix_touch_82x.h>
60 #if defined(CONFIG_SPIM_RK29)
61 #include "../../../drivers/spi/rk29_spim.h"
63 #if defined(CONFIG_MU509)
64 #include <linux/mu509.h>
66 #if defined(CONFIG_MW100)
67 #include <linux/mw100.h>
69 #if defined(CONFIG_MT6229)
70 #include <linux/mt6229.h>
72 #if defined(CONFIG_SEW868)
73 #include <linux/sew868.h>
76 #if defined(CONFIG_MI700)
77 #include <linux/mi700.h>
80 #if defined(CONFIG_ANDROID_TIMED_GPIO)
81 #include "../../../drivers/staging/android/timed_gpio.h"
84 #ifdef CONFIG_THREE_FB_BUFFER
85 #define RK30_FB0_MEM_SIZE 12*SZ_1M
87 #define RK30_FB0_MEM_SIZE 8*SZ_1M
89 #define PMIC_IS_WM831X 0
91 #ifdef CONFIG_VIDEO_RK29
92 /*---------------- Camera Sensor Macro Define Begin ------------------------*/
93 /*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
94 #define CONFIG_SENSOR_0 RK29_CAM_SENSOR_SID130B /* back camera sensor */
95 #define CONFIG_SENSOR_IIC_ADDR_0 0x6e
96 #define CONFIG_SENSOR_IIC_ADAPTER_ID_0 3
97 #define CONFIG_SENSOR_CIF_INDEX_0 0 // 1
98 #define CONFIG_SENSOR_ORIENTATION_0 90
99 #define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO
100 #define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
101 #define CONFIG_SENSOR_POWERDN_PIN_0 RK30_PIN1_PB7
102 #define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
103 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
104 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
105 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_L
106 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
108 #define CONFIG_SENSOR_QCIF_FPS_FIXED_0 15000
109 #define CONFIG_SENSOR_240X160_FPS_FIXED_0 15000
110 #define CONFIG_SENSOR_QVGA_FPS_FIXED_0 15000
111 #define CONFIG_SENSOR_CIF_FPS_FIXED_0 15000
112 #define CONFIG_SENSOR_VGA_FPS_FIXED_0 15000
113 #define CONFIG_SENSOR_480P_FPS_FIXED_0 15000
114 #define CONFIG_SENSOR_SVGA_FPS_FIXED_0 15000
115 #define CONFIG_SENSOR_720P_FPS_FIXED_0 30000
117 #define CONFIG_SENSOR_01 RK29_CAM_SENSOR_OV5642 /* back camera sensor 1 */
118 #define CONFIG_SENSOR_IIC_ADDR_01 0x00
119 #define CONFIG_SENSOR_CIF_INDEX_01 1
120 #define CONFIG_SENSOR_IIC_ADAPTER_ID_01 4
121 #define CONFIG_SENSOR_ORIENTATION_01 90
122 #define CONFIG_SENSOR_POWER_PIN_01 INVALID_GPIO
123 #define CONFIG_SENSOR_RESET_PIN_01 INVALID_GPIO
124 #define CONFIG_SENSOR_POWERDN_PIN_01 RK30_PIN1_PD6
125 #define CONFIG_SENSOR_FALSH_PIN_01 INVALID_GPIO
126 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_01 RK29_CAM_POWERACTIVE_L
127 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_01 RK29_CAM_RESETACTIVE_L
128 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_01 RK29_CAM_POWERDNACTIVE_H
129 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_01 RK29_CAM_FLASHACTIVE_L
131 #define CONFIG_SENSOR_QCIF_FPS_FIXED_01 15000
132 #define CONFIG_SENSOR_240X160_FPS_FIXED_01 15000
133 #define CONFIG_SENSOR_QVGA_FPS_FIXED_01 15000
134 #define CONFIG_SENSOR_CIF_FPS_FIXED_01 15000
135 #define CONFIG_SENSOR_VGA_FPS_FIXED_01 15000
136 #define CONFIG_SENSOR_480P_FPS_FIXED_01 15000
137 #define CONFIG_SENSOR_SVGA_FPS_FIXED_01 15000
138 #define CONFIG_SENSOR_720P_FPS_FIXED_01 30000
140 #define CONFIG_SENSOR_02 RK29_CAM_SENSOR_OV5640 /* back camera sensor 2 */
141 #define CONFIG_SENSOR_IIC_ADDR_02 0x00
142 #define CONFIG_SENSOR_CIF_INDEX_02 1
143 #define CONFIG_SENSOR_IIC_ADAPTER_ID_02 4
144 #define CONFIG_SENSOR_ORIENTATION_02 90
145 #define CONFIG_SENSOR_POWER_PIN_02 INVALID_GPIO
146 #define CONFIG_SENSOR_RESET_PIN_02 INVALID_GPIO
147 #define CONFIG_SENSOR_POWERDN_PIN_02 RK30_PIN1_PD6
148 #define CONFIG_SENSOR_FALSH_PIN_02 INVALID_GPIO
149 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_02 RK29_CAM_POWERACTIVE_L
150 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_02 RK29_CAM_RESETACTIVE_L
151 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_02 RK29_CAM_POWERDNACTIVE_H
152 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_02 RK29_CAM_FLASHACTIVE_L
154 #define CONFIG_SENSOR_QCIF_FPS_FIXED_02 15000
155 #define CONFIG_SENSOR_240X160_FPS_FIXED_02 15000
156 #define CONFIG_SENSOR_QVGA_FPS_FIXED_02 15000
157 #define CONFIG_SENSOR_CIF_FPS_FIXED_02 15000
158 #define CONFIG_SENSOR_VGA_FPS_FIXED_02 15000
159 #define CONFIG_SENSOR_480P_FPS_FIXED_02 15000
160 #define CONFIG_SENSOR_SVGA_FPS_FIXED_02 15000
161 #define CONFIG_SENSOR_720P_FPS_FIXED_02 30000
163 #define CONFIG_SENSOR_1 RK29_CAM_SENSOR_SIV121D /* front camera sensor 0 */
164 #define CONFIG_SENSOR_IIC_ADDR_1 0x66
165 #define CONFIG_SENSOR_IIC_ADAPTER_ID_1 3
166 #define CONFIG_SENSOR_CIF_INDEX_1 0
167 #define CONFIG_SENSOR_ORIENTATION_1 270
168 #define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
169 #define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
170 #define CONFIG_SENSOR_POWERDN_PIN_1 RK30_PIN1_PB6
171 #define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
172 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
173 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
174 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
175 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
177 #define CONFIG_SENSOR_QCIF_FPS_FIXED_1 15000
178 #define CONFIG_SENSOR_240X160_FPS_FIXED_1 15000
179 #define CONFIG_SENSOR_QVGA_FPS_FIXED_1 15000
180 #define CONFIG_SENSOR_CIF_FPS_FIXED_1 15000
181 #define CONFIG_SENSOR_VGA_FPS_FIXED_1 15000
182 #define CONFIG_SENSOR_480P_FPS_FIXED_1 15000
183 #define CONFIG_SENSOR_SVGA_FPS_FIXED_1 15000
184 #define CONFIG_SENSOR_720P_FPS_FIXED_1 30000
186 #define CONFIG_SENSOR_11 RK29_CAM_SENSOR_OV2659 /* front camera sensor 1 */
187 #define CONFIG_SENSOR_IIC_ADDR_11 0x00
188 #define CONFIG_SENSOR_IIC_ADAPTER_ID_11 3
189 #define CONFIG_SENSOR_CIF_INDEX_11 0
190 #define CONFIG_SENSOR_ORIENTATION_11 270
191 #define CONFIG_SENSOR_POWER_PIN_11 INVALID_GPIO
192 #define CONFIG_SENSOR_RESET_PIN_11 INVALID_GPIO
193 #define CONFIG_SENSOR_POWERDN_PIN_11 INVALID_GPIO//RK30_PIN1_PB7
194 #define CONFIG_SENSOR_FALSH_PIN_11 INVALID_GPIO
195 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_11 RK29_CAM_POWERACTIVE_L
196 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_11 RK29_CAM_RESETACTIVE_L
197 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_11 RK29_CAM_POWERDNACTIVE_H
198 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_11 RK29_CAM_FLASHACTIVE_L
200 #define CONFIG_SENSOR_QCIF_FPS_FIXED_11 15000
201 #define CONFIG_SENSOR_240X160_FPS_FIXED_11 15000
202 #define CONFIG_SENSOR_QVGA_FPS_FIXED_11 15000
203 #define CONFIG_SENSOR_CIF_FPS_FIXED_11 15000
204 #define CONFIG_SENSOR_VGA_FPS_FIXED_11 15000
205 #define CONFIG_SENSOR_480P_FPS_FIXED_11 15000
206 #define CONFIG_SENSOR_SVGA_FPS_FIXED_11 15000
207 #define CONFIG_SENSOR_720P_FPS_FIXED_11 30000
209 #define CONFIG_SENSOR_12 RK29_CAM_SENSOR_OV2659//RK29_CAM_SENSOR_OV2655 /* front camera sensor 2 */
210 #define CONFIG_SENSOR_IIC_ADDR_12 0x00
211 #define CONFIG_SENSOR_IIC_ADAPTER_ID_12 3
212 #define CONFIG_SENSOR_CIF_INDEX_12 0
213 #define CONFIG_SENSOR_ORIENTATION_12 270
214 #define CONFIG_SENSOR_POWER_PIN_12 INVALID_GPIO
215 #define CONFIG_SENSOR_RESET_PIN_12 INVALID_GPIO
216 #define CONFIG_SENSOR_POWERDN_PIN_12 INVALID_GPIO//RK30_PIN1_PB7
217 #define CONFIG_SENSOR_FALSH_PIN_12 INVALID_GPIO
218 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_12 RK29_CAM_POWERACTIVE_L
219 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_12 RK29_CAM_RESETACTIVE_L
220 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_12 RK29_CAM_POWERDNACTIVE_H
221 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_12 RK29_CAM_FLASHACTIVE_L
223 #define CONFIG_SENSOR_QCIF_FPS_FIXED_12 15000
224 #define CONFIG_SENSOR_240X160_FPS_FIXED_12 15000
225 #define CONFIG_SENSOR_QVGA_FPS_FIXED_12 15000
226 #define CONFIG_SENSOR_CIF_FPS_FIXED_12 15000
227 #define CONFIG_SENSOR_VGA_FPS_FIXED_12 15000
228 #define CONFIG_SENSOR_480P_FPS_FIXED_12 15000
229 #define CONFIG_SENSOR_SVGA_FPS_FIXED_12 15000
230 #define CONFIG_SENSOR_720P_FPS_FIXED_12 30000
233 #endif //#ifdef CONFIG_VIDEO_RK29
234 /*---------------- Camera Sensor Configuration Macro End------------------------*/
235 #include "../../../drivers/media/video/rk30_camera.c"
236 /*---------------- Camera Sensor Macro Define End ---------*/
238 #define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
239 /*****************************************************************************************
241 * author: ddl@rock-chips.com
242 *****************************************************************************************/
243 #ifdef CONFIG_VIDEO_RK29
244 #define CONFIG_SENSOR_POWER_IOCTL_USR 1 //define this refer to your board layout
245 #define CONFIG_SENSOR_RESET_IOCTL_USR 0
246 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
247 #define CONFIG_SENSOR_FLASH_IOCTL_USR 0
249 static void rk_cif_power(int on)
251 struct regulator *ldo_18,*ldo_28;
252 ldo_28 = regulator_get(NULL, "vmmc"); // vcc28_cif ldo7
253 ldo_18 = regulator_get(NULL, "vdig1"); // vcc18_cif ldo1
254 if (ldo_28 == NULL || IS_ERR(ldo_28) || ldo_18 == NULL || IS_ERR(ldo_18)){
255 printk("get cif ldo failed!\n");
259 regulator_disable(ldo_28);
260 regulator_put(ldo_28);
261 regulator_disable(ldo_18);
262 regulator_put(ldo_18);
266 regulator_set_voltage(ldo_28, 2800000, 2800000);
267 regulator_enable(ldo_28);
268 // printk("%s set ldo7 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_28));
269 regulator_put(ldo_28);
271 regulator_set_voltage(ldo_18, 1800000, 1800000);
272 // regulator_set_suspend_voltage(ldo, 1800000);
273 regulator_enable(ldo_18);
274 // printk("%s set ldo1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_18));
275 regulator_put(ldo_18);
279 #if CONFIG_SENSOR_POWER_IOCTL_USR
280 static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
282 //#error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
287 #if CONFIG_SENSOR_RESET_IOCTL_USR
288 static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
290 #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
294 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
295 static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
297 #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
301 #if CONFIG_SENSOR_FLASH_IOCTL_USR
302 static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
304 #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
308 static struct rk29camera_platform_ioctl_cb sensor_ioctl_cb = {
309 #if CONFIG_SENSOR_POWER_IOCTL_USR
310 .sensor_power_cb = sensor_power_usr_cb,
312 .sensor_power_cb = NULL,
315 #if CONFIG_SENSOR_RESET_IOCTL_USR
316 .sensor_reset_cb = sensor_reset_usr_cb,
318 .sensor_reset_cb = NULL,
321 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
322 .sensor_powerdown_cb = sensor_powerdown_usr_cb,
324 .sensor_powerdown_cb = NULL,
327 #if CONFIG_SENSOR_FLASH_IOCTL_USR
328 .sensor_flash_cb = sensor_flash_usr_cb,
330 .sensor_flash_cb = NULL,
334 #if CONFIG_SENSOR_IIC_ADDR_0
335 static struct reginfo_t rk_init_data_sensor_reg_0[] =
339 static struct reginfo_t rk_init_data_sensor_winseqreg_0[] ={
344 #if CONFIG_SENSOR_IIC_ADDR_1
345 static struct reginfo_t rk_init_data_sensor_reg_1[] =
349 static struct reginfo_t rk_init_data_sensor_winseqreg_1[] =
354 #if CONFIG_SENSOR_IIC_ADDR_01
355 static struct reginfo_t rk_init_data_sensor_reg_01[] =
359 static struct reginfo_t rk_init_data_sensor_winseqreg_01[] =
364 #if CONFIG_SENSOR_IIC_ADDR_02
365 static struct reginfo_t rk_init_data_sensor_reg_02[] =
369 static struct reginfo_t rk_init_data_sensor_winseqreg_02[] =
374 #if CONFIG_SENSOR_IIC_ADDR_11
375 static struct reginfo_t rk_init_data_sensor_reg_11[] =
379 static struct reginfo_t rk_init_data_sensor_winseqreg_11[] =
384 #if CONFIG_SENSOR_IIC_ADDR_12
385 static struct reginfo_t rk_init_data_sensor_reg_12[] =
389 static struct reginfo_t rk_init_data_sensor_winseqreg_12[] =
394 static rk_sensor_user_init_data_s rk_init_data_sensor[RK_CAM_NUM] =
396 #if CONFIG_SENSOR_IIC_ADDR_0
398 .rk_sensor_init_width = INVALID_VALUE,
399 .rk_sensor_init_height = INVALID_VALUE,
400 .rk_sensor_init_bus_param = INVALID_VALUE,
401 .rk_sensor_init_pixelcode = INVALID_VALUE,
402 .rk_sensor_init_data = rk_init_data_sensor_reg_0,
403 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_0,
404 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_0) / sizeof(struct reginfo_t),
405 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_0) / sizeof(struct reginfo_t),
409 .rk_sensor_init_width = INVALID_VALUE,
410 .rk_sensor_init_height = INVALID_VALUE,
411 .rk_sensor_init_bus_param = INVALID_VALUE,
412 .rk_sensor_init_pixelcode = INVALID_VALUE,
413 .rk_sensor_init_data = NULL,
414 .rk_sensor_init_winseq = NULL,
415 .rk_sensor_winseq_size = 0,
416 .rk_sensor_init_data_size = 0,
419 #if CONFIG_SENSOR_IIC_ADDR_1
421 .rk_sensor_init_width = INVALID_VALUE,
422 .rk_sensor_init_height = INVALID_VALUE,
423 .rk_sensor_init_bus_param = INVALID_VALUE,
424 .rk_sensor_init_pixelcode = INVALID_VALUE,
425 .rk_sensor_init_data = rk_init_data_sensor_reg_1,
426 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_1,
427 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_1) / sizeof(struct reginfo_t),
428 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_1) / sizeof(struct reginfo_t),
432 .rk_sensor_init_width = INVALID_VALUE,
433 .rk_sensor_init_height = INVALID_VALUE,
434 .rk_sensor_init_bus_param = INVALID_VALUE,
435 .rk_sensor_init_pixelcode = INVALID_VALUE,
436 .rk_sensor_init_data = NULL,
437 .rk_sensor_init_winseq = NULL,
438 .rk_sensor_winseq_size = 0,
439 .rk_sensor_init_data_size = 0,
442 #if CONFIG_SENSOR_IIC_ADDR_01
444 .rk_sensor_init_width = INVALID_VALUE,
445 .rk_sensor_init_height = INVALID_VALUE,
446 .rk_sensor_init_bus_param = INVALID_VALUE,
447 .rk_sensor_init_pixelcode = INVALID_VALUE,
448 .rk_sensor_init_data = rk_init_data_sensor_reg_01,
449 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_01,
450 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_01) / sizeof(struct reginfo_t),
451 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_01) / sizeof(struct reginfo_t),
455 .rk_sensor_init_width = INVALID_VALUE,
456 .rk_sensor_init_height = INVALID_VALUE,
457 .rk_sensor_init_bus_param = INVALID_VALUE,
458 .rk_sensor_init_pixelcode = INVALID_VALUE,
459 .rk_sensor_init_data = NULL,
460 .rk_sensor_init_winseq = NULL,
461 .rk_sensor_winseq_size = 0,
462 .rk_sensor_init_data_size = 0,
465 #if CONFIG_SENSOR_IIC_ADDR_02
467 .rk_sensor_init_width = INVALID_VALUE,
468 .rk_sensor_init_height = INVALID_VALUE,
469 .rk_sensor_init_bus_param = INVALID_VALUE,
470 .rk_sensor_init_pixelcode = INVALID_VALUE,
471 .rk_sensor_init_data = rk_init_data_sensor_reg_02,
472 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_02,
473 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_02) / sizeof(struct reginfo_t),
474 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_02) / sizeof(struct reginfo_t),
478 .rk_sensor_init_width = INVALID_VALUE,
479 .rk_sensor_init_height = INVALID_VALUE,
480 .rk_sensor_init_bus_param = INVALID_VALUE,
481 .rk_sensor_init_pixelcode = INVALID_VALUE,
482 .rk_sensor_init_data = NULL,
483 .rk_sensor_init_winseq = NULL,
484 .rk_sensor_winseq_size = 0,
485 .rk_sensor_init_data_size = 0,
488 #if CONFIG_SENSOR_IIC_ADDR_11
490 .rk_sensor_init_width = INVALID_VALUE,
491 .rk_sensor_init_height = INVALID_VALUE,
492 .rk_sensor_init_bus_param = INVALID_VALUE,
493 .rk_sensor_init_pixelcode = INVALID_VALUE,
494 .rk_sensor_init_data = rk_init_data_sensor_reg_11,
495 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_11,
496 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_11) / sizeof(struct reginfo_t),
497 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_11) / sizeof(struct reginfo_t),
501 .rk_sensor_init_width = INVALID_VALUE,
502 .rk_sensor_init_height = INVALID_VALUE,
503 .rk_sensor_init_bus_param = INVALID_VALUE,
504 .rk_sensor_init_pixelcode = INVALID_VALUE,
505 .rk_sensor_init_data = NULL,
506 .rk_sensor_init_winseq = NULL,
507 .rk_sensor_winseq_size = 0,
508 .rk_sensor_init_data_size = 0,
511 #if CONFIG_SENSOR_IIC_ADDR_12
513 .rk_sensor_init_width = INVALID_VALUE,
514 .rk_sensor_init_height = INVALID_VALUE,
515 .rk_sensor_init_bus_param = INVALID_VALUE,
516 .rk_sensor_init_pixelcode = INVALID_VALUE,
517 .rk_sensor_init_data = rk_init_data_sensor_reg_12,
518 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_12,
519 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_12) / sizeof(struct reginfo_t),
520 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_12) / sizeof(struct reginfo_t),
524 .rk_sensor_init_width = INVALID_VALUE,
525 .rk_sensor_init_height = INVALID_VALUE,
526 .rk_sensor_init_bus_param = INVALID_VALUE,
527 .rk_sensor_init_pixelcode = INVALID_VALUE,
528 .rk_sensor_init_data = NULL,
529 .rk_sensor_init_winseq = NULL,
530 .rk_sensor_winseq_size = 0,
531 .rk_sensor_init_data_size = 0,
536 #include "../../../drivers/media/video/rk30_camera.c"
538 #endif /* CONFIG_VIDEO_RK29 */
540 #ifdef CONFIG_TOUCHSCREEN_GT82X_IIC
541 #define TOUCH_ENABLE_PIN INVALID_GPIO
542 #define TOUCH_RESET_PIN RK30_PIN4_PD0
543 #define TOUCH_INT_PIN RK30_PIN4_PC2
544 int goodix_init_platform_hw(void)
548 rk30_mux_api_set(GPIO4D0_SMCDATA8_TRACEDATA8_NAME, GPIO4D_GPIO4D0);
549 rk30_mux_api_set(GPIO4C2_SMCDATA2_TRACEDATA2_NAME, GPIO4C_GPIO4C2);
550 //printk("%s:0x%x,0x%x\n",__func__,rk30_mux_api_get(GPIO4D0_SMCDATA8_TRACEDATA8_NAME),rk30_mux_api_get(GPIO4C2_SMCDATA2_TRACEDATA2_NAME));
551 if (TOUCH_ENABLE_PIN != INVALID_GPIO) {
552 ret = gpio_request(TOUCH_ENABLE_PIN, "goodix power pin");
554 gpio_free(TOUCH_ENABLE_PIN);
555 printk("goodix power error\n");
558 gpio_direction_output(TOUCH_ENABLE_PIN, 0);
559 gpio_set_value(TOUCH_ENABLE_PIN, GPIO_LOW);
563 if (TOUCH_RESET_PIN != INVALID_GPIO) {
564 ret = gpio_request(TOUCH_RESET_PIN, "goodix reset pin");
566 gpio_free(TOUCH_RESET_PIN);
567 printk("goodix gpio_request error\n");
570 gpio_direction_output(TOUCH_RESET_PIN, 0);
571 gpio_set_value(TOUCH_RESET_PIN, GPIO_LOW);
573 gpio_set_value(TOUCH_RESET_PIN, GPIO_HIGH);
578 u8 ts82x_config_data[] = {
579 0x65,0x00,0x04,0x00,0x03,0x00,0x0A,0x0D,0x1E,0xE7,
580 0x32,0x03,0x08,0x10,0x48,0x42,0x42,0x20,0x00,0x01,
581 0x60,0x60,0x4B,0x6E,0x0E,0x0D,0x0C,0x0B,0x0A,0x09,
582 0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00,0x1D,
583 0x1C,0x1B,0x1A,0x19,0x18,0x17,0x16,0x15,0x14,0x13,
584 0x12,0x11,0x10,0x0F,0x50,0x00,0x00,0x00,0x00,0x00,
585 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2B,0x00,0x00,
586 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
589 static struct goodix_i2c_rmi_platform_data ts82x_pdata = {
590 .gpio_shutdown = TOUCH_ENABLE_PIN,
591 .gpio_irq = TOUCH_INT_PIN,
592 .gpio_reset = TOUCH_RESET_PIN,
593 .irq_edge = 1, /* 0:rising edge, 1:falling edge */
600 .config_info_len =ARRAY_SIZE(ts82x_config_data),
601 .config_info = ts82x_config_data,
602 .init_platform_hw= goodix_init_platform_hw,
606 #if defined (CONFIG_RK_HEADSET_DET) || defined (CONFIG_RK_HEADSET_IRQ_HOOK_ADC_DET)
608 static int rk_headset_io_init(int gpio, char *iomux_name, int iomux_mode)
611 ret = gpio_request(gpio, NULL);
615 rk30_mux_api_set(iomux_name, iomux_mode);
616 gpio_pull_updown(gpio, PullDisable);
617 gpio_direction_input(gpio);
621 struct rk_headset_pdata rk_headset_info = {
622 .Headset_gpio = RK30_PIN0_PC7,
623 .headset_in_type = HEADSET_IN_HIGH,
625 .hook_key_code = KEY_MEDIA,
626 .headset_gpio_info = {GPIO0C7_TRACECTL_SMCADDR3_NAME, GPIO0C_GPIO0C7},
627 .headset_io_init = rk_headset_io_init,
630 struct platform_device rk_device_headset = {
631 .name = "rk_headsetdet",
634 .platform_data = &rk_headset_info,
640 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
641 #define TOUCH_RESET_PIN RK30_PIN4_PD0
642 #define TOUCH_PWR_PIN INVALID_GPIO
643 int goodix_init_platform_hw(void)
647 rk30_mux_api_set(GPIO4D0_SMCDATA8_TRACEDATA8_NAME, GPIO4D_GPIO4D0);
648 rk30_mux_api_set(GPIO4C2_SMCDATA2_TRACEDATA2_NAME, GPIO4C_GPIO4C2);
649 printk("%s:0x%x,0x%x\n",__func__,rk30_mux_api_get(GPIO4D0_SMCDATA8_TRACEDATA8_NAME),rk30_mux_api_get(GPIO4C2_SMCDATA2_TRACEDATA2_NAME));
651 if (TOUCH_PWR_PIN != INVALID_GPIO) {
652 ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin");
654 gpio_free(TOUCH_PWR_PIN);
655 printk("goodix power error\n");
658 gpio_direction_output(TOUCH_PWR_PIN, 0);
659 gpio_set_value(TOUCH_PWR_PIN, GPIO_LOW);
663 if (TOUCH_RESET_PIN != INVALID_GPIO) {
664 ret = gpio_request(TOUCH_RESET_PIN, "goodix reset pin");
666 gpio_free(TOUCH_RESET_PIN);
667 printk("goodix gpio_request error\n");
670 gpio_direction_output(TOUCH_RESET_PIN, 1);
672 //gpio_set_value(TOUCH_RESET_PIN, GPIO_LOW);
674 //gpio_set_value(TOUCH_RESET_PIN, GPIO_HIGH);
680 struct goodix_platform_data goodix_info = {
682 .irq_pin = RK30_PIN4_PC2,
683 .rest_pin = TOUCH_RESET_PIN,
684 .init_platform_hw = goodix_init_platform_hw,
688 static struct spi_board_info board_spi_devices[] = {
691 /***********************************************************
693 ************************************************************/
694 #ifdef CONFIG_BACKLIGHT_RK29_BL
696 #define PWM_MUX_NAME GPIO0D6_PWM2_NAME
697 #define PWM_MUX_MODE GPIO0D_PWM2
698 #define PWM_MUX_MODE_GPIO GPIO0A_GPIO0A3
699 #define PWM_GPIO RK30_PIN0_PD6
700 #define PWM_EFFECT_VALUE 1
702 #define LCD_DISP_ON_PIN
704 #ifdef LCD_DISP_ON_PIN
705 //#define BL_EN_MUX_NAME GPIOF34_UART3_SEL_NAME
706 //#define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
708 #define BL_EN_PIN RK30_PIN6_PB3
709 #define BL_EN_VALUE GPIO_HIGH
711 static int rk29_backlight_io_init(void)
714 //rk30_mux_api_set(GPIO0D6_PWM2_NAME, GPIO0D_GPIO0D6);
715 //gpio_request(RK30_PIN0_PD6, NULL);
716 //gpio_direction_output(RK30_PIN0_PD6, GPIO_HIGH);
718 rk30_mux_api_set(GPIO0D6_PWM2_NAME, GPIO0D_PWM2);
719 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
720 #ifdef LCD_DISP_ON_PIN
721 // rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
723 ret = gpio_request(BL_EN_PIN, NULL);
725 gpio_free(BL_EN_PIN);
728 gpio_direction_output(BL_EN_PIN, BL_EN_VALUE);
729 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
734 static int rk29_backlight_io_deinit(void)
737 #ifdef LCD_DISP_ON_PIN
738 gpio_free(BL_EN_PIN);
740 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
744 static int rk29_backlight_pwm_suspend(void)
747 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
748 if (gpio_request(PWM_GPIO, NULL)) {
749 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
752 gpio_direction_output(PWM_GPIO, GPIO_LOW);
753 #ifdef LCD_DISP_ON_PIN
754 gpio_direction_output(BL_EN_PIN, 0);
755 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
760 static int rk29_backlight_pwm_resume(void)
763 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
764 #ifdef LCD_DISP_ON_PIN
766 gpio_direction_output(BL_EN_PIN, 1);
767 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
772 static struct rk29_bl_info rk29_bl_info = {
774 .bl_ref = PWM_EFFECT_VALUE,
775 .io_init = rk29_backlight_io_init,
776 .io_deinit = rk29_backlight_io_deinit,
777 .pwm_suspend = rk29_backlight_pwm_suspend,
778 .pwm_resume = rk29_backlight_pwm_resume,
781 static struct platform_device rk29_device_backlight = {
782 .name = "rk29_backlight",
785 .platform_data = &rk29_bl_info,
791 #ifdef CONFIG_SND_SOC_RT3261
793 static int rt3261_io_init(int gpio, char *iomux_name, int iomux_mode)
795 gpio_request(gpio,NULL);
796 rk30_mux_api_set(iomux_name, iomux_mode);
797 gpio_direction_output(gpio,1);
801 static struct rt3261_platform_data rt3261_info = {
802 .codec_en_gpio = RK30_PIN4_PD7,
803 .codec_en_gpio_info = {GPIO4D7_SMCDATA15_TRACEDATA15_NAME,GPIO4D_GPIO4D7},
804 .io_init = rt3261_io_init,
809 #ifdef CONFIG_RK29_SUPPORT_MODEM
811 #define RK30_MODEM_POWER RK30_PIN4_PD1
812 #define RK30_MODEM_POWER_IOMUX rk29_mux_api_set(GPIO4D1_SMCDATA9_TRACEDATA9_NAME, GPIO4D_GPIO4D1)
814 static int rk30_modem_io_init(void)
816 printk("%s\n", __FUNCTION__);
817 RK30_MODEM_POWER_IOMUX;
822 static struct rk29_io_t rk30_modem_io = {
823 .io_addr = RK30_MODEM_POWER,
826 .io_init = rk30_modem_io_init,
829 static struct platform_device rk30_device_modem = {
830 .name = "rk30_modem",
833 .platform_data = &rk30_modem_io,
837 #if defined(CONFIG_MU509)
838 static int mu509_io_init(void)
841 rk30_mux_api_set(GPIO2B6_LCDC1DATA14_SMCADDR18_TSSYNC_NAME, GPIO2B_GPIO2B6);
842 rk30_mux_api_set(GPIO4D2_SMCDATA10_TRACEDATA10_NAME, GPIO4D_GPIO4D2);
843 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
844 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
848 static int mu509_io_deinit(void)
854 struct rk29_mu509_data rk29_mu509_info = {
855 .io_init = mu509_io_init,
856 .io_deinit = mu509_io_deinit,
857 .modem_power_en = RK30_PIN6_PB2,//RK30_PIN4_PD1,
858 .bp_power = RK30_PIN2_PB6,//RK30_PIN4_PD1,
859 .bp_reset = RK30_PIN4_PD2,
860 .ap_wakeup_bp = RK30_PIN2_PB7,
861 .bp_wakeup_ap = RK30_PIN6_PA0,
863 struct platform_device rk29_device_mu509 = {
867 .platform_data = &rk29_mu509_info,
871 #if defined(CONFIG_MW100)
872 static int mw100_io_init(void)
874 rk30_mux_api_set(GPIO2B6_LCDC1DATA14_SMCADDR18_TSSYNC_NAME, GPIO2B_GPIO2B6);
875 rk30_mux_api_set(GPIO4D2_SMCDATA10_TRACEDATA10_NAME, GPIO4D_GPIO4D2);
876 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
877 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
881 static int mw100_io_deinit(void)
887 struct rk29_mw100_data rk29_mw100_info = {
888 .io_init = mw100_io_init,
889 .io_deinit = mw100_io_deinit,
890 .modem_power_en = RK30_PIN6_PB2,
891 .bp_power = RK30_PIN2_PB6,
892 .bp_reset = RK30_PIN4_PD2,
893 .ap_wakeup_bp = RK30_PIN2_PB7,
894 .bp_wakeup_ap = RK30_PIN6_PA0,
896 struct platform_device rk29_device_mw100 = {
900 .platform_data = &rk29_mw100_info,
904 #if defined(CONFIG_MT6229)
905 static int mt6229_io_init(void)
907 rk30_mux_api_set(GPIO2B6_LCDC1DATA14_SMCADDR18_TSSYNC_NAME, GPIO2B_GPIO2B6);
908 rk30_mux_api_set(GPIO2B7_LCDC1DATA15_SMCADDR19_HSADCDATA7_NAME, GPIO2B_GPIO2B7);
909 rk30_mux_api_set(GPIO2C0_LCDCDATA16_GPSCLK_HSADCCLKOUT_NAME, GPIO2C_GPIO2C0);
910 rk30_mux_api_set(GPIO2B5_LCDC1DATA13_SMCADDR17_HSADCDATA8_NAME,GPIO2B_GPIO2B5);
915 static int mt6229_io_deinit(void)
921 struct rk29_mt6229_data rk29_mt6229_info = {
922 .io_init = mt6229_io_init,
923 .io_deinit = mt6229_io_deinit,
924 .modem_power_en = RK30_PIN2_PB6,
925 .bp_power = RK30_PIN2_PB7,//RK30_PIN2_PB6,
926 .ap_wakeup_bp = RK30_PIN2_PC0,
927 .bp_wakeup_ap = RK30_PIN2_PB5,
929 struct platform_device rk29_device_mt6229 = {
933 .platform_data = &rk29_mt6229_info,
937 #if defined(CONFIG_SEW868)
938 static int sew868_io_init(void)
940 rk30_mux_api_set(GPIO2B6_LCDC1DATA14_SMCADDR18_TSSYNC_NAME, GPIO2B_GPIO2B6);
941 rk30_mux_api_set(GPIO4D2_SMCDATA10_TRACEDATA10_NAME, GPIO4D_GPIO4D2);
942 rk30_mux_api_set(GPIO4D4_SMCDATA12_TRACEDATA12_NAME, GPIO4D_GPIO4D4);
945 static int sew868_io_deinit(void)
949 struct rk30_sew868_data rk30_sew868_info = {
950 .io_init = sew868_io_init,
951 .io_deinit = sew868_io_deinit,
952 .bp_power = RK30_PIN6_PB2,
953 .bp_power_active_low = 1,
954 .bp_sys = RK30_PIN2_PB6,
955 .bp_reset = RK30_PIN4_PD2,
956 .bp_reset_active_low = 1,
957 .bp_wakeup_ap = RK30_PIN4_PD4,
958 .ap_wakeup_bp = NULL,
961 struct platform_device rk30_device_sew868 = {
965 .platform_data = &rk30_sew868_info,
969 #if defined(CONFIG_MI700)
970 #define BP_POWER RK29_PIN6_PB1
971 #define BP_RESET RK29_PIN6_PC7
972 static int mi700_io_init(void)
975 result = gpio_request(BP_RESET, NULL);
979 printk("failed to request BP_RESET gpio\n");
981 result = gpio_request(BP_POWER, NULL);
985 printk("failed to request BP_POWER gpio\n");
990 static int mi700_io_deinit(void)
998 struct rk29_mi700_data rk29_mi700_info = {
999 .io_init = mi700_io_init,
1000 .io_deinit = mi700_io_deinit,
1001 .bp_power = RK29_PIN6_PB1,//RK29_PIN0_PB4,
1002 .bp_reset = RK29_PIN6_PC7,//RK29_PIN0_PB3,
1003 .bp_wakeup_ap = RK29_PIN6_PC6,//RK29_PIN0_PC2,
1004 .ap_wakeup_bp = NULL,//RK29_PIN0_PB0,
1006 struct platform_device rk29_device_mi700 = {
1010 .platform_data = &rk29_mi700_info,
1015 #if defined (CONFIG_GS_MMA8452)
1016 #define MMA8452_INT_PIN RK30_PIN4_PC0
1018 static int mma8452_init_platform_hw(void)
1020 rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
1025 static struct sensor_platform_data mma8452_info = {
1026 .type = SENSOR_TYPE_ACCEL,
1028 .poll_delay_ms = 30,
1029 .init_platform_hw = mma8452_init_platform_hw,
1030 .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0},
1033 #if defined (CONFIG_GS_LIS3DH)
1034 #define LIS3DH_INT_PIN RK30_PIN4_PC0
1036 static int lis3dh_init_platform_hw(void)
1038 rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
1043 static struct sensor_platform_data lis3dh_info = {
1044 .type = SENSOR_TYPE_ACCEL,
1046 .poll_delay_ms = 30,
1047 .init_platform_hw = lis3dh_init_platform_hw,
1048 .orientation = {-1, 0, 0, 0, 0, 1, 0, -1, 0},
1051 #if defined (CONFIG_COMPASS_AK8975)
1052 static struct sensor_platform_data akm8975_info =
1054 .type = SENSOR_TYPE_COMPASS,
1056 .poll_delay_ms = 30,
1087 #if defined(CONFIG_GYRO_L3G4200D)
1089 #include <linux/l3g4200d.h>
1090 #define L3G4200D_INT_PIN RK30_PIN4_PC3
1092 static int l3g4200d_init_platform_hw(void)
1094 rk30_mux_api_set(GPIO4C3_SMCDATA3_TRACEDATA3_NAME, GPIO4C_GPIO4C3);
1099 static struct sensor_platform_data l3g4200d_info = {
1100 .type = SENSOR_TYPE_GYROSCOPE,
1102 .poll_delay_ms = 30,
1103 .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
1104 .init_platform_hw = l3g4200d_init_platform_hw,
1105 .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
1112 #ifdef CONFIG_LS_CM3217
1113 static struct sensor_platform_data cm3217_info = {
1114 .type = SENSOR_TYPE_LIGHT,
1116 .poll_delay_ms = 500,
1121 #ifdef CONFIG_FB_ROCKCHIP
1123 #define LCD_CS_MUX_NAME GPIO4C7_SMCDATA7_TRACEDATA7_NAME
1124 #define LCD_CS_PIN RK30_PIN4_PC7
1125 #define LCD_CS_VALUE GPIO_HIGH
1127 #define LCD_EN_MUX_NAME GPIO4C7_SMCDATA7_TRACEDATA7_NAME
1128 #define LCD_EN_PIN RK30_PIN6_PB4
1129 #define LCD_EN_VALUE GPIO_LOW
1131 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
1134 rk30_mux_api_set(LCD_CS_MUX_NAME, GPIO4C_GPIO4C7);
1135 ret = gpio_request(LCD_CS_PIN, NULL);
1138 gpio_free(LCD_CS_PIN);
1139 printk(KERN_ERR "request lcd cs pin fail!\n");
1144 gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
1146 ret = gpio_request(LCD_EN_PIN, NULL);
1149 gpio_free(LCD_EN_PIN);
1150 printk(KERN_ERR "request lcd en pin fail!\n");
1155 gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
1159 static int rk_fb_io_disable(void)
1161 gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE? 0:1);
1162 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE? 0:1);
1165 static int rk_fb_io_enable(void)
1167 gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
1168 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
1172 #if defined(CONFIG_LCDC0_RK30)
1173 struct rk29fb_info lcdc0_screen_info = {
1174 .prop = PRMRY, //primary display device
1175 .io_init = rk_fb_io_init,
1176 .io_disable = rk_fb_io_disable,
1177 .io_enable = rk_fb_io_enable,
1178 .set_screen_info = set_lcd_info,
1182 #if defined(CONFIG_LCDC1_RK30)
1183 struct rk29fb_info lcdc1_screen_info = {
1184 #if defined(CONFIG_HDMI_RK30)
1185 .prop = EXTEND, //extend display device
1187 .set_screen_info = hdmi_init_lcdc,
1192 static struct resource resource_fb[] = {
1196 .end = 0,//RK30_FB0_MEM_SIZE - 1,
1197 .flags = IORESOURCE_MEM,
1200 .name = "ipp buf", //for rotate
1202 .end = 0,//RK30_FB0_MEM_SIZE - 1,
1203 .flags = IORESOURCE_MEM,
1208 .end = 0,//RK30_FB0_MEM_SIZE - 1,
1209 .flags = IORESOURCE_MEM,
1213 static struct platform_device device_fb = {
1216 .num_resources = ARRAY_SIZE(resource_fb),
1217 .resource = resource_fb,
1221 #ifdef CONFIG_ANDROID_TIMED_GPIO
1222 static struct timed_gpio timed_gpios[] = {
1225 .gpio = RK30_PIN0_PA4,
1226 .max_timeout = 1000,
1228 .adjust_time =20, //adjust for diff product
1232 static struct timed_gpio_platform_data rk29_vibrator_info = {
1234 .gpios = timed_gpios,
1237 static struct platform_device rk29_device_vibrator = {
1238 .name = "timed-gpio",
1241 .platform_data = &rk29_vibrator_info,
1247 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1248 static struct gpio_led rk29_leds[] = {
1250 .name = "button-backlight",
1251 .gpio = RK30_PIN4_PD7,
1252 .default_trigger = "timer",
1254 .retain_state_suspended = 0,
1255 .default_state = LEDS_GPIO_DEFSTATE_OFF,
1259 static struct gpio_led_platform_data rk29_leds_pdata = {
1261 .num_leds = ARRAY_SIZE(rk29_leds),
1264 static struct platform_device rk29_device_gpio_leds = {
1265 .name = "leds-gpio",
1268 .platform_data = &rk29_leds_pdata,
1273 #ifdef CONFIG_RK_IRDA
1274 #define IRDA_IRQ_PIN RK30_PIN6_PA1
1276 static int irda_iomux_init(void)
1281 ret = gpio_request(IRDA_IRQ_PIN, NULL);
1283 gpio_free(IRDA_IRQ_PIN);
1284 printk(">>>>>> IRDA_IRQ_PIN gpio_request err \n ");
1286 gpio_pull_updown(IRDA_IRQ_PIN, PullDisable);
1287 gpio_direction_input(IRDA_IRQ_PIN);
1292 static int irda_iomux_deinit(void)
1294 gpio_free(IRDA_IRQ_PIN);
1298 static struct irda_info rk29_irda_info = {
1299 .intr_pin = IRDA_IRQ_PIN,
1300 .iomux_init = irda_iomux_init,
1301 .iomux_deinit = irda_iomux_deinit,
1302 //.irda_pwr_ctl = bu92747guw_power_ctl,
1305 static struct platform_device irda_device = {
1306 #ifdef CONFIG_RK_IRDA_NET
1309 .name = "bu92747_irda",
1313 .platform_data = &rk29_irda_info,
1319 #define ION_RESERVE_SIZE (80 * SZ_1M)
1320 static struct ion_platform_data rk30_ion_pdata = {
1324 .type = ION_HEAP_TYPE_CARVEOUT,
1325 .id = ION_NOR_HEAP_ID,
1327 .size = ION_RESERVE_SIZE,
1332 static struct platform_device device_ion = {
1333 .name = "ion-rockchip",
1336 .platform_data = &rk30_ion_pdata,
1341 /**************************************************************************************************
1342 * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
1343 **************************************************************************************************/
1344 #ifdef CONFIG_SDMMC_RK29
1345 #include "board-rk30-sdk-sdmmc.c"
1347 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1348 #define SDMMC0_WRITE_PROTECT_PIN RK30_PIN3_PB7 //According to your own project to set the value of write-protect-pin.
1351 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1352 #define SDMMC1_WRITE_PROTECT_PIN RK30_PIN3_PC7 //According to your own project to set the value of write-protect-pin.
1355 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK30_PIN6_PB2
1357 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
1359 #ifdef CONFIG_SDMMC0_RK29
1360 static int rk29_sdmmc0_cfg_gpio(void)
1362 #ifdef CONFIG_SDMMC_RK29_OLD
1363 rk30_mux_api_set(GPIO3B1_SDMMC0CMD_NAME, GPIO3B_SDMMC0_CMD);
1364 rk30_mux_api_set(GPIO3B0_SDMMC0CLKOUT_NAME, GPIO3B_SDMMC0_CLKOUT);
1365 rk30_mux_api_set(GPIO3B2_SDMMC0DATA0_NAME, GPIO3B_SDMMC0_DATA0);
1366 rk30_mux_api_set(GPIO3B3_SDMMC0DATA1_NAME, GPIO3B_SDMMC0_DATA1);
1367 rk30_mux_api_set(GPIO3B4_SDMMC0DATA2_NAME, GPIO3B_SDMMC0_DATA2);
1368 rk30_mux_api_set(GPIO3B5_SDMMC0DATA3_NAME, GPIO3B_SDMMC0_DATA3);
1370 rk30_mux_api_set(GPIO3B6_SDMMC0DETECTN_NAME, GPIO3B_GPIO3B6);
1372 rk30_mux_api_set(GPIO3A7_SDMMC0PWREN_NAME, GPIO3A_GPIO3A7);
1373 gpio_request(RK30_PIN3_PA7, "sdmmc-power");
1374 gpio_direction_output(RK30_PIN3_PA7, GPIO_LOW);
1377 rk29_sdmmc_set_iomux(0, 0xFFFF);
1379 rk30_mux_api_set(GPIO3B6_SDMMC0DETECTN_NAME, GPIO3B_SDMMC0_DETECT_N);
1381 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1382 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
1383 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
1391 #define CONFIG_SDMMC0_USE_DMA
1392 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
1394 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
1395 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
1396 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
1398 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1399 .io_init = rk29_sdmmc0_cfg_gpio,
1401 #if !defined(CONFIG_SDMMC_RK29_OLD)
1402 .set_iomux = rk29_sdmmc_set_iomux,
1405 .dma_name = "sd_mmc",
1406 #ifdef CONFIG_SDMMC0_USE_DMA
1411 .detect_irq = RK30_PIN3_PB6, // INVALID_GPIO
1412 .enable_sd_wakeup = 0,
1414 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1415 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
1417 .write_prt = INVALID_GPIO,
1420 #endif // CONFIG_SDMMC0_RK29
1422 #ifdef CONFIG_SDMMC1_RK29
1423 #define CONFIG_SDMMC1_USE_DMA
1424 static int rk29_sdmmc1_cfg_gpio(void)
1426 #if defined(CONFIG_SDMMC_RK29_OLD)
1427 rk30_mux_api_set(GPIO3C0_SMMC1CMD_NAME, GPIO3C_SMMC1_CMD);
1428 rk30_mux_api_set(GPIO3C5_SDMMC1CLKOUT_NAME, GPIO3C_SDMMC1_CLKOUT);
1429 rk30_mux_api_set(GPIO3C1_SDMMC1DATA0_NAME, GPIO3C_SDMMC1_DATA0);
1430 rk30_mux_api_set(GPIO3C2_SDMMC1DATA1_NAME, GPIO3C_SDMMC1_DATA1);
1431 rk30_mux_api_set(GPIO3C3_SDMMC1DATA2_NAME, GPIO3C_SDMMC1_DATA2);
1432 rk30_mux_api_set(GPIO3C4_SDMMC1DATA3_NAME, GPIO3C_SDMMC1_DATA3);
1433 //rk30_mux_api_set(GPIO3C6_SDMMC1DETECTN_NAME, GPIO3C_SDMMC1_DETECT_N);
1437 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1438 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
1439 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
1447 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
1449 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
1450 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
1453 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1454 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
1455 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1458 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1461 .io_init = rk29_sdmmc1_cfg_gpio,
1463 #if !defined(CONFIG_SDMMC_RK29_OLD)
1464 .set_iomux = rk29_sdmmc_set_iomux,
1468 #ifdef CONFIG_SDMMC1_USE_DMA
1474 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1475 #ifdef CONFIG_WIFI_CONTROL_FUNC
1476 .status = rk29sdk_wifi_status,
1477 .register_status_notify = rk29sdk_wifi_status_register,
1480 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
1483 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1484 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
1486 .write_prt = INVALID_GPIO,
1490 .detect_irq = INVALID_GPIO,
1491 .enable_sd_wakeup = 0,
1495 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
1497 /**************************************************************************************************
1498 * the end of setting for SDMMC devices
1499 **************************************************************************************************/
1501 #ifdef CONFIG_BATTERY_RK30_ADC
1502 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
1503 .dc_det_pin = RK30_PIN6_PA5,
1504 .batt_low_pin = RK30_PIN6_PA0,
1505 .charge_set_pin = INVALID_GPIO,
1506 .charge_ok_pin = RK30_PIN6_PA6,
1507 .dc_det_level = GPIO_LOW,
1508 .charge_ok_level = GPIO_HIGH,
1511 static struct platform_device rk30_device_adc_battery = {
1512 .name = "rk30-battery",
1515 .platform_data = &rk30_adc_battery_platdata,
1519 #if CONFIG_RK30_PWM_REGULATOR
1520 const static int pwm_voltage_map[] = {
1521 1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
1524 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
1526 .supply = "vdd_core",
1530 struct regulator_init_data pwm_regulator_init_dcdc[1] =
1534 .name = "PWM_DCDC1",
1536 .max_uV = 1800000, //0.6-1.8V
1538 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
1540 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
1541 .consumer_supplies = pwm_dcdc1_consumers,
1545 static struct pwm_platform_data pwm_regulator_info[1] = {
1548 .pwm_gpio = RK30_PIN0_PD7,
1549 .pwm_iomux_name = GPIO0D7_PWM3_NAME,
1550 .pwm_iomux_pwm = GPIO0D_PWM3,
1551 .pwm_iomux_gpio = GPIO0D_GPIO0D6,
1552 .pwm_voltage = 1100000,
1555 .coefficient = 455, //45.5%
1556 .pwm_voltage_map = pwm_voltage_map,
1557 .init_data = &pwm_regulator_init_dcdc[0],
1561 struct platform_device pwm_regulator_device[1] = {
1563 .name = "pwm-voltage-regulator",
1566 .platform_data = &pwm_regulator_info[0],
1572 #ifdef CONFIG_RK29_VMAC
1573 #define PHY_PWR_EN_GPIO RK30_PIN1_PD6
1574 #include "board-rk30-sdk-vmac.c"
1577 #ifdef CONFIG_RFKILL_RK
1578 // bluetooth rfkill device, its driver in net/rfkill/rfkill-rk.c
1579 static struct rfkill_rk_platform_data rfkill_rk_platdata = {
1580 .type = RFKILL_TYPE_BLUETOOTH,
1582 .poweron_gpio = { // BT_REG_ON
1583 .io = RK30_PIN3_PC7,
1584 .enable = GPIO_HIGH,
1586 .name = GPIO3C7_SDMMC1WRITEPRT_NAME,
1587 .fgpio = GPIO3C_GPIO3C7,
1591 .reset_gpio = { // BT_RST
1592 .io = RK30_PIN3_PD1, // set io to INVALID_GPIO for disable it
1595 .name = GPIO3D1_SDMMC1BACKENDPWR_NAME,
1596 .fgpio = GPIO3D_GPIO3D1,
1600 .wake_gpio = { // BT_WAKE, use to control bt's sleep and wakeup
1601 .io = RK30_PIN3_PC6, // set io to INVALID_GPIO for disable it
1602 .enable = GPIO_HIGH,
1604 .name = GPIO3C6_SDMMC1DETECTN_NAME,
1605 .fgpio = GPIO3C_GPIO3C6,
1609 .wake_host_irq = { // BT_HOST_WAKE, for bt wakeup host when it is in deep sleep
1611 .io = RK30_PIN6_PA7, // set io to INVALID_GPIO for disable it
1612 .enable = GPIO_LOW, // set GPIO_LOW for falling, set 0 for rising
1619 .rts_gpio = { // UART_RTS, enable or disable BT's data coming
1620 .io = RK30_PIN1_PA3, // set io to INVALID_GPIO for disable it
1623 .name = GPIO1A3_UART0RTSN_NAME,
1624 .fgpio = GPIO1A_GPIO1A3,
1625 .fmux = GPIO1A_UART0_RTS_N,
1630 static struct platform_device device_rfkill_rk = {
1631 .name = "rfkill_rk",
1634 .platform_data = &rfkill_rk_platdata,
1639 static struct platform_device *devices[] __initdata = {
1640 #ifdef CONFIG_RK30_PWM_REGULATOR
1641 &pwm_regulator_device[0],
1643 #ifdef CONFIG_BACKLIGHT_RK29_BL
1644 &rk29_device_backlight,
1646 #ifdef CONFIG_FB_ROCKCHIP
1652 #ifdef CONFIG_ANDROID_TIMED_GPIO
1653 &rk29_device_vibrator,
1655 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1656 &rk29_device_gpio_leds,
1658 #ifdef CONFIG_RK_IRDA
1661 #ifdef CONFIG_WIFI_CONTROL_FUNC
1662 &rk29sdk_wifi_device,
1664 #ifdef CONFIG_RK29_SUPPORT_MODEM
1667 #if defined(CONFIG_MU509)
1670 #if defined(CONFIG_MW100)
1673 #if defined(CONFIG_MT6229)
1674 &rk29_device_mt6229,
1676 #if defined(CONFIG_SEW868)
1677 &rk30_device_sew868,
1679 #if defined (CONFIG_RK_HEADSET_DET) || defined (CONFIG_RK_HEADSET_IRQ_HOOK_ADC_DET)
1682 #if defined(CONFIG_MI700)
1685 #ifdef CONFIG_BATTERY_RK30_ADC
1686 &rk30_device_adc_battery,
1688 #ifdef CONFIG_RFKILL_RK
1694 #ifdef CONFIG_I2C0_RK30
1695 static struct i2c_board_info __initdata i2c0_info[] = {
1696 #if defined (CONFIG_GS_MMA8452)
1698 .type = "gs_mma8452",
1701 .irq = MMA8452_INT_PIN,
1702 .platform_data = &mma8452_info,
1705 #if defined (CONFIG_GS_LIS3DH)
1707 .type = "gs_lis3dh",
1708 .addr = 0x19, //0x19(SA0-->VCC), 0x18(SA0-->GND)
1710 .irq = LIS3DH_INT_PIN,
1711 .platform_data = &lis3dh_info,
1714 #if defined (CONFIG_COMPASS_AK8975)
1719 .irq = RK30_PIN4_PC1,
1720 .platform_data = &akm8975_info,
1723 #if defined (CONFIG_GYRO_L3G4200D)
1725 .type = "l3g4200d_gryo",
1728 .irq = L3G4200D_INT_PIN,
1729 .platform_data = &l3g4200d_info,
1732 #if defined (CONFIG_SND_SOC_RK1000)
1734 .type = "rk1000_i2c_codec",
1739 .type = "rk1000_control",
1745 #if defined (CONFIG_SND_SOC_RT5623)
1752 #if defined (CONFIG_SND_SOC_RT5631)
1759 #if defined (CONFIG_SND_SOC_RT3261)
1764 .platform_data = &rt3261_info,
1768 #ifdef CONFIG_MFD_RK610
1770 .type = "rk610_ctl",
1774 #ifdef CONFIG_RK610_TVOUT
1776 .type = "rk610_tvout",
1781 #ifdef CONFIG_RK610_HDMI
1783 .type = "rk610_hdmi",
1786 .irq = RK29_PIN5_PA2,
1789 #ifdef CONFIG_SND_SOC_RK610
1790 {//RK610_CODEC addr from 0x60 to 0x80 (0x60~0x80)
1791 .type = "rk610_i2c_codec",
1801 #ifdef CONFIG_I2C1_RK30
1802 #ifdef CONFIG_MFD_WM831X_I2C
1803 #include "board-rk30-sdk-wm8326.c"
1805 #ifdef CONFIG_MFD_TPS65910
1806 #define TPS65910_HOST_IRQ RK30_PIN6_PA4
1807 #include "board-rk30-sdk-tps65910.c"
1810 static struct i2c_board_info __initdata i2c1_info[] = {
1811 #if defined (CONFIG_MFD_WM831X_I2C)
1816 .irq = RK30_PIN6_PA4,
1817 .platform_data = &wm831x_platdata,
1820 #if defined (CONFIG_MFD_TPS65910)
1823 .addr = TPS65910_I2C_ID0,
1825 .irq = TPS65910_HOST_IRQ,
1826 .platform_data = &tps65910_data,
1832 #ifdef CONFIG_I2C2_RK30
1833 static struct i2c_board_info __initdata i2c2_info[] = {
1834 #if defined (CONFIG_TOUCHSCREEN_GT8XX)
1836 .type = "Goodix-TS",
1839 .irq = RK30_PIN4_PC2,
1840 .platform_data = &goodix_info,
1843 #if defined(CONFIG_TOUCHSCREEN_GT82X_IIC)
1845 .type = "Goodix-TS-82X",
1848 .irq = RK30_PIN4_PC2,
1849 .platform_data = &ts82x_pdata,
1852 #if defined (CONFIG_LS_CM3217)
1854 .type = "lightsensor",
1857 .platform_data = &cm3217_info,
1863 #ifdef CONFIG_I2C3_RK30
1864 static struct i2c_board_info __initdata i2c3_info[] = {
1868 #ifdef CONFIG_I2C4_RK30
1869 static struct i2c_board_info __initdata i2c4_info[] = {
1873 #ifdef CONFIG_I2C_GPIO_RK30
1874 #define I2C_SDA_PIN INVALID_GPIO// RK30_PIN2_PD6 //set sda_pin here
1875 #define I2C_SCL_PIN INVALID_GPIO//RK30_PIN2_PD7 //set scl_pin here
1876 static int rk30_i2c_io_init(void)
1878 //set iomux (gpio) here
1879 //rk30_mux_api_set(GPIO2D7_I2C1SCL_NAME, GPIO2D_GPIO2D7);
1880 //rk30_mux_api_set(GPIO2D6_I2C1SDA_NAME, GPIO2D_GPIO2D6);
1884 struct i2c_gpio_platform_data default_i2c_gpio_data = {
1885 .sda_pin = I2C_SDA_PIN,
1886 .scl_pin = I2C_SCL_PIN,
1887 .udelay = 5, // clk = 500/udelay = 100Khz
1888 .timeout = 100,//msecs_to_jiffies(100),
1890 .io_init = rk30_i2c_io_init,
1892 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1896 static void __init rk30_i2c_register_board_info(void)
1898 #ifdef CONFIG_I2C0_RK30
1899 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1901 #ifdef CONFIG_I2C1_RK30
1902 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1904 #ifdef CONFIG_I2C2_RK30
1905 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1907 #ifdef CONFIG_I2C3_RK30
1908 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1910 #ifdef CONFIG_I2C4_RK30
1911 i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
1913 #ifdef CONFIG_I2C_GPIO_RK30
1914 i2c_register_board_info(5, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1919 static void dcr_en_low(void)
1922 ret=gpio_request(RK30_PIN4_PB7,"dcr_en");
1924 printk("dcr_en_low request io error");
1925 gpio_free(RK30_PIN4_PB7);
1928 gpio_direction_output(RK30_PIN4_PB7, GPIO_LOW);
1931 #define POWER_ON_PIN RK30_PIN6_PB0 //power_hold
1932 void rk30_pm_power_off(void)
1936 printk(KERN_ERR "rk30_pm_power_off start...\n");
1940 if(gpio_get_value (rk30_adc_battery_platdata.dc_det_pin) == rk30_adc_battery_platdata.dc_det_level){
1943 if(gpio_get_value (rk30_adc_battery_platdata.dc_det_pin) != rk30_adc_battery_platdata.dc_det_level){
1946 if((gpio_get_value(RK30_PIN6_PA2)==GPIO_LOW)){
1955 arm_pm_restart(0, NULL);
1959 #if defined(CONFIG_MFD_WM831X)
1960 wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
1961 wm831x_device_shutdown(Wm831x);//wm8326 shutdown
1964 #if defined(CONFIG_MFD_TPS65910)
1965 tps65910_device_shutdown();//tps65910 shutdown
1968 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
1971 EXPORT_SYMBOL_GPL(rk30_pm_power_off);
1972 static void __init machine_rk30_board_init(void)
1975 gpio_request(POWER_ON_PIN, "poweronpin");
1976 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1979 gpio_request(RK30_PIN4_PD7, "codec_en");
1980 rk30_mux_api_set(GPIO4D7_SMCDATA15_TRACEDATA15_NAME, GPIO4D_GPIO4D7);
1981 gpio_direction_output(RK30_PIN4_PD7, GPIO_HIGH);
1983 pm_power_off = rk30_pm_power_off;
1985 rk30_i2c_register_board_info();
1986 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1987 platform_add_devices(devices, ARRAY_SIZE(devices));
1988 board_usb_detect_init(RK30_PIN6_PA3);
1990 #ifdef CONFIG_WIFI_CONTROL_FUNC
1991 rk29sdk_wifi_bt_gpio_control_init();
1996 static void __init rk30_reserve(void)
1999 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
2001 #ifdef CONFIG_FB_ROCKCHIP
2002 resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
2003 resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
2004 resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
2005 resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
2006 resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE);
2007 resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
2009 #ifdef CONFIG_VIDEO_RK29
2010 rk30_camera_request_reserve_mem();
2012 board_mem_reserved();
2016 * dvfs_cpu_logic_table: table for arm and logic dvfs
2017 * @frequency : arm frequency
2018 * @cpu_volt : arm voltage depend on frequency
2019 * @logic_volt : logic voltage arm requests depend on frequency
2020 * comments : min arm/logic voltage
2022 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
2023 {.frequency = 252 * 1000, .cpu_volt = 1075 * 1000, .logic_volt = 1125 * 1000},//0.975V/1.000V
2024 {.frequency = 504 * 1000, .cpu_volt = 1075 * 1000, .logic_volt = 1125* 1000},//0.975V/1.000V
2025 {.frequency = 816 * 1000, .cpu_volt = 1100 * 1000, .logic_volt = 1150 * 1000},//1.000V/1.025V
2026 {.frequency = 1008 * 1000, .cpu_volt = 1125 * 1000, .logic_volt = 1150 * 1000},//1.025V/1.050V
2027 {.frequency = 1200 * 1000, .cpu_volt = 1175 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
2028 //{.frequency = 1272 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000},//1.150V/1.100V
2029 //{.frequency = 1416 * 1000, .cpu_volt = 1300 * 1000, .logic_volt = 1200 * 1000},//1.225V/1.100V
2030 //{.frequency = 1512 * 1000, .cpu_volt = 1350 * 1000, .logic_volt = 1250 * 1000},//1.300V/1.150V
2031 //{.frequency = 1608 * 1000, .cpu_volt = 1375 * 1000, .logic_volt = 1275 * 1000},//1.325V/1.175V
2032 {.frequency = CPUFREQ_TABLE_END},
2035 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
2036 {.frequency = 266 * 1000, .index = 1050 * 1000},
2037 {.frequency = 400 * 1000, .index = 1275 * 1000},
2038 {.frequency = CPUFREQ_TABLE_END},
2041 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
2042 {.frequency = 300 * 1000, .index = 1050 * 1000},
2043 {.frequency = 400 * 1000, .index = 1125 * 1000},
2044 {.frequency = CPUFREQ_TABLE_END},
2047 #define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
2048 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
2049 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
2051 void __init board_clock_init(void)
2053 rk30_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
2054 dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
2055 dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
2056 dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
2059 MACHINE_START(RK30, "RK30board")
2060 .boot_params = PLAT_PHYS_OFFSET + 0x800,
2061 .fixup = rk30_fixup,
2062 .reserve = &rk30_reserve,
2063 .map_io = rk30_map_io,
2064 .init_irq = rk30_init_irq,
2065 .timer = &rk30_timer,
2066 .init_machine = machine_rk30_board_init,