drivers/gpu/drm/meson/meson_encoder_hdmi.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/meson/meson_encoder_hdmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/meson/meson_encoder_hdmi.c- Extension
.c- Size
- 14900 bytes
- Lines
- 495
- 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.
- 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/of_platform.hlinux/platform_device.hlinux/regulator/consumer.hlinux/reset.hmedia/cec-notifier.hdrm/drm_atomic_helper.hdrm/drm_bridge.hdrm/drm_bridge_connector.hdrm/drm_device.hdrm/drm_edid.hdrm/drm_probe_helper.hdrm/drm_simple_kms_helper.hlinux/media-bus-format.hlinux/videodev2.hmeson_drv.hmeson_registers.hmeson_vclk.hmeson_venc.hmeson_encoder_hdmi.h
Detected Declarations
struct meson_encoder_hdmifunction meson_encoder_hdmi_attachfunction meson_encoder_hdmi_detachfunction meson_encoder_hdmi_set_vclkfunction meson_encoder_hdmi_mode_validfunction meson_encoder_hdmi_atomic_enablefunction meson_encoder_hdmi_atomic_disablefunction meson_encoder_hdmi_get_inp_bus_fmtsfunction meson_encoder_hdmi_atomic_checkfunction meson_encoder_hdmi_hpd_notifyfunction meson_encoder_hdmi_probefunction meson_encoder_hdmi_remove
Annotated Snippet
struct meson_encoder_hdmi {
struct drm_encoder encoder;
struct drm_bridge bridge;
struct drm_connector *connector;
struct meson_drm *priv;
unsigned long output_bus_fmt;
struct cec_notifier *cec_notifier;
};
#define bridge_to_meson_encoder_hdmi(x) \
container_of(x, struct meson_encoder_hdmi, bridge)
static int meson_encoder_hdmi_attach(struct drm_bridge *bridge,
struct drm_encoder *encoder,
enum drm_bridge_attach_flags flags)
{
struct meson_encoder_hdmi *encoder_hdmi = bridge_to_meson_encoder_hdmi(bridge);
return drm_bridge_attach(encoder, encoder_hdmi->bridge.next_bridge,
&encoder_hdmi->bridge, flags);
}
static void meson_encoder_hdmi_detach(struct drm_bridge *bridge)
{
struct meson_encoder_hdmi *encoder_hdmi = bridge_to_meson_encoder_hdmi(bridge);
cec_notifier_conn_unregister(encoder_hdmi->cec_notifier);
encoder_hdmi->cec_notifier = NULL;
}
static void meson_encoder_hdmi_set_vclk(struct meson_encoder_hdmi *encoder_hdmi,
const struct drm_display_mode *mode)
{
struct meson_drm *priv = encoder_hdmi->priv;
int vic = drm_match_cea_mode(mode);
unsigned long long phy_freq;
unsigned long long vclk_freq;
unsigned long long venc_freq;
unsigned long long hdmi_freq;
vclk_freq = mode->clock * 1000ULL;
/* For 420, pixel clock is half unlike venc clock */
if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24)
vclk_freq /= 2;
/* TMDS clock is pixel_clock * 10 */
phy_freq = vclk_freq * 10;
if (!vic) {
meson_vclk_setup(priv, MESON_VCLK_TARGET_DMT, phy_freq,
vclk_freq, vclk_freq, vclk_freq, false);
return;
}
/* 480i/576i needs global pixel doubling */
if (mode->flags & DRM_MODE_FLAG_DBLCLK)
vclk_freq *= 2;
venc_freq = vclk_freq;
hdmi_freq = vclk_freq;
/* VENC double pixels for 1080i, 720p and YUV420 modes */
if (meson_venc_hdmi_venc_repeat(vic) ||
encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24)
venc_freq *= 2;
vclk_freq = max(venc_freq, hdmi_freq);
if (mode->flags & DRM_MODE_FLAG_DBLCLK)
venc_freq /= 2;
dev_dbg(priv->dev,
"phy:%lluHz vclk=%lluHz venc=%lluHz hdmi=%lluHz enci=%d\n",
phy_freq, vclk_freq, venc_freq, hdmi_freq,
priv->venc.hdmi_use_enci);
meson_vclk_setup(priv, MESON_VCLK_TARGET_HDMI, phy_freq, vclk_freq,
venc_freq, hdmi_freq, priv->venc.hdmi_use_enci);
}
static enum drm_mode_status meson_encoder_hdmi_mode_valid(struct drm_bridge *bridge,
const struct drm_display_info *display_info,
const struct drm_display_mode *mode)
{
struct meson_encoder_hdmi *encoder_hdmi = bridge_to_meson_encoder_hdmi(bridge);
struct meson_drm *priv = encoder_hdmi->priv;
bool is_hdmi2_sink = display_info->hdmi.scdc.supported;
unsigned long long clock = mode->clock * 1000ULL;
unsigned long long phy_freq;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/component.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/of_graph.h`, `linux/of_platform.h`, `linux/platform_device.h`.
- Detected declarations: `struct meson_encoder_hdmi`, `function meson_encoder_hdmi_attach`, `function meson_encoder_hdmi_detach`, `function meson_encoder_hdmi_set_vclk`, `function meson_encoder_hdmi_mode_valid`, `function meson_encoder_hdmi_atomic_enable`, `function meson_encoder_hdmi_atomic_disable`, `function meson_encoder_hdmi_get_inp_bus_fmts`, `function meson_encoder_hdmi_atomic_check`, `function meson_encoder_hdmi_hpd_notify`.
- 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.
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.