drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c- Extension
.c- Size
- 19849 bytes
- Lines
- 725
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
linux/mailbox_controller.hlinux/platform_device.hmtk-mdp3-cfg.hmtk-mdp3-cmdq.hmtk-mdp3-comp.hmtk-mdp3-core.hmtk-mdp3-m2m.hmtk-img-ipi.h
Detected Declarations
struct mdp_pathfunction is_output_disabledfunction __get_pp_numfunction __get_pipefunction mdp_path_subfrm_requirefunction mdp_path_subfrm_runfunction mdp_path_ctx_initfunction mdp_path_config_subfrmfunction mdp_path_configfunction mdp_auto_release_workfunction mdp_handle_cmdq_callbackfunction mdp_cmdq_sendexport mdp_cmdq_send
Annotated Snippet
struct mdp_path {
struct mdp_dev *mdp_dev;
struct mdp_comp_ctx comps[MDP_PATH_MAX_COMPS];
u32 num_comps;
const struct img_config *config;
const struct img_ipi_frameparam *param;
const struct v4l2_rect *composes[IMG_MAX_HW_OUTPUTS];
struct v4l2_rect bounds[IMG_MAX_HW_OUTPUTS];
};
#define has_op(ctx, op) \
((ctx)->comp->ops && (ctx)->comp->ops->op)
#define call_op(ctx, op, ...) \
(has_op(ctx, op) ? (ctx)->comp->ops->op(ctx, ##__VA_ARGS__) : 0)
static bool is_output_disabled(int p_id, const struct img_compparam *param, u32 count)
{
u32 num = 0;
bool dis_output = false;
bool dis_tile = false;
if (CFG_CHECK(MT8183, p_id)) {
num = CFG_COMP(MT8183, param, num_subfrms);
dis_output = CFG_COMP(MT8183, param, frame.output_disable);
dis_tile = CFG_COMP(MT8183, param, frame.output_disable);
} else if (CFG_CHECK(MT8195, p_id)) {
num = CFG_COMP(MT8195, param, num_subfrms);
dis_output = CFG_COMP(MT8195, param, frame.output_disable);
dis_tile = CFG_COMP(MT8195, param, frame.output_disable);
}
return (count < num) ? (dis_output || dis_tile) : true;
}
static struct mtk_mutex *__get_mutex(const struct mdp_dev *mdp_dev,
const struct mdp_pipe_info *p)
{
return mdp_dev->mm_subsys[p->sub_id].mdp_mutex[p->mutex_id];
}
static u8 __get_pp_num(enum mdp_stream_type type)
{
switch (type) {
case MDP_STREAM_TYPE_DUAL_BITBLT:
return MDP_PP_USED_2;
default:
return MDP_PP_USED_1;
}
}
static enum mdp_pipe_id __get_pipe(const struct mdp_dev *mdp_dev,
enum mtk_mdp_comp_id id)
{
enum mdp_pipe_id pipe_id;
switch (id) {
case MDP_COMP_RDMA0:
pipe_id = MDP_PIPE_RDMA0;
break;
case MDP_COMP_ISP_IMGI:
pipe_id = MDP_PIPE_IMGI;
break;
case MDP_COMP_WPEI:
pipe_id = MDP_PIPE_WPEI;
break;
case MDP_COMP_WPEI2:
pipe_id = MDP_PIPE_WPEI2;
break;
case MDP_COMP_RDMA1:
pipe_id = MDP_PIPE_RDMA1;
break;
case MDP_COMP_RDMA2:
pipe_id = MDP_PIPE_RDMA2;
break;
case MDP_COMP_RDMA3:
pipe_id = MDP_PIPE_RDMA3;
break;
default:
/* Avoid exceptions when operating MUTEX */
pipe_id = MDP_PIPE_RDMA0;
dev_err(&mdp_dev->pdev->dev, "Unknown pipeline id %d", id);
break;
}
return pipe_id;
}
static struct img_config *__get_config_offset(struct mdp_dev *mdp,
struct mdp_cmdq_param *param,
u8 pp_idx)
Annotation
- Immediate include surface: `linux/mailbox_controller.h`, `linux/platform_device.h`, `mtk-mdp3-cfg.h`, `mtk-mdp3-cmdq.h`, `mtk-mdp3-comp.h`, `mtk-mdp3-core.h`, `mtk-mdp3-m2m.h`, `mtk-img-ipi.h`.
- Detected declarations: `struct mdp_path`, `function is_output_disabled`, `function __get_pp_num`, `function __get_pipe`, `function mdp_path_subfrm_require`, `function mdp_path_subfrm_run`, `function mdp_path_ctx_init`, `function mdp_path_config_subfrm`, `function mdp_path_config`, `function mdp_auto_release_work`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.