diff --git a/drivers/power/charge_animation.c b/drivers/power/charge_animation.c index bd89383405..854e961798 100644 --- a/drivers/power/charge_animation.c +++ b/drivers/power/charge_animation.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -23,8 +22,11 @@ #include #include #include -#include #include +#ifdef CONFIG_IRQ +#include +#include +#endif DECLARE_GLOBAL_DATA_PTR; @@ -141,6 +143,20 @@ static int check_key_press(struct udevice *dev) return state; } +/* + * If not enable CONFIG_IRQ, cpu can't suspend to ATF or wfi, so that wakeup + * period timer is useless. + */ +#ifndef CONFIG_IRQ +static int system_suspend_enter(struct charge_animation_pdata *pdata) +{ + return 0; +} + +static void autowakeup_timer_init(struct udevice *dev, uint32_t seconds) {} +static void autowakeup_timer_uninit(void) {} + +#else static int system_suspend_enter(struct charge_animation_pdata *pdata) { if (pdata->system_suspend && IS_ENABLED(CONFIG_ARM_SMCCC)) { @@ -179,7 +195,6 @@ static int system_suspend_enter(struct charge_animation_pdata *pdata) return 0; } - static void timer_irq_handler(int irq, void *data) { struct udevice *dev = data; @@ -214,6 +229,7 @@ static void autowakeup_timer_uninit(void) { irq_free_handler(TIMER_IRQ); } +#endif #ifdef CONFIG_DRM_ROCKCHIP static void charge_show_bmp(const char *name) @@ -385,7 +401,12 @@ static int charge_animation_show(struct udevice *dev) autowakeup_timer_init(dev, pdata->auto_wakeup_interval); } +/* Give a message warning when CONFIG_IRQ is not enabled */ +#ifdef CONFIG_IRQ printf("Enter U-Boot charging mode\n"); +#else + printf("Enter U-Boot charging mode(without IRQ)\n"); +#endif charge_start = get_timer(0); delta = get_timer(0);