+/**
+ * hdmi_show_sink_info: show hdmi sink device information
+ * @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:");
+ lens += snprintf(buf + lens, PAGE_SIZE - lens, " RGB");
+ 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:");
+ lens += snprintf(buf + lens, PAGE_SIZE - lens, " 24bit");
+ 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");
+ if (hdmi->edid.colorimetry) {
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ "\nExtended Colorimetry:");
+ if (hdmi->edid.colorimetry &
+ (1 << (HDMI_COLORIMETRY_EXTEND_XVYCC_601 - 3)))
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " xvYCC601");
+ if (hdmi->edid.colorimetry &
+ (1 << (HDMI_COLORIMETRY_EXTEND_XVYCC_709 - 3)))
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " xvYCC709");
+ if (hdmi->edid.colorimetry &
+ (1 << (HDMI_COLORIMETRY_EXTEND_SYCC_601 - 3)))
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " sYCC601");
+ if (hdmi->edid.colorimetry &
+ (1 << (HDMI_COLORIMETRY_EXTEND_ADOBE_YCC601 - 3)))
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " AdobeYCC601");
+ if (hdmi->edid.colorimetry &
+ (1 << (HDMI_COLORIMETRY_EXTEND_ADOBE_RGB - 3)))
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " AdobeRGB");
+ if (hdmi->edid.colorimetry &
+ (1 << (HDMI_COLORIMETRY_EXTEND_BT_2020_YCC_C - 3)))
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " BT2020cYCC");
+ if (hdmi->edid.colorimetry &
+ (1 << (HDMI_COLORIMETRY_EXTEND_BT_2020_YCC - 3)))
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " BT2020YCC");
+ if (hdmi->edid.colorimetry &
+ (1 << (HDMI_COLORIMETRY_EXTEND_BT_2020_RGB - 3)))
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " BT2020RGB");
+ }
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ "\nSupport audio type:");
+ 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,
+ " LPCM\n");
+ break;
+ case HDMI_AUDIO_AC3:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " AC3");
+ break;
+ case HDMI_AUDIO_MPEG1:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " MPEG1");
+ break;
+ case HDMI_AUDIO_MP3:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " MP3");
+ break;
+ case HDMI_AUDIO_MPEG2:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " MPEG2");
+ break;
+ case HDMI_AUDIO_AAC_LC:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " AAC");
+ break;
+ case HDMI_AUDIO_DTS:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " DTS");
+ break;
+ case HDMI_AUDIO_ATARC:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " ATARC");
+ break;
+ case HDMI_AUDIO_DSD:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " DSD");
+ break;
+ case HDMI_AUDIO_E_AC3:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " E-AC3");
+ break;
+ case HDMI_AUDIO_DTS_HD:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " DTS-HD");
+ break;
+ case HDMI_AUDIO_MLP:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " MLP");
+ break;
+ case HDMI_AUDIO_DST:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " DST");
+ break;
+ case HDMI_AUDIO_WMA_PRO:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " WMP-PRO");
+ break;
+ default:
+ lens += snprintf(buf + lens, PAGE_SIZE - lens,
+ " Unknown");
+ 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:");
+ 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 length:");
+ 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;
+}
+