rk2818-socpm.c: set callback function. pm.c: delete unused code,move lp8725 voltage...
author宋秀杰 <sxj@rock-chips.com>
Fri, 15 Oct 2010 02:09:49 +0000 (19:09 -0700)
committer宋秀杰 <sxj@rock-chips.com>
Fri, 15 Oct 2010 02:09:49 +0000 (19:09 -0700)
arch/arm/mach-rk2818/board-raho.c
arch/arm/mach-rk2818/board-rahosdk.c [changed mode: 0644->0755]
arch/arm/mach-rk2818/include/mach/rk2818-socpm.h
arch/arm/mach-rk2818/pm.c
arch/arm/mach-rk2818/rk2818-socpm.c
drivers/fpga/spi_fpga_init.c

index 76d3871adc766c13d277953feb4a93ba68c4d60e..851f115fc540dde5a6d63f68724536247f609744 100755 (executable)
@@ -2269,18 +2269,77 @@ void __tcmfunc rk2818_soc_general_reg_suspend(void)
                rk2818_socpm_set_gpio(RK2818_PIN_PG7,0,0);
        #endif
 }
-void __tcmfunc rk2818_pm_set_vol(void)
+
+void __tcmfunc pmu_suspend(void)
+{
+       //struct regulator *ldo1,*ldo2,*ldo4,*ldo5;
+       struct regulator *lilo1,*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);*/
+       
+       lilo1 = regulator_get(NULL, "lilo1");
+       regulator_set_voltage(lilo1,2800000,2800000);
+       lilo2 = regulator_get(NULL, "lilo2");
+       regulator_set_voltage(lilo2,2800000,2800000);
+}
+
+void __tcmfunc pmu_resume(void)
+{
+       //struct regulator *ldo1,*ldo2,*ldo4,*ldo5;
+       struct regulator *lilo1,*lilo2;
+
+       /*ldo1 = regulator_get(NULL, "ldo1");
+       regulator_enable(ldo1);
+
+       ldo2 = regulator_get(NULL, "ldo2");
+       regulator_enable(ldo2);
+
+       ldo4 = regulator_get(NULL, "ldo4");
+       regulator_enable(ldo4);
+
+       ldo5 = regulator_get(NULL, "ldo5");
+       regulator_enable(ldo5);*/
+       
+       lilo1 = regulator_get(NULL, "lilo1");
+       regulator_set_voltage(lilo1,3000000,3000000);
+       lilo2 = regulator_get(NULL, "lilo2");
+       regulator_set_voltage(lilo2,3000000,3000000);
+}
+
+void __tcmfunc rk2818_pm_suspend_ctr_pin(void)
 {
+       pmu_suspend( );
        rk2818_socpm_set_gpio(RK2818_PIN_PC2,1,0);
+       //rk2818_socpm_set_gpio(RK2818_PIN_PC7,1,0);
 }
-void __tcmfunc rk2818_pm_resume_vol(void)
+void __tcmfunc rk2818_pm_resume_ctr_pin(void)
 {
+       
        rk2818_socpm_set_gpio(RK2818_PIN_PC2,1,1);
+       //rk2818_socpm_set_gpio(RK2818_PIN_PC7,1,0);
+       pmu_resume( );
 }
+
+static struct rk2818_pm_callback_st __tcmdata callback_init={
+.scu_suspend=(pm_scu_suspend)rk2818_pm_scu_suspend,
+.general_reg_suspend=(pm_general_reg_suspend)rk2818_soc_general_reg_suspend,
+.set_pin=(pm_general_reg_suspend)rk2818_pm_suspend_ctr_pin,
+.resume_pin=(pm_resume_ctr_pin)rk2818_pm_resume_ctr_pin,
+};
 #else
-#define        pm_set_general_cpu_reg(a)
-#define        rk2818_pm_set_vol()
-#define        rk2818_pm_resume_vol()
+static struct rk2818_pm_callback_st __tcmdata callback_init={
+.scu_suspend=NULL,
+.general_reg_suspend=NULL,
+.set_pin=NULL,
+.resume_pin=NULL,
+};
 #endif
 static void __init machine_rk2818_init_irq(void)
 {
@@ -2293,8 +2352,7 @@ static void __init machine_rk2818_board_init(void)
 {      
        printk("3x machine_rk2818_board_init\n");
        
-       rk2818_socpm_int( (pm_scu_suspend) rk2818_pm_scu_suspend,(pm_general_reg_suspend) rk2818_soc_general_reg_suspend,
-       (pm_set_suspendvol) rk2818_pm_set_vol,(pm_resume_vol) rk2818_pm_resume_vol);
+       rk2818_socpm_init(&callback_init);
        rk2818_power_on();
        pm_power_off = rk2818_power_off;
 #ifdef CONFIG_SPI_FPGA_FW
old mode 100644 (file)
new mode 100755 (executable)
index 2802487..a242a5c
@@ -2192,18 +2192,77 @@ void __tcmfunc rk2818_soc_general_reg_suspend(void)
                rk2818_socpm_set_gpio(RK2818_PIN_PG7,0,0);
        #endif
 }
-void __tcmfunc rk2818_pm_set_vol(void)
+
+void __tcmfunc pmu_suspend(void)
+{
+       //struct regulator *ldo1,*ldo2,*ldo4,*ldo5;
+       struct regulator *lilo1,*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);*/
+       
+       lilo1 = regulator_get(NULL, "lilo1");
+       regulator_set_voltage(lilo1,2800000,2800000);
+       lilo2 = regulator_get(NULL, "lilo2");
+       regulator_set_voltage(lilo2,2800000,2800000);
+}
+
+void __tcmfunc pmu_resume(void)
+{
+       //struct regulator *ldo1,*ldo2,*ldo4,*ldo5;
+       struct regulator *lilo1,*lilo2;
+
+       /*ldo1 = regulator_get(NULL, "ldo1");
+       regulator_enable(ldo1);
+
+       ldo2 = regulator_get(NULL, "ldo2");
+       regulator_enable(ldo2);
+
+       ldo4 = regulator_get(NULL, "ldo4");
+       regulator_enable(ldo4);
+
+       ldo5 = regulator_get(NULL, "ldo5");
+       regulator_enable(ldo5);*/
+       
+       lilo1 = regulator_get(NULL, "lilo1");
+       regulator_set_voltage(lilo1,3000000,3000000);
+       lilo2 = regulator_get(NULL, "lilo2");
+       regulator_set_voltage(lilo2,3000000,3000000);
+}
+
+void __tcmfunc rk2818_pm_suspend_ctr_pin(void)
 {
+       pmu_suspend( );
        rk2818_socpm_set_gpio(RK2818_PIN_PC2,1,0);
+       //rk2818_socpm_set_gpio(RK2818_PIN_PC7,1,0);
 }
