drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c- Extension
.c- Size
- 17331 bytes
- Lines
- 669
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/vga_switcheroo.hlinux/slab.hlinux/acpi.hlinux/pci.hlinux/delay.hamdgpu.hamd_acpi.h
Detected Declarations
struct amdgpu_px_quirkstruct amdgpu_atpx_functionsstruct amdgpu_atpxstruct atpx_verify_interfacestruct atpx_px_paramsstruct atpx_power_controlstruct atpx_muxfunction amdgpu_has_atpxfunction amdgpu_has_atpx_dgpu_power_cntlfunction amdgpu_is_atpx_hybridfunction functionfunction supportedfunction enabledfunction amdgpu_atpx_verify_interfacefunction amdgpu_atpx_set_discrete_statefunction amdgpu_atpx_switch_disp_muxfunction amdgpu_atpx_switch_i2c_muxfunction begunfunction endedfunction GPUfunction amdgpu_atpx_power_statefunction handlesfunction interfacefunction GPUfunction amdgpu_atpx_get_quirksfunction systemfunction vga_switcheroofunction vga_switcheroo
Annotated Snippet
struct amdgpu_px_quirk {
u32 chip_vendor;
u32 chip_device;
u32 subsys_vendor;
u32 subsys_device;
u32 px_quirk_flags;
};
struct amdgpu_atpx_functions {
bool px_params;
bool power_cntl;
bool disp_mux_cntl;
bool i2c_mux_cntl;
bool switch_start;
bool switch_end;
bool disp_connectors_mapping;
bool disp_detection_ports;
};
struct amdgpu_atpx {
acpi_handle handle;
struct amdgpu_atpx_functions functions;
bool is_hybrid;
bool dgpu_req_power_for_displays;
};
static struct amdgpu_atpx_priv {
bool atpx_detected;
bool bridge_pm_usable;
unsigned int quirks;
/* handle for device - and atpx */
acpi_handle dhandle;
acpi_handle other_handle;
struct amdgpu_atpx atpx;
} amdgpu_atpx_priv;
struct atpx_verify_interface {
u16 size; /* structure size in bytes (includes size field) */
u16 version; /* version */
u32 function_bits; /* supported functions bit vector */
} __packed;
struct atpx_px_params {
u16 size; /* structure size in bytes (includes size field) */
u32 valid_flags; /* which flags are valid */
u32 flags; /* flags */
} __packed;
struct atpx_power_control {
u16 size;
u8 dgpu_state;
} __packed;
struct atpx_mux {
u16 size;
u16 mux;
} __packed;
bool amdgpu_has_atpx(void)
{
return amdgpu_atpx_priv.atpx_detected;
}
bool amdgpu_has_atpx_dgpu_power_cntl(void)
{
return amdgpu_atpx_priv.atpx.functions.power_cntl;
}
bool amdgpu_is_atpx_hybrid(void)
{
return amdgpu_atpx_priv.atpx.is_hybrid;
}
/**
* amdgpu_atpx_call - call an ATPX method
*
* @handle: acpi handle
* @function: the ATPX function to execute
* @params: ATPX function params
*
* Executes the requested ATPX function (all asics).
* Returns a pointer to the acpi output buffer.
*/
static union acpi_object *amdgpu_atpx_call(acpi_handle handle, int function,
struct acpi_buffer *params)
{
acpi_status status;
union acpi_object atpx_arg_elements[2];
struct acpi_object_list atpx_arg;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
Annotation
- Immediate include surface: `linux/vga_switcheroo.h`, `linux/slab.h`, `linux/acpi.h`, `linux/pci.h`, `linux/delay.h`, `amdgpu.h`, `amd_acpi.h`.
- Detected declarations: `struct amdgpu_px_quirk`, `struct amdgpu_atpx_functions`, `struct amdgpu_atpx`, `struct atpx_verify_interface`, `struct atpx_px_params`, `struct atpx_power_control`, `struct atpx_mux`, `function amdgpu_has_atpx`, `function amdgpu_has_atpx_dgpu_power_cntl`, `function amdgpu_is_atpx_hybrid`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.