phonepad: commit phonepadsdk(i30) code and defconfig

[reference file]
	modified file:
		arch/arm/mach-rk2928/Kconfig
		arch/arm/mach-rk2928/Makefile
	new file:
		arch/arm/configs/rk2928_phonepad_defconfig
		arch/arm/mach-rk2928/board-rk2928-phonepad-camera.c
		arch/arm/mach-rk2928/board-rk2928-phonepad-key.c
		arch/arm/mach-rk2928/board-rk2928-phonepad-tps65910.c
		arch/arm/mach-rk2928/board-rk2928-phonepad.c
This commit is contained in:
linjh 2012-09-27 17:31:49 +08:00
parent ab9209c423
commit 0f6a1dcd93
7 changed files with 4976 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,9 @@ config MACH_RK2928_A720
help
support rk2926 m713 board with pmu act8931
config MACH_RK2928_PHONEPAD
bool "RK2928_PhonePad board"
endchoice
endif

View File

@ -20,3 +20,4 @@ obj-$(CONFIG_MACH_RK2928) += board.o
obj-$(CONFIG_MACH_RK2928_FPGA) += board-rk2928-fpga.o
obj-$(CONFIG_MACH_RK2928_SDK) += board-rk2928-sdk.o
obj-$(CONFIG_MACH_RK2928_A720) += board-rk2928-a720.o
obj-$(CONFIG_MACH_RK2928_PHONEPAD) += board-rk2928-phonepad.o

View File

