diff options
| author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-05-24 07:21:30 -0400 |
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-06-17 07:30:50 -0400 |
| commit | 61a7f24a3f148b3fe491154943221f1a7fa729b7 (patch) | |
| tree | 19dc97eb7705072e8f51797dc4fe5089f441d614 | |
| parent | 3cb07ee66bca756921f0e967b687f4d0e05ba439 (diff) | |
OMAPDSS: Add new Analog TV Connector driver
Add Analog TV Connector driver which uses the new DSS device model and
DSS ops.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
| -rw-r--r-- | drivers/video/omap2/displays-new/Kconfig | 5 | ||||
| -rw-r--r-- | drivers/video/omap2/displays-new/Makefile | 1 | ||||
| -rw-r--r-- | drivers/video/omap2/displays-new/connector-analog-tv.c | 265 | ||||
| -rw-r--r-- | include/video/omap-panel-data.h | 15 |
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 | ||
| 26 | config DISPLAY_CONNECTOR_ANALOG_TV | ||
| 27 | tristate "Analog TV Connector" | ||
| 28 | help | ||
| 29 | Driver for a generic analog TV connector. | ||
| 30 | |||
| 26 | endmenu | 31 | endmenu |
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 | |||
| 2 | obj-$(CONFIG_DISPLAY_ENCODER_TPD12S015) += encoder-tpd12s015.o | 2 | obj-$(CONFIG_DISPLAY_ENCODER_TPD12S015) += encoder-tpd12s015.o |
| 3 | obj-$(CONFIG_DISPLAY_CONNECTOR_DVI) += connector-dvi.o | 3 | obj-$(CONFIG_DISPLAY_CONNECTOR_DVI) += connector-dvi.o |
| 4 | obj-$(CONFIG_DISPLAY_CONNECTOR_HDMI) += connector-hdmi.o | 4 | obj-$(CONFIG_DISPLAY_CONNECTOR_HDMI) += connector-hdmi.o |
| 5 | obj-$(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 | |||
| 19 | struct 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 | |||
| 33 | static 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 | |||
| 51 | static 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 | |||
| 64 | static 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 | |||
| 92 | static 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 | |||
| 107 | static 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 | |||
| 119 | static 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 | |||
| 127 | static 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 | |||
| 136 | static 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 | |||
| 144 | static 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 | |||
| 152 | static 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, | ||
| 162 | |||
| 163 | .get_resolution = omapdss_default_get_resolution, | ||
| 164 | |||
| 165 | .get_wss = tvc_get_wss, | ||
| 166 | .set_wss = tvc_set_wss, | ||
| 167 | }; | ||
| 168 | |||
| 169 | static int tvc_probe_pdata(struct platform_device *pdev) | ||
| 170 | { | ||
