rk30:Support both of compatible pmic wm8326 and tps65910

This commit is contained in:
张晴
2012-08-01 17:13:56 +08:00
parent 40ae8e6015
commit 1f0a3da031
4 changed files with 97 additions and 20 deletions

View File

@@ -1798,6 +1798,9 @@ static struct i2c_board_info __initdata i2c0_info[] = {
};
#endif
#define PMIC_TYPE_WM8326 1
#define PMIC_TYPE_TPS65910 2
int __sramdata g_pmic_type = 0;
#ifdef CONFIG_I2C1_RK30
#ifdef CONFIG_MFD_WM831X_I2C
#include "board-rk30-sdk-wm8326.c"
@@ -1829,6 +1832,25 @@ static struct i2c_board_info __initdata i2c1_info[] = {
};
#endif
void __sramfunc board_pmu_suspend(void)
{
if(g_pmic_type == PMIC_TYPE_WM8326)
board_pmu_wm8326_suspend();
else if(g_pmic_type == PMIC_TYPE_TPS65910)
board_pmu_tps65910_suspend();
}
void __sramfunc board_pmu_resume(void)
{
if(g_pmic_type == PMIC_TYPE_WM8326)
board_pmu_wm8326_resume();
else if(g_pmic_type == PMIC_TYPE_TPS65910)
board_pmu_tps65910_resume();
}
#ifdef CONFIG_I2C2_RK30
static struct i2c_board_info __initdata i2c2_info[] = {
#if defined (CONFIG_TOUCHSCREEN_GT8XX)
@@ -1955,16 +1977,19 @@ void rk30_pm_power_off(void)
arm_pm_restart(0, NULL);
}
#endif
#if PMIC_IS_WM831X
#if defined(CONFIG_MFD_WM831X)
wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
wm831x_device_shutdown(Wm831x);//wm8326 shutdown
#endif
#else
#if defined(CONFIG_MFD_TPS65910)
tps65910_device_shutdown();//tps65910 shutdown
#endif
#endif
#if defined(CONFIG_MFD_WM831X)
if(g_pmic_type == PMIC_TYPE_WM8326)
{
wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
wm831x_device_shutdown(Wm831x);//wm8326 shutdown
}
#endif
#if defined(CONFIG_MFD_TPS65910)
if(g_pmic_type == PMIC_TYPE_TPS65910)
{
tps65910_device_shutdown();//tps65910 shutdown
}
#endif
gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
while(1);
}

View File

