diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 0816878a..3499cc89 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/tegra-powergate.h> | 40 | #include <linux/tegra-powergate.h> |
41 | #include <linux/tegra_pm_domains.h> | 41 | #include <linux/tegra_pm_domains.h> |
42 | #include <linux/clk/tegra.h> | 42 | #include <linux/clk/tegra.h> |
43 | #include <linux/kthread.h> | ||
43 | 44 | ||
44 | #include <linux/sched.h> | 45 | #include <linux/sched.h> |
45 | #include <linux/input-cfboost.h> | 46 | #include <linux/input-cfboost.h> |
@@ -57,6 +58,9 @@ | |||
57 | #include "dbg_gpu_gk20a.h" | 58 | #include "dbg_gpu_gk20a.h" |
58 | #include "hal.h" | 59 | #include "hal.h" |
59 | #include "nvhost_acm.h" | 60 | #include "nvhost_acm.h" |
61 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION | ||
62 | #include "vgpu/vgpu.h" | ||
63 | #endif | ||
60 | 64 | ||
61 | #define CREATE_TRACE_POINTS | 65 | #define CREATE_TRACE_POINTS |
62 | #include <trace/events/gk20a.h> | 66 | #include <trace/events/gk20a.h> |
@@ -737,6 +741,17 @@ static int gk20a_init_client(struct platform_device *dev) | |||
737 | 741 | ||
738 | gk20a_dbg_fn(""); | 742 | gk20a_dbg_fn(""); |
739 | 743 | ||
744 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION | ||
745 | { | ||
746 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
747 | |||
748 | if (platform->virtual_dev) { | ||
749 | err = vgpu_pm_finalize_poweron(&dev->dev); | ||
750 | if (err) | ||
751 | return err; | ||
752 | } | ||
753 | } | ||
754 | #endif | ||
740 | #ifndef CONFIG_PM_RUNTIME | 755 | #ifndef CONFIG_PM_RUNTIME |
741 | gk20a_pm_finalize_poweron(&dev->dev); | 756 | gk20a_pm_finalize_poweron(&dev->dev); |
742 | #endif | 757 | #endif |
@@ -753,6 +768,16 @@ static int gk20a_init_client(struct platform_device *dev) | |||
753 | static void gk20a_deinit_client(struct platform_device *dev) | 768 | static void gk20a_deinit_client(struct platform_device *dev) |
754 | { | 769 | { |
755 | gk20a_dbg_fn(""); | 770 | gk20a_dbg_fn(""); |
771 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION | ||
772 | { | ||
773 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
774 | |||
775 | if (platform->virtual_dev) { | ||
776 | vgpu_pm_prepare_poweroff(&dev->dev); | ||
777 | return; | ||
778 | } | ||
779 | } | ||
780 | #endif | ||
756 | #ifndef CONFIG_PM_RUNTIME | 781 | #ifndef CONFIG_PM_RUNTIME |
757 | gk20a_pm_prepare_poweroff(&dev->dev); | 782 | gk20a_pm_prepare_poweroff(&dev->dev); |
758 | #endif | 783 | #endif |
@@ -1006,6 +1031,10 @@ static struct of_device_id tegra_gk20a_of_match[] = { | |||
1006 | .data = &gk20a_tegra_platform }, | 1031 | .data = &gk20a_tegra_platform }, |
1007 | { .compatible = "nvidia,tegra210-gm20b", | 1032 | { .compatible = "nvidia,tegra210-gm20b", |
1008 | .data = &gm20b_tegra_platform }, | 1033 | .data = &gm20b_tegra_platform }, |
1034 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION | ||
1035 | { .compatible = "nvidia,tegra124-gk20a-vgpu", | ||
1036 | .data = &vgpu_tegra_platform }, | ||
1037 | #endif | ||
1009 | #else | 1038 | #else |
1010 | { .compatible = "nvidia,tegra124-gk20a", | 1039 | { .compatible = "nvidia,tegra124-gk20a", |
1011 | .data = &gk20a_generic_platform }, | 1040 | .data = &gk20a_generic_platform }, |
@@ -1057,7 +1086,7 @@ static int gk20a_create_device( | |||
1057 | return 0; | 1086 | return 0; |
1058 | } | 1087 | } |
1059 | 1088 | ||
1060 | static void gk20a_user_deinit(struct platform_device *dev) | 1089 | void gk20a_user_deinit(struct platform_device *dev) |
1061 | { | 1090 | { |
1062 | struct gk20a *g = get_gk20a(dev); | 1091 | struct gk20a *g = get_gk20a(dev); |
1063 | 1092 | ||
@@ -1098,7 +1127,7 @@ static void gk20a_user_deinit(struct platform_device *dev) | |||
1098 | class_destroy(g->class); | 1127 | class_destroy(g->class); |
1099 | } | 1128 | } |
1100 | 1129 | ||
1101 | static int gk20a_user_init(struct platform_device *dev) | 1130 | int gk20a_user_init(struct platform_device *dev) |
1102 | { | 1131 | { |
1103 | int err; | 1132 | int err; |
1104 | dev_t devno; | 1133 | dev_t devno; |
@@ -1403,6 +1432,11 @@ static int gk20a_probe(struct platform_device *dev) | |||
1403 | 1432 | ||
1404 | platform_set_drvdata(dev, platform); | 1433 | platform_set_drvdata(dev, platform); |
1405 | 1434 | ||
1435 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION | ||
1436 | if (platform->virtual_dev) | ||
1437 | return vgpu_probe(dev); | ||
1438 | #endif | ||
1439 | |||
1406 | gk20a = kzalloc(sizeof(struct gk20a), GFP_KERNEL); | 1440 | gk20a = kzalloc(sizeof(struct gk20a), GFP_KERNEL); |
1407 | if (!gk20a) { | 1441 | if (!gk20a) { |
1408 | dev_err(&dev->dev, "couldn't allocate gk20a support"); | 1442 | dev_err(&dev->dev, "couldn't allocate gk20a support"); |
@@ -1546,8 +1580,16 @@ static int gk20a_probe(struct platform_device *dev) | |||
1546 | static int __exit gk20a_remove(struct platform_device *dev) | 1580 | static int __exit gk20a_remove(struct platform_device *dev) |
1547 | { | 1581 | { |
1548 | struct gk20a *g = get_gk20a(dev); | 1582 | struct gk20a *g = get_gk20a(dev); |
1583 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION | ||
1584 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
1585 | #endif | ||
1549 | gk20a_dbg_fn(""); | 1586 | gk20a_dbg_fn(""); |
1550 | 1587 | ||
1588 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION | ||
1589 | if (platform->virtual_dev) | ||
1590 | return vgpu_remove(dev); | ||
1591 | #endif | ||
1592 | |||
1551 | #ifdef CONFIG_INPUT_CFBOOST | 1593 | #ifdef CONFIG_INPUT_CFBOOST |
1552 | if (g->boost_added) | 1594 | if (g->boost_added) |
1553 | cfb_remove_device(&dev->dev); | 1595 | cfb_remove_device(&dev->dev); |