drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c- Extension
.c- Size
- 20591 bytes
- Lines
- 680
- 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
drm/drm_fourcc.hdrm/drm_of.hlinux/clk.hlinux/component.hlinux/of.hlinux/of_address.hlinux/of_platform.hlinux/platform_device.hlinux/pm_runtime.hlinux/reset.hlinux/soc/mediatek/mtk-cmdq.hlinux/soc/mediatek/mtk-mmsys.hlinux/soc/mediatek/mtk-mutex.hmtk_ddp_comp.hmtk_disp_drv.hmtk_drm_drv.hmtk_ethdr.h
Detected Declarations
struct ovl_adaptor_comp_matchstruct mtk_disp_ovl_adaptorenum mtk_ovl_adaptor_comp_typeenum mtk_ovl_adaptor_comp_idfunction mtk_ovl_adaptor_layer_configfunction mtk_ovl_adaptor_configfunction mtk_ovl_adaptor_startfunction mtk_ovl_adaptor_stopfunction power_offfunction mtk_ovl_adaptor_power_onfunction mtk_ovl_adaptor_power_offfunction mtk_ovl_adaptor_clk_enablefunction mtk_ovl_adaptor_clk_disablefunction mtk_ovl_adaptor_mode_validfunction mtk_ovl_adaptor_layer_nrfunction mtk_ovl_adaptor_register_vblank_cbfunction mtk_ovl_adaptor_unregister_vblank_cbfunction mtk_ovl_adaptor_enable_vblankfunction mtk_ovl_adaptor_disable_vblankfunction mtk_ovl_adaptor_get_blend_modesfunction mtk_ovl_adaptor_get_num_formatsfunction mtk_ovl_adaptor_add_compfunction mtk_ovl_adaptor_remove_compfunction mtk_ovl_adaptor_connectfunction mtk_ovl_adaptor_disconnectfunction ovl_adaptor_comp_get_idfunction ovl_adaptor_of_get_ddp_comp_typefunction mtk_ovl_adaptor_is_comp_presentfunction ovl_adaptor_put_devicefunction ovl_adaptor_comp_initfunction for_each_child_of_node_scopedfunction mtk_disp_ovl_adaptor_comp_bindfunction mtk_disp_ovl_adaptor_comp_unbindfunction mtk_disp_ovl_adaptor_master_bindfunction mtk_disp_ovl_adaptor_master_unbindfunction mtk_disp_ovl_adaptor_probefunction mtk_disp_ovl_adaptor_remove
Annotated Snippet
struct ovl_adaptor_comp_match {
enum mtk_ovl_adaptor_comp_type type;
enum mtk_ddp_comp_id comp_id;
int alias_id;
const struct mtk_ddp_comp_funcs *funcs;
};
struct mtk_disp_ovl_adaptor {
struct device *ovl_adaptor_comp[OVL_ADAPTOR_ID_MAX];
struct device *mmsys_dev;
bool children_bound;
};
static const char * const private_comp_stem[OVL_ADAPTOR_TYPE_NUM] = {
[OVL_ADAPTOR_TYPE_ETHDR] = "ethdr",
[OVL_ADAPTOR_TYPE_MDP_RDMA] = "vdo1-rdma",
[OVL_ADAPTOR_TYPE_MERGE] = "merge",
[OVL_ADAPTOR_TYPE_PADDING] = "padding",
};
static const struct mtk_ddp_comp_funcs ethdr = {
.clk_enable = mtk_ethdr_clk_enable,
.clk_disable = mtk_ethdr_clk_disable,
.start = mtk_ethdr_start,
.stop = mtk_ethdr_stop,
};
static const struct mtk_ddp_comp_funcs merge = {
.clk_enable = mtk_merge_clk_enable,
.clk_disable = mtk_merge_clk_disable,
.mode_valid = mtk_merge_mode_valid,
};
static const struct mtk_ddp_comp_funcs padding = {
.clk_enable = mtk_padding_clk_enable,
.clk_disable = mtk_padding_clk_disable,
.start = mtk_padding_start,
.stop = mtk_padding_stop,
};
static const struct mtk_ddp_comp_funcs rdma = {
.power_on = mtk_mdp_rdma_power_on,
.power_off = mtk_mdp_rdma_power_off,
.clk_enable = mtk_mdp_rdma_clk_enable,
.clk_disable = mtk_mdp_rdma_clk_disable,
};
static const struct ovl_adaptor_comp_match comp_matches[OVL_ADAPTOR_ID_MAX] = {
[OVL_ADAPTOR_ETHDR0] = { OVL_ADAPTOR_TYPE_ETHDR, DDP_COMPONENT_ETHDR_MIXER, 0, ðdr },
[OVL_ADAPTOR_MDP_RDMA0] = { OVL_ADAPTOR_TYPE_MDP_RDMA, DDP_COMPONENT_MDP_RDMA0, 0, &rdma },
[OVL_ADAPTOR_MDP_RDMA1] = { OVL_ADAPTOR_TYPE_MDP_RDMA, DDP_COMPONENT_MDP_RDMA1, 1, &rdma },
[OVL_ADAPTOR_MDP_RDMA2] = { OVL_ADAPTOR_TYPE_MDP_RDMA, DDP_COMPONENT_MDP_RDMA2, 2, &rdma },
[OVL_ADAPTOR_MDP_RDMA3] = { OVL_ADAPTOR_TYPE_MDP_RDMA, DDP_COMPONENT_MDP_RDMA3, 3, &rdma },
[OVL_ADAPTOR_MDP_RDMA4] = { OVL_ADAPTOR_TYPE_MDP_RDMA, DDP_COMPONENT_MDP_RDMA4, 4, &rdma },
[OVL_ADAPTOR_MDP_RDMA5] = { OVL_ADAPTOR_TYPE_MDP_RDMA, DDP_COMPONENT_MDP_RDMA5, 5, &rdma },
[OVL_ADAPTOR_MDP_RDMA6] = { OVL_ADAPTOR_TYPE_MDP_RDMA, DDP_COMPONENT_MDP_RDMA6, 6, &rdma },
[OVL_ADAPTOR_MDP_RDMA7] = { OVL_ADAPTOR_TYPE_MDP_RDMA, DDP_COMPONENT_MDP_RDMA7, 7, &rdma },
[OVL_ADAPTOR_MERGE0] = { OVL_ADAPTOR_TYPE_MERGE, DDP_COMPONENT_MERGE1, 1, &merge },
[OVL_ADAPTOR_MERGE1] = { OVL_ADAPTOR_TYPE_MERGE, DDP_COMPONENT_MERGE2, 2, &merge },
[OVL_ADAPTOR_MERGE2] = { OVL_ADAPTOR_TYPE_MERGE, DDP_COMPONENT_MERGE3, 3, &merge },
[OVL_ADAPTOR_MERGE3] = { OVL_ADAPTOR_TYPE_MERGE, DDP_COMPONENT_MERGE4, 4, &merge },
[OVL_ADAPTOR_PADDING0] = { OVL_ADAPTOR_TYPE_PADDING, DDP_COMPONENT_PADDING0, 0, &padding },
[OVL_ADAPTOR_PADDING1] = { OVL_ADAPTOR_TYPE_PADDING, DDP_COMPONENT_PADDING1, 1, &padding },
[OVL_ADAPTOR_PADDING2] = { OVL_ADAPTOR_TYPE_PADDING, DDP_COMPONENT_PADDING2, 2, &padding },
[OVL_ADAPTOR_PADDING3] = { OVL_ADAPTOR_TYPE_PADDING, DDP_COMPONENT_PADDING3, 3, &padding },
[OVL_ADAPTOR_PADDING4] = { OVL_ADAPTOR_TYPE_PADDING, DDP_COMPONENT_PADDING4, 4, &padding },
[OVL_ADAPTOR_PADDING5] = { OVL_ADAPTOR_TYPE_PADDING, DDP_COMPONENT_PADDING5, 5, &padding },
[OVL_ADAPTOR_PADDING6] = { OVL_ADAPTOR_TYPE_PADDING, DDP_COMPONENT_PADDING6, 6, &padding },
[OVL_ADAPTOR_PADDING7] = { OVL_ADAPTOR_TYPE_PADDING, DDP_COMPONENT_PADDING7, 7, &padding },
};
void mtk_ovl_adaptor_layer_config(struct device *dev, unsigned int idx,
struct mtk_plane_state *state,
struct cmdq_pkt *cmdq_pkt)
{
struct mtk_disp_ovl_adaptor *ovl_adaptor = dev_get_drvdata(dev);
struct mtk_plane_pending_state *pending = &state->pending;
struct mtk_mdp_rdma_cfg rdma_config = {0};
struct device *rdma_l;
struct device *rdma_r;
struct device *merge;
struct device *ethdr;
const struct drm_format_info *fmt_info = drm_format_info(pending->format);
bool use_dual_pipe = false;
unsigned int align_width;
unsigned int l_w = 0;
unsigned int r_w = 0;
dev_dbg(dev, "%s+ idx:%d, enable:%d, fmt:0x%x\n", __func__, idx,
pending->enable, pending->format);
Annotation
- Immediate include surface: `drm/drm_fourcc.h`, `drm/drm_of.h`, `linux/clk.h`, `linux/component.h`, `linux/of.h`, `linux/of_address.h`, `linux/of_platform.h`, `linux/platform_device.h`.
- Detected declarations: `struct ovl_adaptor_comp_match`, `struct mtk_disp_ovl_adaptor`, `enum mtk_ovl_adaptor_comp_type`, `enum mtk_ovl_adaptor_comp_id`, `function mtk_ovl_adaptor_layer_config`, `function mtk_ovl_adaptor_config`, `function mtk_ovl_adaptor_start`, `function mtk_ovl_adaptor_stop`, `function power_off`, `function mtk_ovl_adaptor_power_on`.
- 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.