aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2014-08-04 02:50:07 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-08-04 02:50:07 -0400
commitbe92abea827b82957450dd4ac7f997d5e8173d60 (patch)
treefe05bea2ddf737b31ef9dcda81041387b870a65b /drivers/video
parent3686fe964285a9a0c25265f37ada117d47614f1e (diff)
parent4f930c0f273967b41f46ca84927ac0256bab4649 (diff)
Merge branch '3.17/hdmi-infoframe' into for-next
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/omap2/displays-new/connector-hdmi.c19
-rw-r--r--drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c20
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c5
-rw-r--r--drivers/video/fbdev/omap2/dss/Kconfig1
-rw-r--r--drivers/video/fbdev/omap2/dss/dispc.c22
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi.h107
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi4.c53
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi4_core.c164
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi4_core.h1
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi5.c53
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi5_core.c124
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi_common.c316
12 files changed, 193 insertions, 692 deletions
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
index 4420ccb69aa9..131c6e260898 100644
--- a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
+++ b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c
@@ -262,6 +262,23 @@ static int hdmic_audio_config(struct omap_dss_device *dssdev,
262 return 0; 262 return 0;
263} 263}
264 264
265static int hdmic_set_hdmi_mode(struct omap_dss_device *dssdev, bool hdmi_mode)
266{
267 struct panel_drv_data *ddata = to_panel_data(dssdev);
268 struct omap_dss_device *in = ddata->in;
269
270 return in->ops.hdmi->set_hdmi_mode(in, hdmi_mode);
271}
272
273static int hdmic_set_infoframe(struct omap_dss_device *dssdev,
274 const struct hdmi_avi_infoframe *avi)
275{
276 struct panel_drv_data *ddata = to_panel_data(dssdev);
277 struct omap_dss_device *in = ddata->in;
278
279 return in->ops.hdmi->set_infoframe(in, avi);
280}
281
265static struct omap_dss_driver hdmic_driver = { 282static struct omap_dss_driver hdmic_driver = {
266 .connect = hdmic_connect, 283 .connect = hdmic_connect,
267 .disconnect = hdmic_disconnect, 284 .disconnect = hdmic_disconnect,
@@ -277,6 +294,8 @@ static struct omap_dss_driver hdmic_driver = {
277 294
278 .read_edid = hdmic_read_edid, 295 .read_edid = hdmic_read_edid,
279 .detect = hdmic_detect, 296 .detect = hdmic_detect,
297 .set_hdmi_mode = hdmic_set_hdmi_mode,
298 .set_hdmi_infoframe = hdmic_set_infoframe,
280 299
281 .audio_enable = hdmic_audio_enable, 300 .audio_enable = hdmic_audio_enable,
282 .audio_disable = hdmic_audio_disable, 301 .audio_disable = hdmic_audio_disable,
diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
index 7e33686171e3..c891d8f84cb2 100644
--- a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
+++ b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
@@ -242,6 +242,24 @@ static int tpd_audio_config(struct omap_dss_device *dssdev,
242 return in->ops.hdmi->audio_config(in, audio); 242 return in->ops.hdmi->audio_config(in, audio);
243} 243}
244 244
245static int tpd_set_infoframe(struct omap_dss_device *dssdev,
246 const struct hdmi_avi_infoframe *avi)
247{
248 struct panel_drv_data *ddata = to_panel_data(dssdev);
249 struct omap_dss_device *in = ddata->in;
250
251 return in->ops.hdmi->set_infoframe(in, avi);
252}
253
254static int tpd_set_hdmi_mode(struct omap_dss_device *dssdev,
255 bool hdmi_mode)
256{
257 struct panel_drv_data *ddata = to_panel_data(dssdev);
258 struct omap_dss_device *in = ddata->in;
259
260 return in->ops.hdmi->set_hdmi_mode(in, hdmi_mode);
261}
262
245static const struct omapdss_hdmi_ops tpd_hdmi_ops = { 263static const struct omapdss_hdmi_ops tpd_hdmi_ops = {
246 .connect = tpd_connect, 264 .connect = tpd_connect,
247 .disconnect = tpd_disconnect, 265 .disconnect = tpd_disconnect,
@@ -255,6 +273,8 @@ static const struct omapdss_hdmi_ops tpd_hdmi_ops = {
255 273
256 .read_edid = tpd_read_edid, 274 .read_edid = tpd_read_edid,
257 .detect = tpd_detect, 275 .detect = tpd_detect,
276 .set_infoframe = tpd_set_infoframe,
277 .set_hdmi_mode = tpd_set_hdmi_mode,
258 278
259 .audio_enable = tpd_audio_enable, 279 .audio_enable = tpd_audio_enable,
260 .audio_disable = tpd_audio_disable, 280 .audio_disable = tpd_audio_disable,
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
index c7ba4d8b928a..617f8d2f5127 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
@@ -817,6 +817,10 @@ static int acx565akm_probe(struct spi_device *spi)
817 817
818 bldev = backlight_device_register("acx565akm", &ddata->spi->dev, 818 bldev = backlight_device_register("acx565akm", &ddata->spi->dev,
819 ddata, &acx565akm_bl_ops, &props); 819 ddata, &acx565akm_bl_ops, &props);
820 if (IS_ERR(bldev)) {
821 r = PTR_ERR(bldev);
822 goto err_reg_bl;
823 }
820 ddata->bl_dev = bldev; 824 ddata->bl_dev = bldev;
821 if (ddata->has_cabc) { 825 if (ddata->has_cabc) {
822 r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group); 826 r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group);
@@ -862,6 +866,7 @@ err_reg:
862 sysfs_remove_group(&bldev->dev.kobj, &bldev_attr_group); 866 sysfs_remove_group(&bldev->dev.kobj, &bldev_attr_group);
863err_sysfs: 867err_sysfs:
864 backlight_device_unregister(bldev); 868 backlight_device_unregister(bldev);
869err_reg_bl:
865err_detect: 870err_detect:
866err_gpio: 871err_gpio:
867 omap_dss_put_device(ddata->in); 872 omap_dss_put_device(ddata->in);
diff --git a/drivers/video/fbdev/omap2/dss/Kconfig b/drivers/video/fbdev/omap2/dss/Kconfig
index 285bcd103dce..3d5eb6c36c22 100644
--- a/drivers/video/fbdev/omap2/dss/Kconfig
+++ b/drivers/video/fbdev/omap2/dss/Kconfig
@@ -5,6 +5,7 @@ menuconfig OMAP2_DSS
5 tristate "OMAP2+ Display Subsystem support" 5 tristate "OMAP2+ Display Subsystem support"
6 select VIDEOMODE_HELPERS 6 select VIDEOMODE_HELPERS
7 select OMAP2_DSS_INIT 7 select OMAP2_DSS_INIT
8 select HDMI
8 help 9 help
9 OMAP2+ Display Subsystem support. 10 OMAP2+ Display Subsystem support.
10 11
diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c
index 7aa33b0f4a1f..be053aa80880 100644
--- a/drivers/video/fbdev/omap2/dss/dispc.c
+++ b/drivers/video/fbdev/omap2/dss/dispc.c
@@ -2879,19 +2879,24 @@ static bool _dispc_mgr_pclk_ok(enum omap_channel channel,
2879bool dispc_mgr_timings_ok(enum omap_channel channel, 2879bool dispc_mgr_timings_ok(enum omap_channel channel,
2880 const struct omap_video_timings *timings) 2880 const struct omap_video_timings *timings)
2881{ 2881{
2882 bool timings_ok; 2882 if (!_dispc_mgr_size_ok(timings->x_res, timings->y_res))
2883 2883 return false;
2884 timings_ok = _dispc_mgr_size_ok(timings->x_res, timings->y_res);
2885 2884
2886 timings_ok &= _dispc_mgr_pclk_ok(channel, timings->pixelclock); 2885 if (!_dispc_mgr_pclk_ok(channel, timings->pixelclock))
2886 return false;
2887 2887
2888 if (dss_mgr_is_lcd(channel)) { 2888 if (dss_mgr_is_lcd(channel)) {
2889 timings_ok &= _dispc_lcd_timings_ok(timings->hsw, timings->hfp, 2889 /* TODO: OMAP4+ supports interlace for LCD outputs */
2890 if (timings->interlace)
2891 return false;
2892
2893 if (!_dispc_lcd_timings_ok(timings->hsw, timings->hfp,
2890 timings->hbp, timings->vsw, timings->vfp, 2894 timings->hbp, timings->vsw, timings->vfp,
2891 timings->vbp); 2895 timings->vbp))
2896 return false;
2892 } 2897 }
2893 2898
2894 return timings_ok; 2899 return true;
2895} 2900}
2896 2901
2897static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw, 2902static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw,
@@ -3257,13 +3262,10 @@ static void dispc_dump_regs(struct seq_file *s)
3257 if (i == OMAP_DSS_CHANNEL_DIGIT) 3262 if (i == OMAP_DSS_CHANNEL_DIGIT)
3258 continue; 3263 continue;
3259 3264
3260 DUMPREG(i, DISPC_DEFAULT_COLOR);
3261 DUMPREG(i, DISPC_TRANS_COLOR);
3262 DUMPREG(i, DISPC_TIMING_H); 3265 DUMPREG(i, DISPC_TIMING_H);
3263 DUMPREG(i, DISPC_TIMING_V); 3266 DUMPREG(i, DISPC_TIMING_V);
3264 DUMPREG(i, DISPC_POL_FREQ); 3267 DUMPREG(i, DISPC_POL_FREQ);
3265 DUMPREG(i, DISPC_DIVISORo); 3268 DUMPREG(i, DISPC_DIVISORo);
3266 DUMPREG(i, DISPC_SIZE_MGR);
3267 3269
3268 DUMPREG(i, DISPC_DATA_CYCLE1); 3270 DUMPREG(i, DISPC_DATA_CYCLE1);
3269 DUMPREG(i, DISPC_DATA_CYCLE2); 3271 DUMPREG(i, DISPC_DATA_CYCLE2);
diff --git a/drivers/video/fbdev/omap2/dss/hdmi.h b/drivers/video/fbdev/omap2/dss/hdmi.h
index fbee07816337..262771b9b76b 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi.h
@@ -22,6 +22,7 @@
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/hdmi.h>
25#include <video/omapdss.h> 26#include <video/omapdss.h>
26 27
27#include "dss.h" 28#include "dss.h"
@@ -142,7 +143,7 @@ enum hdmi_audio_samples_perword {
142 HDMI_AUDIO_ONEWORD_TWOSAMPLES = 1 143 HDMI_AUDIO_ONEWORD_TWOSAMPLES = 1
143}; 144};
144 145
145enum hdmi_audio_sample_size { 146enum hdmi_audio_sample_size_omap {
146 HDMI_AUDIO_SAMPLE_16BITS = 0, 147 HDMI_AUDIO_SAMPLE_16BITS = 0,
147 HDMI_AUDIO_SAMPLE_24BITS = 1 148 HDMI_AUDIO_SAMPLE_24BITS = 1
148}; 149};
@@ -178,59 +179,6 @@ enum hdmi_audio_mclk_mode {
178 HDMI_AUDIO_MCLK_192FS = 7 179 HDMI_AUDIO_MCLK_192FS = 7
179}; 180};
180 181
181/* INFOFRAME_AVI_ and INFOFRAME_AUDIO_ definitions */
182enum hdmi_core_infoframe {
183 HDMI_INFOFRAME_AVI_DB1Y_RGB = 0,
184 HDMI_INFOFRAME_AVI_DB1Y_YUV422 = 1,
185 HDMI_INFOFRAME_AVI_DB1Y_YUV444 = 2,
186 HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_OFF = 0,
187 HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_ON = 1,
188 HDMI_INFOFRAME_AVI_DB1B_NO = 0,
189 HDMI_INFOFRAME_AVI_DB1B_VERT = 1,
190 HDMI_INFOFRAME_AVI_DB1B_HORI = 2,
191 HDMI_INFOFRAME_AVI_DB1B_VERTHORI = 3,
192 HDMI_INFOFRAME_AVI_DB1S_0 = 0,
193 HDMI_INFOFRAME_AVI_DB1S_1 = 1,
194 HDMI_INFOFRAME_AVI_DB1S_2 = 2,
195 HDMI_INFOFRAME_AVI_DB2C_NO = 0,
196 HDMI_INFOFRAME_AVI_DB2C_ITU601 = 1,
197 HDMI_INFOFRAME_AVI_DB2C_ITU709 = 2,
198 HDMI_INFOFRAME_AVI_DB2C_EC_EXTENDED = 3,
199 HDMI_INFOFRAME_AVI_DB2M_NO = 0,
200 HDMI_INFOFRAME_AVI_DB2M_43 = 1,
201 HDMI_INFOFRAME_AVI_DB2M_169 = 2,
202 HDMI_INFOFRAME_AVI_DB2R_SAME = 8,
203 HDMI_INFOFRAME_AVI_DB2R_43 = 9,
204 HDMI_INFOFRAME_AVI_DB2R_169 = 10,
205 HDMI_INFOFRAME_AVI_DB2R_149 = 11,
206 HDMI_INFOFRAME_AVI_DB3ITC_NO = 0,
207 HDMI_INFOFRAME_AVI_DB3ITC_YES = 1,
208 HDMI_INFOFRAME_AVI_DB3EC_XVYUV601 = 0,
209 HDMI_INFOFRAME_AVI_DB3EC_XVYUV709 = 1,
210 HDMI_INFOFRAME_AVI_DB3Q_DEFAULT = 0,
211 HDMI_INFOFRAME_AVI_DB3Q_LR = 1,
212 HDMI_INFOFRAME_AVI_DB3Q_FR = 2,
213 HDMI_INFOFRAME_AVI_DB3SC_NO = 0,
214 HDMI_INFOFRAME_AVI_DB3SC_HORI = 1,
215 HDMI_INFOFRAME_AVI_DB3SC_VERT = 2,
216 HDMI_INFOFRAME_AVI_DB3SC_HORIVERT = 3,
217 HDMI_INFOFRAME_AVI_DB5PR_NO = 0,
218 HDMI_INFOFRAME_AVI_DB5PR_2 = 1,
219 HDMI_INFOFRAME_AVI_DB5PR_3 = 2,
220 HDMI_INFOFRAME_AVI_DB5PR_4 = 3,
221 HDMI_INFOFRAME_AVI_DB5PR_5 = 4,
222 HDMI_INFOFRAME_AVI_DB5PR_6 = 5,
223 HDMI_INFOFRAME_AVI_DB5PR_7 = 6,
224 HDMI_INFOFRAME_AVI_DB5PR_8 = 7,
225 HDMI_INFOFRAME_AVI_DB5PR_9 = 8,
226 HDMI_INFOFRAME_AVI_DB5PR_10 = 9,
227};
228
229struct hdmi_cm {
230 int code;
231 int mode;
232};
233
234struct hdmi_video_format { 182struct hdmi_video_format {
235 enum hdmi_packing_mode packing_mode; 183 enum hdmi_packing_mode packing_mode;
236 u32 y_res; /* Line per panel */ 184 u32 y_res; /* Line per panel */
@@ -239,7 +187,8 @@ struct hdmi_video_format {
239 187
240struct hdmi_config { 188struct hdmi_config {
241 struct omap_video_timings timings; 189 struct omap_video_timings timings;
242 struct hdmi_cm cm; 190 struct hdmi_avi_infoframe infoframe;
191 enum hdmi_core_hdmi_dvi hdmi_dvi_mode;
243}; 192};
244 193
245/* HDMI PLL structure */ 194/* HDMI PLL structure */
@@ -260,7 +209,7 @@ struct hdmi_audio_format {
260 enum hdmi_audio_justify justification; 209 enum hdmi_audio_justify justification;
261 enum hdmi_audio_sample_order sample_order; 210 enum hdmi_audio_sample_order sample_order;
262 enum hdmi_audio_samples_perword samples_per_word; 211 enum hdmi_audio_samples_perword samples_per_word;
263 enum hdmi_audio_sample_size sample_size; 212 enum hdmi_audio_sample_size_omap sample_size;
264 enum hdmi_audio_blk_strt_end_sig en_sig_blk_strt_end; 213 enum hdmi_audio_blk_strt_end_sig en_sig_blk_strt_end;
265}; 214};
266 215
@@ -298,47 +247,6 @@ struct hdmi_core_audio_config {
298 bool en_spdif; 247 bool en_spdif;
299}; 248};
300 249
301/*
302 * Refer to section 8.2 in HDMI 1.3 specification for
303 * details about infoframe databytes
304 */
305struct hdmi_core_infoframe_avi {
306 /* Y0, Y1 rgb,yCbCr */
307 u8 db1_format;
308 /* A0 Active information Present */
309 u8 db1_active_info;
310 /* B0, B1 Bar info data valid */
311 u8 db1_bar_info_dv;
312 /* S0, S1 scan information */
313 u8 db1_scan_info;
314 /* C0, C1 colorimetry */
315 u8 db2_colorimetry;
316 /* M0, M1 Aspect ratio (4:3, 16:9) */
317 u8 db2_aspect_ratio;
318 /* R0...R3 Active format aspect ratio */
319 u8 db2_active_fmt_ar;
320 /* ITC IT content. */
321 u8 db3_itc;
322 /* EC0, EC1, EC2 Extended colorimetry */
323 u8 db3_ec;
324 /* Q1, Q0 Quantization range */
325 u8 db3_q_range;
326 /* SC1, SC0 Non-uniform picture scaling */
327 u8 db3_nup_scaling;
328 /* VIC0..6 Video format identification */
329 u8 db4_videocode;
330 /* PR0..PR3 Pixel repetition factor */
331 u8 db5_pixel_repeat;
332 /* Line number end of top bar */
333 u16 db6_7_line_eoftop;
334 /* Line number start of bottom bar */
335 u16 db8_9_line_sofbottom;
336 /* Pixel number end of left bar */
337 u16 db10_11_pixel_eofleft;
338 /* Pixel number start of right bar */
339 u16 db12_13_pixel_sofright;
340};
341
342struct hdmi_wp_data { 250struct hdmi_wp_data {
343 void __iomem *base; 251 void __iomem *base;
344}; 252};
@@ -358,8 +266,6 @@ struct hdmi_phy_data {
358 266
359struct hdmi_core_data { 267struct hdmi_core_data {
360 void __iomem *base; 268 void __iomem *base;
361
362 struct hdmi_core_infoframe_avi avi_cfg;
363}; 269};
364 270
365static inline void hdmi_write_reg(void __iomem *base_addr, const u32 idx, 271static inline void hdmi_write_reg(void __iomem *base_addr, const u32 idx,
@@ -425,9 +331,6 @@ int hdmi_phy_init(struct platform_device *pdev, struct hdmi_phy_data *phy);
425int hdmi_phy_parse_lanes(struct hdmi_phy_data *phy, const u32 *lanes); 331int hdmi_phy_parse_lanes(struct hdmi_phy_data *phy, const u32 *lanes);
426 332
427/* HDMI common funcs */ 333/* HDMI common funcs */
428const struct hdmi_config *hdmi_default_timing(void);
429const struct hdmi_config *hdmi_get_timings(int mode, int code);
430struct hdmi_cm hdmi_get_code(struct omap_video_timings *timing);
431int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep, 334int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep,
432 struct hdmi_phy_data *phy); 335 struct hdmi_phy_data *phy);
433 336
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c
index 626aad2bef46..6a8550cf43e5 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4.c
@@ -281,29 +281,11 @@ static int hdmi_display_check_timing(struct omap_dss_device *dssdev,
281static void hdmi_display_set_timing(struct omap_dss_device *dssdev, 281static void hdmi_display_set_timing(struct omap_dss_device *dssdev,
282 struct omap_video_timings *timings) 282 struct omap_video_timings *timings)
283{ 283{
284 struct hdmi_cm cm;
285 const struct hdmi_config *t;
286
287 mutex_lock(&hdmi.lock); 284 mutex_lock(&hdmi.lock);
288 285
289 cm = hdmi_get_code(timings); 286 hdmi.cfg.timings = *timings;
290 hdmi.cfg.cm = cm;
291
292 t = hdmi_get_timings(cm.mode, cm.code);
293 if (t != NULL) {
294 hdmi.cfg = *t;
295
296 dispc_set_tv_pclk(t->timings.pixelclock);
297 } else {
298 hdmi.cfg.timings = *timings;
299 hdmi.cfg.cm.code = 0;
300 hdmi.cfg.cm.mode = HDMI_DVI;
301
302 dispc_set_tv_pclk(timings->pixelclock);
303 }
304 287
305 DSSDBG("using mode: %s, code %d\n", hdmi.cfg.cm.mode == HDMI_DVI ? 288 dispc_set_tv_pclk(timings->pixelclock);
306 "DVI" : "HDMI", hdmi.cfg.cm.code);
307 289
308 mutex_unlock(&hdmi.lock); 290 mutex_unlock(&hdmi.lock);
309} 291}
@@ -311,14 +293,7 @@ static void hdmi_display_set_timing(struct omap_dss_device *dssdev,
311static void hdmi_display_get_timings(struct omap_dss_device *dssdev, 293static void hdmi_display_get_timings(struct omap_dss_device *dssdev,
312 struct omap_video_timings *timings) 294 struct omap_video_timings *timings)
313{ 295{
314 const struct hdmi_config *cfg; 296 *timings = hdmi.cfg.timings;
315 struct hdmi_cm cm = hdmi.cfg.cm;
316
317 cfg = hdmi_get_timings(cm.mode, cm.code);
318 if (cfg == NULL)
319 cfg = hdmi_default_timing();
320
321 memcpy(timings, &cfg->timings, sizeof(cfg->timings));
322} 297}
323 298
324static void hdmi_dump_regs(struct seq_file *s) 299static void hdmi_dump_regs(struct seq_file *s)
@@ -516,7 +491,7 @@ static int hdmi_audio_enable(struct omap_dss_device *dssdev)
516 491
517 mutex_lock(&hdmi.lock); 492 mutex_lock(&hdmi.lock);
518 493
519 if (!hdmi_mode_has_audio(hdmi.cfg.cm.mode)) { 494 if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
520 r = -EPERM; 495 r = -EPERM;
521 goto err; 496 goto err;
522 } 497 }
@@ -554,7 +529,7 @@ static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
554 529
555 mutex_lock(&hdmi.lock); 530 mutex_lock(&hdmi.lock);
556 531
557 r = hdmi_mode_has_audio(hdmi.cfg.cm.mode); 532 r = hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode);
558 533
559 mutex_unlock(&hdmi.lock); 534 mutex_unlock(&hdmi.lock);
560 return r; 535 return r;
@@ -568,7 +543,7 @@ static int hdmi_audio_config(struct omap_dss_device *dssdev,
568 543
569 mutex_lock(&hdmi.lock); 544 mutex_lock(&hdmi.lock);
570 545
571 if (!hdmi_mode_has_audio(hdmi.cfg.cm.mode)) { 546 if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
572 r = -EPERM; 547 r = -EPERM;
573 goto err; 548 goto err;
574 } 549 }
@@ -615,6 +590,20 @@ static int hdmi_audio_config(struct omap_dss_device *dssdev,
615} 590}
616#endif 591#endif
617 592
593static int hdmi_set_infoframe(struct omap_dss_device *dssdev,
594 const struct hdmi_avi_infoframe *avi)
595{
596 hdmi.cfg.infoframe = *avi;
597 return 0;
598}
599
600static int hdmi_set_hdmi_mode(struct omap_dss_device *dssdev,
601 bool hdmi_mode)
602{
603 hdmi.cfg.hdmi_dvi_mode = hdmi_mode ? HDMI_HDMI : HDMI_DVI;
604 return 0;
605}
606
618static const struct omapdss_hdmi_ops hdmi_ops = { 607static const struct omapdss_hdmi_ops hdmi_ops = {
619 .connect = hdmi_connect, 608 .connect = hdmi_connect,
620 .disconnect = hdmi_disconnect, 609 .disconnect = hdmi_disconnect,
@@ -627,6 +616,8 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
627 .get_timings = hdmi_display_get_timings, 616 .get_timings = hdmi_display_get_timings,
628 617
629 .read_edid = hdmi_read_edid, 618 .read_edid = hdmi_read_edid,
619 .set_infoframe = hdmi_set_infoframe,
620 .set_hdmi_mode = hdmi_set_hdmi_mode,
630 621
631 .audio_enable = hdmi_audio_enable, 622 .audio_enable = hdmi_audio_enable,
632 .audio_disable = hdmi_audio_disable, 623 .audio_disable = hdmi_audio_disable,
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.c b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
index 8bde7b7e95ff..4ad39cfce254 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.c
@@ -197,9 +197,7 @@ int hdmi4_read_edid(struct hdmi_core_data *core, u8 *edid, int len)
197 return l; 197 return l;
198} 198}
199 199
200static void hdmi_core_init(struct hdmi_core_video_config *video_cfg, 200static void hdmi_core_init(struct hdmi_core_video_config *video_cfg)
201 struct hdmi_core_infoframe_avi *avi_cfg,
202 struct hdmi_core_packet_enable_repeat *repeat_cfg)
203{ 201{
204 DSSDBG("Enter hdmi_core_init\n"); 202 DSSDBG("Enter hdmi_core_init\n");
205 203
@@ -210,35 +208,6 @@ static void hdmi_core_init(struct hdmi_core_video_config *video_cfg,
210 video_cfg->pkt_mode = HDMI_PACKETMODERESERVEDVALUE; 208 video_cfg->pkt_mode = HDMI_PACKETMODERESERVEDVALUE;
211 video_cfg->hdmi_dvi = HDMI_DVI; 209 video_cfg->hdmi_dvi = HDMI_DVI;
212 video_cfg->tclk_sel_clkmult = HDMI_FPLL10IDCK; 210 video_cfg->tclk_sel_clkmult = HDMI_FPLL10IDCK;
213
214 /* info frame */
215 avi_cfg->db1_format = 0;
216 avi_cfg->db1_active_info = 0;
217 avi_cfg->db1_bar_info_dv = 0;
218 avi_cfg->db1_scan_info = 0;
219 avi_cfg->db2_colorimetry = 0;
220 avi_cfg->db2_aspect_ratio = 0;
221 avi_cfg->db2_active_fmt_ar = 0;
222 avi_cfg->db3_itc = 0;
223 avi_cfg->db3_ec = 0;
224 avi_cfg->db3_q_range = 0;
225 avi_cfg->db3_nup_scaling = 0;
226 avi_cfg->db4_videocode = 0;
227 avi_cfg->db5_pixel_repeat = 0;
228 avi_cfg->db6_7_line_eoftop = 0;
229 avi_cfg->db8_9_line_sofbottom = 0;
230 avi_cfg->db10_11_pixel_eofleft = 0;
231 avi_cfg->db12_13_pixel_sofright = 0;
232
233 /* packet enable and repeat */
234 repeat_cfg->audio_pkt = 0;
235 repeat_cfg->audio_pkt_repeat = 0;
236 repeat_cfg->avi_infoframe = 0;
237 repeat_cfg->avi_infoframe_repeat = 0;
238 repeat_cfg->gen_cntrl_pkt = 0;
239 repeat_cfg->gen_cntrl_pkt_repeat = 0;
240 repeat_cfg->generic_pkt = 0;
241 repeat_cfg->generic_pkt_repeat = 0;
242} 211}
243 212
244static void hdmi_core_powerdown_disable(struct hdmi_core_data *core) 213static void hdmi_core_powerdown_disable(struct hdmi_core_data *core)
@@ -303,80 +272,22 @@ static void hdmi_core_video_config(struct hdmi_core_data *core,
303 HDMI_CORE_SYS_TMDS_CTRL, cfg->tclk_sel_clkmult, 6, 5); 272 HDMI_CORE_SYS_TMDS_CTRL, cfg->tclk_sel_clkmult, 6, 5);
304} 273}
305 274
306static void hdmi_core_aux_infoframe_avi_config(struct hdmi_core_data *core) 275static void hdmi_core_write_avi_infoframe(struct hdmi_core_data *core,
276 struct hdmi_avi_infoframe *frame)
307{ 277{
308 u32 val;
309 char sum = 0, checksum = 0;
310 void __iomem *av_base = hdmi_av_base(core); 278 void __iomem *av_base = hdmi_av_base(core);
311 struct hdmi_core_infoframe_avi info_avi = core->avi_cfg; 279 u8 data[HDMI_INFOFRAME_SIZE(AVI)];
312 280 int i;
313 sum += 0x82 + 0x002 + 0x00D;
314 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_TYPE, 0x082);
315 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_VERS, 0x002);
316 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_LEN, 0x00D);
317
318 val = (info_avi.db1_format << 5) |
319 (info_avi.db1_active_info << 4) |
320 (info_avi.db1_bar_info_dv << 2) |
321 (info_avi.db1_scan_info);
322 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(0), val);
323 sum += val;
324
325 val = (info_avi.db2_colorimetry << 6) |
326 (info_avi.db2_aspect_ratio << 4) |
327 (info_avi.db2_active_fmt_ar);
328 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(1), val);
329 sum += val;
330
331 val = (info_avi.db3_itc << 7) |
332 (info_avi.db3_ec << 4) |
333 (info_avi.db3_q_range << 2) |
334 (info_avi.db3_nup_scaling);
335 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(2), val);
336 sum += val;
337
338 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(3),
339 info_avi.db4_videocode);
340 sum += info_avi.db4_videocode;
341
342 val = info_avi.db5_pixel_repeat;
343 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(4), val);
344 sum += val;
345
346 val = info_avi.db6_7_line_eoftop & 0x00FF;
347 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(5), val);
348 sum += val;
349
350 val = ((info_avi.db6_7_line_eoftop >> 8) & 0x00FF);
351 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(6), val);
352 sum += val;
353
354 val = info_avi.db8_9_line_sofbottom & 0x00FF;
355 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(7), val);
356 sum += val;
357
358 val = ((info_avi.db8_9_line_sofbottom >> 8) & 0x00FF);
359 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(8), val);
360 sum += val;
361
362 val = info_avi.db10_11_pixel_eofleft & 0x00FF;
363 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(9), val);
364 sum += val;
365
366 val = ((info_avi.db10_11_pixel_eofleft >> 8) & 0x00FF);
367 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(10), val);
368 sum += val;
369
370 val = info_avi.db12_13_pixel_sofright & 0x00FF;
371 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(11), val);
372 sum += val;
373
374 val = ((info_avi.db12_13_pixel_sofright >> 8) & 0x00FF);
375 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_DBYTE(12), val);
376 sum += val;
377 281
378 checksum = 0x100 - sum; 282 hdmi_avi_infoframe_pack(frame, data, sizeof(data));
379 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_CHSUM, checksum); 283
284 print_hex_dump_debug("AVI: ", DUMP_PREFIX_NONE, 16, 1, data,
285 HDMI_INFOFRAME_SIZE(AVI), false);
286
287 for (i = 0; i < sizeof(data); ++i) {
288 hdmi_write_reg(av_base, HDMI_CORE_AV_AVI_BASE + i * 4,
289 data[i]);
290 }
380} 291}
381 292
382static void hdmi_core_av_packet_config(struct hdmi_core_data *core, 293static void hdmi_core_av_packet_config(struct hdmi_core_data *core,
@@ -404,11 +315,10 @@ void hdmi4_configure(struct hdmi_core_data *core,
404 struct omap_video_timings video_timing; 315 struct omap_video_timings video_timing;
405 struct hdmi_video_format video_format; 316 struct hdmi_video_format video_format;
406 /* HDMI core */ 317 /* HDMI core */
407 struct hdmi_core_infoframe_avi *avi_cfg = &core->avi_cfg;
408 struct hdmi_core_video_config v_core_cfg; 318 struct hdmi_core_video_config v_core_cfg;
409 struct hdmi_core_packet_enable_repeat repeat_cfg; 319 struct hdmi_core_packet_enable_repeat repeat_cfg = { 0 };
410 320
411 hdmi_core_init(&v_core_cfg, avi_cfg, &repeat_cfg); 321 hdmi_core_init(&v_core_cfg);
412 322
413 hdmi_wp_init_vid_fmt_timings(&video_format, &video_timing, cfg); 323 hdmi_wp_init_vid_fmt_timings(&video_format, &video_timing, cfg);
414 324
@@ -431,44 +341,24 @@ void hdmi4_configure(struct hdmi_core_data *core,
431 hdmi_core_powerdown_disable(core); 341 hdmi_core_powerdown_disable(core);
432 342
433 v_core_cfg.pkt_mode = HDMI_PACKETMODE24BITPERPIXEL; 343 v_core_cfg.pkt_mode = HDMI_PACKETMODE24BITPERPIXEL;
434 v_core_cfg.hdmi_dvi = cfg->cm.mode; 344 v_core_cfg.hdmi_dvi = cfg->hdmi_dvi_mode;
435 345
436 hdmi_core_video_config(core, &v_core_cfg); 346 hdmi_core_video_config(core, &v_core_cfg);
437 347
438 /* release software reset in the core */ 348 /* release software reset in the core */
439 hdmi_core_swreset_release(core); 349 hdmi_core_swreset_release(core);
440 350
441 /* 351 if (cfg->hdmi_dvi_mode == HDMI_HDMI) {
442 * configure packet 352 hdmi_core_write_avi_infoframe(core, &cfg->infoframe);
443 * info frame video see doc CEA861-D page 65 353
444 */ 354 /* enable/repeat the infoframe */
445 avi_cfg->db1_format = HDMI_INFOFRAME_AVI_DB1Y_RGB; 355 repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
446 avi_cfg->db1_active_info = 356 repeat_cfg.avi_infoframe_repeat = HDMI_PACKETREPEATON;
447 HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_OFF; 357 /* wakeup */
448 avi_cfg->db1_bar_info_dv = HDMI_INFOFRAME_AVI_DB1B_NO; 358 repeat_cfg.audio_pkt = HDMI_PACKETENABLE;
449 avi_cfg->db1_scan_info = HDMI_INFOFRAME_AVI_DB1S_0; 359 repeat_cfg.audio_pkt_repeat = HDMI_PACKETREPEATON;
450 avi_cfg->db2_colorimetry = HDMI_INFOFRAME_AVI_DB2C_NO; 360 }
451 avi_cfg->db2_aspect_ratio = HDMI_INFOFRAME_AVI_DB2M_NO;
452 avi_cfg->db2_active_fmt_ar = HDMI_INFOFRAME_AVI_DB2R_SAME;
453 avi_cfg->db3_itc = HDMI_INFOFRAME_AVI_DB3ITC_NO;
454 avi_cfg->db3_ec = HDMI_INFOFRAME_AVI_DB3EC_XVYUV601;
455 avi_cfg->db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_DEFAULT;
456 avi_cfg->db3_nup_scaling = HDMI_INFOFRAME_AVI_DB3SC_NO;
457 avi_cfg->db4_videocode = cfg->cm.code;
458 avi_cfg->db5_pixel_repeat = HDMI_INFOFRAME_AVI_DB5PR_NO;
459 avi_cfg->db6_7_line_eoftop = 0;
460 avi_cfg->db8_9_line_sofbottom = 0;
461 avi_cfg->db10_11_pixel_eofleft = 0;
462 avi_cfg->db12_13_pixel_sofright = 0;
463
464 hdmi_core_aux_infoframe_avi_config(core);
465 361
466 /* enable/repeat the infoframe */
467 repeat_cfg.avi_infoframe = HDMI_PACKETENABLE;
468 repeat_cfg.avi_infoframe_repeat = HDMI_PACKETREPEATON;
469 /* wakeup */
470 repeat_cfg.audio_pkt = HDMI_PACKETENABLE;
471 repeat_cfg.audio_pkt_repeat = HDMI_PACKETREPEATON;
472 hdmi_core_av_packet_config(core, repeat_cfg); 362 hdmi_core_av_packet_config(core, repeat_cfg);
473} 363}
474 364
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4_core.h b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
index bb646896fa82..827909eb6c50 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi4_core.h
+++ b/drivers/video/fbdev/omap2/dss/hdmi4_core.h
@@ -145,6 +145,7 @@
145#define HDMI_CORE_AV_DPD 0xF4 145#define HDMI_CORE_AV_DPD 0xF4
146#define HDMI_CORE_AV_PB_CTRL1 0xF8 146#define HDMI_CORE_AV_PB_CTRL1 0xF8
147#define HDMI_CORE_AV_PB_CTRL2 0xFC 147#define HDMI_CORE_AV_PB_CTRL2 0xFC
148#define HDMI_CORE_AV_AVI_BASE 0x100
148#define HDMI_CORE_AV_AVI_TYPE 0x100 149#define HDMI_CORE_AV_AVI_TYPE 0x100
149#define HDMI_CORE_AV_AVI_VERS 0x104 150#define HDMI_CORE_AV_AVI_VERS 0x104
150#define HDMI_CORE_AV_AVI_LEN 0x108 151#define HDMI_CORE_AV_AVI_LEN 0x108
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c
index c468b9e1f295..32d02ec34d23 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5.c
@@ -299,29 +299,11 @@ static int hdmi_display_check_timing(struct omap_dss_device *dssdev,
299static void hdmi_display_set_timing(struct omap_dss_device *dssdev, 299static void hdmi_display_set_timing(struct omap_dss_device *dssdev,
300 struct omap_video_timings *timings) 300 struct omap_video_timings *timings)
301{ 301{
302 struct hdmi_cm cm;
303 const struct hdmi_config *t;
304
305 mutex_lock(&hdmi.lock); 302 mutex_lock(&hdmi.lock);
306 303
307 cm = hdmi_get_code(timings); 304 hdmi.cfg.timings = *timings;
308 hdmi.cfg.cm = cm;
309
310 t = hdmi_get_timings(cm.mode, cm.code);
311 if (t != NULL) {
312 hdmi.cfg = *t;
313
314 dispc_set_tv_pclk(t->timings.pixelclock);
315 } else {
316 hdmi.cfg.timings = *timings;
317 hdmi.cfg.cm.code = 0;
318 hdmi.cfg.cm.mode = HDMI_DVI;
319
320 dispc_set_tv_pclk(timings->pixelclock);
321 }
322 305
323 DSSDBG("using mode: %s, code %d\n", hdmi.cfg.cm.mode == HDMI_DVI ? 306 dispc_set_tv_pclk(timings->pixelclock);
324 "DVI" : "HDMI", hdmi.cfg.cm.code);
325 307
326 mutex_unlock(&hdmi.lock); 308 mutex_unlock(&hdmi.lock);
327} 309}
@@ -329,14 +311,7 @@ static void hdmi_display_set_timing(struct omap_dss_device *dssdev,
329static void hdmi_display_get_timings(struct omap_dss_device *dssdev, 311static void hdmi_display_get_timings(struct omap_dss_device *dssdev,
330 struct omap_video_timings *timings) 312 struct omap_video_timings *timings)
331{ 313{
332 const struct hdmi_config *cfg; 314 *timings = hdmi.cfg.timings;
333 struct hdmi_cm cm = hdmi.cfg.cm;
334
335 cfg = hdmi_get_timings(cm.mode, cm.code);
336 if (cfg == NULL)
337 cfg = hdmi_default_timing();
338
339 memcpy(timings, &cfg->timings, sizeof(cfg->timings));
340} 315}
341 316
342static void hdmi_dump_regs(struct seq_file *s) 317static void hdmi_dump_regs(struct seq_file *s)
@@ -541,7 +516,7 @@ static int hdmi_audio_enable(struct omap_dss_device *dssdev)
541 516
542 mutex_lock(&hdmi.lock); 517 mutex_lock(&hdmi.lock);
543 518
544 if (!hdmi_mode_has_audio(hdmi.cfg.cm.mode)) { 519 if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
545 r = -EPERM; 520 r = -EPERM;
546 goto err; 521 goto err;
547 } 522 }
@@ -579,7 +554,7 @@ static bool hdmi_audio_supported(struct omap_dss_device *dssdev)
579 554
580 mutex_lock(&hdmi.lock); 555 mutex_lock(&hdmi.lock);
581 556
582 r = hdmi_mode_has_audio(hdmi.cfg.cm.mode); 557 r = hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode);
583 558
584 mutex_unlock(&hdmi.lock); 559 mutex_unlock(&hdmi.lock);
585 return r; 560 return r;
@@ -593,7 +568,7 @@ static int hdmi_audio_config(struct omap_dss_device *dssdev,
593 568
594 mutex_lock(&hdmi.lock); 569 mutex_lock(&hdmi.lock);
595 570
596 if (!hdmi_mode_has_audio(hdmi.cfg.cm.mode)) { 571 if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) {
597 r = -EPERM; 572 r = -EPERM;
598 goto err; 573 goto err;
599 } 574 }
@@ -640,6 +615,20 @@ static int hdmi_audio_config(struct omap_dss_device *dssdev,
640} 615}
641#endif 616#endif
642 617
618static int hdmi_set_infoframe(struct omap_dss_device *dssdev,
619 const struct hdmi_avi_infoframe *avi)
620{
621 hdmi.cfg.infoframe = *avi;
622 return 0;
623}
624
625static int hdmi_set_hdmi_mode(struct omap_dss_device *dssdev,
626 bool hdmi_mode)
627{
628 hdmi.cfg.hdmi_dvi_mode = hdmi_mode ? HDMI_HDMI : HDMI_DVI;
629 return 0;
630}
631
643static const struct omapdss_hdmi_ops hdmi_ops = { 632static const struct omapdss_hdmi_ops hdmi_ops = {
644 .connect = hdmi_connect, 633 .connect = hdmi_connect,
645 .disconnect = hdmi_disconnect, 634 .disconnect = hdmi_disconnect,
@@ -652,6 +641,8 @@ static const struct omapdss_hdmi_ops hdmi_ops = {
652 .get_timings = hdmi_display_get_timings, 641 .get_timings = hdmi_display_get_timings,
653 642
654 .read_edid = hdmi_read_edid, 643 .read_edid = hdmi_read_edid,
644 .set_infoframe = hdmi_set_infoframe,
645 .set_hdmi_mode = hdmi_set_hdmi_mode,
655 646
656 .audio_enable = hdmi_audio_enable, 647 .audio_enable = hdmi_audio_enable,
657 .audio_disable = hdmi_audio_disable, 648 .audio_disable = hdmi_audio_disable,
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5_core.c b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
index 7528c7a42aa5..83acbf7a8c89 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
@@ -290,7 +290,6 @@ void hdmi5_core_dump(struct hdmi_core_data *core, struct seq_file *s)
290} 290}
291 291
292static void hdmi_core_init(struct hdmi_core_vid_config *video_cfg, 292static void hdmi_core_init(struct hdmi_core_vid_config *video_cfg,
293 struct hdmi_core_infoframe_avi *avi_cfg,
294 struct hdmi_config *cfg) 293 struct hdmi_config *cfg)
295{ 294{
296 DSSDBG("hdmi_core_init\n"); 295 DSSDBG("hdmi_core_init\n");
@@ -312,27 +311,8 @@ static void hdmi_core_init(struct hdmi_core_vid_config *video_cfg,
312 video_cfg->vblank_osc = 0; /* Always 0 - need to confirm */ 311 video_cfg->vblank_osc = 0; /* Always 0 - need to confirm */
313 video_cfg->vblank = cfg->timings.vsw + 312 video_cfg->vblank = cfg->timings.vsw +
314 cfg->timings.vfp + cfg->timings.vbp; 313 cfg->timings.vfp + cfg->timings.vbp;
315 video_cfg->v_fc_config.cm.mode = cfg->cm.mode; 314 video_cfg->v_fc_config.hdmi_dvi_mode = cfg->hdmi_dvi_mode;
316 video_cfg->v_fc_config.timings.interlace = cfg->timings.interlace; 315 video_cfg->v_fc_config.timings.interlace = cfg->timings.interlace;
317
318 /* info frame */
319 avi_cfg->db1_format = 0;
320 avi_cfg->db1_active_info = 0;
321 avi_cfg->db1_bar_info_dv = 0;
322 avi_cfg->db1_scan_info = 0;
323 avi_cfg->db2_colorimetry = 0;
324 avi_cfg->db2_aspect_ratio = 0;
325 avi_cfg->db2_active_fmt_ar = 0;
326 avi_cfg->db3_itc = 0;
327 avi_cfg->db3_ec = 0;
328 avi_cfg->db3_q_range = 0;
329 avi_cfg->db3_nup_scaling = 0;
330 avi_cfg->db4_videocode = 0;
331 avi_cfg->db5_pixel_repeat = 0;
332 avi_cfg->db6_7_line_eoftop = 0;
333 avi_cfg->db8_9_line_sofbottom = 0;
334 avi_cfg->db10_11_pixel_eofleft = 0;
335 avi_cfg->db12_13_pixel_sofright = 0;
336} 316}
337 317
338/* DSS_HDMI_CORE_VIDEO_CONFIG */ 318/* DSS_HDMI_CORE_VIDEO_CONFIG */
@@ -398,7 +378,7 @@ static void hdmi_core_video_config(struct hdmi_core_data *core,
398 378
399 /* select DVI mode */ 379 /* select DVI mode */
400 REG_FLD_MOD(base, HDMI_CORE_FC_INVIDCONF, 380 REG_FLD_MOD(base, HDMI_CORE_FC_INVIDCONF,
401 cfg->v_fc_config.cm.mode, 3, 3); 381 cfg->v_fc_config.hdmi_dvi_mode, 3, 3);
402} 382}
403 383
404static void hdmi_core_config_video_packetizer(struct hdmi_core_data *core) 384static void hdmi_core_config_video_packetizer(struct hdmi_core_data *core)
@@ -438,24 +418,60 @@ static void hdmi_core_config_video_sampler(struct hdmi_core_data *core)
438 REG_FLD_MOD(core->base, HDMI_CORE_TX_INVID0, video_mapping, 4, 0); 418 REG_FLD_MOD(core->base, HDMI_CORE_TX_INVID0, video_mapping, 4, 0);
439} 419}
440 420
441static void hdmi_core_aux_infoframe_avi_config(struct hdmi_core_data *core) 421static void hdmi_core_write_avi_infoframe(struct hdmi_core_data *core,
422 struct hdmi_avi_infoframe *frame)
442{ 423{
443 void __iomem *base = core->base; 424 void __iomem *base = core->base;
444 struct hdmi_core_infoframe_avi avi = core->avi_cfg; 425 u8 data[HDMI_INFOFRAME_SIZE(AVI)];
445 426 u8 *ptr;
446 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF0, avi.db1_format, 1, 0); 427 unsigned y, a, b, s;
447 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF0, avi.db1_active_info, 6, 6); 428 unsigned c, m, r;
448 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF0, avi.db1_bar_info_dv, 3, 2); 429 unsigned itc, ec, q, sc;
449 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF0, avi.db1_scan_info, 5, 4); 430 unsigned vic;
450 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF1, avi.db2_colorimetry, 7, 6); 431 unsigned yq, cn, pr;
451 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF1, avi.db2_aspect_ratio, 5, 4); 432
452 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF1, avi.db2_active_fmt_ar, 3, 0); 433 hdmi_avi_infoframe_pack(frame, data, sizeof(data));
453 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF2, avi.db3_itc, 7, 7); 434
454 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF2, avi.db3_ec, 6, 4); 435 print_hex_dump_debug("AVI: ", DUMP_PREFIX_NONE, 16, 1, data,
455 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF2, avi.db3_q_range, 3, 2); 436 HDMI_INFOFRAME_SIZE(AVI), false);
456 REG_FLD_MOD(base, HDMI_CORE_FC_AVICONF2, avi.db3_nup_scaling, 1, 0); 437
457 REG_FLD_MOD(base, HDMI_CORE_FC_AVIVID, avi.db4_videocode, 6, 0); 438 ptr = data + HDMI_INFOFRAME_HEADER_SIZE;
458 REG_FLD_MOD(base, HDMI_CORE_FC_PRCONF, avi.db5_pixel_repeat, 3, 0); 439
440 y = (ptr[0] >> 5) & 0x3;
441 a = (ptr[0] >> 4) & 0x1;
442 b = (ptr[0] >> 2) & 0x3;
443 s = (ptr[0] >> 0) & 0x3;
444
445 c = (ptr[1] >> 6) & 0x3;
446 m = (ptr[1] >> 4) & 0x3;
447 r = (ptr[1] >> 0) & 0x3;
448
449 itc = (ptr[2] >> 7) & 0x1;
450 ec = (ptr[2] >> 4) & 0x7;
451 q = (ptr[2] >> 2) & 0x3;
452 sc = (ptr[2] >> 0) & 0x3;
453
454 vic = ptr[3];
455
456 yq = (ptr[4] >> 6) & 0x3;
457 cn = (ptr[4] >> 4) & 0x3;
458 pr = (ptr[4] >> 0) & 0xf;
459
460 hdmi_write_reg(base, HDMI_CORE_FC_AVICONF0,
461 (a << 6) | (s << 4) | (b << 2) | (y << 0));
462
463 hdmi_write_reg(base, HDMI_CORE_FC_AVICONF1,
464 (c << 6) | (m << 4) | (r << 0));
465
466 hdmi_write_reg(base, HDMI_CORE_FC_AVICONF2,
467 (itc << 7) | (ec << 4) | (q << 2) | (sc << 0));
468
469 hdmi_write_reg(base, HDMI_CORE_FC_AVIVID, vic);
470
471 hdmi_write_reg(base, HDMI_CORE_FC_AVICONF3,
472 (yq << 2) | (cn << 0));
473
474 REG_FLD_MOD(base, HDMI_CORE_FC_PRCONF, pr, 3, 0);
459} 475}
460 476
461static void hdmi_core_csc_config(struct hdmi_core_data *core, 477static void hdmi_core_csc_config(struct hdmi_core_data *core,
@@ -497,10 +513,8 @@ static void hdmi_core_configure_range(struct hdmi_core_data *core)
497 513
498 /* support limited range with 24 bit color depth for now */ 514 /* support limited range with 24 bit color depth for now */
499 csc_coeff = csc_table_deepcolor[0]; 515 csc_coeff = csc_table_deepcolor[0];
500 core->avi_cfg.db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_LR;
501 516
502 hdmi_core_csc_config(core, csc_coeff); 517 hdmi_core_csc_config(core, csc_coeff);
503 hdmi_core_aux_infoframe_avi_config(core);
504} 518}
505 519
506static void hdmi_core_enable_video_path(struct hdmi_core_data *core) 520static void hdmi_core_enable_video_path(struct hdmi_core_data *core)
@@ -591,11 +605,10 @@ void hdmi5_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
591 struct omap_video_timings video_timing; 605 struct omap_video_timings video_timing;
592 struct hdmi_video_format video_format; 606 struct hdmi_video_format video_format;
593 struct hdmi_core_vid_config v_core_cfg; 607 struct hdmi_core_vid_config v_core_cfg;
594 struct hdmi_core_infoframe_avi *avi_cfg = &core->avi_cfg;
595 608
596 hdmi_core_mask_interrupts(core); 609 hdmi_core_mask_interrupts(core);
597 610
598 hdmi_core_init(&v_core_cfg, avi_cfg, cfg); 611 hdmi_core_init(&v_core_cfg, cfg);
599 612
600 hdmi_wp_init_vid_fmt_timings(&video_format, &video_timing, cfg); 613 hdmi_wp_init_vid_fmt_timings(&video_format, &video_timing, cfg);
601 614
@@ -608,7 +621,9 @@ void hdmi5_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
608 621
609 hdmi_wp_video_config_interface(wp, &video_timing); 622 hdmi_wp_video_config_interface(wp, &video_timing);
610 623
624 /* support limited range with 24 bit color depth for now */
611 hdmi_core_configure_range(core); 625 hdmi_core_configure_range(core);
626 cfg->infoframe.quantization_range = HDMI_QUANTIZATION_RANGE_LIMITED;
612 627
613 /* 628 /*
614 * configure core video part, set software reset in the core 629 * configure core video part, set software reset in the core
@@ -621,29 +636,8 @@ void hdmi5_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
621 hdmi_core_config_csc(core); 636 hdmi_core_config_csc(core);
622 hdmi_core_config_video_sampler(core); 637 hdmi_core_config_video_sampler(core);
623 638
624 /* 639 if (cfg->hdmi_dvi_mode == HDMI_HDMI)
625 * configure packet info frame video see doc CEA861-D page 65 640 hdmi_core_write_avi_infoframe(core, &cfg->infoframe);
626 */
627 avi_cfg->db1_format = HDMI_INFOFRAME_AVI_DB1Y_RGB;
628 avi_cfg->db1_active_info =
629 HDMI_INFOFRAME_AVI_DB1A_ACTIVE_FORMAT_OFF;
630 avi_cfg->db1_bar_info_dv = HDMI_INFOFRAME_AVI_DB1B_NO;
631 avi_cfg->db1_scan_info = HDMI_INFOFRAME_AVI_DB1S_0;
632 avi_cfg->db2_colorimetry = HDMI_INFOFRAME_AVI_DB2C_NO;
633 avi_cfg->db2_aspect_ratio = HDMI_INFOFRAME_AVI_DB2M_NO;
634 avi_cfg->db2_active_fmt_ar = HDMI_INFOFRAME_AVI_DB2R_SAME;
635 avi_cfg->db3_itc = HDMI_INFOFRAME_AVI_DB3ITC_NO;
636 avi_cfg->db3_ec = HDMI_INFOFRAME_AVI_DB3EC_XVYUV601;
637 avi_cfg->db3_q_range = HDMI_INFOFRAME_AVI_DB3Q_DEFAULT;
638 avi_cfg->db3_nup_scaling = HDMI_INFOFRAME_AVI_DB3SC_NO;
639 avi_cfg->db4_videocode = cfg->cm.code;
640 avi_cfg->db5_pixel_repeat = HDMI_INFOFRAME_AVI_DB5PR_NO;
641 avi_cfg->db6_7_line_eoftop = 0;
642 avi_cfg->db8_9_line_sofbottom = 0;
643 avi_cfg->db10_11_pixel_eofleft = 0;
644 avi_cfg->db12_13_pixel_sofright = 0;
645
646 hdmi_core_aux_infoframe_avi_config(core);
647 641
648 hdmi_core_enable_video_path(core); 642 hdmi_core_enable_video_path(core);
649 643
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_common.c b/drivers/video/fbdev/omap2/dss/hdmi_common.c
index 9a2c39cf297f..7d5f1039de9f 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_common.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_common.c
@@ -1,18 +1,4 @@
1 1
2/*
3 * Logic for the below structure :
4 * user enters the CEA or VESA timings by specifying the HDMI/DVI code.
5 * There is a correspondence between CEA/VESA timing and code, please
6 * refer to section 6.3 in HDMI 1.3 specification for timing code.
7 *
8 * In the below structure, cea_vesa_timings corresponds to all OMAP4
9 * supported CEA and VESA timing values.code_cea corresponds to the CEA
10 * code, It is used to get the timing from cea_vesa_timing array.Similarly
11 * with code_vesa. Code_index is used for back mapping, that is once EDID
12 * is read from the TV, EDID is parsed to find the timing values and then
13 * map it to corresponding CEA or VESA index.
14 */
15
16#define DSS_SUBSYS_NAME "HDMI" 2#define DSS_SUBSYS_NAME "HDMI"
17 3
18#include <linux/kernel.h> 4#include <linux/kernel.h>
@@ -22,308 +8,6 @@
22 8
23#include "hdmi.h" 9#include "hdmi.h"
24 10
25static const struct hdmi_config cea_timings[] = {
26 {
27 { 640, 480, 25200000, 96, 16, 48, 2, 10, 33,
28 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
29 false, },
30 { 1, HDMI_HDMI },
31 },
32 {
33 { 720, 480, 27027000, 62, 16, 60, 6, 9, 30,
34 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
35 false, },
36 { 2, HDMI_HDMI },
37 },
38 {
39 { 1280, 720, 74250000, 40, 110, 220, 5, 5, 20,
40 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
41 false, },
42 { 4, HDMI_HDMI },
43 },
44 {
45 { 1920, 540, 74250000, 44, 88, 148, 5, 2, 15,
46 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
47 true, },
48 { 5, HDMI_HDMI },
49 },
50 {
51 { 1440, 240, 27027000, 124, 38, 114, 3, 4, 15,
52 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
53 true, },
54 { 6, HDMI_HDMI },
55 },
56 {
57 { 1920, 1080, 148500000, 44, 88, 148, 5, 4, 36,
58 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
59 false, },
60 { 16, HDMI_HDMI },
61 },
62 {
63 { 720, 576, 27000000, 64, 12, 68, 5, 5, 39,
64 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
65 false, },
66 { 17, HDMI_HDMI },
67 },
68 {
69 { 1280, 720, 74250000, 40, 440, 220, 5, 5, 20,
70 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
71 false, },
72 { 19, HDMI_HDMI },
73 },
74 {
75 { 1920, 540, 74250000, 44, 528, 148, 5, 2, 15,
76 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
77 true, },
78 { 20, HDMI_HDMI },
79 },
80 {
81 { 1440, 288, 27000000, 126, 24, 138, 3, 2, 19,
82 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
83 true, },
84 { 21, HDMI_HDMI },
85 },
86 {
87 { 1440, 576, 54000000, 128, 24, 136, 5, 5, 39,
88 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
89 false, },
90 { 29, HDMI_HDMI },
91 },
92 {
93 { 1920, 1080, 148500000, 44, 528, 148, 5, 4, 36,
94 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
95 false, },
96 { 31, HDMI_HDMI },
97 },
98 {
99 { 1920, 1080, 74250000, 44, 638, 148, 5, 4, 36,
100 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
101 false, },
102 { 32, HDMI_HDMI },
103 },
104 {
105 { 2880, 480, 108108000, 248, 64, 240, 6, 9, 30,
106 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
107 false, },
108 { 35, HDMI_HDMI },
109 },
110 {
111 { 2880, 576, 108000000, 256, 48, 272, 5, 5, 39,
112 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
113 false, },
114 { 37, HDMI_HDMI },
115 },
116};
117
118static const struct hdmi_config vesa_timings[] = {
119/* VESA From Here */
120 {
121 { 640, 480, 25175000, 96, 16, 48, 2, 11, 31,
122 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
123 false, },
124 { 4, HDMI_DVI },
125 },
126 {
127 { 800, 600, 40000000, 128, 40, 88, 4, 1, 23,
128 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
129 false, },
130 { 9, HDMI_DVI },
131 },
132 {
133 { 848, 480, 33750000, 112, 16, 112, 8, 6, 23,
134 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
135 false, },
136 { 0xE, HDMI_DVI },
137 },
138 {
139 { 1280, 768, 79500000, 128, 64, 192, 7, 3, 20,
140 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW,
141 false, },
142 { 0x17, HDMI_DVI },
143 },
144 {
145 { 1280, 800, 83500000, 128, 72, 200, 6, 3, 22,
146 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW,
147 false, },
148 { 0x1C, HDMI_DVI },
149 },
150 {
151 { 1360, 768, 85500000, 112, 64, 256, 6, 3, 18,
152 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
153 false, },
154 { 0x27, HDMI_DVI },
155 },
156 {
157 { 1280, 960, 108000000, 112, 96, 312, 3, 1, 36,
158 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
159 false, },
160 { 0x20, HDMI_DVI },
161 },
162 {
163 { 1280, 1024, 108000000, 112, 48, 248, 3, 1, 38,
164 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
165 false, },
166 { 0x23, HDMI_DVI },
167 },
168 {
169 { 1024, 768, 65000000, 136, 24, 160, 6, 3, 29,
170 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_LOW,
171 false, },
172 { 0x10, HDMI_DVI },
173 },
174 {
175 { 1400, 1050, 121750000, 144, 88, 232, 4, 3, 32,
176 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW,
177 false, },
178 { 0x2A, HDMI_DVI },
179 },
180 {
181 { 1440, 900, 106500000, 152, 80, 232, 6, 3, 25,
182 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW,
183 false, },
184 { 0x2F, HDMI_DVI },
185 },
186 {
187 { 1680, 1050, 146250000, 176 , 104, 280, 6, 3, 30,
188 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_LOW,
189 false, },
190 { 0x3A, HDMI_DVI },
191 },
192 {
193 { 1366, 768, 85500000, 143, 70, 213, 3, 3, 24,
194 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
195 false, },
196 { 0x51, HDMI_DVI },
197 },
198 {
199 { 1920, 1080, 148500000, 44, 148, 80, 5, 4, 36,
200 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
201 false, },
202 { 0x52, HDMI_DVI },
203 },
204 {
205 { 1280, 768, 68250000, 32, 48, 80, 7, 3, 12,
206 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH,
207 false, },
208 { 0x16, HDMI_DVI },
209 },
210 {
211 { 1400, 1050, 101000000, 32, 48, 80, 4, 3, 23,
212 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH,
213 false, },
214 { 0x29, HDMI_DVI },
215 },
216 {
217 { 1680, 1050, 119000000, 32, 48, 80, 6, 3, 21,
218 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH,
219 false, },
220 { 0x39, HDMI_DVI },
221 },
222 {
223 { 1280, 800, 79500000, 32, 48, 80, 6, 3, 14,
224 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH,
225 false, },
226 { 0x1B, HDMI_DVI },
227 },
228 {
229 { 1280, 720, 74250000, 40, 110, 220, 5, 5, 20,
230 OMAPDSS_SIG_ACTIVE_HIGH, OMAPDSS_SIG_ACTIVE_HIGH,
231 false, },
232 { 0x55, HDMI_DVI },
233 },
234 {
235 { 1920, 1200, 154000000, 32, 48, 80, 6, 3, 26,
236 OMAPDSS_SIG_ACTIVE_LOW, OMAPDSS_SIG_ACTIVE_HIGH,
237 false, },
238 { 0x44, HDMI_DVI },
239 },
240};
241
242const struct hdmi_config *hdmi_default_timing(void)
243{
244 return &vesa_timings[0];
245}
246
247static const struct hdmi_config *hdmi_find_timing(int code,
248 const struct hdmi_config *timings_arr, int len)
249{
250 int i;
251
252 for (i = 0; i < len; i++) {
253 if (timings_arr[i].cm.code == code)
254 return &timings_arr[i];
255 }
256
257 return NULL;
258}
259
260const struct hdmi_config *hdmi_get_timings(int mode, int code)
261{
262 const struct hdmi_config *arr;
263 int len;
264
265 if (mode == HDMI_DVI) {
266 arr = vesa_timings;
267 len = ARRAY_SIZE(vesa_timings);
268 } else {
269 arr = cea_timings;
270 len = ARRAY_SIZE(cea_timings);
271 }
272
273 return hdmi_find_timing(code, arr, len);
274}
275
276static bool hdmi_timings_compare(struct omap_video_timings *timing1,
277 const struct omap_video_timings *timing2)
278{
279 int timing1_vsync, timing1_hsync, timing2_vsync, timing2_hsync;
280
281 if ((DIV_ROUND_CLOSEST(timing2->pixelclock, 1000000) ==
282 DIV_ROUND_CLOSEST(timing1->pixelclock, 1000000)) &&
283 (timing2->x_res == timing1->x_res) &&
284 (timing2->y_res == timing1->y_res)) {
285
286 timing2_hsync = timing2->hfp + timing2->hsw + timing2->hbp;
287 timing1_hsync = timing1->hfp + timing1->hsw + timing1->hbp;
288 timing2_vsync = timing2->vfp + timing2->vsw + timing2->vbp;
289 timing1_vsync = timing1->vfp + timing1->vsw + timing1->vbp;
290
291 DSSDBG("timing1_hsync = %d timing1_vsync = %d"\
292 "timing2_hsync = %d timing2_vsync = %d\n",
293 timing1_hsync, timing1_vsync,
294 timing2_hsync, timing2_vsync);
295
296 if ((timing1_hsync == timing2_hsync) &&
297 (timing1_vsync == timing2_vsync)) {
298 return true;
299 }
300 }
301 return false;
302}
303
304struct hdmi_cm hdmi_get_code(struct omap_video_timings *timing)
305{
306 int i;
307 struct hdmi_cm cm = {-1};
308 DSSDBG("hdmi_get_code\n");
309
310 for (i = 0; i < ARRAY_SIZE(cea_timings); i++) {
311 if (hdmi_timings_compare(timing, &cea_timings[i].timings)) {
312 cm = cea_timings[i].cm;
313 goto end;
314 }
315 }
316 for (i = 0; i < ARRAY_SIZE(vesa_timings); i++) {
317 if (hdmi_timings_compare(timing, &vesa_timings[i].timings)) {
318 cm = vesa_timings[i].cm;
319 goto end;
320 }
321 }
322
323end:
324 return cm;
325}
326
327int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep, 11int hdmi_parse_lanes_of(struct platform_device *pdev, struct device_node *ep,
328 struct hdmi_phy_data *phy) 12 struct hdmi_phy_data *phy)
329{ 13{