mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
msm: kgsl: Create first_open and last_close
As the name suggests, the first_open is called when the device is opened for the first time. And last_close is called when last device instance is closed. This helps with differentiating eCP and non eCP open within adreno namespace. Change-Id: Idfbb487313d8be4de9d9785dbcdfb479dbab969e Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
This commit is contained in:
parent
8afc60d2e8
commit
ef64d261f0
3 changed files with 63 additions and 48 deletions
|
|
@ -1953,6 +1953,60 @@ static void adreno_set_active_ctxs_null(struct adreno_device *adreno_dev)
|
|||
}
|
||||
}
|
||||
|
||||
static int adreno_first_open(struct kgsl_device *device)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* active_cnt special case: we are starting up for the first
|
||||
* time, so use this sequence instead of the kgsl_pwrctrl_wake()
|
||||
* which will be called by kgsl_active_count_get().
|
||||
*/
|
||||
atomic_inc(&device->active_cnt);
|
||||
|
||||
kgsl_sharedmem_set(device, device->memstore, 0, 0,
|
||||
device->memstore->size);
|
||||
|
||||
ret = adreno_init(device);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
ret = adreno_start(device, 0);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
timer_setup(&device->idle_timer, kgsl_timer, 0);
|
||||
|
||||
complete_all(&device->hwaccess_gate);
|
||||
kgsl_pwrctrl_change_state(device, KGSL_STATE_ACTIVE);
|
||||
kgsl_active_count_put(device);
|
||||
|
||||
return 0;
|
||||
err:
|
||||
kgsl_pwrctrl_change_state(device, KGSL_STATE_INIT);
|
||||
atomic_dec(&device->active_cnt);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int adreno_last_close(struct kgsl_device *device)
|
||||
{
|
||||
/*
|
||||
* Wait up to 1 second for the active count to go low
|
||||
* and then start complaining about it
|
||||
*/
|
||||
if (kgsl_active_count_wait(device, 0)) {
|
||||
dev_err(device->dev,
|
||||
"Waiting for the active count to become 0\n");
|
||||
|
||||
while (kgsl_active_count_wait(device, 0))
|
||||
dev_err(device->dev,
|
||||
"Still waiting for the active count\n");
|
||||
}
|
||||
|
||||
return kgsl_pwrctrl_change_state(device, KGSL_STATE_INIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* _adreno_start - Power up the GPU and prepare to accept commands
|
||||
* @adreno_dev: Pointer to an adreno_device structure
|
||||
|
|
@ -3791,9 +3845,10 @@ static const struct kgsl_functable adreno_functable = {
|
|||
.idle = adreno_idle,
|
||||
.isidle = adreno_isidle,
|
||||
.suspend_context = adreno_suspend_context,
|
||||
.init = adreno_init,
|
||||
.first_open = adreno_first_open,
|
||||
.start = adreno_start,
|
||||
.stop = adreno_stop,
|
||||
.last_close = adreno_last_close,
|
||||
.getproperty = adreno_getproperty,
|
||||
.getproperty_compat = adreno_getproperty_compat,
|
||||
.waittimestamp = adreno_waittimestamp,
|
||||
|
|
|
|||
|
|
@ -1008,23 +1008,9 @@ static int kgsl_close_device(struct kgsl_device *device)
|
|||
|
||||
mutex_lock(&device->mutex);
|
||||
device->open_count--;
|
||||
if (device->open_count == 0) {
|
||||
if (device->open_count == 0)
|
||||
result = device->ftbl->last_close(device);
|
||||
|
||||
/*
|
||||
* Wait up to 1 second for the active count to go low
|
||||
* and then start complaining about it
|
||||
*/
|
||||
if (kgsl_active_count_wait(device, 0)) {
|
||||
dev_err(device->dev,
|
||||
"Waiting for the active count to become 0\n");
|
||||
|
||||
while (kgsl_active_count_wait(device, 0))
|
||||
dev_err(device->dev,
|
||||
"Still waiting for the active count\n");
|
||||
}
|
||||
|
||||
result = kgsl_pwrctrl_change_state(device, KGSL_STATE_INIT);
|
||||
}
|
||||
mutex_unlock(&device->mutex);
|
||||
return result;
|
||||
|
||||
|
|
@ -1092,37 +1078,12 @@ static int kgsl_open_device(struct kgsl_device *device)
|
|||
|
||||
mutex_lock(&device->mutex);
|
||||
if (device->open_count == 0) {
|
||||
/*
|
||||
* active_cnt special case: we are starting up for the first
|
||||
* time, so use this sequence instead of the kgsl_pwrctrl_wake()
|
||||
* which will be called by kgsl_active_count_get().
|
||||
*/
|
||||
atomic_inc(&device->active_cnt);
|
||||
kgsl_sharedmem_set(device, device->memstore, 0, 0,
|
||||
device->memstore->size);
|
||||
|
||||
result = device->ftbl->init(device);
|
||||
result = device->ftbl->first_open(device);
|
||||
if (result)
|
||||
goto err;
|
||||
|
||||
result = device->ftbl->start(device, 0);
|
||||
if (result)
|
||||
goto err;
|
||||
/*
|
||||
* Make sure the gates are open, so they don't block until
|
||||
* we start suspend or FT.
|
||||
*/
|
||||
complete_all(&device->hwaccess_gate);
|
||||
kgsl_pwrctrl_change_state(device, KGSL_STATE_ACTIVE);
|
||||
kgsl_active_count_put(device);
|
||||
goto out;
|
||||
}
|
||||
device->open_count++;
|
||||
err:
|
||||
if (result) {
|
||||
kgsl_pwrctrl_change_state(device, KGSL_STATE_INIT);
|
||||
atomic_dec(&device->active_cnt);
|
||||
}
|
||||
|
||||
out:
|
||||
mutex_unlock(&device->mutex);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -4908,8 +4869,6 @@ int kgsl_device_platform_probe(struct kgsl_device *device)
|
|||
rwlock_init(&device->context_lock);
|
||||
spin_lock_init(&device->submit_lock);
|
||||
|
||||
timer_setup(&device->idle_timer, kgsl_timer, 0);
|
||||
|
||||
status = kgsl_mmu_probe(device);
|
||||
if (status != 0)
|
||||
goto error_pwrctrl_close;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ struct kgsl_functable {
|
|||
int (*idle)(struct kgsl_device *device);
|
||||
bool (*isidle)(struct kgsl_device *device);
|
||||
int (*suspend_context)(struct kgsl_device *device);
|
||||
int (*init)(struct kgsl_device *device);
|
||||
int (*first_open)(struct kgsl_device *device);
|
||||
int (*last_close)(struct kgsl_device *device);
|
||||
int (*start)(struct kgsl_device *device, int priority);
|
||||
int (*stop)(struct kgsl_device *device);
|
||||
int (*getproperty)(struct kgsl_device *device,
|
||||
|
|
|
|||
Loading…
Reference in a new issue