From a6eaffe40d5e2b697686d56a648d98aca376284d Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Tue, 30 Nov 2021 02:38:05 +0000 Subject: powermgmt: Remove CURRENT_USB CURRENT_USB overrides CURRENT_NORMAL when USB is plugged. It defaults to 2 mA and wasn't defined on any target, but this doesn't make sense to me. After all, the current drawn by the CPU or other components won't change just because USB was plugged in. As far as I can tell, the only side effect of removing this is reducing the estimated USB charging current. This might mean CURRENT_MAX_CHG should be increased by CURRENT_NORMAL on some (all?) targets to compensate, but I'm not sure which targets would be affected. Change-Id: I5aa5c3893ae1e4ce6b8803ab4e8c897d534eb08f --- firmware/export/powermgmt.h | 7 ------- firmware/powermgmt.c | 12 ------------ 2 files changed, 19 deletions(-) diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h index 41594abe4d..a78386445e 100644 --- a/firmware/export/powermgmt.h +++ b/firmware/export/powermgmt.h @@ -84,13 +84,6 @@ enum shutdown_type /* Start up power management thread */ void powermgmt_init(void) INIT_ATTR; -/* Generic current values that are intentionally meaningless - config header - * should define proper numbers.*/ - -#ifndef CURRENT_USB -#define CURRENT_USB 2 /* usual current in mA in USB mode */ -#endif - #if CONFIG_CHARGING && !defined(CURRENT_MAX_CHG) #define CURRENT_MAX_CHG 350 /* maximum charging current */ #endif diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index abcd32f814..e455127496 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -190,18 +190,6 @@ int battery_current(void) int current = CURRENT_NORMAL; #ifndef BOOTLOADER - if (usb_inserted() -#ifdef HAVE_USB_POWER - #if (CURRENT_USB < CURRENT_NORMAL) - || usb_powered_only() - #else - && !usb_powered_only() - #endif -#endif - ) { - current = CURRENT_USB; - } - #if defined(HAVE_BACKLIGHT) && defined(CURRENT_BACKLIGHT) if (backlight_get_current_timeout() == 0) /* LED always on */ current += CURRENT_BACKLIGHT; -- cgit v1.2.3