sasuke : lower input voltage on S0iX
Lower input voltage on S0iX to reduce power consumption
BRANCH=None
TEST=make -j BOARD=sasuke
#include "battery_fuel_gauge.h"
#include "charge_state.h"
#include "common.h"
+#include "hooks.h"
+#include "usb_pd.h"
#include "util.h"
#define CHARGING_CURRENT_REDUCE 4000
@@ -109,3 +111,23 @@ enum ec_status charger_profile_override_set_param(uint32_t param,
{
return EC_RES_INVALID_PARAM;
}
+
+/* Lower our input voltage to 5V in S0iX when battery is full. */
+static void reduce_input_voltage_when_full(void)
+{
+ int max_pd_voltage_mv;
+ int port;
+
+ if (charge_get_percent() == 100 &&
+ chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
+ max_pd_voltage_mv = 5000;
+ else
+ max_pd_voltage_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != max_pd_voltage_mv) {
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, max_pd_voltage_mv);
+ }
+}
+DECLARE_HOOK(HOOK_SECOND, reduce_input_voltage_when_full,
+ HOOK_PRIO_DEFAULT);
