aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/modedb.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-02-17 15:09:59 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-17 15:09:59 -0500
commit48c871c1f6a7c7044dd76774fb469e65c7e2e4e8 (patch)
treeda3aa535c98cc0957851354ceb0fbff7482d7a9d /drivers/video/modedb.c
parent1a1689344add3333d28d1b5495d8043a3877d01c (diff)
parent4409d28140d9a6e6e3f4f1fdaf7234c4b965d954 (diff)
Merge branch 'gfar' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc into upstream
Diffstat (limited to 'drivers/video/modedb.c')
-rw-r--r--drivers/video/modedb.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 5df41f6f2b86..5162eab95539 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -610,10 +610,8 @@ done:
610 diff = refresh; 610 diff = refresh;
611 best = -1; 611 best = -1;
612 for (i = 0; i < dbsize; i++) { 612 for (i = 0; i < dbsize; i++) {
613 if ((name_matches(db[i], name, namelen) && 613 if (name_matches(db[i], name, namelen) ||
614 !fb_try_mode(var, info, &db[i], bpp))) 614 (res_specified && res_matches(db[i], xres, yres))) {
615 return 1;
616 if (res_specified && res_matches(db[i], xres, yres)) {
617 if(!fb_try_mode(var, info, &db[i], bpp)) { 615 if(!fb_try_mode(var, info, &db[i], bpp)) {
618 if(!refresh_specified || db[i].refresh == refresh) 616 if(!refresh_specified || db[i].refresh == refresh)
619 return 1; 617 return 1;
@@ -670,7 +668,7 @@ done:
670 * @var: pointer to struct fb_var_screeninfo 668 * @var: pointer to struct fb_var_screeninfo
671 */ 669 */
672void fb_var_to_videomode(struct fb_videomode *mode, 670void fb_var_to_videomode(struct fb_videomode *mode,
673 struct fb_var_screeninfo *var) 671 const struct fb_var_screeninfo *var)
674{ 672{
675 u32 pixclock, hfreq, htotal, vtotal; 673 u32 pixclock, hfreq, htotal, vtotal;
676 674
@@ -714,17 +712,21 @@ void fb_var_to_videomode(struct fb_videomode *mode,
714 * @mode: pointer to struct fb_videomode 712 * @mode: pointer to struct fb_videomode
715 */ 713 */
716void fb_videomode_to_var(struct fb_var_screeninfo *var, 714void fb_videomode_to_var(struct fb_var_screeninfo *var,
717 struct fb_videomode *mode) 715 const struct fb_videomode *mode)
718{ 716{
719 var->xres = mode->xres; 717 var->xres = mode->xres;
720 var->yres = mode->yres; 718 var->yres = mode->yres;
719 var->xres_virtual = mode->xres;
720 var->yres_virtual = mode->yres;
721 var->xoffset = 0;
722 var->yoffset = 0;
721 var->pixclock = mode->pixclock; 723 var->pixclock = mode->pixclock;
722 var->left_margin = mode->left_margin; 724 var->left_margin = mode->left_margin;
723 var->hsync_len = mode->hsync_len;
724 var->vsync_len = mode->vsync_len;
725 var->right_margin = mode->right_margin; 725 var->right_margin = mode->right_margin;
726 var->upper_margin = mode->upper_margin; 726 var->upper_margin = mode->upper_margin;
727 var->lower_margin = mode->lower_margin; 727 var->lower_margin = mode->lower_margin;
728 var->hsync_len = mode->hsync_len;
729 var->vsync_len = mode->vsync_len;
728 var->sync = mode->sync; 730 var->sync = mode->sync;
729 var->vmode = mode->vmode & FB_VMODE_MASK; 731 var->vmode = mode->vmode & FB_VMODE_MASK;
730} 732}
@@ -737,8 +739,8 @@ void fb_videomode_to_var(struct fb_var_screeninfo *var,
737 * RETURNS: 739 * RETURNS:
738 * 1 if equal, 0 if not 740 * 1 if equal, 0 if not
739 */ 741 */
740int fb_mode_is_equal(struct fb_videomode *mode1, 742int fb_mode_is_equal(const struct fb_videomode *mode1,
741 struct fb_videomode *mode2) 743 const struct fb_videomode *mode2)
742{ 744{
743 return (mode1->xres == mode2->xres && 745 return (mode1->xres == mode2->xres &&
744 mode1->yres == mode2->yres && 746 mode1->yres == mode2->yres &&
@@ -770,8 +772,8 @@ int fb_mode_is_equal(struct fb_videomode *mode1,
770 * var->xres and var->yres. If more than 1 videomode is found, will return 772 * var->xres and var->yres. If more than 1 videomode is found, will return
771 * the videomode with the highest refresh rate 773 * the videomode with the highest refresh rate
772 */ 774 */
773struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var, 775const struct fb_videomode *fb_find_best_mode(const struct fb_var_screeninfo *var,
774 struct list_head *head) 776 struct list_head *head)
775{ 777{
776 struct list_head *pos; 778 struct list_head *pos;
777 struct fb_modelist *modelist; 779 struct fb_modelist *modelist;
@@ -808,8 +810,8 @@ struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var,
808 * If more than 1 videomode is found, will return the videomode with 810 * If more than 1 videomode is found, will return the videomode with
809 * the closest refresh rate. 811 * the closest refresh rate.
810 */ 812 */
811struct fb_videomode *fb_find_nearest_mode(struct fb_videomode *mode, 813const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode,
812 struct list_head *head) 814 struct list_head *head)
813{ 815{
814 struct list_head *pos; 816 struct list_head *pos;
815 struct fb_modelist *modelist; 817 struct fb_modelist *modelist;
@@ -847,8 +849,8 @@ struct fb_videomode *fb_find_nearest_mode(struct fb_videomode *mode,
847 * RETURNS: 849 * RETURNS:
848 * struct fb_videomode, NULL if none found 850 * struct fb_videomode, NULL if none found
849 */ 851 */
850struct fb_videomode *fb_match_mode(struct fb_var_screeninfo *var, 852const struct fb_videomode *fb_match_mode(const struct fb_var_screeninfo *var,
851 struct list_head *head) 853 struct list_head *head)
852{ 854{
853 struct list_head *pos; 855 struct list_head *pos;
854 struct fb_modelist *modelist; 856 struct fb_modelist *modelist;
@@ -872,7 +874,7 @@ struct fb_videomode *fb_match_mode(struct fb_var_screeninfo *var,
872 * NOTES: 874 * NOTES:
873 * Will only add unmatched mode entries 875 * Will only add unmatched mode entries
874 */ 876 */
875int fb_add_videomode(struct fb_videomode *mode, struct list_head *head) 877int fb_add_videomode(const struct fb_videomode *mode, struct list_head *head)
876{ 878{
877 struct list_head *pos; 879 struct list_head *pos;
878 struct fb_modelist *modelist; 880 struct fb_modelist *modelist;
@@ -907,7 +909,8 @@ int fb_add_videomode(struct fb_videomode *mode, struct list_head *head)
907 * NOTES: 909 * NOTES:
908 * Will remove all matching mode entries 910 * Will remove all matching mode entries
909 */ 911 */
910void fb_delete_videomode(struct fb_videomode *mode, struct list_head *head) 912void fb_delete_videomode(const struct fb_videomode *mode,
913 struct list_head *head)
911{ 914{
912 struct list_head *pos, *n; 915 struct list_head *pos, *n;
913 struct fb_modelist *modelist; 916 struct fb_modelist *modelist;
@@ -943,7 +946,7 @@ void fb_destroy_modelist(struct list_head *head)
943 * @num: number of entries in array 946 * @num: number of entries in array
944 * @head: struct list_head of modelist 947 * @head: struct list_head of modelist
945 */ 948 */
946void fb_videomode_to_modelist(struct fb_videomode *modedb, int num, 949void fb_videomode_to_modelist(const struct fb_videomode *modedb, int num,
947 struct list_head *head) 950 struct list_head *head)
948{ 951{
949 int i; 952 int i;
@@ -956,12 +959,12 @@ void fb_videomode_to_modelist(struct fb_videomode *modedb, int num,
956 } 959 }
957} 960}
958 961
959struct fb_videomode *fb_find_best_display(struct fb_monspecs *specs, 962const struct fb_videomode *fb_find_best_display(const struct fb_monspecs *specs,
960 struct list_head *head) 963 struct list_head *head)
961{ 964{
962 struct list_head *pos; 965 struct list_head *pos;
963 struct fb_modelist *modelist; 966 struct fb_modelist *modelist;
964 struct fb_videomode *m, *m1 = NULL, *md = NULL, *best = NULL; 967 const struct fb_videomode *m, *m1 = NULL, *md = NULL, *best = NULL;
965 int first = 0; 968 int first = 0;
966 969
967 if (!head->prev || !head->next || list_empty(head)) 970 if (!head->prev || !head->next || list_empty(head))