aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sh_mobile_hdmi.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2010-11-04 07:06:17 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-11-10 03:29:27 -0500
commit0ea2af1c15b730dba9ce741420352d298bcd7862 (patch)
treef57691cb1b208d44369b0c72c465b72d07990fd4 /drivers/video/sh_mobile_hdmi.c
parentd2ecbab5960d9814a269d36723647d6ef391ba8f (diff)
fbdev: sh_mobile_hdmi: add support for 1080p modes
Add support for 3 more preprogrammed video modes: 1080p at 24, 50, and 60Hz. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/video/sh_mobile_hdmi.c')
-rw-r--r--drivers/video/sh_mobile_hdmi.c57
1 files changed, 36 insertions, 21 deletions
diff --git a/drivers/video/sh_mobile_hdmi.c b/drivers/video/sh_mobile_hdmi.c
index 3adffe6acafc..8338bd4d277e 100644
--- a/drivers/video/sh_mobile_hdmi.c
+++ b/drivers/video/sh_mobile_hdmi.c
@@ -209,7 +209,8 @@ enum hotplug_state {
209struct sh_hdmi { 209struct sh_hdmi {
210 void __iomem *base; 210 void __iomem *base;
211 enum hotplug_state hp_state; /* hot-plug status */ 211 enum hotplug_state hp_state; /* hot-plug status */
212 bool preprogrammed_mode; /* use a pre-programmed VIC or the external mode */ 212 u8 preprogrammed_vic; /* use a pre-programmed VIC or
213 the external mode */
213 struct clk *hdmi_clk; 214 struct clk *hdmi_clk;
214 struct device *dev; 215 struct device *dev;
215 struct fb_info *info; 216 struct fb_info *info;
@@ -342,7 +343,7 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi)
342 hdmi_write(hdmi, var->vsync_len, HDMI_EXTERNAL_V_DURATION); 343 hdmi_write(hdmi, var->vsync_len, HDMI_EXTERNAL_V_DURATION);
343 344
344 /* Set bit 0 of HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS here for external mode */ 345 /* Set bit 0 of HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS here for external mode */
345 if (!hdmi->preprogrammed_mode) 346 if (!hdmi->preprogrammed_vic)
346 hdmi_write(hdmi, sync | 1 | (voffset << 4), 347 hdmi_write(hdmi, sync | 1 | (voffset << 4),
347 HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS); 348 HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS);
348} 349}
@@ -466,7 +467,18 @@ static void sh_hdmi_audio_config(struct sh_hdmi *hdmi)
466 */ 467 */
467static void sh_hdmi_phy_config(struct sh_hdmi *hdmi) 468static void sh_hdmi_phy_config(struct sh_hdmi *hdmi)
468{ 469{
469 if (hdmi->var.pixclock < 30000) { 470 if (hdmi->var.pixclock < 10000) {
471 /* for 1080p8bit 148MHz */
472 hdmi_write(hdmi, 0x1d, HDMI_SLIPHDMIT_PARAM_SETTINGS_1);
473 hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_2);
474 hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_3);
475 hdmi_write(hdmi, 0x4c, HDMI_SLIPHDMIT_PARAM_SETTINGS_5);
476 hdmi_write(hdmi, 0x1e, HDMI_SLIPHDMIT_PARAM_SETTINGS_6);
477 hdmi_write(hdmi, 0x48, HDMI_SLIPHDMIT_PARAM_SETTINGS_7);
478 hdmi_write(hdmi, 0x0e, HDMI_SLIPHDMIT_PARAM_SETTINGS_8);
479 hdmi_write(hdmi, 0x25, HDMI_SLIPHDMIT_PARAM_SETTINGS_9);
480 hdmi_write(hdmi, 0x04, HDMI_SLIPHDMIT_PARAM_SETTINGS_10);
481 } else if (hdmi->var.pixclock < 30000) {
470 /* 720p, 8bit, 74.25MHz. Might need to be adjusted for other formats */ 482 /* 720p, 8bit, 74.25MHz. Might need to be adjusted for other formats */
471 /* 483 /*
472 * [1:0] Speed_A 484 * [1:0] Speed_A
@@ -524,6 +536,7 @@ static void sh_hdmi_phy_config(struct sh_hdmi *hdmi)
524 */ 536 */
525static void sh_hdmi_avi_infoframe_setup(struct sh_hdmi *hdmi) 537static void sh_hdmi_avi_infoframe_setup(struct sh_hdmi *hdmi)
526{ 538{
539 struct fb_var_screeninfo *var = &hdmi->var;
527 u8 vic; 540 u8 vic;
528 541
529 /* AVI InfoFrame */ 542 /* AVI InfoFrame */
@@ -565,17 +578,11 @@ static void sh_hdmi_avi_infoframe_setup(struct sh_hdmi *hdmi)
565 hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB3); 578 hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB3);
566 579
567 /* 580 /*
568 * VIC = 1280 x 720p: ignored if external config is used 581 * VIC should be ignored if external config is used, so, we could just use 0,
569 * Send 2 for 720 x 480p, 16 for 1080p, ignored in external mode 582 * but play safe and use a valid value in any case just in case
570 */ 583 */
571 if (hdmi->var.yres == 1080 && hdmi->var.xres == 1920) 584 if (hdmi->preprogrammed_vic)
572 vic = 16; 585 vic = hdmi->preprogrammed_vic;
573 else if (hdmi->var.yres == 576 && hdmi->var.xres == 720)
574 vic = 17;
575 else if (hdmi->var.yres == 480 && hdmi->var.xres == 720)
576 vic = 2;
577 else if (hdmi->var.yres == 480 && hdmi->var.xres == 640)
578 vic = 1;
579 else 586 else
580 vic = 4; 587 vic = 4;
581 hdmi_write(hdmi, vic, HDMI_CTRL_PKT_BUF_ACCESS_PB4); 588 hdmi_write(hdmi, vic, HDMI_CTRL_PKT_BUF_ACCESS_PB4);
@@ -828,17 +835,25 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
828 if (!found) 835 if (!found)
829 return -ENXIO; 836 return -ENXIO;
830 837
831 if ((found->xres == 640 && found->yres == 480 && found->refresh == 60) || 838 if (found->xres == 640 && found->yres == 480 && found->refresh == 60)
832 (found->xres == 720 && found->yres == 480 && found->refresh == 60) || 839 hdmi->preprogrammed_vic = 1;
833 (found->xres == 720 && found->yres == 576 && found->refresh == 50) || 840 else if (found->xres == 720 && found->yres == 480 && found->refresh == 60)
834 (found->xres == 1280 && found->yres == 720 && found->refresh == 60) || 841 hdmi->preprogrammed_vic = 2;
835 (found->xres == 1920 && found->yres == 1080 && found->refresh == 60)) 842 else if (found->xres == 720 && found->yres == 576 && found->refresh == 50)
836 hdmi->preprogrammed_mode = true; 843 hdmi->preprogrammed_vic = 17;
844 else if (found->xres == 1280 && found->yres == 720 && found->refresh == 60)
845 hdmi->preprogrammed_vic = 4;
846 else if (found->xres == 1920 && found->yres == 1080 && found->refresh == 24)
847 hdmi->preprogrammed_vic = 32;
848 else if (found->xres == 1920 && found->yres == 1080 && found->refresh == 50)
849 hdmi->preprogrammed_vic = 31;
850 else if (found->xres == 1920 && found->yres == 1080 && found->refresh == 60)
851 hdmi->preprogrammed_vic = 16;
837 else 852 else
838 hdmi->preprogrammed_mode = false; 853 hdmi->preprogrammed_vic = 0;
839 854
840 dev_dbg(hdmi->dev, "Using %s %s mode %ux%u@%uHz (%luHz), clock error %luHz\n", 855 dev_dbg(hdmi->dev, "Using %s %s mode %ux%u@%uHz (%luHz), clock error %luHz\n",
841 modelist ? "default" : "EDID", hdmi->preprogrammed_mode ? "VIC" : "external", 856 modelist ? "default" : "EDID", hdmi->preprogrammed_vic ? "VIC" : "external",
842 found->xres, found->yres, found->refresh, 857 found->xres, found->yres, found->refresh,
843 PICOS2KHZ(found->pixclock) * 1000, found_rate_error); 858 PICOS2KHZ(found->pixclock) * 1000, found_rate_error);
844 859