#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);
tcm_udelay(100, 24); //DRVDelayUs(100); 延时一下比较安全,保证退出后稳定
}
-#if 0
+#if 1
static void __tcmlocalfunc noinline tcm_printch(char byte)
{
unsigned int timeout;
#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;
printk(KERN_DEBUG "before core halt\n");
+ pmu_suspend( );
clk_set_rate(arm_clk, 24000000);
dump_register();
rockchip_timer_clocksource_suspend_resume(0);
#endif
-
+ pmu_resume( );
dump_register();
clk_set_rate(arm_clk, arm_rate);
//rk2818_socpm_print();
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));
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();
}
#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>
#define DBG_INFO(x...)
#endif
-
+//#define PM_CONTROL
struct lp8725 {
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__);
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");
} 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;