--- uclinux-2.4.x/drivers/video/fbmon.c Wed Mar 8 15:18:25 2000 +++ ecl-uclinux-2.4.x/drivers/video/fbmon.c Mon Feb 25 14:20:25 2002 @@ -46,31 +46,54 @@ int fbmon_valid_timings(u_int pixclock, u_int htotal, u_int vtotal, const struct fb_info *fb_info) { -#if 0 /* - * long long divisions .... $#%%#$ + * Ohhh, i discover the Secret of Ramses II tomb! + * _PLEASE_ note that this is only worth if you _FILL_ _UP_ + * a fb_monspecs with your monitor specs! + * If you don't do that, this will only check for vesa compatible + * modes at some "generic" multifrequency monitors! (not done yet) + * I will think in how to auto detect monitors, or maybe how you can tell in + * runtime what kind of monitor do you have. + * If you want to know the progress of that, email me at: carlos@embedded.cl + * Note 1: I don't assume nothing, so in htotal & vtotal use your values... + * if you want a sugestion use: htotal = hres * 1.2 and vtotal = vres * 1.1 + * Note 2: We only need to calculate one thing to see if your monitor will cook + * (please don't blame me if it cooks anyway, you must be aware that this function + * do its best to check but is not _the_ final answer! */ - unsigned long long hpicos, vpicos; - const unsigned long long _1e12 = 1000000000000ULL; - const struct fb_monspecs *monspecs = &fb_info->monspecs; - hpicos = (unsigned long long)htotal*(unsigned long long)pixclock; - vpicos = (unsigned long long)vtotal*(unsigned long long)hpicos; - if (!vpicos) - return 0; - - if (monspecs->hfmin == 0) + if( !fb_info->monspecs ) + { + /* + * Dear God... + */ + printk( KERN_INFO "fb: We could not check your monitor, due lack of monspecs!\n" ); return 1; - - if (hpicos*monspecs->hfmin > _1e12 || hpicos*monspecs->hfmax < _1e12 || - vpicos*monspecs->vfmin > _1e12 || vpicos*monspecs->vfmax < _1e12) + } + + if( pixelclock > (fb_info->monspecs.hfmax * htotal) ) + { + /* + * We will cook this monitor! + */ + printk( KERN_INFO "fb: To avoid cooking your monitor we won't use this resolution!\n" ); return 0; -#endif - return 1; + } + + /* + * If we get here, we're safe (almost) + */ + + return 1; } int fbmon_dpms(const struct fb_info *fb_info) { + if( !fb_info->monspecs ) + { + printk( KERN_INFO "fb: No monspecs!\n" ); + return -EINVAL; + } return fb_info->monspecs.dpms; }