-void __tcmfunc rk2818_pm_resume_vol(void)
+void __tcmfunc rk2818_pm_resume_ctr_pin(void)
 {
+       
        rk2818_socpm_set_gpio(RK2818_PIN_PC2,1,1);
+       //rk2818_socpm_set_gpio(RK2818_PIN_PC7,1,0);
+       pmu_resume( );
 }
+
+static struct rk2818_pm_callback_st __tcmdata callback_init={
+.scu_suspend=(pm_scu_suspend)rk2818_pm_scu_suspend,
+.general_reg_suspend=(pm_general_reg_suspend)rk2818_soc_general_reg_suspend,
+.set_pin=(pm_general_reg_suspend)rk2818_pm_suspend_ctr_pin,
+.resume_pin=(pm_resume_ctr_pin)rk2818_pm_resume_ctr_pin,
+};
 #else
-#define        pm_set_general_cpu_reg(a)
-#define        rk2818_pm_set_vol()
-#define        rk2818_pm_resume_vol()
+static struct rk2818_pm_callback_st __tcmdata callback_init={
+.scu_suspend=NULL,
+.general_reg_suspend=NULL,
+.set_pin=NULL,
+.resume_pin=NULL,
+};
 #endif
 static void __init machine_rk2818_init_irq(void)
 {
@@ -2216,8 +2275,7 @@ static void __init machine_rk2818_board_init(void)
 {      
        printk("3x machine_rk2818_board_init\n");
        
-       rk2818_socpm_int( (pm_scu_suspend) rk2818_pm_scu_suspend,(pm_general_reg_suspend) rk2818_soc_general_reg_suspend,
-       (pm_set_suspendvol) rk2818_pm_set_vol,(pm_resume_vol) rk2818_pm_resume_vol);
+       rk2818_socpm_init(&callback_init);
        rk2818_power_on();
        pm_power_off = rk2818_power_off;
        
index 0f7d430402ef276f26409058963297c01cb6bf0c..ed98c6392a13ca2009b26d4047021a09b73fd81b 100755 (executable)
@@ -75,8 +75,8 @@ ssize_t rk2818_socpm_attr_show(int type,char *buf);
 
 typedef void (*pm_scu_suspend)(unsigned int *tempdata,int regoff);
 typedef void (*pm_general_reg_suspend)(void);
-typedef void (*pm_set_suspendvol)(void);
-typedef void (*pm_resume_vol)(void);
+typedef void (*pm_suspend_ctr_pin)(void);
+typedef void (*pm_resume_ctr_pin)(void);
 
 struct rk2818_pm_soc_st{
 unsigned int *reg_save;
@@ -94,11 +94,10 @@ u8 attr_flag;
 };
 
 struct rk2818_pm_callback_st{
-int data;
 pm_scu_suspend scu_suspend;
 pm_general_reg_suspend general_reg_suspend;
-pm_set_suspendvol set_suspendvol;
-pm_resume_vol resume_vol;
+pm_suspend_ctr_pin set_pin;
+pm_resume_ctr_pin resume_pin;
 };
 
 
@@ -113,10 +112,6 @@ struct rk2818_pm_soc_st *gpio1;
 //struct rk2818_pm_callback_st *callback;
 unsigned int *save_reg;
 unsigned int *save_ch;
-pm_scu_suspend scu_suspend;
-pm_general_reg_suspend general_reg_suspend;
-pm_set_suspendvol set_suspendvol;
-pm_resume_vol resume_vol;
 };
 
 /***********************scu SCU_CLKSEL0 reg bit************************************/
@@ -125,11 +120,6 @@ pm_resume_vol resume_vol;
 #define PM_SET_BIT(b) (1<<b)
 #define PM_GET_BIT(val,b)      ((val&(1<<b))>>b)
 
-
-
-
-
-
 /***********************scu SCU_CLKSEL0 reg bit************************************/
 
 #define SCU_GATE0CLK_ALL_EN 0
@@ -311,9 +301,8 @@ enum
        PM_SCU_GPIO_SWPORTC_NUM
 };
 
-void rk2818_socpm_int(pm_scu_suspend scu,pm_general_reg_suspend general,
-       pm_set_suspendvol setvol,pm_resume_vol resumevol);
-       extern struct rk2818_pm_st __tcmdata rk2818_soc_pm;
+int rk2818_socpm_init(struct rk2818_pm_callback_st *call_back);
+extern struct rk2818_pm_st __tcmdata rk2818_soc_pm;
 extern int  __tcmfunc rk2818_socpm_gpio_pullupdown(unsigned int gpio,eGPIOPullType_t GPIOPullUpDown);
 extern int  __tcmfunc rk2818_socpm_set_gpio(unsigned int gpio,unsigned int output,unsigned int level);
 
