drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/mediatek/mtk_hdmi_v2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/mediatek/mtk_hdmi_v2.c- Extension
.c- Size
- 45060 bytes
- Lines
- 1531
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/clk.hlinux/debugfs.hlinux/delay.hlinux/device.hlinux/err.hlinux/interrupt.hlinux/irq.hlinux/kernel.hlinux/mutex.hlinux/of.hlinux/of_platform.hlinux/pm_runtime.hlinux/regmap.hlinux/suspend.hlinux/units.hlinux/phy/phy.hdrm/display/drm_hdmi_helper.hdrm/display/drm_hdmi_state_helper.hdrm/display/drm_scdc_helper.hdrm/drm_drv.hdrm/drm_edid.hdrm/drm_print.hdrm/drm_probe_helper.hmtk_hdmi_common.hmtk_hdmi_regs_v2.h
Detected Declarations
enum mtk_hdmi_v2_clk_idfunction mtk_hdmi_v2_hwirq_disablefunction mtk_hdmi_v2_enable_hpd_pord_irqfunction mtk_hdmi_v2_set_sw_hpdfunction mtk_hdmi_v2_enable_scramblingfunction mtk_hdmi_v2_hw_vid_mutefunction mtk_hdmi_v2_hw_aud_mutefunction mtk_hdmi_v2_hw_resetfunction mtk_hdmi_v2_format_hw_packetfunction mtk_hdmi_v2_hdmi_write_audio_infoframefunction mtk_hdmi_v2_hdmi_write_avi_infoframefunction mtk_hdmi_v2_hdmi_write_spd_infoframefunction mtk_hdmi_v2_hdmi_write_hdmi_infoframefunction mtk_hdmi_yuv420_downsamplingfunction mtk_hdmi_v2_setup_audio_infoframefunction mtk_hdmi_v2_hw_gcp_avmutefunction mtk_hdmi_v2_hw_ncts_enablefunction mtk_hdmi_v2_hw_aud_set_channel_statusfunction mtk_hdmi_v2_hw_aud_set_nctsfunction mtk_hdmi_v2_hw_aud_enablefunction mtk_hdmi_v2_aud_output_channel_mapfunction mtk_hdmi_audio_dsd_configfunction mtk_hdmi_v2_hw_i2s_fifo_mapfunction mtk_hdmi_v2_hw_i2s_ch_numberfunction mtk_hdmi_v2_hw_i2s_ch_mappingfunction mtk_hdmi_i2s_data_fmtfunction mtk_hdmi_i2s_sck_edge_risefunction mtk_hdmi_i2s_cbit_orderfunction mtk_hdmi_i2s_vbitfunction mtk_hdmi_i2s_data_directionfunction mtk_hdmi_v2_hw_audio_typefunction mtk_hdmi_v2_get_i2s_ch_mappingfunction mtk_hdmi_v2_hw_i2s_ch_swapfunction mtk_hdmi_hbr_configfunction mtk_hdmi_v2_hw_spdif_configfunction mtk_hdmi_v2_aud_set_inputfunction mtk_hdmi_v2_hw_audio_input_enablefunction mtk_hdmi_v2_aip_ctrl_initfunction mtk_hdmi_v2_audio_resetfunction mtk_hdmi_v2_aud_output_configfunction mtk_hdmi_v2_change_video_resolutionfunction mtk_hdmi_v2_output_set_display_modefunction mtk_hdmi_v2_clk_enablefunction mtk_hdmi_v2_clk_disablefunction mtk_hdmi_v2_hpd_pord_statusfunction mtk_hdmi_v2_isrfunction __mtk_hdmi_v2_isr_threadfunction mtk_hdmi_v2_isr_thread
Annotated Snippet
static const struct file_operations mtk_hdmi_debug_abist_fops = {
.owner = THIS_MODULE,
.open = mtk_hdmi_v2_debug_abist_open,
.read = seq_read,
.write = mtk_hdmi_v2_debug_abist_write,
.llseek = seq_lseek,
.release = single_release,
};
static void mtk_hdmi_v2_debugfs_init(struct drm_bridge *bridge, struct dentry *root)
{
struct mtk_hdmi *dpi = hdmi_ctx_from_bridge(bridge);
debugfs_create_file("hdmi_abist", 0640, root, dpi, &mtk_hdmi_debug_abist_fops);
}
static const struct drm_bridge_funcs mtk_v2_hdmi_bridge_funcs = {
.attach = mtk_hdmi_v2_bridge_attach,
.detach = mtk_hdmi_v2_bridge_detach,
.mode_fixup = mtk_hdmi_bridge_mode_fixup,
.mode_set = mtk_hdmi_bridge_mode_set,
.atomic_pre_enable = mtk_hdmi_v2_bridge_pre_enable,
.atomic_enable = mtk_hdmi_v2_bridge_enable,
.atomic_disable = mtk_hdmi_v2_bridge_disable,
.atomic_post_disable = mtk_hdmi_v2_bridge_post_disable,
.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
.atomic_reset = drm_atomic_helper_bridge_reset,
.detect = mtk_hdmi_v2_bridge_detect,
.edid_read = mtk_hdmi_v2_bridge_edid_read,
.hpd_enable = mtk_hdmi_v2_hpd_enable,
.hpd_disable = mtk_hdmi_v2_hpd_disable,
.hdmi_tmds_char_rate_valid = mtk_hdmi_v2_hdmi_tmds_char_rate_valid,
.hdmi_clear_audio_infoframe = mtk_hdmi_v2_hdmi_clear_audio_infoframe,
.hdmi_write_audio_infoframe = mtk_hdmi_v2_hdmi_write_audio_infoframe,
.hdmi_clear_avi_infoframe = mtk_hdmi_v2_hdmi_clear_avi_infoframe,
.hdmi_write_avi_infoframe = mtk_hdmi_v2_hdmi_write_avi_infoframe,
.hdmi_clear_spd_infoframe = mtk_hdmi_v2_hdmi_clear_spd_infoframe,
.hdmi_write_spd_infoframe = mtk_hdmi_v2_hdmi_write_spd_infoframe,
.hdmi_clear_hdmi_infoframe = mtk_hdmi_v2_hdmi_clear_hdmi_infoframe,
.hdmi_write_hdmi_infoframe = mtk_hdmi_v2_hdmi_write_hdmi_infoframe,
.debugfs_init = mtk_hdmi_v2_debugfs_init,
};
/*
* HDMI audio codec callbacks
*/
static int mtk_hdmi_v2_audio_hook_plugged_cb(struct device *dev, void *data,
hdmi_codec_plugged_cb fn,
struct device *codec_dev)
{
struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
bool plugged;
if (!hdmi)
return -ENODEV;
mtk_hdmi_audio_set_plugged_cb(hdmi, fn, codec_dev);
plugged = (hdmi->hpd == HDMI_PLUG_IN_AND_SINK_POWER_ON);
mtk_hdmi_v2_handle_plugged_change(hdmi, plugged);
return 0;
}
static int mtk_hdmi_v2_audio_hw_params(struct device *dev, void *data,
struct hdmi_codec_daifmt *daifmt,
struct hdmi_codec_params *params)
{
struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
if (hdmi->audio_enable) {
mtk_hdmi_audio_params(hdmi, daifmt, params);
mtk_hdmi_v2_aud_output_config(hdmi, &hdmi->mode);
}
return 0;
}
static int mtk_hdmi_v2_audio_startup(struct device *dev, void *data)
{
struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
mtk_hdmi_v2_hw_aud_enable(hdmi, true);
hdmi->audio_enable = true;
return 0;
}
static void mtk_hdmi_v2_audio_shutdown(struct device *dev, void *data)
{
struct mtk_hdmi *hdmi = dev_get_drvdata(dev);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/device.h`, `linux/err.h`, `linux/interrupt.h`, `linux/irq.h`.
- Detected declarations: `enum mtk_hdmi_v2_clk_id`, `function mtk_hdmi_v2_hwirq_disable`, `function mtk_hdmi_v2_enable_hpd_pord_irq`, `function mtk_hdmi_v2_set_sw_hpd`, `function mtk_hdmi_v2_enable_scrambling`, `function mtk_hdmi_v2_hw_vid_mute`, `function mtk_hdmi_v2_hw_aud_mute`, `function mtk_hdmi_v2_hw_reset`, `function mtk_hdmi_v2_format_hw_packet`, `function mtk_hdmi_v2_hdmi_write_audio_infoframe`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.