diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/config.h | 3 | ||||
-rw-r--r-- | include/extpower.h | 5 | ||||
-rw-r--r-- | include/extpower_falco.h | 45 |
3 files changed, 53 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h index 8cd5ffcea4..f0a0f08614 100644 --- a/include/config.h +++ b/include/config.h @@ -242,6 +242,9 @@ */ #undef CONFIG_EOPTION +/* Compile support for handling turbo-mode chargers */ +#undef CONFIG_EXTPOWER_FALCO + /* Compile support for detecting external power presence via a GPIO */ #undef CONFIG_EXTPOWER_GPIO diff --git a/include/extpower.h b/include/extpower.h index 36c5535633..1b51f3fa83 100644 --- a/include/extpower.h +++ b/include/extpower.h @@ -27,4 +27,9 @@ int extpower_is_present(void); */ void extpower_interrupt(enum gpio_signal signal); +#ifdef CONFIG_EXTPOWER_FALCO +/* Adapter-specific logic */ +#include "extpower_falco.h" +#endif + #endif /* __CROS_EC_EXTPOWER_H */ diff --git a/include/extpower_falco.h b/include/extpower_falco.h new file mode 100644 index 0000000000..6731b9f0c6 --- /dev/null +++ b/include/extpower_falco.h @@ -0,0 +1,45 @@ +/* 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 + +/* Change turbo mode or throttle the AP depending on the adapter state. */ +void watch_adapter_closely(struct power_state_context *ctx); + +#endif /* __CROS_EC_EXTPOWER_FALCO_H */ |