video: tegra: host: Exclude suspend/resume if disabled
[linux-3.10.git] / drivers / video / tegra / host / gr2d / gr2d.c
1 /*
2  * drivers/video/tegra/host/gr2d/gr2d.c
3  *
4  * Tegra Graphics 2D
5  *
6  * Copyright (c) 2012, NVIDIA Corporation.
7  *
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.
11  *
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
15  * more details.
16  *
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/>.
19  */
20
21 #include <linux/export.h>
22
23 #include "dev.h"
24 #include "bus_client.h"
25
26 static int gr2d_probe(struct nvhost_device *dev,
27         struct nvhost_device_id *id_table)
28 {
29         return nvhost_client_device_init(dev);
30 }
31
32 static int __exit gr2d_remove(struct nvhost_device *dev)
33 {
34         /* Add clean-up */
35         return 0;
36 }
37
38 #ifdef CONFIG_PM
39 static int gr2d_suspend(struct nvhost_device *dev, pm_message_t state)
40 {
41         return nvhost_client_device_suspend(dev);
42 }
43
44 static int gr2d_resume(struct nvhost_device *dev)
45 {
46         dev_info(&dev->dev, "resuming\n");
47         return 0;
48 }
49 #endif
50
51 static struct nvhost_driver gr2d_driver = {
52         .probe = gr2d_probe,
53         .remove = __exit_p(gr2d_remove),
54 #ifdef CONFIG_PM
55         .suspend = gr2d_suspend,
56         .resume = gr2d_resume,
57 #endif
58         .driver = {
59                 .owner = THIS_MODULE,
60                 .name = "gr2d",
61         }
62 };
63
64 static int __init gr2d_init(void)
65 {
66         return nvhost_driver_register(&gr2d_driver);
67 }
68
69 static void __exit gr2d_exit(void)
70 {
71         nvhost_driver_unregister(&gr2d_driver);
72 }
73
74 module_init(gr2d_init);
75 module_exit(gr2d_exit);