GNU Linux-libre 4.19.245-gnu1
[releases.git] / drivers / gpu / drm / omapdrm / dss / core.c
1 /*
2  * Copyright (C) 2009 Nokia Corporation
3  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
4  *
5  * Some code and ideas taken from drivers/video/omap/ driver
6  * by Imre Deak.
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License version 2 as published by
10  * the Free Software Foundation.
11  *
12  * This program is distributed in the hope that 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 along with
18  * this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #define DSS_SUBSYS_NAME "CORE"
22
23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/platform_device.h>
26
27 #include "omapdss.h"
28 #include "dss.h"
29
30 /* INIT */
31 static struct platform_driver * const omap_dss_drivers[] = {
32         &omap_dsshw_driver,
33         &omap_dispchw_driver,
34 #ifdef CONFIG_OMAP2_DSS_DSI
35         &omap_dsihw_driver,
36 #endif
37 #ifdef CONFIG_OMAP2_DSS_VENC
38         &omap_venchw_driver,
39 #endif
40 #ifdef CONFIG_OMAP4_DSS_HDMI
41         &omapdss_hdmi4hw_driver,
42 #endif
43 #ifdef CONFIG_OMAP5_DSS_HDMI
44         &omapdss_hdmi5hw_driver,
45 #endif
46 };
47
48 static struct platform_device *omap_drm_device;
49
50 static int __init omap_dss_init(void)
51 {
52         int r;
53
54         r = platform_register_drivers(omap_dss_drivers,
55                                       ARRAY_SIZE(omap_dss_drivers));
56         if (r)
57                 goto err_reg;
58
59         omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0);
60         if (IS_ERR(omap_drm_device)) {
61                 r = PTR_ERR(omap_drm_device);
62                 goto err_reg;
63         }
64
65         return 0;
66
67 err_reg:
68         platform_unregister_drivers(omap_dss_drivers,
69                                     ARRAY_SIZE(omap_dss_drivers));
70
71         return r;
72 }
73
74 static void __exit omap_dss_exit(void)
75 {
76         platform_device_unregister(omap_drm_device);
77
78         platform_unregister_drivers(omap_dss_drivers,
79                                     ARRAY_SIZE(omap_dss_drivers));
80 }
81
82 module_init(omap_dss_init);
83 module_exit(omap_dss_exit);
84
85 MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
86 MODULE_DESCRIPTION("OMAP2/3 Display Subsystem");
87 MODULE_LICENSE("GPL v2");
88