diff options
Diffstat (limited to 'include/charger_base.h')
-rw-r--r-- | include/charger_base.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/include/charger_base.h b/include/charger_base.h new file mode 100644 index 0000000000..efe4a6885f --- /dev/null +++ b/include/charger_base.h @@ -0,0 +1,64 @@ +/* Copyright 2023 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Charger functions related to a connected keyboard called a 'base' */ + +#ifndef __CROS_EC_CHARGER_BASE_H +#define __CROS_EC_CHARGER_BASE_H + +#include <stdbool.h> + +struct charge_state_data; + +/* allocate power between the base and the lid */ +void base_charge_allocate_input_current_limit( + const struct charge_state_data *curr, bool is_full, bool debugging); + +/* + * Check base external-power settings and react as needed + * + * @param ac Current ac value from struct charge_state_data + * @param prev_ac Previous value of ac + * Returns true if ac should be zeroed, false to leave it along + */ +bool base_check_extpower(int ac, int prev_ac); + +/* Update base battery information */ +void base_update_battery_info(void); + +#ifdef CONFIG_EC_EC_COMM_BATTERY_CLIENT +/* Check if there is a base and it is connected */ +bool base_connected(void); + +#else +static inline bool base_connected(void) +{ + return false; +} +#endif + +/* Set up the charger task for the base */ +void charger_base_setup(void); + +/* Check if charge_base has changed since last time */ +bool charger_base_charge_changed(void); + +/* Update prev_charge_base with charge_base */ +void charger_base_charge_update(void); + +/* Show the current charge level of the base on the console */ +void charger_base_show_charge(void); + +/* Check if the base charge is near full */ +bool charger_base_charge_near_full(void); + +/* Get the base input-voltage */ +int charger_base_get_input_voltage(const struct charge_state_data *curr); + +/* Set the input voltage for the base */ +void charger_base_set_input_voltage(struct charge_state_data *curr, + int input_voltage); + +#endif /* __CROS_EC_CHARGER_BASE_H */ |