2 * Copyright 2012 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
24 #include <linux/pci.h>
25 #include <linux/acpi.h>
26 #include <linux/slab.h>
27 #include <linux/power_supply.h>
28 #include <linux/vga_switcheroo.h>
29 #include <acpi/video.h>
31 #include <drm/drm_crtc_helper.h>
33 #include "amdgpu_acpi.h"
36 #define ACPI_AC_CLASS "ac_adapter"
38 extern void amdgpu_pm_acpi_event_handler(struct amdgpu_device
*adev
);
40 struct atif_verify_interface
{
41 u16 size
; /* structure size in bytes (includes size field) */
42 u16 version
; /* version */
43 u32 notification_mask
; /* supported notifications mask */
44 u32 function_bits
; /* supported functions bit vector */
47 struct atif_system_params
{
48 u16 size
; /* structure size in bytes (includes size field) */
49 u32 valid_mask
; /* valid flags mask */
50 u32 flags
; /* flags */
51 u8 command_code
; /* notify command code */
54 struct atif_sbios_requests
{
55 u16 size
; /* structure size in bytes (includes size field) */
56 u32 pending
; /* pending sbios requests */
57 u8 panel_exp_mode
; /* panel expansion mode */
58 u8 thermal_gfx
; /* thermal state: target gfx controller */
59 u8 thermal_state
; /* thermal state: state id (0: exit state, non-0: state) */
60 u8 forced_power_gfx
; /* forced power state: target gfx controller */
61 u8 forced_power_state
; /* forced power state: state id */
62 u8 system_power_src
; /* system power source */
63 u8 backlight_level
; /* panel backlight level (0-255) */
66 #define ATIF_NOTIFY_MASK 0x3
67 #define ATIF_NOTIFY_NONE 0
68 #define ATIF_NOTIFY_81 1
69 #define ATIF_NOTIFY_N 2
71 struct atcs_verify_interface
{
72 u16 size
; /* structure size in bytes (includes size field) */
73 u16 version
; /* version */
74 u32 function_bits
; /* supported functions bit vector */
77 #define ATCS_VALID_FLAGS_MASK 0x3
79 struct atcs_pref_req_input
{
80 u16 size
; /* structure size in bytes (includes size field) */
81 u16 client_id
; /* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */
82 u16 valid_flags_mask
; /* valid flags mask */
83 u16 flags
; /* flags */
84 u8 req_type
; /* request type */
85 u8 perf_req
; /* performance request */
88 struct atcs_pref_req_output
{
89 u16 size
; /* structure size in bytes (includes size field) */
90 u8 ret_val
; /* return value */
93 /* Call the ATIF method
96 * amdgpu_atif_call - call an ATIF method
98 * @handle: acpi handle
99 * @function: the ATIF function to execute
100 * @params: ATIF function params
102 * Executes the requested ATIF function (all asics).
103 * Returns a pointer to the acpi output buffer.
105 static union acpi_object
*amdgpu_atif_call(acpi_handle handle
, int function
,
106 struct acpi_buffer
*params
)
109 union acpi_object atif_arg_elements
[2];
110 struct acpi_object_list atif_arg
;
111 struct acpi_buffer buffer
= { ACPI_ALLOCATE_BUFFER
, NULL
};
114 atif_arg
.pointer
= &atif_arg_elements
[0];
116 atif_arg_elements
[0].type
= ACPI_TYPE_INTEGER
;
117 atif_arg_elements
[0].integer
.value
= function
;
120 atif_arg_elements
[1].type
= ACPI_TYPE_BUFFER
;
121 atif_arg_elements
[1].buffer
.length
= params
->length
;
122 atif_arg_elements
[1].buffer
.pointer
= params
->pointer
;
124 /* We need a second fake parameter */
125 atif_arg_elements
[1].type
= ACPI_TYPE_INTEGER
;
126 atif_arg_elements
[1].integer
.value
= 0;
129 status
= acpi_evaluate_object(handle
, "ATIF", &atif_arg
, &buffer
);
131 /* Fail only if calling the method fails and ATIF is supported */
132 if (ACPI_FAILURE(status
) && status
!= AE_NOT_FOUND
) {
133 DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n",
134 acpi_format_exception(status
));
135 kfree(buffer
.pointer
);
139 return buffer
.pointer
;
143 * amdgpu_atif_parse_notification - parse supported notifications
145 * @n: supported notifications struct
146 * @mask: supported notifications mask from ATIF
148 * Use the supported notifications mask from ATIF function
149 * ATIF_FUNCTION_VERIFY_INTERFACE to determine what notifications
150 * are supported (all asics).
152 static void amdgpu_atif_parse_notification(struct amdgpu_atif_notifications
*n
, u32 mask
)
154 n
->display_switch
= mask
& ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED
;
155 n
->expansion_mode_change
= mask
& ATIF_EXPANSION_MODE_CHANGE_REQUEST_SUPPORTED
;
156 n
->thermal_state
= mask
& ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED
;
157 n
->forced_power_state
= mask
& ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED
;
158 n
->system_power_state
= mask
& ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED
;
159 n
->display_conf_change
= mask
& ATIF_DISPLAY_CONF_CHANGE_REQUEST_SUPPORTED
;
160 n
->px_gfx_switch
= mask
& ATIF_PX_GFX_SWITCH_REQUEST_SUPPORTED
;
161 n
->brightness_change
= mask
& ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED
;
162 n
->dgpu_display_event
= mask
& ATIF_DGPU_DISPLAY_EVENT_SUPPORTED
;
166 * amdgpu_atif_parse_functions - parse supported functions
168 * @f: supported functions struct
169 * @mask: supported functions mask from ATIF
171 * Use the supported functions mask from ATIF function
172 * ATIF_FUNCTION_VERIFY_INTERFACE to determine what functions
173 * are supported (all asics).
175 static void amdgpu_atif_parse_functions(struct amdgpu_atif_functions
*f
, u32 mask
)
177 f
->system_params
= mask
& ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED
;
178 f
->sbios_requests
= mask
& ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED
;
179 f
->select_active_disp
= mask
& ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED
;
180 f
->lid_state
= mask
& ATIF_GET_LID_STATE_SUPPORTED
;
181 f
->get_tv_standard
= mask
& ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED
;
182 f
->set_tv_standard
= mask
& ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED
;
183 f
->get_panel_expansion_mode
= mask
& ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED
;
184 f
->set_panel_expansion_mode
= mask
& ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED
;
185 f
->temperature_change
= mask
& ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED
;
186 f
->graphics_device_types
= mask
& ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED
;
190 * amdgpu_atif_verify_interface - verify ATIF
192 * @handle: acpi handle
193 * @atif: amdgpu atif struct
195 * Execute the ATIF_FUNCTION_VERIFY_INTERFACE ATIF function
196 * to initialize ATIF and determine what features are supported
198 * returns 0 on success, error on failure.
200 static int amdgpu_atif_verify_interface(acpi_handle handle
,
201 struct amdgpu_atif
*atif
)
203 union acpi_object
*info
;
204 struct atif_verify_interface output
;
208 info
= amdgpu_atif_call(handle
, ATIF_FUNCTION_VERIFY_INTERFACE
, NULL
);
212 memset(&output
, 0, sizeof(output
));
214 size
= *(u16
*) info
->buffer
.pointer
;
216 DRM_INFO("ATIF buffer is too small: %zu\n", size
);
220 size
= min(sizeof(output
), size
);
222 memcpy(&output
, info
->buffer
.pointer
, size
);
224 /* TODO: check version? */
225 DRM_DEBUG_DRIVER("ATIF version %u\n", output
.version
);
227 amdgpu_atif_parse_notification(&atif
->notifications
, output
.notification_mask
);
228 amdgpu_atif_parse_functions(&atif
->functions
, output
.function_bits
);
236 * amdgpu_atif_get_notification_params - determine notify configuration
238 * @handle: acpi handle
239 * @n: atif notification configuration struct
241 * Execute the ATIF_FUNCTION_GET_SYSTEM_PARAMETERS ATIF function
242 * to determine if a notifier is used and if so which one
243 * (all asics). This is either Notify(VGA, 0x81) or Notify(VGA, n)
244 * where n is specified in the result if a notifier is used.
245 * Returns 0 on success, error on failure.
247 static int amdgpu_atif_get_notification_params(acpi_handle handle
,
248 struct amdgpu_atif_notification_cfg
*n
)
250 union acpi_object
*info
;
251 struct atif_system_params params
;
255 info
= amdgpu_atif_call(handle
, ATIF_FUNCTION_GET_SYSTEM_PARAMETERS
, NULL
);
261 size
= *(u16
*) info
->buffer
.pointer
;
267 memset(¶ms
, 0, sizeof(params
));
268 size
= min(sizeof(params
), size
);
269 memcpy(¶ms
, info
->buffer
.pointer
, size
);
271 DRM_DEBUG_DRIVER("SYSTEM_PARAMS: mask = %#x, flags = %#x\n",
272 params
.flags
, params
.valid_mask
);
273 params
.flags
= params
.flags
& params
.valid_mask
;
275 if ((params
.flags
& ATIF_NOTIFY_MASK
) == ATIF_NOTIFY_NONE
) {
278 } else if ((params
.flags
& ATIF_NOTIFY_MASK
) == ATIF_NOTIFY_81
) {
280 n
->command_code
= 0x81;
287 n
->command_code
= params
.command_code
;
291 DRM_DEBUG_DRIVER("Notification %s, command code = %#x\n",
292 (n
->enabled
? "enabled" : "disabled"),
299 * amdgpu_atif_get_sbios_requests - get requested sbios event
301 * @handle: acpi handle
302 * @req: atif sbios request struct
304 * Execute the ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS ATIF function
305 * to determine what requests the sbios is making to the driver
307 * Returns 0 on success, error on failure.
309 static int amdgpu_atif_get_sbios_requests(acpi_handle handle
,
310 struct atif_sbios_requests
*req
)
312 union acpi_object
*info
;
316 info
= amdgpu_atif_call(handle
, ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS
, NULL
);
320 size
= *(u16
*)info
->buffer
.pointer
;
325 memset(req
, 0, sizeof(*req
));
327 size
= min(sizeof(*req
), size
);
328 memcpy(req
, info
->buffer
.pointer
, size
);
329 DRM_DEBUG_DRIVER("SBIOS pending requests: %#x\n", req
->pending
);
331 count
= hweight32(req
->pending
);
339 * amdgpu_atif_handler - handle ATIF notify requests
341 * @adev: amdgpu_device pointer
342 * @event: atif sbios request struct
344 * Checks the acpi event and if it matches an atif event,
346 * Returns NOTIFY code
348 int amdgpu_atif_handler(struct amdgpu_device
*adev
,
349 struct acpi_bus_event
*event
)
351 struct amdgpu_atif
*atif
= &adev
->atif
;
352 struct atif_sbios_requests req
;
356 DRM_DEBUG_DRIVER("event, device_class = %s, type = %#x\n",
357 event
->device_class
, event
->type
);
359 if (strcmp(event
->device_class
, ACPI_VIDEO_CLASS
) != 0)
362 if (!atif
->notification_cfg
.enabled
||
363 event
->type
!= atif
->notification_cfg
.command_code
)
367 /* Check pending SBIOS requests */
368 handle
= ACPI_HANDLE(&adev
->pdev
->dev
);
369 count
= amdgpu_atif_get_sbios_requests(handle
, &req
);
374 DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count
);
376 if (req
.pending
& ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST
) {
377 struct amdgpu_encoder
*enc
= atif
->encoder_for_bl
;
380 struct amdgpu_encoder_atom_dig
*dig
= enc
->enc_priv
;
382 DRM_DEBUG_DRIVER("Changing brightness to %d\n",
383 req
.backlight_level
);
385 amdgpu_display_backlight_set_level(adev
, enc
, req
.backlight_level
);
387 #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
388 backlight_force_update(dig
->bl_dev
,
389 BACKLIGHT_UPDATE_HOTKEY
);
393 /* TODO: check other events */
395 /* We've handled the event, stop the notifier chain. The ACPI interface
396 * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to
397 * userspace if the event was generated only to signal a SBIOS
403 /* Call the ATCS method
406 * amdgpu_atcs_call - call an ATCS method
408 * @handle: acpi handle
409 * @function: the ATCS function to execute
410 * @params: ATCS function params
412 * Executes the requested ATCS function (all asics).
413 * Returns a pointer to the acpi output buffer.
415 static union acpi_object
*amdgpu_atcs_call(acpi_handle handle
, int function
,
416 struct acpi_buffer
*params
)
419 union acpi_object atcs_arg_elements
[2];
420 struct acpi_object_list atcs_arg
;
421 struct acpi_buffer buffer
= { ACPI_ALLOCATE_BUFFER
, NULL
};
424 atcs_arg
.pointer
= &atcs_arg_elements
[0];
426 atcs_arg_elements
[0].type
= ACPI_TYPE_INTEGER
;
427 atcs_arg_elements
[0].integer
.value
= function
;
430 atcs_arg_elements
[1].type
= ACPI_TYPE_BUFFER
;
431 atcs_arg_elements
[1].buffer
.length
= params
->length
;
432 atcs_arg_elements
[1].buffer
.pointer
= params
->pointer
;
434 /* We need a second fake parameter */
435 atcs_arg_elements
[1].type
= ACPI_TYPE_INTEGER
;
436 atcs_arg_elements
[1].integer
.value
= 0;
439 status
= acpi_evaluate_object(handle
, "ATCS", &atcs_arg
, &buffer
);
441 /* Fail only if calling the method fails and ATIF is supported */
442 if (ACPI_FAILURE(status
) && status
!= AE_NOT_FOUND
) {
443 DRM_DEBUG_DRIVER("failed to evaluate ATCS got %s\n",
444 acpi_format_exception(status
));
445 kfree(buffer
.pointer
);
449 return buffer
.pointer
;
453 * amdgpu_atcs_parse_functions - parse supported functions
455 * @f: supported functions struct
456 * @mask: supported functions mask from ATCS
458 * Use the supported functions mask from ATCS function
459 * ATCS_FUNCTION_VERIFY_INTERFACE to determine what functions
460 * are supported (all asics).
462 static void amdgpu_atcs_parse_functions(struct amdgpu_atcs_functions
*f
, u32 mask
)
464 f
->get_ext_state
= mask
& ATCS_GET_EXTERNAL_STATE_SUPPORTED
;
465 f
->pcie_perf_req
= mask
& ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED
;
466 f
->pcie_dev_rdy
= mask
& ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED
;
467 f
->pcie_bus_width
= mask
& ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED
;
471 * amdgpu_atcs_verify_interface - verify ATCS
473 * @handle: acpi handle
474 * @atcs: amdgpu atcs struct
476 * Execute the ATCS_FUNCTION_VERIFY_INTERFACE ATCS function
477 * to initialize ATCS and determine what features are supported
479 * returns 0 on success, error on failure.
481 static int amdgpu_atcs_verify_interface(acpi_handle handle
,
482 struct amdgpu_atcs
*atcs
)
484 union acpi_object
*info
;
485 struct atcs_verify_interface output
;
489 info
= amdgpu_atcs_call(handle
, ATCS_FUNCTION_VERIFY_INTERFACE
, NULL
);
493 memset(&output
, 0, sizeof(output
));
495 size
= *(u16
*) info
->buffer
.pointer
;
497 DRM_INFO("ATCS buffer is too small: %zu\n", size
);
501 size
= min(sizeof(output
), size
);
503 memcpy(&output
, info
->buffer
.pointer
, size
);
505 /* TODO: check version? */
506 DRM_DEBUG_DRIVER("ATCS version %u\n", output
.version
);
508 amdgpu_atcs_parse_functions(&atcs
->functions
, output
.function_bits
);
516 * amdgpu_acpi_is_pcie_performance_request_supported
518 * @adev: amdgpu_device pointer
520 * Check if the ATCS pcie_perf_req and pcie_dev_rdy methods
521 * are supported (all asics).
522 * returns true if supported, false if not.
524 bool amdgpu_acpi_is_pcie_performance_request_supported(struct amdgpu_device
*adev
)
526 struct amdgpu_atcs
*atcs
= &adev
->atcs
;
528 if (atcs
->functions
.pcie_perf_req
&& atcs
->functions
.pcie_dev_rdy
)
535 * amdgpu_acpi_pcie_notify_device_ready
537 * @adev: amdgpu_device pointer
539 * Executes the PCIE_DEVICE_READY_NOTIFICATION method
541 * returns 0 on success, error on failure.
543 int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device
*adev
)
546 union acpi_object
*info
;
547 struct amdgpu_atcs
*atcs
= &adev
->atcs
;
549 /* Get the device handle */
550 handle
= ACPI_HANDLE(&adev
->pdev
->dev
);
554 if (!atcs
->functions
.pcie_dev_rdy
)
557 info
= amdgpu_atcs_call(handle
, ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION
, NULL
);
567 * amdgpu_acpi_pcie_performance_request
569 * @adev: amdgpu_device pointer
570 * @perf_req: requested perf level (pcie gen speed)
571 * @advertise: set advertise caps flag if set
573 * Executes the PCIE_PERFORMANCE_REQUEST method to
574 * change the pcie gen speed (all asics).
575 * returns 0 on success, error on failure.
577 int amdgpu_acpi_pcie_performance_request(struct amdgpu_device
*adev
,
578 u8 perf_req
, bool advertise
)
581 union acpi_object
*info
;
582 struct amdgpu_atcs
*atcs
= &adev
->atcs
;
583 struct atcs_pref_req_input atcs_input
;
584 struct atcs_pref_req_output atcs_output
;
585 struct acpi_buffer params
;
589 /* Get the device handle */
590 handle
= ACPI_HANDLE(&adev
->pdev
->dev
);
594 if (!atcs
->functions
.pcie_perf_req
)
597 atcs_input
.size
= sizeof(struct atcs_pref_req_input
);
598 /* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */
599 atcs_input
.client_id
= adev
->pdev
->devfn
| (adev
->pdev
->bus
->number
<< 8);
600 atcs_input
.valid_flags_mask
= ATCS_VALID_FLAGS_MASK
;
601 atcs_input
.flags
= ATCS_WAIT_FOR_COMPLETION
;
603 atcs_input
.flags
|= ATCS_ADVERTISE_CAPS
;
604 atcs_input
.req_type
= ATCS_PCIE_LINK_SPEED
;
605 atcs_input
.perf_req
= perf_req
;
607 params
.length
= sizeof(struct atcs_pref_req_input
);
608 params
.pointer
= &atcs_input
;
611 info
= amdgpu_atcs_call(handle
, ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST
, ¶ms
);
615 memset(&atcs_output
, 0, sizeof(atcs_output
));
617 size
= *(u16
*) info
->buffer
.pointer
;
619 DRM_INFO("ATCS buffer is too small: %zu\n", size
);
623 size
= min(sizeof(atcs_output
), size
);
625 memcpy(&atcs_output
, info
->buffer
.pointer
, size
);
629 switch (atcs_output
.ret_val
) {
630 case ATCS_REQUEST_REFUSED
:
633 case ATCS_REQUEST_COMPLETE
:
635 case ATCS_REQUEST_IN_PROGRESS
:
645 * amdgpu_acpi_event - handle notify events
647 * @nb: notifier block
651 * Calls relevant amdgpu functions in response to various
653 * Returns NOTIFY code
655 static int amdgpu_acpi_event(struct notifier_block
*nb
,
659 struct amdgpu_device
*adev
= container_of(nb
, struct amdgpu_device
, acpi_nb
);
660 struct acpi_bus_event
*entry
= (struct acpi_bus_event
*)data
;
662 if (strcmp(entry
->device_class
, ACPI_AC_CLASS
) == 0) {
663 if (power_supply_is_system_supplied() > 0)
664 DRM_DEBUG_DRIVER("pm: AC\n");
666 DRM_DEBUG_DRIVER("pm: DC\n");
668 amdgpu_pm_acpi_event_handler(adev
);
671 /* Check for pending SBIOS requests */
672 return amdgpu_atif_handler(adev
, entry
);
675 /* Call all ACPI methods here */
677 * amdgpu_acpi_init - init driver acpi support
679 * @adev: amdgpu_device pointer
681 * Verifies the AMD ACPI interfaces and registers with the acpi
682 * notifier chain (all asics).
683 * Returns 0 on success, error on failure.
685 int amdgpu_acpi_init(struct amdgpu_device
*adev
)
688 struct amdgpu_atif
*atif
= &adev
->atif
;
689 struct amdgpu_atcs
*atcs
= &adev
->atcs
;
692 /* Get the device handle */
693 handle
= ACPI_HANDLE(&adev
->pdev
->dev
);
695 if (!adev
->bios
|| !handle
)
698 /* Call the ATCS method */
699 ret
= amdgpu_atcs_verify_interface(handle
, atcs
);
701 DRM_DEBUG_DRIVER("Call to ATCS verify_interface failed: %d\n", ret
);
704 /* Call the ATIF method */
705 ret
= amdgpu_atif_verify_interface(handle
, atif
);
707 DRM_DEBUG_DRIVER("Call to ATIF verify_interface failed: %d\n", ret
);
711 if (atif
->notifications
.brightness_change
) {
712 struct drm_encoder
*tmp
;
714 /* Find the encoder controlling the brightness */
715 list_for_each_entry(tmp
, &adev
->ddev
->mode_config
.encoder_list
,
717 struct amdgpu_encoder
*enc
= to_amdgpu_encoder(tmp
);
719 if ((enc
->devices
& (ATOM_DEVICE_LCD_SUPPORT
)) &&
721 if (adev
->is_atom_bios
) {
722 struct amdgpu_encoder_atom_dig
*dig
= enc
->enc_priv
;
724 atif
->encoder_for_bl
= enc
;
732 if (atif
->functions
.sbios_requests
&& !atif
->functions
.system_params
) {
733 /* XXX check this workraround, if sbios request function is
734 * present we have to see how it's configured in the system
737 atif
->functions
.system_params
= true;
740 if (atif
->functions
.system_params
) {
741 ret
= amdgpu_atif_get_notification_params(handle
,
742 &atif
->notification_cfg
);
744 DRM_DEBUG_DRIVER("Call to GET_SYSTEM_PARAMS failed: %d\n",
746 /* Disable notification */
747 atif
->notification_cfg
.enabled
= false;
752 adev
->acpi_nb
.notifier_call
= amdgpu_acpi_event
;
753 register_acpi_notifier(&adev
->acpi_nb
);
759 * amdgpu_acpi_fini - tear down driver acpi support
761 * @adev: amdgpu_device pointer
763 * Unregisters with the acpi notifier chain (all asics).
765 void amdgpu_acpi_fini(struct amdgpu_device
*adev
)
767 unregister_acpi_notifier(&adev
->acpi_nb
);