Re: [PATCH 2/3] video: fbdev: Check Standard Timing against DMT
From: Tomi Valkeinen <hidden>
Date: 2014-12-04 15:41:30
On 03/12/14 23:49, David Ung wrote:
quoted hunk ↗ jump to hunk
Add the VESA Display Monitor Timing (DMT) table. During parsing of Standard Timings, it compare the 2 byte STD code with DMT to see what the VESA mode should be. If there is no entry in the vesa_modes table or no match found, it fallsback to the GTF timings. Signed-off-by: David Ung <redacted> --- drivers/video/fbdev/core/fbmon.c | 20 ++++++---- drivers/video/fbdev/core/modedb.c | 84 +++++++++++++++++++++++++++++++++++++++ include/linux/fb.h | 10 +++++ 3 files changed, 107 insertions(+), 7 deletions(-)diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c index 5b0e313..aa1110a 100644 --- a/drivers/video/fbdev/core/fbmon.c +++ b/drivers/video/fbdev/core/fbmon.c@@ -526,16 +526,22 @@ static int get_std_timing(unsigned char *block, struct fb_videomode *mode, refresh = (block[1] & 0x3f) + 60; DPRINTK(" %dx%d@%dHz\n", xres, yres, refresh); - for (i = 0; i < VESA_MODEDB_SIZE; i++) { - if (vesa_modes[i].xres == xres && - vesa_modes[i].yres == yres && - vesa_modes[i].refresh == refresh) { - *mode = vesa_modes[i]; + for (i = 0; i < DMT_SIZE; i++) { + u32 std_2byte_code = block[0] << 8 | block[1]; + + if (std_2byte_code == dmt_modes[i].std_2byte_code) { + if (!dmt_modes[i].mode) + break; + *mode = *dmt_modes[i].mode; mode->flag |= FB_MODE_IS_STANDARD; - return 1; + DPRINTK(" DMT id=%d\n", dmt_modes[i].dmt_id); + break; } } - calc_mode_timings(xres, yres, refresh, mode); + + if (i == DMT_SIZE || !dmt_modes[i].mode) + calc_mode_timings(xres, yres, refresh, mode); + return 1; }diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c index 0b57c1df..858a97e 100644 --- a/drivers/video/fbdev/core/modedb.c +++ b/drivers/video/fbdev/core/modedb.c@@ -497,6 +497,90 @@ const struct fb_videomode vesa_modes[] = { FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, }; EXPORT_SYMBOL(vesa_modes); + +const struct dmt_videomode dmt_modes[DMT_SIZE] = { + { 0x01, 0x0000, 0x000000, &vesa_modes[0] }, + { 0x02, 0x3119, 0x000000, &vesa_modes[1] }, + { 0x03, 0x0000, 0x000000, &vesa_modes[2] }, + { 0x04, 0x3140, 0x000000, &vesa_modes[3] }, + { 0x05, 0x314c, 0x000000, &vesa_modes[4] }, + { 0x06, 0x314f, 0x000000, &vesa_modes[5] }, + { 0x07, 0x3159, 0x000000, &vesa_modes[6] }, + { 0x08, 0x0000, 0x000000, &vesa_modes[7] }, + { 0x09, 0x4540, 0x000000, &vesa_modes[8] }, + { 0x0a, 0x454c, 0x000000, &vesa_modes[9] }, + { 0x0b, 0x454f, 0x000000, &vesa_modes[10] }, + { 0x0c, 0x4559, 0x000000, &vesa_modes[11] }, + { 0x0d, 0x0000, 0x000000, 0 }, + { 0x0e, 0x0000, 0x000000, 0 },
You've filled only some of the modes in this table. What's the logic which modes are left out? Tomi
Attachments
- signature.asc [application/pgp-signature] 819 bytes