drivers/gpu/drm/rockchip/rk3066_hdmi.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/rockchip/rk3066_hdmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/rockchip/rk3066_hdmi.c- Extension
.c- Size
- 23663 bytes
- Lines
- 854
- 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/drm_atomic.hdrm/drm_bridge_connector.hdrm/display/drm_hdmi_helper.hdrm/display/drm_hdmi_state_helper.hdrm/drm_edid.hdrm/drm_of.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_simple_kms_helper.hlinux/clk.hlinux/mfd/syscon.hlinux/platform_device.hlinux/regmap.hrk3066_hdmi.hrockchip_drm_drv.h
Detected Declarations
struct hdmi_data_infostruct rk3066_hdmi_i2cstruct rk3066_hdmifunction hdmi_readbfunction hdmi_writebfunction hdmi_modbfunction rk3066_hdmi_i2c_initfunction rk3066_hdmi_get_power_modefunction rk3066_hdmi_set_power_modefunction rk3066_hdmi_bridge_clear_avi_infoframefunction rk3066_hdmi_bridge_clear_hdmi_infoframefunction rk3066_hdmi_bridge_write_avi_infoframefunction rk3066_hdmi_bridge_write_hdmi_infoframefunction rk3066_hdmi_config_video_timingfunction rk3066_hdmi_phy_writefunction rk3066_hdmi_config_phyfunction rk3066_hdmi_phy_writefunction rk3066_hdmi_setupfunction rk3066_hdmi_bridge_atomic_enablefunction rk3066_hdmi_bridge_atomic_disablefunction rk3066_hdmi_encoder_atomic_checkfunction rk3066_hdmi_bridge_detectfunction rk3066_hdmi_bridge_edid_readfunction rk3066_hdmi_bridge_mode_validfunction rk3066_hdmi_hardirqfunction rk3066_hdmi_irqfunction rk3066_hdmi_i2c_readfunction rk3066_hdmi_i2c_writefunction rk3066_hdmi_i2c_xferfunction rk3066_hdmi_i2c_funcfunction rk3066_hdmi_registerfunction rk3066_hdmi_bindfunction rk3066_hdmi_unbindfunction rk3066_hdmi_probefunction rk3066_hdmi_remove
Annotated Snippet
struct hdmi_data_info {
int vic; /* The CEA Video ID (VIC) of the current drm display mode. */
unsigned int enc_out_format;
unsigned int colorimetry;
};
struct rk3066_hdmi_i2c {
struct i2c_adapter adap;
u8 ddc_addr;
u8 segment_addr;
u8 stat;
struct mutex i2c_lock; /* For i2c operation. */
struct completion cmpltn;
};
struct rk3066_hdmi {
struct device *dev;
struct drm_device *drm_dev;
struct regmap *grf_regmap;
int irq;
struct clk *hclk;
void __iomem *regs;
struct drm_bridge bridge;
struct drm_connector *connector;
struct rockchip_encoder encoder;
struct rk3066_hdmi_i2c *i2c;
unsigned int tmdsclk;
struct hdmi_data_info hdmi_data;
};
static struct rk3066_hdmi *bridge_to_rk3066_hdmi(struct drm_bridge *bridge)
{
return container_of(bridge, struct rk3066_hdmi, bridge);
}
static inline u8 hdmi_readb(struct rk3066_hdmi *hdmi, u16 offset)
{
return readl_relaxed(hdmi->regs + offset);
}
static inline void hdmi_writeb(struct rk3066_hdmi *hdmi, u16 offset, u32 val)
{
writel_relaxed(val, hdmi->regs + offset);
}
static inline void hdmi_modb(struct rk3066_hdmi *hdmi, u16 offset,
u32 msk, u32 val)
{
u8 temp = hdmi_readb(hdmi, offset) & ~msk;
temp |= val & msk;
hdmi_writeb(hdmi, offset, temp);
}
static void rk3066_hdmi_i2c_init(struct rk3066_hdmi *hdmi)
{
int ddc_bus_freq;
ddc_bus_freq = (hdmi->tmdsclk >> 2) / HDMI_SCL_RATE;
hdmi_writeb(hdmi, HDMI_DDC_BUS_FREQ_L, ddc_bus_freq & 0xFF);
hdmi_writeb(hdmi, HDMI_DDC_BUS_FREQ_H, (ddc_bus_freq >> 8) & 0xFF);
/* Clear the EDID interrupt flag and mute the interrupt. */
hdmi_modb(hdmi, HDMI_INTR_MASK1, HDMI_INTR_EDID_MASK, 0);
hdmi_writeb(hdmi, HDMI_INTR_STATUS1, HDMI_INTR_EDID_MASK);
}
static inline u8 rk3066_hdmi_get_power_mode(struct rk3066_hdmi *hdmi)
{
return hdmi_readb(hdmi, HDMI_SYS_CTRL) & HDMI_SYS_POWER_MODE_MASK;
}
static void rk3066_hdmi_set_power_mode(struct rk3066_hdmi *hdmi, int mode)
{
u8 current_mode, next_mode;
u8 i = 0;
current_mode = rk3066_hdmi_get_power_mode(hdmi);
DRM_DEV_DEBUG(hdmi->dev, "mode :%d\n", mode);
DRM_DEV_DEBUG(hdmi->dev, "current_mode :%d\n", current_mode);
if (current_mode == mode)
Annotation
- Immediate include surface: `drm/drm_atomic.h`, `drm/drm_bridge_connector.h`, `drm/display/drm_hdmi_helper.h`, `drm/display/drm_hdmi_state_helper.h`, `drm/drm_edid.h`, `drm/drm_of.h`, `drm/drm_print.h`, `drm/drm_probe_helper.h`.
- Detected declarations: `struct hdmi_data_info`, `struct rk3066_hdmi_i2c`, `struct rk3066_hdmi`, `function hdmi_readb`, `function hdmi_writeb`, `function hdmi_modb`, `function rk3066_hdmi_i2c_init`, `function rk3066_hdmi_get_power_mode`, `function rk3066_hdmi_set_power_mode`, `function rk3066_hdmi_bridge_clear_avi_infoframe`.
- 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.