drivers/gpu/drm/meson/meson_drv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/meson/meson_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/meson/meson_drv.c- Extension
.c- Size
- 14344 bytes
- Lines
- 576
- 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/aperture.hlinux/component.hlinux/module.hlinux/of_graph.hlinux/sys_soc.hlinux/platform_device.hlinux/soc/amlogic/meson-canvas.hdrm/clients/drm_client_setup.hdrm/drm_atomic_helper.hdrm/drm_drv.hdrm/drm_fbdev_dma.hdrm/drm_gem_dma_helper.hdrm/drm_gem_framebuffer_helper.hdrm/drm_modeset_helper_vtables.hdrm/drm_module.hdrm/drm_probe_helper.hdrm/drm_vblank.hmeson_crtc.hmeson_drv.hmeson_overlay.hmeson_plane.hmeson_osd_afbcd.hmeson_registers.hmeson_encoder_cvbs.hmeson_encoder_hdmi.hmeson_encoder_dsi.hmeson_viu.hmeson_vpp.hmeson_rdma.h
Detected Declarations
struct meson_drm_soc_attrfunction meson_irqfunction meson_dumb_createfunction meson_vpu_has_available_connectorsfunction meson_vpu_initfunction meson_drv_bind_masterfunction meson_drv_bindfunction meson_drv_unbindfunction meson_drv_pm_suspendfunction meson_drv_pm_resumefunction meson_drv_shutdownfunction meson_drv_probefunction for_each_endpoint_of_nodefunction meson_drv_remove
Annotated Snippet
struct meson_drm_soc_attr {
struct meson_drm_soc_limits limits;
const struct soc_device_attribute *attrs;
};
static const struct meson_drm_soc_attr meson_drm_soc_attrs[] = {
/* S805X/S805Y HDMI PLL won't lock for HDMI PHY freq > 1,65GHz */
{
.limits = {
.max_hdmi_phy_freq = 1650000000,
},
.attrs = (const struct soc_device_attribute []) {
{ .soc_id = "GXL (S805*)", },
{ /* sentinel */ }
}
},
};
static int meson_drv_bind_master(struct device *dev, bool has_components)
{
struct platform_device *pdev = to_platform_device(dev);
const struct meson_drm_match_data *match;
struct meson_drm *priv;
struct drm_device *drm;
struct resource *res;
void __iomem *regs;
int ret, i;
/* Checks if an output connector is available */
if (!meson_vpu_has_available_connectors(dev)) {
dev_err(dev, "No output connector available\n");
return -ENODEV;
}
match = of_device_get_match_data(dev);
if (!match)
return -ENODEV;
drm = drm_dev_alloc(&meson_driver, dev);
if (IS_ERR(drm))
return PTR_ERR(drm);
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) {
ret = -ENOMEM;
goto free_drm;
}
drm->dev_private = priv;
priv->drm = drm;
priv->dev = dev;
priv->compat = match->compat;
priv->afbcd.ops = match->afbcd_ops;
regs = devm_platform_ioremap_resource_byname(pdev, "vpu");
if (IS_ERR(regs)) {
ret = PTR_ERR(regs);
goto free_drm;
}
priv->io_base = regs;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hhi");
if (!res) {
ret = -EINVAL;
goto free_drm;
}
/* Simply ioremap since it may be a shared register zone */
regs = devm_ioremap(dev, res->start, resource_size(res));
if (!regs) {
ret = -EADDRNOTAVAIL;
goto free_drm;
}
priv->hhi = devm_regmap_init_mmio(dev, regs,
&meson_regmap_config);
if (IS_ERR(priv->hhi)) {
dev_err(&pdev->dev, "Couldn't create the HHI regmap\n");
ret = PTR_ERR(priv->hhi);
goto free_drm;
}
priv->canvas = meson_canvas_get(dev);
if (IS_ERR(priv->canvas)) {
ret = PTR_ERR(priv->canvas);
goto free_drm;
}
ret = meson_canvas_alloc(priv->canvas, &priv->canvas_id_osd1);
if (ret)
goto free_drm;
Annotation
- Immediate include surface: `linux/aperture.h`, `linux/component.h`, `linux/module.h`, `linux/of_graph.h`, `linux/sys_soc.h`, `linux/platform_device.h`, `linux/soc/amlogic/meson-canvas.h`, `drm/clients/drm_client_setup.h`.
- Detected declarations: `struct meson_drm_soc_attr`, `function meson_irq`, `function meson_dumb_create`, `function meson_vpu_has_available_connectors`, `function meson_vpu_init`, `function meson_drv_bind_master`, `function meson_drv_bind`, `function meson_drv_unbind`, `function meson_drv_pm_suspend`, `function meson_drv_pm_resume`.
- 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.