drivers/gpu/drm/panthor/panthor_hw.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panthor/panthor_hw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/panthor/panthor_hw.c- Extension
.c- Size
- 8528 bytes
- Lines
- 319
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/nvmem-consumer.hlinux/platform_device.hdrm/drm_print.hpanthor_device.hpanthor_gpu.hpanthor_gpu_regs.hpanthor_hw.hpanthor_pwr.hpanthor_pwr_regs.h
Detected Declarations
struct panthor_hw_entryfunction panthor_hw_set_power_tracingfunction panthor_hw_power_status_registerfunction panthor_hw_power_status_unregisterfunction overload_shader_presentfunction panthor_gpu_info_initfunction panthor_hw_info_initfunction panthor_hw_bind_devicefunction panthor_hw_gpu_id_initfunction panthor_hw_init
Annotated Snippet
struct device_driver *drv;
int ret;
drv = driver_find("panthor", &platform_bus_type);
if (!drv)
return -ENODEV;
ret = driver_for_each_device(drv, NULL, (void *)true,
panthor_hw_set_power_tracing);
return ret;
}
void panthor_hw_power_status_unregister(void)
{
struct device_driver *drv;
int ret;
drv = driver_find("panthor", &platform_bus_type);
if (!drv)
return;
ret = driver_for_each_device(drv, NULL, NULL, panthor_hw_set_power_tracing);
/*
* Ideally, it'd be possible to ask driver_for_each_device to hand us
* another "start" to keep going after the failing device, but it
* doesn't do that. Minor inconvenience in what is probably a bad day
* on the computer already though.
*/
if (ret)
pr_warn("Couldn't mask power IRQ for at least one device: %pe\n",
ERR_PTR(ret));
}
static char *get_gpu_model_name(struct panthor_device *ptdev)
{
const u32 gpu_id = ptdev->gpu_info.gpu_id;
const u32 product_id = GPU_PROD_ID_MAKE(GPU_ARCH_MAJOR(gpu_id),
GPU_PROD_MAJOR(gpu_id));
const bool ray_intersection = !!(ptdev->gpu_info.gpu_features &
GPU_FEATURES_RAY_INTERSECTION);
const u8 shader_core_count = hweight64(ptdev->gpu_info.shader_present);
switch (product_id) {
case GPU_PROD_ID_MAKE(10, 2):
return "Mali-G710";
case GPU_PROD_ID_MAKE(10, 3):
return "Mali-G510";
case GPU_PROD_ID_MAKE(10, 4):
return "Mali-G310";
case GPU_PROD_ID_MAKE(10, 7):
return "Mali-G610";
case GPU_PROD_ID_MAKE(11, 2):
if (shader_core_count > 10 && ray_intersection)
return "Mali-G715-Immortalis";
else if (shader_core_count >= 7)
return "Mali-G715";
fallthrough;
case GPU_PROD_ID_MAKE(11, 3):
return "Mali-G615";
case GPU_PROD_ID_MAKE(12, 0):
if (shader_core_count >= 10 && ray_intersection)
return "Mali-G720-Immortalis";
else if (shader_core_count >= 6)
return "Mali-G720";
fallthrough;
case GPU_PROD_ID_MAKE(12, 1):
return "Mali-G620";
case GPU_PROD_ID_MAKE(13, 0):
if (shader_core_count >= 10 && ray_intersection)
return "Mali-G925-Immortalis";
else if (shader_core_count >= 6)
return "Mali-G725";
fallthrough;
case GPU_PROD_ID_MAKE(13, 1):
return "Mali-G625";
case GPU_PROD_ID_MAKE(14, 0):
return "Mali-G1-Ultra";
case GPU_PROD_ID_MAKE(14, 1):
return "Mali-G1-Premium";
case GPU_PROD_ID_MAKE(14, 3):
return "Mali-G1-Pro";
}
return "(Unknown Mali GPU)";
}
Annotation
- Immediate include surface: `linux/nvmem-consumer.h`, `linux/platform_device.h`, `drm/drm_print.h`, `panthor_device.h`, `panthor_gpu.h`, `panthor_gpu_regs.h`, `panthor_hw.h`, `panthor_pwr.h`.
- Detected declarations: `struct panthor_hw_entry`, `function panthor_hw_set_power_tracing`, `function panthor_hw_power_status_register`, `function panthor_hw_power_status_unregister`, `function overload_shader_present`, `function panthor_gpu_info_init`, `function panthor_hw_info_init`, `function panthor_hw_bind_device`, `function panthor_hw_gpu_id_init`, `function panthor_hw_init`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern 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.