diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2016-09-22 07:07:03 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-11-02 04:48:18 -0400 |
commit | 4520ff28aaa1e7f1b45f3abc0c45429ea9e93817 (patch) | |
tree | 3c10acd71910c43edb4637fbea5f932439a9e6b2 /drivers/gpu/drm/omapdrm/omap_connector.c | |
parent | 7aa91e76aec9dda35ae643c572a8d1b1d596d27b (diff) |
drm/omap: Replace struct omap_video_timings with videomode
omap_video_timings can be replaced with the generic videomode in omapdrm
and the omap_video_timings can be removed.
This patch will replace the omap_video_timings with videomode.
With the change we no longer need the functions to convert to/from
videomode and drm_display_mode to omap_video_timings, these can be removed
as well.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_connector.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_connector.c | 84 |
1 files changed, 8 insertions, 76 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c index 562a04d49939..b04586b7e594 100644 --- a/drivers/gpu/drm/omapdrm/omap_connector.c +++ b/drivers/gpu/drm/omapdrm/omap_connector.c | |||
@@ -42,76 +42,6 @@ bool omap_connector_get_hdmi_mode(struct drm_connector *connector) | |||
42 | return omap_connector->hdmi_mode; | 42 | return omap_connector->hdmi_mode; |
43 | } | 43 | } |
44 | 44 | ||
45 | void copy_timings_omap_to_drm(struct drm_display_mode *mode, | ||
46 | struct omap_video_timings *timings) | ||
47 | { | ||
48 | mode->clock = timings->pixelclock / 1000; | ||
49 | |||
50 | mode->hdisplay = timings->hactive; | ||
51 | mode->hsync_start = mode->hdisplay + timings->hfront_porch; | ||
52 | mode->hsync_end = mode->hsync_start + timings->hsync_len; | ||
53 | mode->htotal = mode->hsync_end + timings->hback_porch; | ||
54 | |||
55 | mode->vdisplay = timings->vactive; | ||
56 | mode->vsync_start = mode->vdisplay + timings->vfront_porch; | ||
57 | mode->vsync_end = mode->vsync_start + timings->vsync_len; | ||
58 | mode->vtotal = mode->vsync_end + timings->vback_porch; | ||
59 | |||
60 | mode->flags = 0; | ||
61 | |||
62 | if (timings->flags & DISPLAY_FLAGS_INTERLACED) | ||
63 | mode->flags |= DRM_MODE_FLAG_INTERLACE; | ||
64 | |||
65 | if (timings->flags & DISPLAY_FLAGS_DOUBLECLK) | ||
66 | mode->flags |= DRM_MODE_FLAG_DBLCLK; | ||
67 | |||
68 | if (timings->flags & DISPLAY_FLAGS_HSYNC_HIGH) | ||
69 | mode->flags |= DRM_MODE_FLAG_PHSYNC; | ||
70 | else | ||
71 | mode->flags |= DRM_MODE_FLAG_NHSYNC; | ||
72 | |||
73 | if (timings->flags & DISPLAY_FLAGS_VSYNC_HIGH) | ||
74 | mode->flags |= DRM_MODE_FLAG_PVSYNC; | ||
75 | else | ||
76 | mode->flags |= DRM_MODE_FLAG_NVSYNC; | ||
77 | } | ||
78 | |||
79 | void copy_timings_drm_to_omap(struct omap_video_timings *timings, | ||
80 | struct drm_display_mode *mode) | ||
81 | { | ||
82 | timings->pixelclock = mode->clock * 1000; | ||
83 | |||
84 | timings->hactive = mode->hdisplay; | ||
85 | timings->hfront_porch = mode->hsync_start - mode->hdisplay; | ||
86 | timings->hsync_len = mode->hsync_end - mode->hsync_start; | ||
87 | timings->hback_porch = mode->htotal - mode->hsync_end; | ||
88 | |||
89 | timings->vactive = mode->vdisplay; | ||
90 | timings->vfront_porch = mode->vsync_start - mode->vdisplay; | ||
91 | timings->vsync_len = mode->vsync_end - mode->vsync_start; | ||
92 | timings->vback_porch = mode->vtotal - mode->vsync_end; | ||
93 | |||
94 | if (mode->flags & DRM_MODE_FLAG_INTERLACE) | ||
95 | timings->flags |= DISPLAY_FLAGS_INTERLACED; | ||
96 | |||
97 | if (mode->flags & DRM_MODE_FLAG_DBLCLK) | ||
98 | timings->flags |= DISPLAY_FLAGS_DOUBLECLK; | ||
99 | |||
100 | if (mode->flags & DRM_MODE_FLAG_PHSYNC) | ||
101 | timings->flags |= DISPLAY_FLAGS_HSYNC_HIGH; | ||
102 | else | ||
103 | timings->flags |= DISPLAY_FLAGS_HSYNC_LOW; | ||
104 | |||
105 | if (mode->flags & DRM_MODE_FLAG_PVSYNC) | ||
106 | timings->flags |= DISPLAY_FLAGS_VSYNC_HIGH; | ||
107 | else | ||
108 | timings->flags |= DISPLAY_FLAGS_VSYNC_LOW; | ||
109 | |||
110 | timings->flags |= DISPLAY_FLAGS_DE_HIGH | | ||
111 | DISPLAY_FLAGS_PIXDATA_POSEDGE | | ||
112 | DISPLAY_FLAGS_SYNC_NEGEDGE; | ||
113 | } | ||
114 | |||
115 | static enum drm_connector_status omap_connector_detect( | 45 | static enum drm_connector_status omap_connector_detect( |
116 | struct drm_connector *connector, bool force) | 46 | struct drm_connector *connector, bool force) |
117 | { | 47 | { |
@@ -188,11 +118,11 @@ static int omap_connector_get_modes(struct drm_connector *connector) | |||
188 | kfree(edid); | 118 | kfree(edid); |
189 | } else { | 119 | } else { |
190 | struct drm_display_mode *mode = drm_mode_create(dev); | 120 | struct drm_display_mode *mode = drm_mode_create(dev); |
191 | struct omap_video_timings timings = {0}; | 121 | struct videomode timings = {0}; |
192 | 122 | ||
193 | dssdrv->get_timings(dssdev, &timings); | 123 | dssdrv->get_timings(dssdev, &timings); |
194 | 124 | ||
195 | copy_timings_omap_to_drm(mode, &timings); | 125 | drm_display_mode_from_videomode(&timings, mode); |
196 | 126 | ||
197 | mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; | 127 | mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; |
198 | drm_mode_set_name(mode); | 128 | drm_mode_set_name(mode); |
@@ -210,12 +140,14 @@ static int omap_connector_mode_valid(struct drm_connector *connector, | |||
210 | struct omap_connector *omap_connector = to_omap_connector(connector); | 140 | struct omap_connector *omap_connector = to_omap_connector(connector); |
211 | struct omap_dss_device *dssdev = omap_connector->dssdev; | 141 | struct omap_dss_device *dssdev = omap_connector->dssdev; |
212 | struct omap_dss_driver *dssdrv = dssdev->driver; | 142 | struct omap_dss_driver *dssdrv = dssdev->driver; |
213 | struct omap_video_timings timings = {0}; | 143 | struct videomode timings = {0}; |
214 | struct drm_device *dev = connector->dev; | 144 | struct drm_device *dev = connector->dev; |
215 | struct drm_display_mode *new_mode; | 145 | struct drm_display_mode *new_mode; |
216 | int r, ret = MODE_BAD; | 146 | int r, ret = MODE_BAD; |
217 | 147 | ||
218 | copy_timings_drm_to_omap(&timings, mode); | 148 | drm_display_mode_to_videomode(mode, &timings); |
149 | timings.flags |= DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE | | ||
150 | DISPLAY_FLAGS_SYNC_NEGEDGE; | ||
219 | mode->vrefresh = drm_mode_vrefresh(mode); | 151 | mode->vrefresh = drm_mode_vrefresh(mode); |
220 | 152 | ||
221 | /* | 153 | /* |
@@ -226,11 +158,11 @@ static int omap_connector_mode_valid(struct drm_connector *connector, | |||
226 | if (dssdrv->check_timings) { | 158 | if (dssdrv->check_timings) { |
227 | r = dssdrv->check_timings(dssdev, &timings); | 159 | r = dssdrv->check_timings(dssdev, &timings); |
228 | } else { | 160 | } else { |
229 | struct omap_video_timings t = {0}; | 161 | struct videomode t = {0}; |
230 | 162 | ||
231 | dssdrv->get_timings(dssdev, &t); | 163 | dssdrv->get_timings(dssdev, &t); |
232 | 164 | ||
233 | if (memcmp(&timings, &t, sizeof(struct omap_video_timings))) | 165 | if (memcmp(&timings, &t, sizeof(struct videomode))) |
234 | r = -EINVAL; | 166 | r = -EINVAL; |
235 | else | 167 | else |
236 | r = 0; | 168 | r = 0; |