hdmi: move show sink info to debug node.

Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
This commit is contained in:
Zheng Yang
2015-07-10 17:13:26 +08:00
parent 20e295642e
commit ff3fd603a0
2 changed files with 180 additions and 134 deletions

View File

@@ -308,135 +308,6 @@ static int hdmi_add_videomode(const struct fb_videomode *mode,
return 0;
}
/**
* hdmi_show_sink_info: show hdmi sink device infomation
* @hdmi: handle of hdmi
*/
static void hdmi_show_sink_info(struct hdmi *hdmi)
{
struct list_head *pos, *head = &hdmi->edid.modelist;
struct display_modelist *modelist;
struct fb_videomode *m;
int i;
struct hdmi_audio *audio;
pr_info("******** Show Sink Info ********\n");
pr_info("Max tmds clk is %u\n", hdmi->edid.maxtmdsclock);
if (hdmi->edid.hf_vsdb_version)
pr_info("Support HFVSDB\n");
if (hdmi->edid.scdc_present)
pr_info("Support SCDC\n");
pr_info("Support video mode:\n");
list_for_each(pos, head) {
modelist = list_entry(pos, struct display_modelist, list);
m = &modelist->mode;
if (m->flag)
pr_info(" %s(YCbCr420)\n", m->name);
else
pr_info(" %s\n", m->name);
}
pr_info("Support video color mode:\n");
pr_info(" RGB\n");
if (hdmi->edid.ycbcr420)
pr_info(" YCbCr420\n");
if (hdmi->edid.ycbcr422)
pr_info(" YCbCr422\n");
if (hdmi->edid.ycbcr444)
pr_info(" YCbCr444\n");
pr_info("Support video color depth:\n");
pr_info(" 24bit\n");
if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_30BITS)
pr_info(" 30bit\n");
if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_36BITS)
pr_info(" 36bit\n");
if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_48BITS)
pr_info(" 48bit\n");
if (hdmi->edid.ycbcr420)
pr_info(" 420_24bit\n");
if (hdmi->edid.deepcolor_420 & HDMI_DEEP_COLOR_30BITS)
pr_info(" 420_30bit\n");
if (hdmi->edid.deepcolor_420 & HDMI_DEEP_COLOR_36BITS)
pr_info(" 420_36bit\n");
if (hdmi->edid.deepcolor_420 & HDMI_DEEP_COLOR_48BITS)
pr_info(" 420_48bit\n");
pr_info("Support audio type:\n");
for (i = 0; i < hdmi->edid.audio_num; i++) {
audio = &(hdmi->edid.audio[i]);
switch (audio->type) {
case HDMI_AUDIO_LPCM:
pr_info(" LPCM\n");
break;
case HDMI_AUDIO_AC3:
pr_info(" AC3\n");
break;
case HDMI_AUDIO_MPEG1:
pr_info(" MPEG1\n");
break;
case HDMI_AUDIO_MP3:
pr_info(" MP3\n");
break;
case HDMI_AUDIO_MPEG2:
pr_info(" MPEG2\n");
break;
case HDMI_AUDIO_AAC_LC:
pr_info("S AAC\n");
break;
case HDMI_AUDIO_DTS:
pr_info(" DTS\n");
break;
case HDMI_AUDIO_ATARC:
pr_info(" ATARC\n");
break;
case HDMI_AUDIO_DSD:
pr_info(" DSD\n");
break;
case HDMI_AUDIO_E_AC3:
pr_info(" E-AC3\n");
break;
case HDMI_AUDIO_DTS_HD:
pr_info(" DTS-HD\n");
break;
case HDMI_AUDIO_MLP:
pr_info(" MLP\n");
break;
case HDMI_AUDIO_DST:
pr_info(" DST\n");
break;
case HDMI_AUDIO_WMA_PRO:
pr_info(" WMP-PRO\n");
break;
default:
pr_info(" Unkown\n");
break;
}
pr_info("Support max audio channel is %d\n", audio->channel);
pr_info("Support audio sample rate:\n");
if (audio->rate & HDMI_AUDIO_FS_32000)
pr_info(" 32000\n");
if (audio->rate & HDMI_AUDIO_FS_44100)
pr_info(" 44100\n");
if (audio->rate & HDMI_AUDIO_FS_48000)
pr_info(" 48000\n");
if (audio->rate & HDMI_AUDIO_FS_88200)
pr_info(" 88200\n");
if (audio->rate & HDMI_AUDIO_FS_96000)
pr_info(" 96000\n");
if (audio->rate & HDMI_AUDIO_FS_176400)
pr_info(" 176400\n");
if (audio->rate & HDMI_AUDIO_FS_192000)
pr_info(" 192000\n");
pr_info("Support audio word lenght:\n");
if (audio->rate & HDMI_AUDIO_WORD_LENGTH_16bit)
pr_info(" 16bit\n");
if (audio->rate & HDMI_AUDIO_WORD_LENGTH_20bit)
pr_info(" 20bit\n");
if (audio->rate & HDMI_AUDIO_WORD_LENGTH_24bit)
pr_info(" 24bit\n");
pr_info("\n");
}
pr_info("******** Show Sink Info ********\n");
}
/**
* hdmi_sort_modelist: sort modelist of edid
* @edid: edid to be sort
@@ -627,7 +498,6 @@ int hdmi_ouputmode_select(struct hdmi *hdmi, int edid_ok)
}
hdmi_sort_modelist(&hdmi->edid, hdmi->property->feature);
}
hdmi_show_sink_info(hdmi);
return HDMI_ERROR_SUCESS;
}

View File

@@ -302,6 +302,178 @@ static int hdmi_get_monspecs(struct rk_display_device *device,
return 0;
}
/**
* hdmi_show_sink_info: show hdmi sink device infomation
* @hdmi: handle of hdmi
*/
static int hdmi_show_sink_info(struct hdmi *hdmi, char *buf, int len)
{
struct list_head *pos, *head = &hdmi->edid.modelist;
struct display_modelist *modelist;
struct fb_videomode *m;
struct hdmi_audio *audio;
int i, lens = len;
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"******** Show Sink Info ********\n");
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"Max tmds clk is %u\n",
hdmi->edid.maxtmdsclock);
if (hdmi->edid.hf_vsdb_version)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"Support HFVSDB\n");
if (hdmi->edid.scdc_present)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"Support SCDC\n");
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"Support video mode:\n");
list_for_each(pos, head) {
modelist = list_entry(pos, struct display_modelist, list);
m = &modelist->mode;
if (m->flag)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\t%s(YCbCr420)\n", m->name);
else
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\t%s\n", m->name);
}
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"Support video color mode:\n");
lens += snprintf(buf + lens, PAGE_SIZE - lens, "\tRGB");
if (hdmi->edid.ycbcr420)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" YCbCr420");
if (hdmi->edid.ycbcr422)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" YCbCr422");
if (hdmi->edid.ycbcr444)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" YCbCr444");
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\nSupport video color depth:\n");
lens += snprintf(buf + lens, PAGE_SIZE - lens, "\t24bit");
if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_30BITS)
lens += snprintf(buf + lens, PAGE_SIZE - lens, " 30bit");
if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_36BITS)
lens += snprintf(buf + lens, PAGE_SIZE - lens, " 36bit");
if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_48BITS)
lens += snprintf(buf + lens, PAGE_SIZE - lens, " 48bit");
if (hdmi->edid.ycbcr420)
lens += snprintf(buf + lens, PAGE_SIZE - lens, " 420_24bit");
if (hdmi->edid.deepcolor_420 & HDMI_DEEP_COLOR_30BITS)
lens += snprintf(buf + lens, PAGE_SIZE - lens, " 420_30bit");
if (hdmi->edid.deepcolor_420 & HDMI_DEEP_COLOR_36BITS)
lens += snprintf(buf + lens, PAGE_SIZE - lens, " 420_36bit");
if (hdmi->edid.deepcolor_420 & HDMI_DEEP_COLOR_48BITS)
lens += snprintf(buf + lens, PAGE_SIZE - lens, " 420_48bit");
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\nSupport audio type:\n");
for (i = 0; i < hdmi->edid.audio_num; i++) {
audio = &(hdmi->edid.audio[i]);
switch (audio->type) {
case HDMI_AUDIO_LPCM:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tLPCM\n");
break;
case HDMI_AUDIO_AC3:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tAC3\n");
break;
case HDMI_AUDIO_MPEG1:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tMPEG1\n");
break;
case HDMI_AUDIO_MP3:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tMP3\n");
break;
case HDMI_AUDIO_MPEG2:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tMPEG2\n");
break;
case HDMI_AUDIO_AAC_LC:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tAAC\n");
break;
case HDMI_AUDIO_DTS:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tDTS\n");
break;
case HDMI_AUDIO_ATARC:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tATARC\n");
break;
case HDMI_AUDIO_DSD:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tDSD\n");
break;
case HDMI_AUDIO_E_AC3:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tE-AC3\n");
break;
case HDMI_AUDIO_DTS_HD:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tDTS-HD\n");
break;
case HDMI_AUDIO_MLP:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tMLP\n");
break;
case HDMI_AUDIO_DST:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tDST\n");
break;
case HDMI_AUDIO_WMA_PRO:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tWMP-PRO\n");
break;
default:
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\tUnkown\n");
break;
}
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"Support max audio channel is %d\n",
audio->channel);
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"Support audio sample rate:\n\t");
if (audio->rate & HDMI_AUDIO_FS_32000)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" 32000");
if (audio->rate & HDMI_AUDIO_FS_44100)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" 44100");
if (audio->rate & HDMI_AUDIO_FS_48000)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" 48000");
if (audio->rate & HDMI_AUDIO_FS_88200)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" 88200");
if (audio->rate & HDMI_AUDIO_FS_96000)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" 96000");
if (audio->rate & HDMI_AUDIO_FS_176400)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" 176400");
if (audio->rate & HDMI_AUDIO_FS_192000)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" 192000");
lens += snprintf(buf + lens, PAGE_SIZE - lens,
"\nSupport audio word lenght:\n\t");
if (audio->rate & HDMI_AUDIO_WORD_LENGTH_16bit)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" 16bit");
if (audio->rate & HDMI_AUDIO_WORD_LENGTH_20bit)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" 20bit");
if (audio->rate & HDMI_AUDIO_WORD_LENGTH_24bit)
lens += snprintf(buf + lens, PAGE_SIZE - lens,
" 24bit");
lens += snprintf(buf + lens, PAGE_SIZE - lens, "\n");
}
return lens;
}
static int hdmi_get_debug(struct rk_display_device *device, char *buf)
{
struct hdmi *hdmi = device->priv_data;
@@ -310,9 +482,9 @@ static int hdmi_get_debug(struct rk_display_device *device, char *buf)
if (!hdmi)
return 0;
len += snprintf(buf+len, PAGE_SIZE, "EDID status:%s\n",
len += snprintf(buf+len, PAGE_SIZE - len, "EDID status:%s\n",
hdmi->edid.status ? "False" : "Okay");
len += snprintf(buf+len, PAGE_SIZE, "Raw Data:");
len += snprintf(buf+len, PAGE_SIZE - len, "Raw Data:");
mutex_lock(&hdmi->lock);
for (i = 0; i < HDMI_MAX_EDID_BLOCK; i++) {
if (!hdmi->edid.raw[i])
@@ -320,11 +492,15 @@ static int hdmi_get_debug(struct rk_display_device *device, char *buf)
buff = hdmi->edid.raw[i];
for (j = 0; j < HDMI_EDID_BLOCK_SIZE; j++) {
if (j % 16 == 0)
len += snprintf(buf+len, PAGE_SIZE, "\n");
len += snprintf(buf+len, PAGE_SIZE, "0x%02x, ",
len += snprintf(buf + len,
PAGE_SIZE - len, "\n");
len += snprintf(buf+len, PAGE_SIZE - len, "0x%02x, ",
buff[j]);
}
}
len += snprintf(buf+len, PAGE_SIZE, "\n");
if (!hdmi->edid.status)
len += hdmi_show_sink_info(hdmi, buf, len);
mutex_unlock(&hdmi->lock);
return len;
}