drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c- Extension
.c- Size
- 40440 bytes
- Lines
- 1412
- 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
drm/drm_atomic_helper.hdrm/drm_drv.hdrm/drm_probe_helper.hvideo/mipi_display.hvideo/videomode.hlinux/clk.hlinux/interrupt.hlinux/iopoll.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/platform_device.hlinux/pm_runtime.hlinux/reset.hlinux/phy/phy-mipi-dphy.hcdns-dsi-core.hcdns-dsi-j721e.h
Detected Declarations
struct cdns_dsi_bridge_statefunction to_cdns_dsi_bridge_statefunction bridge_to_cdns_dsi_inputfunction dpi_to_dsi_timingfunction cdns_dsi_mode2cfgfunction cdns_dsi_check_conffunction cdns_dsi_bridge_attachfunction cdns_dsi_bridge_mode_validfunction cdns_dsi_bridge_atomic_post_disablefunction cdns_dsi_hs_initfunction cdns_dsi_init_linkfunction cdns_dsi_bridge_atomic_pre_enablefunction cdns_dsi_round_pclkfunction cdns_dsi_bridge_atomic_checkfunction cdns_dsi_bridge_atomic_duplicate_statefunction cdns_dsi_bridge_atomic_destroy_statefunction cdns_dsi_bridge_atomic_resetfunction cdns_dsi_attachfunction cdns_dsi_detachfunction cdns_dsi_interruptfunction cdns_dsi_transferfunction cdns_dsi_resumefunction cdns_dsi_suspendfunction cdns_dsi_drm_probefunction cdns_dsi_drm_remove
Annotated Snippet
struct cdns_dsi_bridge_state {
struct drm_bridge_state base;
struct cdns_dsi_cfg dsi_cfg;
};
static inline struct cdns_dsi_bridge_state *
to_cdns_dsi_bridge_state(struct drm_bridge_state *bridge_state)
{
return container_of(bridge_state, struct cdns_dsi_bridge_state, base);
}
static inline struct cdns_dsi *input_to_dsi(struct cdns_dsi_input *input)
{
return container_of(input, struct cdns_dsi, input);
}
static inline struct cdns_dsi *to_cdns_dsi(struct mipi_dsi_host *host)
{
return container_of(host, struct cdns_dsi, base);
}
static inline struct cdns_dsi_input *
bridge_to_cdns_dsi_input(struct drm_bridge *bridge)
{
return container_of(bridge, struct cdns_dsi_input, bridge);
}
static unsigned int dpi_to_dsi_timing(unsigned int dpi_timing,
unsigned int dpi_bpp,
unsigned int dsi_pkt_overhead)
{
unsigned int dsi_timing = DIV_ROUND_UP(dpi_timing * dpi_bpp, 8);
if (dsi_timing < dsi_pkt_overhead)
dsi_timing = 0;
else
dsi_timing -= dsi_pkt_overhead;
return dsi_timing;
}
static int cdns_dsi_mode2cfg(struct cdns_dsi *dsi,
const struct videomode *vm,
struct cdns_dsi_cfg *dsi_cfg)
{
struct cdns_dsi_output *output = &dsi->output;
u32 dpi_hsa, dpi_hbp, dpi_hfp, dpi_hact;
bool sync_pulse;
int bpp;
dpi_hsa = vm->hsync_len;
dpi_hbp = vm->hback_porch;
dpi_hfp = vm->hfront_porch;
dpi_hact = vm->hactive;
memset(dsi_cfg, 0, sizeof(*dsi_cfg));
sync_pulse = output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
bpp = mipi_dsi_pixel_format_to_bpp(output->dev->format);
if (sync_pulse) {
dsi_cfg->hbp = dpi_to_dsi_timing(dpi_hbp, bpp,
DSI_HBP_FRAME_PULSE_OVERHEAD);
dsi_cfg->hsa = dpi_to_dsi_timing(dpi_hsa, bpp,
DSI_HSA_FRAME_OVERHEAD);
} else {
dsi_cfg->hbp = dpi_to_dsi_timing(dpi_hbp + dpi_hsa, bpp,
DSI_HBP_FRAME_EVENT_OVERHEAD);
dsi_cfg->hsa = 0;
}
dsi_cfg->hact = dpi_to_dsi_timing(dpi_hact, bpp, 0);
dsi_cfg->hfp = dpi_to_dsi_timing(dpi_hfp, bpp, DSI_HFP_FRAME_OVERHEAD);
dsi_cfg->htotal = dsi_cfg->hact + dsi_cfg->hfp + DSI_HFP_FRAME_OVERHEAD;
if (sync_pulse) {
dsi_cfg->htotal += dsi_cfg->hbp + DSI_HBP_FRAME_PULSE_OVERHEAD;
dsi_cfg->htotal += dsi_cfg->hsa + DSI_HSA_FRAME_OVERHEAD;
} else {
dsi_cfg->htotal += dsi_cfg->hbp + DSI_HBP_FRAME_EVENT_OVERHEAD;
}
return 0;
}
Annotation
- Immediate include surface: `drm/drm_atomic_helper.h`, `drm/drm_drv.h`, `drm/drm_probe_helper.h`, `video/mipi_display.h`, `video/videomode.h`, `linux/clk.h`, `linux/interrupt.h`, `linux/iopoll.h`.
- Detected declarations: `struct cdns_dsi_bridge_state`, `function to_cdns_dsi_bridge_state`, `function bridge_to_cdns_dsi_input`, `function dpi_to_dsi_timing`, `function cdns_dsi_mode2cfg`, `function cdns_dsi_check_conf`, `function cdns_dsi_bridge_attach`, `function cdns_dsi_bridge_mode_valid`, `function cdns_dsi_bridge_atomic_post_disable`, `function cdns_dsi_hs_init`.
- 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.