aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/omap2/displays-new/Kconfig5
-rw-r--r--drivers/video/omap2/displays-new/Makefile1
-rw-r--r--drivers/video/omap2/displays-new/connector-analog-tv.c265
-rw-r--r--include/video/omap-panel-data.h15
4 files changed, 286 insertions, 0 deletions
diff --git a/drivers/video/omap2/displays-new/Kconfig b/drivers/video/omap2/displays-new/Kconfig
index 9a66413959a1..532663814532 100644
--- a/drivers/video/omap2/displays-new/Kconfig
+++ b/drivers/video/omap2/displays-new/Kconfig
@@ -23,4 +23,9 @@ config DISPLAY_CONNECTOR_HDMI
23 help 23 help
24 Driver for a generic HDMI connector. 24 Driver for a generic HDMI connector.
25 25
26config DISPLAY_CONNECTOR_ANALOG_TV
27 tristate "Analog TV Connector"
28 help
29 Driver for a generic analog TV connector.
30
26endmenu 31endmenu
diff --git a/drivers/video/omap2/displays-new/Makefile b/drivers/video/omap2/displays-new/Makefile
index 1007b5f53fbc..083bf0895573 100644
--- a/drivers/video/omap2/displays-new/Makefile
+++ b/drivers/video/omap2/displays-new/Makefile
@@ -2,3 +2,4 @@ obj-$(CONFIG_DISPLAY_ENCODER_TFP410) += encoder-tfp410.o
2obj-$(CONFIG_DISPLAY_ENCODER_TPD12S015) += encoder-tpd12s015.o 2obj-$(CONFIG_DISPLAY_ENCODER_TPD12S015) += encoder-tpd12s015.o
3obj-$(CONFIG_DISPLAY_CONNECTOR_DVI) += connector-dvi.o 3obj-$(CONFIG_DISPLAY_CONNECTOR_DVI) += connector-dvi.o
4obj-$(CONFIG_DISPLAY_CONNECTOR_HDMI) += connector-hdmi.o 4obj-$(CONFIG_DISPLAY_CONNECTOR_HDMI) += connector-hdmi.o
5obj-$(CONFIG_DISPLAY_CONNECTOR_ANALOG_TV) += connector-analog-tv.o
diff --git a/drivers/video/omap2/displays-new/connector-analog-tv.c b/drivers/video/omap2/displays-new/connector-analog-tv.c
new file mode 100644
index 000000000000..5338f362293b
--- /dev/null
+++ b/drivers/video/omap2/displays-new/connector-analog-tv.c
@@ -0,0 +1,265 @@
1/*
2 * Analog TV Connector driver
3 *
4 * Copyright (C) 2013 Texas Instruments
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
16#include <video/omapdss.h>
17#include <video/omap-panel-data.h>
18
19struct panel_drv_data {
20 struct omap_dss_device dssdev;
21 struct omap_dss_device *in;
22
23 struct device *dev;
24
25 struct omap_video_timings timings;
26
27 enum omap_dss_venc_type connector_type;
28 bool invert_polarity;
29};
30
31#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
32
33static int tvc_connect(struct omap_dss_device *dssdev)
34{
35 struct panel_drv_data *ddata = to_panel_data(dssdev);
36 struct omap_dss_device *in = ddata->in;
37 int r;
38
39 dev_dbg(ddata->dev, "connect\n");
40
41 if (omapdss_device_is_connected(dssdev))
42 return 0;
43
44 r = in->ops.atv->connect(in, dssdev);
45 if (r)
46 return r;
47
48 return 0;
49}
50
51static void tvc_disconnect(struct omap_dss_device *dssdev)
52{
53 struct panel_drv_data *ddata = to_panel_data(dssdev);
54 struct omap_dss_device *in = ddata->in;
55
56 dev_dbg(ddata->dev, "disconnect\n");
57
58 if (!omapdss_device_is_connected(dssdev))
59 return;
60
61 in->ops.atv->disconnect(in, dssdev);
62}
63
64static int tvc_enable(struct omap_dss_device *dssdev)
65{
66 struct panel_drv_data *ddata = to_panel_data(dssdev);
67 struct omap_dss_device *in = ddata->in;
68 int r;
69
70 dev_dbg(ddata->dev, "enable\n");
71
72 if (!omapdss_device_is_connected(dssdev))
73 return -ENODEV;
74
75 if (omapdss_device_is_enabled(dssdev))
76 return 0;
77
78 in->ops.atv->set_timings(in, &ddata->timings);
79
80 in->ops.atv->set_type(in, ddata->connector_type);
81 in->ops.atv->invert_vid_out_polarity(in, ddata->invert_polarity);
82
83 r = in->ops.atv->enable(in);
84 if (r)
85 return r;
86
87 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
88
89 return r;
90}
91
92static void tvc_disable(struct omap_dss_device *dssdev)
93{
94 struct panel_drv_data *ddata = to_panel_data(dssdev);
95 struct omap_dss_device *in = ddata->in;
96
97 dev_dbg(ddata->dev, "disable\n");
98
99 if (!omapdss_device_is_enabled(dssdev))
100 return;
101
102 in->ops.atv->disable(in);
103
104 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
105}
106
107static void tvc_set_timings(struct omap_dss_device *dssdev,
108 struct omap_video_timings *timings)
109{
110 struct panel_drv_data *ddata = to_panel_data(dssdev);
111 struct omap_dss_device *in = ddata->in;
112
113 ddata->timings = *timings;
114 dssdev->panel.timings = *timings;
115
116 in->ops.atv->set_timings(in, timings);
117}
118
119static void tvc_get_timings(struct omap_dss_device *dssdev,
120 struct omap_video_timings *timings)
121{
122 struct panel_drv_data *ddata = to_panel_data(dssdev);
123
124 *timings = ddata->timings;
125}
126
127static int tvc_check_timings(struct omap_dss_device *dssdev,
128 struct omap_video_timings *timings)
129{
130 struct panel_drv_data *ddata = to_panel_data(dssdev);
131 struct omap_dss_device *in = ddata->in;
132
133 return in->ops.atv->check_timings(in, timings);
134}
135
136static u32 tvc_get_wss(struct omap_dss_device *dssdev)
137{
138 struct panel_drv_data *ddata = to_panel_data(dssdev);
139 struct omap_dss_device *in = ddata->in;
140
141 return in->ops.atv->get_wss(in);
142}
143
144static int tvc_set_wss(struct omap_dss_device *dssdev, u32 wss)
145{
146 struct panel_drv_data *ddata = to_panel_data(dssdev);
147 struct omap_dss_device *in = ddata->in;
148
149 return in->ops.atv->set_wss(in, wss);
150}
151
152static struct omap_dss_driver tvc_driver = {
153 .connect = tvc_connect,
154 .disconnect = tvc_disconnect,
155
156 .enable = tvc_enable,
157 .disable = tvc_disable,
158
159 .set_timings = tvc_set_timings,
160 .get_timings = tvc_get_timings,
161 .check_timings = tvc_check_timings,