@ -0,0 +1,448 @@
#ifdef CONFIG_VIDEO_RK29
/*---------------- Camera Sensor Macro Define Begin ------------------------*/
/*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
#define CONFIG_SENSOR_0 RK29_CAM_SENSOR_OV5642 /* back camera sensor */
#define CONFIG_SENSOR_IIC_ADDR_0 0
#define CONFIG_SENSOR_IIC_ADAPTER_ID_0 0
#define CONFIG_SENSOR_CIF_INDEX_0 0
#define CONFIG_SENSOR_ORIENTATION_0 90
#define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO
#define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
#define CONFIG_SENSOR_POWERDN_PIN_0 INVALID_GPIO//RK2928_PIN3_PB3
#define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
#define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
#define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
#define CONFIG_SENSOR_QCIF_FPS_FIXED_0 15000
#define CONFIG_SENSOR_240X160_FPS_FIXED_0 15000
#define CONFIG_SENSOR_QVGA_FPS_FIXED_0 15000
#define CONFIG_SENSOR_CIF_FPS_FIXED_0 15000
#define CONFIG_SENSOR_VGA_FPS_FIXED_0 15000
#define CONFIG_SENSOR_480P_FPS_FIXED_0 15000
#define CONFIG_SENSOR_SVGA_FPS_FIXED_0 15000
#define CONFIG_SENSOR_720P_FPS_FIXED_0 30000
#define CONFIG_SENSOR_01 RK29_CAM_SENSOR_OV5642 /* back camera sensor 1 */
#define CONFIG_SENSOR_IIC_ADDR_01 0x00
#define CONFIG_SENSOR_CIF_INDEX_01 0
#define CONFIG_SENSOR_IIC_ADAPTER_ID_01 4
#define CONFIG_SENSOR_ORIENTATION_01 90
#define CONFIG_SENSOR_POWER_PIN_01 INVALID_GPIO
#define CONFIG_SENSOR_RESET_PIN_01 INVALID_GPIO
#define CONFIG_SENSOR_POWERDN_PIN_01 INVALID_GPIO//RK2928_PIN3_PB3
#define CONFIG_SENSOR_FALSH_PIN_01 INVALID_GPIO
#define CONFIG_SENSOR_POWERACTIVE_LEVEL_01 RK29_CAM_POWERACTIVE_L
#define CONFIG_SENSOR_RESETACTIVE_LEVEL_01 RK29_CAM_RESETACTIVE_L
#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_01 RK29_CAM_POWERDNACTIVE_H
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_01 RK29_CAM_FLASHACTIVE_L
#define CONFIG_SENSOR_QCIF_FPS_FIXED_01 15000
#define CONFIG_SENSOR_240X160_FPS_FIXED_01 15000
#define CONFIG_SENSOR_QVGA_FPS_FIXED_01 15000
#define CONFIG_SENSOR_CIF_FPS_FIXED_01 15000
#define CONFIG_SENSOR_VGA_FPS_FIXED_01 15000
#define CONFIG_SENSOR_480P_FPS_FIXED_01 15000
#define CONFIG_SENSOR_SVGA_FPS_FIXED_01 15000
#define CONFIG_SENSOR_720P_FPS_FIXED_01 30000
#define CONFIG_SENSOR_02 RK29_CAM_SENSOR_OV5640 /* back camera sensor 2 */
#define CONFIG_SENSOR_IIC_ADDR_02 0x00
#define CONFIG_SENSOR_CIF_INDEX_02 0
#define CONFIG_SENSOR_IIC_ADAPTER_ID_02 4
#define CONFIG_SENSOR_ORIENTATION_02 90
#define CONFIG_SENSOR_POWER_PIN_02 INVALID_GPIO
#define CONFIG_SENSOR_RESET_PIN_02 INVALID_GPIO
#define CONFIG_SENSOR_POWERDN_PIN_02 INVALID_GPIO//RK2928_PIN3_PB3
#define CONFIG_SENSOR_FALSH_PIN_02 INVALID_GPIO
#define CONFIG_SENSOR_POWERACTIVE_LEVEL_02 RK29_CAM_POWERACTIVE_L
#define CONFIG_SENSOR_RESETACTIVE_LEVEL_02 RK29_CAM_RESETACTIVE_L
#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_02 RK29_CAM_POWERDNACTIVE_H
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_02 RK29_CAM_FLASHACTIVE_L
#define CONFIG_SENSOR_QCIF_FPS_FIXED_02 15000
#define CONFIG_SENSOR_240X160_FPS_FIXED_02 15000
#define CONFIG_SENSOR_QVGA_FPS_FIXED_02 15000
#define CONFIG_SENSOR_CIF_FPS_FIXED_02 15000
#define CONFIG_SENSOR_VGA_FPS_FIXED_02 15000
#define CONFIG_SENSOR_480P_FPS_FIXED_02 15000
#define CONFIG_SENSOR_SVGA_FPS_FIXED_02 15000
#define CONFIG_SENSOR_720P_FPS_FIXED_02 30000
#define CONFIG_SENSOR_1 RK29_CAM_SENSOR_GC0308 /* front camera sensor 0 */
#define CONFIG_SENSOR_IIC_ADDR_1 0x42
#define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1
#define CONFIG_SENSOR_CIF_INDEX_1 0
#define CONFIG_SENSOR_ORIENTATION_1 270
#define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
#define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
#define CONFIG_SENSOR_POWERDN_PIN_1 RK2928_PIN3_PB3
#define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
#define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
#define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
#define CONFIG_SENSOR_QCIF_FPS_FIXED_1 15000
#define CONFIG_SENSOR_240X160_FPS_FIXED_1 15000
#define CONFIG_SENSOR_QVGA_FPS_FIXED_1 15000
#define CONFIG_SENSOR_CIF_FPS_FIXED_1 15000
#define CONFIG_SENSOR_VGA_FPS_FIXED_1 15000
#define CONFIG_SENSOR_480P_FPS_FIXED_1 15000
#define CONFIG_SENSOR_SVGA_FPS_FIXED_1 15000
#define CONFIG_SENSOR_720P_FPS_FIXED_1 30000
#define CONFIG_SENSOR_11 RK29_CAM_SENSOR_OV2659 /* front camera sensor 1 */
#define CONFIG_SENSOR_IIC_ADDR_11 0x00
#define CONFIG_SENSOR_IIC_ADAPTER_ID_11 3
#define CONFIG_SENSOR_CIF_INDEX_11 0
#define CONFIG_SENSOR_ORIENTATION_11 270
#define CONFIG_SENSOR_POWER_PIN_11 INVALID_GPIO
#define CONFIG_SENSOR_RESET_PIN_11 INVALID_GPIO
#define CONFIG_SENSOR_POWERDN_PIN_11 INVALID_GPIO
#define CONFIG_SENSOR_FALSH_PIN_11 INVALID_GPIO
#define CONFIG_SENSOR_POWERACTIVE_LEVEL_11 RK29_CAM_POWERACTIVE_L
#define CONFIG_SENSOR_RESETACTIVE_LEVEL_11 RK29_CAM_RESETACTIVE_L
#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_11 RK29_CAM_POWERDNACTIVE_H
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_11 RK29_CAM_FLASHACTIVE_L
#define CONFIG_SENSOR_QCIF_FPS_FIXED_11 15000
#define CONFIG_SENSOR_240X160_FPS_FIXED_11 15000
#define CONFIG_SENSOR_QVGA_FPS_FIXED_11 15000
#define CONFIG_SENSOR_CIF_FPS_FIXED_11 15000
#define CONFIG_SENSOR_VGA_FPS_FIXED_11 15000
#define CONFIG_SENSOR_480P_FPS_FIXED_11 15000
#define CONFIG_SENSOR_SVGA_FPS_FIXED_11 15000
#define CONFIG_SENSOR_720P_FPS_FIXED_11 30000
#define CONFIG_SENSOR_12 RK29_CAM_SENSOR_OV2659//RK29_CAM_SENSOR_OV2655 /* front camera sensor 2 */
#define CONFIG_SENSOR_IIC_ADDR_12 0x00
#define CONFIG_SENSOR_IIC_ADAPTER_ID_12 3
#define CONFIG_SENSOR_CIF_INDEX_12 0
#define CONFIG_SENSOR_ORIENTATION_12 270
#define CONFIG_SENSOR_POWER_PIN_12 INVALID_GPIO
#define CONFIG_SENSOR_RESET_PIN_12 INVALID_GPIO
#define CONFIG_SENSOR_POWERDN_PIN_12 INVALID_GPIO
#define CONFIG_SENSOR_FALSH_PIN_12 INVALID_GPIO
#define CONFIG_SENSOR_POWERACTIVE_LEVEL_12 RK29_CAM_POWERACTIVE_L
#define CONFIG_SENSOR_RESETACTIVE_LEVEL_12 RK29_CAM_RESETACTIVE_L
#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_12 RK29_CAM_POWERDNACTIVE_H
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_12 RK29_CAM_FLASHACTIVE_L
#define CONFIG_SENSOR_QCIF_FPS_FIXED_12 15000
#define CONFIG_SENSOR_240X160_FPS_FIXED_12 15000
#define CONFIG_SENSOR_QVGA_FPS_FIXED_12 15000
#define CONFIG_SENSOR_CIF_FPS_FIXED_12 15000
#define CONFIG_SENSOR_VGA_FPS_FIXED_12 15000
#define CONFIG_SENSOR_480P_FPS_FIXED_12 15000
#define CONFIG_SENSOR_SVGA_FPS_FIXED_12 15000
#define CONFIG_SENSOR_720P_FPS_FIXED_12 30000
#endif //#ifdef CONFIG_VIDEO_RK29
/*---------------- Camera Sensor Configuration Macro End------------------------*/
#include "../../../drivers/media/video/rk2928_camera.c"
/*---------------- Camera Sensor Macro Define End ---------*/
#define PMEM_CAM_SIZE PMEM_CAM_NECESSARY
/*****************************************************************************************
* camera devices
* author: ddl@rock-chips.com
*****************************************************************************************/
#ifdef CONFIG_VIDEO_RK29
#define CONFIG_SENSOR_POWER_IOCTL_USR 0 //define this refer to your board layout
#define CONFIG_SENSOR_RESET_IOCTL_USR 0
#define CONFIG_SENSOR_POWERDOWN_IOCTL_USR 0
#define CONFIG_SENSOR_FLASH_IOCTL_USR 0
static void rk_cif_power(int on)
{
struct regulator *ldo_18,*ldo_28;
ldo_28 = regulator_get(NULL, "ldo7"); // vcc28_cif
ldo_18 = regulator_get(NULL, "ldo1"); // vcc18_cif
if (ldo_28 == NULL || IS_ERR(ldo_28) || ldo_18 == NULL || IS_ERR(ldo_18)){
printk("get cif ldo failed!\n");
return;
}
if(on == 0){
regulator_disable(ldo_28);
regulator_put(ldo_28);
regulator_disable(ldo_18);
regulator_put(ldo_18);
mdelay(500);
}
else{
regulator_set_voltage(ldo_28, 2800000, 2800000);
regulator_enable(ldo_28);
// printk("%s set ldo7 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_28));
regulator_put(ldo_28);
regulator_set_voltage(ldo_18, 1800000, 1800000);
// regulator_set_suspend_voltage(ldo, 1800000);
regulator_enable(ldo_18);
// printk("%s set ldo1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo_18));
regulator_put(ldo_18);
}
}
#if CONFIG_SENSOR_POWER_IOCTL_USR
static int sensor_power_usr_cb (struct rk29camera_gpio_res *res,int on)
{
//#error "CONFIG_SENSOR_POWER_IOCTL_USR is 1, sensor_power_usr_cb function must be writed!!";
rk_cif_power(on);
}
#endif
#if CONFIG_SENSOR_RESET_IOCTL_USR
static int sensor_reset_usr_cb (struct rk29camera_gpio_res *res,int on)
{
#error "CONFIG_SENSOR_RESET_IOCTL_USR is 1, sensor_reset_usr_cb function must be writed!!";
}
#endif
#if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
static int sensor_powerdown_usr_cb (struct rk29camera_gpio_res *res,int on)
{
#error "CONFIG_SENSOR_POWERDOWN_IOCTL_USR is 1, sensor_powerdown_usr_cb function must be writed!!";
}
#endif
#if CONFIG_SENSOR_FLASH_IOCTL_USR
static int sensor_flash_usr_cb (struct rk29camera_gpio_res *res,int on)
{
#error "CONFIG_SENSOR_FLASH_IOCTL_USR is 1, sensor_flash_usr_cb function must be writed!!";
}
#endif
static struct rk29camera_platform_ioctl_cb sensor_ioctl_cb = {
#if CONFIG_SENSOR_POWER_IOCTL_USR
.sensor_power_cb = sensor_power_usr_cb,
#else
.sensor_power_cb = NULL,
#endif
#if CONFIG_SENSOR_RESET_IOCTL_USR
.sensor_reset_cb = sensor_reset_usr_cb,
#else
.sensor_reset_cb = NULL,
#endif
#if CONFIG_SENSOR_POWERDOWN_IOCTL_USR
.sensor_powerdown_cb = sensor_powerdown_usr_cb,
#else
.sensor_powerdown_cb = NULL,
#endif
#if CONFIG_SENSOR_FLASH_IOCTL_USR
.sensor_flash_cb = sensor_flash_usr_cb,
#else
.sensor_flash_cb = NULL,
#endif
};
#if CONFIG_SENSOR_IIC_ADDR_0
static struct reginfo_t rk_init_data_sensor_reg_0[] =
{
{0x0000, 0x00,0,0}
};
static struct reginfo_t rk_init_data_sensor_winseqreg_0[] ={
{0x0000, 0x00,0,0}
};
#endif
#if CONFIG_SENSOR_IIC_ADDR_1
static struct reginfo_t rk_init_data_sensor_reg_1[] =
{
{0x0000, 0x00,0,0}
};
static struct reginfo_t rk_init_data_sensor_winseqreg_1[] =
{
{0x0000, 0x00,0,0}
};
#endif
#if CONFIG_SENSOR_IIC_ADDR_01
static struct reginfo_t rk_init_data_sensor_reg_01[] =
{
{0x0000, 0x00,0,0}
};
static struct reginfo_t rk_init_data_sensor_winseqreg_01[] =
{
{0x0000, 0x00,0,0}
};
#endif
#if CONFIG_SENSOR_IIC_ADDR_02
static struct reginfo_t rk_init_data_sensor_reg_02[] =
{
{0x0000, 0x00,0,0}
};
static struct reginfo_t rk_init_data_sensor_winseqreg_02[] =
{
{0x0000, 0x00,0,0}
};
#endif
#if CONFIG_SENSOR_IIC_ADDR_11
static struct reginfo_t rk_init_data_sensor_reg_11[] =
{
{0x0000, 0x00,0,0}
};
static struct reginfo_t rk_init_data_sensor_winseqreg_11[] =
{
{0x0000, 0x00,0,0}
};
#endif
#if CONFIG_SENSOR_IIC_ADDR_12
static struct reginfo_t rk_init_data_sensor_reg_12[] =
{
{0x0000, 0x00,0,0}
};
static struct reginfo_t rk_init_data_sensor_winseqreg_12[] =
{
{0x0000, 0x00,0,0}
};
#endif
static rk_sensor_user_init_data_s rk_init_data_sensor[RK_CAM_NUM] =
{
#if CONFIG_SENSOR_IIC_ADDR_0
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = rk_init_data_sensor_reg_0,
.rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_0,
.rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_0) / sizeof(struct reginfo_t),
.rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_0) / sizeof(struct reginfo_t),
},
#else
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = NULL,
.rk_sensor_init_winseq = NULL,
.rk_sensor_winseq_size = 0,
.rk_sensor_init_data_size = 0,
},
#endif
#if CONFIG_SENSOR_IIC_ADDR_1
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = rk_init_data_sensor_reg_1,
.rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_1,
.rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_1) / sizeof(struct reginfo_t),
.rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_1) / sizeof(struct reginfo_t),
},
#else
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = NULL,
.rk_sensor_init_winseq = NULL,
.rk_sensor_winseq_size = 0,
.rk_sensor_init_data_size = 0,
},
#endif
#if CONFIG_SENSOR_IIC_ADDR_01
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = rk_init_data_sensor_reg_01,
.rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_01,
.rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_01) / sizeof(struct reginfo_t),
.rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_01) / sizeof(struct reginfo_t),
},
#else
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = NULL,
.rk_sensor_init_winseq = NULL,
.rk_sensor_winseq_size = 0,
.rk_sensor_init_data_size = 0,
},
#endif
#if CONFIG_SENSOR_IIC_ADDR_02
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = rk_init_data_sensor_reg_02,
.rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_02,
.rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_02) / sizeof(struct reginfo_t),
.rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_02) / sizeof(struct reginfo_t),
},
#else
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = NULL,
.rk_sensor_init_winseq = NULL,
.rk_sensor_winseq_size = 0,
.rk_sensor_init_data_size = 0,
},
#endif
#if CONFIG_SENSOR_IIC_ADDR_11
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = rk_init_data_sensor_reg_11,
.rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_11,
.rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_11) / sizeof(struct reginfo_t),
.rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_11) / sizeof(struct reginfo_t),
},
#else
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = NULL,
.rk_sensor_init_winseq = NULL,
.rk_sensor_winseq_size = 0,
.rk_sensor_init_data_size = 0,
},
#endif
#if CONFIG_SENSOR_IIC_ADDR_12
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = rk_init_data_sensor_reg_12,
.rk_sensor_init_winseq = rk_init_data_sensor_winseqreg_12,
.rk_sensor_winseq_size = sizeof(rk_init_data_sensor_winseqreg_12) / sizeof(struct reginfo_t),
.rk_sensor_init_data_size = sizeof(rk_init_data_sensor_reg_12) / sizeof(struct reginfo_t),
},
#else
{
.rk_sensor_init_width = INVALID_VALUE,
.rk_sensor_init_height = INVALID_VALUE,
.rk_sensor_init_bus_param = INVALID_VALUE,
.rk_sensor_init_pixelcode = INVALID_VALUE,
.rk_sensor_init_data = NULL,
.rk_sensor_init_winseq = NULL,
.rk_sensor_winseq_size = 0,
.rk_sensor_init_data_size = 0,
},
#endif
};
#include "../../../drivers/media/video/rk2928_camera.c"
#endif /* CONFIG_VIDEO_RK29 */

View File

@ -0,0 +1,39 @@
#include <mach/gpio.h>
#include <plat/key.h>
#define EV_ENCALL KEY_F4
#define EV_MENU KEY_F1
#define PRESS_LEV_LOW 1
#define PRESS_LEV_HIGH 0
static struct rk29_keys_button key_button[] = {
{
.desc = "play",
.code = KEY_POWER,
.gpio = RK2928_PIN1_PA4,
.active_low = PRESS_LEV_LOW,
//.code_long_press = EV_ENCALL,
.wakeup = 1,
},
{
.desc = "vol+",
.code = KEY_VOLUMEUP,
.gpio = INVALID_GPIO,
.adc_value = 1,
.active_low = PRESS_LEV_LOW,
},
{
.desc = "vol-",
.code = KEY_VOLUMEDOWN,
.gpio = INVALID_GPIO,
.adc_value = 512,
.active_low = PRESS_LEV_LOW,
},
};
struct rk29_keys_platform_data rk29_keys_pdata = {
.buttons = key_button,
.nbuttons = ARRAY_SIZE(key_button),
.chn = 1, //chn: 0-7, if do not use ADC,set 'chn' -1
};

View File

@ -0,0 +1,640 @@
#include <linux/regulator/machine.h>
#include <linux/i2c/twl.h>
#include <linux/mfd/tps65910.h>
#include <mach/sram.h>
#include <linux/platform_device.h>
#include <mach/gpio.h>
#include <mach/iomux.h>
#define gpio_readl(offset) readl_relaxed(RK2928_GPIO1_BASE + offset)
#define gpio_writel(v, offset) do { writel_relaxed(v, RK2928_GPIO1_BASE + offset); dsb(); } while (0)
#define GPIO_SWPORTA_DR 0x0000
#define GPIO_SWPORTA_DDR 0x0004
#define GPIO1_A1_OUTPUT (1<<1)
#define GPIO1_A1_OUTPUT_HIGH (1<<1)
#define GPIO1_A1_OUTPUT_LOW (~(1<<1))
#ifdef CONFIG_MFD_TPS65910
#define PMU_POWER_SLEEP RK2928_PIN1_PA1
extern int platform_device_register(struct platform_device *pdev);
int tps65910_pre_init(struct tps65910 *tps65910){
int val = 0;
int i = 0;
int err = -1;
printk("%s,line=%d\n", __func__,__LINE__);
gpio_request(PMU_POWER_SLEEP, "NULL");
gpio_direction_output(PMU_POWER_SLEEP, GPIO_LOW);
val = tps65910_reg_read(tps65910, TPS65910_DEVCTRL2);
if (val<0) {
printk(KERN_ERR "Unable to read TPS65910_DEVCTRL2 reg\n");
return val;
}
/* Set sleep state active high and allow device turn-off after PWRON long press */
val |= (DEVCTRL2_SLEEPSIG_POL_MASK | DEVCTRL2_PWON_LP_OFF_MASK);
err = tps65910_reg_write(tps65910, TPS65910_DEVCTRL2, val);
if (err) {
printk(KERN_ERR "Unable to write TPS65910_DEVCTRL2 reg\n");
return err;
}
#if 1
/* set PSKIP=0 */
val = tps65910_reg_read(tps65910, TPS65910_DCDCCTRL);
if (val<0) {
printk(KERN_ERR "Unable to read TPS65910_DCDCCTRL reg\n");
return val;
}
val &= ~DEVCTRL_DEV_OFF_MASK;
val &= ~DEVCTRL_DEV_SLP_MASK;
err = tps65910_reg_write(tps65910, TPS65910_DCDCCTRL, val);
if (err) {
printk(KERN_ERR "Unable to write TPS65910_DCDCCTRL reg\n");
return err;
}
#endif
/* Set the maxinum load current */
/* VDD1 */
val = tps65910_reg_read(tps65910, TPS65910_VDD1);
if (val<0) {
printk(KERN_ERR "Unable to read TPS65910_VDD1 reg\n");
return val;
}
val |= (1<<5); //when 1: 1.5 A
val |= (0x07<<2); //TSTEP[2:0] = 111 : 2.5 mV/|¨¬s(sampling 3 Mhz/5)
err = tps65910_reg_write(tps65910, TPS65910_VDD1, val);
if (err) {
printk(KERN_ERR "Unable to write TPS65910_VDD1 reg\n");
return err;
}
/* VDD2 */
val = tps65910_reg_read(tps65910, TPS65910_VDD2);
if (val<0) {
printk(KERN_ERR "Unable to read TPS65910_VDD2 reg\n");
return val;
}
val |= (1<<5); //when 1: 1.5 A
err = tps65910_reg_write(tps65910, TPS65910_VDD2, val);
if (err) {
printk(KERN_ERR "Unable to write TPS65910_VDD2 reg\n");
return err;
}
/* VIO */
val = tps65910_reg_read(tps65910, TPS65910_VIO);
if (val<0) {
printk(KERN_ERR "Unable to read TPS65910_VIO reg\n");
return -EIO;
}
val |= (1<<6); //when 01: 1.0 A
err = tps65910_reg_write(tps65910, TPS65910_VIO, val);
if (err) {
printk(KERN_ERR "Unable to write TPS65910_VIO reg\n");
return err;
}
#if 1
/* Mask ALL interrupts */
err = tps65910_reg_write(tps65910,TPS65910_INT_MSK, 0xFF);
if (err) {
printk(KERN_ERR "Unable to write TPS65910_INT_MSK reg\n");
return err;
}
err = tps65910_reg_write(tps65910, TPS65910_INT_MSK2, 0x03);
if (err) {
printk(KERN_ERR "Unable to write TPS65910_INT_MSK2 reg\n");
return err;
}
/* Set RTC Power, disable Smart Reflex in DEVCTRL_REG */
#if 1
val = 0;
val |= (DEVCTRL_SR_CTL_I2C_SEL_MASK);
err = tps65910_reg_write(tps65910, TPS65910_DEVCTRL, val);
if (err) {
printk(KERN_ERR "Unable to write TPS65910_DEVCTRL reg\n");
return err;
}
printk(KERN_INFO "TPS65910 Set default voltage.\n");
#endif
#if 0
//read sleep control register for debug
for(i=0; i<6; i++)
{
err = tps65910_reg_read(tps65910, &val, TPS65910_DEVCTRL+i);
if (err) {
printk(KERN_ERR "Unable to read TPS65910_DCDCCTRL reg\n");
return -EIO;
}
else
printk("%s.......is 0x%04x\n",__FUNCTION__,val);
}
#endif
#if 1
//sleep control register
/*set func when in sleep mode */
val = tps65910_reg_read(tps65910, TPS65910_DEVCTRL);
if (val<0) {
printk(KERN_ERR "Unable to read TPS65910_DCDCCTRL reg\n");
return val;
}
val |= (1 << 1);
err = tps65910_reg_write(tps65910, TPS65910_DEVCTRL, val);
if (err) {
printk(KERN_ERR "Unable to read TPS65910 Reg at offset 0x%x= \
\n", TPS65910_VDIG1);
return err;
}
/* open ldo when in sleep mode */
val = tps65910_reg_read(tps65910, TPS65910_SLEEP_KEEP_LDO_ON);
if (val<0) {
printk(KERN_ERR "Unable to read TPS65910_DCDCCTRL reg\n");
return val;
}
val &= 0;
err = tps65910_reg_write(tps65910, TPS65910_SLEEP_KEEP_LDO_ON, val);
if (err) {
printk(KERN_ERR "Unable to read TPS65910 Reg at offset 0x%x= \
\n", TPS65910_VDIG1);
return err;
}
/*set dc mode when in sleep mode */
val = tps65910_reg_read(tps65910, TPS65910_SLEEP_KEEP_RES_ON);
if (val<0) {
printk(KERN_ERR "Unable to read TPS65910_DCDCCTRL reg\n");
return val;
}
val |= 0xff;
err = tps65910_reg_write(tps65910, TPS65910_SLEEP_KEEP_RES_ON, val);
if (err) {
printk(KERN_ERR "Unable to read TPS65910 Reg at offset 0x%x= \
\n", TPS65910_VDIG1);
return err;
}
/*close ldo when in sleep mode */
val = tps65910_reg_read(tps65910, TPS65910_SLEEP_SET_LDO_OFF);
if (val<0) {
printk(KERN_ERR "Unable to read TPS65910_DCDCCTRL reg\n");
return val;
}
val |= 0x9B;
err = tps65910_reg_write(tps65910, TPS65910_SLEEP_SET_LDO_OFF, val);
if (err) {
printk(KERN_ERR "Unable to read TPS65910 Reg at offset 0x%x= \
\n", TPS65910_VDIG1);
return err;
}
#endif
#if 0
//read sleep control register for debug
for(i=0; i<6; i++)
{
err = tps65910_reg_read(tps65910, &val, TPS65910_DEVCTRL+i);
if (err) {
printk(KERN_ERR "Unable to read TPS65910_DCDCCTRL reg\n");
return -EIO;
}
else
printk("%s.......is 0x%4x\n",__FUNCTION__,val);
}
#endif
#endif
printk("%s,line=%d\n", __func__,__LINE__);
return 0;
}
void rk2928_usb_wifi_on(void)
{
struct regulator *ldo;
ldo = regulator_get(NULL, "vmmc"); //vccio_wl
regulator_enable(ldo);
printk("%s: vccio_wl enable\n", __func__);
regulator_put(ldo);
udelay(100);
}
EXPORT_SYMBOL(rk2928_usb_wifi_on);
void rk2928_usb_wifi_off(void)
{
struct regulator *ldo;
ldo = regulator_get(NULL, "vmmc"); //vccio_wl
printk("%s: vccio_wl disable\n", __func__);
regulator_disable(ldo);
regulator_put(ldo);
udelay(100);
}
EXPORT_SYMBOL(rk2928_usb_wifi_off);
int tps65910_post_init(struct tps65910 *tps65910)
{
struct regulator *dcdc;
struct regulator *ldo;
printk("%s,line=%d\n", __func__,__LINE__);
#ifdef CONFIG_RK30_PWM_REGULATOR
platform_device_register(&pwm_regulator_device[0]);
#endif
dcdc = regulator_get(NULL, "vio"); //vcc_io
regulator_set_voltage(dcdc, 3300000, 3300000);
regulator_enable(dcdc);
printk("%s set vio vcc_io=%dmV end\n", __func__, regulator_get_voltage(dcdc));
regulator_put(dcdc);
udelay(100);
/*
ldo = regulator_get(NULL, "vpll"); // vcc25
regulator_set_voltage(ldo, 2500000, 2500000);
regulator_enable(ldo);
printk("%s set vpll vcc25=%dmV end\n", __func__, regulator_get_voltage(ldo));
regulator_put(ldo);
udelay(100);
*/
ldo = regulator_get(NULL, "vdig2"); // vdd12
regulator_set_voltage(ldo, 1200000, 1200000);
regulator_enable(ldo);
printk("%s set vdig2 vdd12=%dmV end\n", __func__, regulator_get_voltage(ldo));
regulator_put(ldo);
udelay(100);
ldo = regulator_get(NULL, "vaux33"); //vcc_tp
regulator_set_voltage(ldo, 3300000, 3300000);
regulator_enable(ldo);
printk("%s set vaux33 vcc_tp=%dmV end\n", __func__, regulator_get_voltage(ldo));
regulator_put(ldo);
udelay(100);
dcdc = regulator_get(NULL, "vdd_cpu"); //vdd_cpu
regulator_set_voltage(dcdc, 1200000, 1200000);
regulator_enable(dcdc);
printk("%s set vdd1 vdd_cpu=%dmV end\n", __func__, regulator_get_voltage(dcdc));
regulator_put(dcdc);
udelay(100);
dcdc = regulator_get(NULL, "vdd2"); //vcc_ddr
regulator_set_voltage(dcdc, 1200000, 1200000); // 1.5*4/5 = 1.2 and Vout=1.5v
regulator_enable(dcdc);
printk("%s set vdd2 vcc_ddr=%dmV end\n", __func__, regulator_get_voltage(dcdc));
regulator_put(dcdc);
udelay(100);
ldo = regulator_get(NULL, "vdig1"); //vcc18_cif
regulator_set_voltage(ldo, 1500000, 1500000);
regulator_enable(ldo);
printk("%s set vdig1 vcc18_cif=%dmV end\n", __func__, regulator_get_voltage(ldo));
regulator_put(ldo);
udelay(100);
dcdc = regulator_get(NULL, "vaux1"); //vcc28_cif
regulator_set_voltage(dcdc,2800000,2800000);
regulator_enable(dcdc);
printk("%s set vaux1 vcc28_cif=%dmV end\n", __func__, regulator_get_voltage(dcdc));
regulator_put(dcdc);
udelay(100);
ldo = regulator_get(NULL, "vaux2"); //vcca33
regulator_set_voltage(ldo, 3300000, 3300000);
regulator_enable(ldo);
printk("%s set vaux2 vcca33=%dmV end\n", __func__, regulator_get_voltage(ldo));
regulator_put(ldo);
udelay(100);
/*
ldo = regulator_get(NULL, "vdac"); // vccio_wl
regulator_set_voltage(ldo,1800000,1800000);
regulator_enable(ldo);
printk("%s set vdac vccio_wl=%dmV end\n", __func__, regulator_get_voltage(ldo));
regulator_put(ldo);
udelay(100);
*/
ldo = regulator_get(NULL, "vmmc"); //vccio_wl
regulator_set_voltage(ldo,3300000,3300000);
regulator_enable(ldo);
printk("%s set vmmc vccio_wl=%dmV end\n", __func__, regulator_get_voltage(ldo));
regulator_disable(ldo);
regulator_put(ldo);
udelay(100);
printk("%s,line=%d END\n", __func__,__LINE__);
return 0;
}
static struct regulator_consumer_supply tps65910_smps1_supply[] = {
{
.supply = "vdd1",
},
{
.supply = "vdd_cpu",
},
};
static struct regulator_consumer_supply tps65910_smps2_supply[] = {
{
.supply = "vdd2",
},
};
static struct regulator_consumer_supply tps65910_smps3_supply[] = {
{
.supply = "vdd3",
},
};
static struct regulator_consumer_supply tps65910_smps4_supply[] = {
{
.supply = "vio",
},
};
static struct regulator_consumer_supply tps65910_ldo1_supply[] = {
{
.supply = "vdig1",
},
};
static struct regulator_consumer_supply tps65910_ldo2_supply[] = {
{
.supply = "vdig2",
},
};
static struct regulator_consumer_supply tps65910_ldo3_supply[] = {
{
.supply = "vaux1",
},
};
static struct regulator_consumer_supply tps65910_ldo4_supply[] = {
{
.supply = "vaux2",
},
};
static struct regulator_consumer_supply tps65910_ldo5_supply[] = {
{
.supply = "vaux33",
},
};
static struct regulator_consumer_supply tps65910_ldo6_supply[] = {
{
.supply = "vmmc",
},
};
static struct regulator_consumer_supply tps65910_ldo7_supply[] = {
{
.supply = "vdac",
},
};
static struct regulator_consumer_supply tps65910_ldo8_supply[] = {
{
.supply = "vpll",
},
};
static struct regulator_init_data tps65910_smps1 = {
.constraints = {
.name = "VDD1",
.min_uV = 600000,
.max_uV = 1500000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_smps1_supply),
.consumer_supplies = tps65910_smps1_supply,
};
/* */
static struct regulator_init_data tps65910_smps2 = {
.constraints = {
.name = "VDD2",
.min_uV = 600000,
.max_uV = 1500000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_smps2_supply),
.consumer_supplies = tps65910_smps2_supply,
};
/* */
static struct regulator_init_data tps65910_smps3 = {
.constraints = {
.name = "VDD3",
.min_uV = 1000000,
.max_uV = 1400000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_smps3_supply),
.consumer_supplies = tps65910_smps3_supply,
};
static struct regulator_init_data tps65910_smps4 = {
.constraints = {
.name = "VIO",
.min_uV = 1800000,
.max_uV = 3300000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_smps4_supply),
.consumer_supplies = tps65910_smps4_supply,
};
static struct regulator_init_data tps65910_ldo1 = {
.constraints = {
.name = "VDIG1",
.min_uV = 1200000,
.max_uV = 2700000,
.apply_uV = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_ldo1_supply),
.consumer_supplies = tps65910_ldo1_supply,
};
/* */
static struct regulator_init_data tps65910_ldo2 = {
.constraints = {
.name = "VDIG2",
.min_uV = 1000000,
.max_uV = 1800000,
.apply_uV = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_ldo2_supply),
.consumer_supplies = tps65910_ldo2_supply,
};
/* */
static struct regulator_init_data tps65910_ldo3 = {
.constraints = {
.name = "VAUX1",
.min_uV = 1800000,
.max_uV = 3300000,
.apply_uV = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_ldo3_supply),
.consumer_supplies = tps65910_ldo3_supply,
};
/* */
static struct regulator_init_data tps65910_ldo4 = {
.constraints = {
.name = "VAUX2",
.min_uV = 1800000,
.max_uV = 3300000,
.apply_uV = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_ldo4_supply),
.consumer_supplies = tps65910_ldo4_supply,
};
/* */
static struct regulator_init_data tps65910_ldo5 = {
.constraints = {
.name = "VAUX33",
.min_uV = 1800000,
.max_uV = 3300000,
.apply_uV = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_ldo5_supply),
.consumer_supplies = tps65910_ldo5_supply,
};
/* */
static struct regulator_init_data tps65910_ldo6 = {
.constraints = {
.name = "VMMC",
.min_uV = 1800000,
.max_uV = 3300000,
.apply_uV = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_ldo6_supply),
.consumer_supplies = tps65910_ldo6_supply,
};
/* */
static struct regulator_init_data tps65910_ldo7 = {
.constraints = {
.name = "VDAC",
.min_uV = 1800000,
.max_uV = 2850000,
.apply_uV = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_ldo7_supply),
.consumer_supplies = tps65910_ldo7_supply,
};
/* */
static struct regulator_init_data tps65910_ldo8 = {
.constraints = {
.name = "VPLL",
.min_uV = 1000000,
.max_uV = 2500000,
.apply_uV = 1,
.always_on = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE,
.valid_modes_mask = REGULATOR_MODE_STANDBY | REGULATOR_MODE_NORMAL,
},
.num_consumer_supplies = ARRAY_SIZE(tps65910_ldo8_supply),
.consumer_supplies = tps65910_ldo8_supply,
};
void __sramfunc board_pmu_suspend(void)
{
int ret;
ret = gpio_readl(GPIO_SWPORTA_DDR);
gpio_writel(ret | GPIO1_A1_OUTPUT, GPIO_SWPORTA_DDR);
ret = gpio_readl(GPIO_SWPORTA_DR);
gpio_writel(ret | GPIO1_A1_OUTPUT_HIGH, GPIO_SWPORTA_DR); //set pmu_sleep output high
}
void __sramfunc board_pmu_resume(void)
{
int ret;
ret = gpio_readl(GPIO_SWPORTA_DDR);
gpio_writel(ret | GPIO1_A1_OUTPUT, GPIO_SWPORTA_DDR);
ret = gpio_readl(GPIO_SWPORTA_DR);
gpio_writel(ret & GPIO1_A1_OUTPUT_LOW, GPIO_SWPORTA_DR); //set pmu_sleep output low
sram_udelay(2000);
}
static struct tps65910_board tps65910_data = {
.irq = (unsigned)TPS65910_HOST_IRQ,
.irq_base = NR_GIC_IRQS + NR_GPIO_IRQS,
.gpio_base = TPS65910_GPIO_EXPANDER_BASE,
.pre_init = tps65910_pre_init,
.post_init = tps65910_post_init,
//TPS65910_NUM_REGS = 13
// Regulators
.tps65910_pmic_init_data[TPS65910_REG_VRTC] = NULL,
.tps65910_pmic_init_data[TPS65910_REG_VIO] = &tps65910_smps4,
.tps65910_pmic_init_data[TPS65910_REG_VDD1] = &tps65910_smps1,
.tps65910_pmic_init_data[TPS65910_REG_VDD2] = &tps65910_smps2,
.tps65910_pmic_init_data[TPS65910_REG_VDD3] = &tps65910_smps3,
.tps65910_pmic_init_data[TPS65910_REG_VDIG1] = &tps65910_ldo1,
.tps65910_pmic_init_data[TPS65910_REG_VDIG2] = &tps65910_ldo2,
.tps65910_pmic_init_data[TPS65910_REG_VPLL] = &tps65910_ldo8,
.tps65910_pmic_init_data[TPS65910_REG_VDAC] = &tps65910_ldo7,
.tps65910_pmic_init_data[TPS65910_REG_VAUX1] = &tps65910_ldo3,
.tps65910_pmic_init_data[TPS65910_REG_VAUX2] = &tps65910_ldo4,
.tps65910_pmic_init_data[TPS65910_REG_VAUX33] = &tps65910_ldo5,
.tps65910_pmic_init_data[TPS65910_REG_VMMC] = &tps65910_ldo6,
};
#endif

