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

1 // SPDX-License-Identifier: GPL-2.0-only
49 /* handle for device - and atpx */
93 * amdgpu_atpx_call - call an ATPX method
118 atpx_arg_elements[1].buffer.length = params->length; in amdgpu_atpx_call()
119 atpx_arg_elements[1].buffer.pointer = params->pointer; in amdgpu_atpx_call()
140 * amdgpu_atpx_parse_functions - parse supported functions
151 f->px_params = mask & ATPX_GET_PX_PARAMETERS_SUPPORTED; in amdgpu_atpx_parse_functions()
152 f->power_cntl = mask & ATPX_POWER_CONTROL_SUPPORTED; in amdgpu_atpx_parse_functions()
153 f->disp_mux_cntl = mask & ATPX_DISPLAY_MUX_CONTROL_SUPPORTED; in amdgpu_atpx_parse_functions()
154 f->i2c_mux_cntl = mask & ATPX_I2C_MUX_CONTROL_SUPPORTED; in amdgpu_atpx_parse_functions()
155 f->switch_start = mask & ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED; in amdgpu_atpx_parse_functions()
156 f->switch_end = mask & ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED; in amdgpu_atpx_parse_functions()
157 f->disp_connectors_mapping = mask & ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED; in amdgpu_atpx_parse_functions()
158 f->disp_detection_ports = mask & ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED; in amdgpu_atpx_parse_functions()
162 * amdgpu_atpx_validate - validate ATPX functions
173 if (atpx->functions.px_params) { in amdgpu_atpx_validate()
178 info = amdgpu_atpx_call(atpx->handle, ATPX_FUNCTION_GET_PX_PARAMETERS, NULL); in amdgpu_atpx_validate()
180 return -EIO; in amdgpu_atpx_validate()
184 size = *(u16 *) info->buffer.pointer; in amdgpu_atpx_validate()
188 return -EINVAL; in amdgpu_atpx_validate()
192 memcpy(&output, info->buffer.pointer, size); in amdgpu_atpx_validate()
201 atpx->functions.i2c_mux_cntl = true; in amdgpu_atpx_validate()
202 atpx->functions.disp_mux_cntl = true; in amdgpu_atpx_validate()
208 atpx->functions.disp_mux_cntl = true; in amdgpu_atpx_validate()
214 atpx->functions.power_cntl = true; in amdgpu_atpx_validate()
216 atpx->is_hybrid = false; in amdgpu_atpx_validate()
220 atpx->functions.power_cntl = true; in amdgpu_atpx_validate()
221 atpx->is_hybrid = false; in amdgpu_atpx_validate()
228 atpx->functions.power_cntl = !amdgpu_atpx_priv.bridge_pm_usable; in amdgpu_atpx_validate()
229 atpx->is_hybrid = true; in amdgpu_atpx_validate()
233 atpx->dgpu_req_power_for_displays = false; in amdgpu_atpx_validate()
235 atpx->dgpu_req_power_for_displays = true; in amdgpu_atpx_validate()
241 * amdgpu_atpx_verify_interface - verify ATPX
257 info = amdgpu_atpx_call(atpx->handle, ATPX_FUNCTION_VERIFY_INTERFACE, NULL); in amdgpu_atpx_verify_interface()
259 return -EIO; in amdgpu_atpx_verify_interface()
263 size = *(u16 *) info->buffer.pointer; in amdgpu_atpx_verify_interface()
266 err = -EINVAL; in amdgpu_atpx_verify_interface()
271 memcpy(&output, info->buffer.pointer, size); in amdgpu_atpx_verify_interface()
277 amdgpu_atpx_parse_functions(&atpx->functions, output.function_bits); in amdgpu_atpx_verify_interface()
285 * amdgpu_atpx_set_discrete_state - power up/down discrete GPU
288 * @state: discrete GPU state (0 = power down, 1 = power up)
291 * power down/up the discrete GPU (all asics).
300 if (atpx->functions.power_cntl) { in amdgpu_atpx_set_discrete_state()
305 info = amdgpu_atpx_call(atpx->handle, in amdgpu_atpx_set_discrete_state()
309 return -EIO; in amdgpu_atpx_set_discrete_state()
320 * amdgpu_atpx_switch_disp_mux - switch display mux
323 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
326 * switch the display mux between the discrete GPU and integrated GPU
336 if (atpx->functions.disp_mux_cntl) { in amdgpu_atpx_switch_disp_mux()
341 info = amdgpu_atpx_call(atpx->handle, in amdgpu_atpx_switch_disp_mux()
345 return -EIO; in amdgpu_atpx_switch_disp_mux()
352 * amdgpu_atpx_switch_i2c_mux - switch i2c/hpd mux
355 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
358 * switch the i2c/hpd mux between the discrete GPU and integrated GPU
368 if (atpx->functions.i2c_mux_cntl) { in amdgpu_atpx_switch_i2c_mux()
373 info = amdgpu_atpx_call(atpx->handle, in amdgpu_atpx_switch_i2c_mux()
377 return -EIO; in amdgpu_atpx_switch_i2c_mux()
384 * amdgpu_atpx_switch_start - notify the sbios of a GPU switch
387 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
390 * function to notify the sbios that a switch between the discrete GPU and
391 * integrated GPU has begun (all asics).
400 if (atpx->functions.switch_start) { in amdgpu_atpx_switch_start()
405 info = amdgpu_atpx_call(atpx->handle, in amdgpu_atpx_switch_start()
409 return -EIO; in amdgpu_atpx_switch_start()
416 * amdgpu_atpx_switch_end - notify the sbios of a GPU switch
419 * @mux_id: mux state (0 = integrated GPU, 1 = discrete GPU)
422 * function to notify the sbios that a switch between the discrete GPU and
423 * integrated GPU has ended (all asics).
432 if (atpx->functions.switch_end) { in amdgpu_atpx_switch_end()
437 info = amdgpu_atpx_call(atpx->handle, in amdgpu_atpx_switch_end()
441 return -EIO; in amdgpu_atpx_switch_end()
448 * amdgpu_atpx_switchto - switch to the requested GPU
450 * @id: GPU to switch to
452 * Execute the necessary ATPX functions to switch between the discrete GPU and
453 * integrated GPU (all asics).
456 static int amdgpu_atpx_switchto(enum vga_switcheroo_client_id id) in amdgpu_atpx_switchto() argument
460 if (id == VGA_SWITCHEROO_IGD) in amdgpu_atpx_switchto()
474 * amdgpu_atpx_power_state - power down/up the requested GPU
476 * @id: GPU to power down/up
479 * Execute the necessary ATPX function to power down/up the discrete GPU
483 static int amdgpu_atpx_power_state(enum vga_switcheroo_client_id id, in amdgpu_atpx_power_state() argument
486 /* on w500 ACPI can't change intel gpu state */ in amdgpu_atpx_power_state()
487 if (id == VGA_SWITCHEROO_IGD) in amdgpu_atpx_power_state()
495 * amdgpu_atpx_pci_probe_handle - look up the ATPX handle
507 dhandle = ACPI_HANDLE(&pdev->dev); in amdgpu_atpx_pci_probe_handle()
522 * amdgpu_atpx_init - verify the ATPX interface
545 * amdgpu_atpx_get_client_id - get the client id
549 * look up whether we are the integrated or discrete GPU (all asics).
550 * Returns the client id.
554 if (amdgpu_atpx_priv.dhandle == ACPI_HANDLE(&pdev->dev)) in amdgpu_atpx_get_client_id()
582 while (p && p->chip_device != 0) { in amdgpu_atpx_get_quirks()
583 if (pdev->vendor == p->chip_vendor && in amdgpu_atpx_get_quirks()
584 pdev->device == p->chip_device && in amdgpu_atpx_get_quirks()
585 pdev->subsystem_vendor == p->subsys_vendor && in amdgpu_atpx_get_quirks()
586 pdev->subsystem_device == p->subsys_device) { in amdgpu_atpx_get_quirks()
587 amdgpu_atpx_priv.quirks |= p->px_quirk_flags; in amdgpu_atpx_get_quirks()
595 * amdgpu_atpx_detect - detect whether we have PX
616 d3_supported |= parent_pdev && parent_pdev->bridge_d3; in amdgpu_atpx_detect()
626 d3_supported |= parent_pdev && parent_pdev->bridge_d3; in amdgpu_atpx_detect()
643 * amdgpu_register_atpx_handler - register with vga_switcheroo
661 * amdgpu_unregister_atpx_handler - unregister with vga_switcheroo