From 175257e48ba541b92e6fe8f5a3a724f00f1dd5e5 Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Tue, 4 Sep 2018 17:06:36 +0800 Subject: [PATCH] power: charge animation: support without CONFIG_IRQ enabled If CONFIG_IRQ is not enabled, cpu can't suspend to ATF or wfi, so that the wakeup period timer is useless. Give a message warning when CONFIG_IRQ is not enabled. Change-Id: I9af7e7114ab5d3b3d1026a3ba19ce6cbe56399eb Signed-off-by: Joseph Chen --- drivers/power/charge_animation.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) 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);