drivers/gpu/drm/meson/meson_dw_hdmi.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/meson/meson_dw_hdmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/meson/meson_dw_hdmi.c- Extension
.c- Size
- 25059 bytes
- Lines
- 875
- 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
linux/clk.hlinux/component.hlinux/kernel.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/platform_device.hlinux/regulator/consumer.hlinux/reset.hdrm/bridge/dw_hdmi.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_device.hdrm/drm_edid.hdrm/drm_probe_helper.hdrm/drm_print.hlinux/videodev2.hmeson_drv.hmeson_dw_hdmi.hmeson_registers.h
Detected Declarations
struct meson_dw_hdmistruct meson_dw_hdmi_datastruct meson_dw_hdmienum meson_venc_sourcefunction dw_hdmi_is_compatiblefunction dw_hdmi_top_readfunction dw_hdmi_g12a_top_readfunction dw_hdmi_top_writefunction dw_hdmi_g12a_top_writefunction dw_hdmi_top_write_bitsfunction dw_hdmi_dwc_readfunction dw_hdmi_g12a_dwc_readfunction dw_hdmi_dwc_writefunction dw_hdmi_g12a_dwc_writefunction meson_hdmi_phy_setup_modefunction meson_dw_hdmi_phy_resetfunction dw_hdmi_phy_initfunction dw_hdmi_phy_disablefunction dw_hdmi_read_hpdfunction dw_hdmi_setup_hpdfunction dw_hdmi_top_irqfunction dw_hdmi_top_thread_irqfunction meson_dw_hdmi_reg_readfunction meson_dw_hdmi_reg_writefunction meson_dw_hdmi_initfunction meson_disable_clkfunction meson_enable_clkfunction meson_dw_hdmi_bindfunction meson_dw_hdmi_unbindfunction meson_dw_hdmi_pm_suspendfunction meson_dw_hdmi_pm_resumefunction meson_dw_hdmi_probefunction meson_dw_hdmi_remove
Annotated Snippet
struct meson_dw_hdmi_data {
unsigned int (*top_read)(struct meson_dw_hdmi *dw_hdmi,
unsigned int addr);
void (*top_write)(struct meson_dw_hdmi *dw_hdmi,
unsigned int addr, unsigned int data);
unsigned int (*dwc_read)(struct meson_dw_hdmi *dw_hdmi,
unsigned int addr);
void (*dwc_write)(struct meson_dw_hdmi *dw_hdmi,
unsigned int addr, unsigned int data);
u32 cntl0_init;
u32 cntl1_init;
};
struct meson_dw_hdmi {
struct dw_hdmi_plat_data dw_plat_data;
struct meson_drm *priv;
struct device *dev;
void __iomem *hdmitx;
const struct meson_dw_hdmi_data *data;
struct reset_control *hdmitx_apb;
struct reset_control *hdmitx_ctrl;
struct reset_control *hdmitx_phy;
u32 irq_stat;
struct dw_hdmi *hdmi;
struct drm_bridge *bridge;
};
static inline int dw_hdmi_is_compatible(struct meson_dw_hdmi *dw_hdmi,
const char *compat)
{
return of_device_is_compatible(dw_hdmi->dev->of_node, compat);
}
/* PHY (via TOP bridge) and Controller dedicated register interface */
static unsigned int dw_hdmi_top_read(struct meson_dw_hdmi *dw_hdmi,
unsigned int addr)
{
unsigned long flags;
unsigned int data;
spin_lock_irqsave(®_lock, flags);
/* ADDR must be written twice */
writel(addr & 0xffff, dw_hdmi->hdmitx + HDMITX_TOP_ADDR_REG);
writel(addr & 0xffff, dw_hdmi->hdmitx + HDMITX_TOP_ADDR_REG);
/* Read needs a second DATA read */
data = readl(dw_hdmi->hdmitx + HDMITX_TOP_DATA_REG);
data = readl(dw_hdmi->hdmitx + HDMITX_TOP_DATA_REG);
spin_unlock_irqrestore(®_lock, flags);
return data;
}
static unsigned int dw_hdmi_g12a_top_read(struct meson_dw_hdmi *dw_hdmi,
unsigned int addr)
{
return readl(dw_hdmi->hdmitx + HDMITX_TOP_G12A_OFFSET + (addr << 2));
}
static inline void dw_hdmi_top_write(struct meson_dw_hdmi *dw_hdmi,
unsigned int addr, unsigned int data)
{
unsigned long flags;
spin_lock_irqsave(®_lock, flags);
/* ADDR must be written twice */
writel(addr & 0xffff, dw_hdmi->hdmitx + HDMITX_TOP_ADDR_REG);
writel(addr & 0xffff, dw_hdmi->hdmitx + HDMITX_TOP_ADDR_REG);
/* Write needs single DATA write */
writel(data, dw_hdmi->hdmitx + HDMITX_TOP_DATA_REG);
spin_unlock_irqrestore(®_lock, flags);
}
static inline void dw_hdmi_g12a_top_write(struct meson_dw_hdmi *dw_hdmi,
unsigned int addr, unsigned int data)
{
writel(data, dw_hdmi->hdmitx + HDMITX_TOP_G12A_OFFSET + (addr << 2));
}
/* Helper to change specific bits in PHY registers */
static inline void dw_hdmi_top_write_bits(struct meson_dw_hdmi *dw_hdmi,
unsigned int addr,
unsigned int mask,
unsigned int val)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/component.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/of_graph.h`, `linux/platform_device.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct meson_dw_hdmi`, `struct meson_dw_hdmi_data`, `struct meson_dw_hdmi`, `enum meson_venc_source`, `function dw_hdmi_is_compatible`, `function dw_hdmi_top_read`, `function dw_hdmi_g12a_top_read`, `function dw_hdmi_top_write`, `function dw_hdmi_g12a_top_write`, `function dw_hdmi_top_write_bits`.
- 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.