.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Geode GX framebuffer driver. |
---|
3 | 4 | * |
---|
4 | 5 | * 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 | | - * |
---|
11 | 6 | * |
---|
12 | 7 | * This driver assumes that the BIOS has created a virtual PCI device header |
---|
13 | 8 | * for the video device. The PCI header is assumed to contain the following |
---|
.. | .. |
---|
32 | 27 | #include <linux/init.h> |
---|
33 | 28 | #include <linux/pci.h> |
---|
34 | 29 | #include <linux/cs5535.h> |
---|
| 30 | + |
---|
| 31 | +#include <asm/olpc.h> |
---|
35 | 32 | |
---|
36 | 33 | #include "gxfb.h" |
---|
37 | 34 | |
---|
.. | .. |
---|
107 | 104 | FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA }, |
---|
108 | 105 | }; |
---|
109 | 106 | |
---|
110 | | -#ifdef CONFIG_OLPC |
---|
111 | | -#include <asm/olpc.h> |
---|
112 | | - |
---|
113 | 107 | static struct fb_videomode gx_dcon_modedb[] = { |
---|
114 | 108 | /* The only mode the DCON has is 1200x900 */ |
---|
115 | 109 | { NULL, 50, 1200, 900, 17460, 24, 8, 4, 5, 8, 3, |
---|
.. | .. |
---|
127 | 121 | *size = ARRAY_SIZE(gx_modedb); |
---|
128 | 122 | } |
---|
129 | 123 | } |
---|
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 |
---|
138 | 124 | |
---|
139 | 125 | static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
---|
140 | 126 | { |
---|
.. | .. |
---|
279 | 265 | return 0; |
---|
280 | 266 | } |
---|
281 | 267 | |
---|
282 | | -static struct fb_ops gxfb_ops = { |
---|
| 268 | +static const struct fb_ops gxfb_ops = { |
---|
283 | 269 | .owner = THIS_MODULE, |
---|
284 | 270 | .fb_check_var = gxfb_check_var, |
---|
285 | 271 | .fb_set_par = gxfb_set_par, |
---|
.. | .. |
---|
336 | 322 | return info; |
---|
337 | 323 | } |
---|
338 | 324 | |
---|
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) |
---|
341 | 326 | { |
---|
342 | | - struct fb_info *info = pci_get_drvdata(pdev); |
---|
| 327 | + struct fb_info *info = dev_get_drvdata(dev); |
---|
343 | 328 | |
---|
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(); |
---|
350 | 333 | |
---|
351 | 334 | /* there's no point in setting PCI states; we emulate PCI, so |
---|
352 | 335 | * we don't end up getting power savings anyways */ |
---|
.. | .. |
---|
354 | 337 | return 0; |
---|
355 | 338 | } |
---|
356 | 339 | |
---|
357 | | -static int gxfb_resume(struct pci_dev *pdev) |
---|
| 340 | +static int __maybe_unused gxfb_resume(struct device *dev) |
---|
358 | 341 | { |
---|
359 | | - struct fb_info *info = pci_get_drvdata(pdev); |
---|
| 342 | + struct fb_info *info = dev_get_drvdata(dev); |
---|
360 | 343 | int ret; |
---|
361 | 344 | |
---|
362 | 345 | console_lock(); |
---|
.. | .. |
---|
370 | 353 | console_unlock(); |
---|
371 | 354 | return 0; |
---|
372 | 355 | } |
---|
373 | | -#endif |
---|
374 | 356 | |
---|
375 | 357 | static int gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
---|
376 | 358 | { |
---|
.. | .. |
---|
481 | 463 | |
---|
482 | 464 | MODULE_DEVICE_TABLE(pci, gxfb_id_table); |
---|
483 | 465 | |
---|
| 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 | + |
---|
484 | 477 | static struct pci_driver gxfb_driver = { |
---|
485 | 478 | .name = "gxfb", |
---|
486 | 479 | .id_table = gxfb_id_table, |
---|
487 | 480 | .probe = gxfb_probe, |
---|
488 | 481 | .remove = gxfb_remove, |
---|
489 | | -#ifdef CONFIG_PM |
---|
490 | | - .suspend = gxfb_suspend, |
---|
491 | | - .resume = gxfb_resume, |
---|
492 | | -#endif |
---|
| 482 | + .driver.pm = &gxfb_pm_ops, |
---|
493 | 483 | }; |
---|
494 | 484 | |
---|
495 | 485 | #ifndef MODULE |
---|