@@ -230,6 +230,9 @@ int tps65910_post_init(struct tps65910 *tps65910)
struct regulator *ldo;
printk("%s,line=%d\n", __func__,__LINE__);
g_pmic_type = PMIC_TYPE_TPS65910;
printk("%s:g_pmic_type=%d\n",__func__,g_pmic_type);
dcdc = regulator_get(NULL, "vio"); //vcc_io
regulator_set_voltage(dcdc, 3000000, 3000000);
regulator_enable(dcdc);
@@ -576,13 +579,13 @@ static struct regulator_init_data tps65910_ldo8 = {
.consumer_supplies = tps65910_ldo8_supply,
};
void __sramfunc board_pmu_suspend(void)
void __sramfunc board_pmu_tps65910_suspend(void)
{
grf_writel(GPIO6_PB1_DIR_OUT, GRF_GPIO6L_DIR_ADDR);
grf_writel(GPIO6_PB1_DO_HIGH, GRF_GPIO6L_DO_ADDR); //set gpio6_b1 output low
grf_writel(GPIO6_PB1_EN_MASK, GRF_GPIO6L_EN_ADDR);
}
void __sramfunc board_pmu_resume(void)
void __sramfunc board_pmu_tps65910_resume(void)
{
grf_writel(GPIO6_PB1_DIR_OUT, GRF_GPIO6L_DIR_ADDR);
grf_writel(GPIO6_PB1_DO_LOW, GRF_GPIO6L_DO_ADDR); //set gpio6_b1 output low

View File

@@ -182,7 +182,10 @@ int wm831x_post_init(struct wm831x *Wm831x)
struct regulator *dcdc;
struct regulator *ldo;
g_pmic_type = PMIC_TYPE_WM8326;
printk("%s:g_pmic_type=%d\n",__func__,g_pmic_type);
ldo = regulator_get(NULL, "ldo6"); //vcc_33
regulator_set_voltage(ldo, 3300000, 3300000);
regulator_set_suspend_voltage(ldo, 3300000);
@@ -774,14 +777,14 @@ out:
return 0;
}
void __sramfunc board_pmu_suspend(void)
void __sramfunc board_pmu_wm8326_suspend(void)
{
cru_writel(CRU_CLKGATE5_GRFCLK_ON,CRU_CLKGATE5_CON_ADDR); //open grf clk
grf_writel(GPIO6_PB1_DIR_OUT, GRF_GPIO6L_DIR_ADDR);
grf_writel(GPIO6_PB1_DO_HIGH, GRF_GPIO6L_DO_ADDR); //set gpio6_b1 output low
grf_writel(GPIO6_PB1_EN_MASK, GRF_GPIO6L_EN_ADDR);
}
void __sramfunc board_pmu_resume(void)
void __sramfunc board_pmu_wm8326_resume(void)
{
grf_writel(GPIO6_PB1_DIR_OUT, GRF_GPIO6L_DIR_ADDR);
grf_writel(GPIO6_PB1_DO_LOW, GRF_GPIO6L_DO_ADDR); //set gpio6_b1 output high
@@ -792,6 +795,7 @@ void __sramfunc board_pmu_resume(void)
sram_udelay(10000);
#endif
}
static struct wm831x_pdata wm831x_platdata = {
/** Called before subdevices are set up */

View File

@@ -1538,9 +1538,17 @@ static struct i2c_board_info __initdata i2c0_info[] = {
};
#endif
#define PMIC_TYPE_WM8326 1
#define PMIC_TYPE_TPS65910 2
int __sramdata g_pmic_type = 0;
#ifdef CONFIG_I2C1_RK30
#ifdef CONFIG_MFD_WM831X_I2C
#include "board-rk30-sdk-wm8326.c"
#endif
#ifdef CONFIG_MFD_TPS65910
#define TPS65910_HOST_IRQ RK30_PIN6_PA4
#include "board-rk30-sdk-tps65910.c"
#endif
static struct i2c_board_info __initdata i2c1_info[] = {
#if defined (CONFIG_MFD_WM831X_I2C)
@@ -1552,9 +1560,36 @@ static struct i2c_board_info __initdata i2c1_info[] = {
.platform_data = &wm831x_platdata,
},
#endif
#if defined (CONFIG_MFD_TPS65910)
{
.type = "tps65910",
.addr = TPS65910_I2C_ID0,
.flags = 0,
.irq = TPS65910_HOST_IRQ,
.platform_data = &tps65910_data,
},
#endif
};
#endif
void __sramfunc board_pmu_suspend(void)
{
if(g_pmic_type == PMIC_TYPE_WM8326)
board_pmu_wm8326_suspend();
else if(g_pmic_type == PMIC_TYPE_TPS65910)
board_pmu_tps65910_suspend();
}
void __sramfunc board_pmu_resume(void)
{
if(g_pmic_type == PMIC_TYPE_WM8326)
board_pmu_wm8326_resume();
else if(g_pmic_type == PMIC_TYPE_TPS65910)
board_pmu_tps65910_resume();
}
#ifdef CONFIG_I2C2_RK30
static struct i2c_board_info __initdata i2c2_info[] = {
#if defined (CONFIG_TOUCHSCREEN_GT8XX)
@@ -1638,10 +1673,20 @@ static void rk30_pm_power_off(void)
{
printk(KERN_ERR "rk30_pm_power_off start...\n");
gpio_direction_output(POWER_ON_PIN, GPIO_LOW);
#if defined(CONFIG_MFD_WM831X)
wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
wm831x_device_shutdown(Wm831x);//wm8326 shutdown
#endif
#if defined(CONFIG_MFD_WM831X)
if(g_pmic_type == PMIC_TYPE_WM8326)
{
wm831x_set_bits(Wm831x,WM831X_GPIO_LEVEL,0x0001,0x0000); //set sys_pwr 0
wm831x_device_shutdown(Wm831x);//wm8326 shutdown
}
#endif
#if defined(CONFIG_MFD_TPS65910)
if(g_pmic_type == PMIC_TYPE_TPS65910)
{
tps65910_device_shutdown();//tps65910 shutdown
}
#endif
while (1);
}