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

Commit a39dadaa authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: Ensure that power level restrictions are enforced"

parents 625a4e6a 5306240a
Loading
Loading
Loading
Loading
+5 −17
Original line number Diff line number Diff line
@@ -1149,7 +1149,6 @@ int gmu_probe(struct kgsl_device *device)
		goto error;

	gmu->num_gpupwrlevels = pwr->num_pwrlevels;
	gmu->wakeup_pwrlevel = pwr->default_pwrlevel;

	for (i = 0; i < gmu->num_gpupwrlevels; i++) {
		int j = gmu->num_gpupwrlevels - 1 - i;
@@ -1411,11 +1410,8 @@ int gmu_start(struct kgsl_device *device)
		if (ret)
			goto error_gmu;

		/* Send default DCVS level */
		ret = gmu_dcvs_set(gmu, pwr->default_pwrlevel,
				pwr->pwrlevels[pwr->default_pwrlevel].bus_freq);
		if (ret)
			goto error_gmu;
		/* Request default DCVS level */
		kgsl_pwrctrl_pwrlevel_change(device, pwr->default_pwrlevel);

		msm_bus_scale_client_update_request(gmu->pcl, 0);
		break;
@@ -1435,12 +1431,7 @@ int gmu_start(struct kgsl_device *device)
		if (ret)
			goto error_gmu;

		ret = gmu_dcvs_set(gmu, gmu->wakeup_pwrlevel,
				pwr->pwrlevels[gmu->wakeup_pwrlevel].bus_freq);
		if (ret)
			goto error_gmu;

		gmu->wakeup_pwrlevel = pwr->default_pwrlevel;
		kgsl_pwrctrl_pwrlevel_change(device, pwr->default_pwrlevel);
		break;

	case KGSL_STATE_RESET:
@@ -1462,11 +1453,8 @@ int gmu_start(struct kgsl_device *device)
				goto error_gmu;

			/* Send DCVS level prior to reset*/
			ret = gmu_dcvs_set(gmu, pwr->active_pwrlevel,
					pwr->pwrlevels[pwr->active_pwrlevel]
					.bus_freq);
			if (ret)
				goto error_gmu;
			kgsl_pwrctrl_pwrlevel_change(device,
				pwr->default_pwrlevel);

			ret = gpudev->oob_set(adreno_dev,
				OOB_CPINIT_SET_MASK,
+2 −1
Original line number Diff line number Diff line
@@ -82,7 +82,8 @@ enum gmu_flags {
	GMU_BOOT_INIT_DONE = 0,
	GMU_CLK_ON = 1,
	GMU_HFI_ON = 2,
	GMU_FAULT = 3
	GMU_FAULT = 3,
	GMU_DCVS_REPLAY = 4,
};

/**
+10 −7
Original line number Diff line number Diff line
@@ -244,12 +244,9 @@ static int kgsl_clk_set_rate(struct kgsl_device *device,
	/* GMU scales GPU freq */
	if (kgsl_gmu_isenabled(device)) {
		/* If GMU has not been started, save it */
		if (!(gmu->flags & GMU_HFI_ON)) {
			/* In slumber the clock is off so we are done */
			if (pwrlevel == (gmu->num_gpupwrlevels - 1))
				return 0;

			gmu->wakeup_pwrlevel = pwrlevel;
		if (!test_bit(GMU_HFI_ON, &gmu->flags)) {
			/* store clock change request */
			set_bit(GMU_DCVS_REPLAY, &gmu->flags);
			return 0;
		}

@@ -259,6 +256,8 @@ static int kgsl_clk_set_rate(struct kgsl_device *device,
			return -EINVAL;
		}
		ret = gmu_dcvs_set(gmu, pwrlevel, INVALID_DCVS_IDX);
		/* indicate actual clock  change */
		clear_bit(GMU_DCVS_REPLAY, &gmu->flags);
	} else
		/* Linux clock driver scales GPU freq */
		ret = clk_set_rate(pwr->grp_clks[0], pl->gpu_freq);
@@ -412,7 +411,8 @@ void kgsl_pwrctrl_pwrlevel_change(struct kgsl_device *device,
	 */
	kgsl_pwrctrl_set_thermal_cycle(pwr, new_level);

	if (new_level == old_level)
	if (new_level == old_level &&
		!test_bit(GMU_DCVS_REPLAY, &device->gmu.flags))
		return;

	kgsl_pwrscale_update_stats(device);
@@ -2485,6 +2485,9 @@ static int kgsl_pwrctrl_enable(struct kgsl_device *device)
static void kgsl_pwrctrl_disable(struct kgsl_device *device)
{
	if (kgsl_gmu_isenabled(device)) {
		struct kgsl_pwrctrl *pwr = &device->pwrctrl;

		pwr->active_pwrlevel = pwr->num_pwrlevels - 1;
		kgsl_pwrctrl_axi(device, KGSL_PWRFLAGS_OFF);
		return gmu_stop(device);
	}