]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: Simplify keepalive flag
authorArto Merilainen <amerilainen@nvidia.com>
Tue, 11 Aug 2015 04:17:54 +0000 (07:17 +0300)
committerArto Merilainen <amerilainen@nvidia.com>
Wed, 12 Aug 2015 07:32:42 +0000 (00:32 -0700)
Currently nvhost uses pm_qos API for keeping certain devices
powered. However, due to API limitations this may lead to cases
where the device does not get powered immediately when setting
the flag - or the power domain remains powered after the constraint
has been removed.

This patch refactors code to use only pm_runtime for enabling or
disabling power-off functionality.

Change-Id: I2fc9dd2d4c62626da847d37d689b5fad1935a25e
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/781704
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Shridhar Rasal <srasal@nvidia.com>
drivers/video/tegra/host/bus_client.c
drivers/video/tegra/host/nvhost_acm.c
drivers/video/tegra/host/nvhost_acm.h

index d807544deb36b97d6123c08539efd8a231efcaab..1042b52b7c4f45a26aab55472669926beb194343 100644 (file)
@@ -272,7 +272,7 @@ static int nvhost_channelrelease(struct inode *inode, struct file *filp)
        }
 
        if (pdata->keepalive)
-               nvhost_module_enable_poweroff(priv->pdev);
+               nvhost_module_idle(priv->pdev);
 
        kfree(priv);
        return 0;
@@ -319,15 +319,14 @@ static int __nvhost_channelopen(struct inode *inode,
        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
@@ -399,9 +398,9 @@ fail_get_channel:
        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);
index b440958f8dab4b6c0e583497ed9dab56f698a13d..4db5fb46514cddfbac3fae4bf1fbac0f2607b351 100644 (file)
@@ -276,30 +276,6 @@ int nvhost_module_busy(struct platform_device *dev)
        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;
index cd9a9fbb2980509f315733ff1648e78200b3d338..180abcdd38242b64543170476f7ec0dd1fa0dadb 100644 (file)
@@ -36,8 +36,6 @@ void nvhost_module_deinit(struct platform_device *dev);
 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);