summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-27 17:50:44 +1300
committerCommit Bot <commit-bot@chromium.org>2021-04-02 23:13:03 +0000
commite3cbbc3461c83d2d97b78447c53db1c6540cb3be (patch)
treebb4cc83a5c17d2b702768fbfbf20c585e4efb4ab
parent41025766295073696e2eace5b5be11cf80af525e (diff)
downloadchrome-ec-e3cbbc3461c83d2d97b78447c53db1c6540cb3be.tar.gz
zephyr: Add support for PSYS
Add support for reading the system-power value and enabling the 'psys' command. This feature is provided by some chargers, using the ADC on the EC. BUG=b:183296099 BRANCH=none TEST=with other CLs, build zephyr for lazor and see that the option is present Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I3acbb53f47e00a07b1de4d96bac05e65f13ce628 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788840 Reviewed-by: Wai-Hong Tam <waihong@google.com>
-rw-r--r--zephyr/Kconfig.battery21
-rw-r--r--zephyr/shim/include/config_chip.h10
2 files changed, 31 insertions, 0 deletions
diff --git a/zephyr/Kconfig.battery b/zephyr/Kconfig.battery
index 23614e243b..f58fad8731 100644
--- a/zephyr/Kconfig.battery
+++ b/zephyr/Kconfig.battery
@@ -231,6 +231,27 @@ config PLATFORM_EC_CHARGER_PROFILE_OVERRIDE
It may modify the parameters as needed.
+config PLATFORM_EC_CHARGER_PSYS
+ bool "Support system power-monitor (PSYS) function"
+ help
+ Enable this to support monitoring of system power using the charger's
+ PSYS function. The charger provides an output which can be read
+ using an ADC channel on the EC.
+
+config PLATFORM_EC_CHARGER_PSYS_READ
+ bool "Allow reading PSYS (system power) value"
+ depends on PLATFORM_EC_CHARGER_PSYS
+ help
+ Enable support for reading the system-power value (PSYS). This
+ calls the function charger_get_system_power() which is provided
+ by the charger.
+
+ It also enables the "psys" console command.
+
+ Sample output:
+
+ PSYS from chg_adc: 456 mW
+
config PLATFORM_EC_CHARGER_SENSE_RESISTOR
int "Value of the charge sense-resistor, in mOhms"
help
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index fd32890417..30a3e0a9f1 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -1386,4 +1386,14 @@
#define CONFIG_CHARGER_PROFILE_OVERRIDE
#endif
+#undef CONFIG_CHARGER_PSYS
+#ifdef CONFIG_PLATFORM_EC_CHARGER_PSYS
+#define CONFIG_CHARGER_PSYS
+#endif
+
+#undef CONFIG_CHARGER_PSYS_READ
+#ifdef CONFIG_PLATFORM_EC_CHARGER_PSYS_READ
+#define CONFIG_CHARGER_PSYS_READ
+#endif
+
#endif /* __CROS_EC_CONFIG_CHIP_H */