}
if (pdata->keepalive)
- nvhost_module_enable_poweroff(priv->pdev);
+ nvhost_module_idle(priv->pdev);
kfree(priv);
return 0;
if (nvhost_module_add_client(pdev, priv))
goto fail_add_client;
- /* Keep devices with keepalive flag powered */
- if (pdata->keepalive)
- nvhost_module_disable_poweroff(pdev);
-
/* Check that the device can be powered */
ret = nvhost_module_busy(pdev);
if (ret)
goto fail_power_on;
- nvhost_module_idle(pdev);
+
+ /* Turn off the device if we do not need to keep it powered */
+ if (!pdata->keepalive)
+ nvhost_module_idle(pdev);
if (nvhost_dev_is_virtual(pdev)) {
/* If virtual, allocate a client id on the server side. This is
nvhost_vm_put(priv->vm);
fail_alloc_vm:
fail_virt_clientid:
-fail_power_on:
if (pdata->keepalive)
- nvhost_module_enable_poweroff(pdev);
+ nvhost_module_idle(pdev);
+fail_power_on:
nvhost_module_remove_client(pdev, priv);
fail_add_client:
kfree(priv);
return 0;
}
-void nvhost_module_disable_poweroff(struct platform_device *dev)
-{
- struct nvhost_device_data *pdata = platform_get_drvdata(dev);
-
- mutex_lock(&pdata->no_poweroff_req_mutex);
- pdata->no_poweroff_req_count++;
- if (!dev_pm_qos_request_active(&pdata->no_poweroff_req))
- dev_pm_qos_add_request(&dev->dev, &pdata->no_poweroff_req,
- DEV_PM_QOS_FLAGS, PM_QOS_FLAG_NO_POWER_OFF);
- mutex_unlock(&pdata->no_poweroff_req_mutex);
-}
-
-void nvhost_module_enable_poweroff(struct platform_device *dev)
-{
- struct nvhost_device_data *pdata = platform_get_drvdata(dev);
-
- mutex_lock(&pdata->no_poweroff_req_mutex);
- pdata->no_poweroff_req_count--;
- if (!pdata->no_poweroff_req_count &&
- dev_pm_qos_request_active(&pdata->no_poweroff_req))
- dev_pm_qos_remove_request(&pdata->no_poweroff_req);
- mutex_unlock(&pdata->no_poweroff_req_mutex);
-}
-
void nvhost_module_idle_mult(struct platform_device *dev, int refs)
{
int original_refs = refs;
void nvhost_module_busy_noresume(struct platform_device *dev);
void nvhost_module_reset(struct platform_device *dev, bool reboot);
int nvhost_module_busy(struct platform_device *dev);
-void nvhost_module_disable_poweroff(struct platform_device *dev);
-void nvhost_module_enable_poweroff(struct platform_device *dev);
void nvhost_module_idle_mult(struct platform_device *dev, int refs);
int nvhost_module_add_client(struct platform_device *dev,
void *priv);