mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 14:13:01 -04:00
msm: kgsl: Move the system PM operations to adreno
The system power management functions (suspend/resume) are currently registered with the adreno device but implemented at the KGSL level which requires function hooks for the actual adreno functionality. Move the functions back to adreno where they belong, get rid of the function hooks and remove the legacy suspend/resume handlers that we haven't needed in years. Change-Id: Ic0dedbad4a09f165ffd9707e66c45e5b516962e3 Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
parent
86da0d3094
commit
186835c7d3
4 changed files with 42 additions and 103 deletions
|
|
@ -1613,6 +1613,43 @@ static int adreno_remove(struct platform_device *pdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int adreno_pm_resume(struct device *dev)
|
||||
{
|
||||
struct kgsl_device *device = dev_get_drvdata(dev);
|
||||
|
||||
mutex_lock(&device->mutex);
|
||||
if (device->state == KGSL_STATE_SUSPEND) {
|
||||
adreno_dispatcher_unhalt(device);
|
||||
kgsl_pwrctrl_change_state(device, KGSL_STATE_SLUMBER);
|
||||
} else if (device->state != KGSL_STATE_INIT) {
|
||||
/*
|
||||
* This is an error situation so wait for the device to idle and
|
||||
* then put the device in SLUMBER state. This will get us to
|
||||
* the right place when we resume.
|
||||
*/
|
||||
if (device->state == KGSL_STATE_ACTIVE)
|
||||
adreno_idle(device);
|
||||
kgsl_pwrctrl_change_state(device, KGSL_STATE_SLUMBER);
|
||||
dev_err(device->dev, "resume invoked without a suspend\n");
|
||||
}
|
||||
mutex_unlock(&device->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int adreno_pm_suspend(struct device *dev)
|
||||
{
|
||||
struct kgsl_device *device = dev_get_drvdata(dev);
|
||||
int status;
|
||||
|
||||
mutex_lock(&device->mutex);
|
||||
status = kgsl_pwrctrl_change_state(device, KGSL_STATE_SUSPEND);
|
||||
if (!status && device->state == KGSL_STATE_SUSPEND)
|
||||
adreno_dispatcher_halt(device);
|
||||
mutex_unlock(&device->mutex);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static void adreno_fault_detect_init(struct adreno_device *adreno_dev)
|
||||
{
|
||||
struct adreno_gpudev *gpudev = ADRENO_GPU_DEVICE(adreno_dev);
|
||||
|
|
@ -3741,21 +3778,21 @@ 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,
|
||||
.query_property_list = adreno_query_property_list,
|
||||
.is_hwcg_on = adreno_is_hwcg_on,
|
||||
};
|
||||
|
||||
static const struct dev_pm_ops adreno_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(adreno_pm_suspend, adreno_pm_resume)
|
||||
};
|
||||
|
||||
static struct platform_driver adreno_platform_driver = {
|
||||
.probe = adreno_probe,
|
||||
.remove = adreno_remove,
|
||||
.suspend = kgsl_suspend_driver,
|
||||
.resume = kgsl_resume_driver,
|
||||
.id_table = adreno_id_table,
|
||||
.driver = {
|
||||
.name = "kgsl-3d",
|
||||
.pm = &kgsl_pm_ops,
|
||||
.pm = &adreno_pm_ops,
|
||||
.of_match_table = adreno_match_table,
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -791,97 +791,6 @@ int kgsl_check_timestamp(struct kgsl_device *device,
|
|||
return (timestamp_cmp(ts_processed, timestamp) >= 0);
|
||||
}
|
||||
|
||||
static int kgsl_suspend_device(struct kgsl_device *device, pm_message_t state)
|
||||
{
|
||||
int status = -EINVAL;
|
||||
|
||||
if (!device)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&device->mutex);
|
||||
status = kgsl_pwrctrl_change_state(device, KGSL_STATE_SUSPEND);
|
||||
if (status == 0 && device->state == KGSL_STATE_SUSPEND)
|
||||
device->ftbl->dispatcher_halt(device);
|
||||
mutex_unlock(&device->mutex);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static int kgsl_resume_device(struct kgsl_device *device)
|
||||
{
|
||||
if (!device)
|
||||
return -EINVAL;
|
||||
|
||||
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) {
|
||||
/*
|
||||
* This is an error situation,so wait for the device
|
||||
* to idle and then put the device to SLUMBER state.
|
||||
* This will put the device to the right state when
|
||||
* we resume.
|
||||
*/
|
||||
if (device->state == KGSL_STATE_ACTIVE)
|
||||
device->ftbl->idle(device);
|
||||
kgsl_pwrctrl_change_state(device, KGSL_STATE_SLUMBER);
|
||||
dev_err(device->dev,
|
||||
"resume invoked without a suspend\n");
|
||||
}
|
||||
|
||||
mutex_unlock(&device->mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kgsl_suspend(struct device *dev)
|
||||
{
|
||||
|
||||
pm_message_t arg = {0};
|
||||
struct kgsl_device *device = dev_get_drvdata(dev);
|
||||
|
||||
return kgsl_suspend_device(device, arg);
|
||||
}
|
||||
|
||||
static int kgsl_resume(struct device *dev)
|
||||
{
|
||||
struct kgsl_device *device = dev_get_drvdata(dev);
|
||||
|
||||
return kgsl_resume_device(device);
|
||||
}
|
||||
|
||||
static int kgsl_runtime_suspend(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int kgsl_runtime_resume(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct dev_pm_ops kgsl_pm_ops = {
|
||||
.suspend = kgsl_suspend,
|
||||
.resume = kgsl_resume,
|
||||
.runtime_suspend = kgsl_runtime_suspend,
|
||||
.runtime_resume = kgsl_runtime_resume,
|
||||
};
|
||||
|
||||
int kgsl_suspend_driver(struct platform_device *pdev,
|
||||
pm_message_t state)
|
||||
{
|
||||
struct kgsl_device *device = dev_get_drvdata(&pdev->dev);
|
||||
|
||||
return kgsl_suspend_device(device, state);
|
||||
}
|
||||
|
||||
int kgsl_resume_driver(struct platform_device *pdev)
|
||||
{
|
||||
struct kgsl_device *device = dev_get_drvdata(&pdev->dev);
|
||||
|
||||
return kgsl_resume_device(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* kgsl_destroy_process_private() - Cleanup function to free process private
|
||||
* @kref: - Pointer to object being destroyed's kref struct
|
||||
|
|
|
|||
|
|
@ -439,11 +439,6 @@ kgsl_sharedmem_find(struct kgsl_process_private *private, uint64_t gpuaddr);
|
|||
struct kgsl_mem_entry * __must_check
|
||||
kgsl_sharedmem_find_id(struct kgsl_process_private *process, unsigned int id);
|
||||
|
||||
extern const struct dev_pm_ops kgsl_pm_ops;
|
||||
|
||||
int kgsl_suspend_driver(struct platform_device *pdev, pm_message_t state);
|
||||
int kgsl_resume_driver(struct platform_device *pdev);
|
||||
|
||||
struct kgsl_mem_entry *gpumem_alloc_entry(struct kgsl_device_private *dev_priv,
|
||||
uint64_t size, uint64_t flags);
|
||||
long gpumem_free_entry(struct kgsl_mem_entry *entry);
|
||||
|
|
|
|||
|
|
@ -159,8 +159,6 @@ 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);
|
||||
/**
|
||||
* @query_property_list: query the list of properties
|
||||
* supported by the device. If 'list' is NULL just return the total
|
||||
|
|
|
|||
Loading…
Reference in a new issue