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

Commit a309e0e1 authored by Deepak Kumar's avatar Deepak Kumar Committed by Lynus Vaz
Browse files

msm: kgsl: Disable memory retention for core clock before entering SLUMBER



Memory retention is needed only for NAP state but not for SLUMBER state.
Disables memory retention for core clock before entering SLUMBER to save
power.

Change-Id: I64a5ecec6fc90d662da8d9d793860e56b0c6473f
Signed-off-by: default avatarDeepak Kumar <dkumar@codeaurora.org>
parent 6fae8e1b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2963,11 +2963,11 @@ static void adreno_pwrlevel_change_settings(struct kgsl_device *device,
}

static void adreno_clk_set_options(struct kgsl_device *device, const char *name,
	struct clk *clk)
	struct clk *clk, bool on)
{
	if (ADRENO_GPU_DEVICE(ADRENO_DEVICE(device))->clk_set_options)
		ADRENO_GPU_DEVICE(ADRENO_DEVICE(device))->clk_set_options(
			ADRENO_DEVICE(device), name, clk);
			ADRENO_DEVICE(device), name, clk, on);
}

static void adreno_iommu_sync(struct kgsl_device *device, bool sync)
+1 −1
Original line number Diff line number Diff line
@@ -851,7 +851,7 @@ struct adreno_gpudev {
	void (*preemption_schedule)(struct adreno_device *);
	void (*enable_64bit)(struct adreno_device *);
	void (*clk_set_options)(struct adreno_device *,
				const char *, struct clk *);
				const char *, struct clk *, bool on);
	void (*llc_configure_gpu_scid)(struct adreno_device *adreno_dev);
	void (*llc_configure_gpuhtw_scid)(struct adreno_device *adreno_dev);
	void (*llc_enable_overrides)(struct adreno_device *adreno_dev);
+12 −3
Original line number Diff line number Diff line
@@ -1608,11 +1608,15 @@ static void a5xx_pwrlevel_change_settings(struct adreno_device *adreno_dev,
}

static void a5xx_clk_set_options(struct adreno_device *adreno_dev,
	const char *name, struct clk *clk)
	const char *name, struct clk *clk, bool on)
{

	if (!adreno_is_a540(adreno_dev) && !adreno_is_a512(adreno_dev) &&
		!adreno_is_a508(adreno_dev))
		return;

	/* Handle clock settings for GFX PSCBCs */
	if (adreno_is_a540(adreno_dev) || adreno_is_a512(adreno_dev) ||
		adreno_is_a508(adreno_dev)) {
	if (on) {
		if (!strcmp(name, "mem_iface_clk")) {
			clk_set_flags(clk, CLKFLAG_NORETAIN_PERIPH);
			clk_set_flags(clk, CLKFLAG_NORETAIN_MEM);
@@ -1620,6 +1624,11 @@ static void a5xx_clk_set_options(struct adreno_device *adreno_dev,
			clk_set_flags(clk, CLKFLAG_RETAIN_PERIPH);
			clk_set_flags(clk, CLKFLAG_RETAIN_MEM);
		}
	} else {
		if (!strcmp(name, "core_clk")) {
			clk_set_flags(clk, CLKFLAG_NORETAIN_PERIPH);
			clk_set_flags(clk, CLKFLAG_NORETAIN_MEM);
		}
	}
}

+1 −1
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ struct kgsl_functable {
		unsigned int prelevel, unsigned int postlevel, bool post);
	void (*regulator_disable_poll)(struct kgsl_device *device);
	void (*clk_set_options)(struct kgsl_device *device,
		const char *name, struct clk *clk);
		const char *name, struct clk *clk, bool on);
	void (*gpu_model)(struct kgsl_device *device, char *str,
		size_t bufsz);
	void (*stop_fault_timer)(struct kgsl_device *device);
+19 −4
Original line number Diff line number Diff line
@@ -2049,10 +2049,6 @@ static int _get_clocks(struct kgsl_device *device)

			if (!strcmp(name, "isense_clk"))
				pwr->isense_clk_indx = i;

			if (device->ftbl->clk_set_options)
				device->ftbl->clk_set_options(device, name,
					pwr->grp_clks[i]);
			break;
		}
	}
@@ -2477,6 +2473,22 @@ static void kgsl_pwrctrl_disable(struct kgsl_device *device)
	kgsl_pwrctrl_pwrrail(device, KGSL_PWRFLAGS_OFF);
}

static void
kgsl_pwrctrl_clk_set_options(struct kgsl_device *device, bool on)
{
	struct kgsl_pwrctrl *pwr = &device->pwrctrl;
	int i;

	for (i = 0; i < KGSL_MAX_CLKS; i++) {
		if (pwr->grp_clks[i] == NULL)
			continue;

		if (device->ftbl->clk_set_options)
			device->ftbl->clk_set_options(device, clocks[i],
				pwr->grp_clks[i], on);
	}
}

/**
 * _init() - Get the GPU ready to start, but don't turn anything on
 * @device - Pointer to the kgsl_device struct
@@ -2526,6 +2538,7 @@ static int _wake(struct kgsl_device *device)
		device->ftbl->resume(device);
		/* fall through */
	case KGSL_STATE_SLUMBER:
		kgsl_pwrctrl_clk_set_options(device, true);
		status = device->ftbl->start(device,
				device->pwrctrl.superfast);
		device->pwrctrl.superfast = false;
@@ -2562,6 +2575,7 @@ static int _wake(struct kgsl_device *device)
				device->pwrctrl.interval_timeout);
		break;
	case KGSL_STATE_AWARE:
		kgsl_pwrctrl_clk_set_options(device, true);
		/* Enable state before turning on irq */
		kgsl_pwrctrl_set_state(device, KGSL_STATE_ACTIVE);
		kgsl_pwrctrl_irq(device, KGSL_PWRFLAGS_ON);
@@ -2686,6 +2700,7 @@ _slumber(struct kgsl_device *device)
		status = kgsl_pwrctrl_enable(device);
		device->ftbl->suspend_context(device);
		device->ftbl->stop(device);
		kgsl_pwrctrl_clk_set_options(device, false);
		kgsl_pwrctrl_disable(device);
		kgsl_pwrscale_sleep(device);
		kgsl_pwrctrl_irq(device, KGSL_PWRFLAGS_OFF);