Lines Matching +full:gpu +full:- +full:id
1 // SPDX-License-Identifier: GPL-2.0-only
37 /* handle for device - and atpx */
85 * radeon_atpx_call - call an ATPX method
110 atpx_arg_elements[1].buffer.length = params->length; in radeon_atpx_call()
111 atpx_arg_elements[1].buffer.pointer = params->pointer; in radeon_atpx_call()
132 * radeon_atpx_parse_functions - parse supported functions
143 f->px_params = mask & ATPX_GET_PX_PARAMETERS_SUPPORTED; in radeon_atpx_parse_functions()
144 f->power_cntl = mask & ATPX_POWER_CONTROL_SUPPORTED; in radeon_atpx_parse_functions()
145 f->disp_mux_cntl = mask & ATPX_DISPLAY_MUX_CONTROL_SUPPORTED; in radeon_atpx_parse_functions()
146 f->i2c_mux_cntl = mask & ATPX_I2C_MUX_CONTROL_SUPPORTED; in radeon_atpx_parse_functions()
147 f->switch_start = mask & ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED; in radeon_atpx_parse_functions()
148 f->switch_end = mask & ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED; in radeon_atpx_parse_functions()
149 f->disp_connectors_mapping = mask & ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED; in radeon_atpx_parse_functions()
150 f->disp_detetion_ports = mask & ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED; in radeon_atpx_parse_functions()
154 * radeon_atpx_validate() - validate ATPX functions
165 if (atpx->functions.px_params) { in radeon_atpx_validate()
170 info = radeon_atpx_call(atpx->handle, ATPX_FUNCTION_GET_PX_PARAMETERS, NULL); in radeon_atpx_validate()
172 return -EIO; in radeon_atpx_validate()
176 size = *(u16 *) info->buffer.pointer; in radeon_atpx_validate()
180 return -EINVAL; in radeon_atpx_validate()
184 memcpy(&output, info->buffer.pointer, size); in radeon_atpx_validate()
193 atpx->functions.i2c_mux_cntl = true; in radeon_atpx_validate()
194 atpx->functions.disp_mux_cntl = true; in radeon_atpx_validate()
200 atpx->functions.disp_mux_cntl = true; in radeon_atpx_validate()
205 atpx->functions.power_cntl = true; in radeon_atpx_validate()
207 atpx->is_hybrid = false; in radeon_atpx_validate()
214 atpx->functions.power_cntl = !radeon_atpx_priv.bridge_pm_usable; in radeon_atpx_validate()
215 atpx->is_hybrid = true; in radeon_atpx_validate()
222 * radeon_atpx_verify_interface - verify ATPX
238 info = radeon_atpx_call(atpx->handle, ATPX_FUNCTION_VERIFY_INTERFACE, NULL); in radeon_atpx_verify_interface()
240 return -EIO; in radeon_atpx_verify_interface()
244 size = *(u16 *) info->buffer.pointer; in radeon_atpx_verify_interface()
247 err = -EINVAL; in radeon_atpx_verify_interface()
252 memcpy(&output, info->buffer.pointer, size); in radeon_atpx_verify_interface()
258 radeon_atpx_parse_functions(&atpx->functions, output.function_bits); in radeon_atpx_verify_interface()
266 * radeon_atpx_set_discrete_state - power up/down discrete GPU
269 * @state: discrete GPU state (0 = power down, 1 = power up)
272 * power down/up the discrete GPU (all asics).
281 if (atpx->functions.power_cntl) { in radeon_atpx_set_discrete_state()
286 info = radeon_atpx_call(atpx->handle, in radeon_atpx_set_discrete_state()
290 return -EIO; in radeon_atpx_set_discrete_state()
301 * radeon_atpx_switch_disp_mux - switch display mux
304 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
307 * switch the display mux between the discrete GPU and integrated GPU
317 if (atpx->functions.disp_mux_cntl) { in radeon_atpx_switch_disp_mux()
322 info = radeon_atpx_call(atpx->handle, in radeon_atpx_switch_disp_mux()
326 return -EIO; in radeon_atpx_switch_disp_mux()
333 * radeon_atpx_switch_i2c_mux - switch i2c/hpd mux
336 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
339 * switch the i2c/hpd mux between the discrete GPU and integrated GPU
349 if (atpx->functions.i2c_mux_cntl) { in radeon_atpx_switch_i2c_mux()
354 info = radeon_atpx_call(atpx->handle, in radeon_atpx_switch_i2c_mux()
358 return -EIO; in radeon_atpx_switch_i2c_mux()
365 * radeon_atpx_switch_start - notify the sbios of a GPU switch
368 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
371 * function to notify the sbios that a switch between the discrete GPU and
372 * integrated GPU has begun (all asics).
381 if (atpx->functions.switch_start) { in radeon_atpx_switch_start()
386 info = radeon_atpx_call(atpx->handle, in radeon_atpx_switch_start()
390 return -EIO; in radeon_atpx_switch_start()
397 * radeon_atpx_switch_end - notify the sbios of a GPU switch
400 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
403 * function to notify the sbios that a switch between the discrete GPU and
404 * integrated GPU has ended (all asics).
413 if (atpx->functions.switch_end) { in radeon_atpx_switch_end()
418 info = radeon_atpx_call(atpx->handle, in radeon_atpx_switch_end()
422 return -EIO; in radeon_atpx_switch_end()
429 * radeon_atpx_switchto - switch to the requested GPU
431 * @id: GPU to switch to
433 * Execute the necessary ATPX functions to switch between the discrete GPU and
434 * integrated GPU (all asics).
437 static int radeon_atpx_switchto(enum vga_switcheroo_client_id id) in radeon_atpx_switchto() argument
441 if (id == VGA_SWITCHEROO_IGD) in radeon_atpx_switchto()
455 * radeon_atpx_power_state - power down/up the requested GPU
457 * @id: GPU to power down/up
460 * Execute the necessary ATPX function to power down/up the discrete GPU
464 static int radeon_atpx_power_state(enum vga_switcheroo_client_id id, in radeon_atpx_power_state() argument
467 /* on w500 ACPI can't change intel gpu state */ in radeon_atpx_power_state()
468 if (id == VGA_SWITCHEROO_IGD) in radeon_atpx_power_state()
476 * radeon_atpx_pci_probe_handle - look up the ATPX handle
488 dhandle = ACPI_HANDLE(&pdev->dev); in radeon_atpx_pci_probe_handle()
502 * radeon_atpx_init - verify the ATPX interface
525 * radeon_atpx_get_client_id - get the client id
529 * look up whether we are the integrated or discrete GPU (all asics).
530 * Returns the client id.
534 if (radeon_atpx_priv.dhandle == ACPI_HANDLE(&pdev->dev)) in radeon_atpx_get_client_id()
547 * radeon_atpx_detect - detect whether we have PX
568 d3_supported |= parent_pdev && parent_pdev->bridge_d3; in radeon_atpx_detect()
571 /* some newer PX laptops mark the dGPU as a non-VGA display device */ in radeon_atpx_detect()
578 d3_supported |= parent_pdev && parent_pdev->bridge_d3; in radeon_atpx_detect()
594 * radeon_register_atpx_handler - register with vga_switcheroo
612 * radeon_unregister_atpx_handler - unregister with vga_switcheroo