Lines Matching +full:function +full:- +full:mask

1 // SPDX-License-Identifier: GPL-2.0-only
37 /* handle for device - and atpx */
81 * radeon_atpx_call - call an ATPX method
84 * @function: the ATPX function to execute
85 * @params: ATPX function params
87 * Executes the requested ATPX function (all asics).
90 static union acpi_object *radeon_atpx_call(acpi_handle handle, int function, in radeon_atpx_call() argument
102 atpx_arg_elements[0].integer.value = function; in radeon_atpx_call()
106 atpx_arg_elements[1].buffer.length = params->length; in radeon_atpx_call()
107 atpx_arg_elements[1].buffer.pointer = params->pointer; in radeon_atpx_call()
128 * radeon_atpx_parse_functions - parse supported functions
131 * @mask: supported functions mask from ATPX
133 * Use the supported functions mask from ATPX function
137 static void radeon_atpx_parse_functions(struct radeon_atpx_functions *f, u32 mask) in radeon_atpx_parse_functions() argument
139 f->px_params = mask & ATPX_GET_PX_PARAMETERS_SUPPORTED; in radeon_atpx_parse_functions()
140 f->power_cntl = mask & ATPX_POWER_CONTROL_SUPPORTED; in radeon_atpx_parse_functions()
141 f->disp_mux_cntl = mask & ATPX_DISPLAY_MUX_CONTROL_SUPPORTED; in radeon_atpx_parse_functions()
142 f->i2c_mux_cntl = mask & ATPX_I2C_MUX_CONTROL_SUPPORTED; in radeon_atpx_parse_functions()
143 f->switch_start = mask & ATPX_GRAPHICS_DEVICE_SWITCH_START_NOTIFICATION_SUPPORTED; in radeon_atpx_parse_functions()
144 f->switch_end = mask & ATPX_GRAPHICS_DEVICE_SWITCH_END_NOTIFICATION_SUPPORTED; in radeon_atpx_parse_functions()
145 f->disp_connectors_mapping = mask & ATPX_GET_DISPLAY_CONNECTORS_MAPPING_SUPPORTED; in radeon_atpx_parse_functions()
146 f->disp_detetion_ports = mask & ATPX_GET_DISPLAY_DETECTION_PORTS_SUPPORTED; in radeon_atpx_parse_functions()
150 * radeon_atpx_validate() - validate ATPX functions
161 if (atpx->functions.px_params) { in radeon_atpx_validate()
166 info = radeon_atpx_call(atpx->handle, ATPX_FUNCTION_GET_PX_PARAMETERS, NULL); in radeon_atpx_validate()
168 return -EIO; in radeon_atpx_validate()
172 size = *(u16 *) info->buffer.pointer; in radeon_atpx_validate()
176 return -EINVAL; in radeon_atpx_validate()
180 memcpy(&output, info->buffer.pointer, size); in radeon_atpx_validate()
189 atpx->functions.i2c_mux_cntl = true; in radeon_atpx_validate()
190 atpx->functions.disp_mux_cntl = true; in radeon_atpx_validate()
196 atpx->functions.disp_mux_cntl = true; in radeon_atpx_validate()
201 atpx->functions.power_cntl = true; in radeon_atpx_validate()
203 atpx->is_hybrid = false; in radeon_atpx_validate()
210 atpx->functions.power_cntl = !radeon_atpx_priv.bridge_pm_usable; in radeon_atpx_validate()
211 atpx->is_hybrid = true; in radeon_atpx_validate()
218 * radeon_atpx_verify_interface - verify ATPX
222 * Execute the ATPX_FUNCTION_VERIFY_INTERFACE ATPX function
234 info = radeon_atpx_call(atpx->handle, ATPX_FUNCTION_VERIFY_INTERFACE, NULL); in radeon_atpx_verify_interface()
236 return -EIO; in radeon_atpx_verify_interface()
240 size = *(u16 *) info->buffer.pointer; in radeon_atpx_verify_interface()
243 err = -EINVAL; in radeon_atpx_verify_interface()
248 memcpy(&output, info->buffer.pointer, size); in radeon_atpx_verify_interface()
254 radeon_atpx_parse_functions(&atpx->functions, output.function_bits); in radeon_atpx_verify_interface()
262 * radeon_atpx_set_discrete_state - power up/down discrete GPU
267 * Execute the ATPX_FUNCTION_POWER_CONTROL ATPX function to
277 if (atpx->functions.power_cntl) { in radeon_atpx_set_discrete_state()
282 info = radeon_atpx_call(atpx->handle, in radeon_atpx_set_discrete_state()
286 return -EIO; in radeon_atpx_set_discrete_state()
297 * radeon_atpx_switch_disp_mux - switch display mux
302 * Execute the ATPX_FUNCTION_DISPLAY_MUX_CONTROL ATPX function to
313 if (atpx->functions.disp_mux_cntl) { in radeon_atpx_switch_disp_mux()
318 info = radeon_atpx_call(atpx->handle, in radeon_atpx_switch_disp_mux()
322 return -EIO; in radeon_atpx_switch_disp_mux()
329 * radeon_atpx_switch_i2c_mux - switch i2c/hpd mux
334 * Execute the ATPX_FUNCTION_I2C_MUX_CONTROL ATPX function to
345 if (atpx->functions.i2c_mux_cntl) { in radeon_atpx_switch_i2c_mux()
350 info = radeon_atpx_call(atpx->handle, in radeon_atpx_switch_i2c_mux()
354 return -EIO; in radeon_atpx_switch_i2c_mux()
361 * radeon_atpx_switch_start - notify the sbios of a GPU switch
367 * function to notify the sbios that a switch between the discrete GPU and
377 if (atpx->functions.switch_start) { in radeon_atpx_switch_start()
382 info = radeon_atpx_call(atpx->handle, in radeon_atpx_switch_start()
386 return -EIO; in radeon_atpx_switch_start()
393 * radeon_atpx_switch_end - notify the sbios of a GPU switch
399 * function to notify the sbios that a switch between the discrete GPU and
409 if (atpx->functions.switch_end) { in radeon_atpx_switch_end()
414 info = radeon_atpx_call(atpx->handle, in radeon_atpx_switch_end()
418 return -EIO; in radeon_atpx_switch_end()
425 * radeon_atpx_switchto - switch to the requested GPU
451 * radeon_atpx_power_state - power down/up the requested GPU
456 * Execute the necessary ATPX function to power down/up the discrete GPU
472 * radeon_atpx_pci_probe_handle - look up the ATPX handle
484 dhandle = ACPI_HANDLE(&pdev->dev); in radeon_atpx_pci_probe_handle()
498 * radeon_atpx_init - verify the ATPX interface
521 * radeon_atpx_get_client_id - get the client id
530 if (radeon_atpx_priv.dhandle == ACPI_HANDLE(&pdev->dev)) in radeon_atpx_get_client_id()
543 * radeon_atpx_detect - detect whether we have PX
564 d3_supported |= parent_pdev && parent_pdev->bridge_d3; in radeon_atpx_detect()
567 /* some newer PX laptops mark the dGPU as a non-VGA display device */ in radeon_atpx_detect()
574 d3_supported |= parent_pdev && parent_pdev->bridge_d3; in radeon_atpx_detect()
590 * radeon_register_atpx_handler - register with vga_switcheroo
608 * radeon_unregister_atpx_handler - unregister with vga_switcheroo