summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c36
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/gk20a/fence_gk20a.c1
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h6
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c5
-rw-r--r--drivers/gpu/nvgpu/vgpu/sysfs_vgpu.c1
-rw-r--r--include/linux/gk20a.h35
7 files changed, 18 insertions, 68 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)) {
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
index 3d313ce8..1b650cdd 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
@@ -13,8 +13,6 @@
13 * more details. 13 * more details.
14 */ 14 */
15 15
16#include <linux/gk20a.h>
17
18#include <linux/version.h> 16#include <linux/version.h>
19 17
20#include <nvgpu/semaphore.h> 18#include <nvgpu/semaphore.h>
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
index 5392e77c..51363059 100644
--- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c
@@ -13,7 +13,6 @@
13 13
14#include "fence_gk20a.h" 14#include "fence_gk20a.h"
15 15
16#include <linux/gk20a.h>
17#include <linux/file.h> 16#include <linux/file.h>
18#include <linux/version.h> 17#include <linux/version.h>
19#include <linux/fs.h> 18#include <linux/fs.h>
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 79118fca..34f89fc8 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -1485,10 +1485,8 @@ void gk20a_busy_noresume(struct device *dev);
1485void gk20a_idle_nosuspend(struct device *dev); 1485void gk20a_idle_nosuspend(struct device *dev);
1486int __must_check gk20a_busy(struct gk20a *g); 1486int __must_check gk20a_busy(struct gk20a *g);
1487void gk20a_idle(struct gk20a *g); 1487void gk20a_idle(struct gk20a *g);
1488int gk20a_do_idle(void); 1488int __gk20a_do_idle(struct gk20a *g, bool force_reset);
1489int gk20a_do_unidle(void); 1489int __gk20a_do_unidle(struct gk20a *g);
1490int __gk20a_do_idle(struct device *dev, bool force_reset);
1491int __gk20a_do_unidle(struct device *dev);
1492 1490
1493int gk20a_can_busy(struct gk20a *g); 1491int gk20a_can_busy(struct gk20a *g);
1494void gk20a_driver_start_unload(struct gk20a *g); 1492void gk20a_driver_start_unload(struct gk20a *g);
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
index 275b663f..8c1dbd37 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_sysfs.c
@@ -22,7 +22,6 @@
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/pm_runtime.h> 23#include <linux/pm_runtime.h>
24#include <linux/fb.h> 24#include <linux/fb.h>
25#include <linux/gk20a.h>
26#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) 25#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
27#include <soc/tegra/tegra-dvfs.h> 26#include <soc/tegra/tegra-dvfs.h>
28#endif 27#endif
@@ -742,7 +741,7 @@ static ssize_t force_idle_store(struct device *dev,
742 if (g->forced_idle) 741 if (g->forced_idle)
743 return count; /* do nothing */ 742 return count; /* do nothing */
744 else { 743 else {
745 err = __gk20a_do_idle(dev, false); 744 err = __gk20a_do_idle(g, false);
746 if (!err) { 745 if (!err) {
747 g->forced_idle = 1; 746 g->forced_idle = 1;
748 dev_info(dev, "gpu is idle : %d\n", 747 dev_info(dev, "gpu is idle : %d\n",
@@ -753,7 +752,7 @@ static ssize_t force_idle_store(struct device *dev,
753 if (!g->forced_idle) 752 if (!g->forced_idle)
754 return count; /* do nothing */ 753 return count; /* do nothing */
755 else { 754 else {
756 err = __gk20a_do_unidle(dev); 755 err = __gk20a_do_unidle(g);
757 if (!err) { 756 if (!err) {
758 g->forced_idle = 0; 757 g->forced_idle = 0;
759 dev_info(dev, "gpu is idle : %d\n", 758 dev_info(dev, "gpu is idle : %d\n",
diff --git a/drivers/gpu/nvgpu/vgpu/sysfs_vgpu.c b/drivers/gpu/nvgpu/vgpu/sysfs_vgpu.c
index 5a9f1fee..82fa7aac 100644
--- a/drivers/gpu/nvgpu/vgpu/sysfs_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/sysfs_vgpu.c
@@ -12,7 +12,6 @@
12 */ 12 */
13 13
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/gk20a.h>
16 15
17#include "vgpu/vgpu.h" 16#include "vgpu/vgpu.h"
18 17
diff --git a/include/linux/gk20a.h b/include/linux/gk20a.h
deleted file mode 100644
index ec81faf4..00000000
--- a/include/linux/gk20a.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * gk20a GPU driver
3 *
4 * Copyright (c) 2014-2016, NVIDIA Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef __GK20A_H
20#define __GK20A_H
21
22#include <linux/errno.h>
23
24struct channel_gk20a;
25struct platform_device;
26
27#if defined(CONFIG_GK20A) && defined(CONFIG_PM)
28int gk20a_do_idle(void);
29int gk20a_do_unidle(void);
30#else
31static inline int gk20a_do_idle(void) { return -ENOSYS; }
32static inline int gk20a_do_unidle(void) { return -ENOSYS; }
33#endif
34
35#endif