summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenny Ho <hsiufangho@google.com>2023-09-07 10:54:43 +0800
committerJenny Ho <hsiufangho@google.com>2023-09-08 04:25:00 +0000
commitdd7c3caf5f0dfd8d62e88d418685a4bc9bf8887f (patch)
tree22c4de77b00597e8e577102b23d6a37f6826d965
parent6dba90075d71778bcbb6f9ab65d972f64424d10d (diff)
downloadbms-dd7c3caf5f0dfd8d62e88d418685a4bc9bf8887f.tar.gz
max1720x_battery: moving lock and wakeup_source from init to probe
Need to initialize lock and wakeup_source before max1720x_get_property using these functions Bug: 292440112 Change-Id: Ie765ba5033190990fbb8a59faac2bf7abe5b1688 Signed-off-by: Jenny Ho <hsiufangho@google.com> (cherry picked from commit 59344ee1f2c69c2e63ad6e9b56dc4108903b16b7)
-rw-r--r--max1720x_battery.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/max1720x_battery.c b/max1720x_battery.c
index 11210a5..c6e0f15 100644
--- a/max1720x_battery.c
+++ b/max1720x_battery.c
@@ -4939,9 +4939,6 @@ static int max1720x_init_chip(struct max1720x_chip *chip)
dev_warn(chip->dev, "Cannot write 0x0 to Config(%d)\n", ret);
}
- /* fuel gauge model needs to know the batt_id */
- mutex_init(&chip->model_lock);
-
/*
* The behavior of the drift workaround changes with the capacity
* learning algo used in the part. Integrated FG might have
@@ -5751,10 +5748,6 @@ static void max1720x_init_work(struct work_struct *work)
ret = batt_ce_load_data(&chip->regmap_nvram, &chip->cap_estimate);
if (ret == 0)
batt_ce_dump_data(&chip->cap_estimate, chip->ce_log);
-
- chip->get_prop_ws = wakeup_source_register(NULL, "GetProp");
- if (!chip->get_prop_ws)
- dev_info(chip->dev, "failed to register wakeup sources\n");
}
/* TODO: fix detection of 17301 for non samples looking at FW version too */
@@ -6039,6 +6032,13 @@ static int max1720x_probe(struct i2c_client *client,
dev_info(dev, "max1720x_psy_desc.name=%s\n", chip->max1720x_psy_desc.name);
+ /* fuel gauge model needs to know the batt_id */
+ mutex_init(&chip->model_lock);
+
+ chip->get_prop_ws = wakeup_source_register(NULL, "GetProp");
+ if (!chip->get_prop_ws)
+ dev_info(chip->dev, "failed to register wakeup sources\n");
+
chip->max1720x_psy_desc.type = POWER_SUPPLY_TYPE_BATTERY;
chip->max1720x_psy_desc.get_property = max1720x_get_property;
chip->max1720x_psy_desc.set_property = max1720x_set_property;