Lines Matching +full:gpu +full:- +full:id

1 // SPDX-License-Identifier: GPL-2.0-only
49 /* handle for device - and atpx */
105 * amdgpu_atpx_call - call an ATPX method
130 atpx_arg_elements[1].buffer.length = params->length; in amdgpu_atpx_call()
131 atpx_arg_elements[1].buffer.pointer = params->pointer; in amdgpu_atpx_call()
152 * amdgpu_atpx_parse_functions - parse supported functions
163 f->px_params = mask & ATPX_GET_PX_PARAMETERS_SUPPORTED; in amdgpu_atpx_parse_functions()
164 f->power_cntl = mask & ATPX_POWER_CONTROL_SUPPORTED; in amdgpu_atpx_parse_functions()
165 f->disp_mux_cntl = mask & ATPX_DISPLAY_MUX_CONTROL_SUPPORTED; in amdgpu_atpx_parse_functions()
166 f->i2c_mux_cntl = mask & ATPX_I2C_MUX_CONTROL_SUPPORTED; in amdgpu_atpx_parse_functions()
167 f->switch_start = mask & ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED; in amdgpu_atpx_parse_functions()
168 f->switch_end = mask & ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED; in amdgpu_atpx_parse_functions()
169 f->disp_connectors_mapping = mask & ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED; in amdgpu_atpx_parse_functions()
170 f->disp_detection_ports = mask & ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED; in amdgpu_atpx_parse_functions()
174 * amdgpu_atpx_validate - validate ATPX functions
185 if (atpx->functions.px_params) { in amdgpu_atpx_validate()
190 info = amdgpu_atpx_call(atpx->handle, ATPX_FUNCTION_GET_PX_PARAMETERS, NULL); in amdgpu_atpx_validate()
192 return -EIO; in amdgpu_atpx_validate()
196 size = *(u16 *) info->buffer.pointer; in amdgpu_atpx_validate()
200 return -EINVAL; in amdgpu_atpx_validate()
204 memcpy(&output, info->buffer.pointer, size); in amdgpu_atpx_validate()
213 atpx->functions.i2c_mux_cntl = true; in amdgpu_atpx_validate()
214 atpx->functions.disp_mux_cntl = true; in amdgpu_atpx_validate()
220 atpx->functions.disp_mux_cntl = true; in amdgpu_atpx_validate()
226 atpx->functions.power_cntl = true; in amdgpu_atpx_validate()
228 atpx->is_hybrid = false; in amdgpu_atpx_validate()
232 atpx->functions.power_cntl = true; in amdgpu_atpx_validate()
233 atpx->is_hybrid = false; in amdgpu_atpx_validate()
240 atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable; in amdgpu_atpx_validate()
241 atpx->is_hybrid = true; in amdgpu_atpx_validate()
245 atpx->dgpu_req_power_for_displays = false; in amdgpu_atpx_validate()
247 atpx->dgpu_req_power_for_displays = true; in amdgpu_atpx_validate()
253 * amdgpu_atpx_verify_interface - verify ATPX
269 info = amdgpu_atpx_call(atpx->handle, ATPX_FUNCTION_VERIFY_INTERFACE, NULL); in amdgpu_atpx_verify_interface()
271 return -EIO; in amdgpu_atpx_verify_interface()
275 size = *(u16 *) info->buffer.pointer; in amdgpu_atpx_verify_interface()
278 err = -EINVAL; in amdgpu_atpx_verify_interface()
283 memcpy(&output, info->buffer.pointer, size); in amdgpu_atpx_verify_interface()
289 amdgpu_atpx_parse_functions(&atpx->functions, output.function_bits); in amdgpu_atpx_verify_interface()
297 * amdgpu_atpx_set_discrete_state - power up/down discrete GPU
300 * @state: discrete GPU state (0 = power down, 1 = power up)
303 * power down/up the discrete GPU (all asics).
312 if (atpx->functions.power_cntl) { in amdgpu_atpx_set_discrete_state()
317 info = amdgpu_atpx_call(atpx->handle, in amdgpu_atpx_set_discrete_state()
321 return -EIO; in amdgpu_atpx_set_discrete_state()
332 * amdgpu_atpx_switch_disp_mux - switch display mux
335 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
338 * switch the display mux between the discrete GPU and integrated GPU
348 if (atpx->functions.disp_mux_cntl) { in amdgpu_atpx_switch_disp_mux()
353 info = amdgpu_atpx_call(atpx->handle, in amdgpu_atpx_switch_disp_mux()
357 return -EIO; in amdgpu_atpx_switch_disp_mux()
364 * amdgpu_atpx_switch_i2c_mux - switch i2c/hpd mux
367 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
370 * switch the i2c/hpd mux between the discrete GPU and integrated GPU
380 if (atpx->functions.i2c_mux_cntl) { in amdgpu_atpx_switch_i2c_mux()
385 info = amdgpu_atpx_call(atpx->handle, in amdgpu_atpx_switch_i2c_mux()
389 return -EIO; in amdgpu_atpx_switch_i2c_mux()
396 * amdgpu_atpx_switch_start - notify the sbios of a GPU switch
399 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
402 * function to notify the sbios that a switch between the discrete GPU and
403 * integrated GPU has begun (all asics).
412 if (atpx->functions.switch_start) { in amdgpu_atpx_switch_start()
417 info = amdgpu_atpx_call(atpx->handle, in amdgpu_atpx_switch_start()
421 return -EIO; in amdgpu_atpx_switch_start()
428 * amdgpu_atpx_switch_end - notify the sbios of a GPU switch
431 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
434 * function to notify the sbios that a switch between the discrete GPU and
435 * integrated GPU has ended (all asics).
444 if (atpx->functions.switch_end) { in amdgpu_atpx_switch_end()
449 info = amdgpu_atpx_call(atpx->handle, in amdgpu_atpx_switch_end()
453 return -EIO; in amdgpu_atpx_switch_end()
460 * amdgpu_atpx_switchto - switch to the requested GPU
462 * @id: GPU to switch to
464 * Execute the necessary ATPX functions to switch between the discrete GPU and
465 * integrated GPU (all asics).
468 static int amdgpu_atpx_switchto(enum vga_switcheroo_client_id id) in amdgpu_atpx_switchto() argument
472 if (id == VGA_SWITCHEROO_IGD) in amdgpu_atpx_switchto()
486 * amdgpu_atpx_power_state - power down/up the requested GPU
488 * @id: GPU to power down/up
491 * Execute the necessary ATPX function to power down/up the discrete GPU
495 static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id, in amdgpu_atpx_power_state() argument
498 /* on w500 ACPI can't change intel gpu state */ in amdgpu_atpx_power_state()
499 if (id == VGA_SWITCHEROO_IGD) in amdgpu_atpx_power_state()
507 * amdgpu_atpx_pci_probe_handle - look up the ATPX handle
519 dhandle = ACPI_HANDLE(&pdev->dev); in amdgpu_atpx_pci_probe_handle()
534 * amdgpu_atpx_init - verify the ATPX interface
557 * amdgpu_atpx_get_client_id - get the client id
561 * look up whether we are the integrated or discrete GPU (all asics).
562 * Returns the client id.
566 if (amdgpu_atpx_priv.dhandle == ACPI_HANDLE(&pdev->dev)) in amdgpu_atpx_get_client_id()
594 while (p && p->chip_device != 0) { in amdgpu_atpx_get_quirks()
595 if (pdev->vendor == p->chip_vendor && in amdgpu_atpx_get_quirks()
596 pdev->device == p->chip_device && in amdgpu_atpx_get_quirks()
597 pdev->subsystem_vendor == p->subsys_vendor && in amdgpu_atpx_get_quirks()
598 pdev->subsystem_device == p->subsys_device) { in amdgpu_atpx_get_quirks()
599 amdgpu_atpx_priv.quirks |= p->px_quirk_flags; in amdgpu_atpx_get_quirks()
607 * amdgpu_atpx_detect - detect whether we have PX
628 d3_supported |= parent_pdev && parent_pdev->bridge_d3; in amdgpu_atpx_detect()
638 d3_supported |= parent_pdev && parent_pdev->bridge_d3; in amdgpu_atpx_detect()
655 * amdgpu_register_atpx_handler - register with vga_switcheroo
673 * amdgpu_unregister_atpx_handler - unregister with vga_switcheroo