aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2014-06-18 07:21:55 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2014-07-04 04:17:58 -0400
commit769dcb114e1ff71af08b9cb2f30656744df8437b (patch)
treebf6536c6c53de244ea3556d3962a2ec24a4d5c54 /drivers/video
parentab0aee9526988a5f254ce58b59dbcb6a2ae42fd6 (diff)
OMAPDSS: HDMI5: add support to set infoframe & HDMI mode
Instead of using hardcoded AVI infoframe, and a custom HDMI/DVI mode selection based in internal videomode tables, add support to set the infoframe and HDMI/DVI mode. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi5.c53
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi5_core.c36
2 files changed, 33 insertions, 56 deletions
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 d46cb13b06bf..83acbf7a8c89 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi5_core.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi5_core.c
@@ -311,7 +311,7 @@ static void hdmi_core_init(struct hdmi_core_vid_config *video_cfg,
311 video_cfg->vblank_osc = 0; /* Always 0 - need to confirm */ 311 video_cfg->vblank_osc = 0; /* Always 0 - need to confirm */
312 video_cfg->vblank = cfg->timings.vsw + 312 video_cfg->vblank = cfg->timings.vsw +
313 cfg->timings.vfp + cfg->timings.vbp; 313 cfg->timings.vfp + cfg->timings.vbp;
314 video_cfg->v_fc_config.cm.mode = cfg->cm.mode; 314 video_cfg->v_fc_config.hdmi_dvi_mode = cfg->hdmi_dvi_mode;
315 video_cfg->v_fc_config.timings.interlace = cfg->timings.interlace; 315 video_cfg->v_fc_config.timings.interlace = cfg->timings.interlace;
316} 316}
317 317
@@ -378,7 +378,7 @@ static void hdmi_core_video_config(struct hdmi_core_data *core,
378 378
379 /* select DVI mode */ 379 /* select DVI mode */
380 REG_FLD_MOD(base, HDMI_CORE_FC_INVIDCONF, 380 REG_FLD_MOD(base, HDMI_CORE_FC_INVIDCONF,
381 cfg->v_fc_config.cm.mode, 3, 3); 381 cfg->v_fc_config.hdmi_dvi_mode, 3, 3);
382} 382}
383 383
384static void hdmi_core_config_video_packetizer(struct hdmi_core_data *core) 384static void hdmi_core_config_video_packetizer(struct hdmi_core_data *core)
@@ -418,9 +418,9 @@ static void hdmi_core_config_video_sampler(struct hdmi_core_data *core)
418 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);
419} 419}
420 420
421static 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)
422{ 423{
423 struct hdmi_avi_infoframe *frame = &core->avi_infoframe;
424 void __iomem *base = core->base; 424 void __iomem *base = core->base;
425 u8 data[HDMI_INFOFRAME_SIZE(AVI)]; 425 u8 data[HDMI_INFOFRAME_SIZE(AVI)];
426 u8 *ptr; 426 u8 *ptr;
@@ -432,6 +432,9 @@ static void hdmi_core_aux_infoframe_avi_config(struct hdmi_core_data *core)
432 432
433 hdmi_avi_infoframe_pack(frame, data, sizeof(data)); 433 hdmi_avi_infoframe_pack(frame, data, sizeof(data));
434 434
435 print_hex_dump_debug("AVI: ", DUMP_PREFIX_NONE, 16, 1, data,
436 HDMI_INFOFRAME_SIZE(AVI), false);
437
435 ptr = data + HDMI_INFOFRAME_HEADER_SIZE; 438 ptr = data + HDMI_INFOFRAME_HEADER_SIZE;
436 439
437 y = (ptr[0] >> 5) & 0x3; 440 y = (ptr[0] >> 5) & 0x3;
@@ -510,10 +513,8 @@ static void hdmi_core_configure_range(struct hdmi_core_data *core)
510 513
511 /* support limited range with 24 bit color depth for now */ 514 /* support limited range with 24 bit color depth for now */
512 csc_coeff = csc_table_deepcolor[0]; 515 csc_coeff = csc_table_deepcolor[0];
513 core->avi_infoframe.quantization_range = HDMI_QUANTIZATION_RANGE_LIMITED;
514 516
515 hdmi_core_csc_config(core, csc_coeff); 517 hdmi_core_csc_config(core, csc_coeff);
516 hdmi_core_aux_infoframe_avi_config(core);
517} 518}
518 519
519static void hdmi_core_enable_video_path(struct hdmi_core_data *core) 520static void hdmi_core_enable_video_path(struct hdmi_core_data *core)
@@ -604,7 +605,6 @@ void hdmi5_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
604 struct omap_video_timings video_timing; 605 struct omap_video_timings video_timing;
605 struct hdmi_video_format video_format; 606 struct hdmi_video_format video_format;
606 struct hdmi_core_vid_config v_core_cfg; 607 struct hdmi_core_vid_config v_core_cfg;
607 struct hdmi_avi_infoframe *avi_infoframe = &core->avi_infoframe;
608 608
609 hdmi_core_mask_interrupts(core); 609 hdmi_core_mask_interrupts(core);
610 610
@@ -621,7 +621,9 @@ void hdmi5_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
621 621
622 hdmi_wp_video_config_interface(wp, &video_timing); 622 hdmi_wp_video_config_interface(wp, &video_timing);
623 623
624 /* support limited range with 24 bit color depth for now */
624 hdmi_core_configure_range(core); 625 hdmi_core_configure_range(core);
626 cfg->infoframe.quantization_range = HDMI_QUANTIZATION_RANGE_LIMITED;
625 627
626 /* 628 /*
627 * configure core video part, set software reset in the core 629 * configure core video part, set software reset in the core
@@ -634,24 +636,8 @@ void hdmi5_configure(struct hdmi_core_data *core, struct hdmi_wp_data *wp,
634 hdmi_core_config_csc(core); 636 hdmi_core_config_csc(core);
635 hdmi_core_config_video_sampler(core); 637 hdmi_core_config_video_sampler(core);
636 638
637 /* 639 if (cfg->hdmi_dvi_mode == HDMI_HDMI)
638 * configure packet info frame video see doc CEA861-D page 65 640 hdmi_core_write_avi_infoframe(core, &cfg->infoframe);
639 */
640 hdmi_avi_infoframe_init(avi_infoframe);
641 avi_infoframe->colorspace = HDMI_COLORSPACE_RGB;
642 avi_infoframe->scan_mode = HDMI_SCAN_MODE_NONE;
643 avi_infoframe->colorimetry = HDMI_COLORIMETRY_NONE;
644 avi_infoframe->picture_aspect = HDMI_PICTURE_ASPECT_NONE;
645 avi_infoframe->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE;
646 avi_infoframe->itc = 0;
647 avi_infoframe->extended_colorimetry = HDMI_EXTENDED_COLORIMETRY_XV_YCC_601;
648 avi_infoframe->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
649 avi_infoframe->nups = HDMI_NUPS_UNKNOWN;
650 avi_infoframe->video_code = cfg->cm.code;
651 avi_infoframe->ycc_quantization_range = HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
652 avi_infoframe->content_type = HDMI_CONTENT_TYPE_NONE;
653 avi_infoframe->pixel_repeat = 0;
654 hdmi_core_aux_infoframe_avi_config(core);
655 641
656 hdmi_core_enable_video_path(core); 642 hdmi_core_enable_video_path(core);
657 643