hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/video/fbdev/macfb.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * macfb.c: Generic framebuffer for Macs whose colourmaps/modes we
34 * don't know how to set.
....@@ -17,10 +18,6 @@
1718 *
1819 * The VideoToolbox "Bugs" web page at
1920 * http://rajsky.psych.nyu.edu/Tips/VideoBugs.html
20
- *
21
- * This code is free software. You may copy, modify, and distribute
22
- * it subject to the terms and conditions of the GNU General Public
23
- * License, version 2, or any later version, at your convenience.
2421 */
2522
2623 #include <linux/module.h>
....@@ -120,10 +117,7 @@
120117 #define PIXEL_TO_MM(a) (((a)*10)/28) /* width in mm at 72 dpi */
121118
122119 static struct fb_var_screeninfo macfb_defined = {
123
- .bits_per_pixel = 8,
124120 .activate = FB_ACTIVATE_NOW,
125
- .width = -1,
126
- .height = -1,
127121 .right_margin = 32,
128122 .upper_margin = 16,
129123 .lower_margin = 4,
....@@ -139,7 +133,6 @@
139133 static void *slot_addr;
140134 static struct fb_info fb_info;
141135 static u32 pseudo_palette[16];
142
-static int inverse;
143136 static int vidtest;
144137
145138 /*
....@@ -152,7 +145,7 @@
152145 unsigned int green, unsigned int blue,
153146 struct fb_info *info)
154147 {
155
- static int lastreg = -1;
148
+ static int lastreg = -2;
156149 unsigned long flags;
157150
158151 local_irq_save(flags);
....@@ -201,9 +194,6 @@
201194 unsigned int bpp = info->var.bits_per_pixel;
202195 unsigned long flags;
203196
204
- if (bpp > 8)
205
- return 1; /* failsafe */
206
-
207197 local_irq_save(flags);
208198
209199 /* On these chips, the CLUT register numbers are spread out
....@@ -233,9 +223,6 @@
233223 struct fb_info *info)
234224 {
235225 unsigned long flags;
236
-
237
- if (info->var.bits_per_pixel > 8)
238
- return 1; /* failsafe */
239226
240227 local_irq_save(flags);
241228
....@@ -353,9 +340,6 @@
353340 unsigned long flags;
354341 int clut_status;
355342
356
- if (info->var.bits_per_pixel > 8)
357
- return 1; /* failsafe */
358
-
359343 local_irq_save(flags);
360344
361345 /* Set the register address */
....@@ -494,7 +478,7 @@
494478 break;
495479 /*
496480 * 24-bit colour almost doesn't exist on 68k Macs --
497
- * http://support.apple.com/kb/TA28634 (Old Article: 10992)
481
+ * https://support.apple.com/kb/TA28634 (Old Article: 10992)
498482 */
499483 case 24:
500484 case 32:
....@@ -512,7 +496,7 @@
512496 return 0;
513497 }
514498
515
-static struct fb_ops macfb_ops = {
499
+static const struct fb_ops macfb_ops = {
516500 .owner = THIS_MODULE,
517501 .fb_setcolreg = macfb_setcolreg,
518502 .fb_fillrect = cfb_fillrect,
....@@ -532,7 +516,7 @@
532516 continue;
533517
534518 if (!strcmp(this_opt, "inverse"))
535
- inverse = 1;
519
+ fb_invert_cmaps();
536520 else
537521 if (!strcmp(this_opt, "vidtest"))
538522 vidtest = 1; /* enable experimental CLUT code */
....@@ -688,17 +672,14 @@
688672 case NUBUS_DRHW_APPLE_MDC:
689673 strcpy(macfb_fix.id, "Mac Disp. Card");
690674 macfb_setpalette = mdc_setpalette;
691
- macfb_defined.activate = FB_ACTIVATE_NOW;
692675 break;
693676 case NUBUS_DRHW_APPLE_TFB:
694677 strcpy(macfb_fix.id, "Toby");
695678 macfb_setpalette = toby_setpalette;
696
- macfb_defined.activate = FB_ACTIVATE_NOW;
697679 break;
698680 case NUBUS_DRHW_APPLE_JET:
699681 strcpy(macfb_fix.id, "Jet");
700682 macfb_setpalette = jet_setpalette;
701
- macfb_defined.activate = FB_ACTIVATE_NOW;
702683 break;
703684 default:
704685 strcpy(macfb_fix.id, "Generic NuBus");
....@@ -731,7 +712,6 @@
731712 strcpy(macfb_fix.id, "DAFB");
732713 macfb_setpalette = dafb_setpalette;
733714 dafb_cmap_regs = ioremap(DAFB_BASE, 0x1000);
734
- macfb_defined.activate = FB_ACTIVATE_NOW;
735715 break;
736716
737717 /*
....@@ -741,7 +721,6 @@
741721 strcpy(macfb_fix.id, "V8");
742722 macfb_setpalette = v8_brazil_setpalette;
743723 v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
744
- macfb_defined.activate = FB_ACTIVATE_NOW;
745724 break;
746725
747726 /*
....@@ -755,7 +734,6 @@
755734 strcpy(macfb_fix.id, "Brazil");
756735 macfb_setpalette = v8_brazil_setpalette;
757736 v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
758
- macfb_defined.activate = FB_ACTIVATE_NOW;
759737 break;
760738
761739 /*
....@@ -772,7 +750,6 @@
772750 strcpy(macfb_fix.id, "Sonora");
773751 macfb_setpalette = v8_brazil_setpalette;
774752 v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
775
- macfb_defined.activate = FB_ACTIVATE_NOW;
776753 break;
777754
778755 /*
....@@ -785,7 +762,6 @@
785762 strcpy(macfb_fix.id, "RBV");
786763 macfb_setpalette = rbv_setpalette;
787764 rbv_cmap_regs = ioremap(DAC_BASE, 0x1000);
788
- macfb_defined.activate = FB_ACTIVATE_NOW;
789765 break;
790766
791767 /*
....@@ -796,7 +772,6 @@
796772 strcpy(macfb_fix.id, "Civic");
797773 macfb_setpalette = civic_setpalette;
798774 civic_cmap_regs = ioremap(CIVIC_BASE, 0x1000);
799
- macfb_defined.activate = FB_ACTIVATE_NOW;
800775 break;
801776
802777
....@@ -810,7 +785,6 @@
810785 macfb_setpalette = v8_brazil_setpalette;
811786 v8_brazil_cmap_regs =
812787 ioremap(DAC_BASE, 0x1000);
813
- macfb_defined.activate = FB_ACTIVATE_NOW;
814788 }
815789 break;
816790
....@@ -823,7 +797,6 @@
823797 macfb_setpalette = v8_brazil_setpalette;
824798 v8_brazil_cmap_regs =
825799 ioremap(DAC_BASE, 0x1000);
826
- macfb_defined.activate = FB_ACTIVATE_NOW;
827800 }
828801 break;
829802
....@@ -892,7 +865,6 @@
892865 strcpy(macfb_fix.id, "CSC");
893866 macfb_setpalette = csc_setpalette;
894867 csc_cmap_regs = ioremap(CSC_BASE, 0x1000);
895
- macfb_defined.activate = FB_ACTIVATE_NOW;
896868 break;
897869
898870 default: