hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/video/fbdev/aty/radeon_base.c
....@@ -269,11 +269,7 @@
269269 static bool nomtrr = 0;
270270 static bool force_sleep;
271271 static bool ignore_devlist;
272
-#ifdef CONFIG_PMAC_BACKLIGHT
273
-static int backlight = 1;
274
-#else
275
-static int backlight = 0;
276
-#endif
272
+static int backlight = IS_BUILTIN(CONFIG_PMAC_BACKLIGHT);
277273
278274 /* Note about this function: we have some rare cases where we must not schedule,
279275 * this typically happen with our special "wake up early" hook which allows us to
....@@ -849,12 +845,6 @@
849845 case 9 ... 16:
850846 v.bits_per_pixel = 16;
851847 break;
852
- case 17 ... 24:
853
-#if 0 /* Doesn't seem to work */
854
- v.bits_per_pixel = 24;
855
- break;
856
-#endif
857
- return -EINVAL;
858848 case 25 ... 32:
859849 v.bits_per_pixel = 32;
860850 break;
....@@ -1650,14 +1640,14 @@
16501640 struct fb_var_screeninfo *mode = &info->var;
16511641 struct radeon_regs *newmode;
16521642 int hTotal, vTotal, hSyncStart, hSyncEnd,
1653
- hSyncPol, vSyncStart, vSyncEnd, vSyncPol, cSync;
1643
+ vSyncStart, vSyncEnd;
16541644 u8 hsync_adj_tab[] = {0, 0x12, 9, 9, 6, 5};
16551645 u8 hsync_fudge_fp[] = {2, 2, 0, 0, 5, 5};
16561646 u32 sync, h_sync_pol, v_sync_pol, dotClock, pixClock;
16571647 int i, freq;
16581648 int format = 0;
16591649 int nopllcalc = 0;
1660
- int hsync_start, hsync_fudge, bytpp, hsync_wid, vsync_wid;
1650
+ int hsync_start, hsync_fudge, hsync_wid, vsync_wid;
16611651 int primary_mon = PRIMARY_MONITOR(rinfo);
16621652 int depth = var_to_depth(mode);
16631653 int use_rmx = 0;
....@@ -1730,13 +1720,7 @@
17301720 else if (vsync_wid > 0x1f) /* max */
17311721 vsync_wid = 0x1f;
17321722
1733
- hSyncPol = mode->sync & FB_SYNC_HOR_HIGH_ACT ? 0 : 1;
1734
- vSyncPol = mode->sync & FB_SYNC_VERT_HIGH_ACT ? 0 : 1;
1735
-
1736
- cSync = mode->sync & FB_SYNC_COMP_HIGH_ACT ? (1 << 4) : 0;
1737
-
17381723 format = radeon_get_dstbpp(depth);
1739
- bytpp = mode->bits_per_pixel >> 3;
17401724
17411725 if ((primary_mon == MT_DFP) || (primary_mon == MT_LCD))
17421726 hsync_fudge = hsync_fudge_fp[format-1];
....@@ -1965,7 +1949,7 @@
19651949 }
19661950
19671951
1968
-static struct fb_ops radeonfb_ops = {
1952
+static const struct fb_ops radeonfb_ops = {
19691953 .owner = THIS_MODULE,
19701954 .fb_check_var = radeonfb_check_var,
19711955 .fb_set_par = radeonfb_set_par,
....@@ -2217,8 +2201,7 @@
22172201 char *buf, loff_t off, size_t count)
22182202 {
22192203 struct device *dev = container_of(kobj, struct device, kobj);
2220
- struct pci_dev *pdev = to_pci_dev(dev);
2221
- struct fb_info *info = pci_get_drvdata(pdev);
2204
+ struct fb_info *info = dev_get_drvdata(dev);
22222205 struct radeonfb_info *rinfo = info->par;
22232206
22242207 return radeon_show_one_edid(buf, off, count, rinfo->mon1_EDID);
....@@ -2230,8 +2213,7 @@
22302213 char *buf, loff_t off, size_t count)
22312214 {
22322215 struct device *dev = container_of(kobj, struct device, kobj);
2233
- struct pci_dev *pdev = to_pci_dev(dev);
2234
- struct fb_info *info = pci_get_drvdata(pdev);
2216
+ struct fb_info *info = dev_get_drvdata(dev);
22352217 struct radeonfb_info *rinfo = info->par;
22362218
22372219 return radeon_show_one_edid(buf, off, count, rinfo->mon2_EDID);
....@@ -2294,8 +2276,6 @@
22942276
22952277 info = framebuffer_alloc(sizeof(struct radeonfb_info), &pdev->dev);
22962278 if (!info) {
2297
- printk (KERN_ERR "radeonfb (%s): could not allocate memory\n",
2298
- pci_name(pdev));
22992279 ret = -ENOMEM;
23002280 goto err_disable;
23012281 }
....@@ -2552,16 +2532,6 @@
25522532 if (rinfo->mon2_EDID)
25532533 sysfs_remove_bin_file(&rinfo->pdev->dev.kobj, &edid2_attr);
25542534
2555
-#if 0
2556
- /* restore original state
2557
- *
2558
- * Doesn't quite work yet, I suspect if we come from a legacy
2559
- * VGA mode (or worse, text mode), we need to do some VGA black
2560
- * magic here that I know nothing about. --BenH
2561
- */
2562
- radeon_write_mode (rinfo, &rinfo->init_state, 1);
2563
- #endif
2564
-
25652535 del_timer_sync(&rinfo->lvds_timer);
25662536 arch_phys_wc_del(rinfo->wc_cookie);
25672537 unregister_framebuffer(info);
....@@ -2585,16 +2555,18 @@
25852555 framebuffer_release(info);
25862556 }
25872557
2558
+#ifdef CONFIG_PM
2559
+#define RADEONFB_PCI_PM_OPS (&radeonfb_pci_pm_ops)
2560
+#else
2561
+#define RADEONFB_PCI_PM_OPS NULL
2562
+#endif
25882563
25892564 static struct pci_driver radeonfb_driver = {
25902565 .name = "radeonfb",
25912566 .id_table = radeonfb_pci_table,
25922567 .probe = radeonfb_pci_register,
25932568 .remove = radeonfb_pci_unregister,
2594
-#ifdef CONFIG_PM
2595
- .suspend = radeonfb_pci_suspend,
2596
- .resume = radeonfb_pci_resume,
2597
-#endif /* CONFIG_PM */
2569
+ .driver.pm = RADEONFB_PCI_PM_OPS,
25982570 };
25992571
26002572 #ifndef MODULE