View File

@ -0,0 +1,889 @@
/* arch/arm/mach-rk2928/board-rk2928-fpga.c
*
* Copyright (C) 2012 ROCKCHIP, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/input.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/skbuff.h>
#include <linux/spi/spi.h>
#include <linux/mmc/host.h>
#include <linux/ion.h>
#include <linux/cpufreq.h>
#include <linux/clk.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/flash.h>
#include <asm/hardware/gic.h>
#include <mach/dvfs.h>
#include <mach/board.h>
#include <mach/hardware.h>
#include <mach/io.h>
#include <mach/gpio.h>
#include <mach/iomux.h>
#include <linux/fb.h>
#include <linux/regulator/machine.h>
#include <linux/rfkill-rk.h>
#include <linux/sensor-dev.h>
#include <linux/mfd/tps65910.h>
#include <linux/regulator/rk29-pwm-regulator.h>
#if defined(CONFIG_HDMI_RK30)
#include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
#endif
#if defined(CONFIG_SPIM_RK29)
#include "../../../drivers/spi/rk29_spim.h"
#endif
#ifdef CONFIG_GPIOEXP_AW9523B
#include <linux/gpio_exp_callpad.h>
#endif
#include "board-rk2928-phonepad-camera.c"
#include "board-rk2928-phonepad-key.c"
#ifdef CONFIG_THREE_FB_BUFFER
#define RK30_FB0_MEM_SIZE 12*SZ_1M
#else
#define RK30_FB0_MEM_SIZE 8*SZ_1M
#endif
static struct spi_board_info board_spi_devices[] = {
};
/***********************************************************
* rk30 backlight
************************************************************/
#ifdef CONFIG_BACKLIGHT_RK29_BL
#define PWM_ID 0
#define PWM_MUX_NAME GPIO0D2_PWM_0_NAME
#define PWM_MUX_MODE GPIO0D_PWM_0
#define PWM_MUX_MODE_GPIO GPIO0D_GPIO0D2
#define PWM_GPIO RK2928_PIN0_PD2
#define PWM_EFFECT_VALUE 1
//#define LCD_DISP_ON_PIN
#ifdef LCD_DISP_ON_PIN
#define BL_EN_PIN RK2928_PIN1_PB0
#define BL_EN_VALUE GPIO_HIGH
#endif
static int rk29_backlight_io_init(void)
{
int ret = 0;
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
#ifdef LCD_DISP_ON_PIN
// rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
ret = gpio_request(BL_EN_PIN, NULL);
if (ret != 0) {
gpio_free(BL_EN_PIN);
}
gpio_direction_output(BL_EN_PIN, 0);
gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
#endif
return ret;
}
static int rk29_backlight_io_deinit(void)
{
int ret = 0;
#ifdef LCD_DISP_ON_PIN
gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
gpio_free(BL_EN_PIN);
#endif
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
return ret;
}
static int rk29_backlight_pwm_suspend(void)
{
int ret = 0;
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
if (gpio_request(PWM_GPIO, NULL)) {
printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
return -1;
}
gpio_direction_output(PWM_GPIO, GPIO_LOW);
#ifdef LCD_DISP_ON_PIN
gpio_direction_output(BL_EN_PIN, 0);
gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
#endif
return ret;
}
static int rk29_backlight_pwm_resume(void)
{
gpio_free(PWM_GPIO);
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
#ifdef LCD_DISP_ON_PIN
msleep(30);
gpio_direction_output(BL_EN_PIN, 1);
gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
#endif
return 0;
}
static struct rk29_bl_info rk29_bl_info = {
.pwm_id = PWM_ID,
.min_brightness = 80,
.bl_ref = PWM_EFFECT_VALUE,
.io_init = rk29_backlight_io_init,
.io_deinit = rk29_backlight_io_deinit,
.pwm_suspend = rk29_backlight_pwm_suspend,
.pwm_resume = rk29_backlight_pwm_resume,
};
static struct platform_device rk29_device_backlight = {
.name = "rk29_backlight",
.id = -1,
.dev = {
.platform_data = &rk29_bl_info,
}
};
#endif
#ifdef CONFIG_FB_ROCKCHIP
#define LCD_EN GPIOEXP_P1_0
#define LCD_EN_VALUE GPIO_LOW
#define LCD_STB GPIOEXP_P1_6
#define LCD_STB_VALUE GPIO_LOW
static int rk_fb_io_init(struct rk29_fb_setting_info *fb_setting)
{
gpioexp_set_direction(LCD_EN,0);
gpioexp_set_output_level(LCD_EN,LCD_EN_VALUE);
gpioexp_set_direction(LCD_STB,0);
gpioexp_set_output_level(LCD_STB,!LCD_STB_VALUE);
return 0;
}
static int rk_fb_io_disable(void)
{
gpioexp_set_output_level(LCD_EN, !LCD_EN_VALUE);
return 0;
}
static int rk_fb_io_enable(void)
{
gpioexp_set_output_level(LCD_EN, LCD_EN_VALUE);
return 0;
}
#if defined(CONFIG_LCDC_RK2928)
struct rk29fb_info lcdc_screen_info = {
.prop = PRMRY, //primary display device
.io_init = rk_fb_io_init,
.io_disable = rk_fb_io_disable,
.io_enable = rk_fb_io_enable,
.set_screen_info = set_lcd_info,
};
#endif
static struct resource resource_fb[] = {
[0] = {
.name = "fb0 buf",
.start = 0,
.end = 0,//RK30_FB0_MEM_SIZE - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.name = "ipp buf", //for rotate
.start = 0,
.end = 0,//RK30_FB0_MEM_SIZE - 1,
.flags = IORESOURCE_MEM,
},
[2] = {
.name = "fb2 buf",
.start = 0,
.end = 0,//RK30_FB0_MEM_SIZE - 1,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device device_fb = {
.name = "rk-fb",
.id = -1,
.num_resources = ARRAY_SIZE(resource_fb),
.resource = resource_fb,
};
#endif
//LCDC
#ifdef CONFIG_LCDC_RK2928
static struct resource resource_lcdc[] = {
[0] = {
.name = "lcdc reg",
.start = RK2928_LCDC_PHYS,
.end = RK2928_LCDC_PHYS + RK2928_LCDC_SIZE - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.name = "lcdc irq",
.start = IRQ_LCDC,
.end = IRQ_LCDC,
.flags = IORESOURCE_IRQ,
},
};
static struct platform_device device_lcdc = {
.name = "rk2928-lcdc",
.id = 0,
.num_resources = ARRAY_SIZE(resource_lcdc),
.resource = resource_lcdc,
.dev = {
.platform_data = &lcdc_screen_info,
},
};
#endif
#ifdef CONFIG_ION
#define ION_RESERVE_SIZE (80 * SZ_1M)
static struct ion_platform_data rk30_ion_pdata = {
.nr = 1,
.heaps = {
{
.type = ION_HEAP_TYPE_CARVEOUT,
.id = ION_NOR_HEAP_ID,
.name = "norheap",
.size = ION_RESERVE_SIZE,
}
},
};
static struct platform_device device_ion = {
.name = "ion-rockchip",
.id = 0,
.dev = {
.platform_data = &rk30_ion_pdata,
},
};
#endif
#if defined (CONFIG_TOUCHSCREEN_I30)
#define TOUCH_RESET_PIN GPIOEXP_P1_1
#define TOUCH_INT_PIN RK2928_PIN1_PC6
int ft5306_init_platform_hw(void)
{
struct regulator *ldo;
// printk("ft5306_init_platform_hw\n");
ldo = regulator_get(NULL, "vaux33");
regulator_disable(ldo);
if(gpio_request(TOUCH_INT_PIN,NULL) != 0)
{
gpio_free(TOUCH_INT_PIN);
printk("ift5306_init_platform_hw TOUCH_INT_PIN error\n");
return -EIO;
}
gpio_direction_input(TOUCH_INT_PIN);
gpioexp_set_direction(TOUCH_RESET_PIN,0);
gpioexp_set_output_level(TOUCH_RESET_PIN,GPIO_HIGH);
msleep(50);
regulator_enable(ldo);
regulator_put(ldo);
msleep(300);
return 0;
}
void ft5306_exit_platform_hw(void)
{
// printk("ft5306_exit_platform_hw\n");
gpio_free(TOUCH_RESET_PIN);
gpio_free(TOUCH_INT_PIN);
}
int ft5306_platform_sleep(void)
{
#if 0
struct regulator *ldo;
ldo = regulator_get(NULL, "ldo9");
regulator_disable(ldo);
regulator_put(ldo);
printk("ft5306_platform_sleep\n");
#endif
// gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);
return 0;
}
int ft5306_platform_wakeup(void)
{
#if 0
struct regulator *ldo;
ldo = regulator_get(NULL, "ldo9");
regulator_set_voltage(ldo, 3300000, 3300000);
regulator_enable(ldo);
regulator_put(ldo);
printk("ft5306_platform_wakeup\n");
#endif
// gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);
msleep(300);
return 0;
}
struct ft5306_platform_data ft5306_info = {
.irq_pin = TOUCH_INT_PIN,
.rest_pin = TOUCH_RESET_PIN,
.init_platform_hw= ft5306_init_platform_hw,
.exit_platform_hw= ft5306_exit_platform_hw,
.platform_sleep = ft5306_platform_sleep,
.platform_wakeup = ft5306_platform_wakeup,
};
#endif
/*MMA7660 gsensor*/
#if defined (CONFIG_GS_MMA7660)
#define MMA7660_INT_PIN RK2928_PIN1_PB1
static int mma7660_init_platform_hw(void)
{
rk30_mux_api_set(GPIO1B1_SPI_TXD_UART1_SOUT_NAME, GPIO1B_GPIO1B1);
return 0;
}
static struct sensor_platform_data mma7660_info = {
.type = SENSOR_TYPE_ACCEL,
.irq_enable = 1,
.poll_delay_ms = 30,
.init_platform_hw = mma7660_init_platform_hw,
.orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
};
#endif
#if CONFIG_RK30_PWM_REGULATOR
const static int pwm_voltage_map[] = {
1000000, 1025000, 1050000, 1075000, 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, 1300000, 1325000, 1350000, 1375000, 1400000
};
static struct regulator_consumer_supply pwm_dcdc1_consumers[] = {
{
.supply = "vdd_core",
}
};
struct regulator_init_data pwm_regulator_init_dcdc[1] =
{
{
.constraints = {
.name = "PWM_DCDC1",
.min_uV = 600000,
.max_uV = 1800000, //0.6-1.8V
.apply_uV = true,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE,
},
.num_consumer_supplies = ARRAY_SIZE(pwm_dcdc1_consumers),
.consumer_supplies = pwm_dcdc1_consumers,
},
};
static struct pwm_platform_data pwm_regulator_info[1] = {
{
.pwm_id = 2,
.pwm_gpio = RK2928_PIN0_PD4,
.pwm_iomux_name = GPIO0D4_PWM_2_NAME,
.pwm_iomux_pwm = GPIO0D_PWM_2,
.pwm_iomux_gpio = GPIO0D_GPIO0D4,
.pwm_voltage = 1200000,
.suspend_voltage = 1050000,
.min_uV = 1000000,
.max_uV = 1400000,
.coefficient = 455, //45.5%
.pwm_voltage_map = pwm_voltage_map,
.init_data = &pwm_regulator_init_dcdc[0],
},
};
struct platform_device pwm_regulator_device[1] = {
{
.name = "pwm-voltage-regulator",
.id = 0,
.dev = {
.platform_data = &pwm_regulator_info[0],
}
},
};
#endif
/**************************************************************************************************
* SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
**************************************************************************************************/
#ifdef CONFIG_SDMMC_RK29
#include "board-rk2928-sdk-sdmmc.c"
#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
#define SDMMC0_WRITE_PROTECT_PIN RK2928_PIN1_PA7 //According to your own project to set the value of write-protect-pin.
#endif
#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
#define SDMMC1_WRITE_PROTECT_PIN RK2928_PIN0_PD5 //According to your own project to set the value of write-protect-pin.
#endif
#define RK29SDK_WIFI_SDIO_CARD_DETECT_N RK2928_PIN0_PB2
#endif //endif ---#ifdef CONFIG_SDMMC_RK29
#ifdef CONFIG_SDMMC0_RK29
static int rk29_sdmmc0_cfg_gpio(void)
{
rk29_sdmmc_set_iomux(0, 0xFFFF);
rk30_mux_api_set(GPIO1C1_MMC0_DETN_NAME, GPIO1C_MMC0_DETN);
#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
gpio_request(SDMMC0_WRITE_PROTECT_PIN, "sdmmc-wp");
gpio_direction_input(SDMMC0_WRITE_PROTECT_PIN);
#endif
return 0;
}
#define CONFIG_SDMMC0_USE_DMA
struct rk29_sdmmc_platform_data default_sdmmc0_data = {
.host_ocr_avail =
(MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36),
.host_caps =
(MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
.io_init = rk29_sdmmc0_cfg_gpio,
#if !defined(CONFIG_SDMMC_RK29_OLD)
.set_iomux = rk29_sdmmc_set_iomux,
#endif
.dma_name = "sd_mmc",
#ifdef CONFIG_SDMMC0_USE_DMA
.use_dma = 1,
#else
.use_dma = 0,
#endif
.detect_irq = RK2928_PIN1_PC1, // INVALID_GPIO
.enable_sd_wakeup = 0,
#if defined(CONFIG_SDMMC0_RK29_WRITE_PROTECT)
.write_prt = SDMMC0_WRITE_PROTECT_PIN,
#else
.write_prt = INVALID_GPIO,
#endif
};
#endif // CONFIG_SDMMC0_RK29
#ifdef CONFIG_SDMMC1_RK29
#define CONFIG_SDMMC1_USE_DMA
static int rk29_sdmmc1_cfg_gpio(void)
{
#if defined(CONFIG_SDMMC_RK29_OLD)
rk30_mux_api_set(GPIO0B0_MMC1_CMD_NAME, GPIO0B_MMC1_CMD);
rk30_mux_api_set(GPIO0B1_MMC1_CLKOUT_NAME, GPIO0B_MMC1_CLKOUT);
rk30_mux_api_set(GPIO0B3_MMC1_D0_NAME, GPIO0B_MMC1_D0);
rk30_mux_api_set(GPIO0B4_MMC1_D1_NAME, GPIO0B_MMC1_D1);
rk30_mux_api_set(GPIO0B5_MMC1_D2_NAME, GPIO0B_MMC1_D2);
rk30_mux_api_set(GPIO0B6_MMC1_D3_NAME, GPIO0B_MMC1_D3);
//rk30_mux_api_set(GPIO0B2_MMC1_DETN_NAME, GPIO0B_MMC1_DETN);
#else
#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
gpio_request(SDMMC1_WRITE_PROTECT_PIN, "sdio-wp");
gpio_direction_input(SDMMC1_WRITE_PROTECT_PIN);
#endif
#endif
return 0;
}
struct rk29_sdmmc_platform_data default_sdmmc1_data = {
.host_ocr_avail =
(MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 | MMC_VDD_28_29 |
MMC_VDD_29_30 | MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 |
MMC_VDD_33_34),
#if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
.host_caps = (MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ |
MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
#else
.host_caps =
(MMC_CAP_4_BIT_DATA | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
#endif
.io_init = rk29_sdmmc1_cfg_gpio,
#if !defined(CONFIG_SDMMC_RK29_OLD)
.set_iomux = rk29_sdmmc_set_iomux,
#endif
.dma_name = "sdio",
#ifdef CONFIG_SDMMC1_USE_DMA
.use_dma = 1,
#else
.use_dma = 0,
#endif
#if !defined(CONFIG_USE_SDMMC1_FOR_WIFI_DEVELOP_BOARD)
#ifdef CONFIG_WIFI_CONTROL_FUNC
.status = rk29sdk_wifi_status,
.register_status_notify = rk29sdk_wifi_status_register,
#endif
#if 0
.detect_irq = RK29SDK_WIFI_SDIO_CARD_DETECT_N,
#endif
#if defined(CONFIG_SDMMC1_RK29_WRITE_PROTECT)
.write_prt = SDMMC1_WRITE_PROTECT_PIN,
#else
.write_prt = INVALID_GPIO,
#endif
#else
.detect_irq = INVALID_GPIO,
.enable_sd_wakeup = 0,
#endif
};
#endif //endif--#ifdef CONFIG_SDMMC1_RK29
#ifdef CONFIG_SND_SOC_RK2928
static struct resource resources_acodec[] = {
{
.start = RK2928_ACODEC_PHYS,
.end = RK2928_ACODEC_PHYS + RK2928_ACODEC_SIZE - 1,
.flags = IORESOURCE_MEM,
},
{
.start = RK2928_PIN1_PA0,
.end = RK2928_PIN1_PA0,
.flags = IORESOURCE_IO,
},
};
static struct platform_device device_acodec = {
.name = "rk2928-codec",
.id = -1,
.num_resources = ARRAY_SIZE(resources_acodec),
.resource = resources_acodec,
};
#endif
static struct platform_device *devices[] __initdata = {
#ifdef CONFIG_FB_ROCKCHIP
&device_fb,
#endif
#ifdef CONFIG_LCDC_RK2928
&device_lcdc,
#endif
#ifdef CONFIG_BACKLIGHT_RK29_BL
&rk29_device_backlight,
#endif
#ifdef CONFIG_ION
&device_ion,
#endif
#ifdef CONFIG_SND_SOC_RK2928
&device_acodec,
#endif
};
//i2c
#ifdef CONFIG_I2C0_RK30
#ifdef CONFIG_MFD_TPS65910
#define TPS65910_HOST_IRQ RK2928_PIN1_PC7
#include "board-rk2928-phonepad-tps65910.c"
#endif
#ifdef CONFIG_REGULATOR_ACT8931
#include "board-rk2928-sdk-act8931.c"
#endif
static struct i2c_board_info __initdata i2c0_info[] = {
#if defined (CONFIG_MFD_TPS65910)
{
.type = "tps65910",
.addr = TPS65910_I2C_ID0,
.flags = 0,
.irq = TPS65910_HOST_IRQ,
.platform_data = &tps65910_data,
},
#endif
#if defined (CONFIG_REGULATOR_ACT8931)
{
.type = "act8931",
.addr = 0x5b,
.flags = 0,
.platform_data=&act8931_data,
},
#endif
};
#endif
#if defined (CONFIG_GPIOEXP_AW9523B)
#define AW9523B_INT_PIN RK2928_PIN0_PC3
static int aw9523b_init_hw(void)
{
if(gpio_request(AW9523B_INT_PIN,NULL) != 0)
{
gpio_free(AW9523B_INT_PIN);
printk("aw9523b_init_hw AW9523B_INT_PIN error\n");
return -EIO;
}
gpio_direction_input(AW9523B_INT_PIN);
return 0;
}
static void aw9523b_exit_hw(void)
{
gpio_free(AW9523B_INT_PIN);
}
static struct gpio_exp_platform_data aw9523b_data = {
.init_platform_hw = aw9523b_init_hw,
.exit_platform_hw = aw9523b_exit_hw,
};
#endif
#ifdef CONFIG_I2C1_RK30
static struct i2c_board_info __initdata i2c1_info[] = {
#if defined (CONFIG_GS_MMA7660)
{
.type = "gs_mma7660",
.addr = 0x4c,
.flags = 0,
.irq = MMA7660_INT_PIN,
.platform_data = &mma7660_info,
},
#endif
#ifdef CONFIG_RDA5990
#define RDA_WIFI_CORE_ADDR (0x13)
#define RDA_WIFI_RF_ADDR (0x14) //correct add is 0x14
#define RDA_BT_CORE_ADDR (0x15)
#define RDA_BT_RF_ADDR (0x16)
#define RDA_WIFI_RF_I2C_DEVNAME "rda_wifi_rf_i2c"
#define RDA_WIFI_CORE_I2C_DEVNAME "rda_wifi_core_i2c"
#define RDA_BT_RF_I2C_DEVNAME "rda_bt_rf_i2c"
#define RDA_BT_CORE_I2C_DEVNAME "rda_bt_core_i2c"
{
.type = RDA_WIFI_CORE_I2C_DEVNAME,
.addr = RDA_WIFI_CORE_ADDR,
.flags = 0,
},
{
.type = RDA_WIFI_RF_I2C_DEVNAME,
.addr = RDA_WIFI_RF_ADDR,
.flags = 0,
},
{
.type = RDA_BT_CORE_I2C_DEVNAME,
.addr = RDA_BT_CORE_ADDR,
.flags = 0,
},
{
.type = RDA_BT_RF_I2C_DEVNAME,
.addr = RDA_BT_RF_ADDR,
.flags = 0,
},
#endif
#if defined (CONFIG_GPIOEXP_AW9523B)
{
.type = "gpioexp_aw9523b",
.addr = 0x59,
.flags = 0,
.irq = AW9523B_INT_PIN,
.platform_data = &aw9523b_data,
},
#endif
};
#endif
#ifdef CONFIG_I2C2_RK30
static struct i2c_board_info __initdata i2c2_info[] = {
#if defined (CONFIG_TOUCHSCREEN_I30)
{
.type = "ft5x0x_ts",
.addr = 0x38,
.flags = 0,
.irq = TOUCH_INT_PIN,
.platform_data = &ft5306_info,
},
#endif
};
#endif
#ifdef CONFIG_I2C3_RK30
static struct i2c_board_info __initdata i2c3_info[] = {
};
#endif
#ifdef CONFIG_I2C_GPIO_RK30
#define I2C_SDA_PIN INVALID_GPIO //set sda_pin here
#define I2C_SCL_PIN INVALID_GPIO //set scl_pin here
static int rk30_i2c_io_init(void)
{
//set iomux (gpio) here
return 0;
}
struct i2c_gpio_platform_data default_i2c_gpio_data = {
.sda_pin = I2C_SDA_PIN,
.scl_pin = I2C_SCL_PIN,
.udelay = 5, // clk = 500/udelay = 100Khz
.timeout = 100,//msecs_to_jiffies(100),
.bus_num = 5,
.io_init = rk30_i2c_io_init,
};
static struct i2c_board_info __initdata i2c_gpio_info[] = {
};
#endif
static void __init rk30_i2c_register_board_info(void)
{
#ifdef CONFIG_I2C0_RK30
i2c_register_board_info(0, i2c0_info, ARRAY_SIZE(i2c0_info));
#endif
#ifdef CONFIG_I2C1_RK30
i2c_register_board_info(1, i2c1_info, ARRAY_SIZE(i2c1_info));
#endif
#ifdef CONFIG_I2C2_RK30
i2c_register_board_info(2, i2c2_info, ARRAY_SIZE(i2c2_info));
#endif
#ifdef CONFIG_I2C3_RK30
i2c_register_board_info(3, i2c3_info, ARRAY_SIZE(i2c3_info));
#endif
#ifdef CONFIG_I2C_GPIO_RK30
i2c_register_board_info(4, i2c_gpio_info, ARRAY_SIZE(i2c_gpio_info));
#endif
}
//end of i2c
#define POWER_ON_PIN RK2928_PIN1_PA2 //power_hold
static void rk2928_pm_power_off(void)
{
printk(KERN_ERR "rk2928_pm_power_off start...\n");
#if defined(CONFIG_MFD_TPS65910)
tps65910_device_shutdown();//tps65910 shutdown
#endif
gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
};
static void __init rk2928_board_init(void)
{
gpio_request(POWER_ON_PIN, "poweronpin");
gpio_direction_output(POWER_ON_PIN, GPIO_HIGH);
gpio_free(POWER_ON_PIN);
pm_power_off = rk2928_pm_power_off;
rk30_i2c_register_board_info();
spi_register_board_info(board_spi_devices, ARRAY_SIZE(board_spi_devices));
platform_add_devices(devices, ARRAY_SIZE(devices));
}
static void __init rk2928_reserve(void)
{
#ifdef CONFIG_ION
rk30_ion_pdata.heaps[0].base = board_mem_reserve_add("ion", ION_RESERVE_SIZE);
#endif
#ifdef CONFIG_FB_ROCKCHIP
resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
#endif
#ifdef CONFIG_VIDEO_RK29
rk30_camera_request_reserve_mem();
#endif
board_mem_reserved();
}
/**
* dvfs_cpu_logic_table: table for arm and logic dvfs
* @frequency : arm frequency
* @cpu_volt : arm voltage depend on frequency
* @logic_volt : logic voltage arm requests depend on frequency
* comments : min arm/logic voltage
*/
static struct dvfs_arm_table dvfs_cpu_logic_table[] = {
{.frequency = 216 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},//0.975V/1.000V
{.frequency = 312 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},//0.975V/1.000V
{.frequency = 408 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},//1.000V/1.025V
{.frequency = 504 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},//1.000V/1.025V
{.frequency = 600 * 1000, .cpu_volt = 1200 * 1000, .logic_volt = 1200 * 1000},//1.025V/1.050V
{.frequency = 696 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.000V/1.025V
{.frequency = 816 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
//{.frequency = 912 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
//{.frequency = 1008 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
#if 0
{.frequency = 1104 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
{.frequency = 1200 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
{.frequency = 1104 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
{.frequency = 1248 * 1000, .cpu_volt = 1400 * 1000, .logic_volt = 1200 * 1000},//1.100V/1.050V
#endif
//{.frequency = 1000 * 1000, .cpu_volt = 1225 * 1000, .logic_volt = 1200 * 1000},//1.150V/1.100V
{.frequency = CPUFREQ_TABLE_END},
};
static struct cpufreq_frequency_table dvfs_gpu_table[] = {
{.frequency = 266 * 1000, .index = 1050 * 1000},
{.frequency = 400 * 1000, .index = 1275 * 1000},
{.frequency = CPUFREQ_TABLE_END},
};
static struct cpufreq_frequency_table dvfs_ddr_table[] = {
{.frequency = 300 * 1000, .index = 1050 * 1000},
{.frequency = 400 * 1000, .index = 1125 * 1000},
{.frequency = CPUFREQ_TABLE_END},
};
#define DVFS_CPU_TABLE_SIZE (ARRAY_SIZE(dvfs_cpu_logic_table))
static struct cpufreq_frequency_table cpu_dvfs_table[DVFS_CPU_TABLE_SIZE];
static struct cpufreq_frequency_table dep_cpu2core_table[DVFS_CPU_TABLE_SIZE];
void __init board_clock_init(void)
{
rk2928_clock_data_init(periph_pll_default, codec_pll_default, RK30_CLOCKS_DEFAULT_FLAGS);
dvfs_set_arm_logic_volt(dvfs_cpu_logic_table, cpu_dvfs_table, dep_cpu2core_table);
dvfs_set_freq_volt_table(clk_get(NULL, "gpu"), dvfs_gpu_table);
//dvfs_set_freq_volt_table(clk_get(NULL, "ddr"), dvfs_ddr_table);
printk("%s end\n", __func__);
}
MACHINE_START(RK2928, "RK2928board")
.boot_params = PLAT_PHYS_OFFSET + 0x800,
.fixup = rk2928_fixup,
.reserve = &rk2928_reserve,
.map_io = rk2928_map_io,
.init_irq = rk2928_init_irq,
.timer = &rk2928_timer,
.init_machine = rk2928_board_init,
MACHINE_END