aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/sh_mobile_hdmi.c82
1 files changed, 62 insertions, 20 deletions
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
index 6608429c0fbb..27d76bcf8e07 100644
--- a/drivers/video/sh_mobile_hdmi.c
+++ b/drivers/video/sh_mobile_hdmi.c
@@ -381,21 +381,61 @@ static void sh_hdmi_audio_config(struct sh_hdmi *hdmi)
381} 381}
382 382
383/** 383/**
384 * sh_hdmi_phy_config() 384 * sh_hdmi_phy_config() - configure the HDMI PHY for the used video mode
385 */ 385 */
386static void sh_hdmi_phy_config(struct sh_hdmi *hdmi) 386static void sh_hdmi_phy_config(struct sh_hdmi *hdmi)
387{ 387{
388 /* 720p, 8bit, 74.25MHz. Might need to be adjusted for other formats */ 388 if (hdmi->var.yres > 480) {
389 hdmi_write(hdmi, 0x19, HDMI_SLIPHDMIT_PARAM_SETTINGS_1); 389 /* 720p, 8bit, 74.25MHz. Might need to be adjusted for other formats */
390 hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_2); 390 /*
391 hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_3); 391 * [1:0] Speed_A
392 /* PLLA_CONFIG[7:0]: VCO gain, VCO offset, LPF resistance[0] */ 392 * [3:2] Speed_B
393 hdmi_write(hdmi, 0x44, HDMI_SLIPHDMIT_PARAM_SETTINGS_5); 393 * [4] PLLA_Bypass
394 hdmi_write(hdmi, 0x32, HDMI_SLIPHDMIT_PARAM_SETTINGS_6); 394 * [6] DRV_TEST_EN
395 hdmi_write(hdmi, 0x4A, HDMI_SLIPHDMIT_PARAM_SETTINGS_7); 395 * [7] DRV_TEST_IN
396 hdmi_write(hdmi, 0x0E, HDMI_SLIPHDMIT_PARAM_SETTINGS_8); 396 */
397 hdmi_write(hdmi, 0x25, HDMI_SLIPHDMIT_PARAM_SETTINGS_9); 397 hdmi_write(hdmi, 0x19, HDMI_SLIPHDMIT_PARAM_SETTINGS_1);
398 hdmi_write(hdmi, 0x04, HDMI_SLIPHDMIT_PARAM_SETTINGS_10); 398 /* PLLB_CONFIG[17], PLLA_CONFIG[17] - not in PHY datasheet */
399 hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_2);
400 /*
401 * [2:0] BGR_I_OFFSET
402 * [6:4] BGR_V_OFFSET
403 */
404 hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_3);
405 /* PLLA_CONFIG[7:0]: VCO gain, VCO offset, LPF resistance[0] */
406 hdmi_write(hdmi, 0x44, HDMI_SLIPHDMIT_PARAM_SETTINGS_5);
407 /*
408 * PLLA_CONFIG[15:8]: regulator voltage[0], CP current,
409 * LPF capacitance, LPF resistance[1]
410 */
411 hdmi_write(hdmi, 0x32, HDMI_SLIPHDMIT_PARAM_SETTINGS_6);
412 /* PLLB_CONFIG[7:0]: LPF resistance[0], VCO offset, VCO gain */
413 hdmi_write(hdmi, 0x4A, HDMI_SLIPHDMIT_PARAM_SETTINGS_7);
414 /*
415 * PLLB_CONFIG[15:8]: regulator voltage[0], CP current,
416 * LPF capacitance, LPF resistance[1]
417 */
418 hdmi_write(hdmi, 0x0E, HDMI_SLIPHDMIT_PARAM_SETTINGS_8);
419 /* DRV_CONFIG, PE_CONFIG */
420 hdmi_write(hdmi, 0x25, HDMI_SLIPHDMIT_PARAM_SETTINGS_9);
421 /*
422 * [2:0] AMON_SEL (4 == LPF voltage)
423 * [4] PLLA_CONFIG[16]
424 * [5] PLLB_CONFIG[16]
425 */
426 hdmi_write(hdmi, 0x04, HDMI_SLIPHDMIT_PARAM_SETTINGS_10);
427 } else {
428 /* for 480p8bit 27MHz */
429 hdmi_write(hdmi, 0x19, HDMI_SLIPHDMIT_PARAM_SETTINGS_1);
430 hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_2);
431 hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_3);
432 hdmi_write(hdmi, 0x44, HDMI_SLIPHDMIT_PARAM_SETTINGS_5);
433 hdmi_write(hdmi, 0x32, HDMI_SLIPHDMIT_PARAM_SETTINGS_6);
434 hdmi_write(hdmi, 0x48, HDMI_SLIPHDMIT_PARAM_SETTINGS_7);
435 hdmi_write(hdmi, 0x0F, HDMI_SLIPHDMIT_PARAM_SETTINGS_8);
436 hdmi_write(hdmi, 0x20, HDMI_SLIPHDMIT_PARAM_SETTINGS_9);
437 hdmi_write(hdmi, 0x04, HDMI_SLIPHDMIT_PARAM_SETTINGS_10);
438 }
399} 439}
400 440
401/** 441/**
@@ -403,6 +443,8 @@ static void sh_hdmi_phy_config(struct sh_hdmi *hdmi)
403 */ 443 */
404static void sh_hdmi_avi_infoframe_setup(struct sh_hdmi *hdmi) 444static void sh_hdmi_avi_infoframe_setup(struct sh_hdmi *hdmi)
405{ 445{
446 u8 vic;
447
406 /* AVI InfoFrame */ 448 /* AVI InfoFrame */
407 hdmi_write(hdmi, 0x06, HDMI_CTRL_PKT_BUF_INDEX); 449 hdmi_write(hdmi, 0x06, HDMI_CTRL_PKT_BUF_INDEX);
408 450
@@ -443,9 +485,15 @@ static void sh_hdmi_avi_infoframe_setup(struct sh_hdmi *hdmi)
443 485
444 /* 486 /*
445 * VIC = 1280 x 720p: ignored if external config is used 487 * VIC = 1280 x 720p: ignored if external config is used
446 * Send 2 for 720 x 480p, 16 for 1080p 488 * Send 2 for 720 x 480p, 16 for 1080p, ignored in external mode
447 */ 489 */
448 hdmi_write(hdmi, 4, HDMI_CTRL_PKT_BUF_ACCESS_PB4); 490 if (hdmi->var.yres == 1080 && hdmi->var.xres == 1920)
491 vic = 16;
492 else if (hdmi->var.yres == 480 && hdmi->var.xres == 720)
493 vic = 2;
494 else
495 vic = 4;
496 hdmi_write(hdmi, vic, HDMI_CTRL_PKT_BUF_ACCESS_PB4);
449 497
450 /* PR = No Repetition */ 498 /* PR = No Repetition */
451 hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB5); 499 hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB5);
@@ -666,12 +714,6 @@ static void hdmi_display_on(void *arg, struct fb_info *info)
666 struct sh_hdmi *hdmi = arg; 714 struct sh_hdmi *hdmi = arg;
667 struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data; 715 struct sh_mobile_hdmi_info *pdata = hdmi->dev->platform_data;
668 716
669 if (info->var.xres != 1280 || info->var.yres != 720) {
670 dev_warn(info->device, "Unsupported framebuffer geometry %ux%u\n",
671 info->var.xres, info->var.yres);
672 return;
673 }
674
675 pr_debug("%s(%p): state %x\n", __func__, pdata->lcd_dev, info->state); 717 pr_debug("%s(%p): state %x\n", __func__, pdata->lcd_dev, info->state);
676 /* 718 /*
677 * FIXME: not a good place to store fb_info. And we cannot nullify it 719 * FIXME: not a good place to store fb_info. And we cannot nullify it