From 44b90ca659489361dae9981ebbcda2498f0b43bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E5=AE=8B=E7=A7=80=E6=9D=B0?= Date: Thu, 14 Oct 2010 19:09:49 -0700 Subject: [PATCH] rk2818-socpm.c: set callback function. pm.c: delete unused code,move lp8725 voltage control into callback --- arch/arm/mach-rk2818/board-raho.c | 72 ++- arch/arm/mach-rk2818/board-rahosdk.c | 72 ++- .../mach-rk2818/include/mach/rk2818-socpm.h | 27 +- arch/arm/mach-rk2818/pm.c | 428 +----------------- arch/arm/mach-rk2818/rk2818-socpm.c | 57 +-- drivers/fpga/spi_fpga_init.c | 21 + 6 files changed, 182 insertions(+), 495 deletions(-) mode change 100644 => 100755 arch/arm/mach-rk2818/board-rahosdk.c diff --git a/arch/arm/mach-rk2818/board-raho.c b/arch/arm/mach-rk2818/board-raho.c index 76d3871adc76..851f115fc540 100755 --- a/arch/arm/mach-rk2818/board-raho.c +++ b/arch/arm/mach-rk2818/board-raho.c @@ -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 diff --git a/arch/arm/mach-rk2818/board-rahosdk.c b/arch/arm/mach-rk2818/board-rahosdk.c old mode 100644 new mode 100755 index 280248714804..a242a5c3de89 --- a/arch/arm/mach-rk2818/board-rahosdk.c +++ b/arch/arm/mach-rk2818/board-rahosdk.c @@ -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; diff --git a/arch/arm/mach-rk2818/include/mach/rk2818-socpm.h b/arch/arm/mach-rk2818/include/mach/rk2818-socpm.h index 0f7d430402ef..ed98c6392a13 100755 --- a/arch/arm/mach-rk2818/include/mach/rk2818-socpm.h +++ b/arch/arm/mach-rk2818/include/mach/rk2818-socpm.h @@ -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) - - - - - /***********************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() diff --git a/arch/arm/mach-rk2818/pm.c b/arch/arm/mach-rk2818/pm.c index 95e0ae92149d..ea7be85587ff 100755 --- a/arch/arm/mach-rk2818/pm.c +++ b/arch/arm/mach-rk2818/pm.c @@ -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<>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 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(); diff --git a/arch/arm/mach-rk2818/rk2818-socpm.c b/arch/arm/mach-rk2818/rk2818-socpm.c index dc12906a8938..fe4829269e01 100755 --- a/arch/arm/mach-rk2818/rk2818-socpm.c +++ b/arch/arm/mach-rk2818/rk2818-socpm.c @@ -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<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) diff --git a/drivers/fpga/spi_fpga_init.c b/drivers/fpga/spi_fpga_init.c index a6ca4c1cbc4e..d94d492dc936 100755 --- a/drivers/fpga/spi_fpga_init.c +++ b/drivers/fpga/spi_fpga_init.c @@ -685,6 +685,16 @@ static int spi_fpga_wait_suspend(struct spi_fpga_port *port) static void fpga_close_power_support(void) { + //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 gpio_request(FPGA_PIO4_03, NULL); gpio_direction_output(FPGA_PIO4_03,GPIO_LOW); @@ -704,6 +714,16 @@ static void fpga_close_power_support(void) static void fpga_open_power_support(void) { + //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 //KEY LED resume @@ -712,6 +732,7 @@ static void fpga_open_power_support(void) gpio_free(FPGA_PIO1_13); } + static int spi_fpga_suspend(struct spi_device *spi, pm_message_t state) { -- 2.34.1