video: tegra: host: Set rate for all clocks in nvhost device
Jinyoung Park [Wed, 22 Feb 2012 08:36:08 +0000 (17:36 +0900)]
Fixed rate setting problem what set rate for only a clock in nvhost
device, even if there are clocks more than one in nvhost device.

Bug 938580

Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-on: http://git-master/r/85129
(cherry picked from commit 5818d42dc0ad5dfa7659dca5d7f61b572c08613d)

Change-Id: Id3a7be50541b1d93a2ed7353f3eabc71dd398773
Reviewed-on: http://git-master/r/87276
Tested-by: Jinyoung Park <jinyoungp@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

drivers/video/tegra/host/nvhost_acm.c

index 496e38b..d023b06 100644 (file)
@@ -280,17 +280,22 @@ int nvhost_module_set_rate(struct nvhost_device *dev, void *priv,
                unsigned long rate, int index)
 {
        struct nvhost_module_client *m;
-       int ret;
+       int i, ret = 0;
 
        mutex_lock(&client_list_lock);
        list_for_each_entry(m, &dev->client_list, node) {
                if (m->priv == priv) {
-                       rate = clk_round_rate(dev->clk[index], rate);
-                       m->rate[index] = rate;
+                       for (i = 0; i < dev->num_clks; i++)
+                               m->rate[i] = clk_round_rate(dev->clk[i], rate);
                        break;
                }
        }
-       ret = nvhost_module_update_rate(dev, index);
+
+       for (i = 0; i < dev->num_clks; i++) {
+               ret = nvhost_module_update_rate(dev, i);
+               if (ret < 0)
+                       break;
+       }
        mutex_unlock(&client_list_lock);
        return ret;