drivers/gpu/drm/mediatek/mtk_disp_rdma.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/mediatek/mtk_disp_rdma.c- Extension
.c- Size
- 11912 bytes
- Lines
- 424
- 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.
- 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_fourcc.hlinux/clk.hlinux/component.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_runtime.hlinux/soc/mediatek/mtk-cmdq.hmtk_crtc.hmtk_ddp_comp.hmtk_disp_drv.hmtk_drm_drv.h
Detected Declarations
struct mtk_disp_rdma_datastruct mtk_disp_rdmafunction mtk_disp_rdma_irq_handlerfunction rdma_update_bitsfunction mtk_rdma_register_vblank_cbfunction mtk_rdma_unregister_vblank_cbfunction mtk_rdma_enable_vblankfunction mtk_rdma_disable_vblankfunction mtk_rdma_get_num_formatsfunction mtk_rdma_clk_enablefunction mtk_rdma_clk_disablefunction mtk_rdma_startfunction mtk_rdma_stopfunction mtk_rdma_configfunction rdma_fmt_convertfunction mtk_rdma_layer_nrfunction mtk_rdma_layer_configfunction mtk_disp_rdma_bindfunction mtk_disp_rdma_unbindfunction mtk_disp_rdma_probefunction mtk_disp_rdma_remove
Annotated Snippet
struct mtk_disp_rdma_data {
unsigned int fifo_size;
const u32 *formats;
size_t num_formats;
};
/*
* struct mtk_disp_rdma - DISP_RDMA driver structure
* @data: local driver data
*/
struct mtk_disp_rdma {
struct clk *clk;
void __iomem *regs;
struct cmdq_client_reg cmdq_reg;
const struct mtk_disp_rdma_data *data;
void (*vblank_cb)(void *data);
void *vblank_cb_data;
u32 fifo_size;
};
static irqreturn_t mtk_disp_rdma_irq_handler(int irq, void *dev_id)
{
struct mtk_disp_rdma *priv = dev_id;
/* Clear frame completion interrupt */
writel(0x0, priv->regs + DISP_REG_RDMA_INT_STATUS);
if (!priv->vblank_cb)
return IRQ_NONE;
priv->vblank_cb(priv->vblank_cb_data);
return IRQ_HANDLED;
}
static void rdma_update_bits(struct device *dev, unsigned int reg,
unsigned int mask, unsigned int val)
{
struct mtk_disp_rdma *rdma = dev_get_drvdata(dev);
unsigned int tmp = readl(rdma->regs + reg);
tmp = (tmp & ~mask) | (val & mask);
writel(tmp, rdma->regs + reg);
}
void mtk_rdma_register_vblank_cb(struct device *dev,
void (*vblank_cb)(void *),
void *vblank_cb_data)
{
struct mtk_disp_rdma *rdma = dev_get_drvdata(dev);
rdma->vblank_cb = vblank_cb;
rdma->vblank_cb_data = vblank_cb_data;
}
void mtk_rdma_unregister_vblank_cb(struct device *dev)
{
struct mtk_disp_rdma *rdma = dev_get_drvdata(dev);
rdma->vblank_cb = NULL;
rdma->vblank_cb_data = NULL;
}
void mtk_rdma_enable_vblank(struct device *dev)
{
rdma_update_bits(dev, DISP_REG_RDMA_INT_ENABLE, RDMA_FRAME_END_INT,
RDMA_FRAME_END_INT);
}
void mtk_rdma_disable_vblank(struct device *dev)
{
rdma_update_bits(dev, DISP_REG_RDMA_INT_ENABLE, RDMA_FRAME_END_INT, 0);
}
const u32 *mtk_rdma_get_formats(struct device *dev)
{
struct mtk_disp_rdma *rdma = dev_get_drvdata(dev);
return rdma->data->formats;
}
size_t mtk_rdma_get_num_formats(struct device *dev)
{
struct mtk_disp_rdma *rdma = dev_get_drvdata(dev);
return rdma->data->num_formats;
}
int mtk_rdma_clk_enable(struct device *dev)
{
Annotation
- Immediate include surface: `drm/drm_fourcc.h`, `linux/clk.h`, `linux/component.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/soc/mediatek/mtk-cmdq.h`.
- Detected declarations: `struct mtk_disp_rdma_data`, `struct mtk_disp_rdma`, `function mtk_disp_rdma_irq_handler`, `function rdma_update_bits`, `function mtk_rdma_register_vblank_cb`, `function mtk_rdma_unregister_vblank_cb`, `function mtk_rdma_enable_vblank`, `function mtk_rdma_disable_vblank`, `function mtk_rdma_get_num_formats`, `function mtk_rdma_clk_enable`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- 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.