blob: 5751446677d382428846b14fc6d37d908bb582b9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/**
2 * \file radeon_drv.c
3 * ATI Radeon driver
4 *
5 * \author Gareth Hughes <gareth@valinux.com>
6 */
7
8/*
9 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
10 * All Rights Reserved.
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice (including the next
20 * paragraph) shall be included in all copies or substantial portions of the
21 * Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29 * OTHER DEALINGS IN THE SOFTWARE.
30 */
31
David Howells760285e2012-10-02 18:01:07 +010032#include <drm/drmP.h>
33#include <drm/radeon_drm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include "radeon_drv.h"
35
David Howells760285e2012-10-02 18:01:07 +010036#include <drm/drm_pciids.h>
Jerome Glisse771fe6b2009-06-05 14:42:42 +020037#include <linux/console.h>
Paul Gortmakere0cd3602011-08-30 11:04:30 -040038#include <linux/module.h>
Dave Airlie10ebc0b2012-09-17 14:40:31 +100039#include <linux/pm_runtime.h>
40#include <linux/vga_switcheroo.h>
Daniel Vetterd9fc9412014-09-23 15:46:53 +020041#include <drm/drm_gem.h>
42
Dave Airlie10ebc0b2012-09-17 14:40:31 +100043#include "drm_crtc_helper.h"
Oded Gabbaye28740e2014-07-15 13:53:32 +030044#include "radeon_kfd.h"
45
Jerome Glisse771fe6b2009-06-05 14:42:42 +020046/*
47 * KMS wrapper.
Dave Airlie0de1a572010-03-01 16:32:15 +100048 * - 2.0.0 - initial interface
49 * - 2.1.0 - add square tiling interface
Alex Deucherfdb43522010-03-26 15:24:14 -040050 * - 2.2.0 - add r6xx/r7xx const buffer support
Marek Olšákcae94b02010-02-21 21:24:15 +010051 * - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs
Jerome Glissebc35afd2010-05-12 18:01:13 +020052 * - 2.4.0 - add crtc id query
Alex Deucher148a03b2010-06-03 19:00:03 -040053 * - 2.5.0 - add get accel 2 to work around ddx breakage for evergreen
Dave Airlieab9e1f52010-07-13 11:11:11 +100054 * - 2.6.0 - add tiling config query (r6xx+), add initial HiZ support (r300->r500)
Alex Deucher71901cc2010-10-21 13:45:30 -040055 * 2.7.0 - fixups for r600 2D tiling support. (no external ABI change), add eg dyn gpr regs
Alex Deucher58bbf012011-01-24 17:14:26 -050056 * 2.8.0 - pageflip support, r500 US_FORMAT regs. r500 ARGB2101010 colorbuf, r300->r500 CMASK, clock crystal query
Dave Airlie486af182011-03-01 14:32:27 +100057 * 2.9.0 - r600 tiling (s3tc,rgtc) working, SET_PREDICATION packet 3 on r600 + eg, backend query
Alex Deucherb8709892011-07-27 04:17:25 +000058 * 2.10.0 - fusion 2D tiling
59 * 2.11.0 - backend map, initial compute support for the CS checker
Marek Olšáke70f2242011-10-25 01:38:45 +020060 * 2.12.0 - RADEON_CS_KEEP_TILING_FLAGS
Marek Olšákdd220a02012-01-27 12:17:59 -050061 * 2.13.0 - virtual memory support, streamout
Jerome Glisse285484e2011-12-16 17:03:42 -050062 * 2.14.0 - add evergreen tiling informations
Tom Stellard609c1e12012-03-20 17:17:55 -040063 * 2.15.0 - add max_pipes query
Jerome Glissed2609872012-06-09 10:57:41 -040064 * 2.16.0 - fix evergreen 2D tiled surface calculation
Alex Deucher7c77bf22012-06-14 22:06:37 +020065 * 2.17.0 - add STRMOUT_BASE_UPDATE for r7xx
Marek Olšák0f457e42012-07-29 16:24:57 +020066 * 2.18.0 - r600-eg: allow "invalid" DB formats
Marek Olšákb51ad122012-08-09 16:34:16 +020067 * 2.19.0 - r600-eg: MSAA textures
Marek Olšák6759a0a2012-08-09 16:34:17 +020068 * 2.20.0 - r600-si: RADEON_INFO_TIMESTAMP query
Marek Olšákc116cc92012-08-19 02:22:09 +020069 * 2.21.0 - r600-r700: FMASK and CMASK
Marek Olšák523885d2012-08-24 14:27:36 +020070 * 2.22.0 - r600 only: RESOLVE_BOX allowed
Marek Olšák46fc8782012-09-25 01:45:33 +020071 * 2.23.0 - allow STRMOUT_BASE_UPDATE on RS780 and RS880
Marek Olšák61051af2012-09-25 03:34:01 +020072 * 2.24.0 - eg only: allow MIP_ADDRESS=0 for MSAA textures
Alex Deucher71bfe912012-12-07 20:00:30 -050073 * 2.25.0 - eg+: new info request for num SE and num SH
Jerome Glisse4ac05332012-12-13 12:08:11 -050074 * 2.26.0 - r600-eg: fix htile size computation
Alex Deucher8696e332012-12-13 18:57:07 -050075 * 2.27.0 - r600-SI: Add CS ioctl support for async DMA
Jerome Glisse4613ca12012-12-19 12:26:45 -050076 * 2.28.0 - r600-eg: Add MEM_WRITE packet support
Marek Olšákc18b1172013-01-12 04:19:37 +010077 * 2.29.0 - R500 FP16 color clear registers
Marek Olšák774c3892013-03-01 13:40:31 +010078 * 2.30.0 - fix for FMASK texturing
Samuel Lia0a53aa2013-04-08 17:25:47 -040079 * 2.31.0 - Add fastfb support for rs690
Christian König902aaef2013-04-09 10:35:42 -040080 * 2.32.0 - new info request for rings working
Jerome Glisse64d7b8b2013-04-09 11:17:08 -040081 * 2.33.0 - Add SI tiling mode array query
Alex Deucher39aee492013-04-10 13:41:25 -040082 * 2.34.0 - Add CIK tiling mode array query
Michel Dänzer32f79a82013-11-18 18:26:00 +090083 * 2.35.0 - Add CIK macrotile mode array query
Alex Deucher9482d0d2013-12-23 11:31:44 -050084 * 2.36.0 - Fix CIK DCE tiling setup
Dave Airlie7c4c62a2014-01-30 14:11:12 +100085 * 2.37.0 - allow GS ring setup on r6xx/r7xx
Marek Olšák020ff542014-03-22 16:20:43 +010086 * 2.38.0 - RADEON_GEM_OP (GET_INITIAL_DOMAIN, SET_INITIAL_DOMAIN),
87 * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG
Alex Deucher65fcf662014-06-02 16:13:21 -040088 * 2.39.0 - Add INFO query for number of active CUs
Michel Dänzer72a99872014-07-31 18:43:49 +090089 * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting
Michel Dänzer897eba82014-09-17 16:25:55 +090090 * CS to GPU on >= r600
Glenn Kennard16613742014-12-13 03:32:37 +010091 * 2.41.0 - evergreen/cayman: Add SET_BASE/DRAW_INDIRECT command parsing support
Leo Liu1957d6b2015-03-31 11:19:50 -040092 * 2.42.0 - Add VCE/VUI (Video Usability Information) support
Marek Olšák72b90762015-04-29 19:40:33 +020093 * 2.43.0 - RADEON_INFO_GPU_RESET_COUNTER
Jerome Glisse771fe6b2009-06-05 14:42:42 +020094 */
95#define KMS_DRIVER_MAJOR 2
Marek Olšák72b90762015-04-29 19:40:33 +020096#define KMS_DRIVER_MINOR 43
Jerome Glisse771fe6b2009-06-05 14:42:42 +020097#define KMS_DRIVER_PATCHLEVEL 0
98int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
99int radeon_driver_unload_kms(struct drm_device *dev);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200100void radeon_driver_lastclose_kms(struct drm_device *dev);
101int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv);
102void radeon_driver_postclose_kms(struct drm_device *dev,
103 struct drm_file *file_priv);
104void radeon_driver_preclose_kms(struct drm_device *dev,
105 struct drm_file *file_priv);
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000106int radeon_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon);
107int radeon_resume_kms(struct drm_device *dev, bool resume, bool fbcon);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200108u32 radeon_get_vblank_counter_kms(struct drm_device *dev, int crtc);
109int radeon_enable_vblank_kms(struct drm_device *dev, int crtc);
110void radeon_disable_vblank_kms(struct drm_device *dev, int crtc);
Mario Kleinerf5a80202010-10-23 04:42:17 +0200111int radeon_get_vblank_timestamp_kms(struct drm_device *dev, int crtc,
112 int *max_error,
113 struct timeval *vblank_time,
114 unsigned flags);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200115void radeon_driver_irq_preinstall_kms(struct drm_device *dev);
116int radeon_driver_irq_postinstall_kms(struct drm_device *dev);
117void radeon_driver_irq_uninstall_kms(struct drm_device *dev);
Daniel Vettere9f0d762013-12-11 11:34:42 +0100118irqreturn_t radeon_driver_irq_handler_kms(int irq, void *arg);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200119void radeon_gem_object_free(struct drm_gem_object *obj);
Jerome Glisse721604a2012-01-05 22:11:05 -0500120int radeon_gem_object_open(struct drm_gem_object *obj,
121 struct drm_file *file_priv);
122void radeon_gem_object_close(struct drm_gem_object *obj,
123 struct drm_file *file_priv);
Christian Königf72a113a2014-08-07 09:36:00 +0200124struct dma_buf *radeon_gem_prime_export(struct drm_device *dev,
125 struct drm_gem_object *gobj,
126 int flags);
Mario Kleinerf5a80202010-10-23 04:42:17 +0200127extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc,
Ville Syrjäläabca9e42013-10-28 20:50:48 +0200128 unsigned int flags,
Mario Kleinerd47abc52013-10-30 05:13:07 +0100129 int *vpos, int *hpos, ktime_t *stime,
130 ktime_t *etime);
Alex Deucher90c4cde2014-04-10 22:29:01 -0400131extern bool radeon_is_px(struct drm_device *dev);
Rob Clarkbaa70942013-08-02 13:27:49 -0400132extern const struct drm_ioctl_desc radeon_ioctls_kms[];
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200133extern int radeon_max_kms_ioctl;
134int radeon_mmap(struct file *filp, struct vm_area_struct *vma);
Dave Airlieff72145b2011-02-07 12:16:14 +1000135int radeon_mode_dumb_mmap(struct drm_file *filp,
136 struct drm_device *dev,
137 uint32_t handle, uint64_t *offset_p);
138int radeon_mode_dumb_create(struct drm_file *file_priv,
139 struct drm_device *dev,
140 struct drm_mode_create_dumb *args);
Aaron Plattner1e6d17a2013-01-15 20:47:44 +0000141struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj);
142struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev,
Maarten Lankhorstb5e9c1a2014-01-09 11:03:14 +0100143 struct dma_buf_attachment *,
Aaron Plattner1e6d17a2013-01-15 20:47:44 +0000144 struct sg_table *sg);
145int radeon_gem_prime_pin(struct drm_gem_object *obj);
Maarten Lankhorst280cf212013-06-27 13:38:18 +0200146void radeon_gem_prime_unpin(struct drm_gem_object *obj);
Maarten Lankhorst3aac4502014-07-01 12:57:26 +0200147struct reservation_object *radeon_gem_prime_res_obj(struct drm_gem_object *);
Aaron Plattner1e6d17a2013-01-15 20:47:44 +0000148void *radeon_gem_prime_vmap(struct drm_gem_object *obj);
149void radeon_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
Christian König14adc892013-01-21 13:58:46 +0100150extern long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd,
151 unsigned long arg);
Dave Airlieff72145b2011-02-07 12:16:14 +1000152
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200153#if defined(CONFIG_DEBUG_FS)
154int radeon_debugfs_init(struct drm_minor *minor);
155void radeon_debugfs_cleanup(struct drm_minor *minor);
156#endif
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200157
Christian König14adc892013-01-21 13:58:46 +0100158/* atpx handler */
159#if defined(CONFIG_VGA_SWITCHEROO)
160void radeon_register_atpx_handler(void);
161void radeon_unregister_atpx_handler(void);
162#else
163static inline void radeon_register_atpx_handler(void) {}
164static inline void radeon_unregister_atpx_handler(void) {}
165#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166
Dave Airlie689b9d72005-09-30 17:09:07 +1000167int radeon_no_wb;
Dave Airliee9ced8e2013-05-15 01:23:36 +0000168int radeon_modeset = -1;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200169int radeon_dynclks = -1;
170int radeon_r4xx_atom = 0;
171int radeon_agpmode = 0;
172int radeon_vram_limit = 0;
Alex Deucheredcd26e2013-07-05 17:16:51 -0400173int radeon_gart_size = -1; /* auto */
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200174int radeon_benchmarking = 0;
Michel Dänzerecc0b322009-07-21 11:23:57 +0200175int radeon_testing = 0;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200176int radeon_connector_table = 0;
Dave Airlie4ce001a2009-08-13 16:32:14 +1000177int radeon_tv = 1;
Alex Deucher108dc8e2013-10-14 13:17:50 -0400178int radeon_audio = -1;
Alex Deucherf46c0122010-03-31 00:33:27 -0400179int radeon_disp_priority = 0;
Alex Deuchere2b0a8e2010-03-17 02:07:37 -0400180int radeon_hw_i2c = 0;
Dave Airlie197bbb32012-06-27 08:35:54 +0100181int radeon_pcie_gen2 = -1;
Alex Deuchera18cee12011-11-01 14:20:30 -0400182int radeon_msi = -1;
Christian König3368ff02012-05-02 15:11:21 +0200183int radeon_lockup_timeout = 10000;
Samuel Lia0a53aa2013-04-08 17:25:47 -0400184int radeon_fastfb = 0;
Alex Deucherda321c82013-04-12 13:55:22 -0400185int radeon_dpm = -1;
Alex Deucher1294d4a2013-07-16 15:58:50 -0400186int radeon_aspm = -1;
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000187int radeon_runtime_pm = -1;
Alex Deucher363eb0b2014-01-08 17:55:08 -0500188int radeon_hard_reset = 0;
Christian Königdfc230f2014-07-19 13:55:58 +0200189int radeon_vm_size = 8;
190int radeon_vm_block_size = -1;
Alex Deuchera624f422014-07-01 11:23:03 -0400191int radeon_deep_color = 0;
Mario Kleiner39dc5452014-07-29 06:21:44 +0200192int radeon_use_pflipirq = 2;
Alex Deucher6e909f72014-08-07 09:28:31 -0400193int radeon_bapm = -1;
Alex Deucherbc130182014-09-16 20:57:26 -0400194int radeon_backlight = -1;
Dave Airlie875711f2015-02-20 09:21:36 +1000195int radeon_auxch = -1;
Dave Airlie9843ead2015-02-24 09:24:04 +1000196int radeon_mst = 0;
Dave Airlie689b9d72005-09-30 17:09:07 +1000197
Niels de Vos61a2d072008-07-31 00:07:23 -0700198MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
Dave Airlie689b9d72005-09-30 17:09:07 +1000199module_param_named(no_wb, radeon_no_wb, int, 0444);
200
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200201MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
202module_param_named(modeset, radeon_modeset, int, 0400);
203
204MODULE_PARM_DESC(dynclks, "Disable/Enable dynamic clocks");
205module_param_named(dynclks, radeon_dynclks, int, 0444);
206
207MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx");
208module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444);
209
Lauri Kasanen8902e6f2014-04-08 13:39:36 +0300210MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200211module_param_named(vramlimit, radeon_vram_limit, int, 0600);
212
213MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)");
214module_param_named(agpmode, radeon_agpmode, int, 0444);
215
Alex Deucheredcd26e2013-07-05 17:16:51 -0400216MODULE_PARM_DESC(gartsize, "Size of PCIE/IGP gart to setup in megabytes (32, 64, etc., -1 = auto)");
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200217module_param_named(gartsize, radeon_gart_size, int, 0600);
218
219MODULE_PARM_DESC(benchmark, "Run benchmark");
220module_param_named(benchmark, radeon_benchmarking, int, 0444);
221
Michel Dänzerecc0b322009-07-21 11:23:57 +0200222MODULE_PARM_DESC(test, "Run tests");
223module_param_named(test, radeon_testing, int, 0444);
224
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200225MODULE_PARM_DESC(connector_table, "Force connector table");
226module_param_named(connector_table, radeon_connector_table, int, 0444);
Dave Airlie4ce001a2009-08-13 16:32:14 +1000227
228MODULE_PARM_DESC(tv, "TV enable (0 = disable)");
229module_param_named(tv, radeon_tv, int, 0444);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200230
Alex Deucher108dc8e2013-10-14 13:17:50 -0400231MODULE_PARM_DESC(audio, "Audio enable (-1 = auto, 0 = disable, 1 = enable)");
Christian Koenigdafc3bd2009-10-11 23:49:13 +0200232module_param_named(audio, radeon_audio, int, 0444);
233
Alex Deucherf46c0122010-03-31 00:33:27 -0400234MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = high)");
235module_param_named(disp_priority, radeon_disp_priority, int, 0444);
236
Alex Deuchere2b0a8e2010-03-17 02:07:37 -0400237MODULE_PARM_DESC(hw_i2c, "hw i2c engine enable (0 = disable)");
238module_param_named(hw_i2c, radeon_hw_i2c, int, 0444);
239
Dave Airlie197bbb32012-06-27 08:35:54 +0100240MODULE_PARM_DESC(pcie_gen2, "PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = enable)");
Alex Deucherd42dd572011-01-12 20:05:11 -0500241module_param_named(pcie_gen2, radeon_pcie_gen2, int, 0444);
242
Alex Deuchera18cee12011-11-01 14:20:30 -0400243MODULE_PARM_DESC(msi, "MSI support (1 = enable, 0 = disable, -1 = auto)");
244module_param_named(msi, radeon_msi, int, 0444);
245
Vincent Battsb5c9eca2015-03-06 21:07:05 +0000246MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (default 10000 = 10 seconds, 0 = disable)");
Christian König3368ff02012-05-02 15:11:21 +0200247module_param_named(lockup_timeout, radeon_lockup_timeout, int, 0444);
248
Samuel Lia0a53aa2013-04-08 17:25:47 -0400249MODULE_PARM_DESC(fastfb, "Direct FB access for IGP chips (0 = disable, 1 = enable)");
250module_param_named(fastfb, radeon_fastfb, int, 0444);
251
Alex Deucherda321c82013-04-12 13:55:22 -0400252MODULE_PARM_DESC(dpm, "DPM support (1 = enable, 0 = disable, -1 = auto)");
253module_param_named(dpm, radeon_dpm, int, 0444);
254
Alex Deucher1294d4a2013-07-16 15:58:50 -0400255MODULE_PARM_DESC(aspm, "ASPM support (1 = enable, 0 = disable, -1 = auto)");
256module_param_named(aspm, radeon_aspm, int, 0444);
257
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000258MODULE_PARM_DESC(runpm, "PX runtime pm (1 = force enable, 0 = disable, -1 = PX only default)");
259module_param_named(runpm, radeon_runtime_pm, int, 0444);
260
Alex Deucher363eb0b2014-01-08 17:55:08 -0500261MODULE_PARM_DESC(hard_reset, "PCI config reset (1 = force enable, 0 = disable (default))");
262module_param_named(hard_reset, radeon_hard_reset, int, 0444);
263
Christian König20b26562014-07-18 13:56:56 +0200264MODULE_PARM_DESC(vm_size, "VM address space size in gigabytes (default 4GB)");
Christian Königc1c44132014-06-05 23:47:32 -0400265module_param_named(vm_size, radeon_vm_size, int, 0444);
266
Christian Königdfc230f2014-07-19 13:55:58 +0200267MODULE_PARM_DESC(vm_block_size, "VM page table size in bits (default depending on vm_size)");
Christian König4510fb92014-06-05 23:56:50 -0400268module_param_named(vm_block_size, radeon_vm_block_size, int, 0444);
269
Alex Deuchera624f422014-07-01 11:23:03 -0400270MODULE_PARM_DESC(deep_color, "Deep Color support (1 = enable, 0 = disable (default))");
271module_param_named(deep_color, radeon_deep_color, int, 0444);
272
Mario Kleiner39dc5452014-07-29 06:21:44 +0200273MODULE_PARM_DESC(use_pflipirq, "Pflip irqs for pageflip completion (0 = disable, 1 = as fallback, 2 = exclusive (default))");
274module_param_named(use_pflipirq, radeon_use_pflipirq, int, 0444);
275
Alex Deucher6e909f72014-08-07 09:28:31 -0400276MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)");
277module_param_named(bapm, radeon_bapm, int, 0444);
278
Alex Deucherbc130182014-09-16 20:57:26 -0400279MODULE_PARM_DESC(backlight, "backlight support (1 = enable, 0 = disable, -1 = auto)");
280module_param_named(backlight, radeon_backlight, int, 0444);
281
Dave Airlie875711f2015-02-20 09:21:36 +1000282MODULE_PARM_DESC(auxch, "Use native auxch experimental support (1 = enable, 0 = disable, -1 = auto)");
283module_param_named(auxch, radeon_auxch, int, 0444);
284
Dave Airlie9843ead2015-02-24 09:24:04 +1000285MODULE_PARM_DESC(mst, "DisplayPort MST experimental support (1 = enable, 0 = disable)");
286module_param_named(mst, radeon_mst, int, 0444);
287
Christian König14adc892013-01-21 13:58:46 +0100288static struct pci_device_id pciidlist[] = {
289 radeon_PCI_IDS
290};
291
292MODULE_DEVICE_TABLE(pci, pciidlist);
293
294#ifdef CONFIG_DRM_RADEON_UMS
295
Jesse Barnes0a3e67a2008-09-30 12:14:26 -0700296static int radeon_suspend(struct drm_device *dev, pm_message_t state)
297{
298 drm_radeon_private_t *dev_priv = dev->dev_private;
299
Dave Airlie03efb882009-03-10 18:36:38 +1000300 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
301 return 0;
302
Jesse Barnes0a3e67a2008-09-30 12:14:26 -0700303 /* Disable *all* interrupts */
Alex Deucher800b6992009-03-06 11:47:54 -0500304 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600)
Jesse Barnes0a3e67a2008-09-30 12:14:26 -0700305 RADEON_WRITE(R500_DxMODE_INT_MASK, 0);
306 RADEON_WRITE(RADEON_GEN_INT_CNTL, 0);
307 return 0;
308}
309
310static int radeon_resume(struct drm_device *dev)
311{
312 drm_radeon_private_t *dev_priv = dev->dev_private;
313
Dave Airlie03efb882009-03-10 18:36:38 +1000314 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
315 return 0;
316
Jesse Barnes0a3e67a2008-09-30 12:14:26 -0700317 /* Restore interrupt registers */
Alex Deucher800b6992009-03-06 11:47:54 -0500318 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS600)
Jesse Barnes0a3e67a2008-09-30 12:14:26 -0700319 RADEON_WRITE(R500_DxMODE_INT_MASK, dev_priv->r500_disp_irq_reg);
320 RADEON_WRITE(RADEON_GEN_INT_CNTL, dev_priv->irq_enable_reg);
321 return 0;
322}
323
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000324
Arjan van de Vene08e96d2011-10-31 07:28:57 -0700325static const struct file_operations radeon_driver_old_fops = {
326 .owner = THIS_MODULE,
327 .open = drm_open,
328 .release = drm_release,
329 .unlocked_ioctl = drm_ioctl,
Daniel Vetterbfbf3c82014-09-23 15:46:49 +0200330 .mmap = drm_legacy_mmap,
Arjan van de Vene08e96d2011-10-31 07:28:57 -0700331 .poll = drm_poll,
Arjan van de Vene08e96d2011-10-31 07:28:57 -0700332 .read = drm_read,
333#ifdef CONFIG_COMPAT
334 .compat_ioctl = radeon_compat_ioctl,
335#endif
336 .llseek = noop_llseek,
337};
338
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200339static struct drm_driver driver_old = {
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000340 .driver_features =
Daniel Vetter28185642013-08-08 15:41:27 +0200341 DRIVER_USE_AGP | DRIVER_PCI_DMA | DRIVER_SG |
Jesse Barnes0a3e67a2008-09-30 12:14:26 -0700342 DRIVER_HAVE_IRQ | DRIVER_HAVE_DMA | DRIVER_IRQ_SHARED,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 .dev_priv_size = sizeof(drm_radeon_buf_priv_t),
Dave Airlie22eae942005-11-10 22:16:34 +1100344 .load = radeon_driver_load,
345 .firstopen = radeon_driver_firstopen,
346 .open = radeon_driver_open,
347 .preclose = radeon_driver_preclose,
348 .postclose = radeon_driver_postclose,
349 .lastclose = radeon_driver_lastclose,
David Herrmann915b4d12014-08-29 12:12:43 +0200350 .set_busid = drm_pci_set_busid,
Dave Airlie22eae942005-11-10 22:16:34 +1100351 .unload = radeon_driver_unload,
Jesse Barnes0a3e67a2008-09-30 12:14:26 -0700352 .suspend = radeon_suspend,
353 .resume = radeon_resume,
354 .get_vblank_counter = radeon_get_vblank_counter,
355 .enable_vblank = radeon_enable_vblank,
356 .disable_vblank = radeon_disable_vblank,
Dave Airlie60f2ee02008-12-19 10:22:02 +1100357 .master_create = radeon_master_create,
358 .master_destroy = radeon_master_destroy,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359 .irq_preinstall = radeon_driver_irq_preinstall,
360 .irq_postinstall = radeon_driver_irq_postinstall,
361 .irq_uninstall = radeon_driver_irq_uninstall,
362 .irq_handler = radeon_driver_irq_handler,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363 .ioctls = radeon_ioctls,
364 .dma_ioctl = radeon_cp_buffers,
Arjan van de Vene08e96d2011-10-31 07:28:57 -0700365 .fops = &radeon_driver_old_fops,
Dave Airlie22eae942005-11-10 22:16:34 +1100366 .name = DRIVER_NAME,
367 .desc = DRIVER_DESC,
368 .date = DRIVER_DATE,
369 .major = DRIVER_MAJOR,
370 .minor = DRIVER_MINOR,
371 .patchlevel = DRIVER_PATCHLEVEL,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372};
373
Christian König14adc892013-01-21 13:58:46 +0100374#endif
375
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200376static struct drm_driver kms_driver;
377
Tommi Rantala30238152012-11-09 09:19:39 +0000378static int radeon_kick_out_firmware_fb(struct pci_dev *pdev)
Benjamin Herrenschmidta56f7422010-10-06 16:39:07 +0000379{
380 struct apertures_struct *ap;
381 bool primary = false;
382
383 ap = alloc_apertures(1);
Tommi Rantala30238152012-11-09 09:19:39 +0000384 if (!ap)
385 return -ENOMEM;
386
Benjamin Herrenschmidta56f7422010-10-06 16:39:07 +0000387 ap->ranges[0].base = pci_resource_start(pdev, 0);
388 ap->ranges[0].size = pci_resource_len(pdev, 0);
389
390#ifdef CONFIG_X86
391 primary = pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW;
392#endif
393 remove_conflicting_framebuffers(ap, "radeondrmfb", primary);
394 kfree(ap);
Tommi Rantala30238152012-11-09 09:19:39 +0000395
396 return 0;
Benjamin Herrenschmidta56f7422010-10-06 16:39:07 +0000397}
398
Greg Kroah-Hartman56550d92012-12-21 15:09:25 -0800399static int radeon_pci_probe(struct pci_dev *pdev,
400 const struct pci_device_id *ent)
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200401{
Tommi Rantala30238152012-11-09 09:19:39 +0000402 int ret;
403
Benjamin Herrenschmidta56f7422010-10-06 16:39:07 +0000404 /* Get rid of things like offb */
Tommi Rantala30238152012-11-09 09:19:39 +0000405 ret = radeon_kick_out_firmware_fb(pdev);
406 if (ret)
407 return ret;
Benjamin Herrenschmidta56f7422010-10-06 16:39:07 +0000408
Jordan Crousedcdb1672010-05-27 13:40:25 -0600409 return drm_get_pci_dev(pdev, ent, &kms_driver);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200410}
411
412static void
413radeon_pci_remove(struct pci_dev *pdev)
414{
415 struct drm_device *dev = pci_get_drvdata(pdev);
416
417 drm_put_dev(dev);
418}
419
Dave Airlie7473e832012-09-13 12:02:30 +1000420static int radeon_pmops_suspend(struct device *dev)
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200421{
Dave Airlie7473e832012-09-13 12:02:30 +1000422 struct pci_dev *pdev = to_pci_dev(dev);
423 struct drm_device *drm_dev = pci_get_drvdata(pdev);
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000424 return radeon_suspend_kms(drm_dev, true, true);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200425}
426
Dave Airlie7473e832012-09-13 12:02:30 +1000427static int radeon_pmops_resume(struct device *dev)
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200428{
Dave Airlie7473e832012-09-13 12:02:30 +1000429 struct pci_dev *pdev = to_pci_dev(dev);
430 struct drm_device *drm_dev = pci_get_drvdata(pdev);
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000431 return radeon_resume_kms(drm_dev, true, true);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200432}
433
Dave Airlie7473e832012-09-13 12:02:30 +1000434static int radeon_pmops_freeze(struct device *dev)
435{
436 struct pci_dev *pdev = to_pci_dev(dev);
437 struct drm_device *drm_dev = pci_get_drvdata(pdev);
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000438 return radeon_suspend_kms(drm_dev, false, true);
Dave Airlie7473e832012-09-13 12:02:30 +1000439}
440
441static int radeon_pmops_thaw(struct device *dev)
442{
443 struct pci_dev *pdev = to_pci_dev(dev);
444 struct drm_device *drm_dev = pci_get_drvdata(pdev);
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000445 return radeon_resume_kms(drm_dev, false, true);
446}
447
448static int radeon_pmops_runtime_suspend(struct device *dev)
449{
450 struct pci_dev *pdev = to_pci_dev(dev);
451 struct drm_device *drm_dev = pci_get_drvdata(pdev);
452 int ret;
453
Alex Deucher90c4cde2014-04-10 22:29:01 -0400454 if (!radeon_is_px(drm_dev)) {
Dave Airlie1d8eec82014-03-27 14:09:18 +1000455 pm_runtime_forbid(dev);
456 return -EBUSY;
457 }
Alex Deucher9babd352014-01-24 14:59:42 -0500458
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000459 drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
460 drm_kms_helper_poll_disable(drm_dev);
461 vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);
462
463 ret = radeon_suspend_kms(drm_dev, false, false);
464 pci_save_state(pdev);
465 pci_disable_device(pdev);
Bjorn Helgaasb440bde2014-09-10 13:45:01 -0600466 pci_ignore_hotplug(pdev);
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000467 pci_set_power_state(pdev, PCI_D3cold);
468 drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
469
470 return 0;
471}
472
473static int radeon_pmops_runtime_resume(struct device *dev)
474{
475 struct pci_dev *pdev = to_pci_dev(dev);
476 struct drm_device *drm_dev = pci_get_drvdata(pdev);
477 int ret;
478
Alex Deucher90c4cde2014-04-10 22:29:01 -0400479 if (!radeon_is_px(drm_dev))
Alex Deucher9babd352014-01-24 14:59:42 -0500480 return -EINVAL;
481
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000482 drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
483
484 pci_set_power_state(pdev, PCI_D0);
485 pci_restore_state(pdev);
486 ret = pci_enable_device(pdev);
487 if (ret)
488 return ret;
489 pci_set_master(pdev);
490
491 ret = radeon_resume_kms(drm_dev, false, false);
492 drm_kms_helper_poll_enable(drm_dev);
493 vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_ON);
494 drm_dev->switch_power_state = DRM_SWITCH_POWER_ON;
495 return 0;
496}
497
498static int radeon_pmops_runtime_idle(struct device *dev)
499{
500 struct pci_dev *pdev = to_pci_dev(dev);
501 struct drm_device *drm_dev = pci_get_drvdata(pdev);
502 struct drm_crtc *crtc;
503
Alex Deucher90c4cde2014-04-10 22:29:01 -0400504 if (!radeon_is_px(drm_dev)) {
Dave Airlie1d8eec82014-03-27 14:09:18 +1000505 pm_runtime_forbid(dev);
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000506 return -EBUSY;
507 }
508
509 list_for_each_entry(crtc, &drm_dev->mode_config.crtc_list, head) {
510 if (crtc->enabled) {
511 DRM_DEBUG_DRIVER("failing to power off - crtc active\n");
512 return -EBUSY;
513 }
514 }
515
516 pm_runtime_mark_last_busy(dev);
517 pm_runtime_autosuspend(dev);
518 /* we don't want the main rpm_idle to call suspend - we want to autosuspend */
519 return 1;
520}
521
522long radeon_drm_ioctl(struct file *filp,
523 unsigned int cmd, unsigned long arg)
524{
525 struct drm_file *file_priv = filp->private_data;
526 struct drm_device *dev;
527 long ret;
528 dev = file_priv->minor->dev;
529 ret = pm_runtime_get_sync(dev->dev);
530 if (ret < 0)
531 return ret;
532
533 ret = drm_ioctl(filp, cmd, arg);
534
535 pm_runtime_mark_last_busy(dev->dev);
536 pm_runtime_put_autosuspend(dev->dev);
537 return ret;
Dave Airlie7473e832012-09-13 12:02:30 +1000538}
539
540static const struct dev_pm_ops radeon_pm_ops = {
541 .suspend = radeon_pmops_suspend,
542 .resume = radeon_pmops_resume,
543 .freeze = radeon_pmops_freeze,
544 .thaw = radeon_pmops_thaw,
545 .poweroff = radeon_pmops_freeze,
546 .restore = radeon_pmops_resume,
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000547 .runtime_suspend = radeon_pmops_runtime_suspend,
548 .runtime_resume = radeon_pmops_runtime_resume,
549 .runtime_idle = radeon_pmops_runtime_idle,
Dave Airlie7473e832012-09-13 12:02:30 +1000550};
551
Arjan van de Vene08e96d2011-10-31 07:28:57 -0700552static const struct file_operations radeon_driver_kms_fops = {
553 .owner = THIS_MODULE,
554 .open = drm_open,
555 .release = drm_release,
Dave Airlie10ebc0b2012-09-17 14:40:31 +1000556 .unlocked_ioctl = radeon_drm_ioctl,
Arjan van de Vene08e96d2011-10-31 07:28:57 -0700557 .mmap = radeon_mmap,
558 .poll = drm_poll,
Arjan van de Vene08e96d2011-10-31 07:28:57 -0700559 .read = drm_read,
560#ifdef CONFIG_COMPAT
561 .compat_ioctl = radeon_kms_compat_ioctl,
562#endif
563};
564
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200565static struct drm_driver kms_driver = {
566 .driver_features =
Daniel Vetter28185642013-08-08 15:41:27 +0200567 DRIVER_USE_AGP |
Daniel Vetter81e95692013-07-10 14:11:49 +0200568 DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM |
Christian Königf33bcab2013-08-25 18:29:03 +0200569 DRIVER_PRIME | DRIVER_RENDER,
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200570 .load = radeon_driver_load_kms,
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200571 .open = radeon_driver_open_kms,
572 .preclose = radeon_driver_preclose_kms,
573 .postclose = radeon_driver_postclose_kms,
574 .lastclose = radeon_driver_lastclose_kms,
David Herrmann915b4d12014-08-29 12:12:43 +0200575 .set_busid = drm_pci_set_busid,
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200576 .unload = radeon_driver_unload_kms,
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200577 .get_vblank_counter = radeon_get_vblank_counter_kms,
578 .enable_vblank = radeon_enable_vblank_kms,
579 .disable_vblank = radeon_disable_vblank_kms,
Mario Kleinerf5a80202010-10-23 04:42:17 +0200580 .get_vblank_timestamp = radeon_get_vblank_timestamp_kms,
581 .get_scanout_position = radeon_get_crtc_scanoutpos,
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200582#if defined(CONFIG_DEBUG_FS)
583 .debugfs_init = radeon_debugfs_init,
584 .debugfs_cleanup = radeon_debugfs_cleanup,
585#endif
586 .irq_preinstall = radeon_driver_irq_preinstall_kms,
587 .irq_postinstall = radeon_driver_irq_postinstall_kms,
588 .irq_uninstall = radeon_driver_irq_uninstall_kms,
589 .irq_handler = radeon_driver_irq_handler_kms,
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200590 .ioctls = radeon_ioctls_kms,
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200591 .gem_free_object = radeon_gem_object_free,
Jerome Glisse721604a2012-01-05 22:11:05 -0500592 .gem_open_object = radeon_gem_object_open,
593 .gem_close_object = radeon_gem_object_close,
Dave Airlieff72145b2011-02-07 12:16:14 +1000594 .dumb_create = radeon_mode_dumb_create,
595 .dumb_map_offset = radeon_mode_dumb_mmap,
Daniel Vetter43387b32013-07-16 09:12:04 +0200596 .dumb_destroy = drm_gem_dumb_destroy,
Arjan van de Vene08e96d2011-10-31 07:28:57 -0700597 .fops = &radeon_driver_kms_fops,
Alex Deucher40f5cf92012-05-10 18:33:13 -0400598
599 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
600 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
Christian Königf72a113a2014-08-07 09:36:00 +0200601 .gem_prime_export = radeon_gem_prime_export,
Aaron Plattner1e6d17a2013-01-15 20:47:44 +0000602 .gem_prime_import = drm_gem_prime_import,
603 .gem_prime_pin = radeon_gem_prime_pin,
Maarten Lankhorst280cf212013-06-27 13:38:18 +0200604 .gem_prime_unpin = radeon_gem_prime_unpin,
Maarten Lankhorst3aac4502014-07-01 12:57:26 +0200605 .gem_prime_res_obj = radeon_gem_prime_res_obj,
Aaron Plattner1e6d17a2013-01-15 20:47:44 +0000606 .gem_prime_get_sg_table = radeon_gem_prime_get_sg_table,
607 .gem_prime_import_sg_table = radeon_gem_prime_import_sg_table,
608 .gem_prime_vmap = radeon_gem_prime_vmap,
609 .gem_prime_vunmap = radeon_gem_prime_vunmap,
Alex Deucher40f5cf92012-05-10 18:33:13 -0400610
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200611 .name = DRIVER_NAME,
612 .desc = DRIVER_DESC,
613 .date = DRIVER_DATE,
614 .major = KMS_DRIVER_MAJOR,
615 .minor = KMS_DRIVER_MINOR,
616 .patchlevel = KMS_DRIVER_PATCHLEVEL,
617};
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200618
619static struct drm_driver *driver;
Dave Airlie8410ea32010-12-15 03:16:38 +1000620static struct pci_driver *pdriver;
621
Christian König14adc892013-01-21 13:58:46 +0100622#ifdef CONFIG_DRM_RADEON_UMS
Dave Airlie8410ea32010-12-15 03:16:38 +1000623static struct pci_driver radeon_pci_driver = {
624 .name = DRIVER_NAME,
625 .id_table = pciidlist,
626};
Christian König14adc892013-01-21 13:58:46 +0100627#endif
Dave Airlie8410ea32010-12-15 03:16:38 +1000628
629static struct pci_driver radeon_kms_pci_driver = {
630 .name = DRIVER_NAME,
631 .id_table = pciidlist,
632 .probe = radeon_pci_probe,
633 .remove = radeon_pci_remove,
Dave Airlie7473e832012-09-13 12:02:30 +1000634 .driver.pm = &radeon_pm_ops,
Dave Airlie8410ea32010-12-15 03:16:38 +1000635};
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200636
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637static int __init radeon_init(void)
638{
Dave Airliee9ced8e2013-05-15 01:23:36 +0000639#ifdef CONFIG_VGA_CONSOLE
640 if (vgacon_text_force() && radeon_modeset == -1) {
641 DRM_INFO("VGACON disable radeon kernel modesetting.\n");
642 radeon_modeset = 0;
643 }
644#endif
645 /* set to modesetting by default if not nomodeset */
646 if (radeon_modeset == -1)
647 radeon_modeset = 1;
648
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200649 if (radeon_modeset == 1) {
650 DRM_INFO("radeon kernel modesetting enabled.\n");
651 driver = &kms_driver;
Dave Airlie8410ea32010-12-15 03:16:38 +1000652 pdriver = &radeon_kms_pci_driver;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200653 driver->driver_features |= DRIVER_MODESET;
654 driver->num_ioctls = radeon_max_kms_ioctl;
Dave Airlie6a9ee8a2010-02-01 15:38:10 +1000655 radeon_register_atpx_handler();
Christian König14adc892013-01-21 13:58:46 +0100656
657 } else {
658#ifdef CONFIG_DRM_RADEON_UMS
659 DRM_INFO("radeon userspace modesetting enabled.\n");
660 driver = &driver_old;
661 pdriver = &radeon_pci_driver;
662 driver->driver_features &= ~DRIVER_MODESET;
663 driver->num_ioctls = radeon_max_ioctl;
664#else
665 DRM_ERROR("No UMS support in radeon module!\n");
666 return -EINVAL;
667#endif
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200668 }
Christian König14adc892013-01-21 13:58:46 +0100669
Oded Gabbaye28740e2014-07-15 13:53:32 +0300670 radeon_kfd_init();
671
Christian König14adc892013-01-21 13:58:46 +0100672 /* let modprobe override vga console setting */
Dave Airlie8410ea32010-12-15 03:16:38 +1000673 return drm_pci_init(driver, pdriver);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674}
675
676static void __exit radeon_exit(void)
677{
Oded Gabbaye28740e2014-07-15 13:53:32 +0300678 radeon_kfd_fini();
Dave Airlie8410ea32010-12-15 03:16:38 +1000679 drm_pci_exit(driver, pdriver);
Dave Airlie6a9ee8a2010-02-01 15:38:10 +1000680 radeon_unregister_atpx_handler();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700681}
682
Jerome Glisse176f6132009-06-22 18:16:13 +0200683module_init(radeon_init);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684module_exit(radeon_exit);
685
Dave Airlieb5e89ed2005-09-25 14:28:13 +1000686MODULE_AUTHOR(DRIVER_AUTHOR);
687MODULE_DESCRIPTION(DRIVER_DESC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700688MODULE_LICENSE("GPL and additional rights");