drivers/gpu/drm/drm_displayid.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_displayid.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_displayid.c- Extension
.c- Size
- 4516 bytes
- Lines
- 205
- 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
drm/drm_edid.hdrm/drm_print.hdrm_crtc_internal.hdrm_displayid_internal.h
Detected Declarations
struct displayid_quirkfunction get_quirksfunction displayid_get_headerfunction validate_displayidfunction displayid_iter_edid_beginfunction displayid_iter_blockfunction __displayid_iter_nextfunction displayid_iter_endfunction displayid_versionfunction Case
Annotated Snippet
struct displayid_quirk {
const struct drm_edid_ident ident;
u8 quirks;
};
static const struct displayid_quirk quirks[] = {
{
.ident = DRM_EDID_IDENT_INIT('C', 'S', 'O', 5142, "MNE007ZA1-5"),
.quirks = BIT(QUIRK_IGNORE_CHECKSUM),
},
};
static u8 get_quirks(const struct drm_edid *drm_edid)
{
int i;
for (i = 0; i < ARRAY_SIZE(quirks); i++) {
if (drm_edid_match(drm_edid, &quirks[i].ident))
return quirks[i].quirks;
}
return 0;
}
static const struct displayid_header *
displayid_get_header(const u8 *displayid, int length, int index)
{
const struct displayid_header *base;
if (sizeof(*base) > length - index)
return ERR_PTR(-EINVAL);
base = (const struct displayid_header *)&displayid[index];
return base;
}
static const struct displayid_header *
validate_displayid(const u8 *displayid, int length, int idx, bool ignore_checksum)
{
int i, dispid_length;
u8 csum = 0;
const struct displayid_header *base;
base = displayid_get_header(displayid, length, idx);
if (IS_ERR(base))
return base;
/* +1 for DispID checksum */
dispid_length = sizeof(*base) + base->bytes + 1;
if (dispid_length > length - idx)
return ERR_PTR(-EINVAL);
for (i = 0; i < dispid_length; i++)
csum += displayid[idx + i];
if (csum) {
DRM_NOTE("DisplayID checksum invalid, remainder is %d%s\n", csum,
ignore_checksum ? " (ignoring)" : "");
if (!ignore_checksum)
return ERR_PTR(-EINVAL);
}
return base;
}
static const u8 *find_next_displayid_extension(struct displayid_iter *iter)
{
const struct displayid_header *base;
const u8 *displayid;
bool ignore_checksum = iter->quirks & BIT(QUIRK_IGNORE_CHECKSUM);
displayid = drm_edid_find_extension(iter->drm_edid, DISPLAYID_EXT, &iter->ext_index);
if (!displayid)
return NULL;
/* EDID extensions block checksum isn't for us */
iter->length = EDID_LENGTH - 1;
iter->idx = 1;
base = validate_displayid(displayid, iter->length, iter->idx, ignore_checksum);
if (IS_ERR(base))
return NULL;
iter->length = iter->idx + sizeof(*base) + base->bytes;
return displayid;
}
void displayid_iter_edid_begin(const struct drm_edid *drm_edid,
Annotation
- Immediate include surface: `drm/drm_edid.h`, `drm/drm_print.h`, `drm_crtc_internal.h`, `drm_displayid_internal.h`.
- Detected declarations: `struct displayid_quirk`, `function get_quirks`, `function displayid_get_header`, `function validate_displayid`, `function displayid_iter_edid_begin`, `function displayid_iter_block`, `function __displayid_iter_next`, `function displayid_iter_end`, `function displayid_version`, `function Case`.
- 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.