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>
43 #include <linux/mpu.h>
45 #include <linux/wimo.h>
47 #if defined(CONFIG_HDMI_RK30)
48 #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
51 #include <linux/regulator/fixed.h>
52 #include <linux/mfd/wm8994/pdata.h>
53 #include <linux/regulator/machine.h>
54 #include "../../../drivers/headset_observe/rk_headset.h"
55 #include <linux/regulator/rk29-pwm-regulator.h>
57 #if defined(CONFIG_SPIM_RK29)
58 #include "../../../drivers/spi/rk29_spim.h"
60 #if defined(CONFIG_ANDROID_TIMED_GPIO)
61 #include "../../../drivers/staging/android/timed_gpio.h"
63 #if defined(CONFIG_BACKLIGHT_AW9364)
64 #include "../../../drivers/video/backlight/aw9364_bl.h"
66 #if defined(CONFIG_RK29_SC8800)
67 #include "../../../drivers/tty/serial/sc8800.h"
69 #if defined(CONFIG_TDSC8800)
70 #include <linux/mtk23d.h>
72 #if defined(CONFIG_SMS_SPI_ROCKCHIP)
73 #include "../../../drivers/cmmb/siano/smsspiphy.h"
77 #define RK30_FB0_MEM_SIZE 8*SZ_1M
79 #ifdef CONFIG_VIDEO_RK29
80 /*---------------- Camera Sensor Macro Define Begin ------------------------*/
81 /*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
82 #define CONFIG_SENSOR_0 RK29_CAM_SENSOR_MT9T111 /* back camera sensor */
83 #define CONFIG_SENSOR_IIC_ADDR_0 0x78
84 #define CONFIG_SENSOR_IIC_ADAPTER_ID_0 4
85 #define CONFIG_SENSOR_CIF_INDEX_0 1
86 #define CONFIG_SENSOR_ORIENTATION_0 90
87 #define CONFIG_SENSOR_POWER_PIN_0 RK30_PIN4_PC6
88 #define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
89 #define CONFIG_SENSOR_POWERDN_PIN_0 RK30_PIN1_PD6
90 #define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
91 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_H
92 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
93 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
94 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_H
96 #define CONFIG_SENSOR_QCIF_FPS_FIXED_0 15000
97 #define CONFIG_SENSOR_240X160_FPS_FIXED_0 15000
98 #define CONFIG_SENSOR_QVGA_FPS_FIXED_0 15000
99 #define CONFIG_SENSOR_CIF_FPS_FIXED_0 15000
100 #define CONFIG_SENSOR_VGA_FPS_FIXED_0 15000
101 #define CONFIG_SENSOR_480P_FPS_FIXED_0 15000
102 #define CONFIG_SENSOR_SVGA_FPS_FIXED_0 15000
103 #define CONFIG_SENSOR_720P_FPS_FIXED_0 30000
105 #define CONFIG_SENSOR_01 RK29_CAM_SENSOR_OV5642 /* back camera sensor 1 */
106 #define CONFIG_SENSOR_IIC_ADDR_01 0x00
107 #define CONFIG_SENSOR_CIF_INDEX_01 1
108 #define CONFIG_SENSOR_IIC_ADAPTER_ID_01 4
109 #define CONFIG_SENSOR_ORIENTATION_01 90
110 #define CONFIG_SENSOR_POWER_PIN_01 INVALID_GPIO
111 #define CONFIG_SENSOR_RESET_PIN_01 INVALID_GPIO
112 #define CONFIG_SENSOR_POWERDN_PIN_01 RK30_PIN1_PD6
113 #define CONFIG_SENSOR_FALSH_PIN_01 INVALID_GPIO
114 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_01 RK29_CAM_POWERACTIVE_L
115 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_01 RK29_CAM_RESETACTIVE_L
116 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_01 RK29_CAM_POWERDNACTIVE_H
117 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_01 RK29_CAM_FLASHACTIVE_L
119 #define CONFIG_SENSOR_QCIF_FPS_FIXED_01 15000
120 #define CONFIG_SENSOR_240X160_FPS_FIXED_01 15000
121 #define CONFIG_SENSOR_QVGA_FPS_FIXED_01 15000
122 #define CONFIG_SENSOR_CIF_FPS_FIXED_01 15000
123 #define CONFIG_SENSOR_VGA_FPS_FIXED_01 15000
124 #define CONFIG_SENSOR_480P_FPS_FIXED_01 15000
125 #define CONFIG_SENSOR_SVGA_FPS_FIXED_01 15000
126 #define CONFIG_SENSOR_720P_FPS_FIXED_01 30000
128 #define CONFIG_SENSOR_02 RK29_CAM_SENSOR_OV5640 /* back camera sensor 2 */
129 #define CONFIG_SENSOR_IIC_ADDR_02 0x00
130 #define CONFIG_SENSOR_CIF_INDEX_02 1
131 #define CONFIG_SENSOR_IIC_ADAPTER_ID_02 4
132 #define CONFIG_SENSOR_ORIENTATION_02 90
133 #define CONFIG_SENSOR_POWER_PIN_02 INVALID_GPIO
134 #define CONFIG_SENSOR_RESET_PIN_02 INVALID_GPIO
135 #define CONFIG_SENSOR_POWERDN_PIN_02 RK30_PIN1_PD6
136 #define CONFIG_SENSOR_FALSH_PIN_02 INVALID_GPIO
137 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_02 RK29_CAM_POWERACTIVE_L
138 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_02 RK29_CAM_RESETACTIVE_L
139 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_02 RK29_CAM_POWERDNACTIVE_H
140 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_02 RK29_CAM_FLASHACTIVE_L
142 #define CONFIG_SENSOR_QCIF_FPS_FIXED_02 15000
143 #define CONFIG_SENSOR_240X160_FPS_FIXED_02 15000
144 #define CONFIG_SENSOR_QVGA_FPS_FIXED_02 15000
145 #define CONFIG_SENSOR_CIF_FPS_FIXED_02 15000
146 #define CONFIG_SENSOR_VGA_FPS_FIXED_02 15000
147 #define CONFIG_SENSOR_480P_FPS_FIXED_02 15000
148 #define CONFIG_SENSOR_SVGA_FPS_FIXED_02 15000
149 #define CONFIG_SENSOR_720P_FPS_FIXED_02 30000
151 #define CONFIG_SENSOR_1 RK29_CAM_SENSOR_GC0309 /* front camera sensor 0 */
152 #define CONFIG_SENSOR_IIC_ADDR_1 0x42
153 #define CONFIG_SENSOR_IIC_ADAPTER_ID_1 3
154 #define CONFIG_SENSOR_CIF_INDEX_1 0
155 #define CONFIG_SENSOR_ORIENTATION_1 270
156 #define CONFIG_SENSOR_POWER_PIN_1 RK30_PIN4_PC6
157 #define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
158 #define CONFIG_SENSOR_POWERDN_PIN_1 RK30_PIN1_PB7
159 #define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
160 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_H
161 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
162 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
163 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
165 #define CONFIG_SENSOR_QCIF_FPS_FIXED_1 15000
166 #define CONFIG_SENSOR_240X160_FPS_FIXED_1 15000
167 #define CONFIG_SENSOR_QVGA_FPS_FIXED_1 15000
168 #define CONFIG_SENSOR_CIF_FPS_FIXED_1 15000
169 #define CONFIG_SENSOR_VGA_FPS_FIXED_1 15000
170 #define CONFIG_SENSOR_480P_FPS_FIXED_1 15000
171 #define CONFIG_SENSOR_SVGA_FPS_FIXED_1 15000
172 #define CONFIG_SENSOR_720P_FPS_FIXED_1 30000
174 #define CONFIG_SENSOR_11 RK29_CAM_SENSOR_OV2659 /* front camera sensor 1 */
175 #define CONFIG_SENSOR_IIC_ADDR_11 0x00
176 #define CONFIG_SENSOR_IIC_ADAPTER_ID_11 3
177 #define CONFIG_SENSOR_CIF_INDEX_1 0
178 #define CONFIG_SENSOR_ORIENTATION_11 270
179 #define CONFIG_SENSOR_POWER_PIN_11 INVALID_GPIO
180 #define CONFIG_SENSOR_RESET_PIN_11 INVALID_GPIO
181 #define CONFIG_SENSOR_POWERDN_PIN_11 RK30_PIN1_PB7
182 #define CONFIG_SENSOR_FALSH_PIN_11 INVALID_GPIO
183 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_11 RK29_CAM_POWERACTIVE_L
184 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_11 RK29_CAM_RESETACTIVE_L
185 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_11 RK29_CAM_POWERDNACTIVE_H
186 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_11 RK29_CAM_FLASHACTIVE_L
188 #define CONFIG_SENSOR_QCIF_FPS_FIXED_11 15000
189 #define CONFIG_SENSOR_240X160_FPS_FIXED_11 15000
190 #define CONFIG_SENSOR_QVGA_FPS_FIXED_11 15000
191 #define CONFIG_SENSOR_CIF_FPS_FIXED_11 15000
192 #define CONFIG_SENSOR_VGA_FPS_FIXED_11 15000
193 #define CONFIG_SENSOR_480P_FPS_FIXED_11 15000
194 #define CONFIG_SENSOR_SVGA_FPS_FIXED_11 15000
195 #define CONFIG_SENSOR_720P_FPS_FIXED_11 30000
197 #define CONFIG_SENSOR_12 RK29_CAM_SENSOR_OV2655 /* front camera sensor 2 */
198 #define CONFIG_SENSOR_IIC_ADDR_12 0x00
199 #define CONFIG_SENSOR_IIC_ADAPTER_ID_12 3
200 #define CONFIG_SENSOR_CIF_INDEX_1 0
201 #define CONFIG_SENSOR_ORIENTATION_12 270
202 #define CONFIG_SENSOR_POWER_PIN_12 INVALID_GPIO
203 #define CONFIG_SENSOR_RESET_PIN_12 INVALID_GPIO
204 #define CONFIG_SENSOR_POWERDN_PIN_12 RK30_PIN1_PB7
205 #define CONFIG_SENSOR_FALSH_PIN_12 INVALID_GPIO
206 #define CONFIG_SENSOR_POWERACTIVE_LEVEL_12 RK29_CAM_POWERACTIVE_L
207 #define CONFIG_SENSOR_RESETACTIVE_LEVEL_12 RK29_CAM_RESETACTIVE_L
208 #define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_12 RK29_CAM_POWERDNACTIVE_H
209 #define CONFIG_SENSOR_FLASHACTIVE_LEVEL_12 RK29_CAM_FLASHACTIVE_L
211 #define CONFIG_SENSOR_QCIF_FPS_FIXED_12 15000
212 #define CONFIG_SENSOR_240X160_FPS_FIXED_12 15000
213 #define CONFIG_SENSOR_QVGA_FPS_FIXED_12 15000
214 #define CONFIG_SENSOR_CIF_FPS_FIXED_12 15000
215 #define CONFIG_SENSOR_VGA_FPS_FIXED_12 15000
216 #define CONFIG_SENSOR_480P_FPS_FIXED_12 15000
217 #define CONFIG_SENSOR_SVGA_FPS_FIXED_12 15000
218 #define CONFIG_SENSOR_720P_FPS_FIXED_12 30000
221 #endif //#ifdef CONFIG_VIDEO_RK29
222 /*---------------- Camera Sensor Configuration Macro End------------------------*/
223 #include "../../../drivers/media/video/rk30_camera.c"
224 /*---------------- Camera Sensor Macro Define End ---------*/
226 #define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
227 /*****************************************************************************************
229 * author: ddl@rock-chips.com
230 *****************************************************************************************/
231 #ifdef CONFIG_VIDEO_RK29
232 #define CONFIG_SENSOR_POWER_IOCTL_USR 0
233 #define CONFIG_SENSOR_RESET_IOCTL_USR 0
234 #define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
235 #define CONFIG_SENSOR_FLASH_IOCTL_USR 0
237 #if CONFIG_SENSOR_POWER_IOCTL_USR
238 static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
240 #error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
244 #if CONFIG_SENSOR_RESET_IOCTL_USR
245 static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
247 #error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
251 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
252 static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
254 #error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
258 #if CONFIG_SENSOR_FLASH_IOCTL_USR
259 static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
261 #error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
265 static struct rk29camera_platform_ioctl_cb sensor_ioctl_cb = {
266 #if CONFIG_SENSOR_POWER_IOCTL_USR
267 .sensor_power_cb = sensor_power_usr_cb,
269 .sensor_power_cb = NULL,
272 #if CONFIG_SENSOR_RESET_IOCTL_USR
273 .sensor_reset_cb = sensor_reset_usr_cb,
275 .sensor_reset_cb = NULL,
278 #if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
279 .sensor_powerdown_cb = sensor_powerdown_usr_cb,
281 .sensor_powerdown_cb = NULL,
284 #if CONFIG_SENSOR_FLASH_IOCTL_USR
285 .sensor_flash_cb = sensor_flash_usr_cb,
287 .sensor_flash_cb = NULL,
291 #if CONFIG_SENSOR_IIC_ADDR_0
292 static struct reginfo_t rk_init_data_sensor_reg_0[] =
296 static struct reginfo_t rk_init_data_sensor_winseqreg_0[] ={
301 #if CONFIG_SENSOR_IIC_ADDR_1
302 static struct reginfo_t rk_init_data_sensor_reg_1[] =
306 static struct reginfo_t rk_init_data_sensor_winseqreg_1[] =
311 static rk_sensor_user_init_data_s rk_init_data_sensor[RK_CAM_NUM] =
314 .rk_sensor_init_width = INVALID_VALUE,
315 .rk_sensor_init_height = INVALID_VALUE,
316 .rk_sensor_init_bus_param = INVALID_VALUE,
317 .rk_sensor_init_pixelcode = INVALID_VALUE,
318 .rk_sensor_init_data = NULL,//rk_init_data_sensor_reg_0,
319 .rk_sensor_init_winseq = NULL,//rk_init_data_sensor_winseqreg_0,
320 .rk_sensor_winseq_size = 0,//sizeof(rk_init_data_sensor_winseqreg_0) / sizeof(struct reginfo_t),
322 .rk_sensor_init_width = INVALID_VALUE,
323 .rk_sensor_init_height = INVALID_VALUE,
324 .rk_sensor_init_bus_param = INVALID_VALUE,
325 .rk_sensor_init_pixelcode = INVALID_VALUE,
326 .rk_sensor_init_data = NULL,//rk_init_data_sensor_reg_1,
327 .rk_sensor_init_winseq = NULL,//rk_init_data_sensor_winseqreg_1,
328 .rk_sensor_winseq_size = 0,//sizeof(rk_init_data_sensor_winseqreg_1) / sizeof(struct reginfo_t),
332 #include "../../../drivers/media/video/rk30_camera.c"
334 #endif /* CONFIG_VIDEO_RK29 */
336 #if defined(CONFIG_TOUCHSCREEN_ILI2102_IIC)
337 #include "../../../drivers/input/touchscreen/ili2102_ts.h"
338 #define TOUCH_GPIO_INT RK30_PIN4_PC2
339 #define TOUCH_GPIO_RESET RK30_PIN4_PD0
340 static struct ili2102_platform_data ili2102_info = {
347 .gpio_reset = TOUCH_GPIO_RESET,
348 .gpio_reset_active_low = 1,
349 .gpio_pendown = TOUCH_GPIO_INT,
350 .pendown_iomux_name = GPIO4C2_SMCDATA2_TRACEDATA2_NAME,
351 .resetpin_iomux_name = GPIO4D0_SMCDATA8_TRACEDATA8_NAME,
352 .pendown_iomux_mode = GPIO4C_GPIO4C2,
353 .resetpin_iomux_mode = GPIO4D_GPIO4D0,
358 #if defined(CONFIG_TOUCHSCREEN_GT8XX)
359 #define TOUCH_RESET_PIN RK30_PIN4_PD0
360 #define TOUCH_PWR_PIN INVALID_GPIO
361 int goodix_init_platform_hw(void)
365 rk30_mux_api_set(GPIO4D0_SMCDATA8_TRACEDATA8_NAME, GPIO4D_GPIO4D0);
366 rk30_mux_api_set(GPIO4C2_SMCDATA2_TRACEDATA2_NAME, GPIO4C_GPIO4C2);
367 printk("%s:0x%x,0x%x\n",__func__,rk30_mux_api_get(GPIO4D0_SMCDATA8_TRACEDATA8_NAME),rk30_mux_api_get(GPIO4C2_SMCDATA2_TRACEDATA2_NAME));
369 if (TOUCH_PWR_PIN != INVALID_GPIO) {
370 ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin");
372 gpio_free(TOUCH_PWR_PIN);
373 printk("goodix power error\n");
376 gpio_direction_output(TOUCH_PWR_PIN, 0);
377 gpio_set_value(TOUCH_PWR_PIN, GPIO_LOW);
381 if (TOUCH_RESET_PIN != INVALID_GPIO) {
382 ret = gpio_request(TOUCH_RESET_PIN, "goodix reset pin");
384 gpio_free(TOUCH_RESET_PIN);
385 printk("goodix gpio_request error\n");
388 gpio_direction_output(TOUCH_RESET_PIN, 0);
389 gpio_set_value(TOUCH_RESET_PIN, GPIO_LOW);
391 gpio_set_value(TOUCH_RESET_PIN, GPIO_HIGH);
397 struct goodix_platform_data goodix_info = {
399 .irq_pin = RK30_PIN4_PC2,
400 .rest_pin = TOUCH_RESET_PIN,
401 .init_platform_hw = goodix_init_platform_hw,
405 #if defined(CONFIG_RK29_SC8800)
406 static int sc8800_io_init(void)
408 rk30_mux_api_set(GPIO2B5_LCDC1DATA13_SMCADDR17_HSADCDATA8_NAME, GPIO2B_GPIO2B5);
409 rk30_mux_api_set(GPIO2A2_LCDCDATA2_SMCADDR6_NAME, GPIO2A_GPIO2A2);
413 static int sc8800_io_deinit(void)
420 static struct plat_sc8800 sc8800_plat_data = {
421 .slav_rts_pin = RK30_PIN6_PA0,
422 .slav_rdy_pin = RK30_PIN2_PB5,
423 .master_rts_pin = RK30_PIN6_PA1,
424 .master_rdy_pin = RK30_PIN2_PA2,
426 .io_init = sc8800_io_init,
427 .io_deinit = sc8800_io_deinit,
430 static struct rk29xx_spi_chip sc8800_spi_chip = {
436 #if defined(CONFIG_SMS_SPI_ROCKCHIP)
437 #define CMMB_1186_SPIIRQ RK30_PIN4_PB7
438 #define CMMB_1186_RESET RK30_PIN0_PD5
440 void cmmb_io_init_mux(void)
442 // rk30_mux_api_set(GPIO1A4_UART1SIN_SPI0CSN0_NAME,GPIO1A_GPIO1A4);
445 void cmmb_io_set_for_pm(void)
447 printk("entering cmmb_io_set_for_pm\n");
448 rk30_mux_api_set(GPIO0D5_I2S22CHSDO_SMCADDR1_NAME,GPIO0D_GPIO0D5);
449 gpio_request(CMMB_1186_RESET, NULL);//cmmb reset pin
450 gpio_direction_output(CMMB_1186_RESET,0);
451 rk30_mux_api_set(GPIO1A4_UART1SIN_SPI0CSN0_NAME,GPIO1A_GPIO1A4);
452 gpio_request(RK30_PIN1_PA4, NULL);//cmmb cs pin
453 gpio_direction_input(RK30_PIN1_PA4);
454 gpio_pull_updown(RK30_PIN1_PA4, 0);
457 void cmmb_power_on_by_wm831x(void)
459 struct regulator *ldo;
461 printk("entering cmmb_power_on_by_wm831x\n");
463 rk29_mux_api_set(GPIO1A3_EMMCDETECTN_SPI1CS1_NAME,GPIO1L_SPI0_CSN1);
464 gpio_request(RK29_PIN6_PD2, NULL);
465 gpio_direction_output(RK29_PIN6_PD2,0);
468 ldo = regulator_get(NULL, "ldo8"); //cmmb
469 regulator_set_voltage(ldo,1200000,1200000);
470 regulator_set_suspend_voltage(ldo,1200000);
471 regulator_enable(ldo);
472 printk("%s set ldo8=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
475 ldo = regulator_get(NULL, "ldo9"); //cmmb
476 regulator_set_voltage(ldo,3000000,3000000);
477 regulator_set_suspend_voltage(ldo,3000000);
478 regulator_enable(ldo);
479 printk("%s set ldo9=%dmV end\n", __FUNCTION__, regulator_get_voltage(ldo));
483 gpio_direction_output(RK29_PIN6_PD2,1);
487 void cmmb_power_down_by_wm831x(void)
489 struct regulator* ldo;
491 printk("entering cmmb_power_down_by_wm831x\n");
493 ldo = regulator_get(NULL, "ldo8");
494 regulator_set_voltage(ldo,0,0);
495 regulator_disable(ldo);
498 ldo = regulator_get(NULL, "ldo9");
499 regulator_set_voltage(ldo,0,0);
500 regulator_disable(ldo);
505 static struct cmmb_io_def_s cmmb_io = {
506 .cmmb_pw_en = INVALID_GPIO,
507 .cmmb_pw_dwn = INVALID_GPIO,
508 .cmmb_pw_rst = CMMB_1186_RESET,
509 .cmmb_irq = CMMB_1186_SPIIRQ,
510 .io_init_mux = cmmb_io_init_mux,
511 .cmmb_io_pm = cmmb_io_set_for_pm,
512 .cmmb_power_on = cmmb_power_on_by_wm831x,
513 .cmmb_power_down = cmmb_power_down_by_wm831x
516 static struct rk29xx_spi_chip cmb_spi_chip = {
523 static struct spi_board_info board_spi_devices[] = {
524 #if defined(CONFIG_RK29_SC8800)
526 .modalias = "sc8800",
528 .platform_data = &sc8800_plat_data,
529 .max_speed_hz = 12*1000*1000,
531 .controller_data = &sc8800_spi_chip,
535 #if defined(CONFIG_SMS_SPI_ROCKCHIP)
537 .modalias = "siano1186",
539 .max_speed_hz = 12*1000*1000,
541 .irq =CMMB_1186_SPIIRQ,
542 .platform_data = &cmmb_io,
543 .controller_data = &cmb_spi_chip,
548 /*****************************************************************************************
550 * author: qjb@rock-chips.com
551 *****************************************************************************************/
552 #if defined(CONFIG_MFD_WM8994)
553 static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
554 REGULATOR_SUPPLY("DBVDD", "0-001a"),
555 REGULATOR_SUPPLY("AVDD2", "0-001a"),
556 REGULATOR_SUPPLY("CPVDD", "0-001a"),
559 static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = {
560 REGULATOR_SUPPLY("SPKVDD1", "0-001a"),
561 REGULATOR_SUPPLY("SPKVDD2", "0-001a"),
564 static struct regulator_init_data wm8994_fixed_voltage0_init_data = {
568 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies),
569 .consumer_supplies = wm8994_fixed_voltage0_supplies,
572 static struct regulator_init_data wm8994_fixed_voltage1_init_data = {
576 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies),
577 .consumer_supplies = wm8994_fixed_voltage1_supplies,
580 static struct fixed_voltage_config wm8994_fixed_voltage0_config = {
581 .supply_name = "VCC_1.8V_PDA",
582 .microvolts = 1800000,
584 .init_data = &wm8994_fixed_voltage0_init_data,
587 static struct fixed_voltage_config wm8994_fixed_voltage1_config = {
588 .supply_name = "V_BAT",
589 .microvolts = 3700000,
591 .init_data = &wm8994_fixed_voltage1_init_data,
594 static struct platform_device wm8994_fixed_voltage0 = {
595 .name = "reg-fixed-voltage",
598 .platform_data = &wm8994_fixed_voltage0_config,
602 static struct platform_device wm8994_fixed_voltage1 = {
603 .name = "reg-fixed-voltage",
606 .platform_data = &wm8994_fixed_voltage1_config,
610 static struct regulator_consumer_supply wm8994_avdd1_supply =
611 REGULATOR_SUPPLY("AVDD1", "0-001a");
613 static struct regulator_consumer_supply wm8994_dcvdd_supply =
614 REGULATOR_SUPPLY("DCVDD", "0-001a");
618 static struct regulator_init_data wm8994_ldo1_data = {
620 .name = "AVDD1_3.0V",
621 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
623 .num_consumer_supplies = 1,
624 .consumer_supplies = &wm8994_avdd1_supply,
627 static struct regulator_init_data wm8994_ldo2_data = {
629 .name = "DCVDD_1.0V",
631 .num_consumer_supplies = 1,
632 .consumer_supplies = &wm8994_dcvdd_supply,
635 static struct wm8994_pdata wm8994_platform_data = {
636 #if defined (CONFIG_GPIO_WM8994)
637 .gpio_base = WM8994_GPIO_EXPANDER_BASE,
638 //Fill value to initialize the GPIO
639 // .gpio_defaults ={},
640 /* configure gpio1 function: 0x0001(Logic level input/output) */
641 // .gpio_defaults[0] = 0x0001,
642 /* configure gpio3/4/5/7 function for AIF2 voice */
643 .gpio_defaults[2] = 0x2100,
644 .gpio_defaults[3] = 0x2100,
645 .gpio_defaults[4] = 0xA100,
646 // .gpio_defaults[6] = 0x0100,
647 /* configure gpio8/9/10/11 function for AIF3 BT */
648 .gpio_defaults[7] = 0xA100,
649 .gpio_defaults[8] = 0x2100,
650 .gpio_defaults[9] = 0x2100,
651 .gpio_defaults[10] = 0x2100,
654 .ldo[0] = { RK30_PIN3_PA6, NULL, &wm8994_ldo1_data,GPIO3A6_SDMMC0RSTNOUT_NAME, GPIO3A_GPIO3A6}, /* XM0FRNB_2 */
655 .ldo[1] = { 0, NULL, &wm8994_ldo2_data },
661 // .BB_input_diff = 1,
665 #ifdef CONFIG_RK_HEADSET_DET
666 #define HEADSET_GPIO RK29_PIN4_PD2
667 struct rk_headset_pdata rk_headset_info = {
668 .Headset_gpio = RK30_PIN6_PA5,
669 .headset_in_type= HEADSET_IN_HIGH,
670 .Hook_gpio = RK30_PIN1_PB2,//Detection Headset--Must be set
671 .hook_key_code = KEY_MEDIA,
674 struct platform_device rk_device_headset = {
675 .name = "rk_headsetdet",
678 .platform_data = &rk_headset_info,
683 #if CONFIG_RK30_PWM_REGULATOR
684 static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
686 .supply = "vdd_core",
690 static struct regulator_consumer_supply pwm_dcdc2_consumers[] = {
696 struct regulator_init_data pwm_regulator_init_dcdc[2] =
702 .max_uV = 1800000, //0.6-1.8V
704 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
706 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
707 .consumer_supplies = pwm_dcdc1_consumers,
713 .max_uV = 1800000, //0.6-1.8V
715 .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
717 .num_consumer_supplies = ARRAY_SIZE(pwm_dcdc2_consumers),
718 .consumer_supplies = pwm_dcdc2_consumers,
722 static struct pwm_platform_data pwm_regulator_info[2] = {
725 .pwm_gpio = RK30_PIN0_PA3,
726 .pwm_iomux_name = GPIO0A3_PWM0_NAME,
727 .pwm_iomux_pwm = GPIO0A_PWM0,
728 .pwm_iomux_gpio = GPIO0A_GPIO0A3,
729 .pwm_voltage = 1100000,
730 .init_data = &pwm_regulator_init_dcdc[0],
734 .pwm_gpio = RK30_PIN0_PD6,
735 .pwm_iomux_name = GPIO0D6_PWM2_NAME,
736 .pwm_iomux_pwm = GPIO0D_PWM2,
737 .pwm_iomux_gpio = GPIO0D_GPIO0D6,
738 .pwm_voltage = 1100000,
739 .init_data = &pwm_regulator_init_dcdc[1],
745 struct platform_device pwm_regulator_device[2] = {
747 .name = "pwm-voltage-regulator",
750 .platform_data = &pwm_regulator_info[0],
754 .name = "pwm-voltage-regulator",
757 .platform_data = &pwm_regulator_info[1],
766 /***********************************************************
768 ************************************************************/
769 #ifdef CONFIG_BACKLIGHT_AW9364
770 static int aw9364_backlight_io_init(void)
772 rk30_mux_api_set(GPIO4D2_SMCDATA10_TRACEDATA10_NAME, GPIO4D_GPIO4D2);
776 static int aw9364_backlight_io_deinit(void)
780 struct aw9364_platform_data aw9364_bl_info = {
781 .pin_en = RK30_PIN4_PD2,
782 .io_init = aw9364_backlight_io_init,
783 .io_deinit = aw9364_backlight_io_deinit,
786 struct platform_device aw9364_device_backlight = {
787 .name = "aw9364_backlight",
790 .platform_data = &aw9364_bl_info,
796 #ifdef CONFIG_BACKLIGHT_RK29_BL
798 #define PWM_MUX_NAME GPIO0A3_PWM0_NAME
799 #define PWM_MUX_MODE GPIO0A_PWM0
800 #define PWM_MUX_MODE_GPIO GPIO0A_GPIO0A3
801 #define PWM_GPIO RK30_PIN0_PA3
802 #define PWM_EFFECT_VALUE 1
804 #define LCD_DISP_ON_PIN
806 #ifdef LCD_DISP_ON_PIN
807 //#define BL_EN_MUX_NAME GPIOF34_UART3_SEL_NAME
808 //#define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
810 #define BL_EN_PIN RK30_PIN6_PB3
811 #define BL_EN_VALUE GPIO_HIGH
813 static int rk29_backlight_io_init(void)
816 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
817 #ifdef LCD_DISP_ON_PIN
818 // rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
820 ret = gpio_request(BL_EN_PIN, NULL);
822 gpio_free(BL_EN_PIN);
825 gpio_direction_output(BL_EN_PIN, 0);
826 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
831 static int rk29_backlight_io_deinit(void)
834 #ifdef LCD_DISP_ON_PIN
835 gpio_free(BL_EN_PIN);
837 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
841 static int rk29_backlight_pwm_suspend(void)
844 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
845 if (gpio_request(PWM_GPIO, NULL)) {
846 printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
849 gpio_direction_output(PWM_GPIO, GPIO_LOW);
850 #ifdef LCD_DISP_ON_PIN
851 gpio_direction_output(BL_EN_PIN, 0);
852 gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
857 static int rk29_backlight_pwm_resume(void)
860 rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
861 #ifdef LCD_DISP_ON_PIN
863 gpio_direction_output(BL_EN_PIN, 1);
864 gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
869 static struct rk29_bl_info rk29_bl_info = {
871 .bl_ref = PWM_EFFECT_VALUE,
872 .io_init = rk29_backlight_io_init,
873 .io_deinit = rk29_backlight_io_deinit,
874 .pwm_suspend = rk29_backlight_pwm_suspend,
875 .pwm_resume = rk29_backlight_pwm_resume,
878 static struct platform_device rk29_device_backlight = {
879 .name = "rk29_backlight",
882 .platform_data = &rk29_bl_info,
889 #if defined (CONFIG_GS_MMA8452)
890 #define MMA8452_INT_PIN RK30_PIN4_PC0
892 static int mma8452_init_platform_hw(void)
894 rk30_mux_api_set(GPIO4C0_SMCDATA0_TRACEDATA0_NAME, GPIO4C_GPIO4C0);
896 if (gpio_request(MMA8452_INT_PIN, NULL) != 0) {
897 gpio_free(MMA8452_INT_PIN);
898 printk("mma8452_init_platform_hw gpio_request error\n");
901 gpio_pull_updown(MMA8452_INT_PIN, 1);
905 static struct gsensor_platform_data mma8452_info = {
909 .init_platform_hw = mma8452_init_platform_hw,
910 .orientation = {0, -1, 0, 0, 0, -1, -1, 0, 0},
913 #if defined (CONFIG_COMPASS_AK8975)
914 static struct akm8975_platform_data akm8975_info =
947 #if defined (CONFIG_MPU_SENSORS_MPU3050)
948 static struct mpu_platform_data mpu3050_data = {
950 .orientation = { 1, 0, 0,0, 1, 0, 0, 0, 1 },
955 #if defined (CONFIG_MPU_SENSORS_MMA845X)
956 static struct ext_slave_platform_data inv_mpu_mma845x_data = {
957 .bus = EXT_SLAVE_BUS_SECONDARY,
959 .orientation = {1, 0, 0, 0, 1, 0, 0, 0, 1},
964 #if defined (CONFIG_MPU_SENSORS_AK8975)
965 static struct ext_slave_platform_data inv_mpu_ak8975_data = {
966 .bus = EXT_SLAVE_BUS_PRIMARY,
968 .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
973 #if defined(CONFIG_GYRO_L3G4200D)
975 #include <linux/l3g4200d.h>
976 #define L3G4200D_INT_PIN RK30_PIN4_PC3
978 static int l3g4200d_init_platform_hw(void)
980 if (gpio_request(L3G4200D_INT_PIN, NULL) != 0) {
981 gpio_free(L3G4200D_INT_PIN);
982 printk("%s: request l3g4200d int pin error\n", __func__);
985 gpio_pull_updown(L3G4200D_INT_PIN, 1);
989 static struct l3g4200d_platform_data l3g4200d_info = {
990 .orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
991 .init = l3g4200d_init_platform_hw,
992 .x_min = 40,//x_min,y_min,z_min = (0-100) according to hardware
1001 #ifdef CONFIG_LS_CM3217
1003 #define CM3217_POWER_PIN INVALID_GPIO
1004 #define CM3217_IRQ_PIN INVALID_GPIO
1005 static int cm3217_init_hw(void)
1008 if (gpio_request(CM3217_POWER_PIN, NULL) != 0) {
1009 gpio_free(CM3217_POWER_PIN);
1010 printk("%s: request cm3217 power pin error\n", __func__);
1013 gpio_pull_updown(CM3217_POWER_PIN, PullDisable);
1015 if (gpio_request(CM3217_IRQ_PIN, NULL) != 0) {
1016 gpio_free(CM3217_IRQ_PIN);
1017 printk("%s: request cm3217 int pin error\n", __func__);
1020 gpio_pull_updown(CM3217_IRQ_PIN, PullDisable);
1025 static void cm3217_exit_hw(void)
1028 gpio_free(CM3217_POWER_PIN);
1029 gpio_free(CM3217_IRQ_PIN);
1034 static struct cm3217_platform_data cm3217_info = {
1035 .irq_pin = CM3217_IRQ_PIN,
1036 .power_pin = CM3217_POWER_PIN,
1037 .init_platform_hw = cm3217_init_hw,
1038 .exit_platform_hw = cm3217_exit_hw,
1042 #ifdef CONFIG_FB_ROCKCHIP
1044 /*****************************************************************************************
1046 * author: zyw@rock-chips.com
1047 *****************************************************************************************/
1048 //#ifdef CONFIG_LCD_TD043MGEA1
1050 #define LCD_TXD_PIN RK30_PIN0_PB7
1051 #define LCD_CLK_PIN RK30_PIN0_PB6
1052 #define LCD_CS_PIN RK30_PIN0_PB5
1053 #define LCD_RST_PIN RK30_PIN4_PC7
1055 /*****************************************************************************************
1056 * frame buffer devices
1057 * author: zyw@rock-chips.com
1058 *****************************************************************************************/
1060 #define FB_DISPLAY_ON_PIN INVALID_GPIO//RK29_PIN6_PD0
1061 #define FB_LCD_STANDBY_PIN INVALID_GPIO//RK29_PIN6_PD1
1062 #define FB_LCD_CABC_EN_PIN INVALID_GPIO//RK29_PIN6_PD2
1063 #define FB_MCU_FMK_PIN INVALID_GPIO
1065 #define FB_DISPLAY_ON_VALUE GPIO_HIGH
1066 #define FB_LCD_STANDBY_VALUE GPIO_HIGH
1070 static int rk29_lcd_io_init(void)
1073 //printk("rk29_lcd_io_init\n");
1074 //ret = gpio_request(LCD_RXD_PIN, NULL);
1075 ret = gpio_request(LCD_TXD_PIN, NULL);
1076 ret = gpio_request(LCD_CLK_PIN, NULL);
1077 ret = gpio_request(LCD_CS_PIN, NULL);
1079 rk30_mux_api_set(GPIO0B7_I2S8CHSDO3_NAME, GPIO0B_GPIO0B7);
1080 rk30_mux_api_set(GPIO0B6_I2S8CHSDO2_NAME, GPIO0B_GPIO0B6);
1081 rk30_mux_api_set(GPIO0B5_I2S8CHSDO1_NAME, GPIO0B_GPIO0B5);
1084 gpio_request(LCD_RST_PIN, NULL);
1085 gpio_direction_output(LCD_RST_PIN, 1);
1086 gpio_direction_output(LCD_RST_PIN, 0);
1087 usleep_range(5*1000, 5*1000);
1088 gpio_set_value(LCD_RST_PIN, 1);
1089 usleep_range(50*1000, 50*1000);
1090 gpio_free(LCD_RST_PIN);
1095 #if defined (CONFIG_RK29_WORKING_POWER_MANAGEMENT)
1096 static int rk29_lcd_io_deinit(void)
1100 gpio_direction_output(LCD_TXD_PIN, 1);
1101 gpio_direction_output(LCD_CLK_PIN, 1);
1103 gpio_free(LCD_CS_PIN);
1104 gpio_free(LCD_CLK_PIN);
1105 gpio_free(LCD_TXD_PIN);
1110 static int rk29_lcd_io_deinit(void)
1113 //printk("rk29_lcd_io_deinit\n");
1114 gpio_free(LCD_CS_PIN);
1115 gpio_free(LCD_CLK_PIN);
1116 gpio_free(LCD_TXD_PIN);
1117 //gpio_free(LCD_RXD_PIN);
1119 //rk30_mux_api_set(GPIO0B7_I2S8CHSDO3_NAME, GPIO0B_GPIO0B7);
1120 //rk30_mux_api_set(GPIO0B6_I2S8CHSDO2_NAME, GPIO0B_GPIO0B6);
1121 //rk30_mux_api_set(GPIO0B5_I2S8CHSDO1_NAME, GPIO0B_GPIO0B5);
1128 static struct rk29lcd_info rk29_lcd_info = {
1129 .txd_pin = LCD_TXD_PIN,
1130 .clk_pin = LCD_CLK_PIN,
1131 .cs_pin = LCD_CS_PIN,
1132 .io_init = rk29_lcd_io_init,
1133 .io_deinit = rk29_lcd_io_deinit,
1138 #define LCD_EN_MUX_NAME GPIO4C7_SMCDATA7_TRACEDATA7_NAME
1139 #define LCD_EN_PIN RK30_PIN4_PC7
1140 #define LCD_EN_VALUE GPIO_HIGH
1142 static int rk_fb_io_init(void)
1145 rk30_mux_api_set(LCD_EN_MUX_NAME, GPIO4C_GPIO4C7);
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, 1);
1156 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
1160 static int rk_fb_io_disable(void)
1162 gpio_set_value(LCD_EN_PIN, ~LCD_EN_VALUE);
1165 static int rk_fb_io_enable(void)
1167 gpio_set_value(LCD_EN_PIN, LCD_EN_VALUE);
1172 #if defined(CONFIG_LCDC0_RK30)
1173 struct rk29fb_info lcdc0_screen_info = {
1176 .mcu_fmk_pin = FB_MCU_FMK_PIN,
1177 .lcd_info = &rk29_lcd_info,
1178 .io_init = rk_fb_io_init,
1179 .io_disable = rk_fb_io_disable,
1180 .io_enable = rk_fb_io_enable,
1181 .set_screen_info = set_lcd_info,
1184 #if defined(CONFIG_LCDC1_RK30)
1185 struct rk29fb_info lcdc1_screen_info = {
1186 #if defined(CONFIG_HDMI_RK30)
1189 .set_screen_info = hdmi_set_info,
1194 static struct resource resource_fb[] = {
1198 .end = 0,//RK30_FB0_MEM_SIZE - 1,
1199 .flags = IORESOURCE_MEM,
1202 .name = "ipp buf", //for rotate
1204 .end = 0,//RK30_FB0_MEM_SIZE - 1,
1205 .flags = IORESOURCE_MEM,
1210 .end = 0,//RK30_FB0_MEM_SIZE - 1,
1211 .flags = IORESOURCE_MEM,
1215 static struct platform_device device_fb = {
1218 .num_resources = ARRAY_SIZE(resource_fb),
1219 .resource = resource_fb,
1222 #ifdef CONFIG_FB_WIMO
1223 static struct wimo_platform_data wimo_pdata = {
1227 static struct platform_device wimo_device = {
1231 .platform_data = &wimo_pdata,
1237 #ifdef CONFIG_ANDROID_TIMED_GPIO
1238 static struct timed_gpio timed_gpios[] = {
1241 .gpio = RK30_PIN0_PA4,
1242 .max_timeout = 1000,
1244 .adjust_time =20, //adjust for diff product
1248 static struct timed_gpio_platform_data rk29_vibrator_info = {
1250 .gpios = timed_gpios,
1253 static struct platform_device rk29_device_vibrator = {
1254 .name = "timed-gpio",
1257 .platform_data = &rk29_vibrator_info,
1263 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1264 static struct gpio_led rk29_leds[] = {
1266 .name = "button-backlight",
1267 .gpio = RK30_PIN4_PD7,
1268 .default_trigger = "timer",
1270 .retain_state_suspended = 0,
1271 .default_state = LEDS_GPIO_DEFSTATE_OFF,
1275 static struct gpio_led_platform_data rk29_leds_pdata = {
1277 .num_leds = ARRAY_SIZE(rk29_leds),
1280 static struct platform_device rk29_device_gpio_leds = {
1281 .name = "leds-gpio",
1284 .platform_data = &rk29_leds_pdata,
1289 #ifdef CONFIG_RK_IRDA
1290 #define IRDA_IRQ_PIN RK30_PIN6_PA1
1292 static int irda_iomux_init(void)
1297 ret = gpio_request(IRDA_IRQ_PIN, NULL);
1299 gpio_free(IRDA_IRQ_PIN);
1300 printk(">>>>>> IRDA_IRQ_PIN gpio_request err \n ");
1302 gpio_pull_updown(IRDA_IRQ_PIN, PullDisable);
1303 gpio_direction_input(IRDA_IRQ_PIN);
1308 static int irda_iomux_deinit(void)
1310 gpio_free(IRDA_IRQ_PIN);
1314 static struct irda_info rk29_irda_info = {
1315 .intr_pin = IRDA_IRQ_PIN,
1316 .iomux_init = irda_iomux_init,
1317 .iomux_deinit = irda_iomux_deinit,
1318 //.irda_pwr_ctl = bu92747guw_power_ctl,
1321 static struct platform_device irda_device = {
1322 #ifdef CONFIG_RK_IRDA_NET
1325 .name = "bu92747_irda",
1329 .platform_data = &rk29_irda_info,
1335 #define ION_RESERVE_SIZE (80 * SZ_1M)
1336 static struct ion_platform_data rk30_ion_pdata = {
1340 .type = ION_HEAP_TYPE_CARVEOUT,
1341 .id = ION_NOR_HEAP_ID,
1343 .size = ION_RESERVE_SIZE,
1348 static struct platform_device device_ion = {
1349 .name = "ion-rockchip",
1352 .platform_data = &rk30_ion_pdata,
1357 /**************************************************************************************************
1358 * SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
1359 **************************************************************************************************/
1360 #ifdef CONFIG_SDMMC_RK29
1361 #include "board-rk30-phone-sdmmc.c"
1363 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1364 #define SDMMC0_WRITE_PROTECT_PIN RK30_PIN3_PB7 //According to your own project to set the value of write-protect-pin.
1367 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1368 #define SDMMC1_WRITE_PROTECT_PIN RK30_PIN3_PC7 //According to your own project to set the value of write-protect-pin.
1371 #define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK30_PIN6_PB2
1373 #endif //endif ---#ifdef CONFIG_SDMMC_RK29
1375 #ifdef CONFIG_SDMMC0_RK29
1376 static int rk29_sdmmc0_cfg_gpio(void)
1378 #ifdef CONFIG_SDMMC_RK29_OLD
1379 rk30_mux_api_set(GPIO3B1_SDMMC0CMD_NAME, GPIO3B_SDMMC0_CMD);
1380 rk30_mux_api_set(GPIO3B0_SDMMC0CLKOUT_NAME, GPIO3B_SDMMC0_CLKOUT);
1381 rk30_mux_api_set(GPIO3B2_SDMMC0DATA0_NAME, GPIO3B_SDMMC0_DATA0);
1382 rk30_mux_api_set(GPIO3B3_SDMMC0DATA1_NAME, GPIO3B_SDMMC0_DATA1);
1383 rk30_mux_api_set(GPIO3B4_SDMMC0DATA2_NAME, GPIO3B_SDMMC0_DATA2);
1384 rk30_mux_api_set(GPIO3B5_SDMMC0DATA3_NAME, GPIO3B_SDMMC0_DATA3);
1386 rk30_mux_api_set(GPIO3B6_SDMMC0DETECTN_NAME, GPIO3B_GPIO3B6);
1388 rk30_mux_api_set(GPIO3A7_SDMMC0PWREN_NAME, GPIO3A_GPIO3A7);
1389 gpio_request(RK30_PIN3_PA7, "sdmmc-power");
1390 gpio_direction_output(RK30_PIN3_PA7, GPIO_LOW);
1393 rk29_sdmmc_set_iomux(0, 0xFFFF);
1395 rk30_mux_api_set(GPIO3B6_SDMMC0DETECTN_NAME, GPIO3B_SDMMC0_DETECT_N);
1397 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1398 gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
1399 gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
1407 #define CONFIG_SDMMC0_USE_DMA
1408 struct rk29_sdmmc_platform_data default_sdmmc0_data = {
1410 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
1411 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
1412 MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
1414 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1415 .io_init = rk29_sdmmc0_cfg_gpio,
1417 #if !defined(CONFIG_SDMMC_RK29_OLD)
1418 .set_iomux = rk29_sdmmc_set_iomux,
1421 .dma_name = "sd_mmc",
1422 #ifdef CONFIG_SDMMC0_USE_DMA
1427 .detect_irq = INVALID_GPIO, // INVALID_GPIO
1428 .enable_sd_wakeup = 0,
1430 #if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
1431 .write_prt = SDMMC0_WRITE_PROTECT_PIN,
1433 .write_prt = INVALID_GPIO,
1436 #endif // CONFIG_SDMMC0_RK29
1438 #ifdef CONFIG_SDMMC1_RK29
1439 #define CONFIG_SDMMC1_USE_DMA
1440 static int rk29_sdmmc1_cfg_gpio(void)
1442 #if defined(CONFIG_SDMMC_RK29_OLD)
1443 rk30_mux_api_set(GPIO3C0_SMMC1CMD_NAME, GPIO3C_SMMC1_CMD);
1444 rk30_mux_api_set(GPIO3C5_SDMMC1CLKOUT_NAME, GPIO3C_SDMMC1_CLKOUT);
1445 rk30_mux_api_set(GPIO3C1_SDMMC1DATA0_NAME, GPIO3C_SDMMC1_DATA0);
1446 rk30_mux_api_set(GPIO3C2_SDMMC1DATA1_NAME, GPIO3C_SDMMC1_DATA1);
1447 rk30_mux_api_set(GPIO3C3_SDMMC1DATA2_NAME, GPIO3C_SDMMC1_DATA2);
1448 rk30_mux_api_set(GPIO3C4_SDMMC1DATA3_NAME, GPIO3C_SDMMC1_DATA3);
1449 //rk30_mux_api_set(GPIO3C6_SDMMC1DETECTN_NAME, GPIO3C_SDMMC1_DETECT_N);
1453 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1454 gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
1455 gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
1463 struct rk29_sdmmc_platform_data default_sdmmc1_data = {
1465 (MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
1466 MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
1469 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1470 .host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
1471 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1474 (MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1477 .io_init = rk29_sdmmc1_cfg_gpio,
1479 #if !defined(CONFIG_SDMMC_RK29_OLD)
1480 .set_iomux = rk29_sdmmc_set_iomux,
1484 #ifdef CONFIG_SDMMC1_USE_DMA
1490 #if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
1491 #ifdef CONFIG_WIFI_CONTROL_FUNC
1492 .status = rk29sdk_wifi_status,
1493 .register_status_notify = rk29sdk_wifi_status_register,
1496 .detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
1499 #if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
1500 .write_prt = SDMMC1_WRITE_PROTECT_PIN,
1502 .write_prt = INVALID_GPIO,
1506 .detect_irq = INVALID_GPIO,
1507 .enable_sd_wakeup = 0,
1511 #endif //endif--#ifdef CONFIG_SDMMC1_RK29
1513 /* bluetooth rfkill device */
1514 static struct platform_device rk29sdk_rfkill = {
1515 .name = "rk29sdk_rfkill",
1519 /**************************************************************************************************
1520 * the end of setting for SDMMC devices
1521 **************************************************************************************************/
1523 /*************td modem sc8800 power control*************/
1525 #if defined(CONFIG_TDSC8800)
1526 #define BP_VOL_PIN RK30_PIN6_PB2
1528 static int tdsc8800_io_init(void)
1534 static int tdsc8800_io_deinit(void)
1540 struct rk2818_23d_data rk29_tdsc8800_info = {
1541 .io_init = tdsc8800_io_init,
1542 .io_deinit = tdsc8800_io_deinit,
1543 .bp_power = BP_VOL_PIN,
1544 .bp_power_active_low = 1,
1546 struct platform_device rk29_device_tdsc8800 = {
1550 .platform_data = &rk29_tdsc8800_info,
1556 static struct platform_device *devices[] __initdata = {
1557 #ifdef CONFIG_RK30_PWM_REGULATOR
1558 &pwm_regulator_device[0],
1559 &pwm_regulator_device[1],
1561 #ifdef CONFIG_BACKLIGHT_RK29_BL
1562 &rk29_device_backlight,
1564 #ifdef CONFIG_BACKLIGHT_AW9364
1565 &aw9364_device_backlight,
1567 #ifdef CONFIG_FB_ROCKCHIP
1573 #ifdef CONFIG_FB_WIMO
1576 #ifdef CONFIG_ANDROID_TIMED_GPIO
1577 &rk29_device_vibrator,
1579 #ifdef CONFIG_LEDS_GPIO_PLATFORM
1580 &rk29_device_gpio_leds,
1582 #ifdef CONFIG_RK_IRDA
1585 #ifdef CONFIG_WIFI_CONTROL_FUNC
1586 &rk29sdk_wifi_device,
1591 #ifdef CONFIG_MFD_WM8994
1592 &wm8994_fixed_voltage0,
1593 &wm8994_fixed_voltage1,
1595 #ifdef CONFIG_RK_HEADSET_DET
1598 #ifdef CONFIG_TDSC8800
1599 &rk29_device_tdsc8800,
1605 #ifdef CONFIG_I2C0_RK30
1606 static struct i2c_board_info __initdata i2c0_info[] = {
1607 #if defined (CONFIG_GS_MMA8452)
1609 .type = "gs_mma8452",
1612 .irq = MMA8452_INT_PIN,
1613 .platform_data = &mma8452_info,
1616 #if defined (CONFIG_COMPASS_AK8975)
1621 .irq = RK30_PIN4_PC1,
1622 .platform_data = &akm8975_info,
1625 #if defined (CONFIG_GYRO_L3G4200D)
1627 .type = "l3g4200d_gryo",
1630 .irq = L3G4200D_INT_PIN,
1631 .platform_data = &l3g4200d_info,
1634 #if defined (CONFIG_MPU_SENSORS_MPU3050)
1639 .irq = RK30_PIN4_PC3,
1640 .platform_data = &mpu3050_data,
1643 #if defined (CONFIG_MPU_SENSORS_MMA845X)
1648 .irq = RK30_PIN4_PC0,
1649 .platform_data = &inv_mpu_mma845x_data,
1652 #if defined (CONFIG_MPU_SENSORS_AK8975)
1657 .irq = RK30_PIN4_PC1,
1658 .platform_data = &inv_mpu_ak8975_data,
1662 #if defined (CONFIG_SND_SOC_RK1000)
1664 .type = "rk1000_i2c_codec",
1669 .type = "rk1000_control",
1674 #if defined (CONFIG_SND_SOC_RT5631)
1682 #ifdef CONFIG_MFD_RK610
1684 .type = "rk610_ctl",
1688 #ifdef CONFIG_RK610_TVOUT
1690 .type = "rk610_tvout",
1695 #ifdef CONFIG_HDMI_RK610
1697 .type = "rk610_hdmi",
1700 .irq = RK29_PIN5_PA2,
1703 #ifdef CONFIG_SND_SOC_RK610
1704 {//RK610_CODEC addr from 0x60 to 0x80 (0x60~0x80)
1705 .type = "rk610_i2c_codec",
1711 #if defined (CONFIG_SND_SOC_WM8994)
1716 #if defined(CONFIG_MFD_WM8994)
1717 .platform_data = &wm8994_platform_data,
1725 #ifdef CONFIG_I2C1_RK30
1727 #include "board-rk30-phone-wm831x.c"
1729 static struct i2c_board_info __initdata i2c1_info[] = {
1730 #if defined (CONFIG_MFD_WM831X_I2C)
1735 .irq = RK30_PIN6_PA4,
1736 .platform_data = &wm831x_platdata,
1743 #ifdef CONFIG_I2C2_RK30
1744 static struct i2c_board_info __initdata i2c2_info[] = {
1745 #if defined (CONFIG_TOUCHSCREEN_ILI2102_IIC)
1747 .type = "ili2102_ts",
1749 .flags = I2C_M_NEED_DELAY,
1751 .irq = TOUCH_GPIO_INT,
1752 .platform_data = &ili2102_info,
1756 #if defined (CONFIG_TOUCHSCREEN_GT8XX)
1758 .type = "Goodix-TS",
1761 .irq = RK30_PIN4_PC2,
1762 .platform_data = &goodix_info,
1765 #if defined (CONFIG_LS_CM3217)
1767 .type = "lightsensor",
1770 .irq = CM3217_IRQ_PIN,
1771 .platform_data = &cm3217_info,
1777 #ifdef CONFIG_I2C3_RK30
1778 static struct i2c_board_info __initdata i2c3_info[] = {
1782 #ifdef CONFIG_I2C4_RK30
1783 static struct i2c_board_info __initdata i2c4_info[] = {
1787 #ifdef CONFIG_I2C_GPIO_RK30
1788 #include "board-rk30-phone-wm831x.c"
1790 #define I2C_SDA_PIN RK30_PIN2_PD7 //set sda_pin here
1791 #define I2C_SCL_PIN RK30_PIN2_PD6 //set scl_pin here
1792 static int rk30_i2c_io_init(void)
1794 //set iomux (gpio) here
1795 rk30_mux_api_set(GPIO2D7_I2C1SCL_NAME, GPIO2D_GPIO2D7);
1796 rk30_mux_api_set(GPIO2D6_I2C1SDA_NAME, GPIO2D_GPIO2D6);
1800 struct i2c_gpio_platform_data default_i2c_gpio_data = {
1801 .sda_pin = I2C_SDA_PIN,
1802 .scl_pin = I2C_SCL_PIN,
1803 .udelay = 5, // clk = 500/udelay = 100Khz
1804 .timeout = 100,//msecs_to_jiffies(100),
1806 .io_init = rk30_i2c_io_init,
1808 static struct i2c_board_info __initdata i2c_gpio_info[] = {
1809 #if defined (CONFIG_MFD_WM831X_I2C)
1814 .irq = RK30_PIN6_PA4,
1815 .platform_data = &wm831x_platdata,
1822 static void __init rk30_i2c_register_board_info(void)
1824 #ifdef CONFIG_I2C0_RK30
1825 i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
1827 #ifdef CONFIG_I2C1_RK30
1828 i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
1830 #ifdef CONFIG_I2C2_RK30
1831 i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
1833 #ifdef CONFIG_I2C3_RK30
1834 i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
1836 #ifdef CONFIG_I2C4_RK30
1837 i2c_register_board_info(4, i2c4_info, ARRAY_SIZE(i2c4_info));
1839 #ifdef CONFIG_I2C_GPIO_RK30
1840 i2c_register_board_info(5, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
1846 #define POWER_ON_PIN RK30_PIN6_PB0 //power_hold
1847 static void rk30_pm_power_off(void)
1849 printk(KERN_ERR "rk30_pm_power_off start...\n");
1850 gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
1851 #if defined(CONFIG_MFD_WM831X)
1852 wm831x_device_shutdown(Wm831x);//wm8326 shutdown
1857 static void __init machine_rk30_board_init(void)
1859 gpio_request(POWER_ON_PIN, "poweronpin");
1860 gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
1862 pm_power_off = rk30_pm_power_off;
1864 rk30_i2c_register_board_info();
1865 spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
1866 platform_add_devices(devices, ARRAY_SIZE(devices));
1867 board_usb_detect_init(RK30_PIN6_PA3);
1869 #if defined (CONFIG_MPU_SENSORS_MPU3050)
1870 rk30_mux_api_set(GPIO4C3_SMCDATA3_TRACEDATA3_NAME, GPIO4C_GPIO4C3);
1873 #ifdef CONFIG_WIFI_CONTROL_FUNC
1874 rk29sdk_wifi_bt_gpio_control_init();
1878 static void __init rk30_reserve(void)
1881 rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
1883 #ifdef CONFIG_FB_ROCKCHIP
1884 resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
1885 resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
1886 resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
1887 resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
1888 resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE);
1889 resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
1891 #ifdef CONFIG_VIDEO_RK29
1892 rk30_camera_request_reserve_mem();
1894 board_mem_reserved();
1898 * dvfs_cpu_logic_table: table for arm and logic dvfs
1899 * @frequency : arm frequency
1900 * @cpu_volt : arm voltage depend on frequency
1901 * @logic_volt : logic voltage arm requests depend on frequency
1902 * comments : min arm/logic voltage
1904 static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
1905 //{.frequency = 252 * 1000, .cpu_volt = 1050 * 1000, .logic_volt = 1050 * 1000},//0.975V/1.000V
1906 //{.frequency = 504 * 1000, .cpu_volt = 1050 * 1000, .logic_volt = 1050 * 1000},//0.975V/1.000V
1907 {.frequency = 816 * 1000, .cpu_volt = 1100 * 1000, .logic_volt = 1100 * 1000},
1908 {.frequency = 1008 * 1000, .cpu_volt = 1150 * 1000, .logic_volt = 1100 * 1000},
1909 {.frequency = 1200 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1100 * 1000},
1910 //{.frequency = 1272 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1150 * 1000},//1.150V/1.100V
1911 //{.frequency = 1416 * 1000, .cpu_volt = 1275 * 1000, .logic_volt = 1150 * 1000},//1.225V/1.100V
1912 //{.frequency = 1512 * 1000, .cpu_volt = 1325 * 1000, .logic_volt = 1200 * 1000},//1.300V/1.150V
1913 //{.frequency = 1608 * 1000, .cpu_volt = 1350 * 1000, .logic_volt = 1200 * 1000},//1.325V/1.175V
1914 {.frequency = CPUFREQ_TABLE_END},
1917 #define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
1918 static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
1919 static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
1921 void __init board_clock_init(void)
1923 rk30_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
1924 dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
1927 MACHINE_START(RK30, "RK30board")
1928 .boot_params = PLAT_PHYS_OFFSET + 0x800,
1929 .fixup = rk30_fixup,
1930 .reserve = &rk30_reserve,
1931 .map_io = rk30_map_io,
1932 .init_irq = rk30_init_irq,
1933 .timer = &rk30_timer,
1934 .init_machine = machine_rk30_board_init,