drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/modules/hdcp/hdcp_ddc.c- Extension
.c- Size
- 23480 bytes
- Lines
- 765
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
hdcp.h
Detected Declarations
enum mod_hdcp_ddc_message_idfunction readfunction read_repeatedlyfunction writefunction mod_hdcp_read_bksvfunction mod_hdcp_read_bcapsfunction mod_hdcp_read_bstatusfunction mod_hdcp_read_r0pfunction mod_hdcp_read_ksvlistfunction mod_hdcp_read_vpfunction mod_hdcp_read_binfofunction mod_hdcp_write_aksvfunction mod_hdcp_write_ainfofunction mod_hdcp_write_anfunction mod_hdcp_read_hdcp2versionfunction mod_hdcp_read_rxcapsfunction mod_hdcp_read_rxstatusfunction mod_hdcp_read_ake_certfunction mod_hdcp_read_h_primefunction mod_hdcp_read_pairing_infofunction mod_hdcp_read_l_primefunction mod_hdcp_read_rx_id_listfunction mod_hdcp_read_stream_readyfunction mod_hdcp_write_ake_initfunction mod_hdcp_write_no_stored_kmfunction mod_hdcp_write_stored_kmfunction mod_hdcp_write_lc_initfunction mod_hdcp_write_eksfunction mod_hdcp_write_repeater_auth_ackfunction mod_hdcp_write_stream_managefunction mod_hdcp_write_content_typefunction mod_hdcp_clear_cp_irq_statusfunction write_stall_read_lc_fw_auxfunction write_poll_read_lc_fw_i2cfunction mod_hdcp_write_poll_read_lc_fw
Annotated Snippet
while (buf_len > 0) {
cur_size = MIN(buf_len, HDCP_MAX_AUX_TRANSACTION_SIZE);
success = hdcp->config.ddc.funcs.read_dpcd(hdcp->config.ddc.handle,
hdcp_dpcd_addrs[msg_id] + data_offset,
buf + data_offset,
cur_size);
if (!success)
break;
buf_len -= cur_size;
data_offset += cur_size;
}
} else {
int num_i2c_offsets = ARRAY_SIZE(hdcp_i2c_offsets);
if (msg_id >= num_i2c_offsets)
return MOD_HDCP_STATUS_DDC_FAILURE;
success = hdcp->config.ddc.funcs.read_i2c(
hdcp->config.ddc.handle,
HDCP_I2C_ADDR,
hdcp_i2c_offsets[msg_id],
buf,
(uint32_t)buf_len);
}
return success ? MOD_HDCP_STATUS_SUCCESS : MOD_HDCP_STATUS_DDC_FAILURE;
}
static enum mod_hdcp_status read_repeatedly(struct mod_hdcp *hdcp,
enum mod_hdcp_ddc_message_id msg_id,
uint8_t *buf,
uint32_t buf_len,
uint8_t read_size)
{
enum mod_hdcp_status status = MOD_HDCP_STATUS_DDC_FAILURE;
uint32_t cur_size = 0;
uint32_t data_offset = 0;
while (buf_len > 0) {
cur_size = MIN(buf_len, read_size);
status = read(hdcp, msg_id, buf + data_offset, cur_size);
if (status != MOD_HDCP_STATUS_SUCCESS)
break;
buf_len -= cur_size;
data_offset += cur_size;
}
return status;
}
static enum mod_hdcp_status write(struct mod_hdcp *hdcp,
enum mod_hdcp_ddc_message_id msg_id,
uint8_t *buf,
uint32_t buf_len)
{
bool success = true;
uint32_t cur_size = 0;
uint32_t data_offset = 0;
if (msg_id == MOD_HDCP_MESSAGE_ID_INVALID ||
msg_id >= MOD_HDCP_MESSAGE_ID_MAX)
return MOD_HDCP_STATUS_DDC_FAILURE;
if (is_dp_hdcp(hdcp)) {
int num_dpcd_addrs = ARRAY_SIZE(hdcp_dpcd_addrs);
if (msg_id >= num_dpcd_addrs)
return MOD_HDCP_STATUS_DDC_FAILURE;
while (buf_len > 0) {
cur_size = MIN(buf_len, HDCP_MAX_AUX_TRANSACTION_SIZE);
success = hdcp->config.ddc.funcs.write_dpcd(
hdcp->config.ddc.handle,
hdcp_dpcd_addrs[msg_id] + data_offset,
buf + data_offset,
cur_size);
if (!success)
break;
buf_len -= cur_size;
data_offset += cur_size;
}
} else {
int num_i2c_offsets = ARRAY_SIZE(hdcp_i2c_offsets);
if (msg_id >= num_i2c_offsets)
return MOD_HDCP_STATUS_DDC_FAILURE;
Annotation
- Immediate include surface: `hdcp.h`.
- Detected declarations: `enum mod_hdcp_ddc_message_id`, `function read`, `function read_repeatedly`, `function write`, `function mod_hdcp_read_bksv`, `function mod_hdcp_read_bcaps`, `function mod_hdcp_read_bstatus`, `function mod_hdcp_read_r0p`, `function mod_hdcp_read_ksvlist`, `function mod_hdcp_read_vp`.
- 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.
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.