]> asedeno.scripts.mit.edu Git - linux.git/blob - drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
drm/omap: Merge omap_dss_device type and output_type fields
[linux.git] / drivers / gpu / drm / omapdrm / displays / connector-analog-tv.c
1 /*
2  * Analog TV Connector driver
3  *
4  * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5  * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License version 2 as published by
9  * the Free Software Foundation.
10  */
11
12 #include <linux/slab.h>
13 #include <linux/module.h>
14 #include <linux/platform_device.h>
15 #include <linux/of.h>
16
17 #include "../dss/omapdss.h"
18
19 struct panel_drv_data {
20         struct omap_dss_device dssdev;
21
22         struct device *dev;
23 };
24
25 #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
26
27 static int tvc_connect(struct omap_dss_device *src,
28                        struct omap_dss_device *dst)
29 {
30         return 0;
31 }
32
33 static void tvc_disconnect(struct omap_dss_device *src,
34                            struct omap_dss_device *dst)
35 {
36 }
37
38 static const struct omap_dss_device_ops tvc_ops = {
39         .connect                = tvc_connect,
40         .disconnect             = tvc_disconnect,
41 };
42
43 static int tvc_probe(struct platform_device *pdev)
44 {
45         struct panel_drv_data *ddata;
46         struct omap_dss_device *dssdev;
47
48         ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
49         if (!ddata)
50                 return -ENOMEM;
51
52         platform_set_drvdata(pdev, ddata);
53         ddata->dev = &pdev->dev;
54
55         dssdev = &ddata->dssdev;
56         dssdev->ops = &tvc_ops;
57         dssdev->dev = &pdev->dev;
58         dssdev->type = OMAP_DISPLAY_TYPE_VENC;
59         dssdev->display = true;
60         dssdev->owner = THIS_MODULE;
61         dssdev->of_ports = BIT(0);
62
63         omapdss_display_init(dssdev);
64         omapdss_device_register(dssdev);
65
66         return 0;
67 }
68
69 static int __exit tvc_remove(struct platform_device *pdev)
70 {
71         struct panel_drv_data *ddata = platform_get_drvdata(pdev);
72
73         omapdss_device_unregister(&ddata->dssdev);
74
75         return 0;
76 }
77
78 static const struct of_device_id tvc_of_match[] = {
79         { .compatible = "omapdss,svideo-connector", },
80         { .compatible = "omapdss,composite-video-connector", },
81         {},
82 };
83
84 MODULE_DEVICE_TABLE(of, tvc_of_match);
85
86 static struct platform_driver tvc_connector_driver = {
87         .probe  = tvc_probe,
88         .remove = __exit_p(tvc_remove),
89         .driver = {
90                 .name   = "connector-analog-tv",
91                 .of_match_table = tvc_of_match,
92                 .suppress_bind_attrs = true,
93         },
94 };
95
96 module_platform_driver(tvc_connector_driver);
97
98 MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
99 MODULE_DESCRIPTION("Analog TV Connector driver");
100 MODULE_LICENSE("GPL");