aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_atpx_handler.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_atpx_handler.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index ed5dfe58f29..9d95792bea3 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -15,6 +15,9 @@
15#define ATPX_VERSION 0 15#define ATPX_VERSION 0
16#define ATPX_GPU_PWR 2 16#define ATPX_GPU_PWR 2
17#define ATPX_MUX_SELECT 3 17#define ATPX_MUX_SELECT 3
18#define ATPX_I2C_MUX_SELECT 4
19#define ATPX_SWITCH_START 5
20#define ATPX_SWITCH_END 6
18 21
19#define ATPX_INTEGRATED 0 22#define ATPX_INTEGRATED 0
20#define ATPX_DISCRETE 1 23#define ATPX_DISCRETE 1
@@ -149,13 +152,35 @@ static int radeon_atpx_switch_mux(acpi_handle handle, int mux_id)
149 return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id); 152 return radeon_atpx_execute(handle, ATPX_MUX_SELECT, mux_id);
150} 153}
151 154
155static int radeon_atpx_switch_i2c_mux(acpi_handle handle, int mux_id)
156{
157 return radeon_atpx_execute(handle, ATPX_I2C_MUX_SELECT, mux_id);
158}
159
160static int radeon_atpx_switch_start(acpi_handle handle, int gpu_id)
161{
162 return radeon_atpx_execute(handle, ATPX_SWITCH_START, gpu_id);
163}
164
165static int radeon_atpx_switch_end(acpi_handle handle, int gpu_id)
166{
167 return radeon_atpx_execute(handle, ATPX_SWITCH_END, gpu_id);
168}
152 169
153static int radeon_atpx_switchto(enum vga_switcheroo_client_id id) 170static int radeon_atpx_switchto(enum vga_switcheroo_client_id id)
154{ 171{
172 int gpu_id;
173
155 if (id == VGA_SWITCHEROO_IGD) 174 if (id == VGA_SWITCHEROO_IGD)
156 radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 0); 175 gpu_id = ATPX_INTEGRATED;
157 else 176 else
158 radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, 1); 177 gpu_id = ATPX_DISCRETE;
178
179 radeon_atpx_switch_start(radeon_atpx_priv.atpx_handle, gpu_id);
180 radeon_atpx_switch_mux(radeon_atpx_priv.atpx_handle, gpu_id);
181 radeon_atpx_switch_i2c_mux(radeon_atpx_priv.atpx_handle, gpu_id);
182 radeon_atpx_switch_end(radeon_atpx_priv.atpx_handle, gpu_id);
183
159 return 0; 184 return 0;
160} 185}
161 186