/* ************************************************************************************************************ * * function * * name : * * parmeters : * * return : * * note : * * ************************************************************************************************************ */ int sunxi_board_shutdown(void) { #if defined(CONFIG_SUNXI_RTC) printf("rtc disable\n"); rtc_disable(); #endif printf("set next system normal\n"); axp_set_next_poweron_status(0x0); board_display_set_exit_mode(0); #ifdef CONFIG_SUNXI_DISPLAY drv_disp_exit(); #endif sunxi_flash_exit(1); //强制关闭FLASH sunxi_sprite_exit(1); disable_interrupts(); interrupt_exit(); tick_printf("power off\n"); axp_set_hardware_poweroff_vol(); axp_set_power_off(); #if defined(CONFIG_ARCH_SUN8IW7P1) power_off(); #endif return 0; }
/* ************************************************************************************************************ * * function * * 函数名称:axp_probe_startup_check_factory_mode * * 参数列表: * * 返回值 : * * 说明 :用于样机恢复出厂设置后,第一次启动系统要求,要在USB或火牛存在情况下才能按按键启动,启动后清除标志 * * ************************************************************************************************************ */ int axp_probe_factory_mode(void) { int buffer_value, status; int poweron_reason; buffer_value = sunxi_axp_dev[0]->probe_pre_sys_mode(); if(buffer_value == PMU_PRE_FACTORY_MODE) //factory mode: need the power key and dc or vbus { printf("factory mode detect\n"); status = sunxi_axp_dev[0]->probe_power_status(); if(status > 0) //has the dc or vbus { //获取 开机原因,是按键触发,或者插入电压触发 poweron_reason = sunxi_axp_dev[0]->probe_this_poweron_cause(); if(poweron_reason == AXP_POWER_ON_BY_POWER_KEY) { //set the system next powerom status as 0x0e(the system mode) printf("factory mode release\n"); sunxi_axp_dev[0]->set_next_sys_mode(PMU_PRE_SYS_MODE); } else { printf("factory mode: try to poweroff without power key\n"); axp_set_hardware_poweron_vol(); //poweroff axp_set_power_off(); for(;;); } } else { printf("factory mode: try to poweroff without power in\n"); axp_set_hardware_poweroff_vol(); //poweroff axp_set_power_off(); for(;;); } } return 0; }
int sunxi_board_shutdown(void) { printf("set next system normal\n"); axp_set_next_poweron_status(0x0); #ifdef CONFIG_SUNXI_DISPLAY board_display_set_exit_mode(0); drv_disp_exit(); #endif sunxi_flash_exit(1); sunxi_sprite_exit(1); disable_interrupts(); interrupt_exit(); tick_printf("power off\n"); axp_set_hardware_poweroff_vol(); axp_set_power_off(); return 0; }