2 #include <linux/acpi.h>
3 #include <linux/slab.h>
4 #include <acpi/acpi_drivers.h>
5 #include <acpi/acpi_bus.h>
10 #include "drm_crtc_helper.h"
13 #include <linux/vga_switcheroo.h>
15 /* Call the ATIF method
17 * Note: currently we discard the output
19 static int radeon_atif_call(acpi_handle handle
)
22 union acpi_object atif_arg_elements
[2];
23 struct acpi_object_list atif_arg
;
24 struct acpi_buffer buffer
= { ACPI_ALLOCATE_BUFFER
, NULL
};
27 atif_arg
.pointer
= &atif_arg_elements
[0];
29 atif_arg_elements
[0].type
= ACPI_TYPE_INTEGER
;
30 atif_arg_elements
[0].integer
.value
= 0;
31 atif_arg_elements
[1].type
= ACPI_TYPE_INTEGER
;
32 atif_arg_elements
[1].integer
.value
= 0;
34 status
= acpi_evaluate_object(handle
, "ATIF", &atif_arg
, &buffer
);
36 /* Fail only if calling the method fails and ATIF is supported */
37 if (ACPI_FAILURE(status
) && status
!= AE_NOT_FOUND
) {
38 printk(KERN_DEBUG
"failed to evaluate ATIF got %s\n", acpi_format_exception(status
));
39 kfree(buffer
.pointer
);
43 kfree(buffer
.pointer
);
47 /* Call all ACPI methods here */
48 int radeon_acpi_init(struct radeon_device
*rdev
)
53 /* No need to proceed if we're sure that ATIF is not supported */
54 if (!ASIC_IS_AVIVO(rdev
) || !rdev
->bios
)
57 /* Get the device handle */
58 handle
= DEVICE_ACPI_HANDLE(&rdev
->pdev
->dev
);
60 /* Call the ATIF method */
61 ret
= radeon_atif_call(handle
);