--- ../linux/arch/arm/mach-pxa/sharpsl_power.c 2004-03-08 14:15:52.000000000 +0900 +++ linux/arch/arm/mach-pxa/sharpsl_power.c 2004-07-10 00:44:19.000000000 +0900 @@ -193,6 +193,7 @@ u32 sharpsl_emergency_off = 0; unsigned int sharpsl_chg_freq = 0x0145; static DECLARE_WAIT_QUEUE_HEAD(wq_off); +static DECLARE_WAIT_QUEUE_HEAD(key_off); int sharpsl_off_mode = 0; int sharpsl_off_state = 0; int pass_charge_flag = 0; @@ -212,6 +213,10 @@ //@@extern int sharpsl_get_jacket_status(void); //@@#endif +#if defined(CONFIG_SL_CCCR_CHANGE) +extern unsigned int cccr_clkparam; +#endif + void PrintParamTable(void); #ifdef CONFIG_SABINAL_DISCOVERY @@ -711,6 +716,15 @@ cccr_reg = CCCR; break; #endif +#if defined(CONFIG_SL_CCCR_CHANGE) + default: + if ( (sharpsl_chg_freq & 0xffff) !=0 ){ + cccr_clkparam = (unsigned int)(sharpsl_chg_freq & 0xffff); + cpu_xscale_sl_change_speed_num(); + cccr_reg = CCCR; + } + break; +#endif } sharpsl_chg_freq &= 0x0000ffff; mdelay(500); @@ -1217,8 +1231,15 @@ #if defined(CONFIG_ARCH_PXA_SHEPHERD) || defined(CONFIG_ARCH_PXA_TOSA) else if ( sharpsl_chg_freq == 0x0161 ) { cpu_xscale_sl_change_speed_161(); +#endif +#if defined(CONFIG_SL_CCCR_CHANGE) } + else if ( sharpsl_chg_freq != 0x0 ){ + cccr_clkparam = (unsigned int)sharpsl_chg_freq; + cpu_xscale_sl_change_speed_num(); #endif + } + cccr_reg = CCCR; printk("FCS : CCCR = %x\n",cccr_reg); @@ -1687,6 +1708,48 @@ return 0; } +#if defined(CONFIG_SL7X0_POWER_KEY_OFF) +static int key_suspend_thread(void* unused) +{ + int time_cnt = 0; + + // daemonize(); + strcpy(current->comm, "off_thread"); + sigfillset(¤t->blocked); + + while(1) { + sleep_on(&key_off); + printk("start off sequence ! \n"); + + handle_scancode(SLKEY_OFF|KBDOWN , 1); + mdelay(10); + handle_scancode(SLKEY_OFF|KBUP , 0); + + // wait off signal + // if can not recieve off siganl , so force off. +// time_cnt = jiffies; +// while(1) { +// if ( ( jiffies - time_cnt ) > 500 ) break; +// schedule(); +// } + + // maybe apps is dead, so we have to restart. + pm_do_suspend(); + } + return 0; +} + +void slc7x0_key_suspend(void) +{ + apm_wakeup_src_mask = 0; + wake_up(&key_off); +} + +EXPORT_SYMBOL(slc7x0_key_suspend); + +#endif + + #if defined(CONFIG_ARCH_PXA_SHEPHERD) || defined(CONFIG_ARCH_PXA_TOSA) static struct timer_list bat_switch_timer; @@ -1773,6 +1836,9 @@ } kernel_thread(sharpsl_off_thread, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD); +#if defined(CONFIG_SL7X0_POWER_KEY_OFF) + kernel_thread(key_suspend_thread, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND | SIGCHLD); +#endif #if defined(CONFIG_ARCH_PXA_SHEPHERD) || defined(CONFIG_ARCH_PXA_TOSA) //#if defined(CONFIG_ARCH_PXA_SHEPHERD) init_timer(&bat_switch_timer);