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 <acpi/video.h>
30 #include <drm/drm_crtc_helper.h>
32 #include "radeon_acpi.h"
35 #define ACPI_AC_CLASS "ac_adapter"
37 extern void radeon_pm_acpi_event_handler(struct radeon_device
*rdev
);
39 struct atif_verify_interface
{
40 u16 size
; /* structure size in bytes (includes size field) */
41 u16 version
; /* version */
42 u32 notification_mask
; /* supported notifications mask */
43 u32 function_bits
; /* supported functions bit vector */
46 struct atif_system_params
{
47 u16 size
; /* structure size in bytes (includes size field) */
48 u32 valid_mask
; /* valid flags mask */
49 u32 flags
; /* flags */
50 u8 command_code
; /* notify command code */
53 struct atif_sbios_requests
{
54 u16 size
; /* structure size in bytes (includes size field) */
55 u32 pending
; /* pending sbios requests */
56 u8 panel_exp_mode
; /* panel expansion mode */
57 u8 thermal_gfx
; /* thermal state: target gfx controller */
58 u8 thermal_state
; /* thermal state: state id (0: exit state, non-0: state) */
59 u8 forced_power_gfx
; /* forced power state: target gfx controller */
60 u8 forced_power_state
; /* forced power state: state id */
61 u8 system_power_src
; /* system power source */
62 u8 backlight_level
; /* panel backlight level (0-255) */
65 #define ATIF_NOTIFY_MASK 0x3
66 #define ATIF_NOTIFY_NONE 0
67 #define ATIF_NOTIFY_81 1
68 #define ATIF_NOTIFY_N 2
70 struct atcs_verify_interface
{
71 u16 size
; /* structure size in bytes (includes size field) */
72 u16 version
; /* version */
73 u32 function_bits
; /* supported functions bit vector */
76 #define ATCS_VALID_FLAGS_MASK 0x3
78 struct atcs_pref_req_input
{
79 u16 size
; /* structure size in bytes (includes size field) */
80 u16 client_id
; /* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */
81 u16 valid_flags_mask
; /* valid flags mask */
82 u16 flags
; /* flags */
83 u8 req_type
; /* request type */
84 u8 perf_req
; /* performance request */
87 struct atcs_pref_req_output
{
88 u16 size
; /* structure size in bytes (includes size field) */
89 u8 ret_val
; /* return value */
92 /* Call the ATIF method
95 * radeon_atif_call - call an ATIF method
97 * @handle: acpi handle
98 * @function: the ATIF function to execute
99 * @params: ATIF function params
101 * Executes the requested ATIF function (all asics).
102 * Returns a pointer to the acpi output buffer.
104 static union acpi_object
*radeon_atif_call(acpi_handle handle
, int function
,
105 struct acpi_buffer
*params
)
108 union acpi_object atif_arg_elements
[2];
109 struct acpi_object_list atif_arg
;
110 struct acpi_buffer buffer
= { ACPI_ALLOCATE_BUFFER
, NULL
};
113 atif_arg
.pointer
= &atif_arg_elements
[0];
115 atif_arg_elements
[0].type
= ACPI_TYPE_INTEGER
;
116 atif_arg_elements
[0].integer
.value
= function
;
119 atif_arg_elements
[1].type
= ACPI_TYPE_BUFFER
;
120 atif_arg_elements
[1].buffer
.length
= params
->length
;
121 atif_arg_elements
[1].buffer
.pointer
= params
->pointer
;
123 /* We need a second fake parameter */
124 atif_arg_elements
[1].type
= ACPI_TYPE_INTEGER
;
125 atif_arg_elements
[1].integer
.value
= 0;
128 status
= acpi_evaluate_object(handle
, "ATIF", &atif_arg
, &buffer
);
130 /* Fail only if calling the method fails and ATIF is supported */
131 if (ACPI_FAILURE(status
) && status
!= AE_NOT_FOUND
) {
132 DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n",
133 acpi_format_exception(status
));
134 kfree(buffer
.pointer
);
138 return buffer
.pointer
;
142 * radeon_atif_parse_notification - parse supported notifications
144 * @n: supported notifications struct
145 * @mask: supported notifications mask from ATIF
147 * Use the supported notifications mask from ATIF function
148 * ATIF_FUNCTION_VERIFY_INTERFACE to determine what notifications
149 * are supported (all asics).
151 static void radeon_atif_parse_notification(struct radeon_atif_notifications
*n
, u32 mask
)
153 n
->display_switch
= mask
& ATIF_DISPLAY_SWITCH_REQUEST_SUPPORTED
;
154 n
->expansion_mode_change
= mask
& ATIF_EXPANSION_MODE_CHANGE_REQUEST_SUPPORTED
;
155 n
->thermal_state
= mask
& ATIF_THERMAL_STATE_CHANGE_REQUEST_SUPPORTED
;
156 n
->forced_power_state
= mask
& ATIF_FORCED_POWER_STATE_CHANGE_REQUEST_SUPPORTED
;
157 n
->system_power_state
= mask
& ATIF_SYSTEM_POWER_SOURCE_CHANGE_REQUEST_SUPPORTED
;
158 n
->display_conf_change
= mask
& ATIF_DISPLAY_CONF_CHANGE_REQUEST_SUPPORTED
;
159 n
->px_gfx_switch
= mask
& ATIF_PX_GFX_SWITCH_REQUEST_SUPPORTED
;
160 n
->brightness_change
= mask
& ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST_SUPPORTED
;
161 n
->dgpu_display_event
= mask
& ATIF_DGPU_DISPLAY_EVENT_SUPPORTED
;
165 * radeon_atif_parse_functions - parse supported functions
167 * @f: supported functions struct
168 * @mask: supported functions mask from ATIF
170 * Use the supported functions mask from ATIF function
171 * ATIF_FUNCTION_VERIFY_INTERFACE to determine what functions
172 * are supported (all asics).
174 static void radeon_atif_parse_functions(struct radeon_atif_functions
*f
, u32 mask
)
176 f
->system_params
= mask
& ATIF_GET_SYSTEM_PARAMETERS_SUPPORTED
;
177 f
->sbios_requests
= mask
& ATIF_GET_SYSTEM_BIOS_REQUESTS_SUPPORTED
;
178 f
->select_active_disp
= mask
& ATIF_SELECT_ACTIVE_DISPLAYS_SUPPORTED
;
179 f
->lid_state
= mask
& ATIF_GET_LID_STATE_SUPPORTED
;
180 f
->get_tv_standard
= mask
& ATIF_GET_TV_STANDARD_FROM_CMOS_SUPPORTED
;
181 f
->set_tv_standard
= mask
& ATIF_SET_TV_STANDARD_IN_CMOS_SUPPORTED
;
182 f
->get_panel_expansion_mode
= mask
& ATIF_GET_PANEL_EXPANSION_MODE_FROM_CMOS_SUPPORTED
;
183 f
->set_panel_expansion_mode
= mask
& ATIF_SET_PANEL_EXPANSION_MODE_IN_CMOS_SUPPORTED
;
184 f
->temperature_change
= mask
& ATIF_TEMPERATURE_CHANGE_NOTIFICATION_SUPPORTED
;
185 f
->graphics_device_types
= mask
& ATIF_GET_GRAPHICS_DEVICE_TYPES_SUPPORTED
;
189 * radeon_atif_verify_interface - verify ATIF
191 * @handle: acpi handle
192 * @atif: radeon atif struct
194 * Execute the ATIF_FUNCTION_VERIFY_INTERFACE ATIF function
195 * to initialize ATIF and determine what features are supported
197 * returns 0 on success, error on failure.
199 static int radeon_atif_verify_interface(acpi_handle handle
,
200 struct radeon_atif
*atif
)
202 union acpi_object
*info
;
203 struct atif_verify_interface output
;
207 info
= radeon_atif_call(handle
, ATIF_FUNCTION_VERIFY_INTERFACE
, NULL
);
211 memset(&output
, 0, sizeof(output
));
213 size
= *(u16
*) info
->buffer
.pointer
;
215 DRM_INFO("ATIF buffer is too small: %zu\n", size
);
219 size
= min(sizeof(output
), size
);
221 memcpy(&output
, info
->buffer
.pointer
, size
);
223 /* TODO: check version? */
224 DRM_DEBUG_DRIVER("ATIF version %u\n", output
.version
);
226 radeon_atif_parse_notification(&atif
->notifications
, output
.notification_mask
);
227 radeon_atif_parse_functions(&atif
->functions
, output
.function_bits
);
235 * radeon_atif_get_notification_params - determine notify configuration
237 * @handle: acpi handle
238 * @n: atif notification configuration struct
240 * Execute the ATIF_FUNCTION_GET_SYSTEM_PARAMETERS ATIF function
241 * to determine if a notifier is used and if so which one
242 * (all asics). This is either Notify(VGA, 0x81) or Notify(VGA, n)
243 * where n is specified in the result if a notifier is used.
244 * Returns 0 on success, error on failure.
246 static int radeon_atif_get_notification_params(acpi_handle handle
,
247 struct radeon_atif_notification_cfg
*n
)
249 union acpi_object
*info
;
250 struct atif_system_params params
;
254 info
= radeon_atif_call(handle
, ATIF_FUNCTION_GET_SYSTEM_PARAMETERS
, NULL
);
260 size
= *(u16
*) info
->buffer
.pointer
;
266 memset(¶ms
, 0, sizeof(params
));
267 size
= min(sizeof(params
), size
);
268 memcpy(¶ms
, info
->buffer
.pointer
, size
);
270 DRM_DEBUG_DRIVER("SYSTEM_PARAMS: mask = %#x, flags = %#x\n",
271 params
.flags
, params
.valid_mask
);
272 params
.flags
= params
.flags
& params
.valid_mask
;
274 if ((params
.flags
& ATIF_NOTIFY_MASK
) == ATIF_NOTIFY_NONE
) {
277 } else if ((params
.flags
& ATIF_NOTIFY_MASK
) == ATIF_NOTIFY_81
) {
279 n
->command_code
= 0x81;
286 n
->command_code
= params
.command_code
;
290 DRM_DEBUG_DRIVER("Notification %s, command code = %#x\n",
291 (n
->enabled
? "enabled" : "disabled"),
298 * radeon_atif_get_sbios_requests - get requested sbios event
300 * @handle: acpi handle
301 * @req: atif sbios request struct
303 * Execute the ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS ATIF function
304 * to determine what requests the sbios is making to the driver
306 * Returns 0 on success, error on failure.
308 static int radeon_atif_get_sbios_requests(acpi_handle handle
,
309 struct atif_sbios_requests
*req
)
311 union acpi_object
*info
;
315 info
= radeon_atif_call(handle
, ATIF_FUNCTION_GET_SYSTEM_BIOS_REQUESTS
, NULL
);
319 size
= *(u16
*)info
->buffer
.pointer
;
324 memset(req
, 0, sizeof(*req
));
326 size
= min(sizeof(*req
), size
);
327 memcpy(req
, info
->buffer
.pointer
, size
);
328 DRM_DEBUG_DRIVER("SBIOS pending requests: %#x\n", req
->pending
);
330 count
= hweight32(req
->pending
);
338 * radeon_atif_handler - handle ATIF notify requests
340 * @rdev: radeon_device pointer
341 * @event: atif sbios request struct
343 * Checks the acpi event and if it matches an atif event,
345 * Returns NOTIFY code
347 int radeon_atif_handler(struct radeon_device
*rdev
,
348 struct acpi_bus_event
*event
)
350 struct radeon_atif
*atif
= &rdev
->atif
;
351 struct atif_sbios_requests req
;
355 DRM_DEBUG_DRIVER("event, device_class = %s, type = %#x\n",
356 event
->device_class
, event
->type
);
358 if (strcmp(event
->device_class
, ACPI_VIDEO_CLASS
) != 0)
361 if (!atif
->notification_cfg
.enabled
||
362 event
->type
!= atif
->notification_cfg
.command_code
)
366 /* Check pending SBIOS requests */
367 handle
= ACPI_HANDLE(&rdev
->pdev
->dev
);
368 count
= radeon_atif_get_sbios_requests(handle
, &req
);
373 DRM_DEBUG_DRIVER("ATIF: %d pending SBIOS requests\n", count
);
375 if (req
.pending
& ATIF_PANEL_BRIGHTNESS_CHANGE_REQUEST
) {
376 struct radeon_encoder
*enc
= atif
->encoder_for_bl
;
379 DRM_DEBUG_DRIVER("Changing brightness to %d\n",
380 req
.backlight_level
);
382 radeon_set_backlight_level(rdev
, enc
, req
.backlight_level
);
384 #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
385 if (rdev
->is_atom_bios
) {
386 struct radeon_encoder_atom_dig
*dig
= enc
->enc_priv
;
387 backlight_force_update(dig
->bl_dev
,
388 BACKLIGHT_UPDATE_HOTKEY
);
390 struct radeon_encoder_lvds
*dig
= enc
->enc_priv
;
391 backlight_force_update(dig
->bl_dev
,
392 BACKLIGHT_UPDATE_HOTKEY
);
397 /* TODO: check other events */
399 /* We've handled the event, stop the notifier chain. The ACPI interface
400 * overloads ACPI_VIDEO_NOTIFY_PROBE, we don't want to send that to
401 * userspace if the event was generated only to signal a SBIOS
407 /* Call the ATCS method
410 * radeon_atcs_call - call an ATCS method
412 * @handle: acpi handle
413 * @function: the ATCS function to execute
414 * @params: ATCS function params
416 * Executes the requested ATCS function (all asics).
417 * Returns a pointer to the acpi output buffer.
419 static union acpi_object
*radeon_atcs_call(acpi_handle handle
, int function
,
420 struct acpi_buffer
*params
)
423 union acpi_object atcs_arg_elements
[2];
424 struct acpi_object_list atcs_arg
;
425 struct acpi_buffer buffer
= { ACPI_ALLOCATE_BUFFER
, NULL
};
428 atcs_arg
.pointer
= &atcs_arg_elements
[0];
430 atcs_arg_elements
[0].type
= ACPI_TYPE_INTEGER
;
431 atcs_arg_elements
[0].integer
.value
= function
;
434 atcs_arg_elements
[1].type
= ACPI_TYPE_BUFFER
;
435 atcs_arg_elements
[1].buffer
.length
= params
->length
;
436 atcs_arg_elements
[1].buffer
.pointer
= params
->pointer
;
438 /* We need a second fake parameter */
439 atcs_arg_elements
[1].type
= ACPI_TYPE_INTEGER
;
440 atcs_arg_elements
[1].integer
.value
= 0;
443 status
= acpi_evaluate_object(handle
, "ATCS", &atcs_arg
, &buffer
);
445 /* Fail only if calling the method fails and ATIF is supported */
446 if (ACPI_FAILURE(status
) && status
!= AE_NOT_FOUND
) {
447 DRM_DEBUG_DRIVER("failed to evaluate ATCS got %s\n",
448 acpi_format_exception(status
));
449 kfree(buffer
.pointer
);
453 return buffer
.pointer
;
457 * radeon_atcs_parse_functions - parse supported functions
459 * @f: supported functions struct
460 * @mask: supported functions mask from ATCS
462 * Use the supported functions mask from ATCS function
463 * ATCS_FUNCTION_VERIFY_INTERFACE to determine what functions
464 * are supported (all asics).
466 static void radeon_atcs_parse_functions(struct radeon_atcs_functions
*f
, u32 mask
)
468 f
->get_ext_state
= mask
& ATCS_GET_EXTERNAL_STATE_SUPPORTED
;
469 f
->pcie_perf_req
= mask
& ATCS_PCIE_PERFORMANCE_REQUEST_SUPPORTED
;
470 f
->pcie_dev_rdy
= mask
& ATCS_PCIE_DEVICE_READY_NOTIFICATION_SUPPORTED
;
471 f
->pcie_bus_width
= mask
& ATCS_SET_PCIE_BUS_WIDTH_SUPPORTED
;
475 * radeon_atcs_verify_interface - verify ATCS
477 * @handle: acpi handle
478 * @atcs: radeon atcs struct
480 * Execute the ATCS_FUNCTION_VERIFY_INTERFACE ATCS function
481 * to initialize ATCS and determine what features are supported
483 * returns 0 on success, error on failure.
485 static int radeon_atcs_verify_interface(acpi_handle handle
,
486 struct radeon_atcs
*atcs
)
488 union acpi_object
*info
;
489 struct atcs_verify_interface output
;
493 info
= radeon_atcs_call(handle
, ATCS_FUNCTION_VERIFY_INTERFACE
, NULL
);
497 memset(&output
, 0, sizeof(output
));
499 size
= *(u16
*) info
->buffer
.pointer
;
501 DRM_INFO("ATCS buffer is too small: %zu\n", size
);
505 size
= min(sizeof(output
), size
);
507 memcpy(&output
, info
->buffer
.pointer
, size
);
509 /* TODO: check version? */
510 DRM_DEBUG_DRIVER("ATCS version %u\n", output
.version
);
512 radeon_atcs_parse_functions(&atcs
->functions
, output
.function_bits
);
520 * radeon_acpi_is_pcie_performance_request_supported
522 * @rdev: radeon_device pointer
524 * Check if the ATCS pcie_perf_req and pcie_dev_rdy methods
525 * are supported (all asics).
526 * returns true if supported, false if not.
528 bool radeon_acpi_is_pcie_performance_request_supported(struct radeon_device
*rdev
)
530 struct radeon_atcs
*atcs
= &rdev
->atcs
;
532 if (atcs
->functions
.pcie_perf_req
&& atcs
->functions
.pcie_dev_rdy
)
539 * radeon_acpi_pcie_notify_device_ready
541 * @rdev: radeon_device pointer
543 * Executes the PCIE_DEVICE_READY_NOTIFICATION method
545 * returns 0 on success, error on failure.
547 int radeon_acpi_pcie_notify_device_ready(struct radeon_device
*rdev
)
550 union acpi_object
*info
;
551 struct radeon_atcs
*atcs
= &rdev
->atcs
;
553 /* Get the device handle */
554 handle
= ACPI_HANDLE(&rdev
->pdev
->dev
);
558 if (!atcs
->functions
.pcie_dev_rdy
)
561 info
= radeon_atcs_call(handle
, ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION
, NULL
);
571 * radeon_acpi_pcie_performance_request
573 * @rdev: radeon_device pointer
574 * @perf_req: requested perf level (pcie gen speed)
575 * @advertise: set advertise caps flag if set
577 * Executes the PCIE_PERFORMANCE_REQUEST method to
578 * change the pcie gen speed (all asics).
579 * returns 0 on success, error on failure.
581 int radeon_acpi_pcie_performance_request(struct radeon_device
*rdev
,
582 u8 perf_req
, bool advertise
)
585 union acpi_object
*info
;
586 struct radeon_atcs
*atcs
= &rdev
->atcs
;
587 struct atcs_pref_req_input atcs_input
;
588 struct atcs_pref_req_output atcs_output
;
589 struct acpi_buffer params
;
593 /* Get the device handle */
594 handle
= ACPI_HANDLE(&rdev
->pdev
->dev
);
598 if (!atcs
->functions
.pcie_perf_req
)
601 atcs_input
.size
= sizeof(struct atcs_pref_req_input
);
602 /* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */
603 atcs_input
.client_id
= rdev
->pdev
->devfn
| (rdev
->pdev
->bus
->number
<< 8);
604 atcs_input
.valid_flags_mask
= ATCS_VALID_FLAGS_MASK
;
605 atcs_input
.flags
= ATCS_WAIT_FOR_COMPLETION
;
607 atcs_input
.flags
|= ATCS_ADVERTISE_CAPS
;
608 atcs_input
.req_type
= ATCS_PCIE_LINK_SPEED
;
609 atcs_input
.perf_req
= perf_req
;
611 params
.length
= sizeof(struct atcs_pref_req_input
);
612 params
.pointer
= &atcs_input
;
615 info
= radeon_atcs_call(handle
, ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST
, ¶ms
);
619 memset(&atcs_output
, 0, sizeof(atcs_output
));
621 size
= *(u16
*) info
->buffer
.pointer
;
623 DRM_INFO("ATCS buffer is too small: %zu\n", size
);
627 size
= min(sizeof(atcs_output
), size
);
629 memcpy(&atcs_output
, info
->buffer
.pointer
, size
);
633 switch (atcs_output
.ret_val
) {
634 case ATCS_REQUEST_REFUSED
:
637 case ATCS_REQUEST_COMPLETE
:
639 case ATCS_REQUEST_IN_PROGRESS
:
649 * radeon_acpi_event - handle notify events
651 * @nb: notifier block
655 * Calls relevant radeon functions in response to various
657 * Returns NOTIFY code
659 static int radeon_acpi_event(struct notifier_block
*nb
,
663 struct radeon_device
*rdev
= container_of(nb
, struct radeon_device
, acpi_nb
);
664 struct acpi_bus_event
*entry
= (struct acpi_bus_event
*)data
;
666 if (strcmp(entry
->device_class
, ACPI_AC_CLASS
) == 0) {
667 if (power_supply_is_system_supplied() > 0)
668 DRM_DEBUG_DRIVER("pm: AC\n");
670 DRM_DEBUG_DRIVER("pm: DC\n");
672 radeon_pm_acpi_event_handler(rdev
);
675 /* Check for pending SBIOS requests */
676 return radeon_atif_handler(rdev
, entry
);
679 /* Call all ACPI methods here */
681 * radeon_acpi_init - init driver acpi support
683 * @rdev: radeon_device pointer
685 * Verifies the AMD ACPI interfaces and registers with the acpi
686 * notifier chain (all asics).
687 * Returns 0 on success, error on failure.
689 int radeon_acpi_init(struct radeon_device
*rdev
)
692 struct radeon_atif
*atif
= &rdev
->atif
;
693 struct radeon_atcs
*atcs
= &rdev
->atcs
;
696 /* Get the device handle */
697 handle
= ACPI_HANDLE(&rdev
->pdev
->dev
);
699 /* No need to proceed if we're sure that ATIF is not supported */
700 if (!ASIC_IS_AVIVO(rdev
) || !rdev
->bios
|| !handle
)
703 /* Call the ATCS method */
704 ret
= radeon_atcs_verify_interface(handle
, atcs
);
706 DRM_DEBUG_DRIVER("Call to ATCS verify_interface failed: %d\n", ret
);
709 /* Call the ATIF method */
710 ret
= radeon_atif_verify_interface(handle
, atif
);
712 DRM_DEBUG_DRIVER("Call to ATIF verify_interface failed: %d\n", ret
);
716 if (atif
->notifications
.brightness_change
) {
717 struct drm_encoder
*tmp
;
718 struct radeon_encoder
*target
= NULL
;
720 /* Find the encoder controlling the brightness */
721 list_for_each_entry(tmp
, &rdev
->ddev
->mode_config
.encoder_list
,
723 struct radeon_encoder
*enc
= to_radeon_encoder(tmp
);
725 if ((enc
->devices
& (ATOM_DEVICE_LCD_SUPPORT
)) &&
727 if (rdev
->is_atom_bios
) {
728 struct radeon_encoder_atom_dig
*dig
= enc
->enc_priv
;
734 struct radeon_encoder_lvds
*dig
= enc
->enc_priv
;
743 atif
->encoder_for_bl
= target
;
745 /* Brightness change notification is enabled, but we
746 * didn't find a backlight controller, this should
749 DRM_ERROR("Cannot find a backlight controller\n");
753 if (atif
->functions
.sbios_requests
&& !atif
->functions
.system_params
) {
754 /* XXX check this workraround, if sbios request function is
755 * present we have to see how it's configured in the system
758 atif
->functions
.system_params
= true;
761 if (atif
->functions
.system_params
) {
762 ret
= radeon_atif_get_notification_params(handle
,
763 &atif
->notification_cfg
);
765 DRM_DEBUG_DRIVER("Call to GET_SYSTEM_PARAMS failed: %d\n",
767 /* Disable notification */
768 atif
->notification_cfg
.enabled
= false;
773 rdev
->acpi_nb
.notifier_call
= radeon_acpi_event
;
774 register_acpi_notifier(&rdev
->acpi_nb
);
780 * radeon_acpi_fini - tear down driver acpi support
782 * @rdev: radeon_device pointer
784 * Unregisters with the acpi notifier chain (all asics).
786 void radeon_acpi_fini(struct radeon_device
*rdev
)
788 unregister_acpi_notifier(&rdev
->acpi_nb
);