Reland "zephyr: Add battery and smart battery options"
This is a reland of ac4f512e60
Original change's description:
> zephyr: Add battery and smart battery options
>
> Shim in battery and smart battery support.
>
> BUG=b:175248556
> BRANCH=none
> TEST=boot on volteer, run 'battery' command.
> TEST=run 'ninja menuconfig' and check KConfig help text.
> 20-12-10 20:08:12.778 battery
> 20-12-10 20:08:13.509 Status: 0x02c0 DCHG INIT RC
> 20-12-10 20:08:13.529 Param flags:00000003
> 20-12-10 20:08:13.541 Temp: 0x0b63 = %.1d K (%.1d C)
> 20-12-10 20:08:13.541 V: 0x2a1e = 10782 mV
> 20-12-10 20:08:13.541 V-desired: 0x3390 = 13200 mV
> 20-12-10 20:08:13.541 I: 0x0000 = 0 mA
> 20-12-10 20:08:13.550 I-desired: 0x0a19 = 2585 mA
> 20-12-10 20:08:13.550 Charging: Allowed
> 20-12-10 20:08:13.550 Charge: 0 %
> 20-12-10 20:08:13.550 Manuf: LG
> 20-12-10 20:08:13.555 Device: AC17A8
> 20-12-10 20:08:13.573 Chem: LIO
> 20-12-10 20:08:13.573 Serial: 0xb754
> 20-12-10 20:08:13.573 V-design: 0x2d1e = 11550 mV
> 20-12-10 20:08:13.573 Mode: 0x6001
> 20-12-10 20:08:13.573 Abs charge:0 %
> 20-12-10 20:08:13.573 Remaining: 0 mAh
> 20-12-10 20:08:13.577 Cap-full: 4932 mAh (4833 mAh with 98 % compensation)
> 20-12-10 20:08:13.585 Design: 5360 mAh
> 20-12-10 20:08:13.594 Time-full: 0h:0
> 20-12-10 20:08:13.594 Empty: 0h:0
>
> Change-Id: Ie782e75ee4027ab2a5c6a0ae7f4ad81e9c360711
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575199
Bug: b:175248556
TEST=make buildall, which fails with:
/opt/coreboot-sdk/lib/gcc/nds32le-elf/8.3.0/../../../../nds32le-elf/bin/ld: __flash_dma_size < IT83XX_ILM_BLOCK_SIZE
BRANCH=none
Change-Id: I318fb13ba91485cd7d876b2294f20d748f47e0fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2585931
Tested-by: Simon Glass <sjg@chromium.org>
Auto-Submit: Simon Glass <sjg@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
This commit is contained in:
parent
5f0df61bad
commit
6dc2111008
|
@ -43,6 +43,10 @@ zephyr_sources_ifdef(CONFIG_PLATFORM_EC "${PLATFORM_EC}/common/base32.c"
|
|||
|
||||
# Now include files that depend on or relate to other CONFIG options, sorted by
|
||||
# CONFIG
|
||||
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_BATTERY "${PLATFORM_EC}/common/battery.c")
|
||||
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_BATTERY_SMART
|
||||
"${PLATFORM_EC}/driver/battery/smart.c")
|
||||
|
||||
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_CBI "${PLATFORM_EC}/common/cbi.c")
|
||||
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_POWERSEQ
|
||||
"${PLATFORM_EC}/common/chipset.c")
|
||||
|
|
|
@ -12,6 +12,7 @@ menuconfig PLATFORM_EC
|
|||
|
||||
if PLATFORM_EC
|
||||
|
||||
rsource "Kconfig.battery"
|
||||
rsource "Kconfig.powerseq"
|
||||
rsource "Kconfig.tasks"
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
# Copyright 2020 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.
|
||||
|
||||
config PLATFORM_EC_BATTERY
|
||||
bool "Support batteries"
|
||||
help
|
||||
Enables battery support on the board. Requires selection of a battery
|
||||
and a charger IC.
|
||||
|
||||
If using I2C batteries, you must define I2C_PORT_BATTERY in your
|
||||
board's i2c_map.h file so that the EC code will know which I2C
|
||||
port the battery is on.
|
||||
|
||||
if PLATFORM_EC_BATTERY
|
||||
|
||||
choice "Battery select"
|
||||
prompt "Select the battery to use"
|
||||
help
|
||||
Select the battery used on the board. If you are ensure, select the
|
||||
smart battery option.
|
||||
|
||||
config PLATFORM_EC_BATTERY_SMART
|
||||
bool "Support a smart battery"
|
||||
depends on PLATFORM_EC_I2C
|
||||
help
|
||||
Many batteries support the Smart Battery Specification and therefore
|
||||
have common registers which can be accessed to control and monitor
|
||||
the battery.
|
||||
|
||||
See here for the spec: http://sbs-forum.org/specs/sbdat110.pdf
|
||||
|
||||
endchoice
|
||||
|
||||
choice "Charger select"
|
||||
prompt "Select the charger to use"
|
||||
help
|
||||
Select the battery charger IC used on the board. Only one charger may
|
||||
be selected.
|
||||
|
||||
config PLATFORM_EC_CHARGER_ISL9241
|
||||
bool "Use the ISL9241 charger"
|
||||
depends on PLATFORM_EC_I2C
|
||||
help
|
||||
Enables a driver for the ISL9241 VCD Battery Charger. This is a
|
||||
digitally-configurable, buck-boost battery charger that can support
|
||||
both Narrow Voltage Direct Charging (NVDC) and Hybrid Power Buck Boost
|
||||
(HPBB/Bypass) charging and switch between the modes under firmware
|
||||
control. It supports an input voltage range of 3.9-23.4V and output
|
||||
of 3.9-18.3V. It provides an I2C interace for configuration.
|
||||
|
||||
endchoice
|
||||
|
||||
endif # PLATFORM_EC_BATTERY
|
|
@ -26,6 +26,26 @@
|
|||
#define CONFIG_CHIPSET_TIGERLAKE
|
||||
#endif
|
||||
|
||||
/* Battery configuration */
|
||||
#undef CONFIG_BATTERY
|
||||
#undef CONFIG_BATTERY_FUEL_GAUGE
|
||||
#ifdef CONFIG_PLATFORM_EC_BATTERY
|
||||
#define CONFIG_BATTERY
|
||||
#define CONFIG_BATTERY_FUEL_GAUGE
|
||||
#endif
|
||||
|
||||
#undef CONFIG_CHARGER_ISL9241
|
||||
#ifdef CONFIG_PLATFORM_EC_CHARGER_ISL9241
|
||||
#define CONFIG_CHARGER_ISL9241
|
||||
/* Hardware based charge ramp is broken in the ISL9241 (b/169350714) */
|
||||
#define CONFIG_CHARGE_RAMP_SW
|
||||
#endif
|
||||
|
||||
#undef CONFIG_BATTERY_SMART
|
||||
#ifdef CONFIG_PLATFORM_EC_BATTERY_SMART
|
||||
#define CONFIG_BATTERY_SMART
|
||||
#endif
|
||||
|
||||
/* eSPI configuration */
|
||||
#ifdef CONFIG_PLATFORM_EC_ESPI
|
||||
|
||||
|
|
Loading…
Reference in New Issue