hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/video/fbdev/aty/radeon_pm.c
....@@ -1208,11 +1208,11 @@
12081208 case 1:
12091209 if (mc & 0x4)
12101210 break;
1211
- /* fall through */
1211
+ fallthrough;
12121212 case 2:
12131213 dll_sleep_mask |= MDLL_R300_RDCK__MRDCKB_SLEEP;
12141214 dll_reset_mask |= MDLL_R300_RDCK__MRDCKB_RESET;
1215
- /* fall through */
1215
+ fallthrough;
12161216 case 0:
12171217 dll_sleep_mask |= MDLL_R300_RDCK__MRDCKA_SLEEP;
12181218 dll_reset_mask |= MDLL_R300_RDCK__MRDCKA_RESET;
....@@ -1221,7 +1221,7 @@
12211221 case 1:
12221222 if (!(mc & 0x4))
12231223 break;
1224
- /* fall through */
1224
+ fallthrough;
12251225 case 2:
12261226 dll_sleep_mask |= MDLL_R300_RDCK__MRDCKD_SLEEP;
12271227 dll_reset_mask |= MDLL_R300_RDCK__MRDCKD_RESET;
....@@ -1431,7 +1431,6 @@
14311431 mdelay( 15);
14321432 }
14331433
1434
-#if defined(CONFIG_PM)
14351434 #if defined(CONFIG_X86) || defined(CONFIG_PPC_PMAC)
14361435 static void radeon_pm_reset_pad_ctlr_strength(struct radeonfb_info *rinfo)
14371436 {
....@@ -2210,7 +2209,6 @@
22102209 radeon_pm_m10_enable_lvds_spread_spectrum(rinfo);
22112210 }
22122211 #endif
2213
-#endif
22142212
22152213 #if 0 /* Not ready yet */
22162214 static void radeon_reinitialize_QW(struct radeonfb_info *rinfo)
....@@ -2593,7 +2591,7 @@
25932591 * calling pci_set_power_state()
25942592 */
25952593 radeonfb_whack_power_state(rinfo, PCI_D2);
2596
- __pci_complete_power_transition(rinfo->pdev, PCI_D2);
2594
+ pci_platform_power_transition(rinfo->pdev, PCI_D2);
25972595 } else {
25982596 printk(KERN_DEBUG "radeonfb (%s): switching to D0 state...\n",
25992597 pci_name(rinfo->pdev));
....@@ -2613,8 +2611,9 @@
26132611 }
26142612 }
26152613
2616
-int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
2614
+static int radeonfb_pci_suspend_late(struct device *dev, pm_message_t mesg)
26172615 {
2616
+ struct pci_dev *pdev = to_pci_dev(dev);
26182617 struct fb_info *info = pci_get_drvdata(pdev);
26192618 struct radeonfb_info *rinfo = info->par;
26202619
....@@ -2662,11 +2661,6 @@
26622661 pmac_suspend_agp_for_card(pdev);
26632662 #endif /* CONFIG_PPC_PMAC */
26642663
2665
- /* It's unclear whether or when the generic code will do that, so let's
2666
- * do it ourselves. We save state before we do any power management
2667
- */
2668
- pci_save_state(pdev);
2669
-
26702664 /* If we support wakeup from poweroff, we save all regs we can including cfg
26712665 * space
26722666 */
....@@ -2691,7 +2685,6 @@
26912685 msleep(20);
26922686 OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_DIGON));
26932687 }
2694
- pci_disable_device(pdev);
26952688 }
26962689 /* If we support D2, we go to it (should be fixed later with a flag forcing
26972690 * D3 only for some laptops)
....@@ -2707,6 +2700,21 @@
27072700 return 0;
27082701 }
27092702
2703
+static int radeonfb_pci_suspend(struct device *dev)
2704
+{
2705
+ return radeonfb_pci_suspend_late(dev, PMSG_SUSPEND);
2706
+}
2707
+
2708
+static int radeonfb_pci_hibernate(struct device *dev)
2709
+{
2710
+ return radeonfb_pci_suspend_late(dev, PMSG_HIBERNATE);
2711
+}
2712
+
2713
+static int radeonfb_pci_freeze(struct device *dev)
2714
+{
2715
+ return radeonfb_pci_suspend_late(dev, PMSG_FREEZE);
2716
+}
2717
+
27102718 static int radeon_check_power_loss(struct radeonfb_info *rinfo)
27112719 {
27122720 return rinfo->save_regs[4] != INPLL(CLK_PIN_CNTL) ||
....@@ -2714,8 +2722,9 @@
27142722 rinfo->save_regs[3] != INPLL(SCLK_CNTL);
27152723 }
27162724
2717
-int radeonfb_pci_resume(struct pci_dev *pdev)
2725
+static int radeonfb_pci_resume(struct device *dev)
27182726 {
2727
+ struct pci_dev *pdev = to_pci_dev(dev);
27192728 struct fb_info *info = pci_get_drvdata(pdev);
27202729 struct radeonfb_info *rinfo = info->par;
27212730 int rc = 0;
....@@ -2797,6 +2806,15 @@
27972806 return rc;
27982807 }
27992808
2809
+const struct dev_pm_ops radeonfb_pci_pm_ops = {
2810
+ .suspend = radeonfb_pci_suspend,
2811
+ .resume = radeonfb_pci_resume,
2812
+ .freeze = radeonfb_pci_freeze,
2813
+ .thaw = radeonfb_pci_resume,
2814
+ .poweroff = radeonfb_pci_hibernate,
2815
+ .restore = radeonfb_pci_resume,
2816
+};
2817
+
28002818 #ifdef CONFIG_PPC__disabled
28012819 static void radeonfb_early_resume(void *data)
28022820 {
....@@ -2844,8 +2862,8 @@
28442862 * in some desktop G4s), Via (M9+ chip on iBook G4) and
28452863 * Snowy (M11 chip on iBook G4 manufactured after July 2005)
28462864 */
2847
- if (!strcmp(rinfo->of_node->name, "ATY,JasperParent") ||
2848
- !strcmp(rinfo->of_node->name, "ATY,SnowyParent")) {
2865
+ if (of_node_name_eq(rinfo->of_node, "ATY,JasperParent") ||
2866
+ of_node_name_eq(rinfo->of_node, "ATY,SnowyParent")) {
28492867 rinfo->reinit_func = radeon_reinitialize_M10;
28502868 rinfo->pm_mode |= radeon_pm_off;
28512869 }
....@@ -2855,7 +2873,7 @@
28552873 rinfo->pm_mode |= radeon_pm_off;
28562874 }
28572875 #endif
2858
- if (!strcmp(rinfo->of_node->name, "ATY,ViaParent")) {
2876
+ if (of_node_name_eq(rinfo->of_node, "ATY,ViaParent")) {
28592877 rinfo->reinit_func = radeon_reinitialize_M9P;
28602878 rinfo->pm_mode |= radeon_pm_off;
28612879 }