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 #if defined(CONFIG_HDMI_RK30)
46 #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
49 #if defined(CONFIG_SPIM_RK29)
50 #include "../../../drivers/spi/rk29_spim.h"
52 #if defined(CONFIG_ANDROID_TIMED_GPIO)
53 #include "../../../drivers/staging/android/timed_gpio.h"
56 #ifdef CONFIG_THREE_FB_BUFFER
57 #define RK30_FB0_MEM_SIZE 12*SZ_1M
59 #define RK30_FB0_MEM_SIZE 8*SZ_1M
62 #ifdef CONFIG_VIDEO_RK29
63 /*---------------- Camera Sensor Macro Define Begin ------------------------*/
64 /*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
66 #define CONFIG_SENSOR_0 RK29_CAM_SENSOR_OV2655 /* back camera sensor */
67 #define CONFIG_SENSOR_IIC_ADDR_0 0x60
68 #define CONFIG_SENSOR_IIC_ADAPTER_ID_0 3
69 #define CONFIG_SENSOR_CIF_INDEX_0 0
70 #define CONFIG_SENSOR_ORIENTATION_0 90
71 #define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO
72 #define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
73 #define CONFIG_SENSOR_POWERDN_PIN_0 RK30_PIN1_PB6
74 #define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
75 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
76 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
77 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
78 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
80 #define CONFIG_SENSOR_QCIF_FPS_FIXED_0 12504
81 #define CONFIG_SENSOR_240X160_FPS_FIXED_0 12504
82 #define CONFIG_SENSOR_QVGA_FPS_FIXED_0 12504
83 #define CONFIG_SENSOR_CIF_FPS_FIXED_0 12504
84 #define CONFIG_SENSOR_VGA_FPS_FIXED_0 12504
85 #define CONFIG_SENSOR_480P_FPS_FIXED_0 12504
86 #define CONFIG_SENSOR_SVGA_FPS_FIXED_0 12504
87 #define CONFIG_SENSOR_720P_FPS_FIXED_0 12504
89 #define CONFIG_SENSOR_01 RK29_CAM_SENSOR_OV5642 /* back camera sensor 1 */
90 #define CONFIG_SENSOR_IIC_ADDR_01 0x00
91 #define CONFIG_SENSOR_CIF_INDEX_01 1
92 #define CONFIG_SENSOR_IIC_ADAPTER_ID_01 4
93 #define CONFIG_SENSOR_ORIENTATION_01 90
94 #define CONFIG_SENSOR_POWER_PIN_01 INVALID_GPIO
95 #define CONFIG_SENSOR_RESET_PIN_01 INVALID_GPIO
96 #define CONFIG_SENSOR_POWERDN_PIN_01 INVALID_GPIO
97 #define CONFIG_SENSOR_FALSH_PIN_01 INVALID_GPIO
98 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_01 RK29_CAM_POWERACTIVE_L
99 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_01 RK29_CAM_RESETACTIVE_L
100 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_01 RK29_CAM_POWERDNACTIVE_H
101 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_01 RK29_CAM_FLASHACTIVE_L
103 #define CONFIG_SENSOR_QCIF_FPS_FIXED_01 12504
104 #define CONFIG_SENSOR_240X160_FPS_FIXED_01 12504
105 #define CONFIG_SENSOR_QVGA_FPS_FIXED_01 12504
106 #define CONFIG_SENSOR_CIF_FPS_FIXED_01 12504
107 #define CONFIG_SENSOR_VGA_FPS_FIXED_01 12504
108 #define CONFIG_SENSOR_480P_FPS_FIXED_01 12504
109 #define CONFIG_SENSOR_SVGA_FPS_FIXED_01 12504
110 #define CONFIG_SENSOR_720P_FPS_FIXED_01 12504
112 #define CONFIG_SENSOR_02 RK29_CAM_SENSOR_OV5640 /* back camera sensor 2 */
113 #define CONFIG_SENSOR_IIC_ADDR_02 0x00
114 #define CONFIG_SENSOR_CIF_INDEX_02 1
115 #define CONFIG_SENSOR_IIC_ADAPTER_ID_02 4
116 #define CONFIG_SENSOR_ORIENTATION_02 90
117 #define CONFIG_SENSOR_POWER_PIN_02 INVALID_GPIO
118 #define CONFIG_SENSOR_RESET_PIN_02 INVALID_GPIO
119 #define CONFIG_SENSOR_POWERDN_PIN_02 INVALID_GPIO
120 #define CONFIG_SENSOR_FALSH_PIN_02 INVALID_GPIO
121 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_02 RK29_CAM_POWERACTIVE_L
122 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_02 RK29_CAM_RESETACTIVE_L
123 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_02 RK29_CAM_POWERDNACTIVE_H
124 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_02 RK29_CAM_FLASHACTIVE_L
126 #define CONFIG_SENSOR_QCIF_FPS_FIXED_02 12504
127 #define CONFIG_SENSOR_240X160_FPS_FIXED_02 12504
128 #define CONFIG_SENSOR_QVGA_FPS_FIXED_02 12504
129 #define CONFIG_SENSOR_CIF_FPS_FIXED_02 12504
130 #define CONFIG_SENSOR_VGA_FPS_FIXED_02 12504
131 #define CONFIG_SENSOR_480P_FPS_FIXED_02 12504
132 #define CONFIG_SENSOR_SVGA_FPS_FIXED_02 12504
133 #define CONFIG_SENSOR_720P_FPS_FIXED_02 12504
135 #define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV2655 /* front camera sensor 0 */
136 #define CONFIG_SENSOR_IIC_ADDR_1 0x60
137 #define CONFIG_SENSOR_IIC_ADAPTER_ID_1 3
138 #define CONFIG_SENSOR_CIF_INDEX_1 0
139 #define CONFIG_SENSOR_ORIENTATION_1 270
140 #define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
141 #define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
142 #define CONFIG_SENSOR_POWERDN_PIN_1 RK30_PIN1_PB7
143 #define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
144 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
145 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
146 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
147 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
149 #define CONFIG_SENSOR_QCIF_FPS_FIXED_1 12504
150 #define CONFIG_SENSOR_240X160_FPS_FIXED_1 12504
151 #define CONFIG_SENSOR_QVGA_FPS_FIXED_1 12504
152 #define CONFIG_SENSOR_CIF_FPS_FIXED_1 12504
153 #define CONFIG_SENSOR_VGA_FPS_FIXED_1 12504
154 #define CONFIG_SENSOR_480P_FPS_FIXED_1 12504
155 #define CONFIG_SENSOR_SVGA_FPS_FIXED_1 12504
156 #define CONFIG_SENSOR_720P_FPS_FIXED_1 12504
158 #define CONFIG_SENSOR_11 RK29_CAM_SENSOR_OV2659 /* front camera sensor 1 */
159 #define CONFIG_SENSOR_IIC_ADDR_11 0x00
160 #define CONFIG_SENSOR_IIC_ADAPTER_ID_11 3
161 #define CONFIG_SENSOR_CIF_INDEX_11 0
162 #define CONFIG_SENSOR_ORIENTATION_11 270
163 #define CONFIG_SENSOR_POWER_PIN_11 INVALID_GPIO
164 #define CONFIG_SENSOR_RESET_PIN_11 INVALID_GPIO
165 #define CONFIG_SENSOR_POWERDN_PIN_11 INVALID_GPIO
166 #define CONFIG_SENSOR_FALSH_PIN_11 INVALID_GPIO
167 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_11 RK29_CAM_POWERACTIVE_L
168 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_11 RK29_CAM_RESETACTIVE_L
169 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_11 RK29_CAM_POWERDNACTIVE_H
170 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_11 RK29_CAM_FLASHACTIVE_L
172 #define CONFIG_SENSOR_QCIF_FPS_FIXED_11 12504
173 #define CONFIG_SENSOR_240X160_FPS_FIXED_11 12504
174 #define CONFIG_SENSOR_QVGA_FPS_FIXED_11 12500
175 #define CONFIG_SENSOR_CIF_FPS_FIXED_11 12504
176 #define CONFIG_SENSOR_VGA_FPS_FIXED_11 12504
177 #define CONFIG_SENSOR_480P_FPS_FIXED_11 12504
178 #define CONFIG_SENSOR_SVGA_FPS_FIXED_11 12504
179 #define CONFIG_SENSOR_720P_FPS_FIXED_11 12504
181 #define CONFIG_SENSOR_12 RK29_CAM_SENSOR_OV2655 /* front camera sensor 2 */
182 #define CONFIG_SENSOR_IIC_ADDR_12 0x00
183 #define CONFIG_SENSOR_IIC_ADAPTER_ID_12 3
184 #define CONFIG_SENSOR_CIF_INDEX_12 0
185 #define CONFIG_SENSOR_ORIENTATION_12 270
186 #define CONFIG_SENSOR_POWER_PIN_12 INVALID_GPIO
187 #define CONFIG_SENSOR_RESET_PIN_12 INVALID_GPIO
188 #define CONFIG_SENSOR_POWERDN_PIN_12 INVALID_GPIO
189 #define CONFIG_SENSOR_FALSH_PIN_12 INVALID_GPIO
190 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_12 RK29_CAM_POWERACTIVE_L
191 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_12 RK29_CAM_RESETACTIVE_L
192 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_12 RK29_CAM_POWERDNACTIVE_H
193 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_12 RK29_CAM_FLASHACTIVE_L
195 #define CONFIG_SENSOR_QCIF_FPS_FIXED_12 12504
196 #define CONFIG_SENSOR_240X160_FPS_FIXED_12 12504
197 #define CONFIG_SENSOR_QVGA_FPS_FIXED_12 12504
198 #define CONFIG_SENSOR_CIF_FPS_FIXED_12 12504
199 #define CONFIG_SENSOR_VGA_FPS_FIXED_12 12504
200 #define CONFIG_SENSOR_480P_FPS_FIXED_12 12504
201 #define CONFIG_SENSOR_SVGA_FPS_FIXED_12 12504
202 #define CONFIG_SENSOR_720P_FPS_FIXED_12 12504
204 #endif //#ifdef CONFIG_VIDEO_RK29
205 /*---------------- Camera Sensor Configuration Macro End------------------------*/
206 #include "../../../drivers/media/video/rk30_camera.c"
207 /*---------------- Camera Sensor Macro Define End ---------*/
209 #define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
210 /*****************************************************************************************
212 * author: ddl@rock-chips.com
213 *****************************************************************************************/
214 #ifdef CONFIG_VIDEO_RK29
215 #define CONFIG_SENSOR_POWER_IOCTL_USR 0
216 #define CONFIG_SENSOR_RESET_IOCTL_USR 0
217 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
218 #define CONFIG_SENSOR_FLASH_IOCTL_USR 0
220 static void rk_cif_power(int on)
222 struct regulator *ldo_18,*ldo_28;
223 ldo_28 = regulator_get(NULL, "ldo7"); // vcc28_cif
224 ldo_18 = regulator_get(NULL, "ldo1"); // vcc18_cif
227 regulator_disable(ldo_28);
228 regulator_put(ldo_28);
229 regulator_disable(ldo_18);
230 regulator_put(ldo_18);
234 regulator_set_voltage(ldo_28, 2800000, 2800000);
235 regulator_enable(ldo_28);
236 // printk("%s set ldo7 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_28));
237 regulator_put(ldo_28);
239 regulator_set_voltage(ldo_18, 1800000, 1800000);
240 // regulator_set_suspend_voltage(ldo, 1800000);
241 regulator_enable(ldo_18);
242 // printk("%s set ldo1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo));
243 regulator_put(ldo_18);
247 #if CONFIG_SENSOR_POWER_IOCTL_USR
248 static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
250 //#error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
255 #if CONFIG_SENSOR_RESET_IOCTL_USR
256 static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
258 #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
262 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
263 static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
265 #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
269 #if CONFIG_SENSOR_FLASH_IOCTL_USR
270 static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
272 #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
276 static struct rk29camera_platform_ioctl_cb sensor_ioctl_cb = {
277 #if CONFIG_SENSOR_POWER_IOCTL_USR
278 .sensor_power_cb = sensor_power_usr_cb,
280 .sensor_power_cb = NULL,
283 #if CONFIG_SENSOR_RESET_IOCTL_USR
284 .sensor_reset_cb = sensor_reset_usr_cb,
286 .sensor_reset_cb = NULL,
289 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
290 .sensor_powerdown_cb = sensor_powerdown_usr_cb,
292 .sensor_powerdown_cb = NULL,
295 #if CONFIG_SENSOR_FLASH_IOCTL_USR
296 .sensor_flash_cb = sensor_flash_usr_cb,
298 .sensor_flash_cb = NULL,
302 #if CONFIG_SENSOR_IIC_ADDR_0
303 static struct reginfo_t rk_init_data_sensor_reg_0[] =
307 static struct reginfo_t rk_init_data_sensor_winseqreg_0[] ={
312 #if CONFIG_SENSOR_IIC_ADDR_1
313 static struct reginfo_t rk_init_data_sensor_reg_1[] =
317 static struct reginfo_t rk_init_data_sensor_winseqreg_1[] =
322 #if CONFIG_SENSOR_IIC_ADDR_01
323 static struct reginfo_t rk_init_data_sensor_reg_01[] =
327 static struct reginfo_t rk_init_data_sensor_winseqreg_01[] =
332 #if CONFIG_SENSOR_IIC_ADDR_02
333 static struct reginfo_t rk_init_data_sensor_reg_02[] =
337 static struct reginfo_t rk_init_data_sensor_winseqreg_02[] =
342 #if CONFIG_SENSOR_IIC_ADDR_11
343 static struct reginfo_t rk_init_data_sensor_reg_11[] =
347 static struct reginfo_t rk_init_data_sensor_winseqreg_11[] =
352 #if CONFIG_SENSOR_IIC_ADDR_12
353 static struct reginfo_t rk_init_data_sensor_reg_12[] =
357 static struct reginfo_t rk_init_data_sensor_winseqreg_12[] =
362 static rk_sensor_user_init_data_s rk_init_data_sensor[RK_CAM_NUM] =
364 #if CONFIG_SENSOR_IIC_ADDR_0
366 .rk_sensor_init_width = INVALID_VALUE,
367 .rk_sensor_init_height = INVALID_VALUE,
368 .rk_sensor_init_bus_param = INVALID_VALUE,
369 .rk_sensor_init_pixelcode = INVALID_VALUE,
370 .rk_sensor_init_data = rk_init_data_sensor_reg_0,
371 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_0,
372 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_0) / sizeof(struct reginfo_t),
373 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_0) / sizeof(struct reginfo_t),
377 .rk_sensor_init_width = INVALID_VALUE,
378 .rk_sensor_init_height = INVALID_VALUE,
379 .rk_sensor_init_bus_param = INVALID_VALUE,
380 .rk_sensor_init_pixelcode = INVALID_VALUE,
381 .rk_sensor_init_data = NULL,
382 .rk_sensor_init_winseq = NULL,
383 .rk_sensor_winseq_size = 0,
384 .rk_sensor_init_data_size = 0,
387 #if CONFIG_SENSOR_IIC_ADDR_1
389 .rk_sensor_init_width = INVALID_VALUE,
390 .rk_sensor_init_height = INVALID_VALUE,
391 .rk_sensor_init_bus_param = INVALID_VALUE,
392 .rk_sensor_init_pixelcode = INVALID_VALUE,
393 .rk_sensor_init_data = rk_init_data_sensor_reg_1,
394 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_1,
395 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_1) / sizeof(struct reginfo_t),
396 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_1) / sizeof(struct reginfo_t),
400 .rk_sensor_init_width = INVALID_VALUE,
401 .rk_sensor_init_height = INVALID_VALUE,
402 .rk_sensor_init_bus_param = INVALID_VALUE,
403 .rk_sensor_init_pixelcode = INVALID_VALUE,
404 .rk_sensor_init_data = NULL,
405 .rk_sensor_init_winseq = NULL,
406 .rk_sensor_winseq_size = 0,
407 .rk_sensor_init_data_size = 0,
410 #if CONFIG_SENSOR_IIC_ADDR_01
412 .rk_sensor_init_width = INVALID_VALUE,
413 .rk_sensor_init_height = INVALID_VALUE,
414 .rk_sensor_init_bus_param = INVALID_VALUE,
415 .rk_sensor_init_pixelcode = INVALID_VALUE,
416 .rk_sensor_init_data = rk_init_data_sensor_reg_01,
417 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_01,
418 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_01) / sizeof(struct reginfo_t),
419 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_01) / sizeof(struct reginfo_t),
423 .rk_sensor_init_width = INVALID_VALUE,
424 .rk_sensor_init_height = INVALID_VALUE,
425 .rk_sensor_init_bus_param = INVALID_VALUE,
426 .rk_sensor_init_pixelcode = INVALID_VALUE,
427 .rk_sensor_init_data = NULL,
428 .rk_sensor_init_winseq = NULL,
429 .rk_sensor_winseq_size = 0,
430 .rk_sensor_init_data_size = 0,
433 #if CONFIG_SENSOR_IIC_ADDR_02
435 .rk_sensor_init_width = INVALID_VALUE,
436 .rk_sensor_init_height = INVALID_VALUE,
437 .rk_sensor_init_bus_param = INVALID_VALUE,
438 .rk_sensor_init_pixelcode = INVALID_VALUE,
439 .rk_sensor_init_data = rk_init_data_sensor_reg_02,
440 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_02,
441 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_02) / sizeof(struct reginfo_t),
442 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_02) / sizeof(struct reginfo_t),
446 .rk_sensor_init_width = INVALID_VALUE,
447 .rk_sensor_init_height = INVALID_VALUE,
448 .rk_sensor_init_bus_param = INVALID_VALUE,
449 .rk_sensor_init_pixelcode = INVALID_VALUE,
450 .rk_sensor_init_data = NULL,
451 .rk_sensor_init_winseq = NULL,
452 .rk_sensor_winseq_size = 0,
453 .rk_sensor_init_data_size = 0,
456 #if CONFIG_SENSOR_IIC_ADDR_11
458 .rk_sensor_init_width = INVALID_VALUE,
459 .rk_sensor_init_height = INVALID_VALUE,
460 .rk_sensor_init_bus_param = INVALID_VALUE,
461 .rk_sensor_init_pixelcode = INVALID_VALUE,
462 .rk_sensor_init_data = rk_init_data_sensor_reg_11,
463 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_11,
464 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_11) / sizeof(struct reginfo_t),
465 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_11) / sizeof(struct reginfo_t),
469 .rk_sensor_init_width = INVALID_VALUE,
470 .rk_sensor_init_height = INVALID_VALUE,
471 .rk_sensor_init_bus_param = INVALID_VALUE,
472 .rk_sensor_init_pixelcode = INVALID_VALUE,
473 .rk_sensor_init_data = NULL,
474 .rk_sensor_init_winseq = NULL,
475 .rk_sensor_winseq_size = 0,
476 .rk_sensor_init_data_size = 0,
479 #if CONFIG_SENSOR_IIC_ADDR_12
481 .rk_sensor_init_width = INVALID_VALUE,
482 .rk_sensor_init_height = INVALID_VALUE,
483 .rk_sensor_init_bus_param = INVALID_VALUE,
484 .rk_sensor_init_pixelcode = INVALID_VALUE,
485 .rk_sensor_init_data = rk_init_data_sensor_reg_12,
486 .rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_12,
487 .rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_12) / sizeof(struct reginfo_t),
488 .rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_12) / sizeof(struct reginfo_t),
492 .rk_sensor_init_width = INVALID_VALUE,
493 .rk_sensor_init_height = INVALID_VALUE,
494 .rk_sensor_init_bus_param = INVALID_VALUE,
495 .rk_sensor_init_pixelcode = INVALID_VALUE,
496 .rk_sensor_init_data = NULL,
497 .rk_sensor_init_winseq = NULL,
498 .rk_sensor_winseq_size = 0,
499 .rk_sensor_init_data_size = 0,
504 #include "../../../drivers/media/video/rk30_camera.c"
506 #endif /* CONFIG_VIDEO_RK29 */
508 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
509 #define TOUCH_RESET_PIN RK30_PIN4_PD0
510 #define TOUCH_PWR_PIN INVALID_GPIO
511 int goodix_init_platform_hw(void)
515 rk30_mux_api_set(GPIO4D0_SMCDATA8_TRACEDATA8_NAME, GPIO4D_GPIO4D0);
516 rk30_mux_api_set(GPIO4C2_SMCDATA2_TRACEDATA2_NAME, GPIO4C_GPIO4C2);
517 printk("%s:0x%x,0x%x\n",__func__,rk30_mux_api_get(GPIO4D0_SMCDATA8_TRACEDATA8_NAME),rk30_mux_api_get(GPIO4C2_SMCDATA2_TRACEDATA2_NAME));
519 if (TOUCH_PWR_PIN != INVALID_GPIO) {
520 ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin");
522 gpio_free(TOUCH_PWR_PIN);
523 printk("goodix power error\n");
526 gpio_direction_output(TOUCH_PWR_PIN, 0);
527 gpio_set_value(TOUCH_PWR_PIN, GPIO_LOW);
531 if (TOUCH_RESET_PIN != INVALID_GPIO) {
532 ret = gpio_request(TOUCH_RESET_PIN, "goodix reset pin");
534 gpio_free(TOUCH_RESET_PIN);
535 printk("goodix gpio_request error\n");
538 gpio_direction_output(TOUCH_RESET_PIN, 1);
540 //gpio_set_value(TOUCH_RESET_PIN, GPIO_LOW);
542 //gpio_set_value(TOUCH_RESET_PIN, GPIO_HIGH);
548 struct goodix_platform_data goodix_info = {
550 .irq_pin = RK30_PIN4_PC2,
551 .rest_pin = TOUCH_RESET_PIN,
552 .init_platform_hw = goodix_init_platform_hw,
556 static struct spi_board_info board_spi_devices[] = {
559 /***********************************************************
561 ************************************************************/
562 #ifdef CONFIG_BACKLIGHT_RK29_BL
564 #define PWM_MUX_NAME GPIO0A3_PWM0_NAME
565 #define PWM_MUX_MODE GPIO0A_PWM0
566 #define PWM_MUX_MODE_GPIO GPIO0A_GPIO0A3
567 #define PWM_GPIO RK30_PIN0_PA3
568 #define PWM_EFFECT_VALUE 1
570 #define LCD_DISP_ON_PIN
572 #ifdef LCD_DISP_ON_PIN
573 //#define BL_EN_MUX_NAME GPIOF34_UART3_SEL_NAME
574 //#define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
576 #define BL_EN_PIN RK30_PIN6_PB3
577 #define BL_EN_VALUE GPIO_HIGH
579 static int rk29_backlight_io_init(void)
582 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
583 #ifdef LCD_DISP_ON_PIN
584 // rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
586 ret = gpio_request(BL_EN_PIN, NULL);
588 gpio_free(BL_EN_PIN);
591 gpio_direction_output(BL_EN_PIN, BL_EN_VALUE);
592 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
597 static int rk29_backlight_io_deinit(void)
600 #ifdef LCD_DISP_ON_PIN
601 gpio_free(BL_EN_PIN);
603 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
605 if (ret = gpio_request(PWM_GPIO, NULL)) {
606 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
609 gpio_direction_output(PWM_GPIO, !BL_EN_VALUE);
610 gpio_set_value(PWM_GPIO,!BL_EN_VALUE);
614 static int rk29_backlight_pwm_suspend(void)
617 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
618 if (gpio_request(PWM_GPIO, NULL)) {
619 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
622 gpio_direction_output(PWM_GPIO, GPIO_LOW);
623 #ifdef LCD_DISP_ON_PIN
624 gpio_direction_output(BL_EN_PIN, 0);
625 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
630 static int rk29_backlight_pwm_resume(void)
633 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
634 #ifdef LCD_DISP_ON_PIN
636 gpio_direction_output(BL_EN_PIN, 1);
637 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
642 static struct rk29_bl_info rk29_bl_info = {
644 .bl_ref = PWM_EFFECT_VALUE,
645 .io_init = rk29_backlight_io_init,
646 .io_deinit = rk29_backlight_io_deinit,
647 .pwm_suspend = rk29_backlight_pwm_suspend,
648 .pwm_resume = rk29_backlight_pwm_resume,
649 .min_brightness = 60,
653 static struct platform_device rk29_device_backlight = {
654 .name = "rk29_backlight",
657 .platform_data = &rk29_bl_info,
663 #ifdef CONFIG_RK29_SUPPORT_MODEM
665 #define RK30_MODEM_POWER RK30_PIN4_PD1
666 #define RK30_MODEM_POWER_IOMUX rk29_mux_api_set(GPIO4D1_SMCDATA9_TRACEDATA9_NAME, GPIO4D_GPIO4D1)
668 static int rk30_modem_io_init(void)
670 printk("%s\n", __FUNCTION__);
671 RK30_MODEM_POWER_IOMUX;
676 static struct rk29_io_t rk30_modem_io = {
677 .io_addr = RK30_MODEM_POWER,
680 .io_init = rk30_modem_io_init,
683 static struct platform_device rk30_device_modem = {
684 .name = "rk30_modem",
687 .platform_data = &rk30_modem_io,
693 #if defined (CONFIG_GS_MMA8452)
694 #define MMA8452_INT_PIN RK30_PIN4_PC0
696 static int mma8452_init_platform_hw(void)
698 rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
703 static struct gsensor_platform_data mma8452_info = {
707 .init_platform_hw = mma8452_init_platform_hw,
708 .orientation ={1, 0, 0, 0, 0, -1, 0, -1, 0},
711 #if defined (CONFIG_COMPASS_AK8975)
712 static struct akm8975_platform_data akm8975_info =
744 #if defined(CONFIG_GYRO_L3G4200D)
746 #include <linux/l3g4200d.h>
747 #define L3G4200D_INT_PIN RK30_PIN4_PC3
749 static int l3g4200d_init_platform_hw(void)
751 rk30_mux_api_set(GPIO4C3_SMCDATA3_TRACEDATA3_NAME, GPIO4C_GPIO4C3);
756 static struct l3g4200d_platform_data l3g4200d_info = {
757 .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
758 .init = l3g4200d_init_platform_hw,
759 .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
766 #ifdef CONFIG_LS_CM3217
768 #define CM3217_POWER_PIN INVALID_GPIO
769 #define CM3217_IRQ_PIN INVALID_GPIO
770 static int cm3217_init_hw(void)
773 if (gpio_request(CM3217_POWER_PIN, NULL) != 0) {
774 gpio_free(CM3217_POWER_PIN);
775 printk("%s: request cm3217 power pin error\n", __func__);
778 gpio_pull_updown(CM3217_POWER_PIN, PullDisable);
780 if (gpio_request(CM3217_IRQ_PIN, NULL) != 0) {
781 gpio_free(CM3217_IRQ_PIN);
782 printk("%s: request cm3217 int pin error\n", __func__);
785 gpio_pull_updown(CM3217_IRQ_PIN, PullDisable);
790 static void cm3217_exit_hw(void)
793 gpio_free(CM3217_POWER_PIN);
794 gpio_free(CM3217_IRQ_PIN);
799 static struct cm3217_platform_data cm3217_info = {
800 .irq_pin = CM3217_IRQ_PIN,
801 .power_pin = CM3217_POWER_PIN,
802 .init_platform_hw = cm3217_init_hw,
803 .exit_platform_hw = cm3217_exit_hw,
807 #ifdef CONFIG_FB_ROCKCHIP
809 #define LCD_CS_MUX_NAME GPIO4C7_SMCDATA7_TRACEDATA7_NAME
810 #define LCD_CS_PIN RK30_PIN4_PC7
811 #define LCD_CS_VALUE GPIO_HIGH
812 #define LCD_EN_PIN RK30_PIN6_PB4
813 #define LCD_EN_VALUE GPIO_HIGH
815 static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
818 rk30_mux_api_set(LCD_CS_MUX_NAME, GPIO4C_GPIO4C7);
819 ret = gpio_request(LCD_CS_PIN, "lcd_CS");
821 gpio_free(LCD_CS_PIN);
822 printk(KERN_ERR "request lcd cs pin fail!\n");
824 gpio_direction_output(LCD_CS_PIN, LCD_CS_VALUE);
825 gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
827 ret = gpio_request(LCD_EN_PIN, "lcd_en");
830 gpio_free(LCD_EN_PIN);
831 printk(KERN_ERR "request lcd en pin fail!\n");
836 gpio_direction_output(LCD_EN_PIN, LCD_EN_VALUE);
837 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
841 static int rk_fb_io_disable(void)
843 gpio_set_value(LCD_EN_PIN, !LCD_EN_VALUE);
844 gpio_set_value(LCD_CS_PIN, !LCD_CS_VALUE);
847 static int rk_fb_io_enable(void)
849 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
850 gpio_set_value(LCD_CS_PIN, LCD_CS_VALUE);
854 #if defined(CONFIG_LCDC0_RK30)
855 struct rk29fb_info lcdc0_screen_info = {
856 .prop = PRMRY, //primary display device
857 .io_init = rk_fb_io_init,
858 .io_disable = rk_fb_io_disable,
859 .io_enable = rk_fb_io_enable,
860 .set_screen_info = set_lcd_info,
864 #if defined(CONFIG_LCDC1_RK30)
865 struct rk29fb_info lcdc1_screen_info = {
866 #if defined(CONFIG_HDMI_RK30)
867 .prop = EXTEND, //extend display device
869 .set_screen_info = hdmi_init_lcdc,
874 static struct resource resource_fb[] = {
878 .end = 0,//RK30_FB0_MEM_SIZE - 1,
879 .flags = IORESOURCE_MEM,
882 .name = "ipp buf", //for rotate
884 .end = 0,//RK30_FB0_MEM_SIZE - 1,
885 .flags = IORESOURCE_MEM,
890 .end = 0,//RK30_FB0_MEM_SIZE - 1,
891 .flags = IORESOURCE_MEM,
895 static struct platform_device device_fb = {
898 .num_resources = ARRAY_SIZE(resource_fb),
899 .resource = resource_fb,
903 #if defined(CONFIG_LCDC0_RK30)
904 static struct resource resource_lcdc0[] = {
907 .start = RK30_LCDC0_PHYS,
908 .end = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
909 .flags = IORESOURCE_MEM,
916 .flags = IORESOURCE_IRQ,
920 static struct platform_device device_lcdc0 = {
923 .num_resources = ARRAY_SIZE(resource_lcdc0),
924 .resource = resource_lcdc0,
926 .platform_data = &lcdc0_screen_info,
931 #if defined(CONFIG_LCDC1_RK30)
932 extern struct rk29fb_info lcdc1_screen_info;
933 static struct resource resource_lcdc1[] = {
936 .start = RK30_LCDC1_PHYS,
937 .end = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
938 .flags = IORESOURCE_MEM,
944 .flags = IORESOURCE_IRQ,
948 static struct platform_device device_lcdc1 = {
951 .num_resources = ARRAY_SIZE(resource_lcdc1),
952 .resource = resource_lcdc1,
954 .platform_data = &lcdc1_screen_info,
959 #ifdef CONFIG_ANDROID_TIMED_GPIO
960 static struct timed_gpio timed_gpios[] = {
963 .gpio = RK30_PIN0_PA4,
966 .adjust_time =20, //adjust for diff product
970 static struct timed_gpio_platform_data rk29_vibrator_info = {
972 .gpios = timed_gpios,
975 static struct platform_device rk29_device_vibrator = {
976 .name = "timed-gpio",
979 .platform_data = &rk29_vibrator_info,
985 #ifdef CONFIG_LEDS_GPIO_PLATFORM
986 static struct gpio_led rk29_leds[] = {
988 .name = "button-backlight",
989 .gpio = RK30_PIN4_PD7,
990 .default_trigger = "timer",
992 .retain_state_suspended = 0,
993 .default_state = LEDS_GPIO_DEFSTATE_OFF,
997 static struct gpio_led_platform_data rk29_leds_pdata = {
999 .num_leds = ARRAY_SIZE(rk29_leds),
1002 static struct platform_device rk29_device_gpio_leds = {
1003 .name = "leds-gpio",
1006 .platform_data = &rk29_leds_pdata,
1011 #ifdef CONFIG_RK_IRDA
1012 #define IRDA_IRQ_PIN RK30_PIN6_PA1
1014 static int irda_iomux_init(void)
1019 ret = gpio_request(IRDA_IRQ_PIN, NULL);
1021 gpio_free(IRDA_IRQ_PIN);
1022 printk(">>>>>> IRDA_IRQ_PIN gpio_request err \n ");
1024 gpio_pull_updown(IRDA_IRQ_PIN, PullDisable);
1025 gpio_direction_input(IRDA_IRQ_PIN);
1030 static int irda_iomux_deinit(void)
1032 gpio_free(IRDA_IRQ_PIN);
1036 static struct irda_info rk29_irda_info = {
1037 .intr_pin = IRDA_IRQ_PIN,
1038 .iomux_init = irda_iomux_init,
1039 .iomux_deinit = irda_iomux_deinit,
1040 //.irda_pwr_ctl = bu92747guw_power_ctl,
1043 static struct platform_device irda_device = {
1044 #ifdef CONFIG_RK_IRDA_NET
1047 .name = "bu92747_irda",
1051 .platform_data = &rk29_irda_info,
1057 #define ION_RESERVE_SIZE (80 * SZ_1M)
1058 static struct ion_platform_data rk30_ion_pdata = {
1062 .type = ION_HEAP_TYPE_CARVEOUT,
1063 .id = ION_NOR_HEAP_ID,
1065 .size = ION_RESERVE_SIZE,
1070 static struct platform_device device_ion = {
1071 .name = "ion-rockchip",
1074 .platform_data = &rk30_ion_pdata,
1079 /**************************************************************************************************
1080 * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
1081 **************************************************************************************************/
1082 #ifdef CONFIG_SDMMC_RK29
1083 #include "board-rk30-sdk-sdmmc.c"
1085 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1086 #define SDMMC0_WRITE_PROTECT_PIN RK30_PIN3_PB7 //According to your own project to set the value of write-protect-pin.
1089 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1090 #define SDMMC1_WRITE_PROTECT_PIN RK30_PIN3_PC7 //According to your own project to set the value of write-protect-pin.
1093 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK30_PIN6_PB2
1095 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
1097 #ifdef CONFIG_SDMMC0_RK29
1098 static int rk29_sdmmc0_cfg_gpio(void)
1100 #ifdef CONFIG_SDMMC_RK29_OLD
1101 rk30_mux_api_set(GPIO3B1_SDMMC0CMD_NAME, GPIO3B_SDMMC0_CMD);
1102 rk30_mux_api_set(GPIO3B0_SDMMC0CLKOUT_NAME, GPIO3B_SDMMC0_CLKOUT);
1103 rk30_mux_api_set(GPIO3B2_SDMMC0DATA0_NAME, GPIO3B_SDMMC0_DATA0);
1104 rk30_mux_api_set(GPIO3B3_SDMMC0DATA1_NAME, GPIO3B_SDMMC0_DATA1);
1105 rk30_mux_api_set(GPIO3B4_SDMMC0DATA2_NAME, GPIO3B_SDMMC0_DATA2);
1106 rk30_mux_api_set(GPIO3B5_SDMMC0DATA3_NAME, GPIO3B_SDMMC0_DATA3);
1108 rk30_mux_api_set(GPIO3B6_SDMMC0DETECTN_NAME, GPIO3B_GPIO3B6);
1110 rk30_mux_api_set(GPIO3A7_SDMMC0PWREN_NAME, GPIO3A_GPIO3A7);
1111 gpio_request(RK30_PIN3_PA7, "sdmmc-power");
1112 gpio_direction_output(RK30_PIN3_PA7, GPIO_LOW);
1115 rk29_sdmmc_set_iomux(0, 0xFFFF);
1117 rk30_mux_api_set(GPIO3B6_SDMMC0DETECTN_NAME, GPIO3B_SDMMC0_DETECT_N);
1119 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1120 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
1121 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
1129 #define CONFIG_SDMMC0_USE_DMA
1130 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
1132 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
1133 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
1134 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
1136 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1137 .io_init = rk29_sdmmc0_cfg_gpio,
1139 #if !defined(CONFIG_SDMMC_RK29_OLD)
1140 .set_iomux = rk29_sdmmc_set_iomux,
1143 .dma_name = "sd_mmc",
1144 #ifdef CONFIG_SDMMC0_USE_DMA
1149 .detect_irq = RK30_PIN3_PB6, // INVALID_GPIO
1150 .enable_sd_wakeup = 0,
1152 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1153 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
1155 .write_prt = INVALID_GPIO,
1158 #endif // CONFIG_SDMMC0_RK29
1160 #ifdef CONFIG_SND_SOC_RK610
1161 static int rk610_codec_io_init(void)
1164 //Must not gpio_request
1168 static struct rk610_codec_platform_data rk610_codec_pdata = {
1169 .spk_ctl_io = RK30_PIN4_PC6,
1170 .io_init = rk610_codec_io_init,
1174 #ifdef CONFIG_SDMMC1_RK29
1175 #define CONFIG_SDMMC1_USE_DMA
1176 static int rk29_sdmmc1_cfg_gpio(void)
1178 #if defined(CONFIG_SDMMC_RK29_OLD)
1179 rk30_mux_api_set(GPIO3C0_SMMC1CMD_NAME, GPIO3C_SMMC1_CMD);
1180 rk30_mux_api_set(GPIO3C5_SDMMC1CLKOUT_NAME, GPIO3C_SDMMC1_CLKOUT);
1181 rk30_mux_api_set(GPIO3C1_SDMMC1DATA0_NAME, GPIO3C_SDMMC1_DATA0);
1182 rk30_mux_api_set(GPIO3C2_SDMMC1DATA1_NAME, GPIO3C_SDMMC1_DATA1);
1183 rk30_mux_api_set(GPIO3C3_SDMMC1DATA2_NAME, GPIO3C_SDMMC1_DATA2);
1184 rk30_mux_api_set(GPIO3C4_SDMMC1DATA3_NAME, GPIO3C_SDMMC1_DATA3);
1185 //rk30_mux_api_set(GPIO3C6_SDMMC1DETECTN_NAME, GPIO3C_SDMMC1_DETECT_N);
1189 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1190 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
1191 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
1199 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
1201 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
1202 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
1205 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1206 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
1207 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1210 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1213 .io_init = rk29_sdmmc1_cfg_gpio,
1215 #if !defined(CONFIG_SDMMC_RK29_OLD)
1216 .set_iomux = rk29_sdmmc_set_iomux,
1220 #ifdef CONFIG_SDMMC1_USE_DMA
1226 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1227 #ifdef CONFIG_WIFI_CONTROL_FUNC
1228 .status = rk29sdk_wifi_status,
1229 .register_status_notify = rk29sdk_wifi_status_register,
1232 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
1235 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1236 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
1238 .write_prt = INVALID_GPIO,
1242 .detect_irq = INVALID_GPIO,
1243 .enable_sd_wakeup = 0,
1247 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
1249 /**************************************************************************************************
1250 * the end of setting for SDMMC devices
1251 **************************************************************************************************/
1253 /* bluetooth rfkill device */
1254 static struct platform_device rk29sdk_rfkill = {
1255 .name = "rk29sdk_rfkill",
1259 #ifdef CONFIG_BATTERY_RK30_ADC
1260 static struct rk30_adc_battery_platform_data rk30_adc_battery_platdata = {
1261 .dc_det_pin = RK30_PIN6_PA5,
1262 .batt_low_pin = RK30_PIN6_PA0,
1263 .charge_set_pin = INVALID_GPIO,
1264 .charge_ok_pin = RK30_PIN6_PA6,
1265 .dc_det_level = GPIO_LOW,
1266 .charge_ok_level = GPIO_HIGH,
1269 static struct platform_device rk30_device_adc_battery = {
1270 .name = "rk30-battery",
1273 .platform_data = &rk30_adc_battery_platdata,
1278 #ifdef CONFIG_RK29_VMAC
1279 #define PHY_PWR_EN_GPIO RK30_PIN1_PD6
1280 #include "board-rk30-sdk-vmac.c"
1283 static struct platform_device *devices[] __initdata = {
1284 #ifdef CONFIG_FB_ROCKCHIP
1287 #if defined(CONFIG_LCDC0_RK30)
1290 #if defined(CONFIG_LCDC1_RK30)
1294 #ifdef CONFIG_BACKLIGHT_RK29_BL
1295 &rk29_device_backlight,
1301 #ifdef CONFIG_ANDROID_TIMED_GPIO
1302 &rk29_device_vibrator,
1304 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1305 &rk29_device_gpio_leds,
1307 #ifdef CONFIG_RK_IRDA
1310 #ifdef CONFIG_WIFI_CONTROL_FUNC
1311 &rk29sdk_wifi_device,
1316 #ifdef CONFIG_RK29_SUPPORT_MODEM
1319 #ifdef CONFIG_BATTERY_RK30_ADC
1320 &rk30_device_adc_battery,
1325 #ifdef CONFIG_I2C0_RK30
1326 static struct i2c_board_info __initdata i2c0_info[] = {
1327 #if defined (CONFIG_GS_MMA8452)
1329 .type = "gs_mma8452",
1332 .irq = MMA8452_INT_PIN,
1333 .platform_data = &mma8452_info,
1336 #if defined (CONFIG_COMPASS_AK8975)
1341 .irq = RK30_PIN4_PC1,
1342 .platform_data = &akm8975_info,
1345 #if defined (CONFIG_GYRO_L3G4200D)
1347 .type = "l3g4200d_gryo",
1350 .irq = L3G4200D_INT_PIN,
1351 .platform_data = &l3g4200d_info,
1354 #if defined (CONFIG_SND_SOC_RK1000)
1356 .type = "rk1000_i2c_codec",
1361 .type = "rk1000_control",
1366 #if defined (CONFIG_SND_SOC_RT5631)
1374 #ifdef CONFIG_MFD_RK610
1376 .type = "rk610_ctl",
1380 #ifdef CONFIG_RK610_TVOUT
1382 .type = "rk610_tvout",
1387 #ifdef CONFIG_HDMI_RK610
1389 .type = "rk610_hdmi",
1392 .irq = RK29_PIN5_PA2,
1395 #ifdef CONFIG_SND_SOC_RK610
1396 {//RK610_CODEC addr from 0x60 to 0x80 (0x60~0x80)
1397 .type = "rk610_i2c_codec",
1400 .platform_data = &rk610_codec_pdata,
1408 #ifdef CONFIG_I2C1_RK30
1409 #include "board-rk30-ds1001b-wm8326.c"
1411 static struct i2c_board_info __initdata i2c1_info[] = {
1412 #if defined (CONFIG_MFD_WM831X_I2C)
1417 .irq = RK30_PIN6_PA4,
1418 .platform_data = &wm831x_platdata,
1424 #ifdef CONFIG_I2C2_RK30
1425 static struct i2c_board_info __initdata i2c2_info[] = {
1426 #if defined (CONFIG_TOUCHSCREEN_GT8XX)
1428 .type = "Goodix-TS",
1431 .irq = RK30_PIN4_PC2,
1432 .platform_data = &goodix_info,
1435 #if defined (CONFIG_LS_CM3217)
1437 .type = "lightsensor",
1440 .irq = CM3217_IRQ_PIN,
1441 .platform_data = &cm3217_info,
1447 #ifdef CONFIG_I2C3_RK30
1448 static struct i2c_board_info __initdata i2c3_info[] = {
1452 #ifdef CONFIG_I2C4_RK30
1453 static struct i2c_board_info __initdata i2c4_info[] = {
1457 #ifdef CONFIG_I2C_GPIO_RK30
1458 #define I2C_SDA_PIN INVALID_GPIO// RK30_PIN2_PD6 //set sda_pin here
1459 #define I2C_SCL_PIN INVALID_GPIO//RK30_PIN2_PD7 //set scl_pin here
1460 static int rk30_i2c_io_init(void)
1462 //set iomux (gpio) here
1463 //rk30_mux_api_set(GPIO2D7_I2C1SCL_NAME, GPIO2D_GPIO2D7);
1464 //rk30_mux_api_set(GPIO2D6_I2C1SDA_NAME, GPIO2D_GPIO2D6);
1468 struct i2c_gpio_platform_data default_i2c_gpio_data = {
1469 .sda_pin = I2C_SDA_PIN,
1470 .scl_pin = I2C_SCL_PIN,
1471 .udelay = 5, // clk = 500/udelay = 100Khz
1472 .timeout = 100,//msecs_to_jiffies(100),
1474 .io_init = rk30_i2c_io_init,
1476 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1480 static void __init rk30_i2c_register_board_info(void)
1482 #ifdef CONFIG_I2C0_RK30
1483 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1485 #ifdef CONFIG_I2C1_RK30
1486 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1488 #ifdef CONFIG_I2C2_RK30
1489 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1491 #ifdef CONFIG_I2C3_RK30
1492 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1494 #ifdef CONFIG_I2C4_RK30
1495 i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
1497 #ifdef CONFIG_I2C_GPIO_RK30
1498 i2c_register_board_info(5, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1503 static void dcr_en_low(void)
1506 ret=gpio_request(RK30_PIN4_PB7,"dcr_en");
1508 printk("dcr_en_low request io error");
1509 gpio_free(RK30_PIN4_PB7);
1512 gpio_direction_output(RK30_PIN4_PB7, GPIO_LOW);
1514 #define POWER_ON_PIN RK30_PIN6_PB0 //power_hold
1515 static void rk30_pm_power_off(void)
1517 printk(KERN_ERR "rk30_pm_power_off start...\n");
1518 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
1519 #if defined(CONFIG_MFD_WM831X)
1520 wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
1521 wm831x_device_shutdown(Wm831x);//wm8326 shutdown
1525 static void __init machine_rk30_board_init(void)
1528 gpio_request(POWER_ON_PIN, "poweronpin");
1529 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1531 pm_power_off = rk30_pm_power_off;
1533 rk30_i2c_register_board_info();
1534 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1535 platform_add_devices(devices, ARRAY_SIZE(devices));
1536 board_usb_detect_init(RK30_PIN6_PA3);
1538 #ifdef CONFIG_WIFI_CONTROL_FUNC
1539 rk29sdk_wifi_bt_gpio_control_init();
1544 static void __init rk30_reserve(void)
1547 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
1549 #ifdef CONFIG_FB_ROCKCHIP
1550 resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
1551 resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
1553 resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
1554 resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
1555 resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE);
1556 resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
1559 #ifdef CONFIG_VIDEO_RK29
1560 rk30_camera_request_reserve_mem();
1562 board_mem_reserved();
1566 * dvfs_cpu_logic_table: table for arm and logic dvfs
1567 * @frequency : arm frequency
1568 * @cpu_volt : arm voltage depend on frequency
1569 * @logic_volt : logic voltage arm requests depend on frequency
1570 * comments : min arm/logic voltage
1572 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
1573 {.frequency = 252 * 1000, .cpu_volt = 1050 * 1000, .logic_volt = 1050 * 1000},//0.975V/1.000V
1574 {.frequency = 504 * 1000, .cpu_volt = 1050 * 1000, .logic_volt = 1100 * 1000},//0.975V/1.000V
1575 {.frequency = 816 * 1000, .cpu_volt = 1100 * 1000, .logic_volt = 1150 * 1000},//1.000V/1.025V
1576 {.frequency = 1008 * 1000, .cpu_volt = 1100 * 1000, .logic_volt = 1150 * 1000},//1.025V/1.050V
1577 {.frequency = 1200 * 1000, .cpu_volt = 1175 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
1578 {.frequency = 1272 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000},//1.150V/1.100V
1579 {.frequency = 1416 * 1000, .cpu_volt = 1300 * 1000, .logic_volt = 1200 * 1000},//1.225V/1.100V
1580 {.frequency = 1512 * 1000, .cpu_volt = 1350 * 1000, .logic_volt = 1250 * 1000},//1.300V/1.150V
1581 {.frequency = 1608 * 1000, .cpu_volt = 1375 * 1000, .logic_volt = 1275 * 1000},//1.325V/1.175V
1582 {.frequency = CPUFREQ_TABLE_END},
1584 static struct cpufreq_frequency_table dvfs_gpu_table[] = {
1585 {.frequency = 266 * 1000, .index = 1050 * 1000},
1586 {.frequency = 400 * 1000, .index = 1275 * 1000},
1587 {.frequency = CPUFREQ_TABLE_END},
1590 static struct cpufreq_frequency_table dvfs_ddr_table[] = {
1591 {.frequency = 300 * 1000, .index = 1050 * 1000},
1592 {.frequency = 400 * 1000, .index = 1125 * 1000},
1593 {.frequency = CPUFREQ_TABLE_END},
1596 #define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
1597 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
1598 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
1600 void __init board_clock_init(void)
1602 rk30_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1603 dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1604 dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
1605 dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
1608 MACHINE_START(RK30, "RK30board")
1609 .boot_params = PLAT_PHYS_OFFSET + 0x800,
1610 .fixup = rk30_fixup,
1611 .reserve = &rk30_reserve,
1612 .map_io = rk30_map_io,
1613 .init_irq = rk30_init_irq,
1614 .timer = &rk30_timer,
1615 .init_machine = machine_rk30_board_init,