core.c 2.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/*
 * linux/drivers/video/omap2/dss/core.c
 *
 * Copyright (C) 2009 Nokia Corporation
 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
 *
 * Some code and ideas taken from drivers/video/omap/ driver
 * by Imre Deak.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published by
 * the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#define DSS_SUBSYS_NAME "CORE"

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>

29
#include "omapdss.h"
30 31 32
#include "dss.h"

/* INIT */
33
static int (*dss_output_drv_reg_funcs[])(void) __initdata = {
34 35
	dss_init_platform_driver,
	dispc_init_platform_driver,
T
Tomi Valkeinen 已提交
36 37 38
#ifdef CONFIG_OMAP2_DSS_DSI
	dsi_init_platform_driver,
#endif
39 40 41 42
#ifdef CONFIG_OMAP2_DSS_VENC
	venc_init_platform_driver,
#endif
#ifdef CONFIG_OMAP4_DSS_HDMI
43
	hdmi4_init_platform_driver,
44
#endif
45 46 47
#ifdef CONFIG_OMAP5_DSS_HDMI
	hdmi5_init_platform_driver,
#endif
48 49
};

50
static void (*dss_output_drv_unreg_funcs[])(void) = {
T
Tomi Valkeinen 已提交
51 52
#ifdef CONFIG_OMAP5_DSS_HDMI
	hdmi5_uninit_platform_driver,
T
Tomi Valkeinen 已提交
53
#endif
T
Tomi Valkeinen 已提交
54 55
#ifdef CONFIG_OMAP4_DSS_HDMI
	hdmi4_uninit_platform_driver,
56
#endif
T
Tomi Valkeinen 已提交
57 58
#ifdef CONFIG_OMAP2_DSS_VENC
	venc_uninit_platform_driver,
59
#endif
T
Tomi Valkeinen 已提交
60 61
#ifdef CONFIG_OMAP2_DSS_DSI
	dsi_uninit_platform_driver,
62
#endif
63 64
	dispc_uninit_platform_driver,
	dss_uninit_platform_driver,
65 66
};

67 68
static struct platform_device *omap_drm_device;

69
static int __init omap_dss_init(void)
70 71
{
	int r;
72
	int i;
73

74 75
	for (i = 0; i < ARRAY_SIZE(dss_output_drv_reg_funcs); ++i) {
		r = dss_output_drv_reg_funcs[i]();
76 77
		if (r)
			goto err_reg;
78 79
	}

80
	omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 0);
81 82 83 84 85
	if (IS_ERR(omap_drm_device)) {
		r = PTR_ERR(omap_drm_device);
		goto err_reg;
	}

86 87
	return 0;

88 89 90 91 92 93
err_reg:
	for (i = ARRAY_SIZE(dss_output_drv_reg_funcs) - i;
			i < ARRAY_SIZE(dss_output_drv_reg_funcs);
			++i)
		dss_output_drv_unreg_funcs[i]();

94 95 96
	return r;
}

97
static void __exit omap_dss_exit(void)
98
{
99 100
	int i;

101 102
	platform_device_unregister(omap_drm_device);

103 104
	for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i)
		dss_output_drv_unreg_funcs[i]();
105 106
}

107 108 109 110 111 112 113
module_init(omap_dss_init);
module_exit(omap_dss_exit);

MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>");
MODULE_DESCRIPTION("OMAP2/3 Display Subsystem");
MODULE_LICENSE("GPL v2");