summaryrefslogtreecommitdiff
path: root/include/charger_base.h
blob: 37df73ab6f59dceadcc9251975757419d75b77a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* 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);

#endif /* __CROS_EC_CHARGER_BASE_H */