@@ -322,7 +311,7 @@ extern int  __tcmfunc rk2818_socpm_set_gpio(unsigned int gpio,unsigned int outpu
 void __tcmfunc rk2818_socpm_suspend_first(void);
 void __tcmfunc rk2818_socpm_suspend(void);
 
-void __tcmfunc rk2818_socpm_resume_first(void);
+void __tcmfunc rk2818_socpm_resume_last(void);
 void __tcmfunc rk2818_socpm_resume(void);
 void rk2818_socpm_print(void);
 #else
@@ -331,7 +320,7 @@ void rk2818_socpm_print(void);
 #define rk2818_socpm_set_gpio(a,b,c)
 #define rk2818_socpm_suspend_first()
 #define rk2818_socpm_suspend()
-#define rk2818_socpm_resume_first()
+#define rk2818_socpm_resume_last()
 #define rk2818_socpm_resume()
 #define rk2818_socpm_print()
 
index 95e0ae92149d82783970d4bb2b4c1aeac319c005..ea7be85587ff647de53ff9f6e68b9584dde48b40 100755 (executable)
@@ -64,15 +64,6 @@ static inline u32 sdram_get_mem_type(void)
 
 #define ASM_LOOP_INSTRUCTION_NUM     4
 
-/*static noinline void __tcmlocalfunc tcm_udelay(unsigned long usecs, u32 arm_freq_mhz)
-{
-       volatile unsigned int cycle;
-
-       cycle = usecs * arm_freq_mhz / ASM_LOOP_INSTRUCTION_NUM;
-
-       while (cycle--) {}
-}*/
-
 #define CLK_GATE_SDRAM_MASK            ((1 << (CLK_GATE_SDRAM_COMMON & 31)) | (1 << (CLK_GATE_SDRAM_CONTROLLER & 31)))
 #define CLK_GATE_MOBILESDRAM_MASK      ((1 << (CLK_GATE_SDRAM_COMMON & 31)) | (1 << (CLK_GATE_MOBILE_SDRAM_CONTROLLER & 31)))
 
@@ -170,7 +161,7 @@ void __tcmfunc sdram_exit_self_refresh(u32 ctrl_reg_62)
        tcm_udelay(100, 24); //DRVDelayUs(100); 延时一下比较安全,保证退出后稳定
 }
 
-#if 1
+#if 0
 static void __tcmlocalfunc noinline tcm_printch(char byte)
 {
        unsigned int timeout;
@@ -205,400 +196,8 @@ static void __tcmlocalfunc noinline tcm_printhex(unsigned int hex)
 }
 #endif
 
