2 * drivers/video/tegra/host/vi/vi.c
4 * Tegra Graphics Host VI
6 * Copyright (c) 2012-2013, NVIDIA Corporation.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include <linux/export.h>
22 #include <linux/resource.h>
23 #include <linux/pm_runtime.h>
25 #include <linux/of_device.h>
26 #include <linux/of_platform.h>
28 #include <mach/iomap.h>
31 #include "bus_client.h"
34 #include "t114/t114.h"
36 static struct of_device_id tegra_vi_of_match[] = {
37 { .compatible = "nvidia,tegra20-vi",
38 .data = (struct nvhost_device_data *)&t20_vi_info },
39 { .compatible = "nvidia,tegra30-vi",
40 .data = (struct nvhost_device_data *)&t30_vi_info },
41 { .compatible = "nvidia,tegra114-vi",
42 .data = (struct nvhost_device_data *)&t11_vi_info },
46 static int vi_probe(struct platform_device *dev)
49 struct nvhost_device_data *pdata = NULL;
51 if (dev->dev.of_node) {
52 const struct of_device_id *match;
54 match = of_match_device(tegra_vi_of_match, &dev->dev);
56 pdata = (struct nvhost_device_data *)match->data;
58 pdata = (struct nvhost_device_data *)dev->dev.platform_data;
62 dev_info(&dev->dev, "no platform data\n");
67 platform_set_drvdata(dev, pdata);
69 err = nvhost_client_device_get_resources(dev);
73 err = nvhost_client_device_init(dev);
77 pm_runtime_use_autosuspend(&dev->dev);
78 pm_runtime_set_autosuspend_delay(&dev->dev, 100);
79 pm_runtime_enable(&dev->dev);
84 static int __exit vi_remove(struct platform_device *dev)
91 static int vi_suspend(struct device *dev)
93 return nvhost_client_device_suspend(to_platform_device(dev));
96 static int vi_resume(struct device *dev)
98 dev_info(dev, "resuming\n");
102 static const struct dev_pm_ops vi_pm_ops = {
103 .suspend = vi_suspend,
107 #define VI_PM_OPS (&vi_pm_ops)
111 #define VI_PM_OPS NULL
115 static struct platform_driver vi_driver = {
117 .remove = __exit_p(vi_remove),
119 .owner = THIS_MODULE,
123 .of_match_table = tegra_vi_of_match,
128 static int __init vi_init(void)
130 return platform_driver_register(&vi_driver);
133 static void __exit vi_exit(void)
135 platform_driver_unregister(&vi_driver);
138 module_init(vi_init);
139 module_exit(vi_exit);