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

Commit f995ef60 authored by Kyle Yan's avatar Kyle Yan
Browse files

soc: qcom: Vote for bus scaling before enabling regulators and clocks



RPMh can prevent clocks from turning if the bus is not properly scaled yet.
Reorder bus scaling votes to happen before enabling regulators or clocks.

Change-Id: I22bc750951f1b0fa75921944713738b945f597d0
Signed-off-by: default avatarKyle Yan <kyan@codeaurora.org>
parent e4e90297
Loading
Loading
Loading
Loading
+20 −21
Original line number Diff line number Diff line
@@ -536,30 +536,29 @@ static int pil_make_proxy_vote(struct pil_desc *pil)
	if (d->subsys_desc.no_auth)
		return 0;

	rc = enable_regulators(d, pil->dev, d->proxy_regs,
					d->proxy_reg_count, false);
	if (rc)
		return rc;

	rc = prepare_enable_clocks(pil->dev, d->proxy_clks,
							d->proxy_clk_count);
	if (rc)
		goto err_clks;

	if (d->bus_client) {
		rc = msm_bus_scale_client_update_request(d->bus_client, 1);
		if (rc) {
			dev_err(pil->dev, "bandwidth request failed(rc:%d)\n",
									rc);
			goto err_bw;
			return rc;
		}
	} else
		WARN(d->enable_bus_scaling, "Bus scaling not set up for %s!\n",
					d->subsys_desc.name);

	rc = enable_regulators(d, pil->dev, d->proxy_regs,
					d->proxy_reg_count, false);
	if (rc)
		return rc;

	rc = prepare_enable_clocks(pil->dev, d->proxy_clks,
							d->proxy_clk_count);
	if (rc)
		goto err_clks;

	return 0;
err_bw:
	disable_unprepare_clocks(d->proxy_clks, d->proxy_clk_count);

err_clks:
	disable_regulators(d, d->proxy_regs, d->proxy_reg_count, false);

@@ -573,15 +572,15 @@ static void pil_remove_proxy_vote(struct pil_desc *pil)
	if (d->subsys_desc.no_auth)
		return;

	disable_unprepare_clocks(d->proxy_clks, d->proxy_clk_count);

	disable_regulators(d, d->proxy_regs, d->proxy_reg_count, true);

	if (d->bus_client)
		msm_bus_scale_client_update_request(d->bus_client, 0);
	else
		WARN(d->enable_bus_scaling, "Bus scaling not set up for %s!\n",
					d->subsys_desc.name);

	disable_unprepare_clocks(d->proxy_clks, d->proxy_clk_count);

	disable_regulators(d, d->proxy_regs, d->proxy_reg_count, true);
}

static int pil_init_image_trusted(struct pil_desc *pil,
@@ -693,6 +692,10 @@ static int pil_auth_and_reset(struct pil_desc *pil)
	desc.args[0] = proc = d->pas_id;
	desc.arginfo = SCM_ARGS(1);

	rc = scm_pas_enable_bw();
	if (rc)
		return rc;

	rc = enable_regulators(d, pil->dev, d->regs, d->reg_count, false);
	if (rc)
		return rc;
@@ -701,10 +704,6 @@ static int pil_auth_and_reset(struct pil_desc *pil)
	if (rc)
		goto err_clks;

	rc = scm_pas_enable_bw();
	if (rc)
		goto err_reset;

	if (!is_scm_armv8()) {
		rc = scm_call(SCM_SVC_PIL, PAS_AUTH_AND_RESET_CMD, &proc,
				sizeof(proc), &scm_ret, sizeof(scm_ret));