Merge branch 'vendor/XZ'
[dragonfly.git] / sys / dev / drm / radeon / radeon_acpi.c
1 /*
2  * Copyright 2012 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * $FreeBSD: head/sys/dev/drm2/radeon/radeon_acpi.c 254885 2013-08-25 19:37:15Z dumbbell $
23  */
24
25 #include <drm/drmP.h>
26 #include <drm/drm_crtc_helper.h>
27 #include "radeon.h"
28 #include "radeon_acpi.h"
29 #include "atom.h"
30
31 #define ACPI_AC_CLASS           "ac_adapter"
32
33 struct atif_verify_interface {
34         u16 size;               /* structure size in bytes (includes size field) */
35         u16 version;            /* version */
36         u32 notification_mask;  /* supported notifications mask */
37         u32 function_bits;      /* supported functions bit vector */
38 } __packed;
39
40 struct atif_system_params {
41         u16 size;               /* structure size in bytes (includes size field) */
42         u32 valid_mask;         /* valid flags mask */
43         u32 flags;              /* flags */
44         u8 command_code;        /* notify command code */
45 } __packed;
46
47 struct atif_sbios_requests {
48         u16 size;               /* structure size in bytes (includes size field) */
49         u32 pending;            /* pending sbios requests */
50         u8 panel_exp_mode;      /* panel expansion mode */
51         u8 thermal_gfx;         /* thermal state: target gfx controller */
52         u8 thermal_state;       /* thermal state: state id (0: exit state, non-0: state) */
53         u8 forced_power_gfx;    /* forced power state: target gfx controller */
54         u8 forced_power_state;  /* forced power state: state id */
55         u8 system_power_src;    /* system power source */
56         u8 backlight_level;     /* panel backlight level (0-255) */
57 } __packed;
58
59 #define ATIF_NOTIFY_MASK        0x3
60 #define ATIF_NOTIFY_NONE        0
61 #define ATIF_NOTIFY_81          1
62 #define ATIF_NOTIFY_N           2
63
64 struct atcs_verify_interface {
65         u16 size;               /* structure size in bytes (includes size field) */
66         u16 version;            /* version */
67         u32 function_bits;      /* supported functions bit vector */
68 } __packed;
69
70 /* Call the ATIF method
71  */
72 /**
73  * radeon_atif_call - call an ATIF method
74  *
75  * @handle: acpi handle
76  * @function: the ATIF function to execute
77  * @params: ATIF function params
78  *
79  * Executes the requested ATIF function (all asics).
80  * Returns a pointer to the acpi output buffer.
81  */
82 static ACPI_OBJECT *radeon_atif_call(ACPI_HANDLE handle, int function,
83                 ACPI_BUFFER *params)
84 {
85         ACPI_STATUS status;
86         ACPI_OBJECT atif_arg_elements[2];
87         ACPI_OBJECT_LIST atif_arg;
88         ACPI_BUFFER buffer = { ACPI_ALLOCATE_BUFFER, NULL };
89
90         atif_arg.Count = 2;
91         atif_arg.Pointer = &atif_arg_elements[0];
92
93         atif_arg_elements[0].Type = ACPI_TYPE_INTEGER;
94         atif_arg_elements[0].Integer.Value = function;
95
96         if (params) {
97                 atif_arg_elements[1].Type = ACPI_TYPE_BUFFER;
98                 atif_arg_elements[1].Buffer.Length = params->Length;
99                 atif_arg_elements[1].Buffer.Pointer = params->Pointer;
100         } else {
101                 /* We need a second fake parameter */
102                 atif_arg_elements[1].Type = ACPI_TYPE_INTEGER;
103                 atif_arg_elements[1].Integer.Value = 0;
104         }
105
106         status = AcpiEvaluateObject(handle, "ATIF", &atif_arg, &buffer);
107
108         /* Fail only if calling the method fails and ATIF is supported */
109         if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
110                 DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n",
111                                  AcpiFormatException(status));
112                 AcpiOsFree(buffer.Pointer);
113                 return NULL;
114         }
115
116         return buffer.Pointer;
117 }
118
119 /**
120  * radeon_atif_parse_notification - parse supported notifications
121  *
122  * @n: supported notifications struct
123  * @mask: supported notifications mask from ATIF
124  *
125  * Use the supported notifications mask from ATIF function
126  * ATIF_FUNCTION_VERIFY_INTERFACE to determine what notifications
127  * are supported (all asics).
128  */
129 static void radeon_atif_parse_notification(struct radeon_atif_notifications *n, u32 mask)
130 {
131         n->display_switch = mask & ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED;
132         n->expansion_mode_change = mask & ATIF_EXPANSION_MODE_CHANGE_REQUEST_SUPPORTED;
133         n->thermal_state = mask & ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED;
134         n->forced_power_state = mask & ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED;
135         n->system_power_state = mask & ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED;
136         n->display_conf_change = mask & ATIF_DISPLAY_CONF_CHANGE_REQUEST_SUPPORTED;
137         n->px_gfx_switch = mask & ATIF_PX_GFX_SWITCH_REQUEST_SUPPORTED;
138         n->brightness_change = mask & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED;
139         n->dgpu_display_event = mask & ATIF_DGPU_DISPLAY_EVENT_SUPPORTED;
140 }
141
142 /**
143  * radeon_atif_parse_functions - parse supported functions
144  *
145  * @f: supported functions struct
146  * @mask: supported functions mask from ATIF
147  *
148  * Use the supported functions mask from ATIF function
149  * ATIF_FUNCTION_VERIFY_INTERFACE to determine what functions
150  * are supported (all asics).
151  */
152 static void radeon_atif_parse_functions(struct radeon_atif_functions *f, u32 mask)
153 {
154         f->system_params = mask & ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED;
155         f->sbios_requests = mask & ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED;
156         f->select_active_disp = mask & ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED;
157         f->lid_state = mask & ATIF_GET_LID_STATE_SUPPORTED;
158         f->get_tv_standard = mask & ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED;
159         f->set_tv_standard = mask & ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED;
160         f->get_panel_expansion_mode = mask & ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED;
161         f->set_panel_expansion_mode = mask & ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED;
162         f->temperature_change = mask & ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED;
163         f->graphics_device_types = mask & ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED;
164 }
165
166 /**
167  * radeon_atif_verify_interface - verify ATIF
168  *
169  * @handle: acpi handle
170  * @atif: radeon atif struct
171  *
172  * Execute the ATIF_FUNCTION_VERIFY_INTERFACE ATIF function
173  * to initialize ATIF and determine what features are supported
174  * (all asics).
175  * returns 0 on success, error on failure.
176  */
177 static int radeon_atif_verify_interface(ACPI_HANDLE handle,
178                 struct radeon_atif *atif)
179 {
180         ACPI_OBJECT *info;
181         struct atif_verify_interface output;
182         size_t size;
183         int err = 0;
184
185         info = radeon_atif_call(handle, ATIF_FUNCTION_VERIFY_INTERFACE, NULL);
186         if (!info)
187                 return -EIO;
188
189         memset(&output, 0, sizeof(output));
190
191         size = *(u16 *) info->Buffer.Pointer;
192         if (size < 12) {
193                 DRM_INFO("ATIF buffer is too small: %zu\n", size);
194                 err = -EINVAL;
195                 goto out;
196         }
197         size = min(sizeof(output), size);
198
199         memcpy(&output, info->Buffer.Pointer, size);
200
201         /* TODO: check version? */
202         DRM_DEBUG_DRIVER("ATIF version %u\n", output.version);
203
204         radeon_atif_parse_notification(&atif->notifications, output.notification_mask);
205         radeon_atif_parse_functions(&atif->functions, output.function_bits);
206
207 out:
208         AcpiOsFree(info);
209         return err;
210 }
211
212 /**
213  * radeon_atif_get_notification_params - determine notify configuration
214  *
215  * @handle: acpi handle
216  * @n: atif notification configuration struct
217  *
218  * Execute the ATIF_FUNCTION_GET_SYSTEM_PARAMETERS ATIF function
219  * to determine if a notifier is used and if so which one
220  * (all asics).  This is either Notify(VGA, 0x81) or Notify(VGA, n)
221  * where n is specified in the result if a notifier is used.
222  * Returns 0 on success, error on failure.
223  */
224 static int radeon_atif_get_notification_params(ACPI_HANDLE handle,
225                 struct radeon_atif_notification_cfg *n)
226 {
227         ACPI_OBJECT *info;
228         struct atif_system_params params;
229         size_t size;
230         int err = 0;
231
232         info = radeon_atif_call(handle, ATIF_FUNCTION_GET_SYSTEM_PARAMETERS, NULL);
233         if (!info) {
234                 err = -EIO;
235                 goto out;
236         }
237
238         size = *(u16 *) info->Buffer.Pointer;
239         if (size < 10) {
240                 err = -EINVAL;
241                 goto out;
242         }
243
244         memset(&params, 0, sizeof(params));
245         size = min(sizeof(params), size);
246         memcpy(&params, info->Buffer.Pointer, size);
247
248         DRM_DEBUG_DRIVER("SYSTEM_PARAMS: mask = %#x, flags = %#x\n",
249                         params.flags, params.valid_mask);
250         params.flags = params.flags & params.valid_mask;
251
252         if ((params.flags & ATIF_NOTIFY_MASK) == ATIF_NOTIFY_NONE) {
253                 n->enabled = false;
254                 n->command_code = 0;
255         } else if ((params.flags & ATIF_NOTIFY_MASK) == ATIF_NOTIFY_81) {
256                 n->enabled = true;
257                 n->command_code = 0x81;
258         } else {
259                 if (size < 11) {
260                         err = -EINVAL;
261                         goto out;
262                 }
263                 n->enabled = true;
264                 n->command_code = params.command_code;
265         }
266
267 out:
268         DRM_DEBUG_DRIVER("Notification %s, command code = %#x\n",
269                         (n->enabled ? "enabled" : "disabled"),
270                         n->command_code);
271         AcpiOsFree(info);
272         return err;
273 }
274
275 /**
276  * radeon_atif_get_sbios_requests - get requested sbios event
277  *
278  * @handle: acpi handle
279  * @req: atif sbios request struct
280  *
281  * Execute the ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS ATIF function
282  * to determine what requests the sbios is making to the driver
283  * (all asics).
284  * Returns 0 on success, error on failure.
285  */
286 static int radeon_atif_get_sbios_requests(ACPI_HANDLE handle,
287                 struct atif_sbios_requests *req)
288 {
289         ACPI_OBJECT *info;
290         size_t size;
291         int count = 0;
292
293         info = radeon_atif_call(handle, ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS, NULL);
294         if (!info)
295                 return -EIO;
296
297         size = *(u16 *)info->Buffer.Pointer;
298         if (size < 0xd) {
299                 count = -EINVAL;
300                 goto out;
301         }
302         memset(req, 0, sizeof(*req));
303
304         size = min(sizeof(*req), size);
305         memcpy(req, info->Buffer.Pointer, size);
306         DRM_DEBUG_DRIVER("SBIOS pending requests: %#x\n", req->pending);
307
308         count = hweight32(req->pending);
309
310 out:
311         AcpiOsFree(info);
312         return count;
313 }
314
315 /**
316  * radeon_atif_handler - handle ATIF notify requests
317  *
318  * @rdev: radeon_device pointer
319  * @event: atif sbios request struct
320  *
321  * Checks the acpi event and if it matches an atif event,
322  * handles it.
323  * Returns NOTIFY code
324  */
325 void radeon_atif_handler(struct radeon_device *rdev,
326     UINT32 type)
327 {
328         struct radeon_atif *atif = &rdev->atif;
329         struct atif_sbios_requests req;
330         ACPI_HANDLE handle;
331         int count;
332
333         DRM_DEBUG_DRIVER("event, type = %#x\n",
334                         type);
335
336         if (!atif->notification_cfg.enabled ||
337                         type != atif->notification_cfg.command_code)
338                 /* Not our event */
339                 return;
340
341         /* Check pending SBIOS requests */
342         handle = rdev->acpi.handle;
343         count = radeon_atif_get_sbios_requests(handle, &req);
344
345         if (count <= 0)
346                 return;
347
348         DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count);
349
350         if (req.pending & ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST) {
351                 struct radeon_encoder *enc = atif->encoder_for_bl;
352
353                 if (enc) {
354                         DRM_DEBUG_DRIVER("Changing brightness to %d\n",
355                                         req.backlight_level);
356
357                         radeon_set_backlight_level(rdev, enc, req.backlight_level);
358
359 #ifdef DUMBBELL_WIP
360                         if (rdev->is_atom_bios) {
361                                 struct radeon_encoder_atom_dig *dig = enc->enc_priv;
362                                 backlight_force_update(dig->bl_dev,
363                                                        BACKLIGHT_UPDATE_HOTKEY);
364                         } else {
365                                 struct radeon_encoder_lvds *dig = enc->enc_priv;
366                                 backlight_force_update(dig->bl_dev,
367                                                        BACKLIGHT_UPDATE_HOTKEY);
368                         }
369 #endif /* DUMBBELL_WIP */
370                 }
371         }
372         /* TODO: check other events */
373
374         /* We've handled the event, stop the notifier chain. The ACPI interface
375          * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to
376          * userspace if the event was generated only to signal a SBIOS
377          * request.
378          */
379 }
380
381 /* Call the ATCS method
382  */
383 /**
384  * radeon_atcs_call - call an ATCS method
385  *
386  * @handle: acpi handle
387  * @function: the ATCS function to execute
388  * @params: ATCS function params
389  *
390  * Executes the requested ATCS function (all asics).
391  * Returns a pointer to the acpi output buffer.
392  */
393 static union acpi_object *radeon_atcs_call(ACPI_HANDLE handle, int function,
394                                            ACPI_BUFFER *params)
395 {
396         ACPI_STATUS status;
397         ACPI_OBJECT atcs_arg_elements[2];
398         ACPI_OBJECT_LIST atcs_arg;
399         ACPI_BUFFER buffer = { ACPI_ALLOCATE_BUFFER, NULL };
400
401         atcs_arg.Count = 2;
402         atcs_arg.Pointer = &atcs_arg_elements[0];
403
404         atcs_arg_elements[0].Type = ACPI_TYPE_INTEGER;
405         atcs_arg_elements[0].Integer.Value = function;
406
407         if (params) {
408                 atcs_arg_elements[1].Type = ACPI_TYPE_BUFFER;
409                 atcs_arg_elements[1].Buffer.Length = params->Length;
410                 atcs_arg_elements[1].Buffer.Pointer = params->Pointer;
411         } else {
412                 /* We need a second fake parameter */
413                 atcs_arg_elements[1].Type = ACPI_TYPE_INTEGER;
414                 atcs_arg_elements[1].Integer.Value = 0;
415         }
416
417         status = AcpiEvaluateObject(handle, "ATCS", &atcs_arg, &buffer);
418
419         /* Fail only if calling the method fails and ATIF is supported */
420         if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
421                 DRM_DEBUG_DRIVER("failed to evaluate ATCS got %s\n",
422                                  AcpiFormatException(status));
423                 AcpiOsFree(buffer.Pointer);
424                 return NULL;
425         }
426
427         return buffer.Pointer;
428 }
429
430 /**
431  * radeon_atcs_parse_functions - parse supported functions
432  *
433  * @f: supported functions struct
434  * @mask: supported functions mask from ATCS
435  *
436  * Use the supported functions mask from ATCS function
437  * ATCS_FUNCTION_VERIFY_INTERFACE to determine what functions
438  * are supported (all asics).
439  */
440 static void radeon_atcs_parse_functions(struct radeon_atcs_functions *f, u32 mask)
441 {
442         f->get_ext_state = mask & ATCS_GET_EXTERNAL_STATE_SUPPORTED;
443         f->pcie_perf_req = mask & ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED;
444         f->pcie_dev_rdy = mask & ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED;
445         f->pcie_bus_width = mask & ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED;
446 }
447
448 /**
449  * radeon_atcs_verify_interface - verify ATCS
450  *
451  * @handle: acpi handle
452  * @atcs: radeon atcs struct
453  *
454  * Execute the ATCS_FUNCTION_VERIFY_INTERFACE ATCS function
455  * to initialize ATCS and determine what features are supported
456  * (all asics).
457  * returns 0 on success, error on failure.
458  */
459 static int radeon_atcs_verify_interface(ACPI_HANDLE handle,
460                                         struct radeon_atcs *atcs)
461 {
462         ACPI_OBJECT *info;
463         struct atcs_verify_interface output;
464         size_t size;
465         int err = 0;
466
467         info = radeon_atcs_call(handle, ATCS_FUNCTION_VERIFY_INTERFACE, NULL);
468         if (!info)
469                 return -EIO;
470
471         memset(&output, 0, sizeof(output));
472
473         size = *(u16 *) info->Buffer.Pointer;
474         if (size < 8) {
475                 DRM_INFO("ATCS buffer is too small: %zu\n", size);
476                 err = -EINVAL;
477                 goto out;
478         }
479         size = min(sizeof(output), size);
480
481         memcpy(&output, info->Buffer.Pointer, size);
482
483         /* TODO: check version? */
484         DRM_DEBUG_DRIVER("ATCS version %u\n", output.version);
485
486         radeon_atcs_parse_functions(&atcs->functions, output.function_bits);
487
488 out:
489         AcpiOsFree(info);
490         return err;
491 }
492
493 /**
494  * radeon_acpi_event - handle notify events
495  *
496  * @nb: notifier block
497  * @val: val
498  * @data: acpi event
499  *
500  * Calls relevant radeon functions in response to various
501  * acpi events.
502  * Returns NOTIFY code
503  */
504 static void radeon_acpi_event(ACPI_HANDLE handle, UINT32 type,
505     void *context)
506 {
507         struct radeon_device *rdev = (struct radeon_device *)context;
508
509 #ifdef DUMBBELL_WIP
510         if (strcmp(entry->device_class, ACPI_AC_CLASS) == 0) {
511                 if (power_supply_is_system_supplied() > 0)
512                         DRM_DEBUG_DRIVER("pm: AC\n");
513                 else
514                         DRM_DEBUG_DRIVER("pm: DC\n");
515
516                 radeon_pm_acpi_event_handler(rdev);
517         }
518 #endif /* DUMBBELL_WIP */
519
520         /* Check for pending SBIOS requests */
521         radeon_atif_handler(rdev, type);
522 }
523
524 /* Call all ACPI methods here */
525 /**
526  * radeon_acpi_init - init driver acpi support
527  *
528  * @rdev: radeon_device pointer
529  *
530  * Verifies the AMD ACPI interfaces and registers with the acpi
531  * notifier chain (all asics).
532  * Returns 0 on success, error on failure.
533  */
534 int radeon_acpi_init(struct radeon_device *rdev)
535 {
536         ACPI_HANDLE handle;
537         struct radeon_atif *atif = &rdev->atif;
538         struct radeon_atcs *atcs = &rdev->atcs;
539         int ret;
540
541         /* Get the device handle */
542         handle = acpi_get_handle(rdev->dev);
543
544         /* No need to proceed if we're sure that ATIF is not supported */
545         if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle)
546                 return 0;
547
548         /* Call the ATCS method */
549         ret = radeon_atcs_verify_interface(handle, atcs);
550         if (ret) {
551                 DRM_DEBUG_DRIVER("Call to ATCS verify_interface failed: %d\n", ret);
552         }
553
554         /* Call the ATIF method */
555         ret = radeon_atif_verify_interface(handle, atif);
556         if (ret) {
557                 DRM_DEBUG_DRIVER("Call to ATIF verify_interface failed: %d\n", ret);
558                 goto out;
559         }
560
561         if (atif->notifications.brightness_change) {
562                 struct drm_encoder *tmp;
563                 struct radeon_encoder *target = NULL;
564
565                 /* Find the encoder controlling the brightness */
566                 list_for_each_entry(tmp, &rdev->ddev->mode_config.encoder_list,
567                                 head) {
568                         struct radeon_encoder *enc = to_radeon_encoder(tmp);
569
570                         if ((enc->devices & (ATOM_DEVICE_LCD_SUPPORT)) &&
571                             enc->enc_priv) {
572                                 if (rdev->is_atom_bios) {
573                                         struct radeon_encoder_atom_dig *dig = enc->enc_priv;
574                                         if (dig->bl_dev) {
575                                                 target = enc;
576                                                 break;
577                                         }
578                                 } else {
579                                         struct radeon_encoder_lvds *dig = enc->enc_priv;
580                                         if (dig->bl_dev) {
581                                                 target = enc;
582                                                 break;
583                                         }
584                                 }
585                         }
586                 }
587
588                 atif->encoder_for_bl = target;
589                 if (!target) {
590                         /* Brightness change notification is enabled, but we
591                          * didn't find a backlight controller, this should
592                          * never happen.
593                          */
594                         DRM_ERROR("Cannot find a backlight controller\n");
595                 }
596         }
597
598         if (atif->functions.sbios_requests && !atif->functions.system_params) {
599                 /* XXX check this workraround, if sbios request function is
600                  * present we have to see how it's configured in the system
601                  * params
602                  */
603                 atif->functions.system_params = true;
604         }
605
606         if (atif->functions.system_params) {
607                 ret = radeon_atif_get_notification_params(handle,
608                                 &atif->notification_cfg);
609                 if (ret) {
610                         DRM_DEBUG_DRIVER("Call to GET_SYSTEM_PARAMS failed: %d\n",
611                                         ret);
612                         /* Disable notification */
613                         atif->notification_cfg.enabled = false;
614                 }
615         }
616
617 out:
618         rdev->acpi.handle = handle;
619         rdev->acpi.notifier_call = radeon_acpi_event;
620         AcpiInstallNotifyHandler(handle, ACPI_DEVICE_NOTIFY,
621             rdev->acpi.notifier_call, rdev);
622
623         return ret;
624 }
625
626 /**
627  * radeon_acpi_fini - tear down driver acpi support
628  *
629  * @rdev: radeon_device pointer
630  *
631  * Unregisters with the acpi notifier chain (all asics).
632  */
633 void radeon_acpi_fini(struct radeon_device *rdev)
634 {
635         AcpiRemoveNotifyHandler(rdev->acpi.handle, ACPI_DEVICE_NOTIFY,
636             rdev->acpi.notifier_call);
637 }