diff options
author | Mayuresh Kulkarni <mkulkarni@nvidia.com> | 2012-03-27 14:54:47 +0530 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-03-30 08:08:59 -0700 |
commit | 1a1b1468b9ef4c33c7408b0c67bb9f751d485dec (patch) | |
tree | 6292140237e963c6f58bf6ac04fabc114fec98cb /drivers | |
parent | a55e86c26f4096aa7897455bf9e3146ab52f7036 (diff) |
video: tegra: host: do not assume 3d channel opened by user space
- if user space does not open 3d channel, 3d scaling
algorithm is not initialized. so return safely when
3d scaling is disabled
- also do not call nvhost_module_suspend() explicitly
for host1x client modules. nvhost_channel_suspend()
takes care to suspend the module if ref count = 0
- call nvhost_module_suspend() only for host1x device
as it does not use actual hardware channel
Bug 953451
Change-Id: Iba2b771b71d9b41c8ed978112566181872c56259
Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com>
Reviewed-on: http://git-master/r/92506
Reviewed-by: Automatic_Commit_Validation_User
Tested-by: Peer Chen <pchen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Emily Jiang <ejiang@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/tegra/host/bus_client.c | 1 | ||||
-rw-r--r-- | drivers/video/tegra/host/gr3d/scale3d.c | 33 |
2 files changed, 22 insertions, 12 deletions
diff --git a/drivers/video/tegra/host/bus_client.c b/drivers/video/tegra/host/bus_client.c index 736f3da0bdec..940f04a40e89 100644 --- a/drivers/video/tegra/host/bus_client.c +++ b/drivers/video/tegra/host/bus_client.c @@ -600,7 +600,6 @@ int nvhost_client_device_suspend(struct nvhost_device *dev) if (ret) return ret; - ret = nvhost_module_suspend(dev, true); dev_info(&dev->dev, "suspend status: %d\n", ret); return ret; diff --git a/drivers/video/tegra/host/gr3d/scale3d.c b/drivers/video/tegra/host/gr3d/scale3d.c index 24618f8a4a11..8a267a127ea9 100644 --- a/drivers/video/tegra/host/gr3d/scale3d.c +++ b/drivers/video/tegra/host/gr3d/scale3d.c @@ -153,6 +153,9 @@ static void scale3d_clocks_handler(struct work_struct *work) void nvhost_scale3d_suspend(struct nvhost_device *dev) { + if (!scale3d.enable) + return; + cancel_work_sync(&scale3d.work); cancel_delayed_work(&scale3d.idle_timer); } @@ -174,6 +177,9 @@ static int scale3d_is_enabled(void) { int enable; + if (!scale3d.enable) + return 0; + mutex_lock(&scale3d.lock); enable = scale3d.enable; mutex_unlock(&scale3d.lock); @@ -373,10 +379,10 @@ void nvhost_scale3d_notify_idle(struct nvhost_device *dev) ktime_t t; unsigned long dt; - mutex_lock(&scale3d.lock); - if (!scale3d.enable) - goto done; + return; + + mutex_lock(&scale3d.lock); t = ktime_get(); @@ -398,7 +404,6 @@ void nvhost_scale3d_notify_idle(struct nvhost_device *dev) msecs_to_jiffies((scale3d.idle_max * scale3d.fast_response) / 50000)); -done: mutex_unlock(&scale3d.lock); } @@ -408,10 +413,10 @@ void nvhost_scale3d_notify_busy(struct nvhost_device *dev) unsigned long short_term_idle; ktime_t t; - mutex_lock(&scale3d.lock); - if (!scale3d.enable) - goto done; + return; + + mutex_lock(&scale3d.lock); cancel_delayed_work(&scale3d.idle_timer); @@ -429,7 +434,6 @@ void nvhost_scale3d_notify_busy(struct nvhost_device *dev) scaling_state_check(t); -done: mutex_unlock(&scale3d.lock); } @@ -437,10 +441,12 @@ static void scale3d_idle_handler(struct work_struct *work) { int notify_idle = 0; + if (!scale3d.enable) + return; + mutex_lock(&scale3d.lock); - if (scale3d.enable && scale3d.is_idle && - tegra_is_clk_enabled(scale3d.clk_3d)) { + if (scale3d.is_idle && tegra_is_clk_enabled(scale3d.clk_3d)) { unsigned long curr = clk_get_rate(scale3d.clk_3d); if (curr > scale3d.min_rate_3d) notify_idle = 1; @@ -454,7 +460,12 @@ static void scale3d_idle_handler(struct work_struct *work) void nvhost_scale3d_reset() { - ktime_t t = ktime_get(); + ktime_t t; + + if (!scale3d.enable) + return; + + t = ktime_get(); mutex_lock(&scale3d.lock); reset_scaling_counters(t); mutex_unlock(&scale3d.lock); |