Skip to content

Commit

Permalink
added extended EDID info to sysfs entries vga_edid and dvi_edid for d…
Browse files Browse the repository at this point in the history
…ebugging monitor problems
  • Loading branch information
Far McKon authored and haveahennessy committed Jun 9, 2011
1 parent 3739922 commit 939ebab
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
4 changes: 2 additions & 2 deletions drivers/bmi/pims/video/bmi_video.c
Expand Up @@ -368,7 +368,7 @@ static ssize_t bmi_video_vga_edid_show(struct device *dev,
if(video->vga_monitor_edid) {
ssize_t len = 0;
fb_edid_to_monspecs( video->vga_monitor_edid, &monspecs);
len = fb_edid_show(&monspecs, buf, PAGE_SIZE, 1);
len = fb_edid_show(&monspecs, buf, PAGE_SIZE, 5);
fb_destroy_modedb(monspecs.modedb);
return len;
}
Expand All @@ -384,7 +384,7 @@ static ssize_t bmi_video_dvi_edid_show(struct device *dev,
if(video->dvi_monitor_edid) {
ssize_t len = 0;
fb_edid_to_monspecs( video->dvi_monitor_edid, &monspecs);
len = fb_edid_show(&monspecs, buf, PAGE_SIZE, 1);
len = fb_edid_show(&monspecs, buf, PAGE_SIZE, 5);
fb_destroy_modedb(monspecs.modedb);
return len;
}
Expand Down
47 changes: 44 additions & 3 deletions drivers/video/fbmon.c
Expand Up @@ -908,7 +908,26 @@ int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var)
}
return 1;
}

ssize_t fb_videomode_show(struct fb_videomode* modedb, int modedb_len,
int bpp, char* buf, ssize_t bufSize)
{
int i = 0;
if(modedb_len <= 0) {
snprintfcat(buf,bufSize, "== No Valid Mode Info ==\n");
return strnlen(buf, bufSize);
}
// detail <= 1, print EDID header
snprintfcat(buf, bufSize, "=====\nMODE INFO\n====\n");

for (i = 0; i < modedb_len; i++)
{
struct fb_videomode* mode = &modedb[i];
snprintfcat(buf, bufSize, "Listed mode %s %dx%d-%d@%d\n",
mode->name ? mode->name : "noname",
mode->xres, mode->yres, bpp, mode->refresh);
}
return strnlen(buf, bufSize);
}

/* fb_edid_show - prints EDID data summary to a passed buffer
*
Expand All @@ -923,6 +942,7 @@ int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var)
ssize_t fb_edid_show(struct fb_monspecs *specs, char *buf,
ssize_t bufSize, int detail)
{
// detail <= 1, print EDID header
snprintfcat(buf, bufSize, "=====\nEDID INFO\n====\n");
snprintfcat(buf, bufSize, " EDID Version %d.%d\n",
(int) specs->version, (int) specs->revision);
Expand All @@ -931,8 +951,29 @@ ssize_t fb_edid_show(struct fb_monspecs *specs, char *buf,
snprintfcat(buf, bufSize, " Serial#: %u\n", specs->serial);
snprintfcat(buf, bufSize, " Year: %u Week %u\n",
specs->year, specs->week);
if (detail < 1) {
printk(KERN_INFO "Only level 1 detail available\n");

//display video modes
if(detail >= 2){
int bpp = 8; //HACK: hardcoded for testing
fb_videomode_show(specs->modedb, specs->modedb_len,bpp, buf, bufSize);
}

if (detail >= 3 ) {
snprintfcat(buf, bufSize, "== Display Characteristics:\n");
if(specs->input == 0)
snprintfcat(buf, bufSize, "No display inf in EDID\n");
else if( (specs->input & FB_DISP_DDI) == FB_DISP_DDI)
snprintfcat(buf, bufSize, "Digital Display Input\n");
else if( (specs->input & FB_DISP_ANA_700_300) == FB_DISP_ANA_700_300)
snprintfcat(buf, bufSize, "Analog Display Input: 0.7V/0.3V\n");
else if( (specs->input & FB_DISP_ANA_714_286) == FB_DISP_ANA_714_286)
snprintfcat(buf, bufSize, "Analog Display Input: 0.714V/0.286V\n");
else if( (specs->input & FB_DISP_ANA_1000_400) == FB_DISP_ANA_1000_400)
snprintfcat(buf, bufSize, "Analog Display Input: 0.1000V/0.400V\n");
else if( (specs->input & FB_DISP_ANA_700_000) == FB_DISP_ANA_700_000)
snprintfcat(buf, bufSize, "Analog Display Input: 0.7V/0.0V\n");

snprintfcat(buf, bufSize, "Sync: Not reported\n");
return strnlen(buf, bufSize);
}

Expand Down
2 changes: 2 additions & 0 deletions include/linux/fb.h
Expand Up @@ -1067,6 +1067,8 @@ extern int fb_validate_mode(const struct fb_var_screeninfo *var,
struct fb_info *info);
extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
extern const unsigned char *fb_firmware_edid(struct device *device);
ssize_t fb_videomode_show(struct fb_videomode* modedb, int modedb_len,
int bpp, char* buf, ssize_t bufSize);
extern ssize_t fb_edid_show(struct fb_monspecs *specs, char *buf,
ssize_t bufSize, int detail);
extern void fb_edid_to_monspecs(unsigned char *edid,
Expand Down

0 comments on commit 939ebab

Please sign in to comment.