.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /************************************************************************** |
---|
2 | 3 | * Copyright (c) 2007-2011, Intel Corporation. |
---|
3 | 4 | * All Rights Reserved. |
---|
4 | 5 | * Copyright (c) 2008, Tungsten Graphics, Inc. Cedar Park, TX., USA. |
---|
5 | 6 | * All Rights Reserved. |
---|
6 | 7 | * |
---|
7 | | - * This program is free software; you can redistribute it and/or modify it |
---|
8 | | - * under the terms and conditions of the GNU General Public License, |
---|
9 | | - * version 2, as published by the Free Software Foundation. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope it will be useful, but WITHOUT |
---|
12 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
13 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
14 | | - * more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License along with |
---|
17 | | - * this program; if not, write to the Free Software Foundation, Inc., |
---|
18 | | - * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
---|
19 | | - * |
---|
20 | 8 | **************************************************************************/ |
---|
21 | 9 | |
---|
22 | | -#include <drm/drmP.h> |
---|
| 10 | +#include <linux/cpu.h> |
---|
| 11 | +#include <linux/module.h> |
---|
| 12 | +#include <linux/notifier.h> |
---|
| 13 | +#include <linux/pm_runtime.h> |
---|
| 14 | +#include <linux/spinlock.h> |
---|
| 15 | + |
---|
| 16 | +#include <asm/set_memory.h> |
---|
| 17 | + |
---|
| 18 | +#include <acpi/video.h> |
---|
| 19 | + |
---|
23 | 20 | #include <drm/drm.h> |
---|
24 | | -#include "psb_drv.h" |
---|
| 21 | +#include <drm/drm_drv.h> |
---|
| 22 | +#include <drm/drm_fb_helper.h> |
---|
| 23 | +#include <drm/drm_file.h> |
---|
| 24 | +#include <drm/drm_ioctl.h> |
---|
| 25 | +#include <drm/drm_irq.h> |
---|
| 26 | +#include <drm/drm_pciids.h> |
---|
| 27 | +#include <drm/drm_vblank.h> |
---|
| 28 | + |
---|
25 | 29 | #include "framebuffer.h" |
---|
26 | | -#include "psb_reg.h" |
---|
27 | | -#include "psb_intel_reg.h" |
---|
28 | 30 | #include "intel_bios.h" |
---|
29 | 31 | #include "mid_bios.h" |
---|
30 | | -#include <drm/drm_pciids.h> |
---|
31 | 32 | #include "power.h" |
---|
32 | | -#include <linux/cpu.h> |
---|
33 | | -#include <linux/notifier.h> |
---|
34 | | -#include <linux/spinlock.h> |
---|
35 | | -#include <linux/pm_runtime.h> |
---|
36 | | -#include <acpi/video.h> |
---|
37 | | -#include <linux/module.h> |
---|
38 | | -#include <asm/set_memory.h> |
---|
| 33 | +#include "psb_drv.h" |
---|
| 34 | +#include "psb_intel_reg.h" |
---|
| 35 | +#include "psb_reg.h" |
---|
39 | 36 | |
---|
40 | 37 | static struct drm_driver driver; |
---|
41 | 38 | static int psb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent); |
---|
.. | .. |
---|
259 | 256 | PSB_AUX_RESOURCE); |
---|
260 | 257 | resource_len = pci_resource_len(dev_priv->aux_pdev, |
---|
261 | 258 | PSB_AUX_RESOURCE); |
---|
262 | | - dev_priv->aux_reg = ioremap_nocache(resource_start, |
---|
| 259 | + dev_priv->aux_reg = ioremap(resource_start, |
---|
263 | 260 | resource_len); |
---|
264 | 261 | if (!dev_priv->aux_reg) |
---|
265 | 262 | goto out_err; |
---|
.. | .. |
---|
368 | 365 | drm_irq_install(dev, dev->pdev->irq); |
---|
369 | 366 | |
---|
370 | 367 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ |
---|
371 | | - dev->driver->get_vblank_counter = psb_get_vblank_counter; |
---|
372 | 368 | |
---|
373 | 369 | psb_modeset_init(dev); |
---|
374 | 370 | psb_fbdev_init(dev); |
---|
.. | .. |
---|
431 | 427 | |
---|
432 | 428 | static int psb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
---|
433 | 429 | { |
---|
434 | | - return drm_get_pci_dev(pdev, ent, &driver); |
---|
435 | | -} |
---|
| 430 | + struct drm_device *dev; |
---|
| 431 | + int ret; |
---|
436 | 432 | |
---|
| 433 | + ret = pci_enable_device(pdev); |
---|
| 434 | + if (ret) |
---|
| 435 | + return ret; |
---|
| 436 | + |
---|
| 437 | + dev = drm_dev_alloc(&driver, &pdev->dev); |
---|
| 438 | + if (IS_ERR(dev)) { |
---|
| 439 | + ret = PTR_ERR(dev); |
---|
| 440 | + goto err_pci_disable_device; |
---|
| 441 | + } |
---|
| 442 | + |
---|
| 443 | + dev->pdev = pdev; |
---|
| 444 | + pci_set_drvdata(pdev, dev); |
---|
| 445 | + |
---|
| 446 | + ret = psb_driver_load(dev, ent->driver_data); |
---|
| 447 | + if (ret) |
---|
| 448 | + goto err_drm_dev_put; |
---|
| 449 | + |
---|
| 450 | + ret = drm_dev_register(dev, ent->driver_data); |
---|
| 451 | + if (ret) |
---|
| 452 | + goto err_psb_driver_unload; |
---|
| 453 | + |
---|
| 454 | + return 0; |
---|
| 455 | + |
---|
| 456 | +err_psb_driver_unload: |
---|
| 457 | + psb_driver_unload(dev); |
---|
| 458 | +err_drm_dev_put: |
---|
| 459 | + drm_dev_put(dev); |
---|
| 460 | +err_pci_disable_device: |
---|
| 461 | + pci_disable_device(pdev); |
---|
| 462 | + return ret; |
---|
| 463 | +} |
---|
437 | 464 | |
---|
438 | 465 | static void psb_pci_remove(struct pci_dev *pdev) |
---|
439 | 466 | { |
---|
440 | 467 | struct drm_device *dev = pci_get_drvdata(pdev); |
---|
441 | | - drm_put_dev(dev); |
---|
| 468 | + |
---|
| 469 | + drm_dev_unregister(dev); |
---|
| 470 | + psb_driver_unload(dev); |
---|
| 471 | + drm_dev_put(dev); |
---|
442 | 472 | } |
---|
443 | 473 | |
---|
444 | 474 | static const struct dev_pm_ops psb_pm_ops = { |
---|
.. | .. |
---|
470 | 500 | }; |
---|
471 | 501 | |
---|
472 | 502 | static struct drm_driver driver = { |
---|
473 | | - .driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | \ |
---|
474 | | - DRIVER_MODESET | DRIVER_GEM, |
---|
475 | | - .load = psb_driver_load, |
---|
476 | | - .unload = psb_driver_unload, |
---|
| 503 | + .driver_features = DRIVER_MODESET | DRIVER_GEM, |
---|
477 | 504 | .lastclose = drm_fb_helper_lastclose, |
---|
478 | 505 | |
---|
479 | 506 | .num_ioctls = ARRAY_SIZE(psb_ioctls), |
---|
.. | .. |
---|
481 | 508 | .irq_postinstall = psb_irq_postinstall, |
---|
482 | 509 | .irq_uninstall = psb_irq_uninstall, |
---|
483 | 510 | .irq_handler = psb_irq_handler, |
---|
484 | | - .enable_vblank = psb_enable_vblank, |
---|
485 | | - .disable_vblank = psb_disable_vblank, |
---|
486 | | - .get_vblank_counter = psb_get_vblank_counter, |
---|
487 | 511 | |
---|
488 | | - .gem_free_object = psb_gem_free_object, |
---|
| 512 | + .gem_free_object_unlocked = psb_gem_free_object, |
---|
489 | 513 | .gem_vm_ops = &psb_gem_vm_ops, |
---|
490 | 514 | |
---|
491 | 515 | .dumb_create = psb_gem_dumb_create, |
---|