drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c- Extension
.c- Size
- 23562 bytes
- Lines
- 933
- 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.
- 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/delay.hlinux/interconnect.hlinux/of_irq.hdrm/drm_debugfs.hdrm/drm_drv.hdrm/drm_file.hdrm/drm_vblank.hmsm_drv.hmsm_gem.hmsm_mmu.hmdp5_kms.h
Detected Declarations
function Copyrightfunction mdp5_get_existing_global_statefunction mdp5_global_duplicate_statefunction mdp5_global_destroy_statefunction mdp5_global_create_statefunction mdp5_global_print_statefunction mdp5_enable_commitfunction mdp5_disable_commitfunction mdp5_prepare_commitfunction mdp5_flush_commitfunction mdp5_complete_commitfunction mdp5_kms_destroyfunction mdp5_disablefunction mdp5_enablefunction get_dsi_id_from_intffunction modeset_init_intffunction modeset_initfunction read_mdp_hw_revisionfunction get_clkfunction mdp5_kms_initfunction mdp5_destroyfunction construct_pipesfunction hwpipe_initfunction hwmixer_initfunction interface_initfunction mdp5_initfunction mdp5_setup_interconnectfunction mdp5_dev_probefunction mdp5_dev_removefunction mdp5_runtime_suspendfunction mdp5_runtime_resumefunction msm_mdp_registerfunction msm_mdp_unregister
Annotated Snippet
if (intfs[i] == INTF_DSI) {
if (intf_num == i)
return id;
id++;
}
}
return -EINVAL;
}
static int modeset_init_intf(struct mdp5_kms *mdp5_kms,
struct mdp5_interface *intf)
{
struct drm_device *dev = mdp5_kms->dev;
struct msm_drm_private *priv = dev->dev_private;
struct mdp5_ctl_manager *ctlm = mdp5_kms->ctlm;
struct mdp5_ctl *ctl;
struct drm_encoder *encoder;
int ret = 0;
switch (intf->type) {
case INTF_eDP:
DRM_DEV_INFO(dev->dev, "Skipping eDP interface %d\n", intf->num);
break;
case INTF_HDMI:
if (!priv->kms->hdmi)
break;
ctl = mdp5_ctlm_request(ctlm, intf->num);
if (!ctl) {
ret = -EINVAL;
break;
}
encoder = construct_encoder(mdp5_kms, intf, ctl);
if (IS_ERR(encoder)) {
ret = PTR_ERR(encoder);
break;
}
ret = msm_hdmi_modeset_init(priv->kms->hdmi, dev, encoder);
break;
case INTF_DSI:
{
const struct mdp5_cfg_hw *hw_cfg =
mdp5_cfg_get_hw_config(mdp5_kms->cfg);
int dsi_id = get_dsi_id_from_intf(hw_cfg, intf->num);
if ((dsi_id >= ARRAY_SIZE(priv->kms->dsi)) || (dsi_id < 0)) {
DRM_DEV_ERROR(dev->dev, "failed to find dsi from intf %d\n",
intf->num);
ret = -EINVAL;
break;
}
if (!priv->kms->dsi[dsi_id])
break;
ctl = mdp5_ctlm_request(ctlm, intf->num);
if (!ctl) {
ret = -EINVAL;
break;
}
encoder = construct_encoder(mdp5_kms, intf, ctl);
if (IS_ERR(encoder)) {
ret = PTR_ERR(encoder);
break;
}
ret = msm_dsi_modeset_init(priv->kms->dsi[dsi_id], dev, encoder);
if (!ret)
mdp5_encoder_set_intf_mode(encoder,
msm_dsi_is_cmd_mode(priv->kms->dsi[dsi_id]));
break;
}
default:
DRM_DEV_ERROR(dev->dev, "unknown intf: %d\n", intf->type);
ret = -EINVAL;
break;
}
return ret;
}
static int modeset_init(struct mdp5_kms *mdp5_kms)
{
struct drm_device *dev = mdp5_kms->dev;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/interconnect.h`, `linux/of_irq.h`, `drm/drm_debugfs.h`, `drm/drm_drv.h`, `drm/drm_file.h`, `drm/drm_vblank.h`, `msm_drv.h`.
- Detected declarations: `function Copyright`, `function mdp5_get_existing_global_state`, `function mdp5_global_duplicate_state`, `function mdp5_global_destroy_state`, `function mdp5_global_create_state`, `function mdp5_global_print_state`, `function mdp5_enable_commit`, `function mdp5_disable_commit`, `function mdp5_prepare_commit`, `function mdp5_flush_commit`.
- 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.