summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoy Cho <joy.cho@hardkernel.com>2020-11-28 15:51:12 +0300
committerJoy Cho <joy.cho@hardkernel.com>2020-12-02 10:34:40 +0300
commit59472e110b7145bb9cb40722859b15d270d3ff8f (patch)
treee5d9e209f0e7713e97c95483041eccbdebab0dac
parent68e7d4d0e26298eb518808256d09214d5477b1ee (diff)
downloadu-boot-59472e110b7145bb9cb40722859b15d270d3ff8f.tar.xz
ODROID-GOA: Update charge LED control during charge animation
- charging off : LED Off - charging on & soc < 100 : LED Toggle - charging on & soc == 100 (full charged) : Keep LED On Change-Id: Ib71fab99b758523f0dbcf73d41c4cdced192949e
-rw-r--r--arch/arm/dts/odroidgo2-kernel-v11.dts4
-rw-r--r--arch/arm/dts/odroidgo2-kernel.dts4
-rw-r--r--arch/arm/dts/odroidgo3-kernel.dts4
-rw-r--r--board/rockchip/odroidgo3/odroidgo3_power.c4
-rw-r--r--drivers/power/charge_animation.c20
5 files changed, 25 insertions, 11 deletions
diff --git a/arch/arm/dts/odroidgo2-kernel-v11.dts b/arch/arm/dts/odroidgo2-kernel-v11.dts
index 17824074af..39a1bf24ef 100644
--- a/arch/arm/dts/odroidgo2-kernel-v11.dts
+++ b/arch/arm/dts/odroidgo2-kernel-v11.dts
@@ -142,9 +142,9 @@
};
battery {
- label = "battery_full";
+ label = "battery_charging";
gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
- default-state = "off";
+ default-state = "on";
};
};
diff --git a/arch/arm/dts/odroidgo2-kernel.dts b/arch/arm/dts/odroidgo2-kernel.dts
index 27e7379fba..bf415034bf 100644
--- a/arch/arm/dts/odroidgo2-kernel.dts
+++ b/arch/arm/dts/odroidgo2-kernel.dts
@@ -132,9 +132,9 @@
};
battery {
- label = "battery_full";
+ label = "battery_charging";
gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
- default-state = "off";
+ default-state = "on";
};
};
diff --git a/arch/arm/dts/odroidgo3-kernel.dts b/arch/arm/dts/odroidgo3-kernel.dts
index 6f83bef9d7..03cea18692 100644
--- a/arch/arm/dts/odroidgo3-kernel.dts
+++ b/arch/arm/dts/odroidgo3-kernel.dts
@@ -167,9 +167,9 @@
};
battery {
- label = "battery_full";
+ label = "battery_charging";
gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;
- default-state = "off";
+ default-state = "on";
};
};
diff --git a/board/rockchip/odroidgo3/odroidgo3_power.c b/board/rockchip/odroidgo3/odroidgo3_power.c
index 131d5e43ab..5cb32acd78 100644
--- a/board/rockchip/odroidgo3/odroidgo3_power.c
+++ b/board/rockchip/odroidgo3/odroidgo3_power.c
@@ -19,8 +19,8 @@
void board_chg_led(void)
{
gpio_request(CHG_LED_GPIO, "chg_led");
- /* default on */
- gpio_direction_output(CHG_LED_GPIO, 1);
+ /* default off, controlled by charge animation logic */
+ gpio_direction_output(CHG_LED_GPIO, 0);
gpio_free(CHG_LED_GPIO);
}
diff --git a/drivers/power/charge_animation.c b/drivers/power/charge_animation.c
index 2451f54427..c8b31e554e 100644
--- a/drivers/power/charge_animation.c
+++ b/drivers/power/charge_animation.c
@@ -351,7 +351,7 @@ static void charge_show_bmp(int idx, struct udevice *fg)
lcd_setfg_color("white");
lcd_printf(0, 24, 1, "%s", cmd);
- sprintf(cmd, "current %d mA", current_avg);
+ sprintf(cmd, "current : %d mA", current_avg);
lcd_printf(0, 26, 1, "%s", cmd);
@@ -376,15 +376,21 @@ static void charge_show_logo(void) {}
static int leds_update(struct udevice *dev, int soc)
{
struct charge_animation_priv *priv = dev_get_priv(dev);
- static int old_soc = -1;
int ret, ledst;
+#if !defined(CONFIG_PLATFORM_ODROID_GOADV)
+ static int old_soc = -1;
if (old_soc == soc)
return 0;
old_soc = soc;
+#endif
if (priv->led_charging) {
+#if defined(CONFIG_PLATFORM_ODROID_GOADV)
+ ledst = (soc < 100) ? LEDST_TOGGLE : LEDST_OFF;
+#else
ledst = (soc < 100) ? LEDST_ON : LEDST_OFF;
+#endif
ret = led_set_state(priv->led_charging, ledst);
if (ret) {
printf("set charging led %s failed, ret=%d\n",
@@ -591,6 +597,9 @@ static int charge_animation_show(struct udevice *dev)
ever_lowpower_screen_off = true;
#if defined(CONFIG_PLATFORM_ODROID_GOADV)
lcd_onoff(false);
+
+ /* set CHG LED on before screen off */
+ led_set_state(priv->led_charging, LEDST_ON);
#else
charge_show_bmp(NULL);
#endif
@@ -688,11 +697,12 @@ show_images:
current, charging, screen_on);
}
+#if !defined(CONFIG_PLATFORM_ODROID_GOADV)
/* Update leds */
ret = leds_update(dev, soc);
if (ret)
printf("update led failed: %d\n", ret);
-
+#endif
/*
* If ever lowpower screen off, force screen_on=false, which
* means key event can't modify screen_on, only voltage higher
@@ -752,6 +762,7 @@ show_images:
debug("SHOW: %s\n", image[show_idx].name);
#if defined(CONFIG_PLATFORM_ODROID_GOADV)
charge_show_bmp(show_idx, fg);
+ leds_update(dev, soc);
#else
charge_show_bmp(image[show_idx].name);
#endif
@@ -804,6 +815,9 @@ show_images:
if (screen_on) {
#if defined(CONFIG_PLATFORM_ODROID_GOADV)
lcd_onoff(false);
+
+ /* set CHG LED on before screen off */
+ led_set_state(priv->led_charging, LEDST_ON);
#else
charge_show_bmp(NULL); /* Turn off screen */
#endif