-//#define RK2818_MOBLIE_PM_CON
-#ifdef RK2818_MOBLIE_PM_CON
-
-#define RK2818_MOBLIE_PM_PRT_ORIGINAL_REG
-//#define RK2818_MOBLIE_PM_PRT_CHANGED_REG
-
-#define PM_SAVE_REG_NUM 4
-struct rk2818_pm_st{
-unsigned int *pm_scu_reg;
-unsigned int *pm_cpu_reg;
-unsigned int *pm_gpio0_reg;
-unsigned int *pm_gpio1_reg;
-unsigned int *savereg;
-
-unsigned int *pm_scu_reg_ch;
-unsigned int *pm_cpu_reg_ch;
-unsigned int *pm_gpio0_reg_ch;
-unsigned int *pm_gpio1_reg_ch;
-unsigned int *save_ch;
-
-u16 scu_regbit;
-u16 cpu_regbit;
-u16 gpio0_regbit;
-u16 gpio1_regbit;
-};
-unsigned int __tcmdata pm_scu_reg_save[PM_SCU_REG_NUM];
-unsigned int __tcmdata pm_cpu_reg_save[PM_GENERAL_CPU_REG];
-unsigned int __tcmdata pm_gpio0_reg_save[PM_SCU_GPIO_SWPORTC_NUM];
-unsigned int __tcmdata pm_gpio1_reg_save[PM_SCU_GPIO_SWPORTC_NUM];
-unsigned int __tcmdata pm_savereg[PM_SAVE_REG_NUM];
-
-unsigned int __tcmdata pm_scu_reg_ch[PM_SCU_REG_NUM];
-unsigned int __tcmdata pm_cpu_reg_ch[PM_GENERAL_CPU_REG];
-unsigned int __tcmdata pm_gpio0_reg_save_ch[PM_SCU_GPIO_SWPORTC_NUM];
-unsigned int __tcmdata pm_gpio1_reg_save_ch[PM_SCU_GPIO_SWPORTC_NUM];
-unsigned int __tcmdata savereg_ch[PM_SAVE_REG_NUM];
-
-struct rk2818_pm_st __tcmdata pm_save={
-.pm_scu_reg=&pm_scu_reg_save[0],
-.pm_cpu_reg=&pm_cpu_reg_save[0],
-.pm_gpio0_reg=&pm_gpio0_reg_save[0],
-.pm_gpio1_reg=&pm_gpio1_reg_save[0],
-.savereg=&pm_savereg[0],
-
-.pm_scu_reg_ch=&pm_scu_reg_ch[0],
-.pm_cpu_reg_ch=&pm_cpu_reg_ch[0],
-.pm_gpio0_reg_ch=&pm_gpio0_reg_save_ch[0],
-.pm_gpio1_reg_ch=&pm_gpio1_reg_save_ch[0],
-.save_ch=&savereg_ch[0],
-};
-
-#if 0
-#define rk2818_define_value \
-unsigned int pm_scu_reg_save[PM_SCU_REG_NUM];\
-unsigned int pm_cpu_reg_save[PM_GENERAL_CPU_REG];\
-unsigned int pm_gpio0_reg_save[PM_SCU_GPIO_SWPORTC_NUM];\
-unsigned int pm_gpio1_reg_save[PM_SCU_GPIO_SWPORTC_NUM];\
-unsigned int save[4];\
-unsigned int pm_scu_reg_ch[PM_SCU_REG_NUM];\
-unsigned int pm_cpu_reg_ch[PM_GENERAL_CPU_REG];\
-struct rk2818_pm_st pm_save={&pm_scu_reg_save[0],&pm_cpu_reg_save[0],&pm_gpio0_reg_save[0],&pm_gpio1_reg_save[0],&save[0]\
-,&pm_scu_reg_ch[0],&pm_cpu_reg_ch[0]\
-};\
-struct regulator *buck1
-
-#endif
-static int __tcmfunc pm_set_gpio_pinstate(unsigned int gpio,unsigned int output,unsigned int level)
-{
-       unsigned int *rk2818_gpio_reg;
-       unsigned int regoff;
-
-       if(gpio>=RK2818GPIO_TOTAL)
-               return -1;
-       
-       if(gpio<32)
-               rk2818_gpio_reg=(unsigned int *)RK2818_GPIO0_BASE;
-       else
-       {
-               rk2818_gpio_reg=(unsigned int *)RK2818_GPIO1_BASE;
-               gpio-=32;
-       }
-       
-       regoff=PM_GPIO_SWPORTA_DR+(gpio/8)*3;
-       gpio%=8;
-       
-       if(output)
-       {
-               rk2818_gpio_reg[regoff+1]|=(1<<gpio);//ddr set dir
-               if(level==0)
-                       rk2818_gpio_reg[regoff]&=(~(1<<gpio));//ddr set value
-               else
-                       rk2818_gpio_reg[regoff]|=(1<<gpio);
-       }
-       else
-               rk2818_gpio_reg[regoff+1]&=(~(1<<gpio));//ddr set dir
-       return 0;
-}
-static void __tcmfunc rk2818_pm_save_reg(unsigned int *save,unsigned int *source,int num)
-{
-       int i;
-       if(save&&source)
-       for(i=0;i<num;i++)
-       {
-               save[i]=source[i];
-       }
-               
-}
-static void __tcmfunc rk2818_pm_suspend_first(void)
-{
-       unsigned int *rk2818_scu_reg=(unsigned int *)RK2818_SCU_BASE;
-       unsigned int *rk2818_cpu_reg=(unsigned int *)RK2818_REGFILE_BASE;
-       unsigned int *rk2818_gpio0_reg=(unsigned int *)RK2818_GPIO0_BASE;
-       unsigned int *rk2818_gpio1_reg=(unsigned int *)RK2818_GPIO1_BASE;
-       //unsigned int *rk2818_ddr_reg=(unsigned int *)RK2818_SDRAMC_BASE;
-
-       rk2818_pm_save_reg(pm_save.pm_scu_reg,rk2818_scu_reg,PM_SCU_REG_NUM);
-       rk2818_pm_save_reg(pm_save.pm_cpu_reg,rk2818_cpu_reg,PM_GENERAL_CPU_REG);
-       rk2818_pm_save_reg(pm_save.pm_gpio0_reg,rk2818_gpio0_reg,PM_SCU_GPIO_SWPORTC_NUM);
-       rk2818_pm_save_reg(pm_save.pm_gpio1_reg,rk2818_gpio1_reg,PM_SCU_GPIO_SWPORTC_NUM);
-       pm_save.scu_regbit=0;
-       pm_save.cpu_regbit=0;
-       pm_save.gpio0_regbit=0x6db;
-       pm_save.gpio1_regbit=0x6db;
-       //pm_save.savereg[0]=rk2818_ddr_reg[82];
-       //rk2818_ddr_reg[82]=rk2818_ddr_reg[82]&(~(0xffff))&(~(0xf<<20));
-       pm_set_gpio_pinstate(RK2818_PIN_PC2,1,0);
-       tcm_printascii("suspend frist\n");
-}
-
-static void __tcmfunc rk2818_pm_resume_first(void)
-{
-       //unsigned int *rk2818_ddr_reg=(unsigned int *)RK2818_SDRAMC_BASE;
-       pm_set_gpio_pinstate(RK2818_PIN_PC2,1,1);
-       //rk2818_ddr_reg[82]=pm_save.savereg[0];
-}
-static void __tcmfunc rk2818_soc_scu_suspend(void)
-{
-
-       unsigned int *rk2818_scu_reg=(unsigned int *)RK2818_SCU_BASE;
-
-       pm_save.scu_regbit|=(0x1<<PM_SCU_CLKGATE0_CON);
-       rk2818_scu_reg[PM_SCU_CLKGATE0_CON] = SCU_GATE0CLK_ALL_DIS&(~DIS_ARM_CLK)&(~DIS_TIMER_CLK)&(~DIS_GPIO0_CLK)&(~DIS_GPIO1_CLK)&(~DIS_INTC_CLK)&(~DIS_UART1_CLK);
-               //&(~DIS_UART0_CLK)&(~DIS_UART1_CLK);
-
-
-       pm_save.scu_regbit|=(0x1<<PM_SCU_CLKGATE1_CON);
-       rk2818_scu_reg[PM_SCU_CLKGATE1_CON] =SCU_GATE1CLK_BASE_SET|EN_AXI_CLK/*&(~DIS_DDR_CLK)&(~DIS_DDR_HCLK)*/;
-
-       pm_save.scu_regbit|=(0x1<<PM_SCU_CLKGATE2_CON);
-        rk2818_scu_reg[PM_SCU_CLKGATE2_CON] =SCU_GATE2CLK_BASE_SET&(~DIS_ITCMBUS_CLK)
-       &(~DIS_DTCM0BUS_CLK)&(~DIS_DTCM1BUS_CLK);
-       
-       //pm_save.scu_regbit|=(0x1<<PM_SCU_CLKSEL0_CON);
-       //rk2818_scu_reg[PM_SCU_CLKSEL0_CON] |=(rk2818_scu_reg[PM_SCU_CLKSEL0_CON]&PM_BIT_CLEAR(CLKSEL0_HCLK,2)&PM_BIT_CLEAR(CLKSEL0_PCLK,2))
-       //      |CLKSEL0_HCLK21;
-
-       pm_save.scu_regbit|=(0x1<<PM_SCU_DPLL_CON);
-       rk2818_scu_reg[PM_SCU_DPLL_CON] |= DSPPLL_POERDOWN;    //dsp pll power down
-       
-       pm_save.scu_regbit|=(0x1<<PM_SCU_CPLL_CON);
-       rk2818_scu_reg[PM_SCU_CPLL_CON] |= CPLL_POERDOWN;    //dsp pll power down
-
-       tcm_udelay(1, 24);
-       //tcm_printascii("dsp pll power down\n");
-       
-       pm_save.scu_regbit|=(0x1<<PM_SCU_PMU_CON);
-       rk2818_scu_reg[PM_SCU_PMU_CON] |=LCDC_POWER_DOWN;
-       rk2818_scu_reg[PM_SCU_PMU_CON] |=DSP_POWER_DOWN;
-
-       tcm_udelay(1, 24);
-       //tcm_printascii("dsp power down\n");
-
-       pm_save.scu_regbit|=(0x1<<PM_CLKSEL2_CON);
-       rk2818_scu_reg[PM_CLKSEL2_CON] =(rk2818_scu_reg[PM_CLKSEL2_CON]&(~0xf))|0x7;
-
-       pm_save.scu_regbit|=(0x1<<PM_SCU_MODE_CON);
-       rk2818_scu_reg[PM_SCU_MODE_CON] &= CPU_SLOW_MODE;       //cpu slow mode
-
-       pm_save.scu_regbit|=(0x1<<PM_SCU_APLL_CON);
-       //rk2818_scu_reg[PM_SCU_APLL_CON] |= ARMPLL_BYPASSMODE;//enable arm pll bypass
-       rk2818_scu_reg[PM_SCU_APLL_CON] |= ARMPLL_POERDOWN;     //arm pll power down
-       
-       //tcm_printascii("arm pll power down\n");
-
-       //rk2818_scu_reg[PM_SCU_PMU_CON] |=DDR_POWER_DOWN;
-       //pm_save.scu_regbit|=(0x1<<PM_SCU_SOFTRST_CON);
-       //rk2818_scu_reg[PM_SCU_SOFTRST_CON]|=RST_DDR_CORE_LOGIC;//RST_DDR_BUS/RST_DDR_CORE_LOGIC
-
-       #ifdef RK2818_MOBLIE_PM_PRT_CHANGED_REG
-       rk2818_pm_save_reg(pm_save.pm_scu_reg_ch,rk2818_scu_reg,PM_SCU_REG_NUM);
-       #endif
-}
-
-/*static void __tcmfunc rk2818_soc_general_cpu_suspend(void)
-{
-
-       unsigned int *rk2818_cpu_reg=(unsigned int *)RK2818_REGFILE_BASE;
-       //unsigned int *rk2818_gpio0_reg=(unsigned int *)RK2818_GPIO0_BASE;
-       //unsigned int *rk2818_gpio1_reg=(unsigned int *)RK2818_GPIO1_BASE;
-
-       #if 0
-       pm_save.cpu_regbit|=(0x1<<PM_GPIO0_AB_PU_CON);
-       rk2818_cpu_reg[PM_GPIO0_AB_PU_CON] =GPIO0_AB_NORMAL|PMGPIO_DN(GPIO0_A3);
-
-       pm_save.cpu_regbit|=(0x1<<PM_GPIO0_CD_PU_CON);
-       rk2818_cpu_reg[PM_GPIO0_CD_PU_CON] = GPIO0_CD_NORMAL;
-       
-       pm_save.cpu_regbit|=(0x1<<PM_GPIO1_AB_PU_CON);
-       rk2818_cpu_reg[PM_GPIO1_AB_PU_CON] = GPIO1_AB_NORMAL;
-       
-       pm_save.cpu_regbit|=(0x1<<PM_GPIO1_CD_PU_CON);
-       rk2818_cpu_reg[PM_GPIO1_CD_PU_CON] = GPIO1_CD_NORMAL;
-       #endif
-
-       pm_save.cpu_regbit|=(0x1<<PM_IOMUX_A_CON);
-       pm_save.cpu_regbit|=(0x1<<PM_IOMUX_B_CON);
-
-       #if 1  //set uart0 pin
-       rk2818_cpu_reg[PM_IOMUX_A_CON] &=(~(0x3<<PM_UART0_OUT))&(~(0x3<<PM_UART0_IN));// 00 gpio 01uart
-       rk2818_cpu_reg[PM_IOMUX_B_CON] &=(~(0x1<<PM_UART0_RTS))&(~(0x1<<PM_UART0_CTS));//
-       pm_set_gpio_pinstate(RK2818_PIN_PG0,0,0);//uart0 sin pin
-       pm_set_gpio_pinstate(RK2818_PIN_PG1,0,0);//uart0 sout pin       
-       pm_set_gpio_pinstate(RK2818_PIN_PG0,0,0);//uart0 sin pin
-       pm_set_gpio_pinstate(RK2818_PIN_PG1,0,0);//uart0 sout pin
-       pm_set_gpio_pinstate(RK2818_PIN_PB2,0,0);//uart0 cts pin
-       pm_set_gpio_pinstate(RK2818_PIN_PB3,0,0);//uart0 rts pin
-       pm_set_gpio_pinstate(RK2818_PIN_PF7,0,0);//uart0 dtr pin
-       //pm_set_gpio_pinstate(RK2818_PIN_PE0,0,0);//uart0 dsr pin
-       #endif
-
-       #if 0  //set uart1 pin
-       rk2818_cpu_reg[PM_IOMUX_A_CON] &=(~(0x3<<PM_UART1_OUT))&(~(0x3<<PM_UART1_IN));// 00 gpio 01uart
-       pm_set_gpio_pinstate(RK2818_PIN_PF0,0,0);//uart0 sin pin
-       pm_set_gpio_pinstate(RK2818_PIN_PG1,0,0);//uart0 sout pin
-       #endif
-
-       #if 0 //set i2c0 pin
-       rk2818_cpu_reg[PM_IOMUX_A_CON] |=(0x1<<PM_I2C0);// 1 gpio;0 i2c
-       pm_set_gpio_pinstate(RK2818_PIN_PE4,0,0);//sda pin
-       pm_set_gpio_pinstate(RK2818_PIN_PE5,0,0);//scl dsr pin
-       #endif
-
-       #if 0  //set i2c1 pin
-       rk2818_cpu_reg[PM_IOMUX_A_CON] &=(~(0x3<<PM_I2C1));// 1 gpio;0 i2c
-       pm_set_gpio_pinstate(RK2818_PIN_PE6,0,0);//sda pin
-       pm_set_gpio_pinstate(RK2818_PIN_PE7,0,0);//scl dsr pin
-       #endif
-
-       #if 1  // sdio0
-       rk2818_cpu_reg[PM_IOMUX_A_CON] &=(~(0x1<<PM_SDIO0_CMD))&(~(0x1<<PM_SDIO0_DATA));// 1 gpio;0 i2c
-       pm_set_gpio_pinstate(RK2818_PIN_PH0,0,0);
-       pm_set_gpio_pinstate(RK2818_PIN_PH1,0,0);
-       pm_set_gpio_pinstate(RK2818_PIN_PH2,0,0);
-       pm_set_gpio_pinstate(RK2818_PIN_PH3,0,0);
-       pm_set_gpio_pinstate(RK2818_PIN_PH4,0,0);
-       pm_set_gpio_pinstate(RK2818_PIN_PH5,0,0);
-       //pm_set_gpio_pinstate(RK2818_PIN_PF3,0,0);
-       #endif
-
-       #if 0 // sdio1
-       rk2818_cpu_reg[PM_IOMUX_A_CON] &=(~(0x1<<PM_SDIO1_CMD))&(~(0x1<<PM_SDIO1_DATA));// 1 gpio;0 i2c
-       pm_set_gpio_pinstate(RK2818_PIN_PG2,0,0);
-       pm_set_gpio_pinstate(RK2818_PIN_PG3,0,0);
-       pm_set_gpio_pinstate(RK2818_PIN_PG4,0,0);
-       pm_set_gpio_pinstate(RK2818_PIN_PG5,0,0);
-       pm_set_gpio_pinstate(RK2818_PIN_PG6,0,0);
-       pm_set_gpio_pinstate(RK2818_PIN_PG7,0,0);
-       #endif
-
-#ifdef RK2818_MOBLIE_PM_PRT_CHANGED_REG
-       rk2818_pm_save_reg(pm_save.pm_cpu_reg_ch,rk2818_cpu_reg,PM_GENERAL_CPU_REG);
-       rk2818_pm_save_reg(pm_save.pm_gpio0_reg_ch,rk2818_gpio0_reg,PM_SCU_GPIO_SWPORTC_NUM);
-       rk2818_pm_save_reg(pm_save.pm_gpio1_reg_ch,rk2818_gpio1_reg,PM_SCU_GPIO_SWPORTC_NUM);
-#endif
-
-}*/
-
-static void __tcmfunc rk2818_soc_resume(unsigned int *pm_save_reg,unsigned int *base_add,u16 regbit,int num)
-{
-       int i;
-       tcm_printascii("rk2818_soc_resume\n");
-       for(i=0;i<num;i++)
-       {
-              if((regbit>>i)&0x0001)
-               base_add[i]=pm_save_reg[i];
-       }
-}
-static void __tcmfunc rk2818_pm_soc_suspend(void)
-{ 
-       rk2818_soc_scu_suspend( );
-       //rk2818_soc_general_cpu_suspend( );
-}
-static void __tcmfunc rk2818_pm_soc_resume(void)
-{
-       rk2818_soc_resume(pm_save.pm_scu_reg,(unsigned int *)RK2818_SCU_BASE,pm_save.scu_regbit,PM_SCU_REG_NUM);
-       //rk2818_soc_resume(pm_save.pm_cpu_reg,(unsigned int *)RK2818_REGFILE_BASE,pm_save.cpu_regbit,PM_GENERAL_CPU_REG);
-}
-
-/*void rk2818_pm_print(void)
-{
-       //rk2818_pm_reg_print(pm_save.pm_scu_reg,pm_save.pm_scu_reg_ch,PM_SCU_REG_NUM,"scu");
-       //rk2818_pm_reg_print(pm_save.pm_cpu_reg,pm_save.pm_cpu_reg,PM_GENERAL_CPU_REG,"general_cpu");
-       //rk2818_pm_reg_print(pm_save.pm_gpio0_reg,pm_save.pm_gpio0_reg,PM_SCU_GPIO_SWPORTC_NUM,"gpio0");
-}
-
-static void rk2818_pm_reg_print(unsigned int *pm_save_reg,unsigned int *pm_ch_reg,int num,char *name)
-{
-        int i;
-
-#ifdef RK2818_MOBLIE_PM_PRT_ORIGINAL_REG
-       printk("***the follow inf is %s original reg***\n",name);
-       for(i=0;i<num;i++)
-       {
-           printk(" %d,%x",i,pm_save_reg[i]);
-       }
-       printk("\n");
-#endif
-
-#ifdef RK2818_MOBLIE_PM_PRT_CHANGED_REG
-       printk("***the follow inf is %s changed reg***\n",name);
-       for(i=0;i<num;i++)
-       {
-           printk(" %d,%x",i,pm_ch_reg[i]);
-       }
-       printk("\n");
-#endif
-}*/
-
-#else
-#define rk2818_pm_suspend_first(a)
-#define rk2818_pm_resume_first(b)
-#define rk2818_pm_soc_suspend(a)
-#define rk2818_pm_soc_resume(a)
-#define rk2818_define_value
-
-#endif
-
-static void pmu_suspend(void)
-{
-       //struct regulator *ldo1,*ldo2,*ldo4,*ldo5;
-       struct regulator *lilo1,*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);*/
-       
-       lilo1 = regulator_get(NULL, "lilo1");
-       regulator_set_voltage(lilo1,2800000,2800000);
-       lilo2 = regulator_get(NULL, "lilo2");
-       regulator_set_voltage(lilo2,2800000,2800000);
-}
-
-static void pmu_resume(void)
-{
-       //struct regulator *ldo1,*ldo2,*ldo4,*ldo5;
-       struct regulator *lilo1,*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);*/
-       
-       lilo1 = regulator_get(NULL, "lilo1");
-       regulator_set_voltage(lilo1,3000000,3000000);
-       lilo2 = regulator_get(NULL, "lilo2");
-       regulator_set_voltage(lilo2,3000000,3000000);
-}
-
 static int __tcmfunc rk2818_tcm_idle(void)
 {
-       //rk2818_define_value;
        volatile u32 unit;
        u32 ctrl_reg_62;
        
@@ -609,12 +208,9 @@ static int __tcmfunc rk2818_tcm_idle(void)
        asm("b 1f; .align 5; 1:");
        asm("mcr p15, 0, r0, c7, c10, 4");      /* drain write buffer */
        
-
        scu_writel(scu_mode & ~(3 << 2), SCU_MODE_CON); // slow
        scu_writel(scu_apll | PLL_PD, SCU_APLL_CON); // powerdown
 
-       
-       //tcm_printascii("3x pm ddr refresh\n");
        //rk28_ddr_enter_self_refresh();
        tcm_udelay(5, 24); //DRVDelayUs(100); 
        ctrl_reg_62=sdram_enter_self_refresh();
@@ -627,34 +223,27 @@ static int __tcmfunc rk2818_tcm_idle(void)
        asm("mcr p15, 0, r0, c7, c0, 4");       /* wait for interrupt */
 
        tcm_udelay(1, 24); //DRVDelayUs(100); 
-       rk2818_socpm_resume_first();
        rk2818_socpm_resume();
+       rk2818_socpm_resume_last();
        tcm_udelay(1, 24); //DRVDelayUs(100); 
        sdram_exit_self_refresh(ctrl_reg_62);
-       //rk28_ddr_exit_self_refresh();
-       //tcm_printascii("3x pm re\n");
+
        tcm_udelay(10, 24);
        scu_writel(scu_apll, SCU_APLL_CON); // powerup
        scu_writel(scu_clksel0 & (~3), SCU_CLKSEL0_CON);
        tcm_udelay(20, 24);
-       //tcm_printascii("3x pm re1\n");
 
        unit = 7200;  /* 24m,0.3ms , 24*300*/
        while (unit-- > 0) {
                if (regfile_readl(CPU_APB_REG0) & 0x80)
                        break;
        }
-       ///tcm_printascii("3x pm re2\n");
 
        tcm_udelay(5 << 8, 24);
        scu_writel(scu_clksel0, SCU_CLKSEL0_CON);
        tcm_udelay(5, 24);
-       //tcm_printascii("3x pm re3\n");
 
        scu_writel(scu_mode, SCU_MODE_CON); // normal
-
-       //tcm_printascii("3x pm re4\n");
-
        return unit;
 }
 
