summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/module.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index cbad3993..80c516a6 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -288,9 +288,9 @@ static struct of_device_id tegra_gk20a_of_match[] = {
288 * In success, we hold these locks and return 288 * In success, we hold these locks and return
289 * In failure, we release these locks and return 289 * In failure, we release these locks and return
290 */ 290 */
291int __gk20a_do_idle(struct device *dev, bool force_reset) 291int __gk20a_do_idle(struct gk20a *g, bool force_reset)
292{ 292{
293 struct gk20a *g = get_gk20a(dev); 293 struct device *dev = g->dev;
294 struct gk20a_platform *platform = dev_get_drvdata(dev); 294 struct gk20a_platform *platform = dev_get_drvdata(dev);
295 struct nvgpu_timeout timeout; 295 struct nvgpu_timeout timeout;
296 int ref_cnt; 296 int ref_cnt;
@@ -419,25 +419,19 @@ fail_timeout:
419 * 419 *
420 * In success, this call MUST be balanced by caller with gk20a_do_unidle() 420 * In success, this call MUST be balanced by caller with gk20a_do_unidle()
421 */ 421 */
422int gk20a_do_idle(void) 422static int gk20a_do_idle(void *_g)
423{ 423{
424 struct device_node *node = 424 struct gk20a *g = (struct gk20a *)_g;
425 of_find_matching_node(NULL, tegra_gk20a_of_match);
426 struct platform_device *pdev = of_find_device_by_node(node);
427
428 int ret = __gk20a_do_idle(&pdev->dev, true);
429
430 of_node_put(node);
431 425
432 return ret; 426 return __gk20a_do_idle(g, true);
433} 427}
434 428
435/** 429/**
436 * __gk20a_do_unidle() - unblock all the tasks blocked by __gk20a_do_idle() 430 * __gk20a_do_unidle() - unblock all the tasks blocked by __gk20a_do_idle()
437 */ 431 */
438int __gk20a_do_unidle(struct device *dev) 432int __gk20a_do_unidle(struct gk20a *g)
439{ 433{
440 struct gk20a *g = get_gk20a(dev); 434 struct device *dev = g->dev;
441 struct gk20a_platform *platform = dev_get_drvdata(dev); 435 struct gk20a_platform *platform = dev_get_drvdata(dev);
442 int err; 436 int err;
443 437
@@ -471,17 +465,11 @@ int __gk20a_do_unidle(struct device *dev)
471/** 465/**
472 * gk20a_do_unidle() - wrap up for __gk20a_do_unidle() 466 * gk20a_do_unidle() - wrap up for __gk20a_do_unidle()
473 */ 467 */
474int gk20a_do_unidle(void) 468static int gk20a_do_unidle(void *_g)
475{ 469{
476 struct device_node *node = 470 struct gk20a *g = (struct gk20a *)_g;
477 of_find_matching_node(NULL, tegra_gk20a_of_match);
478 struct platform_device *pdev = of_find_device_by_node(node);
479 471
480 int ret = __gk20a_do_unidle(&pdev->dev); 472 return __gk20a_do_unidle(g);
481
482 of_node_put(node);
483
484 return ret;
485} 473}
486#endif 474#endif
487 475
@@ -520,6 +508,8 @@ static irqreturn_t gk20a_intr_thread_stall(int irq, void *dev_id)
520 508
521void gk20a_remove_support(struct gk20a *g) 509void gk20a_remove_support(struct gk20a *g)
522{ 510{
511 tegra_unregister_idle_unidle(gk20a_do_idle);
512
523 nvgpu_kfree(g, g->dbg_regops_tmp_buf); 513 nvgpu_kfree(g, g->dbg_regops_tmp_buf);
524 514
525 if (g->pmu.remove_support) 515 if (g->pmu.remove_support)
@@ -557,6 +547,8 @@ static int gk20a_init_support(struct platform_device *dev)
557 int err = 0; 547 int err = 0;
558 struct gk20a *g = get_gk20a(&dev->dev); 548 struct gk20a *g = get_gk20a(&dev->dev);
559 549
550 tegra_register_idle_unidle(gk20a_do_idle, gk20a_do_unidle, g);
551
560 g->regs = gk20a_ioremap_resource(dev, GK20A_BAR0_IORESOURCE_MEM, 552 g->regs = gk20a_ioremap_resource(dev, GK20A_BAR0_IORESOURCE_MEM,
561 &g->reg_mem); 553 &g->reg_mem);
562 if (IS_ERR(g->regs)) { 554 if (IS_ERR(g->regs)) {