drivers/gpu/drm/mediatek/mtk_disp_ovl.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/mediatek/mtk_disp_ovl.c- Extension
.c- Size
- 23058 bytes
- Lines
- 781
- 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_blend.hdrm/drm_fourcc.hdrm/drm_framebuffer.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_ovl_datastruct mtk_disp_ovlfunction Copyrightfunction mtk_disp_ovl_irq_handlerfunction mtk_ovl_register_vblank_cbfunction mtk_ovl_unregister_vblank_cbfunction mtk_ovl_enable_vblankfunction mtk_ovl_disable_vblankfunction mtk_ovl_get_blend_modesfunction mtk_ovl_get_num_formatsfunction mtk_ovl_is_afbc_supportedfunction mtk_ovl_clk_enablefunction mtk_ovl_clk_disablefunction mtk_ovl_startfunction mtk_ovl_stopfunction mtk_ovl_set_afbcfunction mtk_ovl_set_bit_depthfunction mtk_ovl_configfunction mtk_ovl_layer_nrfunction mtk_ovl_supported_rotationsfunction mtk_ovl_layer_checkfunction mtk_ovl_layer_onfunction mtk_ovl_layer_offfunction mtk_ovl_fmt_convertfunction mtk_ovl_afbc_layer_configfunction mtk_ovl_layer_configfunction mtk_ovl_bgclr_in_onfunction mtk_ovl_bgclr_in_offfunction mtk_disp_ovl_bindfunction mtk_disp_ovl_unbindfunction mtk_disp_ovl_probefunction mtk_disp_ovl_remove
Annotated Snippet
struct mtk_disp_ovl_data {
unsigned int addr;
unsigned int gmc_bits;
unsigned int layer_nr;
bool fmt_rgb565_is_0;
bool smi_id_en;
bool supports_afbc;
const u32 blend_modes;
const u32 *formats;
size_t num_formats;
bool supports_clrfmt_ext;
};
/*
* struct mtk_disp_ovl - DISP_OVL driver structure
* @crtc: associated crtc to report vblank events to
* @data: platform data
*/
struct mtk_disp_ovl {
struct drm_crtc *crtc;
struct clk *clk;
void __iomem *regs;
struct cmdq_client_reg cmdq_reg;
const struct mtk_disp_ovl_data *data;
void (*vblank_cb)(void *data);
void *vblank_cb_data;
};
static irqreturn_t mtk_disp_ovl_irq_handler(int irq, void *dev_id)
{
struct mtk_disp_ovl *priv = dev_id;
/* Clear frame completion interrupt */
writel(0x0, priv->regs + DISP_REG_OVL_INTSTA);
if (!priv->vblank_cb)
return IRQ_NONE;
priv->vblank_cb(priv->vblank_cb_data);
return IRQ_HANDLED;
}
void mtk_ovl_register_vblank_cb(struct device *dev,
void (*vblank_cb)(void *),
void *vblank_cb_data)
{
struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
ovl->vblank_cb = vblank_cb;
ovl->vblank_cb_data = vblank_cb_data;
}
void mtk_ovl_unregister_vblank_cb(struct device *dev)
{
struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
ovl->vblank_cb = NULL;
ovl->vblank_cb_data = NULL;
}
void mtk_ovl_enable_vblank(struct device *dev)
{
struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
writel(0x0, ovl->regs + DISP_REG_OVL_INTSTA);
writel_relaxed(OVL_FME_CPL_INT, ovl->regs + DISP_REG_OVL_INTEN);
}
void mtk_ovl_disable_vblank(struct device *dev)
{
struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
writel_relaxed(0x0, ovl->regs + DISP_REG_OVL_INTEN);
}
u32 mtk_ovl_get_blend_modes(struct device *dev)
{
struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
return ovl->data->blend_modes;
}
const u32 *mtk_ovl_get_formats(struct device *dev)
{
struct mtk_disp_ovl *ovl = dev_get_drvdata(dev);
return ovl->data->formats;
}
Annotation
- Immediate include surface: `drm/drm_blend.h`, `drm/drm_fourcc.h`, `drm/drm_framebuffer.h`, `linux/clk.h`, `linux/component.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `struct mtk_disp_ovl_data`, `struct mtk_disp_ovl`, `function Copyright`, `function mtk_disp_ovl_irq_handler`, `function mtk_ovl_register_vblank_cb`, `function mtk_ovl_unregister_vblank_cb`, `function mtk_ovl_enable_vblank`, `function mtk_ovl_disable_vblank`, `function mtk_ovl_get_blend_modes`, `function mtk_ovl_get_num_formats`.
- 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.