power_off.c 588 B

123456789101112131415161718192021222324252627282930
  1. //#include <common.h>
  2. //#include <asm/arch/mt65xx.h>
  3. #include <debug.h>
  4. #include <platform/mt_typedefs.h>
  5. #include <platform/mt_rtc.h>
  6. #include <platform/mtk_wdt.h>
  7. #include <platform/timer.h>
  8. extern kal_bool pmic_chrdet_status(void);
  9. #ifndef NO_POWER_OFF
  10. void mt6575_power_off(void)
  11. {
  12. int count = 0;
  13. dprintf(CRITICAL, "mt_power_off\n");
  14. /* pull PWRBB low */
  15. rtc_bbpu_power_down();
  16. while (1) {
  17. mdelay(100);
  18. dprintf(CRITICAL, "mt_power_off : check charger\n");
  19. if (pmic_chrdet_status() == KAL_TRUE || count > 10) {
  20. mtk_arch_reset(0);
  21. break;
  22. }
  23. count++;
  24. }
  25. }
  26. #endif