drivers/gpu/drm/mediatek/mtk_dp.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/mediatek/mtk_dp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/mediatek/mtk_dp.c- Extension
.c- Size
- 79292 bytes
- Lines
- 2971
- 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.
- 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/display/drm_dp_aux_bus.hdrm/display/drm_dp.hdrm/display/drm_dp_helper.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_crtc.hdrm/drm_edid.hdrm/drm_of.hdrm/drm_panel.hdrm/drm_print.hdrm/drm_probe_helper.hlinux/arm-smccc.hlinux/clk.hlinux/delay.hlinux/errno.hlinux/kernel.hlinux/media-bus-format.hlinux/nvmem-consumer.hlinux/of.hlinux/of_irq.hlinux/of_platform.hlinux/phy/phy.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.hlinux/soc/mediatek/mtk_sip_svc.hsound/hdmi-codec.hvideo/videomode.hmtk_dp_reg.h
Detected Declarations
struct mtk_dp_train_infostruct mtk_dp_audio_cfgstruct mtk_dp_infostruct mtk_dp_efuse_fmtstruct mtk_dpstruct mtk_dp_datafunction mtk_dp_readfunction mtk_dp_writefunction mtk_dp_update_bitsfunction mtk_dp_bulk_16bit_writefunction mtk_dp_msa_bypass_enablefunction mtk_dp_set_msafunction mtk_dp_set_color_formatfunction mtk_dp_set_color_depthfunction mtk_dp_config_mn_modefunction mtk_dp_set_sram_read_startfunction mtk_dp_setup_encoderfunction mtk_dp_pg_enablefunction mtk_dp_audio_setup_channelsfunction mtk_dp_audio_channel_status_setfunction mtk_dp_audio_sdp_asp_set_channelsfunction mtk_dp_audio_set_dividerfunction mtk_dp_sdp_trigger_auifunction mtk_dp_sdp_set_datafunction mtk_dp_sdp_set_header_auifunction mtk_dp_disable_sdp_auifunction mtk_dp_setup_sdp_auifunction mtk_dp_aux_irq_clearfunction mtk_dp_aux_set_cmdfunction mtk_dp_aux_clear_fifofunction mtk_dp_aux_request_readyfunction mtk_dp_aux_fill_write_fifofunction mtk_dp_aux_read_rx_fifofunction mtk_dp_aux_set_lengthfunction mtk_dp_aux_wait_for_completionfunction mtk_dp_aux_do_transferfunction mtk_dp_set_swing_pre_emphasisfunction mtk_dp_reset_swing_pre_emphasisfunction mtk_dp_swirq_get_clearfunction mtk_dp_hwirq_get_clearfunction mtk_dp_hwirq_enablefunction mtk_dp_initialize_settingsfunction mtk_dp_initialize_hpd_detect_settingsfunction mtk_dp_initialize_aux_settingsfunction mtk_dp_initialize_digital_settingsfunction mtk_dp_digital_sw_resetfunction mtk_dp_sdp_path_resetfunction mtk_dp_set_lanes
Annotated Snippet
struct mtk_dp_train_info {
bool sink_ssc;
bool cable_plugged_in;
/* link_rate is in multiple of 0.27Gbps */
int link_rate;
int lane_count;
unsigned int channel_eq_pattern;
};
struct mtk_dp_audio_cfg {
bool detect_monitor;
int sad_count;
int sample_rate;
int word_length_bits;
int channels;
};
struct mtk_dp_info {
enum dp_pixelformat format;
struct videomode vm;
struct mtk_dp_audio_cfg audio_cur_cfg;
};
struct mtk_dp_efuse_fmt {
unsigned short idx;
unsigned short shift;
unsigned short mask;
unsigned short min_val;
unsigned short max_val;
unsigned short default_val;
};
struct mtk_dp {
bool enabled;
bool need_debounce;
int irq;
u8 max_lanes;
u8 max_linkrate;
u8 rx_cap[DP_RECEIVER_CAP_SIZE];
u32 cal_data[MTK_DP_CAL_MAX];
u32 irq_thread_handle;
/* irq_thread_lock is used to protect irq_thread_handle */
spinlock_t irq_thread_lock;
struct device *dev;
struct drm_bridge bridge;
struct drm_bridge *next_bridge;
struct drm_connector *conn;
struct drm_device *drm_dev;
struct drm_dp_aux aux;
const struct mtk_dp_data *data;
struct mtk_dp_info info;
struct mtk_dp_train_info train_info;
struct platform_device *phy_dev;
struct phy *phy;
struct regmap *regs;
struct timer_list debounce_timer;
/* For audio */
bool audio_enable;
hdmi_codec_plugged_cb plugged_cb;
struct platform_device *audio_pdev;
struct device *codec_dev;
/* protect the plugged_cb as it's used in both bridge ops and audio */
struct mutex update_plugged_status_lock;
};
struct mtk_dp_data {
int bridge_type;
unsigned int smc_cmd;
const struct mtk_dp_efuse_fmt *efuse_fmt;
bool audio_supported;
bool audio_pkt_in_hblank_area;
u16 audio_m_div2_bit;
};
static const struct mtk_dp_efuse_fmt mt8188_dp_efuse_fmt[MTK_DP_CAL_MAX] = {
[MTK_DP_CAL_GLB_BIAS_TRIM] = {
.idx = 0,
.shift = 10,
.mask = 0x1f,
.min_val = 1,
.max_val = 0x1e,
.default_val = 0xf,
},
[MTK_DP_CAL_CLKTX_IMPSE] = {
.idx = 0,
Annotation
- Immediate include surface: `drm/display/drm_dp_aux_bus.h`, `drm/display/drm_dp.h`, `drm/display/drm_dp_helper.h`, `drm/drm_atomic_helper.h`, `drm/drm_bridge.h`, `drm/drm_crtc.h`, `drm/drm_edid.h`, `drm/drm_of.h`.
- Detected declarations: `struct mtk_dp_train_info`, `struct mtk_dp_audio_cfg`, `struct mtk_dp_info`, `struct mtk_dp_efuse_fmt`, `struct mtk_dp`, `struct mtk_dp_data`, `function mtk_dp_read`, `function mtk_dp_write`, `function mtk_dp_update_bits`, `function mtk_dp_bulk_16bit_write`.
- 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.
- 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.