1 #include "rockchip-hdmi.h"
3 static const struct hdmi_video_timing hdmi_mode[] = {
4 /* name refresh xres yres pixclock h_bp h_fp v_bp v_fp h_pw v_pw polariry PorI flag vic 2ndvic pixelrepeat interface */
6 { { "720x480i@60Hz", 60, 720, 480, 27000000, 57, 19, 15, 4, 62, 3, 0, 1, 0 }, 6, HDMI_720X480I_60HZ_16_9, 2, OUT_P888},
7 { { "720x576i@50Hz", 50, 720, 576, 27000000, 69, 12, 19, 2, 63, 3, 0, 1, 0 }, 21, HDMI_720X576I_50HZ_16_9, 2, OUT_P888},
8 { { "720x480p@60Hz", 60, 720, 480, 27000000, 60, 16, 30, 9, 62, 6, 0, 0, 0 }, 2, HDMI_720X480P_60HZ_16_9, 1, OUT_P888},
9 { { "720x576p@50Hz", 50, 720, 576, 27000000, 68, 12, 39, 5, 64, 5, 0, 0, 0 }, 17, HDMI_720X576P_50HZ_16_9, 1, OUT_P888},
10 { { "1280x720p@24Hz", 24, 1280, 720, 59400000, 220, 1760, 20, 5, 40, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 60, HDMI_1280X720P_24HZ_4_3, 1, OUT_P888},
11 { { "1280x720p@25Hz", 25, 1280, 720, 74250000, 220, 2420, 20, 5, 40, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 61, HDMI_1280X720P_25HZ_4_3, 1, OUT_P888},
12 { { "1280x720p@30Hz", 30, 1280, 720, 74250000, 220, 1760, 20, 5, 40, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 62, HDMI_1280X720P_30HZ_4_3, 1, OUT_P888},
13 { { "1280x720p@50Hz", 50, 1280, 720, 74250000, 220, 440, 20, 5, 40, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 19, HDMI_1280X720P_50HZ_4_3, 1, OUT_P888},
14 { { "1280x720p@60Hz", 60, 1280, 720, 74250000, 220, 110, 20, 5, 40, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 4, HDMI_1280X720P_60HZ_4_3, 1, OUT_P888},
15 { { "1920x1080i@50Hz", 50, 1920, 1080, 74250000, 148, 528, 15, 2, 44, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 1, 0 }, 20, 0, 1, OUT_P888},
16 { { "1920x1080i@60Hz", 60, 1920, 1080, 74250000, 148, 88, 15, 2, 44, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 1, 0 }, 5, 0, 1, OUT_P888},
17 { { "1920x1080p@24Hz", 24, 1920, 1080, 74250000, 148, 638, 36, 4, 44, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 32, HDMI_1920X1080P_24HZ_4_3, 1, OUT_P888},
18 { { "1920x1080p@25Hz", 25, 1920, 1080, 74250000, 148, 528, 36, 4, 44, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 33, HDMI_1920X1080P_25HZ_4_3, 1, OUT_P888},
19 { { "1920x1080p@30Hz", 30, 1920, 1080, 74250000, 148, 88, 36, 4, 44, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 34, HDMI_1920X1080P_30HZ_4_3, 1, OUT_P888},
20 { { "1920x1080p@50Hz", 50, 1920, 1080, 148500000, 148, 528, 36, 4, 44, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 31, HDMI_1920X1080P_50HZ_4_3, 1, OUT_P888},
21 { { "1920x1080p@60Hz", 60, 1920, 1080, 148500000, 148, 88, 36, 4, 44, 5, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 16, HDMI_1920X1080P_60HZ_4_3, 1, OUT_P888},
22 { { "3840x2160p@24Hz", 24, 3840, 2160, 297000000, 296, 1276, 72, 8, 88, 10, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 93, HDMI_3840X2160P_24HZ_4_3, 1, OUT_P888},
23 { { "3840x2160p@25Hz", 25, 3840, 2160, 297000000, 296, 1056, 72, 8, 88, 10, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 94, HDMI_3840X2160P_25HZ_4_3, 1, OUT_P888},
24 { { "3840x2160p@30Hz", 30, 3840, 2160, 297000000, 296, 176, 72, 8, 88, 10, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 95, HDMI_3840X2160P_30HZ_4_3, 1, OUT_P888},
25 { { "4096x2160p@24Hz", 24, 4096, 2160, 297000000, 296, 1020, 72, 8, 88, 10, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 98, 0, 1, OUT_P888},
26 { { "4096x2160p@25Hz", 25, 4096, 2160, 297000000, 128, 968, 72, 8, 88, 10, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 99, 0, 1, OUT_P888},
27 { { "4096x2160p@30Hz", 30, 4096, 2160, 297000000, 128, 88, 72, 8, 88, 10, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 100, 0, 1, OUT_P888},
28 { { "3840x2160p@50Hz", 50, 3840, 2160, 594000000, 296, 1056, 72, 8, 88, 10, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 96, HDMI_3840X2160P_50HZ_4_3, 1, OUT_P888},
29 { { "3840x2160p@60Hz", 60, 3840, 2160, 594000000, 296, 176, 72, 8, 88, 10, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 97, HDMI_3840X2160P_60HZ_4_3, 1, OUT_P888},
30 { { "4096x2160p@50Hz", 50, 4096, 2160, 594000000, 128, 968, 72, 8, 88, 10, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 101, 0, 1, OUT_P888},
31 { { "4096x2160p@60Hz", 60, 4096, 2160, 594000000, 128, 88, 72, 8, 88, 10, FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, 0, 0 }, 102, 0, 1, OUT_P888},
34 static int hdmi_set_info(struct rk_screen *screen, struct hdmi *hdmi)
37 struct fb_videomode *mode;
39 if (screen == NULL || hdmi == NULL)
40 return HDMI_ERROR_FALSE;
43 hdmi->vic = hdmi->property->defaultmode;
45 for (i = 0; i < ARRAY_SIZE(hdmi_mode); i++) {
46 if (hdmi_mode[i].vic == (hdmi->vic & HDMI_VIC_MASK) ||
47 hdmi_mode[i].vic_2nd == (hdmi->vic & HDMI_VIC_MASK))
50 if (i == ARRAY_SIZE(hdmi_mode))
51 return HDMI_ERROR_FALSE;
53 memset(screen, 0, sizeof(struct rk_screen));
55 /* screen type & face */
56 screen->type = SCREEN_HDMI;
57 if (hdmi->colormode_input == HDMI_COLOR_RGB_0_255)
58 screen->color_mode = COLOR_RGB;
60 screen->color_mode = COLOR_YCBCR;
61 if (hdmi->vic & HDMI_VIDEO_YUV420)
62 screen->face = OUT_YUV_420;
64 screen->face = hdmi_mode[i].interface;
65 screen->pixelrepeat = hdmi_mode[i].pixelrepeat - 1;
66 mode = (struct fb_videomode *)&(hdmi_mode[i].mode);
71 #ifdef CONFIG_HDMI_RK616
72 screen->pin_hsync = 0;
73 screen->pin_vsync = 0;
75 if (FB_SYNC_HOR_HIGH_ACT & mode->sync)
76 screen->pin_hsync = 1;
78 screen->pin_hsync = 0;
79 if (FB_SYNC_VERT_HIGH_ACT & mode->sync)
80 screen->pin_vsync = 1;
82 screen->pin_vsync = 0;
88 if (hdmi->soctype == HDMI_SOC_RK3368 &&
89 screen->color_mode == COLOR_YCBCR &&
90 screen->face == OUT_P888)
96 screen->swap_delta = 0;
97 screen->swap_dumy = 0;
99 /* Operation function*/
101 screen->standby = NULL;
103 screen->overscan.left = hdmi->xscale;
104 screen->overscan.top = hdmi->yscale;
105 screen->overscan.right = hdmi->xscale;
106 screen->overscan.bottom = hdmi->yscale;
111 * hdmi_find_best_mode: find the video mode nearest to input vic
116 * If vic is zero, return the high resolution video mode vic.
118 int hdmi_find_best_mode(struct hdmi *hdmi, int vic)
120 struct list_head *pos, *head = &hdmi->edid.modelist;
121 struct display_modelist *modelist;
123 /* pr_info("%s vic %d\n", __FUNCTION__, vic); */
125 list_for_each(pos, head) {
128 struct display_modelist, list);
129 if (modelist->vic == vic) {
135 if ((vic == 0 || found == 0) && head->next != head) {
136 /* If parse edid error, we select default mode; */
137 if (hdmi->edid.specs == NULL ||
138 hdmi->edid.specs->modedb_len == 0)
139 return hdmi->property->defaultmode;
140 /*modelist = list_entry(head->prev,
141 struct display_modelist, list);*/
143 modelist = list_entry(head->next,
144 struct display_modelist, list);
147 if (modelist != NULL)
148 return modelist->vic;
153 * hdmi_set_lcdc: switch lcdc mode to required video mode
159 int hdmi_set_lcdc(struct hdmi *hdmi)
162 struct rk_screen screen;
165 hdmi->vic = hdmi_find_best_mode(hdmi, 0);
167 hdmi->vic = hdmi_find_best_mode(hdmi, hdmi->vic);
170 hdmi->vic = hdmi->property->defaultmode;
172 rc = hdmi_set_info(&screen, hdmi);
175 rk_fb_switch_screen(&screen, 1, hdmi->lcdc->id);
176 if (rk_fb_get_display_policy() != DISPLAY_POLICY_BOX)
177 rk_fb_disp_scale(hdmi->xscale,
185 * hdmi_videomode_compare - compare 2 videomodes
186 * @mode1: first videomode
187 * @mode2: second videomode
190 * 1 if mode1 > mode2, 0 if mode1 = mode2, -1 mode1 < mode2
192 static int hdmi_videomode_compare(const struct fb_videomode *mode1,
193 const struct fb_videomode *mode2)
195 if (mode1->xres > mode2->xres)
198 if (mode1->xres == mode2->xres) {
199 if (mode1->yres > mode2->yres)
201 if (mode1->yres == mode2->yres) {
202 if (mode1->vmode < mode2->vmode)
204 if (mode1->pixclock > mode2->pixclock)
206 if (mode1->pixclock == mode2->pixclock) {
207 if (mode1->refresh > mode2->refresh)
209 if (mode1->refresh == mode2->refresh) {
210 if (mode2->flag > mode1->flag)
212 if (mode2->flag < mode1->flag)
214 if (mode2->vmode > mode1->vmode)
216 if (mode2->vmode == mode1->vmode)
226 * hdmi_add_vic - add entry to modelist according vic
227 * @vic: vic to be added
228 * @head: struct list_head of modelist
231 * Will only add unmatched mode entries
233 int hdmi_add_vic(int vic, struct list_head *head)
235 struct list_head *pos;
236 struct display_modelist *modelist;
239 /* DBG("%s vic %d", __FUNCTION__, vic); */
243 list_for_each(pos, head) {
244 modelist = list_entry(pos, struct display_modelist, list);
252 modelist = kmalloc(sizeof(*modelist),
257 memset(modelist, 0, sizeof(struct display_modelist));
259 list_add_tail(&modelist->list, head);
265 * hdmi_add_videomode: adds videomode entry to modelist
266 * @mode: videomode to be added
267 * @head: struct list_head of modelist
270 * Will only add unmatched mode entries
272 static int hdmi_add_videomode(const struct fb_videomode *mode,
273 struct list_head *head)
275 struct list_head *pos;
276 struct display_modelist *modelist, *modelist_new;
277 struct fb_videomode *m;
280 for (i = 0; i < ARRAY_SIZE(hdmi_mode); i++) {
281 m = (struct fb_videomode *)&(hdmi_mode[i].mode);
282 if (fb_mode_is_equal(m, mode)) {
289 list_for_each(pos, head) {
290 modelist = list_entry(pos,
291 struct display_modelist, list);
293 if (fb_mode_is_equal(m, mode))
295 else if (hdmi_videomode_compare(m, mode) == -1)
299 modelist_new = kmalloc(sizeof(*modelist_new), GFP_KERNEL);
302 memset(modelist_new, 0, sizeof(struct display_modelist));
303 modelist_new->mode = hdmi_mode[i].mode;
304 modelist_new->vic = hdmi_mode[i].vic;
305 list_add_tail(&modelist_new->list, pos);
312 * hdmi_show_sink_info: show hdmi sink device infomation
313 * @hdmi: handle of hdmi
315 static void hdmi_show_sink_info(struct hdmi *hdmi)
317 struct list_head *pos, *head = &hdmi->edid.modelist;
318 struct display_modelist *modelist;
319 struct fb_videomode *m;
321 struct hdmi_audio *audio;
323 pr_info("******** Show Sink Info ********\n");
324 pr_info("Max tmds clk is %u\n", hdmi->edid.maxtmdsclock);
325 if (hdmi->edid.hf_vsdb_version)
326 pr_info("Support HFVSDB\n");
327 if (hdmi->edid.scdc_present)
328 pr_info("Support SCDC\n");
329 pr_info("Support video mode:\n");
330 list_for_each(pos, head) {
331 modelist = list_entry(pos, struct display_modelist, list);
334 pr_info(" %s(YCbCr420)\n", m->name);
336 pr_info(" %s\n", m->name);
338 pr_info("Support video color mode:\n");
340 if (hdmi->edid.ycbcr420)
341 pr_info(" YCbCr420\n");
342 if (hdmi->edid.ycbcr422)
343 pr_info(" YCbCr422\n");
344 if (hdmi->edid.ycbcr444)
345 pr_info(" YCbCr444\n");
346 pr_info("Support video color depth:\n");
348 if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_30BITS)
350 if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_36BITS)
352 if (hdmi->edid.deepcolor & HDMI_DEEP_COLOR_48BITS)
355 pr_info("Support audio type:\n");
356 for (i = 0; i < hdmi->edid.audio_num; i++) {
357 audio = &(hdmi->edid.audio[i]);
358 switch (audio->type) {
359 case HDMI_AUDIO_LPCM:
365 case HDMI_AUDIO_MPEG1:
371 case HDMI_AUDIO_MPEG2:
374 case HDMI_AUDIO_AAC_LC:
380 case HDMI_AUDIO_ATARC:
386 case HDMI_AUDIO_E_AC3:
389 case HDMI_AUDIO_DTS_HD:
390 pr_info(" DTS-HD\n");
398 case HDMI_AUDIO_WMA_PRO:
399 pr_info(" WMP-PRO\n");
402 pr_info(" Unkown\n");
405 pr_info("Support max audio channel is %d\n", audio->channel);
406 pr_info("Support audio sample rate:\n");
407 if (audio->rate & HDMI_AUDIO_FS_32000)
409 if (audio->rate & HDMI_AUDIO_FS_44100)
411 if (audio->rate & HDMI_AUDIO_FS_48000)
413 if (audio->rate & HDMI_AUDIO_FS_88200)
415 if (audio->rate & HDMI_AUDIO_FS_96000)
417 if (audio->rate & HDMI_AUDIO_FS_176400)
418 pr_info(" 176400\n");
419 if (audio->rate & HDMI_AUDIO_FS_192000)
420 pr_info(" 192000\n");
421 pr_info("Support audio word lenght:\n");
422 if (audio->rate & HDMI_AUDIO_WORD_LENGTH_16bit)
424 if (audio->rate & HDMI_AUDIO_WORD_LENGTH_20bit)
426 if (audio->rate & HDMI_AUDIO_WORD_LENGTH_24bit)
430 pr_info("******** Show Sink Info ********\n");
434 * hdmi_sort_modelist: sort modelist of edid
435 * @edid: edid to be sort
437 static void hdmi_sort_modelist(struct hdmi_edid *edid, int feature)
439 struct list_head *pos, *pos_new;
440 struct list_head head_new, *head = &edid->modelist;
441 struct display_modelist *modelist, *modelist_new, *modelist_n;
442 struct fb_videomode *m, *m_new;
445 INIT_LIST_HEAD(&head_new);
446 list_for_each(pos, head) {
447 modelist = list_entry(pos, struct display_modelist, list);
448 /*pr_info("%s vic %d\n", __function__, modelist->vic);*/
449 for (i = 0; i < ARRAY_SIZE(hdmi_mode); i++) {
450 vic = modelist->vic & HDMI_VIC_MASK;
451 if (vic == hdmi_mode[i].vic ||
452 vic == hdmi_mode[i].vic_2nd) {
453 if ((feature & SUPPORT_4K) == 0 &&
454 hdmi_mode[i].mode.xres >= 3840)
456 if ((feature & SUPPORT_4K_4096) == 0 &&
457 hdmi_mode[i].mode.xres == 4096)
459 if ((feature & SUPPORT_TMDS_600M) == 0 &&
460 !(modelist->vic & HDMI_VIDEO_YUV420) &&
461 hdmi_mode[i].mode.pixclock > 340000000)
463 if ((modelist->vic & HDMI_VIDEO_YUV420) &&
464 (feature & SUPPORT_YUV420) == 0)
466 if ((feature & SUPPORT_1080I) == 0 &&
467 hdmi_mode[i].mode.xres == 1920 &&
468 hdmi_mode[i].mode.vmode ==
471 if ((feature & SUPPORT_480I_576I) == 0 &&
472 hdmi_mode[i].mode.xres == 720 &&
473 hdmi_mode[i].mode.vmode ==
477 modelist->vic = hdmi_mode[i].vic;
478 modelist->mode = hdmi_mode[i].mode;
479 if (vic & HDMI_VIDEO_YUV420) {
480 modelist->vic |= HDMI_VIDEO_YUV420;
481 modelist->mode.flag = 1;
484 m = (struct fb_videomode *)&(modelist->mode);
485 list_for_each(pos_new, &head_new) {
488 struct display_modelist,
490 m_new = &modelist_new->mode;
492 hdmi_videomode_compare(m, m_new);
498 kmalloc(sizeof(*modelist_n),
502 *modelist_n = *modelist;
503 list_add_tail(&modelist_n->list,
510 fb_destroy_modelist(head);
511 if (head_new.next == &head_new) {
512 pr_info("There is no available video mode in EDID.\n");
513 INIT_LIST_HEAD(&edid->modelist);
515 edid->modelist = head_new;
516 edid->modelist.prev->next = &edid->modelist;
517 edid->modelist.next->prev = &edid->modelist;
522 * hdmi_ouputmode_select - select hdmi transmitter output mode: hdmi or dvi?
523 * @hdmi: handle of hdmi
524 * @edid_ok: get EDID data success or not, HDMI_ERROR_SUCESS means success.
526 int hdmi_ouputmode_select(struct hdmi *hdmi, int edid_ok)
528 struct list_head *head = &hdmi->edid.modelist;
529 struct fb_monspecs *specs = hdmi->edid.specs;
530 struct fb_videomode *modedb = NULL, *mode = NULL;
533 if (edid_ok != HDMI_ERROR_SUCESS) {
534 dev_err(hdmi->dev, "warning: EDID error, assume sink as HDMI !!!!");
535 hdmi->edid.sink_hdmi = 1;
536 hdmi->edid.baseaudio_support = 1;
537 hdmi->edid.ycbcr444 = 0;
538 hdmi->edid.ycbcr422 = 0;
541 if (head->next == head) {
543 "warning: no CEA video mode parsed from EDID !!!!\n");
544 /* If EDID get error, list all system supported mode.
545 If output mode is set to DVI and EDID is ok, check
548 if (hdmi->edid.sink_hdmi == 0 && specs && specs->modedb_len) {
549 /* Get max resolution timing */
550 modedb = &specs->modedb[0];
551 for (i = 0; i < specs->modedb_len; i++) {
552 if (specs->modedb[i].xres > modedb->xres)
553 modedb = &specs->modedb[i];
554 else if (specs->modedb[i].xres ==
556 specs->modedb[i].yres > modedb->yres)
557 modedb = &specs->modedb[i];
559 /* For some monitor, the max pixclock read from EDID
560 is smaller than the clock of max resolution mode
561 supported. We fix it. */
562 pixclock = PICOS2KHZ(modedb->pixclock);
566 if (pixclock == 148250000)
567 pixclock = 148500000;
568 if (pixclock > specs->dclkmax)
569 specs->dclkmax = pixclock;
572 for (i = 0; i < ARRAY_SIZE(hdmi_mode); i++) {
573 mode = (struct fb_videomode *)&(hdmi_mode[i].mode);
575 if ((mode->pixclock < specs->dclkmin) ||
576 (mode->pixclock > specs->dclkmax) ||
577 (mode->refresh < specs->vfmin) ||
578 (mode->refresh > specs->vfmax) ||
579 (mode->xres > modedb->xres) ||
580 (mode->yres > modedb->yres))
583 if (!(hdmi->property->feature & SUPPORT_4K) &&
586 else if (mode->pixclock > 340000000)
589 hdmi_add_videomode(mode, head);
592 /* There are some video mode is not defined in EDID extend
593 block, so we need to check first block data.*/
594 if (specs && specs->modedb_len) {
595 for (i = 0; i < specs->modedb_len; i++) {
596 modedb = &specs->modedb[0];
597 pixclock = hdmi_videomode_to_vic(modedb);
599 hdmi_add_vic(pixclock, head);
602 hdmi_sort_modelist(&hdmi->edid, hdmi->property->feature);
604 hdmi_show_sink_info(hdmi);
606 return HDMI_ERROR_SUCESS;
610 * hdmi_videomode_to_vic: transverse video mode to vic
611 * @vmode: videomode to transverse
614 int hdmi_videomode_to_vic(struct fb_videomode *vmode)
616 struct fb_videomode *mode;
617 unsigned char vic = 0;
620 for (i = 0; i < ARRAY_SIZE(hdmi_mode); i++) {
621 mode = (struct fb_videomode *)&(hdmi_mode[i].mode);
622 if (vmode->vmode == mode->vmode &&
623 vmode->refresh == mode->refresh &&
624 vmode->xres == mode->xres &&
625 vmode->yres == mode->yres &&
626 vmode->left_margin == mode->left_margin &&
627 vmode->right_margin == mode->right_margin &&
628 vmode->upper_margin == mode->upper_margin &&
629 vmode->lower_margin == mode->lower_margin &&
630 vmode->hsync_len == mode->hsync_len &&
631 vmode->vsync_len == mode->vsync_len) {
632 vic = hdmi_mode[i].vic;
640 * hdmi_vic2timing: transverse vic mode to video timing
641 * @vmode: vic to transverse
644 const struct hdmi_video_timing *hdmi_vic2timing(int vic)
651 for (i = 0; i < ARRAY_SIZE(hdmi_mode); i++) {
652 if (hdmi_mode[i].vic == vic || hdmi_mode[i].vic_2nd == vic)
653 return &(hdmi_mode[i]);
659 * hdmi_vic_to_videomode: transverse vic mode to video mode
660 * @vmode: vic to transverse
663 const struct fb_videomode *hdmi_vic_to_videomode(int vic)
670 for (i = 0; i < ARRAY_SIZE(hdmi_mode); i++) {
671 if (hdmi_mode[i].vic == (vic & HDMI_VIC_MASK) ||
672 hdmi_mode[i].vic_2nd == (vic & HDMI_VIC_MASK))
673 return &hdmi_mode[i].mode;
679 * hdmi_init_modelist: initial hdmi mode list
685 void hdmi_init_modelist(struct hdmi *hdmi)
688 struct list_head *head = &hdmi->edid.modelist;
690 feature = hdmi->property->feature;
691 INIT_LIST_HEAD(&hdmi->edid.modelist);
692 for (i = 0; i < ARRAY_SIZE(hdmi_mode); i++) {
693 if ((feature & SUPPORT_TMDS_600M) == 0 &&
694 hdmi_mode[i].mode.pixclock > 340000000)
696 if ((feature & SUPPORT_4K) == 0 &&
697 hdmi_mode[i].mode.xres >= 3840)
699 if ((feature & SUPPORT_4K_4096) == 0 &&
700 hdmi_mode[i].mode.xres == 4096)
702 if ((feature & SUPPORT_1080I) == 0 &&
703 hdmi_mode[i].mode.xres == 1920 &&
704 hdmi_mode[i].mode.vmode == FB_VMODE_INTERLACED)
706 if ((feature & SUPPORT_480I_576I) == 0 &&
707 hdmi_mode[i].mode.xres == 720 &&
708 hdmi_mode[i].mode.vmode == FB_VMODE_INTERLACED)
710 hdmi_add_videomode(&(hdmi_mode[i].mode), head);