提交 0ea2af1c 编写于 作者: G Guennadi Liakhovetski 提交者: Paul Mundt

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: NGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
上级 d2ecbab5
...@@ -209,7 +209,8 @@ enum hotplug_state { ...@@ -209,7 +209,8 @@ enum hotplug_state {
struct sh_hdmi { struct sh_hdmi {
void __iomem *base; void __iomem *base;
enum hotplug_state hp_state; /* hot-plug status */ enum hotplug_state hp_state; /* hot-plug status */
bool preprogrammed_mode; /* use a pre-programmed VIC or the external mode */ u8 preprogrammed_vic; /* use a pre-programmed VIC or
the external mode */
struct clk *hdmi_clk; struct clk *hdmi_clk;
struct device *dev; struct device *dev;
struct fb_info *info; struct fb_info *info;
...@@ -342,7 +343,7 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi) ...@@ -342,7 +343,7 @@ static void sh_hdmi_external_video_param(struct sh_hdmi *hdmi)
hdmi_write(hdmi, var->vsync_len, HDMI_EXTERNAL_V_DURATION); hdmi_write(hdmi, var->vsync_len, HDMI_EXTERNAL_V_DURATION);
/* Set bit 0 of HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS here for external mode */ /* Set bit 0 of HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS here for external mode */
if (!hdmi->preprogrammed_mode) if (!hdmi->preprogrammed_vic)
hdmi_write(hdmi, sync | 1 | (voffset << 4), hdmi_write(hdmi, sync | 1 | (voffset << 4),
HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS); HDMI_EXTERNAL_VIDEO_PARAM_SETTINGS);
} }
...@@ -466,7 +467,18 @@ static void sh_hdmi_audio_config(struct sh_hdmi *hdmi) ...@@ -466,7 +467,18 @@ static void sh_hdmi_audio_config(struct sh_hdmi *hdmi)
*/ */
static void sh_hdmi_phy_config(struct sh_hdmi *hdmi) static void sh_hdmi_phy_config(struct sh_hdmi *hdmi)
{ {
if (hdmi->var.pixclock < 30000) { if (hdmi->var.pixclock < 10000) {
/* for 1080p8bit 148MHz */
hdmi_write(hdmi, 0x1d, HDMI_SLIPHDMIT_PARAM_SETTINGS_1);
hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_2);
hdmi_write(hdmi, 0x00, HDMI_SLIPHDMIT_PARAM_SETTINGS_3);
hdmi_write(hdmi, 0x4c, HDMI_SLIPHDMIT_PARAM_SETTINGS_5);
hdmi_write(hdmi, 0x1e, HDMI_SLIPHDMIT_PARAM_SETTINGS_6);
hdmi_write(hdmi, 0x48, HDMI_SLIPHDMIT_PARAM_SETTINGS_7);
hdmi_write(hdmi, 0x0e, HDMI_SLIPHDMIT_PARAM_SETTINGS_8);
hdmi_write(hdmi, 0x25, HDMI_SLIPHDMIT_PARAM_SETTINGS_9);
hdmi_write(hdmi, 0x04, HDMI_SLIPHDMIT_PARAM_SETTINGS_10);
} else if (hdmi->var.pixclock < 30000) {
/* 720p, 8bit, 74.25MHz. Might need to be adjusted for other formats */ /* 720p, 8bit, 74.25MHz. Might need to be adjusted for other formats */
/* /*
* [1:0] Speed_A * [1:0] Speed_A
...@@ -524,6 +536,7 @@ static void sh_hdmi_phy_config(struct sh_hdmi *hdmi) ...@@ -524,6 +536,7 @@ static void sh_hdmi_phy_config(struct sh_hdmi *hdmi)
*/ */
static void sh_hdmi_avi_infoframe_setup(struct sh_hdmi *hdmi) static void sh_hdmi_avi_infoframe_setup(struct sh_hdmi *hdmi)
{ {
struct fb_var_screeninfo *var = &hdmi->var;
u8 vic; u8 vic;
/* AVI InfoFrame */ /* AVI InfoFrame */
...@@ -565,17 +578,11 @@ static void sh_hdmi_avi_infoframe_setup(struct sh_hdmi *hdmi) ...@@ -565,17 +578,11 @@ static void sh_hdmi_avi_infoframe_setup(struct sh_hdmi *hdmi)
hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB3); hdmi_write(hdmi, 0x00, HDMI_CTRL_PKT_BUF_ACCESS_PB3);
/* /*
* VIC = 1280 x 720p: ignored if external config is used * VIC should be ignored if external config is used, so, we could just use 0,
* Send 2 for 720 x 480p, 16 for 1080p, ignored in external mode * but play safe and use a valid value in any case just in case
*/ */
if (hdmi->var.yres == 1080 && hdmi->var.xres == 1920) if (hdmi->preprogrammed_vic)
vic = 16; vic = hdmi->preprogrammed_vic;
else if (hdmi->var.yres == 576 && hdmi->var.xres == 720)
vic = 17;
else if (hdmi->var.yres == 480 && hdmi->var.xres == 720)
vic = 2;
else if (hdmi->var.yres == 480 && hdmi->var.xres == 640)
vic = 1;
else else
vic = 4; vic = 4;
hdmi_write(hdmi, vic, HDMI_CTRL_PKT_BUF_ACCESS_PB4); 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,17 +835,25 @@ static int sh_hdmi_read_edid(struct sh_hdmi *hdmi, unsigned long *hdmi_rate,
if (!found) if (!found)
return -ENXIO; return -ENXIO;
if ((found->xres == 640 && found->yres == 480 && found->refresh == 60) || if (found->xres == 640 && found->yres == 480 && found->refresh == 60)
(found->xres == 720 && found->yres == 480 && found->refresh == 60) || hdmi->preprogrammed_vic = 1;
(found->xres == 720 && found->yres == 576 && found->refresh == 50) || else if (found->xres == 720 && found->yres == 480 && found->refresh == 60)
(found->xres == 1280 && found->yres == 720 && found->refresh == 60) || hdmi->preprogrammed_vic = 2;
(found->xres == 1920 && found->yres == 1080 && found->refresh == 60)) else if (found->xres == 720 && found->yres == 576 && found->refresh == 50)
hdmi->preprogrammed_mode = true; hdmi->preprogrammed_vic = 17;
else if (found->xres == 1280 && found->yres == 720 && found->refresh == 60)
hdmi->preprogrammed_vic = 4;
else if (found->xres == 1920 && found->yres == 1080 && found->refresh == 24)
hdmi->preprogrammed_vic = 32;
else if (found->xres == 1920 && found->yres == 1080 && found->refresh == 50)
hdmi->preprogrammed_vic = 31;
else if (found->xres == 1920 && found->yres == 1080 && found->refresh == 60)
hdmi->preprogrammed_vic = 16;
else else
hdmi->preprogrammed_mode = false; hdmi->preprogrammed_vic = 0;
dev_dbg(hdmi->dev, "Using %s %s mode %ux%u@%uHz (%luHz), clock error %luHz\n", dev_dbg(hdmi->dev, "Using %s %s mode %ux%u@%uHz (%luHz), clock error %luHz\n",
modelist ? "default" : "EDID", hdmi->preprogrammed_mode ? "VIC" : "external", modelist ? "default" : "EDID", hdmi->preprogrammed_vic ? "VIC" : "external",
found->xres, found->yres, found->refresh, found->xres, found->yres, found->refresh,
PICOS2KHZ(found->pixclock) * 1000, found_rate_error); PICOS2KHZ(found->pixclock) * 1000, found_rate_error);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部