Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+33 -56
+22 -31
drivers/video/fbdev/omap2/dss/hdmi5.c
··· 299 299 static void hdmi_display_set_timing(struct omap_dss_device *dssdev, 300 300 struct omap_video_timings *timings) 301 301 { 302 - struct hdmi_cm cm; 303 - const struct hdmi_config *t; 304 - 305 302 mutex_lock(&hdmi.lock); 306 303 307 - cm = hdmi_get_code(timings); 308 - hdmi.cfg.cm = cm; 304 + hdmi.cfg.timings = *timings; 309 305 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 - 323 - DSSDBG("using mode: %s, code %d\n", hdmi.cfg.cm.mode == HDMI_DVI ? 324 - "DVI" : "HDMI", hdmi.cfg.cm.code); 306 + dispc_set_tv_pclk(timings->pixelclock); 325 307 326 308 mutex_unlock(&hdmi.lock); 327 309 } ··· 311 329 static void hdmi_display_get_timings(struct omap_dss_device *dssdev, 312 330 struct omap_video_timings *timings) 313 331 { 314 - const struct hdmi_config *cfg; 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)); 332 + *timings = hdmi.cfg.timings; 322 333 } 323 334 324 335 static void hdmi_dump_regs(struct seq_file *s) ··· 516 541 517 542 mutex_lock(&hdmi.lock); 518 543 519 - if (!hdmi_mode_has_audio(hdmi.cfg.cm.mode)) { 544 + if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) { 520 545 r = -EPERM; 521 546 goto err; 522 547 } ··· 554 579 555 580 mutex_lock(&hdmi.lock); 556 581 557 - r = hdmi_mode_has_audio(hdmi.cfg.cm.mode); 582 + r = hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode); 558 583 559 584 mutex_unlock(&hdmi.lock); 560 585 return r; ··· 568 593 569 594 mutex_lock(&hdmi.lock); 570 595 571 - if (!hdmi_mode_has_audio(hdmi.cfg.cm.mode)) { 596 + if (!hdmi_mode_has_audio(hdmi.cfg.hdmi_dvi_mode)) { 572 597 r = -EPERM; 573 598 goto err; 574 599 } ··· 615 640 } 616 641 #endif 617 642 643 + static int hdmi_set_infoframe(struct omap_dss_device *dssdev, 644 + const struct hdmi_avi_infoframe *avi) 645 + { 646 + hdmi.cfg.infoframe = *avi; 647 + return 0; 648 + } 649 + 650 + static int hdmi_set_hdmi_mode(struct omap_dss_device *dssdev, 651 + bool hdmi_mode) 652 + { 653 + hdmi.cfg.hdmi_dvi_mode = hdmi_mode ? HDMI_HDMI : HDMI_DVI; 654 + return 0; 655 + } 656 + 618 657 static const struct omapdss_hdmi_ops hdmi_ops = { 619 658 .connect = hdmi_connect, 620 659 .disconnect = hdmi_disconnect, ··· 641 652 .get_timings = hdmi_display_get_timings, 642 653 643 654 .read_edid = hdmi_read_edid, 655 + .set_infoframe = hdmi_set_infoframe, 656 + .set_hdmi_mode = hdmi_set_hdmi_mode, 644 657 645 658 .audio_enable = hdmi_audio_enable, 646 659 .audio_disable = hdmi_audio_disable,
+11 -25
drivers/video/fbdev/omap2/dss/hdmi5_core.c
··· 311 311 video_cfg->vblank_osc = 0; /* Always 0 - need to confirm */ 312 312 video_cfg->vblank = cfg->timings.vsw + 313 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 315 video_cfg->v_fc_config.timings.interlace = cfg->timings.interlace; 316 316 } 317 317 ··· 378 378 379 379 /* select DVI mode */ 380 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 384 384 static void hdmi_core_config_video_packetizer(struct hdmi_core_data *core) ··· 418 418 REG_FLD_MOD(core->base, HDMI_CORE_TX_INVID0, video_mapping, 4, 0); 419 419 } 420 420 421 - static void hdmi_core_aux_infoframe_avi_config(struct hdmi_core_data *core) 421 + static 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 424 void __iomem *base = core->base; 425 425 u8 data[HDMI_INFOFRAME_SIZE(AVI)]; 426 426 u8 *ptr; ··· 431 431 unsigned yq, cn, pr; 432 432 433 433 hdmi_avi_infoframe_pack(frame, data, sizeof(data)); 434 + 435 + print_hex_dump_debug("AVI: ", DUMP_PREFIX_NONE, 16, 1, data, 436 + HDMI_INFOFRAME_SIZE(AVI), false); 434 437 435 438 ptr = data + HDMI_INFOFRAME_HEADER_SIZE; 436 439 ··· 513 510 514 511 /* support limited range with 24 bit color depth for now */ 515 512 csc_coeff = csc_table_deepcolor[0]; 516 - core->avi_infoframe.quantization_range = HDMI_QUANTIZATION_RANGE_LIMITED; 517 513 518 514 hdmi_core_csc_config(core, csc_coeff); 519 - hdmi_core_aux_infoframe_avi_config(core); 520 515 } 521 516 522 517 static void hdmi_core_enable_video_path(struct hdmi_core_data *core) ··· 605 604 struct omap_video_timings video_timing; 606 605 struct hdmi_video_format video_format; 607 606 struct hdmi_core_vid_config v_core_cfg; 608 - struct hdmi_avi_infoframe *avi_infoframe = &core->avi_infoframe; 609 607 610 608 hdmi_core_mask_interrupts(core); 611 609 ··· 621 621 622 622 hdmi_wp_video_config_interface(wp, &video_timing); 623 623 624 + /* support limited range with 24 bit color depth for now */ 624 625 hdmi_core_configure_range(core); 626 + cfg->infoframe.quantization_range = HDMI_QUANTIZATION_RANGE_LIMITED; 625 627 626 628 /* 627 629 * configure core video part, set software reset in the core ··· 636 634 hdmi_core_config_csc(core); 637 635 hdmi_core_config_video_sampler(core); 638 636 639 - /* 640 - * configure packet info frame video see doc CEA861-D page 65 641 - */ 642 - hdmi_avi_infoframe_init(avi_infoframe); 643 - avi_infoframe->colorspace = HDMI_COLORSPACE_RGB; 644 - avi_infoframe->scan_mode = HDMI_SCAN_MODE_NONE; 645 - avi_infoframe->colorimetry = HDMI_COLORIMETRY_NONE; 646 - avi_infoframe->picture_aspect = HDMI_PICTURE_ASPECT_NONE; 647 - avi_infoframe->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE; 648 - avi_infoframe->itc = 0; 649 - avi_infoframe->extended_colorimetry = HDMI_EXTENDED_COLORIMETRY_XV_YCC_601; 650 - avi_infoframe->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT; 651 - avi_infoframe->nups = HDMI_NUPS_UNKNOWN; 652 - avi_infoframe->video_code = cfg->cm.code; 653 - avi_infoframe->ycc_quantization_range = HDMI_YCC_QUANTIZATION_RANGE_LIMITED; 654 - avi_infoframe->content_type = HDMI_CONTENT_TYPE_NONE; 655 - avi_infoframe->pixel_repeat = 0; 656 - hdmi_core_aux_infoframe_avi_config(core); 637 + if (cfg->hdmi_dvi_mode == HDMI_HDMI) 638 + hdmi_core_write_avi_infoframe(core, &cfg->infoframe); 657 639 658 640 hdmi_core_enable_video_path(core); 659 641