mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
add pmu channel control in pm.c, old file do not support it
This commit is contained in:
@@ -706,7 +706,7 @@ struct rk2818_i2c_platform_data default_i2c1_data = {
|
||||
.flags = 0,
|
||||
.slave_addr = 0xff,
|
||||
.scl_rate = 400*1000,
|
||||
.mode = I2C_MODE_IRQ, //I2C_MODE_POLL
|
||||
.mode = I2C_MODE_POLL, //I2C_MODE_POLL
|
||||
.io_init = rk2818_i2c1_io_init,
|
||||
};
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/rk2818-socpm.h>
|
||||
#include <linux/regulator/driver.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
extern void rockchip_timer_clocksource_suspend_resume(int suspend);
|
||||
extern int rockchip_timer_clocksource_irq_checkandclear(void);
|
||||
@@ -169,7 +170,7 @@ void __tcmfunc sdram_exit_self_refresh(u32 ctrl_reg_62)
|
||||
tcm_udelay(100, 24); //DRVDelayUs(100); 延时一下比较安全,保证退出后稳定
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
static void __tcmlocalfunc noinline tcm_printch(char byte)
|
||||
{
|
||||
unsigned int timeout;
|
||||
@@ -541,6 +542,50 @@ static void rk2818_pm_reg_print(unsigned int *pm_save_reg,unsigned int *pm_ch_re
|
||||
|
||||
#endif
|
||||
|
||||
static void pmu_suspend(void)
|
||||
{
|
||||
struct regulator *ldo1,*ldo2,*ldo4,*ldo5;
|
||||
struct regulator *lilo2;
|
||||
|
||||
ldo1 = regulator_get(NULL, "ldo1");
|
||||
regulator_disable(ldo1);
|
||||
ldo2 = regulator_get(NULL, "ldo2");
|
||||
regulator_disable(ldo2);
|
||||
ldo4 = regulator_get(NULL, "ldo4");
|
||||
regulator_disable(ldo4);
|
||||
ldo5 = regulator_get(NULL, "ldo5");
|
||||
regulator_disable(ldo5);
|
||||
lilo2 = regulator_get(NULL, "lilo2");
|
||||
regulator_disable(lilo2);
|
||||
}
|
||||
|
||||
static void pmu_resume(void)
|
||||
{
|
||||
struct regulator *ldo1,*ldo2,*ldo4,*ldo5;
|
||||
struct regulator *lilo2;
|
||||
int tmp = 0;
|
||||
|
||||
ldo1 = regulator_get(NULL, "ldo1");
|
||||
regulator_enable(ldo1);
|
||||
tmp = regulator_get_voltage(ldo1);
|
||||
|
||||
ldo2 = regulator_get(NULL, "ldo2");
|
||||
regulator_enable(ldo2);
|
||||
tmp = regulator_get_voltage(ldo2);
|
||||
|
||||
ldo4 = regulator_get(NULL, "ldo4");
|
||||
regulator_enable(ldo4);
|
||||
tmp = regulator_get_voltage(ldo4);
|
||||
|
||||
ldo5 = regulator_get(NULL, "ldo5");
|
||||
regulator_enable(ldo5);
|
||||
tmp = regulator_get_voltage(ldo5);
|
||||
|
||||
lilo2 = regulator_get(NULL, "lilo2");
|
||||
regulator_enable(lilo2);
|
||||
tmp = regulator_get_voltage(lilo2);
|
||||
}
|
||||
|
||||
static int __tcmfunc rk2818_tcm_idle(void)
|
||||
{
|
||||
//rk2818_define_value;
|
||||
@@ -652,6 +697,7 @@ static int rk2818_pm_enter(suspend_state_t state)
|
||||
|
||||
printk(KERN_DEBUG "before core halt\n");
|
||||
|
||||
pmu_suspend( );
|
||||
clk_set_rate(arm_clk, 24000000);
|
||||
dump_register();
|
||||
|
||||
@@ -675,7 +721,7 @@ static int rk2818_pm_enter(suspend_state_t state)
|
||||
|
||||
rockchip_timer_clocksource_suspend_resume(0);
|
||||
#endif
|
||||
|
||||
pmu_resume( );
|
||||
dump_register();
|
||||
clk_set_rate(arm_clk, arm_rate);
|
||||
//rk2818_socpm_print();
|
||||
|
||||
@@ -463,7 +463,7 @@ void __tcmfunc rk2818_socpm_suspend_first(void)
|
||||
rk2818_soc_pm.general->reg_ctrbit=0;
|
||||
rk2818_soc_pm.gpio0->reg_ctrbit=0x6db;
|
||||
rk2818_soc_pm.gpio1->reg_ctrbit=0x6db;
|
||||
|
||||
rk2818_socpm_set_gpio(RK2818_PIN_PC2,1,0);
|
||||
//rk2818_soc_pm.save_reg[0]=rk2818_ddr_reg[82];
|
||||
//rk2818_ddr_reg[82]=rk2818_ddr_reg[82]&(~(0xffff))&(~(0xf<<20));
|
||||
|
||||
@@ -476,8 +476,9 @@ void __tcmfunc rk2818_socpm_suspend_first(void)
|
||||
void __tcmfunc rk2818_socpm_resume_first(void)
|
||||
{
|
||||
//unsigned int *rk2818_ddr_reg=(unsigned int *)RK2818_SDRAMC_BASE;
|
||||
if(rk2818_soc_pm.resume_vol)
|
||||
rk2818_soc_pm.resume_vol();
|
||||
rk2818_socpm_set_gpio(RK2818_PIN_PC2,1,1);
|
||||
if(rk2818_soc_pm.resume_vol)
|
||||
rk2818_soc_pm.resume_vol();
|
||||
|
||||
}
|
||||
|
||||
|
||||
21
drivers/regulator/rk2818_lp8725.c
Normal file → Executable file
21
drivers/regulator/rk2818_lp8725.c
Normal file → Executable file
@@ -33,6 +33,7 @@ REVISION 0.01
|
||||
#include <linux/regulator/rk2818_lp8725.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <linux/delay.h>
|
||||
#include <mach/iomux.h>
|
||||
|
||||
//add by robert for reboot notifier
|
||||
#include <linux/notifier.h>
|
||||
@@ -53,7 +54,7 @@ REVISION 0.01
|
||||
#define DBG_INFO(x...)
|
||||
#endif
|
||||
|
||||
|
||||
//#define PM_CONTROL
|
||||
|
||||
|
||||
struct lp8725 {
|
||||
@@ -768,7 +769,7 @@ static int lp8725_set_init(void)
|
||||
int tmp = 0;
|
||||
struct regulator *ldo1,*ldo2,*ldo3,*ldo4,*ldo5;
|
||||
struct regulator *lilo1,*lilo2;
|
||||
struct regulator *buck1,*buck2;
|
||||
struct regulator *buck1,*buck1_v2,*buck2;
|
||||
|
||||
DBG_INFO("***run in %s %d ",__FUNCTION__,__LINE__);
|
||||
|
||||
@@ -835,6 +836,15 @@ static int lp8725_set_init(void)
|
||||
tmp = regulator_get_voltage(buck1);
|
||||
DBG_INFO("***regulator_set_init: buck1 vcc =%d\n",tmp);
|
||||
|
||||
#ifdef PM_CONTROL
|
||||
DBG_INFO("***buck1 v2 init\n");
|
||||
buck1_v2 = regulator_get(NULL, "vdd12_v2");// dvs 0
|
||||
regulator_enable(buck1_v2);
|
||||
regulator_set_voltage(buck1_v2,1000000,1000000);//1300000
|
||||
tmp = regulator_get_voltage(buck1_v2);
|
||||
DBG_INFO("***regulator_set_init: buck1 v2 =%d\n",tmp);
|
||||
#endif
|
||||
|
||||
/*init buck2*/
|
||||
DBG_INFO("***buck2 vcc init\n");
|
||||
buck2 = regulator_get(NULL, "vccdr");
|
||||
@@ -910,6 +920,13 @@ static int __devinit lp8725_i2c_probe(struct i2c_client *i2c, const struct i2c_d
|
||||
} else
|
||||
dev_warn(lp8725->dev, "No platform init data supplied\n");
|
||||
|
||||
//DVS pin control, make sure it is high level at start.
|
||||
#ifdef PM_CONTROL
|
||||
rk2818_mux_api_set(GPIOC_LCDC24BIT_SEL_NAME, IOMUXB_GPIO0_C2_7);
|
||||
ret=gpio_request(RK2818_PIN_PC2,NULL);
|
||||
gpio_direction_output(RK2818_PIN_PC2,1);
|
||||
gpio_set_value(RK2818_PIN_PC2,1);
|
||||
#endif
|
||||
lp8725_set_init();
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user