drivers/gpu/drm/mediatek/mtk_ethdr.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/mediatek/mtk_ethdr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/mediatek/mtk_ethdr.c- Extension
.c- Size
- 11438 bytes
- Lines
- 397
- 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/of.hlinux/of_address.hlinux/platform_device.hlinux/reset.hlinux/soc/mediatek/mtk-cmdq.hlinux/soc/mediatek/mtk-mmsys.hmtk_crtc.hmtk_ddp_comp.hmtk_drm_drv.hmtk_ethdr.h
Detected Declarations
struct mtk_ethdr_compstruct mtk_ethdrenum mtk_ethdr_comp_idfunction mtk_ethdr_register_vblank_cbfunction mtk_ethdr_unregister_vblank_cbfunction mtk_ethdr_enable_vblankfunction mtk_ethdr_disable_vblankfunction mtk_ethdr_irq_handlerfunction mtk_ethdr_get_blend_modesfunction mtk_ethdr_layer_configfunction mtk_ethdr_configfunction mtk_ethdr_startfunction mtk_ethdr_stopfunction mtk_ethdr_clk_enablefunction mtk_ethdr_clk_disablefunction mtk_ethdr_bindfunction mtk_ethdr_unbindfunction mtk_ethdr_probefunction mtk_ethdr_remove
Annotated Snippet
struct mtk_ethdr_comp {
struct device *dev;
void __iomem *regs;
struct cmdq_client_reg cmdq_base;
};
struct mtk_ethdr {
struct mtk_ethdr_comp ethdr_comp[ETHDR_ID_MAX];
struct clk_bulk_data ethdr_clk[ETHDR_CLK_NUM];
struct device *mmsys_dev;
void (*vblank_cb)(void *data);
void *vblank_cb_data;
int irq;
struct reset_control *reset_ctl;
};
static const char * const ethdr_clk_str[] = {
"ethdr_top",
"mixer",
"vdo_fe0",
"vdo_fe1",
"gfx_fe0",
"gfx_fe1",
"vdo_be",
"adl_ds",
"vdo_fe0_async",
"vdo_fe1_async",
"gfx_fe0_async",
"gfx_fe1_async",
"vdo_be_async",
};
void mtk_ethdr_register_vblank_cb(struct device *dev,
void (*vblank_cb)(void *),
void *vblank_cb_data)
{
struct mtk_ethdr *priv = dev_get_drvdata(dev);
priv->vblank_cb = vblank_cb;
priv->vblank_cb_data = vblank_cb_data;
}
void mtk_ethdr_unregister_vblank_cb(struct device *dev)
{
struct mtk_ethdr *priv = dev_get_drvdata(dev);
priv->vblank_cb = NULL;
priv->vblank_cb_data = NULL;
}
void mtk_ethdr_enable_vblank(struct device *dev)
{
struct mtk_ethdr *priv = dev_get_drvdata(dev);
writel(MIX_FME_CPL_INTEN, priv->ethdr_comp[ETHDR_MIXER].regs + MIX_INTEN);
}
void mtk_ethdr_disable_vblank(struct device *dev)
{
struct mtk_ethdr *priv = dev_get_drvdata(dev);
writel(0x0, priv->ethdr_comp[ETHDR_MIXER].regs + MIX_INTEN);
}
static irqreturn_t mtk_ethdr_irq_handler(int irq, void *dev_id)
{
struct mtk_ethdr *priv = dev_id;
writel(0x0, priv->ethdr_comp[ETHDR_MIXER].regs + MIX_INTSTA);
if (!priv->vblank_cb)
return IRQ_NONE;
priv->vblank_cb(priv->vblank_cb_data);
return IRQ_HANDLED;
}
u32 mtk_ethdr_get_blend_modes(struct device *dev)
{
return BIT(DRM_MODE_BLEND_PREMULTI) |
BIT(DRM_MODE_BLEND_COVERAGE) |
BIT(DRM_MODE_BLEND_PIXEL_NONE);
}
void mtk_ethdr_layer_config(struct device *dev, unsigned int idx,
struct mtk_plane_state *state,
struct cmdq_pkt *cmdq_pkt)
{
struct mtk_ethdr *priv = dev_get_drvdata(dev);
Annotation
- Immediate include surface: `drm/drm_blend.h`, `drm/drm_fourcc.h`, `drm/drm_framebuffer.h`, `linux/clk.h`, `linux/component.h`, `linux/of.h`, `linux/of_address.h`, `linux/platform_device.h`.
- Detected declarations: `struct mtk_ethdr_comp`, `struct mtk_ethdr`, `enum mtk_ethdr_comp_id`, `function mtk_ethdr_register_vblank_cb`, `function mtk_ethdr_unregister_vblank_cb`, `function mtk_ethdr_enable_vblank`, `function mtk_ethdr_disable_vblank`, `function mtk_ethdr_irq_handler`, `function mtk_ethdr_get_blend_modes`, `function mtk_ethdr_layer_config`.
- 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.