drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c- Extension
.c- Size
- 64718 bytes
- Lines
- 2475
- 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/clk.hlinux/delay.hlinux/err.hlinux/firmware.hlinux/io.hlinux/iopoll.hlinux/irq.hlinux/media-bus-format.hlinux/module.hlinux/of.hlinux/phy/phy.hlinux/phy/phy-dp.hlinux/platform_device.hlinux/slab.hlinux/wait.hdrm/display/drm_dp_helper.hdrm/display/drm_hdcp_helper.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_atomic_state_helper.hdrm/drm_bridge.hdrm/drm_connector.hdrm/drm_edid.hdrm/drm_modeset_helper_vtables.hdrm/drm_print.hdrm/drm_probe_helper.hlinux/unaligned.hcdns-mhdp8546-core.hcdns-mhdp8546-hdcp.hcdns-mhdp8546-j721e.h
Detected Declarations
function Copyrightfunction cdns_mhdp_bridge_hpd_disablefunction cdns_mhdp_mailbox_readfunction cdns_mhdp_mailbox_writefunction cdns_mhdp_mailbox_recv_headerfunction cdns_mhdp_mailbox_recv_datafunction cdns_mhdp_mailbox_sendfunction cdns_mhdp_reg_readfunction cdns_mhdp_reg_writefunction cdns_mhdp_reg_write_bitfunction cdns_mhdp_dpcd_readfunction cdns_mhdp_dpcd_writefunction cdns_mhdp_set_firmware_activefunction cdns_mhdp_get_hpd_statusfunction cdns_mhdp_get_edid_blockfunction cdns_mhdp_read_hpd_eventfunction cdns_mhdp_adjust_ltfunction cdns_mhdp_link_configurefunction cdns_mhdp_max_link_ratefunction cdns_mhdp_max_num_lanesfunction cdns_mhdp_eq_training_pattern_supportedfunction cdns_mhdp_get_ssc_supportedfunction cdns_mhdp_detectfunction cdns_mhdp_check_fw_versionfunction cdns_mhdp_fw_activatefunction cdns_mhdp_fw_cbfunction cdns_mhdp_load_firmwarefunction cdns_mhdp_transferfunction cdns_mhdp_link_training_initfunction cdns_mhdp_get_adjust_trainfunction cdns_mhdp_set_adjust_request_voltagefunction cdns_mhdp_set_adjust_request_pre_emphasisfunction cdns_mhdp_adjust_requested_eqfunction cdns_mhdp_print_lt_statusfunction cdns_mhdp_link_training_channel_eqfunction cdns_mhdp_adjust_requested_crfunction cdns_mhdp_validate_crfunction cdns_mhdp_link_training_crfunction cdns_mhdp_lower_link_ratefunction cdns_mhdp_link_trainingfunction cdns_mhdp_get_training_interval_usfunction cdns_mhdp_fill_host_capsfunction cdns_mhdp_fill_sink_capsfunction cdns_mhdp_link_upfunction cdns_mhdp_link_trainingfunction cdns_mhdp_link_downfunction cdns_mhdp_get_bppfunction cdns_mhdp_bandwidth_ok
Annotated Snippet
if (fw_ver == 26098) {
revision = 15;
} else if (lib_ver == 0 && fw_ver == 0) {
revision = 17;
} else {
dev_err(mhdp->dev, "Unsupported FW version: fw_ver = %u, lib_ver = %u\n",
fw_ver, lib_ver);
return -ENODEV;
}
} else {
/* To identify newer FW versions with major number 2 onwards. */
major_num = fw_ver / 10000;
minor_num = (fw_ver / 100) % 100;
revision = (fw_ver % 10000) % 100;
}
dev_dbg(mhdp->dev, "FW version: v%u.%u.%u\n", major_num, minor_num,
revision);
return 0;
}
static int cdns_mhdp_fw_activate(const struct firmware *fw,
struct cdns_mhdp_device *mhdp)
{
unsigned int reg;
int ret;
/* Release uCPU reset and stall it. */
writel(CDNS_CPU_STALL, mhdp->regs + CDNS_APB_CTRL);
memcpy_toio(mhdp->regs + CDNS_MHDP_IMEM, fw->data, fw->size);
/* Leave debug mode, release stall */
writel(0, mhdp->regs + CDNS_APB_CTRL);
/*
* Wait for the KEEP_ALIVE "message" on the first 8 bits.
* Updated each sched "tick" (~2ms)
*/
ret = readl_poll_timeout(mhdp->regs + CDNS_KEEP_ALIVE, reg,
reg & CDNS_KEEP_ALIVE_MASK, 500,
CDNS_KEEP_ALIVE_TIMEOUT);
if (ret) {
dev_err(mhdp->dev,
"device didn't give any life sign: reg %d\n", reg);
return ret;
}
ret = cdns_mhdp_check_fw_version(mhdp);
if (ret)
return ret;
/* Init events to 0 as it's not cleared by FW at boot but on read */
readl(mhdp->regs + CDNS_SW_EVENT0);
readl(mhdp->regs + CDNS_SW_EVENT1);
readl(mhdp->regs + CDNS_SW_EVENT2);
readl(mhdp->regs + CDNS_SW_EVENT3);
/* Activate uCPU */
ret = cdns_mhdp_set_firmware_active(mhdp, true);
if (ret)
return ret;
spin_lock(&mhdp->start_lock);
mhdp->hw_state = MHDP_HW_READY;
/*
* Here we must keep the lock while enabling the interrupts
* since it would otherwise be possible that interrupt enable
* code is executed after the bridge is detached. The similar
* situation is not possible in attach()/detach() callbacks
* since the hw_state changes from MHDP_HW_READY to
* MHDP_HW_STOPPED happens only due to driver removal when
* bridge should already be detached.
*/
cdns_mhdp_bridge_hpd_enable(&mhdp->bridge);
spin_unlock(&mhdp->start_lock);
wake_up(&mhdp->fw_load_wq);
dev_dbg(mhdp->dev, "DP FW activated\n");
return 0;
}
static void cdns_mhdp_fw_cb(const struct firmware *fw, void *context)
{
struct cdns_mhdp_device *mhdp = context;
bool bridge_attached;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/err.h`, `linux/firmware.h`, `linux/io.h`, `linux/iopoll.h`, `linux/irq.h`, `linux/media-bus-format.h`.
- Detected declarations: `function Copyright`, `function cdns_mhdp_bridge_hpd_disable`, `function cdns_mhdp_mailbox_read`, `function cdns_mhdp_mailbox_write`, `function cdns_mhdp_mailbox_recv_header`, `function cdns_mhdp_mailbox_recv_data`, `function cdns_mhdp_mailbox_send`, `function cdns_mhdp_reg_read`, `function cdns_mhdp_reg_write`, `function cdns_mhdp_reg_write_bit`.
- 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.