Skip to content

Commit

Permalink
Block VICs reported as valid when Max_TMDS_Clock1 doesn't support them
Browse files Browse the repository at this point in the history
Fall back to 422 or 8-bit if Max_TMDS_Clock1 doesn't support 10/12 bit.
  • Loading branch information
graham8 authored and samnazarko committed Sep 13, 2018
1 parent 8e1a123 commit d58165d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
33 changes: 21 additions & 12 deletions drivers/amlogic/hdmi/hdmi_tx_20/hdmi_tx_main.c
Expand Up @@ -1421,23 +1421,32 @@ static ssize_t show_disp_cap(struct device *dev,
const char *native_disp_mode =
hdmitx_edid_get_native_VIC(&hdmitx_device);
enum hdmi_vic vic;
struct hdmi_format_para *para = NULL;
if (hdmitx_device.tv_no_edid) {
pos += snprintf(buf+pos, PAGE_SIZE, "null edid\n");
} else {
for (i = 0; disp_mode_t[i]; i++) {
vic = hdmitx_edid_get_VIC(&hdmitx_device,
disp_mode_t[i], 0);
if (vic != HDMI_Unkown) {
pos += snprintf(buf+pos, PAGE_SIZE, "%s",
disp_mode_t[i]);
if (native_disp_mode && (strcmp(
native_disp_mode,
disp_mode_t[i]) == 0)) {
pos += snprintf(buf+pos, PAGE_SIZE,
"*\n");
} else
pos += snprintf(buf+pos, PAGE_SIZE, "\n");
}
disp_mode_t[i], 0);
if (vic != HDMI_Unkown) {
/* sanity check */
para = hdmi_get_fmt_paras(vic);
if (! hdmitx_device.RXCap.HF_IEEEOUI &&
para->tmds_clk > hdmitx_device.RXCap.Max_TMDS_Clock1 * 5000){
pr_info("Mode %s (VIC %d) needs %dMHz clock, more than %dMHz",
disp_mode_t[i], vic, para->tmds_clk / 1000, hdmitx_device.RXCap.Max_TMDS_Clock1 * 5);
} else {
pos += snprintf(buf+pos, PAGE_SIZE, "%s",
disp_mode_t[i]);
if (native_disp_mode && (strcmp(
native_disp_mode,
disp_mode_t[i]) == 0)) {
pos += snprintf(buf+pos, PAGE_SIZE,
"*\n");
} else
pos += snprintf(buf+pos, PAGE_SIZE, "\n");
}
}
}
}
return pos;
Expand Down
14 changes: 14 additions & 0 deletions drivers/amlogic/hdmi/hdmi_tx_20/hdmi_tx_video.c
Expand Up @@ -663,6 +663,20 @@ int hdmitx_set_display(struct hdmitx_dev *hdev, enum hdmi_vic VideoCode)
default:
break;
}
if (param->color == COLORSPACE_YUV444 &&
hdev->para->tmds_clk * ((int) param->color_depth) / ((int) COLORDEPTH_24B) >
hdev->RXCap.Max_TMDS_Clock1 * 5000 &&
! hdev->RXCap.HF_IEEEOUI){
/* set 422 mode if sink can handle it */
if (hdev->RXCap.native_Mode & 0x10){
hdev->para->cs = COLORSPACE_YUV422;
pr_info("Setting colourspace to YCC422");
} else {
pr_info("No bandwidth for YCC444 at %d, setting 8-bit", (int) param->color_depth);
hdev->para->cs = COLORDEPTH_24B;
}
}

if (param->color == COLORSPACE_RGB444) {
hdev->para->cs = hdev->cur_video_param->color;
pr_info("hdmitx: rx edid only support RGB format\n");
Expand Down

0 comments on commit d58165d

Please sign in to comment.