aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/radeon/radeon_atpx_handler.c
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2012-07-18 13:28:52 -0400
committerAlex Deucher <alexander.deucher@amd.com>2012-09-20 13:10:34 -0400
commit9e05b2f49eb9484e857e9b6c70dea3bbbe564290 (patch)
treeaa0f042e30138f80000ee36e2f93c86050cd9f5e /drivers/gpu/drm/radeon/radeon_atpx_handler.c
parent9e9eb7c60d57620bfe46b2a489e7f56a5925115a (diff)
drm/radeon: add new AMD ACPI header and update relevant code (v2)
Add a new header that defines the AMD ACPI interface used for laptops, PowerXpress, and chipset specific functionality and update the current code to use it. Todo: - properly verify the ACPI interfaces - hook up and handle ACPI notifications - make PX code more robust - implement PCIe Gen and width switching using ACPI v2: fix typo in header Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_atpx_handler.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index 2a2cf0b88a2..950a1ac95d6 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -12,18 +12,7 @@
#include <acpi/acpi_bus.h>
#include <linux/pci.h>
-#define ATPX_VERSION 0
-#define ATPX_GPU_PWR 2
-#define ATPX_MUX_SELECT 3
-#define ATPX_I2C_MUX_SELECT 4
-#define ATPX_SWITCH_START 5
-#define ATPX_SWITCH_END 6
-
-#define ATPX_INTEGRATED 0
-#define ATPX_DISCRETE 1
-
-#define ATPX_MUX_IGD 0
-#define ATPX_MUX_DISCRETE 1
+#include "radeon_acpi.h"
static struct radeon_atpx_priv {
bool atpx_detected;
@@ -43,10 +32,10 @@ static int radeon_atpx_get_version(acpi_handle handle)
atpx_arg.pointer = &atpx_arg_elements[0];
atpx_arg_elements[0].type = ACPI_TYPE_INTEGER;
- atpx_arg_elements[0].integer.value = ATPX_VERSION;
+ atpx_arg_elements[0].integer.value = ATPX_FUNCTION_VERIFY_INTERFACE;
atpx_arg_elements[1].type = ACPI_TYPE_INTEGER;
- atpx_arg_elements[1].integer.value = ATPX_VERSION;
+ atpx_arg_elements[1].integer.value = 0;
status = acpi_evaluate_object(handle, NULL, &atpx_arg, &buffer);
if (ACPI_FAILURE(status)) {
@@ -96,27 +85,31 @@ static int radeon_atpx_execute(acpi_handle handle, int cmd_id, u16 value)
static int radeon_atpx_set_discrete_state(acpi_handle handle, int state)
{
- return radeon_atpx_execute(handle, ATPX_GPU_PWR, state);
+ return radeon_atpx_execute(handle, ATPX_FUNCTION_POWER_CONTROL, state);
}
static int radeon_atpx_switch_mux(acpi_handle handle, int mux_id)
{
- return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id);
+ return radeon_atpx_execute(handle, ATPX_FUNCTION_DISPLAY_MUX_CONTROL, mux_id);
}
static int radeon_atpx_switch_i2c_mux(acpi_handle handle, int mux_id)
{
- return radeon_atpx_execute(handle, ATPX_I2C_MUX_SELECT, mux_id);
+ return radeon_atpx_execute(handle, ATPX_FUNCTION_I2C_MUX_CONTROL, mux_id);
}
static int radeon_atpx_switch_start(acpi_handle handle, int gpu_id)
{
- return radeon_atpx_execute(handle, ATPX_SWITCH_START, gpu_id);
+ return radeon_atpx_execute(handle,
+ ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION,
+ gpu_id);
}
static int radeon_atpx_switch_end(acpi_handle handle, int gpu_id)
{
- return radeon_atpx_execute(handle, ATPX_SWITCH_END, gpu_id);
+ return radeon_atpx_execute(handle,
+ ATPX_FUNCTION_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION,
+ gpu_id);
}
static int radeon_atpx_switchto(enum vga_switcheroo_client_id id)
@@ -124,9 +117,9 @@ static int radeon_atpx_switchto(enum vga_switcheroo_client_id id)
int gpu_id;
if (id == VGA_SWITCHEROO_IGD)
- gpu_id = ATPX_INTEGRATED;
+ gpu_id = ATPX_INTEGRATED_GPU;
else
- gpu_id = ATPX_DISCRETE;
+ gpu_id = ATPX_DISCRETE_GPU;
radeon_atpx_switch_start(radeon_atpx_priv.atpx_handle, gpu_id);
radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, gpu_id);