hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/video/fbdev/geode/gxfb_core.c
....@@ -1,13 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Geode GX framebuffer driver.
34 *
45 * Copyright (C) 2006 Arcom Control Systems Ltd.
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License as published by the
8
- * Free Software Foundation; either version 2 of the License, or (at your
9
- * option) any later version.
10
- *
116 *
127 * This driver assumes that the BIOS has created a virtual PCI device header
138 * for the video device. The PCI header is assumed to contain the following
....@@ -32,6 +27,8 @@
3227 #include <linux/init.h>
3328 #include <linux/pci.h>
3429 #include <linux/cs5535.h>
30
+
31
+#include <asm/olpc.h>
3532
3633 #include "gxfb.h"
3734
....@@ -107,9 +104,6 @@
107104 FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
108105 };
109106
110
-#ifdef CONFIG_OLPC
111
-#include <asm/olpc.h>
112
-
113107 static struct fb_videomode gx_dcon_modedb[] = {
114108 /* The only mode the DCON has is 1200x900 */
115109 { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3,
....@@ -127,14 +121,6 @@
127121 *size = ARRAY_SIZE(gx_modedb);
128122 }
129123 }
130
-
131
-#else
132
-static void get_modedb(struct fb_videomode **modedb, unsigned int *size)
133
-{
134
- *modedb = (struct fb_videomode *) gx_modedb;
135
- *size = ARRAY_SIZE(gx_modedb);
136
-}
137
-#endif
138124
139125 static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
140126 {
....@@ -279,7 +265,7 @@
279265 return 0;
280266 }
281267
282
-static struct fb_ops gxfb_ops = {
268
+static const struct fb_ops gxfb_ops = {
283269 .owner = THIS_MODULE,
284270 .fb_check_var = gxfb_check_var,
285271 .fb_set_par = gxfb_set_par,
....@@ -336,17 +322,14 @@
336322 return info;
337323 }
338324
339
-#ifdef CONFIG_PM
340
-static int gxfb_suspend(struct pci_dev *pdev, pm_message_t state)
325
+static int __maybe_unused gxfb_suspend(struct device *dev)
341326 {
342
- struct fb_info *info = pci_get_drvdata(pdev);
327
+ struct fb_info *info = dev_get_drvdata(dev);
343328
344
- if (state.event == PM_EVENT_SUSPEND) {
345
- console_lock();
346
- gx_powerdown(info);
347
- fb_set_suspend(info, 1);
348
- console_unlock();
349
- }
329
+ console_lock();
330
+ gx_powerdown(info);
331
+ fb_set_suspend(info, 1);
332
+ console_unlock();
350333
351334 /* there's no point in setting PCI states; we emulate PCI, so
352335 * we don't end up getting power savings anyways */
....@@ -354,9 +337,9 @@
354337 return 0;
355338 }
356339
357
-static int gxfb_resume(struct pci_dev *pdev)
340
+static int __maybe_unused gxfb_resume(struct device *dev)
358341 {
359
- struct fb_info *info = pci_get_drvdata(pdev);
342
+ struct fb_info *info = dev_get_drvdata(dev);
360343 int ret;
361344
362345 console_lock();
....@@ -370,7 +353,6 @@
370353 console_unlock();
371354 return 0;
372355 }
373
-#endif
374356
375357 static int gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
376358 {
....@@ -481,15 +463,23 @@
481463
482464 MODULE_DEVICE_TABLE(pci, gxfb_id_table);
483465
466
+static const struct dev_pm_ops gxfb_pm_ops = {
467
+#ifdef CONFIG_PM_SLEEP
468
+ .suspend = gxfb_suspend,
469
+ .resume = gxfb_resume,
470
+ .freeze = NULL,
471
+ .thaw = gxfb_resume,
472
+ .poweroff = NULL,
473
+ .restore = gxfb_resume,
474
+#endif
475
+};
476
+
484477 static struct pci_driver gxfb_driver = {
485478 .name = "gxfb",
486479 .id_table = gxfb_id_table,
487480 .probe = gxfb_probe,
488481 .remove = gxfb_remove,
489
-#ifdef CONFIG_PM
490
- .suspend = gxfb_suspend,
491
- .resume = gxfb_resume,
492
-#endif
482
+ .driver.pm = &gxfb_pm_ops,
493483 };
494484
495485 #ifndef MODULE