diff options
author | ben chen <ben.chen2@quanta.corp-partner.google.com> | 2023-02-15 09:27:57 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-02-15 08:24:01 +0000 |
commit | f487fa9d324e292f5f647bcc488b9960168934ae (patch) | |
tree | b95486aca47b1adbf35f88f5df6143b6d6964f5f | |
parent | 2d45809d07944fe2488f37b644eb277e6ef35101 (diff) | |
download | chrome-ec-f487fa9d324e292f5f647bcc488b9960168934ae.tar.gz |
kuldax: Using fw_config return peripheral charger count
Using fw_config control in board_get_pchg_count() to determined
pchg_count at runtime. some sku w/wo pheripheral charger.
peripheral_charger flag address bit5 size 1 of cbi fw_config:
0 :PERIPHERAL_CHARGER_ENABLE
1 :PERIPHERAL_CHARGER_DISABLE
BUG=b:267700817
BRANCH=None
TEST=make BOARD PASS
Change-Id: I19fe61b910274a5f1594d3d9410dfcb317a61c46
Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4252926
Reviewed-by: Derek Huang <derekhuang@google.com>
Commit-Queue: Derek Huang <derekhuang@google.com>
-rw-r--r-- | board/kuldax/board.c | 6 | ||||
-rw-r--r-- | board/kuldax/fw_config.c | 5 | ||||
-rw-r--r-- | board/kuldax/fw_config.h | 16 |
3 files changed, 25 insertions, 2 deletions
diff --git a/board/kuldax/board.c b/board/kuldax/board.c index 3b1b55b87c..c462672ba8 100644 --- a/board/kuldax/board.c +++ b/board/kuldax/board.c @@ -69,7 +69,11 @@ __override void board_pchg_power_on(int port, bool on) int board_get_pchg_count(void) { - return ARRAY_SIZE(pchgs); + if (ec_cfg_has_peripheral_charger()) { + return ARRAY_SIZE(pchgs); + } else { + return 0; + } } /******************************************************************************/ diff --git a/board/kuldax/fw_config.c b/board/kuldax/fw_config.c index 4229f3bed1..7f0204f667 100644 --- a/board/kuldax/fw_config.c +++ b/board/kuldax/fw_config.c @@ -71,3 +71,8 @@ void ec_bj_power(uint32_t *voltage, uint32_t *current) *voltage = bj_power[bj].voltage; *current = bj_power[bj].current; } + +bool ec_cfg_has_peripheral_charger(void) +{ + return (fw_config.peripheral_charger == PERIPHERAL_CHARGER_ENABLE); +} diff --git a/board/kuldax/fw_config.h b/board/kuldax/fw_config.h index d7fa0a11a9..cdba1b16d7 100644 --- a/board/kuldax/fw_config.h +++ b/board/kuldax/fw_config.h @@ -17,11 +17,20 @@ enum ec_cfg_audio_type { DB_AUDIO_UNKNOWN = 0, DB_NAU88L25B_I2S = 1 }; enum ec_cfg_bj_power { BJ_150W = 0, BJ_230W = 1, BJ_65W = 2, BJ_135W = 3 }; +/* + * Peripheral charger (Bits 5) + */ +enum ec_cfg_peripheral_charger { + PERIPHERAL_CHARGER_ENABLE = 0, + PERIPHERAL_CHARGER_DISABLE = 1 +}; + union brask_cbi_fw_config { struct { uint32_t audio : 3; uint32_t bj_power : 2; - uint32_t reserved_1 : 27; + uint32_t peripheral_charger : 1; + uint32_t reserved_1 : 26; }; uint32_t raw_value; }; @@ -38,4 +47,9 @@ union brask_cbi_fw_config get_fw_config(void); */ void ec_bj_power(uint32_t *voltage, uint32_t *current); +/** + * SWITCH the peripheral charger function enable/disable from FW_CONFIG. + */ +bool ec_cfg_has_peripheral_charger(void); + #endif /* __BOARD_BRASK_FW_CONFIG_H_ */ |