summaryrefslogtreecommitdiff
path: root/include/extpower_falco.h
blob: b5cbbcdc8d6b023aea8178904f9a3883a366dad6 (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
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* We can do even smarter charging if we can identify the AC adapter */

#ifndef __CROS_EC_EXTPOWER_FALCO_H
#define __CROS_EC_EXTPOWER_FALCO_H

#include "charge_state.h"

/* Supported adapters */
enum adapter_type {
	ADAPTER_UNKNOWN = 0,
	ADAPTER_45W,
	ADAPTER_65W,
	ADAPTER_90W,
	NUM_ADAPTER_TYPES
};

/* Adapter identification values */
struct adapter_id_vals {
	int lo, hi;
};

/* Adapter-specific parameters. */
struct adapter_limits {
	int hi_val, lo_val;			/* current thresholds (mA) */
	int hi_cnt, lo_cnt;			/* count needed to trigger */
	int count;				/* samples past the limit */
	int triggered;				/* threshold reached */
};

/* Rate at which adapter samples are collected. */
#define EXTPOWER_FALCO_POLL_PERIOD  (MSEC * 100)

/* Number of special states */
#define NUM_AC_TURBO_STATES 2
#define NUM_AC_THRESHOLDS 2
#define NUM_BATT_THRESHOLDS 2

/* Change turbo mode or throttle the AP depending on the adapter state. */
void watch_adapter_closely(struct charge_state_context *ctx);

#endif  /* __CROS_EC_EXTPOWER_FALCO_H */