fg/sm5602: Early detection device chipID

it should add device id detect before parse dtsi,
otherwise it will effect other fgauge boot time

Change-Id: If5d6e2de0a8783c40b4b60097baff1ffe3fa97e5
Reviewed-on: https://gerrit.mot.com/2144787
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Submit-Approved: Jira Key
This commit is contained in:
wutao 2021-12-15 11:23:39 +08:00 • committed by huaqin89
commit bc1f9b3b7d

View file

@ -2173,11 +2173,6 @@ static bool fg_init(struct i2c_client *client)
struct sm_fg_chip *sm = i2c_get_clientdata(client);
/*sm5602 i2c read check*/
ret = fg_get_device_id(client);
if (ret < 0) {
pr_err("%s: fail to do i2c read(%d)\n", __func__, ret);
return false;
}
if (fg_check_reg_init_need(client)) {
ret = fg_reset(sm);
@ -2631,8 +2626,16 @@ static int fg_battery_parse_dt(struct sm_fg_chip *sm)
bool hal_fg_init(struct i2c_client *client)
{
struct sm_fg_chip *sm = i2c_get_clientdata(client);
int ret = 0;
pr_info("sm5602 hal_fg_init...\n");
ret = fg_get_device_id(client);
if (ret < 0) {
pr_err("%s: fail to do i2c read(%d)\n", __func__, ret);
return false;
}
mutex_lock(&sm->data_lock);
if (client->dev.of_node) {
/* Load common data from DTS*/