@@ -667,9 +256,6 @@ static void rk2818_idle(void)
        asm volatile ("mov sp, %0" :: "r" (tcm_sp));
        rk2818_tcm_idle();
        asm volatile ("mov sp, %0" :: "r" (old_sp));
-
-       //printk("rk2818_idle\n");
-
 }
 
 #if 1
@@ -705,11 +291,6 @@ static int rk2818_pm_enter(suspend_state_t state)
        struct clk *arm_clk = clk_get(NULL, "arm");
        unsigned long arm_rate = clk_get_rate(arm_clk);
 
-       printk(KERN_DEBUG "before core halt\n");
-
-       #if defined(CONFIG_MACH_RAHO)||defined(CONFIG_MACH_RAHOSDK)
-       pmu_suspend( );
-       #endif
        clk_set_rate(arm_clk, 24000000);
        dump_register();
 
@@ -733,9 +314,6 @@ static int rk2818_pm_enter(suspend_state_t state)
 
        rockchip_timer_clocksource_suspend_resume(0);
 #endif
-       #if defined(CONFIG_MACH_RAHO)||defined(CONFIG_MACH_RAHOSDK)
-       pmu_resume( );
-       #endif
        dump_register();
        clk_set_rate(arm_clk, arm_rate);
        //rk2818_socpm_print();
