drivers/gpu/drm/radeon/radeon_device.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/radeon_device.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/radeon_device.c- Extension
.c- Size
- 50003 bytes
- Lines
- 1860
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/efi.hlinux/pci.hlinux/pm_runtime.hlinux/slab.hlinux/vga_switcheroo.hlinux/vgaarb.hdrm/drm_cache.hdrm/drm_client_event.hdrm/drm_crtc_helper.hdrm/drm_device.hdrm/drm_fb_helper.hdrm/drm_file.hdrm/drm_framebuffer.hdrm/drm_probe_helper.hdrm/radeon_drm.hradeon_device.hradeon_reg.hradeon.hatom.h
Detected Declarations
struct radeon_px_quirkfunction radeon_has_atpx_dgpu_power_cntlfunction radeon_is_atpx_hybridfunction radeon_is_pxfunction radeon_device_handle_px_quirksfunction radeon_program_register_sequencefunction radeon_pci_config_resetfunction registersfunction informationfunction driverfunction driverfunction informationfunction informationfunction driverfunction driverfunction eventsfunction memoryfunction memoryfunction parameterfunction radeon_gtt_locationfunction VMfunction initializedfunction watermarksfunction itfunction driverfunction driverfunction actionsfunction interpreterfunction interpreterfunction interpreterfunction interpreterfunction interpreterfunction interpreterfunction interpreterfunction interpreterfunction interpreterfunction combiosfunction combiosfunction radeon_gart_size_autofunction driverfunction radeon_switcheroo_set_statefunction radeon_switcheroo_can_switchfunction hwfunction radeon_ib_ring_testsfunction infofunction statefunction statefunction list_for_each_entry
Annotated Snippet
struct radeon_px_quirk {
u32 chip_vendor;
u32 chip_device;
u32 subsys_vendor;
u32 subsys_device;
u32 px_quirk_flags;
};
static struct radeon_px_quirk radeon_px_quirk_list[] = {
/* Acer aspire 5560g (CPU: AMD A4-3305M; GPU: AMD Radeon HD 6480g + 7470m)
* https://bugzilla.kernel.org/show_bug.cgi?id=74551
*/
{ PCI_VENDOR_ID_ATI, 0x6760, 0x1025, 0x0672, RADEON_PX_QUIRK_DISABLE_PX },
/* Asus K73TA laptop with AMD A6-3400M APU and Radeon 6550 GPU
* https://bugzilla.kernel.org/show_bug.cgi?id=51381
*/
{ PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x108c, RADEON_PX_QUIRK_DISABLE_PX },
/* Asus K53TK laptop with AMD A6-3420M APU and Radeon 7670m GPU
* https://bugzilla.kernel.org/show_bug.cgi?id=51381
*/
{ PCI_VENDOR_ID_ATI, 0x6840, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX },
/* Asus K53TK laptop with AMD A6-3420M APU and Radeon 7670m GPU
* https://bugs.freedesktop.org/show_bug.cgi?id=101491
*/
{ PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX },
/* Asus K73TK laptop with AMD A6-3420M APU and Radeon 7670m GPU
* https://bugzilla.kernel.org/show_bug.cgi?id=51381#c52
*/
{ PCI_VENDOR_ID_ATI, 0x6840, 0x1043, 0x2123, RADEON_PX_QUIRK_DISABLE_PX },
{ 0, 0, 0, 0, 0 },
};
bool radeon_is_px(struct drm_device *dev)
{
struct radeon_device *rdev = dev->dev_private;
if (rdev->flags & RADEON_IS_PX)
return true;
return false;
}
static void radeon_device_handle_px_quirks(struct radeon_device *rdev)
{
struct radeon_px_quirk *p = radeon_px_quirk_list;
/* Apply PX quirks */
while (p && p->chip_device != 0) {
if (rdev->pdev->vendor == p->chip_vendor &&
rdev->pdev->device == p->chip_device &&
rdev->pdev->subsystem_vendor == p->subsys_vendor &&
rdev->pdev->subsystem_device == p->subsys_device) {
rdev->px_quirk_flags = p->px_quirk_flags;
break;
}
++p;
}
if (rdev->px_quirk_flags & RADEON_PX_QUIRK_DISABLE_PX)
rdev->flags &= ~RADEON_IS_PX;
/* disable PX is the system doesn't support dGPU power control or hybrid gfx */
if (!radeon_is_atpx_hybrid() &&
!radeon_has_atpx_dgpu_power_cntl())
rdev->flags &= ~RADEON_IS_PX;
}
/**
* radeon_program_register_sequence - program an array of registers.
*
* @rdev: radeon_device pointer
* @registers: pointer to the register array
* @array_size: size of the register array
*
* Programs an array or registers with and and or masks.
* This is a helper for setting golden registers.
*/
void radeon_program_register_sequence(struct radeon_device *rdev,
const u32 *registers,
const u32 array_size)
{
u32 tmp, reg, and_mask, or_mask;
int i;
if (array_size % 3)
return;
for (i = 0; i < array_size; i +=3) {
reg = registers[i + 0];
and_mask = registers[i + 1];
or_mask = registers[i + 2];
Annotation
- Immediate include surface: `linux/efi.h`, `linux/pci.h`, `linux/pm_runtime.h`, `linux/slab.h`, `linux/vga_switcheroo.h`, `linux/vgaarb.h`, `drm/drm_cache.h`, `drm/drm_client_event.h`.
- Detected declarations: `struct radeon_px_quirk`, `function radeon_has_atpx_dgpu_power_cntl`, `function radeon_is_atpx_hybrid`, `function radeon_is_px`, `function radeon_device_handle_px_quirks`, `function radeon_program_register_sequence`, `function radeon_pci_config_reset`, `function registers`, `function information`, `function driver`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.