diff options
author | Simon Glass <sjg@chromium.org> | 2021-03-27 15:52:27 +1300 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-01 05:50:51 +0000 |
commit | 6c1b3648fd83c8e260e46f9b038fa79c6d0458b4 (patch) | |
tree | 8efd76436247a95aac3a3abacb5476083b382a32 | |
parent | 338ad19ff83e09b5ce59ed2c10c45ef191ea0482 (diff) | |
download | chrome-ec-6c1b3648fd83c8e260e46f9b038fa79c6d0458b4.tar.gz |
zephyr: Add support for setting charger sense-resistors
We need a different value for lazor, so move this to Kconfig. We may at
some point move this to device tree.
BUG=b:183296099, b:175881762
BRANCH=none
TEST=with other CLs, build zephyr for lazor and see that the option is
present
build config for volteer and make sure it has not changed
Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: I7b5fa6a03ba24028006f6a1a8516e9244308fe76
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788833
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | zephyr/Kconfig.battery | 14 | ||||
-rw-r--r-- | zephyr/projects/trogdor/lazor/prj.conf | 2 | ||||
-rw-r--r-- | zephyr/projects/volteer/volteer/prj.conf | 2 | ||||
-rw-r--r-- | zephyr/shim/include/config_chip.h | 16 |
4 files changed, 30 insertions, 4 deletions
diff --git a/zephyr/Kconfig.battery b/zephyr/Kconfig.battery index a7ad8d74aa..4a41f7f60e 100644 --- a/zephyr/Kconfig.battery +++ b/zephyr/Kconfig.battery @@ -218,6 +218,20 @@ config PLATFORM_EC_CHARGER_NARROW_VDC This should be enabled by charger drivers which need it. It cannot be set otherwise, even in prj.conf +config PLATFORM_EC_CHARGER_SENSE_RESISTOR + int "Value of the charge sense-resistor, in mOhms" + help + The charge sense-resistor is used to detect the charge current to the + battery. Its value must be known for the calculation to be correct. + The value is typically around 10 mOhms. + +config PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC + int "Value of the input sense-resistor, in mOhms" + help + The input sense-resistor is used to detect the input current from the + external AC power supply. Its value must be known for the calculation + to be correct. The value is typically around 10 mOhms. + config PLATFORM_EC_BATTERY_FUEL_GAUGE bool "Board supplies battery info" help diff --git a/zephyr/projects/trogdor/lazor/prj.conf b/zephyr/projects/trogdor/lazor/prj.conf index 25dcae5e4a..ec9cc78c66 100644 --- a/zephyr/projects/trogdor/lazor/prj.conf +++ b/zephyr/projects/trogdor/lazor/prj.conf @@ -60,6 +60,8 @@ CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y CONFIG_PLATFORM_EC_CHARGER_ISL9238=y CONFIG_PLATFORM_EC_CHARGE_RAMP_HW=y +CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10 +CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=20 # USB-A CONFIG_PLATFORM_EC_USB_A_PORT_COUNT=1 diff --git a/zephyr/projects/volteer/volteer/prj.conf b/zephyr/projects/volteer/volteer/prj.conf index c1b8bc73c7..571f4fb66e 100644 --- a/zephyr/projects/volteer/volteer/prj.conf +++ b/zephyr/projects/volteer/volteer/prj.conf @@ -109,6 +109,8 @@ CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON=3 CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC=1 CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT=15000 CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON=15001 +CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10 +CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=10 CONFIG_HAS_TASK_USB_CHG_P1=y CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y CONFIG_PLATFORM_EC_USB_PID=0x503e diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h index e4d792f8b6..dc73ceae97 100644 --- a/zephyr/shim/include/config_chip.h +++ b/zephyr/shim/include/config_chip.h @@ -191,10 +191,6 @@ #undef CONFIG_CHARGER_ISL9241 #ifdef CONFIG_PLATFORM_EC_CHARGER_ISL9241 #define CONFIG_CHARGER_ISL9241 - -/* TODO(b/175881762): Move to devicetree? */ -#define CONFIG_CHARGER_SENSE_RESISTOR 10 -#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 #endif /* @@ -1373,4 +1369,16 @@ #define CONFIG_CHARGER_DISCHARGE_ON_AC_CUSTOM #endif +#undef CONFIG_CHARGER_SENSE_RESISTOR +#ifdef CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR +#define CONFIG_CHARGER_SENSE_RESISTOR \ + CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR +#endif + +#undef CONFIG_CHARGER_SENSE_RESISTOR_AC +#ifdef CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC +#define CONFIG_CHARGER_SENSE_RESISTOR_AC \ + CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC +#endif + #endif /* __CROS_EC_CONFIG_CHIP_H */ |