index dc12906a89380fd3f100c688fa84dfdc6cd1bb38..fe4829269e015cb6dc8b9b6affd52f284ee18390 100755 (executable)
@@ -74,8 +74,6 @@ static struct rk2818_pm_soc_st __tcmdata pm_general_ctr={
 
 static unsigned int __tcmdata pm_gpio0_reg_save[PM_SCU_GPIO_SWPORTC_NUM];
 
-
-
 static struct rk2818_pm_soc_st __tcmdata pm_gpio0_ctr={
 .reg_save=&pm_gpio0_reg_save[0],
 .reg_base_addr=(unsigned int *)RK2818_GPIO0_BASE,
@@ -120,12 +118,10 @@ struct rk2818_pm_st __tcmdata rk2818_soc_pm={
 .gpio1=(struct rk2818_pm_soc_st *)&pm_gpio1_ctr.reg_save,
 .save_reg=&pm_savereg[0],
 .save_ch=&savereg_ch[0],
-.scu_suspend=NULL,
-.general_reg_suspend=NULL,
-.set_suspendvol=NULL,
-.resume_vol=NULL,
 };
 
+static struct rk2818_pm_callback_st __tcmdata *pm_ctr_callback=NULL;
+
 int __tcmfunc rk2818_socpm_set_gpio(unsigned int gpio,unsigned int output,unsigned int level)
 {
        unsigned int *rk2818_gpio_reg;
@@ -245,9 +241,9 @@ static void __tcmfunc rk2818_pm_save_reg(unsigned int *save,unsigned int *source
 static void __tcmfunc rk2818_soc_updata_scureg(unsigned int *tempdata,int regoff,int flag)
 {
        
-       if(rk2818_soc_pm.scu_suspend&&flag)
+       if(pm_ctr_callback->scu_suspend&&flag)
        {
-               rk2818_soc_pm.scu_suspend(tempdata,regoff);
+               pm_ctr_callback->scu_suspend(tempdata,regoff);
        }
        rk2818_soc_pm.scu->reg_base_addr[regoff]=*tempdata;
        rk2818_soc_pm.scu->reg_ctrbit|=(0x1<<regoff);
@@ -278,7 +274,6 @@ static void __tcmfunc rk2818_soc_scu_suspend(void)
        rk2818_soc_updata_scureg(tempdata,PM_SCU_CLKGATE1_CON,1);
        tcm_udelay(1, 24);
 
-
       *tempdata=SCU_GATE2CLK_BASE_SET&(~DIS_ITCMBUS_CLK)&(~DIS_DTCM0BUS_CLK)&(~DIS_DTCM1BUS_CLK);
        rk2818_soc_updata_scureg(tempdata,PM_SCU_CLKGATE2_CON,1);
        tcm_udelay(1, 24);
@@ -290,14 +285,11 @@ static void __tcmfunc rk2818_soc_scu_suspend(void)
        *tempdata=rk2818_scu_reg[PM_SCU_CPLL_CON] |CPLL_POERDOWN;    //dsp pll power down
        rk2818_soc_updata_scureg(tempdata,PM_SCU_CPLL_CON,1);
        tcm_udelay(1, 24);
-
-       
        rk2818_scu_reg[PM_SCU_PMU_CON] |=LCDC_POWER_DOWN;
        *tempdata=rk2818_scu_reg[PM_SCU_PMU_CON] |DSP_POWER_DOWN;
        rk2818_soc_updata_scureg(tempdata,PM_SCU_PMU_CON,1);
 
-
-
        *tempdata=rk2818_scu_reg[PM_SCU_MODE_CON] &CPU_SLOW_MODE;       //general slow mode
        rk2818_soc_updata_scureg(tempdata,PM_SCU_MODE_CON,1);
 
@@ -311,7 +303,6 @@ static void __tcmfunc rk2818_soc_scu_suspend(void)
        rk2818_soc_updata_scureg(tempdata,PM_SCU_CLKSEL0_CON,1);
        tcm_udelay(2, 24);
 
-       
        *tempdata=(rk2818_scu_reg[PM_CLKSEL2_CON]&(~0xf))|0xF;
        rk2818_soc_updata_scureg(tempdata,PM_CLKSEL2_CON,1);
 
@@ -320,7 +311,6 @@ static void __tcmfunc rk2818_soc_scu_suspend(void)
        //*tempdata=rk2818_scu_reg[PM_SCU_PMU_CON] |DDR_POWER_DOWN;
        //rk2818_soc_updata_scureg(tempdata,PM_SCU_PMU_CON,0);
 
-
        //*tempdata=rk2818_scu_reg[PM_SCU_SOFTRST_CON]|(1<<RST_DDR_BUS)|(1<<RST_DDR_CORE_LOGIC);//RST_ALL&(~(1<<RST_ARM));
        //rk2818_soc_updata_scureg(tempdata,PM_SCU_SOFTRST_CON,1);
 }
@@ -408,9 +398,9 @@ void __tcmfunc rk2818_socpm_suspend(void)
        rk2818_soc_scu_suspend();
        tcm_udelay(1, 24); //DRVDelayUs(100); 
        
-       if(rk2818_soc_pm.general_reg_suspend)
+       if(pm_ctr_callback&&pm_ctr_callback->general_reg_suspend)
        {
-               rk2818_soc_pm.general_reg_suspend();
+               pm_ctr_callback->general_reg_suspend();
        }
 #ifdef RK2818_PM_PRT_CHANGED_REG
 
@@ -435,7 +425,7 @@ void __tcmfunc rk2818_socpm_resume(void)
                rk2818_soc_resume(rk2818_soc_pm.scu->reg_save,rk2818_soc_pm.scu->reg_base_addr,
                        rk2818_soc_pm.scu->reg_ctrbit,rk2818_soc_pm.scu->reg_num);
                tcm_udelay(2, 24);
-               if(rk2818_soc_pm.general_reg_suspend)
+               if(pm_ctr_callback->general_reg_suspend)
                {
 
                        rk2818_soc_resume(rk2818_soc_pm.general->reg_save,rk2818_soc_pm.general->reg_base_addr,
@@ -463,25 +453,24 @@ 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));
        
-               if(rk2818_soc_pm.set_suspendvol)
-                       rk2818_soc_pm.set_suspendvol();
+       if(pm_ctr_callback&&pm_ctr_callback->set_pin)
+               pm_ctr_callback->set_pin();
 
 
 }
 
-void __tcmfunc rk2818_socpm_resume_first(void)
+void __tcmfunc rk2818_socpm_resume_last(void)
 {
        //unsigned int *rk2818_ddr_reg=(unsigned int *)RK2818_SDRAMC_BASE;
-       rk2818_socpm_set_gpio(RK2818_PIN_PC2,1,1);
-       if(rk2818_soc_pm.resume_vol)
-               rk2818_soc_pm.resume_vol();
 
-}
+       if(pm_ctr_callback&&pm_ctr_callback->resume_pin)
+               pm_ctr_callback->resume_pin();
 
+}
 
 void rk2818_socpm_print(void)
 {
@@ -496,22 +485,16 @@ void rk2818_socpm_print(void)
 }
 
 
-
-void rk2818_socpm_int(pm_scu_suspend scu,pm_general_reg_suspend general,
-       pm_set_suspendvol setvol,pm_resume_vol resumevol)
+int rk2818_socpm_init(struct rk2818_pm_callback_st *call_back)
 {
-               rk2818_soc_pm.scu_suspend=scu;
-               rk2818_soc_pm.general_reg_suspend=general;
-               rk2818_soc_pm.set_suspendvol=setvol;
-               rk2818_soc_pm.resume_vol=resumevol;
+       if(call_back==NULL)
+               return -1;
+       pm_ctr_callback = call_back;
+       return 0;
 
 }
 
 
-
-
-
-
 #if defined (CONFIG_RK2818_SOC_PM_DBG)
 
 static bool check_attr_dbg_value(struct rk2818_pm_attr_dbg_st *attr)
index a6ca4c1cbc4efdded2e0ef3331636d8d228582e6..d94d492dc936f8186cb1bcdcb24fc0e7f0a5d1ef 100755 (executable)
@@ -685,6 +685,16 @@ static int spi_fpga_wait_suspend(struct spi_fpga_port *port)
 \r
 static void fpga_close_power_support(void)\r
 {\r
+       //modem
+       #if 0
+       gpio_request(FPGA_PIO2_03, NULL);       
+       gpio_direction_output(FPGA_PIO2_03,GPIO_LOW); 
+       gpio_free(FPGA_PIO2_03);
+       gpio_request(FPGA_PIO2_05, NULL);       
+       gpio_direction_output(FPGA_PIO2_05,GPIO_HIGH); 
+       gpio_free(FPGA_PIO2_05);
+       #endif
+
        //cmmb power down\r
        gpio_request(FPGA_PIO4_03, NULL); \r
        gpio_direction_output(FPGA_PIO4_03,GPIO_LOW); \r
@@ -704,6 +714,16 @@ static void fpga_close_power_support(void)
 \r
 static void fpga_open_power_support(void)\r
 {\r
+       //modem
+       #if 0
+       gpio_request(FPGA_PIO2_03, NULL);       
+       gpio_direction_output(FPGA_PIO2_03,GPIO_HIGH); 
+       gpio_free(FPGA_PIO2_03);
+       gpio_request(FPGA_PIO2_05, NULL);       
+       gpio_direction_output(FPGA_PIO2_05,GPIO_LOW);
+       gpio_free(FPGA_PIO2_05);        
+       #endif
+
        //cmmb do not control here\r
 \r
        //KEY LED resume\r
@@ -712,6 +732,7 @@ static void fpga_open_power_support(void)
        gpio_free(FPGA_PIO1_13);                \r
 }\r
 \r
+\r
 static int spi_fpga_suspend(struct spi_device *spi, pm_message_t state)\r
 {\r
 \r