dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / drivers / gpu / drm / omapdrm / displays / connector-analog-tv.c
blob28a3ce8f88d260db15c3d27f9b6e4d5de2db20f5
1 /*
2 * Analog TV Connector driver
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
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.
12 #include <linux/slab.h>
13 #include <linux/module.h>
14 #include <linux/platform_device.h>
15 #include <linux/of.h>
17 #include "../dss/omapdss.h"
19 struct panel_drv_data {
20 struct omap_dss_device dssdev;
22 struct device *dev;
25 #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
27 static int tvc_connect(struct omap_dss_device *src,
28 struct omap_dss_device *dst)
30 return 0;
33 static void tvc_disconnect(struct omap_dss_device *src,
34 struct omap_dss_device *dst)
38 static int tvc_enable(struct omap_dss_device *dssdev)
40 struct panel_drv_data *ddata = to_panel_data(dssdev);
41 struct omap_dss_device *src = dssdev->src;
42 int r;
44 dev_dbg(ddata->dev, "enable\n");
46 if (!omapdss_device_is_connected(dssdev))
47 return -ENODEV;
49 if (omapdss_device_is_enabled(dssdev))
50 return 0;
52 r = src->ops->enable(src);
53 if (r)
54 return r;
56 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
58 return r;
61 static void tvc_disable(struct omap_dss_device *dssdev)
63 struct panel_drv_data *ddata = to_panel_data(dssdev);
64 struct omap_dss_device *src = dssdev->src;
66 dev_dbg(ddata->dev, "disable\n");
68 if (!omapdss_device_is_enabled(dssdev))
69 return;
71 src->ops->disable(src);
73 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
76 static const struct omap_dss_device_ops tvc_ops = {
77 .connect = tvc_connect,
78 .disconnect = tvc_disconnect,
80 .enable = tvc_enable,
81 .disable = tvc_disable,
84 static int tvc_probe(struct platform_device *pdev)
86 struct panel_drv_data *ddata;
87 struct omap_dss_device *dssdev;
89 ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
90 if (!ddata)
91 return -ENOMEM;
93 platform_set_drvdata(pdev, ddata);
94 ddata->dev = &pdev->dev;
96 dssdev = &ddata->dssdev;
97 dssdev->ops = &tvc_ops;
98 dssdev->dev = &pdev->dev;
99 dssdev->type = OMAP_DISPLAY_TYPE_VENC;
100 dssdev->owner = THIS_MODULE;
101 dssdev->of_ports = BIT(0);
103 omapdss_display_init(dssdev);
104 omapdss_device_register(dssdev);
106 return 0;
109 static int __exit tvc_remove(struct platform_device *pdev)
111 struct panel_drv_data *ddata = platform_get_drvdata(pdev);
112 struct omap_dss_device *dssdev = &ddata->dssdev;
114 omapdss_device_unregister(&ddata->dssdev);
116 tvc_disable(dssdev);
118 return 0;
121 static const struct of_device_id tvc_of_match[] = {
122 { .compatible = "omapdss,svideo-connector", },
123 { .compatible = "omapdss,composite-video-connector", },
127 MODULE_DEVICE_TABLE(of, tvc_of_match);
129 static struct platform_driver tvc_connector_driver = {
130 .probe = tvc_probe,
131 .remove = __exit_p(tvc_remove),
132 .driver = {
133 .name = "connector-analog-tv",
134 .of_match_table = tvc_of_match,
135 .suppress_bind_attrs = true,
139 module_platform_driver(tvc_connector_driver);
141 MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>");
142 MODULE_DESCRIPTION("Analog TV Connector driver");
143 MODULE_LICENSE("GPL");