summaryrefslogtreecommitdiff
path: root/include/charger.h
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2020-05-08 17:22:22 -0700
committerCommit Bot <commit-bot@chromium.org>2020-06-04 02:50:29 +0000
commitca454e7f6ec451d7fcee5287534e6b63533b0b2f (patch)
tree2bd2d0f9ea55b2165cb22c2e52f5996127a83e5d /include/charger.h
parent533c749098b53ec3e640f874dab20dda8adbd086 (diff)
downloadchrome-ec-ca454e7f6ec451d7fcee5287534e6b63533b0b2f.tar.gz
OCPC: charger: Add support for VSYS compensation
Some charger ICs can compensate VSYS for losses across the board when charging from an auxiliary charger in an OCPC scheme. This commit adds that support to the common charger and OCPC framework such that it can be leveraged. Charger ICs which can dynamically compensate and don't need continuous adjustments should return EC_SUCCESS as the PID won't be needed. Other chargers should return EC_ERROR_UNIMPLEMENTED since they require continuous adjustments. BUG=b:147440290,b:148980016 BRANCH=None TEST=With driver changes made for RAA48900, build and flash on waddledoo, verify that charging from the sub board works on board revs 0 and 1. TEST=`make -j buildall` Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Ie6fb27260b2d6e040dbfdc0aaa5b64b52173037c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2191298 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'include/charger.h')
-rw-r--r--include/charger.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/charger.h b/include/charger.h
index 310643017b..41f22adfad 100644
--- a/include/charger.h
+++ b/include/charger.h
@@ -9,6 +9,7 @@
#define __CROS_EC_CHARGER_H
#include "common.h"
+#include "ocpc.h"
/* Charger information
* voltage unit: mV
@@ -106,6 +107,16 @@ struct charger_drv {
int (*ramp_is_stable)(int chgnum);
int (*ramp_is_detected)(int chgnum);
int (*ramp_get_current_limit)(int chgnum);
+
+ /* OCPC functions */
+ /*
+ * Some chargers can perform VSYS output compensation. Configure the
+ * charger IC with the right parameters.
+ */
+ enum ec_error_list (*set_vsys_compensation)(int chgnum,
+ struct ocpc_data *o,
+ int current_ma,
+ int voltage_mv);
};
struct charger_config_t {
@@ -251,6 +262,24 @@ enum ec_error_list charger_get_option(int *option);
enum ec_error_list charger_set_option(int option);
enum ec_error_list charger_set_hw_ramp(int enable);
+/**
+ * Some charger ICs can compensate for board losses if charging from an
+ * auxiliary charger in a multi-charger IC design. (CONFIG_OCPC) Some of those
+ * charger ICs can dynamically compensate meaning that the PID loop may not be
+ * needed. For the others, it still will be needed. The charger driver should
+ * return the appropriate action.
+ *
+ * @param chgnum: Active charge port
+ * @param ocpc: Pointer to ocpc data
+ * @param current_ma: Desired charge current
+ * @param voltage_mv: Desired charge voltage
+ * @return EC_SUCCESS on success, error otherwise.
+ */
+enum ec_error_list charger_set_vsys_compensation(int chgnum,
+ struct ocpc_data *ocpc,
+ int current_ma,
+ int voltage_mv);
+
/*
* Print all charger info for debugging purposes
* @param chgnum: charger IC index.