Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b54a5a1 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy Committed by Abhijeet Dharmapurikar
Browse files

power: qpnp-fg: fix error in delayed_init_work



Commit c4301419358485fa265df9c1adac9ec1a600418c ("power:
qpnp-fg: reduce the probe time of driver) moved the hardware
initialization to delayed_init_work to improve the driver probe
time. However, with the recent change made in update_sram_data
to wait for SRAM access to be revoked before updating SRAM
parameters times out because the access is held by the callee
itself.

This eventually causes error in fg_batt_profile_init as below.

[    9.547366] FG: fg_hw_init: set default value to esr filter
[   12.542896] FG: update_sram_data_work: transaction timed out ret=0
[   17.539999] FG: fg_batt_profile_init: profile loading timed out rc=-110
[   17.545583] FG: batt_profile_init: failed to initialize profile

Fix this.

CRs-Fixed: 844197
Change-Id: I16f52f991ccccc275a945874bfe86259a5ec97f1
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 1ad669d2
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -5170,15 +5170,17 @@ static void delayed_init_work(struct work_struct *work)
				init_work);

	/* hold memory access until initialization finishes */
	atomic_add_return(1, &chip->memif_user_cnt);
	fg_mem_lock(chip);

	rc = fg_hw_init(chip);
	if (rc) {
		pr_err("failed to hw init rc = %d\n", rc);
		fg_release_access_if_necessary(chip);
		fg_mem_release(chip);
		fg_cleanup(chip);
		return;
	}
	/* release memory access before update_sram_data is called */
	fg_mem_release(chip);

	schedule_delayed_work(
		&chip->update_jeita_setting,
@@ -5190,9 +5192,6 @@ static void delayed_init_work(struct work_struct *work)
	if (chip->last_temp_update_time == 0)
		update_temp_data(&chip->update_temp_work.work);

	/* release memory access if necessary */
	fg_release_access_if_necessary(chip);

	if (!chip->use_otp_profile)
		schedule_work(&chip->batt_profile_init);