summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Pedro <mapedro@nvidia.com>2014-05-11 22:57:48 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:09:48 -0400
commit6c6936858af4902ca0e170da03ddf92e32b74ae1 (patch)
treeafc541fd72773aa4676188684b9c92a67af60a09
parenta82f92e318005f1e42f803aec054ee3714f780f9 (diff)
Revert "gpu: nvgpu: Keep host1x on when GPU on"
This reverts commit 20d48a759b032116e3092e1df76518065da59879. Change-Id: I93718a314b70ee9284a83ca69964883e670ad78d Signed-off-by: Matt Pedro <mapedro@nvidia.com> Reviewed-on: http://git-master/r/407969 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gk20a/as_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c48
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c57
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c4
7 files changed, 70 insertions, 53 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/as_gk20a.c b/drivers/gpu/nvgpu/gk20a/as_gk20a.c
index 42fa2167..ea0fb8f5 100644
--- a/drivers/gpu/nvgpu/gk20a/as_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/as_gk20a.c
@@ -231,7 +231,7 @@ long gk20a_as_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
231 return -EFAULT; 231 return -EFAULT;
232 } 232 }
233 233
234 err = gk20a_busy(g->dev); 234 err = gk20a_channel_busy(g->dev);
235 if (err) 235 if (err)
236 return err; 236 return err;
237 237
@@ -288,7 +288,7 @@ long gk20a_as_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
288 break; 288 break;
289 } 289 }
290 290
291 gk20a_idle(g->dev); 291 gk20a_channel_idle(g->dev);
292 292
293 if ((err == 0) && (_IOC_DIR(cmd) & _IOC_READ)) 293 if ((err == 0) && (_IOC_DIR(cmd) & _IOC_READ))
294 err = copy_to_user((void __user *)arg, buf, _IOC_SIZE(cmd)); 294 err = copy_to_user((void __user *)arg, buf, _IOC_SIZE(cmd));
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 344223ae..60f7d4e3 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -697,14 +697,14 @@ int gk20a_channel_release(struct inode *inode, struct file *filp)
697 697
698 trace_gk20a_channel_release(dev_name(&g->dev->dev)); 698 trace_gk20a_channel_release(dev_name(&g->dev->dev));
699 699
700 err = gk20a_busy(ch->g->dev); 700 err = gk20a_channel_busy(ch->g->dev);
701 if (err) { 701 if (err) {
702 gk20a_err(dev_from_gk20a(g), "failed to release channel %d", 702 gk20a_err(dev_from_gk20a(g), "failed to release channel %d",
703 ch->hw_chid); 703 ch->hw_chid);
704 return err; 704 return err;
705 } 705 }
706 gk20a_free_channel(ch, true); 706 gk20a_free_channel(ch, true);
707 gk20a_idle(ch->g->dev); 707 gk20a_channel_idle(ch->g->dev);
708 708
709 gk20a_put_client(g); 709 gk20a_put_client(g);
710 filp->private_data = NULL; 710 filp->private_data = NULL;
@@ -767,14 +767,14 @@ static int __gk20a_channel_open(struct gk20a *g, struct file *filp)
767 return err; 767 return err;
768 } 768 }
769 769
770 err = gk20a_busy(g->dev); 770 err = gk20a_channel_busy(g->dev);
771 if (err) { 771 if (err) {
772 gk20a_put_client(g); 772 gk20a_put_client(g);
773 gk20a_err(dev_from_gk20a(g), "failed to power on, %d", err); 773 gk20a_err(dev_from_gk20a(g), "failed to power on, %d", err);
774 return err; 774 return err;
775 } 775 }
776 ch = gk20a_open_new_channel(g); 776 ch = gk20a_open_new_channel(g);
777 gk20a_idle(g->dev); 777 gk20a_channel_idle(g->dev);
778 if (!ch) { 778 if (!ch) {
779 gk20a_put_client(g); 779 gk20a_put_client(g);
780 gk20a_err(dev_from_gk20a(g), 780 gk20a_err(dev_from_gk20a(g),
@@ -1417,7 +1417,7 @@ void gk20a_channel_update(struct channel_gk20a *c, int nr_completed)
1417 1417
1418 list_del_init(&job->list); 1418 list_del_init(&job->list);
1419 kfree(job); 1419 kfree(job);
1420 gk20a_idle(g->dev); 1420 gk20a_channel_idle(g->dev);
1421 } 1421 }
1422 1422
1423 /* 1423 /*
@@ -1436,7 +1436,7 @@ void gk20a_channel_update(struct channel_gk20a *c, int nr_completed)
1436 mutex_unlock(&c->submit_lock); 1436 mutex_unlock(&c->submit_lock);
1437 1437
1438 for (i = 0; i < nr_completed; i++) 1438 for (i = 0; i < nr_completed; i++)
1439 gk20a_idle(c->g->dev); 1439 gk20a_channel_idle(c->g->dev);
1440} 1440}
1441 1441
1442void add_wait_cmd(u32 *ptr, u32 id, u32 thresh) 1442void add_wait_cmd(u32 *ptr, u32 id, u32 thresh)
@@ -1484,7 +1484,7 @@ static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
1484 gk20a_dbg_info("channel %d", c->hw_chid); 1484 gk20a_dbg_info("channel %d", c->hw_chid);
1485 1485
1486 /* gk20a_channel_update releases this ref. */ 1486 /* gk20a_channel_update releases this ref. */
1487 err = gk20a_busy(g->dev); 1487 err = gk20a_channel_busy(g->dev);
1488 if (err) { 1488 if (err) {
1489 gk20a_err(d, "failed to host gk20a to submit gpfifo"); 1489 gk20a_err(d, "failed to host gk20a to submit gpfifo");
1490 return err; 1490 return err;
@@ -1645,7 +1645,7 @@ clean_up:
1645 gk20a_err(d, "fail"); 1645 gk20a_err(d, "fail");
1646 free_priv_cmdbuf(c, wait_cmd); 1646 free_priv_cmdbuf(c, wait_cmd);
1647 free_priv_cmdbuf(c, incr_cmd); 1647 free_priv_cmdbuf(c, incr_cmd);
1648 gk20a_idle(g->dev); 1648 gk20a_channel_idle(g->dev);
1649 return err; 1649 return err;
1650} 1650}
1651 1651
@@ -2079,7 +2079,7 @@ long gk20a_channel_ioctl(struct file *filp,
2079 case NVHOST_IOCTL_CHANNEL_SET_NVMAP_FD: 2079 case NVHOST_IOCTL_CHANNEL_SET_NVMAP_FD:
2080 break; 2080 break;
2081 case NVHOST_IOCTL_CHANNEL_ALLOC_OBJ_CTX: 2081 case NVHOST_IOCTL_CHANNEL_ALLOC_OBJ_CTX:
2082 err = gk20a_busy(dev); 2082 err = gk20a_channel_busy(dev);
2083 if (err) { 2083 if (err) {
2084 dev_err(&dev->dev, 2084 dev_err(&dev->dev,
2085 "%s: failed to host gk20a for ioctl cmd: 0x%x", 2085 "%s: failed to host gk20a for ioctl cmd: 0x%x",
@@ -2088,10 +2088,10 @@ long gk20a_channel_ioctl(struct file *filp,
2088 } 2088 }
2089 err = gk20a_alloc_obj_ctx(ch, 2089 err = gk20a_alloc_obj_ctx(ch,
2090 (struct nvhost_alloc_obj_ctx_args *)buf); 2090 (struct nvhost_alloc_obj_ctx_args *)buf);
2091 gk20a_idle(dev); 2091 gk20a_channel_idle(dev);
2092 break; 2092 break;
2093 case NVHOST_IOCTL_CHANNEL_FREE_OBJ_CTX: 2093 case NVHOST_IOCTL_CHANNEL_FREE_OBJ_CTX:
2094 err = gk20a_busy(dev); 2094 err = gk20a_channel_busy(dev);
2095 if (err) { 2095 if (err) {
2096 dev_err(&dev->dev, 2096 dev_err(&dev->dev,
2097 "%s: failed to host gk20a for ioctl cmd: 0x%x", 2097 "%s: failed to host gk20a for ioctl cmd: 0x%x",
@@ -2100,10 +2100,10 @@ long gk20a_channel_ioctl(struct file *filp,
2100 } 2100 }
2101 err = gk20a_free_obj_ctx(ch, 2101 err = gk20a_free_obj_ctx(ch,
2102 (struct nvhost_free_obj_ctx_args *)buf); 2102 (struct nvhost_free_obj_ctx_args *)buf);
2103 gk20a_idle(dev); 2103 gk20a_channel_idle(dev);
2104 break; 2104 break;
2105 case NVHOST_IOCTL_CHANNEL_ALLOC_GPFIFO: 2105 case NVHOST_IOCTL_CHANNEL_ALLOC_GPFIFO:
2106 err = gk20a_busy(dev); 2106 err = gk20a_channel_busy(dev);
2107 if (err) { 2107 if (err) {
2108 dev_err(&dev->dev, 2108 dev_err(&dev->dev,
2109 "%s: failed to host gk20a for ioctl cmd: 0x%x", 2109 "%s: failed to host gk20a for ioctl cmd: 0x%x",
@@ -2112,14 +2112,14 @@ long gk20a_channel_ioctl(struct file *filp,
2112 } 2112 }
2113 err = gk20a_alloc_channel_gpfifo(ch, 2113 err = gk20a_alloc_channel_gpfifo(ch,
2114 (struct nvhost_alloc_gpfifo_args *)buf); 2114 (struct nvhost_alloc_gpfifo_args *)buf);
2115 gk20a_idle(dev); 2115 gk20a_channel_idle(dev);
2116 break; 2116 break;
2117 case NVHOST_IOCTL_CHANNEL_SUBMIT_GPFIFO: 2117 case NVHOST_IOCTL_CHANNEL_SUBMIT_GPFIFO:
2118 err = gk20a_ioctl_channel_submit_gpfifo(ch, 2118 err = gk20a_ioctl_channel_submit_gpfifo(ch,
2119 (struct nvhost_submit_gpfifo_args *)buf); 2119 (struct nvhost_submit_gpfifo_args *)buf);
2120 break; 2120 break;
2121 case NVHOST_IOCTL_CHANNEL_WAIT: 2121 case NVHOST_IOCTL_CHANNEL_WAIT:
2122 err = gk20a_busy(dev); 2122 err = gk20a_channel_busy(dev);
2123 if (err) { 2123 if (err) {
2124 dev_err(&dev->dev, 2124 dev_err(&dev->dev,
2125 "%s: failed to host gk20a for ioctl cmd: 0x%x", 2125 "%s: failed to host gk20a for ioctl cmd: 0x%x",
@@ -2128,10 +2128,10 @@ long gk20a_channel_ioctl(struct file *filp,
2128 } 2128 }
2129 err = gk20a_channel_wait(ch, 2129 err = gk20a_channel_wait(ch,
2130 (struct nvhost_wait_args *)buf); 2130 (struct nvhost_wait_args *)buf);
2131 gk20a_idle(dev); 2131 gk20a_channel_idle(dev);
2132 break; 2132 break;
2133 case NVHOST_IOCTL_CHANNEL_ZCULL_BIND: 2133 case NVHOST_IOCTL_CHANNEL_ZCULL_BIND:
2134 err = gk20a_busy(dev); 2134 err = gk20a_channel_busy(dev);
2135 if (err) { 2135 if (err) {
2136 dev_err(&dev->dev, 2136 dev_err(&dev->dev,
2137 "%s: failed to host gk20a for ioctl cmd: 0x%x", 2137 "%s: failed to host gk20a for ioctl cmd: 0x%x",
@@ -2140,10 +2140,10 @@ long gk20a_channel_ioctl(struct file *filp,
2140 } 2140 }
2141 err = gk20a_channel_zcull_bind(ch, 2141 err = gk20a_channel_zcull_bind(ch,
2142 (struct nvhost_zcull_bind_args *)buf); 2142 (struct nvhost_zcull_bind_args *)buf);
2143 gk20a_idle(dev); 2143 gk20a_channel_idle(dev);
2144 break; 2144 break;
2145 case NVHOST_IOCTL_CHANNEL_SET_ERROR_NOTIFIER: 2145 case NVHOST_IOCTL_CHANNEL_SET_ERROR_NOTIFIER:
2146 err = gk20a_busy(dev); 2146 err = gk20a_channel_busy(dev);
2147 if (err) { 2147 if (err) {
2148 dev_err(&dev->dev, 2148 dev_err(&dev->dev,
2149 "%s: failed to host gk20a for ioctl cmd: 0x%x", 2149 "%s: failed to host gk20a for ioctl cmd: 0x%x",
@@ -2152,11 +2152,11 @@ long gk20a_channel_ioctl(struct file *filp,
2152 } 2152 }
2153 err = gk20a_init_error_notifier(ch, 2153 err = gk20a_init_error_notifier(ch,
2154 (struct nvhost_set_error_notifier *)buf); 2154 (struct nvhost_set_error_notifier *)buf);
2155 gk20a_idle(dev); 2155 gk20a_channel_idle(dev);
2156 break; 2156 break;
2157#ifdef CONFIG_GK20A_CYCLE_STATS 2157#ifdef CONFIG_GK20A_CYCLE_STATS
2158 case NVHOST_IOCTL_CHANNEL_CYCLE_STATS: 2158 case NVHOST_IOCTL_CHANNEL_CYCLE_STATS:
2159 err = gk20a_busy(dev); 2159 err = gk20a_channel_busy(dev);
2160 if (err) { 2160 if (err) {
2161 dev_err(&dev->dev, 2161 dev_err(&dev->dev,
2162 "%s: failed to host gk20a for ioctl cmd: 0x%x", 2162 "%s: failed to host gk20a for ioctl cmd: 0x%x",
@@ -2165,7 +2165,7 @@ long gk20a_channel_ioctl(struct file *filp,
2165 } 2165 }
2166 err = gk20a_channel_cycle_stats(ch, 2166 err = gk20a_channel_cycle_stats(ch,
2167 (struct nvhost_cycle_stats_args *)buf); 2167 (struct nvhost_cycle_stats_args *)buf);
2168 gk20a_idle(dev); 2168 gk20a_channel_idle(dev);
2169 break; 2169 break;
2170#endif 2170#endif
2171 case NVHOST_IOCTL_CHANNEL_SET_TIMEOUT: 2171 case NVHOST_IOCTL_CHANNEL_SET_TIMEOUT:
@@ -2195,7 +2195,7 @@ long gk20a_channel_ioctl(struct file *filp,
2195 ch->has_timedout; 2195 ch->has_timedout;
2196 break; 2196 break;
2197 case NVHOST_IOCTL_CHANNEL_SET_PRIORITY: 2197 case NVHOST_IOCTL_CHANNEL_SET_PRIORITY:
2198 err = gk20a_busy(dev); 2198 err = gk20a_channel_busy(dev);
2199 if (err) { 2199 if (err) {
2200 dev_err(&dev->dev, 2200 dev_err(&dev->dev,
2201 "%s: failed to host gk20a for ioctl cmd: 0x%x", 2201 "%s: failed to host gk20a for ioctl cmd: 0x%x",
@@ -2204,7 +2204,7 @@ long gk20a_channel_ioctl(struct file *filp,
2204 } 2204 }
2205 gk20a_channel_set_priority(ch, 2205 gk20a_channel_set_priority(ch,
2206 ((struct nvhost_set_priority_args *)buf)->priority); 2206 ((struct nvhost_set_priority_args *)buf)->priority);
2207 gk20a_idle(dev); 2207 gk20a_channel_idle(dev);
2208 break; 2208 break;
2209 default: 2209 default:
2210 dev_err(&dev->dev, "unrecognized ioctl cmd: 0x%x", cmd); 2210 dev_err(&dev->dev, "unrecognized ioctl cmd: 0x%x", cmd);
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
index 55ee5181..dd93fb4a 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
@@ -227,14 +227,14 @@ static int __gk20a_channel_syncpt_incr(struct gk20a_channel_sync *s,
227 227
228 if (register_irq) { 228 if (register_irq) {
229 /* nvhost action_gpfifo_submit_complete releases this ref. */ 229 /* nvhost action_gpfifo_submit_complete releases this ref. */
230 err = gk20a_busy(c->g->dev); 230 err = gk20a_channel_busy(c->g->dev);
231 231
232 if (!err) { 232 if (!err) {
233 err = nvhost_intr_register_notifier(sp->host1x_pdev, 233 err = nvhost_intr_register_notifier(sp->host1x_pdev,
234 sp->id, thresh, 234 sp->id, thresh,
235 gk20a_channel_syncpt_update, c); 235 gk20a_channel_syncpt_update, c);
236 if (err) 236 if (err)
237 gk20a_idle(c->g->dev); 237 gk20a_channel_idle(c->g->dev);
238 } 238 }
239 239
240 /* Adding interrupt action should never fail. A proper error 240 /* Adding interrupt action should never fail. A proper error
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
index 77806a5e..9fe1729f 100644
--- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c
@@ -573,7 +573,7 @@ static int dbg_set_powergate(struct dbg_session_gk20a *dbg_s,
573 573
574 gk20a_dbg(gpu_dbg_gpu_dbg | gpu_dbg_fn, "module busy"); 574 gk20a_dbg(gpu_dbg_gpu_dbg | gpu_dbg_fn, "module busy");
575 gk20a_busy(g->dev); 575 gk20a_busy(g->dev);
576 err = gk20a_busy(dbg_s->pdev); 576 err = gk20a_channel_busy(dbg_s->pdev);
577 if (err) 577 if (err)
578 return -EPERM; 578 return -EPERM;
579 579
@@ -618,7 +618,7 @@ static int dbg_set_powergate(struct dbg_session_gk20a *dbg_s,
618 gk20a_pmu_enable_elpg(g); 618 gk20a_pmu_enable_elpg(g);
619 619
620 gk20a_dbg(gpu_dbg_gpu_dbg | gpu_dbg_fn, "module idle"); 620 gk20a_dbg(gpu_dbg_gpu_dbg | gpu_dbg_fn, "module idle");
621 gk20a_idle(dbg_s->pdev); 621 gk20a_channel_idle(dbg_s->pdev);
622 gk20a_idle(g->dev); 622 gk20a_idle(g->dev);
623 } 623 }
624 624
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index 96711c0c..7617c70a 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -740,10 +740,10 @@ void gk20a_put_client(struct gk20a *g)
740 WARN_ON(g->client_refcount < 0); 740 WARN_ON(g->client_refcount < 0);
741} 741}
742 742
743static int gk20a_pm_prepare_poweroff(struct device *dev) 743static int gk20a_pm_prepare_poweroff(struct device *_dev)
744{ 744{
745 struct platform_device *pdev = to_platform_device(dev); 745 struct platform_device *dev = to_platform_device(_dev);
746 struct gk20a *g = get_gk20a(pdev); 746 struct gk20a *g = get_gk20a(dev);
747 int ret = 0; 747 int ret = 0;
748 748
749 gk20a_dbg_fn(""); 749 gk20a_dbg_fn("");
@@ -770,8 +770,6 @@ static int gk20a_pm_prepare_poweroff(struct device *dev)
770 770
771 /* Disable GPCPLL */ 771 /* Disable GPCPLL */
772 ret |= gk20a_suspend_clk_support(g); 772 ret |= gk20a_suspend_clk_support(g);
773
774 gk20a_platform_channel_idle(pdev);
775 g->power_on = false; 773 g->power_on = false;
776 774
777 return ret; 775 return ret;
@@ -795,18 +793,14 @@ static void gk20a_detect_chip(struct gk20a *g)
795 g->gpu_characteristics.rev); 793 g->gpu_characteristics.rev);
796} 794}
797 795
798static int gk20a_pm_finalize_poweron(struct device *dev) 796static int gk20a_pm_finalize_poweron(struct device *_dev)
799{ 797{
800 struct platform_device *pdev = to_platform_device(dev); 798 struct platform_device *dev = to_platform_device(_dev);
801 struct gk20a *g = get_gk20a(pdev); 799 struct gk20a *g = get_gk20a(dev);
802 int err, nice_value; 800 int err, nice_value;
803 801
804 gk20a_dbg_fn(""); 802 gk20a_dbg_fn("");
805 803
806 err = gk20a_platform_channel_busy(pdev);
807 if (err)
808 return err;
809
810 if (g->power_on) 804 if (g->power_on)
811 return 0; 805 return 0;
812 806
@@ -855,7 +849,7 @@ static int gk20a_pm_finalize_poweron(struct device *dev)
855 saving features (blcg/slcg) are enabled. For now, do it here. */ 849 saving features (blcg/slcg) are enabled. For now, do it here. */
856 err = gk20a_init_clk_support(g); 850 err = gk20a_init_clk_support(g);
857 if (err) { 851 if (err) {
858 gk20a_err(dev, "failed to init gk20a clk"); 852 gk20a_err(&dev->dev, "failed to init gk20a clk");
859 goto done; 853 goto done;
860 } 854 }
861 855
@@ -874,7 +868,7 @@ static int gk20a_pm_finalize_poweron(struct device *dev)
874 868
875 err = gk20a_init_fifo_reset_enable_hw(g); 869 err = gk20a_init_fifo_reset_enable_hw(g);
876 if (err) { 870 if (err) {
877 gk20a_err(dev, "failed to reset gk20a fifo"); 871 gk20a_err(&dev->dev, "failed to reset gk20a fifo");
878 goto done; 872 goto done;
879 } 873 }
880 874
@@ -883,43 +877,43 @@ static int gk20a_pm_finalize_poweron(struct device *dev)
883 877
884 err = gk20a_init_mm_support(g); 878 err = gk20a_init_mm_support(g);
885 if (err) { 879 if (err) {
886 gk20a_err(dev, "failed to init gk20a mm"); 880 gk20a_err(&dev->dev, "failed to init gk20a mm");
887 goto done; 881 goto done;
888 } 882 }
889 883
890 err = gk20a_init_pmu_support(g); 884 err = gk20a_init_pmu_support(g);
891 if (err) { 885 if (err) {
892 gk20a_err(dev, "failed to init gk20a pmu"); 886 gk20a_err(&dev->dev, "failed to init gk20a pmu");
893 goto done; 887 goto done;
894 } 888 }
895 889
896 err = gk20a_init_fifo_support(g); 890 err = gk20a_init_fifo_support(g);
897 if (err) { 891 if (err) {
898 gk20a_err(dev, "failed to init gk20a fifo"); 892 gk20a_err(&dev->dev, "failed to init gk20a fifo");
899 goto done; 893 goto done;
900 } 894 }
901 895
902 err = gk20a_init_gr_support(g); 896 err = gk20a_init_gr_support(g);
903 if (err) { 897 if (err) {
904 gk20a_err(dev, "failed to init gk20a gr"); 898 gk20a_err(&dev->dev, "failed to init gk20a gr");
905 goto done; 899 goto done;
906 } 900 }
907 901
908 err = gk20a_init_pmu_setup_hw2(g); 902 err = gk20a_init_pmu_setup_hw2(g);
909 if (err) { 903 if (err) {
910 gk20a_err(dev, "failed to init gk20a pmu_hw2"); 904 gk20a_err(&dev->dev, "failed to init gk20a pmu_hw2");
911 goto done; 905 goto done;
912 } 906 }
913 907
914 err = gk20a_init_therm_support(g); 908 err = gk20a_init_therm_support(g);
915 if (err) { 909 if (err) {
916 gk20a_err(dev, "failed to init gk20a therm"); 910 gk20a_err(&dev->dev, "failed to init gk20a therm");
917 goto done; 911 goto done;
918 } 912 }
919 913
920 err = gk20a_init_gpu_characteristics(g); 914 err = gk20a_init_gpu_characteristics(g);
921 if (err) { 915 if (err) {
922 gk20a_err(dev, "failed to init gk20a gpu characteristics"); 916 gk20a_err(&dev->dev, "failed to init gk20a gpu characteristics");
923 goto done; 917 goto done;
924 } 918 }
925 919
@@ -1546,6 +1540,27 @@ void gk20a_busy_noresume(struct platform_device *pdev)
1546 pm_runtime_get_noresume(&pdev->dev); 1540 pm_runtime_get_noresume(&pdev->dev);
1547} 1541}
1548 1542
1543int gk20a_channel_busy(struct platform_device *pdev)
1544{
1545 int ret = 0;
1546
1547 ret = gk20a_platform_channel_busy(pdev);
1548 if (ret)
1549 return ret;
1550
1551 ret = gk20a_busy(pdev);
1552 if (ret)
1553 gk20a_platform_channel_idle(pdev);
1554
1555 return ret;
1556}
1557
1558void gk20a_channel_idle(struct platform_device *pdev)
1559{
1560 gk20a_idle(pdev);
1561 gk20a_platform_channel_idle(pdev);
1562}
1563
1549int gk20a_busy(struct platform_device *pdev) 1564int gk20a_busy(struct platform_device *pdev)
1550{ 1565{
1551 int ret = 0; 1566 int ret = 0;
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index fc488a28..13d385f5 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -550,6 +550,8 @@ int clk_gk20a_debugfs_init(struct platform_device *dev);
550void gk20a_busy_noresume(struct platform_device *pdev); 550void gk20a_busy_noresume(struct platform_device *pdev);
551int gk20a_busy(struct platform_device *pdev); 551int gk20a_busy(struct platform_device *pdev);
552void gk20a_idle(struct platform_device *pdev); 552void gk20a_idle(struct platform_device *pdev);
553int gk20a_channel_busy(struct platform_device *pdev);
554void gk20a_channel_idle(struct platform_device *pdev);
553void gk20a_disable(struct gk20a *g, u32 units); 555void gk20a_disable(struct gk20a *g, u32 units);
554void gk20a_enable(struct gk20a *g, u32 units); 556void gk20a_enable(struct gk20a *g, u32 units);
555void gk20a_reset(struct gk20a *g, u32 units); 557void gk20a_reset(struct gk20a *g, u32 units);
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
index 9ebc5bab..2d2cf220 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
@@ -301,7 +301,7 @@ static ssize_t elpg_enable_store(struct device *device,
301 * Since elpg is refcounted, we should not unnecessarily call 301 * Since elpg is refcounted, we should not unnecessarily call
302 * enable/disable if it is already so. 302 * enable/disable if it is already so.
303 */ 303 */
304 err = gk20a_busy(g->dev); 304 err = gk20a_channel_busy(g->dev);
305 if (err) 305 if (err)
306 return -EAGAIN; 306 return -EAGAIN;
307 307
@@ -312,7 +312,7 @@ static ssize_t elpg_enable_store(struct device *device,
312 g->elpg_enabled = false; 312 g->elpg_enabled = false;
313 gk20a_pmu_disable_elpg(g); 313 gk20a_pmu_disable_elpg(g);
314 } 314 }
315 gk20a_idle(g->dev); 315 gk20a_channel_idle(g->dev);
316 316
317 dev_info(device, "ELPG is %s.\n", g->elpg_enabled ? "enabled" : 317 dev_info(device, "ELPG is %s.\n", g->elpg_enabled ? "enabled" :
318 "disabled"); 318 "disabled");