drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
Source file repositories/reference/linux-study-clean/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c- Extension
.c- Size
- 53032 bytes
- Lines
- 1838
- Domain
- Driver Families
- Bucket
- drivers/media
- 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/completion.hlinux/ctype.hlinux/delay.hlinux/hex.hlinux/init.hlinux/interrupt.hlinux/kernel.hlinux/module.hlinux/slab.hlinux/time.hextron-da-hd-4k-plus.h
Detected Declarations
function extron_send_bytefunction extron_send_lenfunction extron_send_and_wait_lenfunction extron_send_and_waitfunction extron_parse_edidfunction get_edid_tag_locationfunction extron_edid_crcfunction extron_set_edid_stringfunction extron_update_edidfunction extron_write_edidfunction update_edid_workfunction extron_read_edidfunction extron_irq_work_handlerfunction extron_process_receivedfunction extron_port_signal_changefunction extron_process_signal_changefunction extron_port_edid_changefunction extron_process_edid_changefunction extron_phys_addr_changefunction extron_process_tx_donefunction extron_add_edidfunction extron_interruptfunction extron_cec_adap_enablefunction extron_cec_adap_log_addrfunction extron_cec_adap_transmitfunction extron_cec_adap_unconfiguredfunction extron_cec_configuredfunction extron_cec_adap_nb_transmit_canceledfunction extron_receivedfunction extron_adap_status_portfunction extron_adap_statusfunction extron_querycapfunction extron_enum_inputfunction extron_g_inputfunction extron_s_inputfunction extron_enum_outputfunction extron_g_outputfunction extron_s_outputfunction extron_g_edidfunction extron_s_edidfunction extron_log_statusfunction extron_disconnectfunction extron_setupfunction strcmpfunction extron_setup_threadfunction extron_connect
Annotated Snippet
switch (tag) {
case 2: /* Video Data Block */
/* Search for VIC 97 */
if (memchr(edid + i + 1, 97, len))
port->has_4kp60 = true;
/* Search for VIC 95 */
if (memchr(edid + i + 1, 95, len))
port->has_4kp30 = true;
break;
case 7: /* Use Extended Tag */
switch (edid[i + 1]) {
case 0: /* Video Capability Data Block */
if (edid[i + 2] & 0x80)
port->has_qy = true;
if (edid[i + 2] & 0x40)
port->has_qs = true;
break;
}
break;
}
i += len + 1;
} while (i < end);
}
static int get_edid_tag_location(const u8 *edid, unsigned int size,
u8 want_tag, u8 ext_tag)
{
unsigned int offset = 128;
int i, end;
u8 d;
edid += offset;
/* Return if not a CTA-861 extension block */
if (size < 256 || edid[0] != 0x02 || edid[1] != 0x03)
return -ENOENT;
/* search tag */
d = edid[0x02] & 0x7f;
if (d <= 4)
return -ENOENT;
i = 0x04;
end = 0x00 + d;
do {
unsigned char tag = edid[i] >> 5;
unsigned char len = edid[i] & 0x1f;
if (tag != want_tag || i + len > end) {
i += len + 1;
continue;
}
if (tag < 7 || (len >= 1 && edid[i + 1] == ext_tag))
return offset + i;
i += len + 1;
} while (i < end);
return -ENOENT;
}
static void extron_edid_crc(u8 *edid)
{
u8 sum = 0;
int offset;
/* Update CRC */
for (offset = 0; offset < 127; offset++)
sum += edid[offset];
edid[127] = 256 - sum;
}
/*
* Fill in EDID string. As per VESA EDID-1.3, strings are at most 13 chars
* long. If shorter then add a 0x0a character after the string and pad the
* remainder with spaces.
*/
static void extron_set_edid_string(u8 *start, const char *s)
{
const unsigned int max_len = 13;
int len = strlen(s);
memset(start, ' ', max_len);
if (len > max_len)
len = max_len;
memcpy(start, s, len);
if (len < max_len)
start[len] = 0x0a;
}
Annotation
- Immediate include surface: `linux/completion.h`, `linux/ctype.h`, `linux/delay.h`, `linux/hex.h`, `linux/init.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `function extron_send_byte`, `function extron_send_len`, `function extron_send_and_wait_len`, `function extron_send_and_wait`, `function extron_parse_edid`, `function get_edid_tag_location`, `function extron_edid_crc`, `function extron_set_edid_string`, `function extron_update_edid`, `function extron_write_edid`.
- Atlas domain: Driver Families / drivers/media.
- 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.