improve mtk23d driver's compatibility

This commit is contained in:
luowei 2011-04-15 10:36:37 +08:00
parent cccbc4a790
commit 99331f5bc0
5 changed files with 75 additions and 36 deletions

View File

@ -2154,24 +2154,38 @@ static struct platform_device rk29_device_pwm_regulator = {
#if defined(CONFIG_MTK23D)
static int mtk23d_io_init(void)
{
return 0;
}
static int mtk23d_io_deinit(void)
{
return 0;
}
struct rk2818_23d_data rk2818_23d_info = {
.bp_power = RK29_PIN0_PA0,
.bp_reset = RK29_PIN0_PA1,
.bp_statue = RK29_PIN0_PA3,//input high bp sleep;
.ap_statue = RK29_PIN0_PA2,//output high ap sleep;
.ap_bp_wakeup = RK29_PIN0_PA4, //output AP wake up BP used rising edge;
//.bp_ap_wakeup = RK2818_PIN_PE0,//input BP wake up AP
.io_init = mtk23d_io_init,
.io_deinit = mtk23d_io_deinit,
.bp_power = RK29_PIN6_PB0,
.bp_power_active_low = 0,
.bp_reset = RK29_PIN6_PB1,
.bp_reset_active_low = 0,
.bp_statue = RK29_PIN0_PA2,//input high bp sleep;
.ap_statue = RK29_PIN0_PA3,//output high ap sleep;
.ap_bp_wakeup = RK29_PIN0_PA0, //output AP wake up BP used rising edge;
//.bp_ap_wakeup = RK2818_PIN_PA4,//input BP wake up AP
};
struct platform_device rk2818_device_mtk23d = {
.name = "mtk23d",
.id = -1,
.dev = {
.platform_data = &rk2818_23d_info,
}
struct platform_device rk2818_device_mtk23d = {
.name = "mtk23d",
.id = -1,
.dev = {
.platform_data = &rk2818_23d_info,
}
};
#endif
/*****************************************************************************************
* SDMMC devices
*****************************************************************************************/
@ -2904,7 +2918,7 @@ static struct kobj_attribute rk29xx_virtual_keys_attr = {
.name = "virtualkeys.hx8520-touchscreen",
#elif defined(CONFIG_TOUCHSCREEN_GT801_IIC)
.name = "virtualkeys.gt801-touchscreen",
#elif defined(CONFIG_TOUCHSCREEN_GT801_IIC)
#elif defined(CONFIG_TOUCHSCREEN_ILI2102_IIC)
.name = "virtualkeys.ili2102-touchscreen",
#endif
@ -3000,7 +3014,7 @@ static void __init machine_rk29_board_init(void)
rk29sdk_init_wifi_mem();
#endif
//rk29xx_virtual_keys_init();
rk29xx_virtual_keys_init();
}
static void __init machine_rk29_fixup(struct machine_desc *desc, struct tag *tags,

View File

@ -729,6 +729,9 @@ static struct regulator_consumer_supply dcdc1_consumers[] = {
static struct regulator_consumer_supply dcdc2_consumers[] = {
{
.supply = "dcdc2",
},
{
.supply = "vcore",
}
};
static struct regulator_consumer_supply dcdc3_consumers[] = {
@ -2151,9 +2154,24 @@ static struct platform_device rk29_device_pwm_regulator = {
#if defined(CONFIG_MTK23D)
static int mtk23d_io_init(void)
{
return 0;
}
static int mtk23d_io_deinit(void)
{
return 0;
}
struct rk2818_23d_data rk2818_23d_info = {
.io_init = mtk23d_io_init,
.io_deinit = mtk23d_io_deinit,
.bp_power = RK29_PIN0_PA0,
.bp_power_active_low = 0,
.bp_reset = RK29_PIN0_PA1,
.bp_reset_active_low = 1,
.bp_statue = RK29_PIN0_PA3,//input high bp sleep;
.ap_statue = RK29_PIN0_PA2,//output high ap sleep;
.ap_bp_wakeup = RK29_PIN0_PA4, //output AP wake up BP used rising edge;
@ -2899,6 +2917,8 @@ static struct kobj_attribute rk29xx_virtual_keys_attr = {
.name = "virtualkeys.hx8520-touchscreen",
#elif defined(CONFIG_TOUCHSCREEN_GT801_IIC)
.name = "virtualkeys.gt801-touchscreen",
#elif defined(CONFIG_TOUCHSCREEN_ILI2102_IIC)
.name = "virtualkeys.ili2102-touchscreen",
#endif

View File

@ -115,7 +115,7 @@ static int mtk23d_open(struct inode *inode, struct file *file)
int ret = 0;
gpio_direction_output(pdata->bp_power, GPIO_HIGH);
gpio_direction_output(pdata->bp_power, pdata->bp_power_active_low? GPIO_LOW:GPIO_HIGH);
gpio_direction_input(pdata->bp_statue);
@ -126,18 +126,19 @@ static int mtk23d_open(struct inode *inode, struct file *file)
gpio_direction_output(pdata->ap_bp_wakeup, GPIO_LOW);
mdelay(100);
//rk2818_mux_api_set(GPIOE_SPI1_FLASH_SEL_NAME, IOMUXA_GPIO1_A3B7);
gpio_direction_output(pdata->bp_reset, GPIO_LOW);
gpio_direction_output(pdata->bp_reset, pdata->bp_reset_active_low? GPIO_LOW:GPIO_HIGH);
mdelay(100);
gpio_set_value(pdata->bp_reset, GPIO_HIGH);
gpio_set_value(pdata->bp_reset, pdata->bp_reset_active_low? GPIO_HIGH:GPIO_LOW);
mdelay(2000);
gpio_set_value(pdata->bp_power, GPIO_LOW);
gpio_set_value(pdata->bp_power, pdata->bp_power_active_low? GPIO_HIGH:GPIO_LOW);
gpio_set_value(pdata->ap_bp_wakeup, GPIO_HIGH);
//INIT_WORK(&mt6223d_data->work, bpwakeup_work_func_work);
device_init_wakeup(&pdev, 1);
printk("%s\n",__FUNCTION__);
return 0;
}
@ -184,6 +185,8 @@ static int mtk23d_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, mt6223d_data);
pdata->io_init();
result = gpio_request(pdata->bp_statue, "mtk23d");
if (result) {
printk("failed to request BP_STATUS gpio\n");
@ -211,32 +214,30 @@ static int mtk23d_probe(struct platform_device *pdev)
printk("failed to request BP_POW_EN gpio\n");
goto err1;
}
#if 0
gpio_direction_output(pdata->bp_power, GPIO_HIGH);
gpio_direction_output(pdata->bp_power, pdata->bp_power_active_low? GPIO_HIGH:GPIO_LOW);
gpio_direction_input(pdata->bp_statue);
rk2818_mux_api_set(CXGPIO_HSADC_SEL_NAME, 0);
//rk2818_mux_api_set(CXGPIO_HSADC_SEL_NAME, 0);
gpio_direction_output(pdata->ap_statue, GPIO_LOW);
rk2818_mux_api_set(GPIOF5_APWM3_DPWM3_NAME,0);
//rk2818_mux_api_set(GPIOF5_APWM3_DPWM3_NAME,0);
gpio_direction_output(pdata->ap_bp_wakeup, GPIO_LOW);
mdelay(100);
//rk2818_mux_api_set(GPIOE_SPI1_FLASH_SEL_NAME, IOMUXA_GPIO1_A3B7);
gpio_direction_output(pdata->bp_reset, pdata->bp_reset_active_low? GPIO_LOW:GPIO_HIGH);
mdelay(100);
gpio_set_value(pdata->bp_reset, pdata->bp_reset_active_low? GPIO_HIGH:GPIO_LOW);
//rk2818_mux_api_set(GPIOE_SPI1_FLASH_SEL_NAME, IOMUXA_GPIO1_A3B7);
gpio_direction_output(pdata->bp_reset, GPIO_LOW);
mdelay(100);
gpio_set_value(pdata->bp_reset, GPIO_HIGH);
mdelay(2000);
gpio_set_value(pdata->bp_power, GPIO_LOW);
gpio_set_value(pdata->bp_power, pdata->bp_power_active_low? GPIO_LOW:GPIO_HIGH);
gpio_set_value(pdata->ap_bp_wakeup, GPIO_HIGH);
//INIT_WORK(&mt6223d_data->work, bpwakeup_work_func_work);
device_init_wakeup(&pdev->dev, 1);
printk("%s:power up modem\n",__FUNCTION__);
#endif
INIT_WORK(&mt6223d_data->work, bpwakeup_work_func_work);
result = misc_register(&mtk23d_misc);

View File

@ -37,7 +37,7 @@
#include "rk2818_serial.h"
#define DBG_PORT 0
#if 1
#if 0
#define DBG(msg...) printk(msg);
#else
#define DBG(...)

View File

@ -11,8 +11,12 @@ struct modem_dev
/* 耳机数据结构体 */
struct rk2818_23d_data {
int (*io_init)(void);
int (*io_deinit)(void);
unsigned int bp_power;
unsigned int bp_power_active_low;
unsigned int bp_reset;
unsigned int bp_reset_active_low;
unsigned int bp_statue;
unsigned int ap_statue;
unsigned int ap_bp_wakeup;