summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYiHsiang Peng <yihsiangpeng@google.com>2023-06-21 07:11:49 +0000
committerTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2023-08-14 15:28:37 +0000
commit1e82101f48bd6ab93d0ae59338c5286490cb8750 (patch)
tree3c9911e8242b014c2a66cc5865499612c077b7a9
parentc61a148b3a07ecd2b2f1cd73fc96d582509e6835 (diff)
downloadbms-1e82101f48bd6ab93d0ae59338c5286490cb8750.tar.gz
p9221_charger: check dc_icl votable exist before setting auth_icl
p9221_set_auth_dc_icl() may run before p9221_set_dc_icl() runs, this will cause failure to enter HPP mode. Bug: 291876901 Change-Id: I35f347ba5239b148594255229e8ec59738723760 Signed-off-by: YiHsiang Peng <yihsiangpeng@google.com> (cherry picked from commit b537905b0d63a14fc3989869e9b101be403e7ff2)
-rw-r--r--p9221_charger.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/p9221_charger.c b/p9221_charger.c
index ac1202a..3c0221a 100644
--- a/p9221_charger.c
+++ b/p9221_charger.c
@@ -2293,8 +2293,14 @@ int p9221_set_auth_dc_icl(struct p9221_charger_data *charger, bool enable)
icl_ua = enable ? P9221_AUTH_DC_ICL_UA_500 : 0;
- if (!charger->dc_icl_votable)
- goto exit;
+ if (!charger->dc_icl_votable) {
+ charger->dc_icl_votable = gvotable_election_get_handle("DC_ICL");
+ if (!charger->dc_icl_votable) {
+ dev_err(&charger->client->dev,
+ "Could not get votable: DC_ICL\n");
+ goto exit;
+ }
+ }
if (enable && !charger->auth_delay) {
dev_info(&charger->client->dev, "Enable Auth ICL (%d)\n", ret);