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

Commit 9b88a302 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: qpnp-fg-gen3: Write to profile integrity bit before restarting FG



When the profile is loaded and FG is restarted, HW will be busy
not granting SRAM access for ~330 ms. This can potentially end
up failing in writing the profile integrity bit which is done
immediately following restarting FG. Write the profile integrity
bit after loading the profile and before restarting FG so that
it will not fail.

Also, increase the number of retries while waiting for MEM_GNT to
be set, to help with any potential SRAM accesses that if made
when FG is restarted can go through.

CRs-Fixed: 2168844
Change-Id: I0c18a206e8d238b8c43f019b278dc7223228519b
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 436b6888
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -747,7 +747,7 @@ int fg_interleaved_mem_write(struct fg_chip *chip, u16 address, u8 offset,
}

#define MEM_GNT_WAIT_TIME_US	10000
#define MEM_GNT_RETRIES		20
#define MEM_GNT_RETRIES		50
static int fg_direct_mem_request(struct fg_chip *chip, bool request)
{
	int rc, ret, i = 0;
+8 −9
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2905,14 +2905,6 @@ static void profile_load_work(struct work_struct *work)
		goto out;
	}

	rc = __fg_restart(chip);
	if (rc < 0) {
		pr_err("Error in restarting FG, rc=%d\n", rc);
		goto out;
	}

	fg_dbg(chip, FG_STATUS, "SOC is ready\n");

	/* Set the profile integrity bit */
	val = HLOS_RESTART_BIT | PROFILE_LOAD_BIT;
	rc = fg_sram_write(chip, PROFILE_INTEGRITY_WORD,
@@ -2922,6 +2914,13 @@ static void profile_load_work(struct work_struct *work)
		goto out;
	}

	rc = __fg_restart(chip);
	if (rc < 0) {
		pr_err("Error in restarting FG, rc=%d\n", rc);
		goto out;
	}

	fg_dbg(chip, FG_STATUS, "SOC is ready\n");
done:
	rc = fg_bp_params_config(chip);
	if (rc < 0)