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