diff options
author | Aaron Massey <aaronmassey@google.com> | 2022-03-02 17:55:03 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-03-03 19:25:30 +0000 |
commit | ffe429445e27702a8763bea5eab71045d1f35bb4 (patch) | |
tree | 12af5b9dca5df82cfea1d61a31d7693bfd87df16 /zephyr | |
parent | bdc0492846962ecaf244c5e490d27222514c5c7b (diff) | |
download | chrome-ec-ffe429445e27702a8763bea5eab71045d1f35bb4.tar.gz |
zephyr: Extract charger config to its own kconfig
Make build more tractable by moving the charger configs defined in
Kconfig.battery to separate Kconfig.charger.
BRANCH=none
BUG=b:218897689
TEST=zmake testall
Signed-off-by: Aaron Massey <aaronmassey@google.com>
Change-Id: If9c817a6a201e484bc296e4b072c6dc32da202d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3453231
Reviewed-by: Yuval Peress <peress@google.com>
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/Kconfig | 1 | ||||
-rw-r--r-- | zephyr/Kconfig.battery | 626 | ||||
-rw-r--r-- | zephyr/Kconfig.charger | 630 |
3 files changed, 631 insertions, 626 deletions
diff --git a/zephyr/Kconfig b/zephyr/Kconfig index 25e9cc22fd..9e06a724c9 100644 --- a/zephyr/Kconfig +++ b/zephyr/Kconfig @@ -37,6 +37,7 @@ rsource "shim/chip/npcx/Kconfig.npcx" rsource "Kconfig.adc" rsource "Kconfig.ap_power" rsource "Kconfig.battery" +rsource "Kconfig.charger" rsource "Kconfig.board_version" rsource "Kconfig.console" rsource "Kconfig.console_cmd_mem" diff --git a/zephyr/Kconfig.battery b/zephyr/Kconfig.battery index deaab091d9..603542703e 100644 --- a/zephyr/Kconfig.battery +++ b/zephyr/Kconfig.battery @@ -109,632 +109,6 @@ config PLATFORM_EC_I2C_VIRTUAL_BATTERY_ADDR to decrease i2c communication traffic. This should be equal to the address of real battery. -menuconfig PLATFORM_EC_CHARGER - bool "Charging support" - default y - select HAS_TASK_CHARGER - select PLATFORM_EC_EXTPOWER - help - Enable the EC charging task. This enables compilation of the - charge_state_v2 code. - -if PLATFORM_EC_CHARGER - -choice PLATFORM_EC_CHARGER_TYPE - prompt "Select how many chargers are on the board" - default PLATFORM_EC_CHARGER_SINGLE_CHIP - help - Select a single charger or multiple chargers. - Multiple chargers imply one charger per type-C port (OCPC). - -config PLATFORM_EC_CHARGER_SINGLE_CHIP - bool "Board has a single charger" - help - Enables a single charger for the board, which is assigned - index 0. - -config PLATFORM_EC_OCPC - bool "Board has multiple chargers" - help - Enables multiple chargers, one for each type-C port (OCPC). - The assumption is that that primary charger is index 0 and is the - charger IC connected to the battery FET. - Additionally, `chgnum` is assumed to be the same as the - charge port index. - -endchoice # PLATFORM_EC_CHARGER_TYPE - -config PLATFORM_EC_CHARGER_RUNTIME_CONFIG - bool "Allow charger configuration at runtime" - default n - help - When enabled, the internal array of charger chip configuration will - not be made constant. This allows board code to do runtime - reconfiguration, such as to configure ports that may only be present - in some hardware configurations or when ports in some configurations - are setup differently. - -config PLATFORM_EC_CHARGE_MANAGER - bool "Charge manager" - default y - help - The EC charge manager manages charging the battery from all supported - power sources. This includes dedicated charge ports (such as a - barrel jack connector), BC1.2 (Battery Charging 1.2) sources, and - USB-C sources. When multiple charge sources are connected to a - Chromebook simultaneously, the charge manager is responsible for - picking the best source. - - Note that the charge manager assumes that at least one USB-C power - source is available on the hardware, so cannot be built without - PLATFORM_EC_USBC. - -config PLATFORM_EC_CHARGER_ISL9237 - bool "Use the ISL9237 charger" - depends on PLATFORM_EC_I2C - select PLATFORM_EC_CHARGER_NARROW_VDC - select PLATFORM_EC_CHARGER_OTG_SUPPORTED - help - Enables a driver for the ISL9237 VCD Battery Charger. This is a - digitally-configurable, buck-boost battery charger that supporting - Narrow Voltage Direct Charging (NVDC). It supports an input voltage - range of 3.2-23.4V and output of 2.4-13.8V. It provides an I2C - interface for configuration an provides a USB On-The-Go (OTG) - function for 2- and 3-cell battery applications. - -config PLATFORM_EC_CHARGER_ISL9238 - bool "Use the ISL9238 charger" - depends on PLATFORM_EC_I2C - select PLATFORM_EC_CHARGER_NARROW_VDC - select PLATFORM_EC_CHARGER_OTG_SUPPORTED - help - Enables a driver for the ISL9238 VCD Battery Charger. This is a - digitally-configurable, buck-boost battery charger that supporting - Narrow Voltage Direct Charging (NVDC). It supports an input voltage - range of 3.2-23.4V and output of 2.4-18.3V. It provides an I2C - interface for configuration. - -config PLATFORM_EC_CHARGER_ISL9238C - bool "Use the ISL9238 Rev C charger" - depends on PLATFORM_EC_I2C - select PLATFORM_EC_CHARGER_NARROW_VDC - select PLATFORM_EC_CHARGER_OTG_SUPPORTED - help - Enable a driver for the ISL9238 Rev C VCD Battery Charger. This - is a digitally-configurable, buck-boost battery charger that - supporting Narrow Voltage Direct Charging (NVDC). It supports an input - voltage range of 3.2-23.4V and output of 2.4-18.3V. It provides an I2C - interface for configuration. - - This option is separate from PLATFORM_EC_CHARGER_ISL9238 since there - is no way in software to distinguish between rev. A/B and rev. C. - -config PLATFORM_EC_CHARGER_ISL9241 - bool "Use the ISL9241 charger" - depends on PLATFORM_EC_I2C - # Hardware based charge ramp is broken in the ISL9241 (b/169350714) - select PLATFORM_EC_CHARGER_CHGRAMP_BROKEN - 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 interface for configuration. - -config PLATFORM_EC_CHARGER_BQ25710 - bool "Use the BQ25710 charger" - depends on PLATFORM_EC_I2C - select PLATFORM_EC_CHARGER_NARROW_VDC - help - Enables the driver for the TI BQ25710 battery charger - controller. This is a synchronous narrow voltage DC buck-boost - battery charger for one to four battery cell applications. A - wide range of input power sources are supported such as high - voltage USB-C power delivery. - -config PLATFORM_EC_CHARGER_BQ25720 - bool "Use the BQ25720 charger" - depends on PLATFORM_EC_I2C - select PLATFORM_EC_CHARGER_NARROW_VDC - help - Enables the driver for the TI BQ25720 battery charger - controller. This is a synchronous narrow voltage DC buck-boost - battery charger for one to four battery cell applications. A - wide range of input power sources are supported such as high - voltage USB-C power delivery. - -config PLATFORM_EC_CHARGER_RAA489000 - bool "Use the RAA489000 charger" - depends on PLATFORM_EC_I2C - depends on PLATFORM_EC_CHARGER_SENSE_RESISTOR > 0 - depends on PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC > 0 - select PLATFORM_EC_CHARGER_NARROW_VDC - select PLATFORM_EC_CHARGER_TRICKLE - help - Enables the driver for the Renesas RAA489000 battery charger - with integrated USB-C TCPC. - -config PLATFORM_EC_CHARGER_RT9490 - bool "Use the RT9490 charger" - depends on PLATFORM_EC_I2C - select PLATFORM_EC_CHARGER_OTG_SUPPORTED - help - Enables the driver for the Richtek RT9490 battery charger - controller. This is a highly-integrated 5A Buck-Boost switch mode - battery charge management and system power path management device for - 1-4 cell Li-Ion and Li-polymer battery. - -config PLATFORM_EC_CHARGER_SM5803 - bool "Use the SM5803 charger" - depends on PLATFORM_EC_I2C - select PLATFORM_EC_CHARGER_NARROW_VDC - help - Enables the driver for the SM5803. - The SM5803 is the Silicon Mitus SM5803 Buck-Boost Charger. - - -if PLATFORM_EC_OCPC - -config PLATFORM_EC_OCPC_DEF_RBATT_MOHMS - int "Resistance between the secondary charger IC and the battery" - help - Boards using OCPC must define this value in order to seed the - starting board battery and system resistance between the secondary - charger IC and the battery. - This should be at a minimum the Rds(on) resistance of the BFET plus - the series sense resistor. - -endif # PLATFORM_EC_OCPC - -config PLATFORM_EC_CHARGER_DISCHARGE_ON_AC - bool "Board supports discharge mode" - help - Enable this if the board supports discharging the battery even when - AC power is present. This is used for testing. The function is - provided either by the charger or by custom code in the board. - -if PLATFORM_EC_CHARGER_DISCHARGE_ON_AC - -choice "Discharge control method" - prompt "Select the method of controlling discharge" - help - Select which method is provided to enable and disable the discharge - mode. - -config PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CHARGER - bool "Charger controls discharge mode" - help - Enable this if the charger controls selection of discharge mode. - In this case the charger must provide a function: - - int charger_discharge_on_ac(int enabled) - - It should enable this feature if enabled is true, else disable it. - The function should return EC_SUCCESS - -config PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CUSTOM - bool "Custom control of discharge mode" - help - Enable this if the discharge mode is controlled by a custom function. - This function is typically provided by the board implementation: - - int board_discharge_on_ac(int enabled) - - It should enable this feature if enabled is true, else disable it. - The function should return EC_SUCCESS - -endchoice # "Discharge control method" - -endif # PLATFORM_EC_CHARGER_DISCHARGE_ON_AC - -config PLATFORM_EC_CHARGER_BQ25710_PSYS_SENSING - bool "Charger monitors PSYS" - default n - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - This enables the PSYS sensing circuit on the BQ25710 and - BQ25720 chargers. This is used for system power monitoring on - board designs that support this capability. This circuit is - disabled by default (reset) and needs to be explicitly enabled - for meaningful results. - -config PLATFORM_EC_CHARGER_BQ25710_CMP_REF_1P2 - bool "Use 1.2 V for internal comparator reference voltage" - default n - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - This changes the charger's internal comparator reference - voltage to 1.2 V. The power-on default is 2.3 V. This must be - enabled if the board was designed for 1.2 V instead of 2.3 V. - -config PLATFORM_EC_CHARGER_BQ25710_PKPWR_TOVLD_DEG_CUSTOM - bool "PKPWR_TOVLD_DEG override" - default n - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - Enable customizing the charger's PKPWR_TOVLD_DEG period. - -config PLATFORM_EC_CHARGER_BQ25710_PKPWR_TOVLD_DEG - int "PKPWR_TOVLD_DEG period" - range 0 3 - default 0 - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - Sets the input overload time when in peak power mode - (PKPWR_TOVLD_DEG). This limits how long the charger can draw - ILIM2 from the adapter. This is a 2 bit field. On the bq25710 - 1 ms to 20 ms can be encoded. On the bq25720 1 ms to 10 ms can - be encoded. - -config PLATFORM_EC_CHARGER_BQ25710_EN_ACOC - bool "Enable AC over-current protection" - default n - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - This enables the charger's AC over-current protection. The - converter turns off when the OC threshold is reached. The - threshold is selected using the ACOC_VTH bit. - -config PLATFORM_EC_CHARGER_BQ25710_ACOC_VTH_1P33 - bool "Set ACOC threshold to 133% of ILIM2" - default n - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - This selects which ACOC protection threshold is used with - EN_ACOC. Enabling this option selects 133% of - ILIM2. Otherwise, the default is 200% of ILIM2. - -config PLATFORM_EC_CHARGER_BQ25710_BATOC_VTH_MINIMUM - bool "Select the minimum BATOC threshold" - default n - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - This selects the minimum BATOC protection threshold to be used - with EN_BATOC. The minimum threshold is 150% of PROCHOT IDCHG - on the bq25710 and 133% of PROCHOT IDCHG_TH2 on the - bq25720. The default threshold is 200% on both chips. - -config PLATFORM_EC_CHARGER_BQ25710_PP_INOM - bool "Enable PROCHOT on adapter current exceeding INOM" - default n - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - Sets the PP_INOM bit in Prochot Option 1 register. This causes - PROCHOT to be pulsed when the nominal adapter current - threshold is reached. INOM is 110% of IDPM/IIN_DPM (input - current setting). - -config PLATFORM_EC_CHARGER_BQ25710_PP_BATPRES - bool "Enable PROCHOT on battery removal" - default n - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - Sets the PP_BATPRES bit in Prochot Option 1 register. This - causes PROCHOT to be pulsed when the battery is removed. - -config PLATFORM_EC_CHARGER_BQ25710_PP_ACOK - bool "Enable PROCHOT on AC removal" - default n - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - Sets the PP_ACOK in Prochot Option 1 register. This causes - PROCHOT to be pulsed when the AC adapter is removed. - -config PLATFORM_EC_CHARGER_BQ25720_PP_IDCHG2 - bool "Enable PROCHOT on battery current exceeding IDCHG_TH2" - default n - depends on PLATFORM_EC_CHARGER_BQ25720 - help - Sets the PP_IDCHG2 bit in Charge Option 4 register. This - causes PROCHOT to be pulsed when the battery discharge current - exceeds IDCHG_TH2. - -config PLATFORM_EC_CHARGER_BQ25710_SENSE_RESISTOR - int "Value of the charge sense-resistor, in mOhms" - default 10 - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - 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_BQ25710_SENSE_RESISTOR_AC - int "Value of the input sense-resistor, in mOhms" - default 10 - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - 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_CHARGER_BQ257X0_ILIM2_VTH_CUSTOM - bool "ILIM2_VTH override" - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - Enable customizing the charhger's ILIM2_VTH threshold - -config PLATFORM_EC_CHARGER_BQ257X0_ILIM2_VTH - int "ILIM2 threshold" - range 1 30 - default 9 - depends on PLATFORM_EC_CHARGER_BQ257X0_ILIM2_VTH_CUSTOM - help - Set percentage of IDPM as threshold. ICRIT threshold is set to be 110% - of ILIM2. Input overcurrent protection (ACOC) threshold is also 1.33x - or 2x of ILIM2 (1.33x or 2x based on ACOC limit field). - 1 - 25: 110% - 230%, step is 5%. - 26 - 30: 250% - 450%, step is 50%. - 31: Out of range (ignored). - -config PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_CUSTOM - bool "VSYS_TH2 override" - depends on PLATFORM_EC_CHARGER_BQ25720 - help - Enable customizing the charger's VSYS_TH2 threshold. - -config PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_DV - int "VSYS threshold 2 in deci-volts" - range 32 95 - default 32 - depends on PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_CUSTOM - help - Sets the VSYS threshold 2 in deci volts. This is the first - threshold that will be encountered when VSYS droops, typically - due to high power demand from the main processor. The charger - chip reacts by asserting PROCHOT which the main processor uses - as an indication to throttle back and reduce power demand. The - charger chip uses default thresholds which may be low enough - to cause system instability. The default for 1S batteries is - 3.2v and 5.9v for 2S or higher batteries. The valid range is - 3.2v - 3.9v for 1S and 3.2 - 9.5v for 2S or higher batteries. - -config PLATFORM_EC_CHARGER_BQ25720_VSYS_UVP_CUSTOM - bool "VSYS_UVP override" - depends on PLATFORM_EC_CHARGER_BQ25720 - help - Enable customizing the charger's VSYS_UVP threshold. - -config PLATFORM_EC_CHARGER_BQ25720_VSYS_UVP - int "VSYS_UVP threshold" - range 0 7 - default 0 - depends on PLATFORM_EC_CHARGER_BQ25720_VSYS_UVP_CUSTOM - help - Sets the VSYS under voltage (VSYS_UVP) lockout threshold. This - is a 3 bit field with default value 0. The actual voltage - encoded is (0.8 * <value> + 2.4), allowing a threshold in the - range of 2.4 V to 8.0 V to be specified. - -config PLATFORM_EC_CHARGER_BQ25720_IDCHG_DEG2_CUSTOM - bool "IDCHG_TH2 deglitch time override" - depends on PLATFORM_EC_CHARGER_BQ25720 - help - Enable customizing the charger's 2nd battery discharge current - limit (IDCHG_TH2) deglitch time (IDCHG_DEG2). - -config PLATFORM_EC_CHARGER_BQ25720_IDCHG_DEG2 - int "IDCHG_TH2 deglitch time" - range 0 3 - default 1 - depends on PLATFORM_EC_CHARGER_BQ25720_IDCHG_DEG2_CUSTOM - help - Sets the 2nd battery discharge current limit (IDCHG_TH2) - deglitch time (IDCHG_DEG2). This is a 2 bit field with default - value 1 (1.6 ms). The encoded value ranges from 100 us to 12 - ms. - -config PLATFORM_EC_CHARGER_BQ25720_IDCHG_TH2_CUSTOM - bool "IDCHG_TH2 override" - depends on PLATFORM_EC_CHARGER_BQ25720 - help - Enable customizing the charger's 2nd battery discharge current - limit (IDCHG_TH2). - -config PLATFORM_EC_CHARGER_BQ25720_IDCHG_TH2 - int "IDCHG threshold 2" - range 0 7 - default 1 - depends on PLATFORM_EC_CHARGER_BQ25720_IDCHG_TH2_CUSTOM - help - Sets the charger's 2nd battery discharge current limit - (IDCHG_TH2) as a percentage of IDCHG_TH1. This is a 3 bit - field with default value 1 (150%). The encoded value ranges - from 125% to 400%. - -config PLATFORM_EC_CHARGER_BQ25710_VSYS_MIN_VOLTAGE_CUSTOM - bool "Enable minimum system voltage override" - depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 - help - Enable customizing the charger's 2nd battery discharge current - limit (IDCHG_TH2). - -config PLATFORM_EC_CHARGER_BQ25710_VSYS_MIN_VOLTAGE_MV - int "Minimum system voltage in milli-volts" - default 0 - depends on PLATFORM_EC_CHARGER_BQ25710_VSYS_MIN_VOLTAGE_CUSTOM - help - Sets the minimum system voltage in milli-volts. The bq25710 - uses 6 bits of resolution and can be configured from 1.024 V - to 16.128 V in 256 mV increments. The bq25720 uses 8 bits of - resolution and can be set from 1.0 V to 19.2 V in 100 mV - increments. The default value depends on configured number of - battery cells connected in series using the CELL_BATPRESZ - strap. - -config PLATFORM_EC_CHARGER_MAINTAIN_VBAT - bool "Maintain VBAT voltage regardless of AC state" - help - Leave the charger VBAT configured to battery-requested voltage under - all conditions, even when AC is not present. This may be necessary to - work around quirks of certain charger chips, such as the BD9995X. - -config PLATFORM_EC_CHARGER_NARROW_VDC - bool - help - Select this if the charger uses a Narrow Voltage Direct Charging. - Narrow VDC (NVDC) reduces power loss by reducing the voltage range of - the VDC node. This reduction is accomplished by replacing the - battery-charger circuit with a system-charger voltage regulator, thus - narrowing the VDC range. This in turn enables DC/DC converter - optimisations in the system and allows the removal of the power-path - switch, saving additional power, board area, and cost. - - This should be enabled by charger drivers which need it. It cannot - be set otherwise, even in prj.conf - -config PLATFORM_EC_CHARGER_TRICKLE - bool - help - Select this if the charger allows trickle charging, which allows - the battery to charge with a minimum voltage. - - This should be enabled by charger drivers which need it. - -config PLATFORM_EC_CHARGER_OTG_SUPPORTED - bool - help - Indicates that the charger supports an OTG (On-The-Go) function, - which allows supplying output power from the battery to a connected - device. - - This should be enabled by charger drivers which support it. It cannot - be set otherwise, even in prj.conf - -config PLATFORM_EC_CHARGER_OTG - bool "Allow supplying output power from the battery" - depends on PLATFORM_EC_CHARGER_OTG_SUPPORTED - help - Enable charger's OTG functions, i.e. make it possible to supply - output power from the battery. This option is available if the - selected charger supports it. - -config PLATFORM_EC_CHARGER_PROFILE_OVERRIDE - bool "Override the charger profile" - help - Select this if the charger should call battery_override_params() to - limit/correct the voltage and current requested by the battery pack - before acting on the request. - - The board must provide this function: - - void battery_override_params(struct batt_params *batt); - - 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 - 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_CHARGER_CHGRAMP_BROKEN - bool - help - This is selected if the charger's support for hardware-controlled - charge ramping is broken. In some cases the charger has problems - which make it unusable and we must fall back to software-controlled - charge ramping. - - This should be enabled by charger drivers which need it. It cannot - be set otherwise, even in prj.conf - -choice "Charge-ramp method" - prompt "Select the charge-ramp method" - help - Select the method used for ramping up charging of a battery. It is - preferred to use the hardware method if the charger chip can support - it. If not, software-controlled charging can be used, with a slight - increase in code size. - -config PLATFORM_EC_CHARGE_RAMP_HW - bool "Hardware-controlled charging" - depends on !PLATFORM_EC_CHARGER_CHGRAMP_BROKEN - help - Disables software control of ramping up charging. This is used when - the hardware has a mechanism for ramping input current and - backing-off as needed. - -config PLATFORM_EC_CHARGE_RAMP_SW - bool "Software-controlled charging" - select HAS_TASK_CHG_RAMP - help - Enables ramping up charging from an external source to the maximum - available within the source's limits and taking into account the - current needs of the device. It handles the user plugging chargers in - and removing them. - -endchoice # "Charge-ramp method" - -config PLATFORM_EC_CONSOLE_CMD_CHARGER_ADC_AMON_BMON - bool "Console command: amonbmon" - help - Enable the 'amonbmon' command. This shows the charger adapter-current - monitor (AMON) and battery-charging current monitor (BMON). - - amonbmon a | b - -config PLATFORM_EC_CONSOLE_CMD_CHGRAMP - bool "Console command: chgramp" - depends on PLATFORM_EC_CHARGE_RAMP_SW - default y - help - Enable the "chgramp" command. This shows the current state of the - chg_ramp task. It shows the state of each port and the current limit - for each port. The 'State' shown is from enum chg_ramp_state. - - Chg Ramp: - State: 5 - Min ICL: 2000 - Active ICL: 2000 - Port 0: - OC idx:0 - OC 0: s-1 oc_det0 icl0 - OC 1: s0 oc_det0 icl0 - OC 2: s0 oc_det0 icl0 - Port 1: - OC idx:0 - OC 0: s-1 oc_det0 icl0 - OC 1: s0 oc_det0 icl0 - OC 2: s0 oc_det0 icl0 - -config PLATFORM_EC_CONSOLE_CMD_CHARGER_DUMP - bool "Console command: charger dump" - help - Enable the "charger dump" subcommand. If the charger driver provides - a dump_registers() function, this command shows its register dump. - -endif # PLATFORM_EC_CHARGER - config PLATFORM_EC_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF bool "Enable battery cut off on critical power level" help diff --git a/zephyr/Kconfig.charger b/zephyr/Kconfig.charger new file mode 100644 index 0000000000..ac8dbfb191 --- /dev/null +++ b/zephyr/Kconfig.charger @@ -0,0 +1,630 @@ +# Copyright 2022 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. + +menuconfig PLATFORM_EC_CHARGER + bool "Charging support" + default y + select HAS_TASK_CHARGER + select PLATFORM_EC_EXTPOWER + depends on PLATFORM_EC_BATTERY + help + Enable the EC charging task. This enables compilation of the + charge_state_v2 code. + +if PLATFORM_EC_CHARGER + +choice PLATFORM_EC_CHARGER_TYPE + prompt "Select how many chargers are on the board" + default PLATFORM_EC_CHARGER_SINGLE_CHIP + help + Select a single charger or multiple chargers. + Multiple chargers imply one charger per type-C port (OCPC). + +config PLATFORM_EC_CHARGER_SINGLE_CHIP + bool "Board has a single charger" + help + Enables a single charger for the board, which is assigned + index 0. + +config PLATFORM_EC_OCPC + bool "Board has multiple chargers" + help + Enables multiple chargers, one for each type-C port (OCPC). + The assumption is that that primary charger is index 0 and is the + charger IC connected to the battery FET. + Additionally, `chgnum` is assumed to be the same as the + charge port index. + +endchoice # PLATFORM_EC_CHARGER_TYPE + +config PLATFORM_EC_CHARGER_RUNTIME_CONFIG + bool "Allow charger configuration at runtime" + default n + help + When enabled, the internal array of charger chip configuration will + not be made constant. This allows board code to do runtime + reconfiguration, such as to configure ports that may only be present + in some hardware configurations or when ports in some configurations + are setup differently. + +config PLATFORM_EC_CHARGE_MANAGER + bool "Charge manager" + default y + help + The EC charge manager manages charging the battery from all supported + power sources. This includes dedicated charge ports (such as a + barrel jack connector), BC1.2 (Battery Charging 1.2) sources, and + USB-C sources. When multiple charge sources are connected to a + Chromebook simultaneously, the charge manager is responsible for + picking the best source. + + Note that the charge manager assumes that at least one USB-C power + source is available on the hardware, so cannot be built without + PLATFORM_EC_USBC. + +config PLATFORM_EC_CHARGER_ISL9237 + bool "Use the ISL9237 charger" + depends on PLATFORM_EC_I2C + select PLATFORM_EC_CHARGER_NARROW_VDC + select PLATFORM_EC_CHARGER_OTG_SUPPORTED + help + Enables a driver for the ISL9237 VCD Battery Charger. This is a + digitally-configurable, buck-boost battery charger that supporting + Narrow Voltage Direct Charging (NVDC). It supports an input voltage + range of 3.2-23.4V and output of 2.4-13.8V. It provides an I2C + interface for configuration an provides a USB On-The-Go (OTG) + function for 2- and 3-cell battery applications. + +config PLATFORM_EC_CHARGER_ISL9238 + bool "Use the ISL9238 charger" + depends on PLATFORM_EC_I2C + select PLATFORM_EC_CHARGER_NARROW_VDC + select PLATFORM_EC_CHARGER_OTG_SUPPORTED + help + Enables a driver for the ISL9238 VCD Battery Charger. This is a + digitally-configurable, buck-boost battery charger that supporting + Narrow Voltage Direct Charging (NVDC). It supports an input voltage + range of 3.2-23.4V and output of 2.4-18.3V. It provides an I2C + interface for configuration. + +config PLATFORM_EC_CHARGER_ISL9238C + bool "Use the ISL9238 Rev C charger" + depends on PLATFORM_EC_I2C + select PLATFORM_EC_CHARGER_NARROW_VDC + select PLATFORM_EC_CHARGER_OTG_SUPPORTED + help + Enable a driver for the ISL9238 Rev C VCD Battery Charger. This + is a digitally-configurable, buck-boost battery charger that + supporting Narrow Voltage Direct Charging (NVDC). It supports an input + voltage range of 3.2-23.4V and output of 2.4-18.3V. It provides an I2C + interface for configuration. + + This option is separate from PLATFORM_EC_CHARGER_ISL9238 since there + is no way in software to distinguish between rev. A/B and rev. C. + +config PLATFORM_EC_CHARGER_ISL9241 + bool "Use the ISL9241 charger" + depends on PLATFORM_EC_I2C + # Hardware based charge ramp is broken in the ISL9241 (b/169350714) + select PLATFORM_EC_CHARGER_CHGRAMP_BROKEN + 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 interface for configuration. + +config PLATFORM_EC_CHARGER_BQ25710 + bool "Use the BQ25710 charger" + depends on PLATFORM_EC_I2C + select PLATFORM_EC_CHARGER_NARROW_VDC + help + Enables the driver for the TI BQ25710 battery charger + controller. This is a synchronous narrow voltage DC buck-boost + battery charger for one to four battery cell applications. A + wide range of input power sources are supported such as high + voltage USB-C power delivery. + +config PLATFORM_EC_CHARGER_BQ25720 + bool "Use the BQ25720 charger" + depends on PLATFORM_EC_I2C + select PLATFORM_EC_CHARGER_NARROW_VDC + help + Enables the driver for the TI BQ25720 battery charger + controller. This is a synchronous narrow voltage DC buck-boost + battery charger for one to four battery cell applications. A + wide range of input power sources are supported such as high + voltage USB-C power delivery. + +config PLATFORM_EC_CHARGER_RAA489000 + bool "Use the RAA489000 charger" + depends on PLATFORM_EC_I2C + depends on PLATFORM_EC_CHARGER_SENSE_RESISTOR > 0 + depends on PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC > 0 + select PLATFORM_EC_CHARGER_NARROW_VDC + select PLATFORM_EC_CHARGER_TRICKLE + help + Enables the driver for the Renesas RAA489000 battery charger + with integrated USB-C TCPC. + +config PLATFORM_EC_CHARGER_RT9490 + bool "Use the RT9490 charger" + depends on PLATFORM_EC_I2C + select PLATFORM_EC_CHARGER_OTG_SUPPORTED + help + Enables the driver for the Richtek RT9490 battery charger + controller. This is a highly-integrated 5A Buck-Boost switch mode + battery charge management and system power path management device for + 1-4 cell Li-Ion and Li-polymer battery. + +config PLATFORM_EC_CHARGER_SM5803 + bool "Use the SM5803 charger" + depends on PLATFORM_EC_I2C + select PLATFORM_EC_CHARGER_NARROW_VDC + help + Enables the driver for the SM5803. + The SM5803 is the Silicon Mitus SM5803 Buck-Boost Charger. + + +if PLATFORM_EC_OCPC + +config PLATFORM_EC_OCPC_DEF_RBATT_MOHMS + int "Resistance between the secondary charger IC and the battery" + help + Boards using OCPC must define this value in order to seed the + starting board battery and system resistance between the secondary + charger IC and the battery. + This should be at a minimum the Rds(on) resistance of the BFET plus + the series sense resistor. + +endif # PLATFORM_EC_OCPC + +config PLATFORM_EC_CHARGER_DISCHARGE_ON_AC + bool "Board supports discharge mode" + help + Enable this if the board supports discharging the battery even when + AC power is present. This is used for testing. The function is + provided either by the charger or by custom code in the board. + +if PLATFORM_EC_CHARGER_DISCHARGE_ON_AC + +choice "Discharge control method" + prompt "Select the method of controlling discharge" + help + Select which method is provided to enable and disable the discharge + mode. + +config PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CHARGER + bool "Charger controls discharge mode" + help + Enable this if the charger controls selection of discharge mode. + In this case the charger must provide a function: + + int charger_discharge_on_ac(int enabled) + + It should enable this feature if enabled is true, else disable it. + The function should return EC_SUCCESS + +config PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CUSTOM + bool "Custom control of discharge mode" + help + Enable this if the discharge mode is controlled by a custom function. + This function is typically provided by the board implementation: + + int board_discharge_on_ac(int enabled) + + It should enable this feature if enabled is true, else disable it. + The function should return EC_SUCCESS + +endchoice # "Discharge control method" + +endif # PLATFORM_EC_CHARGER_DISCHARGE_ON_AC + +config PLATFORM_EC_CHARGER_BQ25710_PSYS_SENSING + bool "Charger monitors PSYS" + default n + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + This enables the PSYS sensing circuit on the BQ25710 and + BQ25720 chargers. This is used for system power monitoring on + board designs that support this capability. This circuit is + disabled by default (reset) and needs to be explicitly enabled + for meaningful results. + +config PLATFORM_EC_CHARGER_BQ25710_CMP_REF_1P2 + bool "Use 1.2 V for internal comparator reference voltage" + default n + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + This changes the charger's internal comparator reference + voltage to 1.2 V. The power-on default is 2.3 V. This must be + enabled if the board was designed for 1.2 V instead of 2.3 V. + +config PLATFORM_EC_CHARGER_BQ25710_PKPWR_TOVLD_DEG_CUSTOM + bool "PKPWR_TOVLD_DEG override" + default n + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + Enable customizing the charger's PKPWR_TOVLD_DEG period. + +config PLATFORM_EC_CHARGER_BQ25710_PKPWR_TOVLD_DEG + int "PKPWR_TOVLD_DEG period" + range 0 3 + default 0 + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + Sets the input overload time when in peak power mode + (PKPWR_TOVLD_DEG). This limits how long the charger can draw + ILIM2 from the adapter. This is a 2 bit field. On the bq25710 + 1 ms to 20 ms can be encoded. On the bq25720 1 ms to 10 ms can + be encoded. + +config PLATFORM_EC_CHARGER_BQ25710_EN_ACOC + bool "Enable AC over-current protection" + default n + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + This enables the charger's AC over-current protection. The + converter turns off when the OC threshold is reached. The + threshold is selected using the ACOC_VTH bit. + +config PLATFORM_EC_CHARGER_BQ25710_ACOC_VTH_1P33 + bool "Set ACOC threshold to 133% of ILIM2" + default n + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + This selects which ACOC protection threshold is used with + EN_ACOC. Enabling this option selects 133% of + ILIM2. Otherwise, the default is 200% of ILIM2. + +config PLATFORM_EC_CHARGER_BQ25710_BATOC_VTH_MINIMUM + bool "Select the minimum BATOC threshold" + default n + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + This selects the minimum BATOC protection threshold to be used + with EN_BATOC. The minimum threshold is 150% of PROCHOT IDCHG + on the bq25710 and 133% of PROCHOT IDCHG_TH2 on the + bq25720. The default threshold is 200% on both chips. + +config PLATFORM_EC_CHARGER_BQ25710_PP_INOM + bool "Enable PROCHOT on adapter current exceeding INOM" + default n + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + Sets the PP_INOM bit in Prochot Option 1 register. This causes + PROCHOT to be pulsed when the nominal adapter current + threshold is reached. INOM is 110% of IDPM/IIN_DPM (input + current setting). + +config PLATFORM_EC_CHARGER_BQ25710_PP_BATPRES + bool "Enable PROCHOT on battery removal" + default n + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + Sets the PP_BATPRES bit in Prochot Option 1 register. This + causes PROCHOT to be pulsed when the battery is removed. + +config PLATFORM_EC_CHARGER_BQ25710_PP_ACOK + bool "Enable PROCHOT on AC removal" + default n + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + Sets the PP_ACOK in Prochot Option 1 register. This causes + PROCHOT to be pulsed when the AC adapter is removed. + +config PLATFORM_EC_CHARGER_BQ25720_PP_IDCHG2 + bool "Enable PROCHOT on battery current exceeding IDCHG_TH2" + default n + depends on PLATFORM_EC_CHARGER_BQ25720 + help + Sets the PP_IDCHG2 bit in Charge Option 4 register. This + causes PROCHOT to be pulsed when the battery discharge current + exceeds IDCHG_TH2. + +config PLATFORM_EC_CHARGER_BQ25710_SENSE_RESISTOR + int "Value of the charge sense-resistor, in mOhms" + default 10 + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + 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_BQ25710_SENSE_RESISTOR_AC + int "Value of the input sense-resistor, in mOhms" + default 10 + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + 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_CHARGER_BQ257X0_ILIM2_VTH_CUSTOM + bool "ILIM2_VTH override" + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + Enable customizing the charhger's ILIM2_VTH threshold + +config PLATFORM_EC_CHARGER_BQ257X0_ILIM2_VTH + int "ILIM2 threshold" + range 1 30 + default 9 + depends on PLATFORM_EC_CHARGER_BQ257X0_ILIM2_VTH_CUSTOM + help + Set percentage of IDPM as threshold. ICRIT threshold is set to be 110% + of ILIM2. Input overcurrent protection (ACOC) threshold is also 1.33x + or 2x of ILIM2 (1.33x or 2x based on ACOC limit field). + 1 - 25: 110% - 230%, step is 5%. + 26 - 30: 250% - 450%, step is 50%. + 31: Out of range (ignored). + +config PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_CUSTOM + bool "VSYS_TH2 override" + depends on PLATFORM_EC_CHARGER_BQ25720 + help + Enable customizing the charger's VSYS_TH2 threshold. + +config PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_DV + int "VSYS threshold 2 in deci-volts" + range 32 95 + default 32 + depends on PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_CUSTOM + help + Sets the VSYS threshold 2 in deci volts. This is the first + threshold that will be encountered when VSYS droops, typically + due to high power demand from the main processor. The charger + chip reacts by asserting PROCHOT which the main processor uses + as an indication to throttle back and reduce power demand. The + charger chip uses default thresholds which may be low enough + to cause system instability. The default for 1S batteries is + 3.2v and 5.9v for 2S or higher batteries. The valid range is + 3.2v - 3.9v for 1S and 3.2 - 9.5v for 2S or higher batteries. + +config PLATFORM_EC_CHARGER_BQ25720_VSYS_UVP_CUSTOM + bool "VSYS_UVP override" + depends on PLATFORM_EC_CHARGER_BQ25720 + help + Enable customizing the charger's VSYS_UVP threshold. + +config PLATFORM_EC_CHARGER_BQ25720_VSYS_UVP + int "VSYS_UVP threshold" + range 0 7 + default 0 + depends on PLATFORM_EC_CHARGER_BQ25720_VSYS_UVP_CUSTOM + help + Sets the VSYS under voltage (VSYS_UVP) lockout threshold. This + is a 3 bit field with default value 0. The actual voltage + encoded is (0.8 * <value> + 2.4), allowing a threshold in the + range of 2.4 V to 8.0 V to be specified. + +config PLATFORM_EC_CHARGER_BQ25720_IDCHG_DEG2_CUSTOM + bool "IDCHG_TH2 deglitch time override" + depends on PLATFORM_EC_CHARGER_BQ25720 + help + Enable customizing the charger's 2nd battery discharge current + limit (IDCHG_TH2) deglitch time (IDCHG_DEG2). + +config PLATFORM_EC_CHARGER_BQ25720_IDCHG_DEG2 + int "IDCHG_TH2 deglitch time" + range 0 3 + default 1 + depends on PLATFORM_EC_CHARGER_BQ25720_IDCHG_DEG2_CUSTOM + help + Sets the 2nd battery discharge current limit (IDCHG_TH2) + deglitch time (IDCHG_DEG2). This is a 2 bit field with default + value 1 (1.6 ms). The encoded value ranges from 100 us to 12 + ms. + +config PLATFORM_EC_CHARGER_BQ25720_IDCHG_TH2_CUSTOM + bool "IDCHG_TH2 override" + depends on PLATFORM_EC_CHARGER_BQ25720 + help + Enable customizing the charger's 2nd battery discharge current + limit (IDCHG_TH2). + +config PLATFORM_EC_CHARGER_BQ25720_IDCHG_TH2 + int "IDCHG threshold 2" + range 0 7 + default 1 + depends on PLATFORM_EC_CHARGER_BQ25720_IDCHG_TH2_CUSTOM + help + Sets the charger's 2nd battery discharge current limit + (IDCHG_TH2) as a percentage of IDCHG_TH1. This is a 3 bit + field with default value 1 (150%). The encoded value ranges + from 125% to 400%. + +config PLATFORM_EC_CHARGER_BQ25710_VSYS_MIN_VOLTAGE_CUSTOM + bool "Enable minimum system voltage override" + depends on PLATFORM_EC_CHARGER_BQ25710 || PLATFORM_EC_CHARGER_BQ25720 + help + Enable customizing the charger's 2nd battery discharge current + limit (IDCHG_TH2). + +config PLATFORM_EC_CHARGER_BQ25710_VSYS_MIN_VOLTAGE_MV + int "Minimum system voltage in milli-volts" + default 0 + depends on PLATFORM_EC_CHARGER_BQ25710_VSYS_MIN_VOLTAGE_CUSTOM + help + Sets the minimum system voltage in milli-volts. The bq25710 + uses 6 bits of resolution and can be configured from 1.024 V + to 16.128 V in 256 mV increments. The bq25720 uses 8 bits of + resolution and can be set from 1.0 V to 19.2 V in 100 mV + increments. The default value depends on configured number of + battery cells connected in series using the CELL_BATPRESZ + strap. + +config PLATFORM_EC_CHARGER_MAINTAIN_VBAT + bool "Maintain VBAT voltage regardless of AC state" + help + Leave the charger VBAT configured to battery-requested voltage under + all conditions, even when AC is not present. This may be necessary to + work around quirks of certain charger chips, such as the BD9995X. + +config PLATFORM_EC_CHARGER_NARROW_VDC + bool + help + Select this if the charger uses a Narrow Voltage Direct Charging. + Narrow VDC (NVDC) reduces power loss by reducing the voltage range of + the VDC node. This reduction is accomplished by replacing the + battery-charger circuit with a system-charger voltage regulator, thus + narrowing the VDC range. This in turn enables DC/DC converter + optimisations in the system and allows the removal of the power-path + switch, saving additional power, board area, and cost. + + This should be enabled by charger drivers which need it. It cannot + be set otherwise, even in prj.conf + +config PLATFORM_EC_CHARGER_TRICKLE + bool + help + Select this if the charger allows trickle charging, which allows + the battery to charge with a minimum voltage. + + This should be enabled by charger drivers which need it. + +config PLATFORM_EC_CHARGER_OTG_SUPPORTED + bool + help + Indicates that the charger supports an OTG (On-The-Go) function, + which allows supplying output power from the battery to a connected + device. + + This should be enabled by charger drivers which support it. It cannot + be set otherwise, even in prj.conf + +config PLATFORM_EC_CHARGER_OTG + bool "Allow supplying output power from the battery" + depends on PLATFORM_EC_CHARGER_OTG_SUPPORTED + help + Enable charger's OTG functions, i.e. make it possible to supply + output power from the battery. This option is available if the + selected charger supports it. + +config PLATFORM_EC_CHARGER_PROFILE_OVERRIDE + bool "Override the charger profile" + help + Select this if the charger should call battery_override_params() to + limit/correct the voltage and current requested by the battery pack + before acting on the request. + + The board must provide this function: + + void battery_override_params(struct batt_params *batt); + + 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 + 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_CHARGER_CHGRAMP_BROKEN + bool + help + This is selected if the charger's support for hardware-controlled + charge ramping is broken. In some cases the charger has problems + which make it unusable and we must fall back to software-controlled + charge ramping. + + This should be enabled by charger drivers which need it. It cannot + be set otherwise, even in prj.conf + +choice "Charge-ramp method" + prompt "Select the charge-ramp method" + help + Select the method used for ramping up charging of a battery. It is + preferred to use the hardware method if the charger chip can support + it. If not, software-controlled charging can be used, with a slight + increase in code size. + +config PLATFORM_EC_CHARGE_RAMP_HW + bool "Hardware-controlled charging" + depends on !PLATFORM_EC_CHARGER_CHGRAMP_BROKEN + help + Disables software control of ramping up charging. This is used when + the hardware has a mechanism for ramping input current and + backing-off as needed. + +config PLATFORM_EC_CHARGE_RAMP_SW + bool "Software-controlled charging" + select HAS_TASK_CHG_RAMP + help + Enables ramping up charging from an external source to the maximum + available within the source's limits and taking into account the + current needs of the device. It handles the user plugging chargers in + and removing them. + +endchoice # "Charge-ramp method" + +config PLATFORM_EC_CONSOLE_CMD_CHARGER_ADC_AMON_BMON + bool "Console command: amonbmon" + help + Enable the 'amonbmon' command. This shows the charger adapter-current + monitor (AMON) and battery-charging current monitor (BMON). + + amonbmon a | b + +config PLATFORM_EC_CONSOLE_CMD_CHGRAMP + bool "Console command: chgramp" + depends on PLATFORM_EC_CHARGE_RAMP_SW + default y + help + Enable the "chgramp" command. This shows the current state of the + chg_ramp task. It shows the state of each port and the current limit + for each port. The 'State' shown is from enum chg_ramp_state. + + Chg Ramp: + State: 5 + Min ICL: 2000 + Active ICL: 2000 + Port 0: + OC idx:0 + OC 0: s-1 oc_det0 icl0 + OC 1: s0 oc_det0 icl0 + OC 2: s0 oc_det0 icl0 + Port 1: + OC idx:0 + OC 0: s-1 oc_det0 icl0 + OC 1: s0 oc_det0 icl0 + OC 2: s0 oc_det0 icl0 + +config PLATFORM_EC_CONSOLE_CMD_CHARGER_DUMP + bool "Console command: charger dump" + help + Enable the "charger dump" subcommand. If the charger driver provides + a dump_registers() function, this command shows its register dump. + +endif # PLATFORM_EC_CHARGER |