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

Commit a6e44af5 authored by Deepak Kumar's avatar Deepak Kumar Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Keep dispatcher halted during SUSPEND state



Increment GPU halt variable after successful transition
to SUSPEND state to halt dispatcher. This is necessary to
make sure that any pending dispatcher threads don't go
ahead and try to wake up GPU in SUSPEND state.

Change-Id: I806884306549afbef0dfa92ea14903cc7a47d347
Signed-off-by: default avatarDeepak Kumar <dkumar@codeaurora.org>
parent d9281e0f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3549,6 +3549,8 @@ static const struct kgsl_functable adreno_functable = {
	.clk_set_options = adreno_clk_set_options,
	.gpu_model = adreno_gpu_model,
	.stop_fault_timer = adreno_dispatcher_stop_fault_timer,
	.dispatcher_halt = adreno_dispatcher_halt,
	.dispatcher_unhalt = adreno_dispatcher_unhalt,
};

static struct platform_driver adreno_platform_driver = {
+17 −0
Original line number Diff line number Diff line
@@ -2857,6 +2857,16 @@ int adreno_dispatcher_init(struct adreno_device *adreno_dev)
	return ret;
}

void adreno_dispatcher_halt(struct kgsl_device *device)
{
	adreno_get_gpu_halt(ADRENO_DEVICE(device));
}

void adreno_dispatcher_unhalt(struct kgsl_device *device)
{
	adreno_put_gpu_halt(ADRENO_DEVICE(device));
}

/*
 * adreno_dispatcher_idle() - Wait for dispatcher to idle
 * @adreno_dev: Adreno device whose dispatcher needs to idle
@@ -2887,6 +2897,13 @@ int adreno_dispatcher_idle(struct adreno_device *adreno_dev)

	mutex_unlock(&device->mutex);

	/*
	 * Flush the worker to make sure all executing
	 * or pending dispatcher works on worker are
	 * finished
	 */
	kthread_flush_worker(&kgsl_driver.worker);

	ret = wait_for_completion_timeout(&dispatcher->idle_gate,
			msecs_to_jiffies(ADRENO_IDLE_TIMEOUT));
	if (ret == 0) {
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2008-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2008-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
@@ -103,6 +103,8 @@ enum adreno_dispatcher_flags {
};

void adreno_dispatcher_start(struct kgsl_device *device);
void adreno_dispatcher_halt(struct kgsl_device *device);
void adreno_dispatcher_unhalt(struct kgsl_device *device);
int adreno_dispatcher_init(struct adreno_device *adreno_dev);
void adreno_dispatcher_close(struct adreno_device *adreno_dev);
int adreno_dispatcher_idle(struct adreno_device *adreno_dev);
+3 −0
Original line number Diff line number Diff line
@@ -754,6 +754,8 @@ static int kgsl_suspend_device(struct kgsl_device *device, pm_message_t state)

	mutex_lock(&device->mutex);
	status = kgsl_pwrctrl_change_state(device, KGSL_STATE_SUSPEND);
	if (status == 0)
		device->ftbl->dispatcher_halt(device);
	mutex_unlock(&device->mutex);

	KGSL_PWR_WARN(device, "suspend end\n");
@@ -768,6 +770,7 @@ static int kgsl_resume_device(struct kgsl_device *device)
	KGSL_PWR_WARN(device, "resume start\n");
	mutex_lock(&device->mutex);
	if (device->state == KGSL_STATE_SUSPEND) {
		device->ftbl->dispatcher_unhalt(device);
		kgsl_pwrctrl_change_state(device, KGSL_STATE_SLUMBER);
	} else if (device->state != KGSL_STATE_INIT) {
		/*
+2 −0
Original line number Diff line number Diff line
@@ -190,6 +190,8 @@ struct kgsl_functable {
	void (*gpu_model)(struct kgsl_device *device, char *str,
		size_t bufsz);
	void (*stop_fault_timer)(struct kgsl_device *device);
	void (*dispatcher_halt)(struct kgsl_device *device);
	void (*dispatcher_unhalt)(struct kgsl_device *device);
};

struct kgsl_ioctl {