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

Commit a6f18bb9 authored by Kyle Piefer's avatar Kyle Piefer
Browse files

msm: kgsl: Check GX status before enabling / disabling



Check to see that GX is not already in the wanted state
before putting it in that state.

CRs-Fixed: 2017390
Change-Id: I369858b1da170503c79869f5d45711d079cfe397
Signed-off-by: default avatarKyle Piefer <kpiefer@codeaurora.org>
parent 979ef22a
Loading
Loading
Loading
Loading
+11 −10
Original line number Original line Diff line number Diff line
@@ -857,14 +857,15 @@ static int a6xx_hm_enable(struct adreno_device *adreno_dev)
	struct kgsl_pwrctrl *pwr = &device->pwrctrl;
	struct kgsl_pwrctrl *pwr = &device->pwrctrl;
	struct gmu_device *gmu = &device->gmu;
	struct gmu_device *gmu = &device->gmu;


	if (!IS_ERR_OR_NULL(gmu->gx_gdsc)) {
	if (regulator_is_enabled(gmu->gx_gdsc))
		return 0;

	ret = regulator_enable(gmu->gx_gdsc);
	ret = regulator_enable(gmu->gx_gdsc);
	if (ret) {
	if (ret) {
		dev_err(&gmu->pdev->dev,
		dev_err(&gmu->pdev->dev,
				"Failed to turn on GPU HM HS\n");
				"Failed to turn on GPU HM HS\n");
		return ret;
		return ret;
	}
	}
	}


	ret = clk_set_rate(pwr->grp_clks[0],
	ret = clk_set_rate(pwr->grp_clks[0],
			pwr->pwrlevels[pwr->default_pwrlevel].
			pwr->pwrlevels[pwr->default_pwrlevel].
@@ -885,15 +886,15 @@ static int a6xx_hm_disable(struct adreno_device *adreno_dev)
	struct kgsl_pwrctrl *pwr = &device->pwrctrl;
	struct kgsl_pwrctrl *pwr = &device->pwrctrl;
	struct gmu_device *gmu = &device->gmu;
	struct gmu_device *gmu = &device->gmu;


	if (!regulator_is_enabled(gmu->gx_gdsc))
		return 0;

	clk_disable_unprepare(pwr->grp_clks[0]);
	clk_disable_unprepare(pwr->grp_clks[0]);


	clk_set_rate(pwr->grp_clks[0],
	clk_set_rate(pwr->grp_clks[0],
			pwr->pwrlevels[pwr->num_pwrlevels - 1].
			pwr->pwrlevels[pwr->num_pwrlevels - 1].
			gpu_freq);
			gpu_freq);


	if (IS_ERR_OR_NULL(gmu->gx_gdsc))
		return 0;

	return regulator_disable(gmu->gx_gdsc);
	return regulator_disable(gmu->gx_gdsc);
}
}