drivers/gpu/drm/vc4/vc4_hdmi.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vc4/vc4_hdmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vc4/vc4_hdmi.c- Extension
.c- Size
- 100095 bytes
- Lines
- 3518
- 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_hdmi_audio_helper.hdrm/display/drm_hdmi_cec_helper.hdrm/display/drm_hdmi_helper.hdrm/display/drm_hdmi_state_helper.hdrm/display/drm_scdc_helper.hdrm/drm_atomic_helper.hdrm/drm_drv.hdrm/drm_edid.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_simple_kms_helper.hlinux/clk.hlinux/component.hlinux/gpio/consumer.hlinux/i2c.hlinux/of.hlinux/of_address.hlinux/pm_runtime.hlinux/rational.hlinux/reset.hsound/dmaengine_pcm.hsound/hdmi-codec.hsound/jack.hsound/pcm_drm_eld.hsound/pcm_params.hsound/soc.hmedia/cec.hvc4_drv.hvc4_hdmi.hvc4_hdmi_regs.hvc4_regs.h
Detected Declarations
function Copyrightfunction vc4_hdmi_mode_needs_scramblingfunction vc4_hdmi_debugfs_regsfunction vc4_hdmi_resetfunction vc5_hdmi_resetfunction vc4_hdmi_cec_update_clk_divfunction vc4_hdmi_cec_update_clk_divfunction vc4_hdmi_handle_hotplugfunction vc4_hdmi_connector_detect_ctxfunction vc4_hdmi_connector_get_modesfunction list_for_each_entryfunction vc4_hdmi_connector_atomic_checkfunction vc4_hdmi_connector_resetfunction vc4_hdmi_connector_initfunction vc4_hdmi_stop_packetfunction vc4_hdmi_clear_infoframefunction vc4_hdmi_write_infoframefunction vc4_hdmi_clear_avi_infoframefunction vc4_hdmi_clear_hdmi_infoframefunction vc4_hdmi_clear_audio_infoframefunction vc4_hdmi_clear_hdr_drm_infoframefunction vc4_hdmi_clear_spd_infoframefunction vc4_hdmi_write_avi_infoframefunction vc4_hdmi_write_hdmi_infoframefunction vc4_hdmi_write_audio_infoframefunction vc4_hdmi_write_hdr_drm_infoframefunction vc4_hdmi_write_spd_infoframefunction vc4_hdmi_enable_scramblingfunction vc4_hdmi_disable_scramblingfunction vc4_hdmi_scrambling_wqfunction vc4_hdmi_encoder_post_crtc_disablefunction vc4_hdmi_encoder_post_crtc_powerdownfunction vc4_hdmi_csc_setupfunction vc5_hdmi_set_csc_coeffsfunction vc5_hdmi_set_csc_coeffs_swapfunction u16function vc5_hdmi_csc_setupfunction vc4_hdmi_set_timingsfunction vc5_hdmi_set_timingsfunction vc4_hdmi_recenter_fifofunction vc4_hdmi_encoder_pre_crtc_configurefunction vc4_hdmi_encoder_pre_crtc_enablefunction vc4_hdmi_encoder_post_crtc_enablefunction vc4_hdmi_encoder_atomic_mode_setfunction vc4_hdmi_connector_clock_validfunction vc4_hdmi_encoder_atomic_checkfunction vc4_hdmi_encoder_mode_validfunction vc4_hdmi_late_register
Annotated Snippet
static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) {}
#endif
static int vc4_hdmi_reset_link(struct drm_connector *connector,
struct drm_modeset_acquire_ctx *ctx)
{
struct drm_device *drm;
struct vc4_hdmi *vc4_hdmi;
struct drm_connector_state *conn_state;
struct drm_crtc_state *crtc_state;
struct drm_crtc *crtc;
bool scrambling_needed;
u8 config;
int ret;
if (!connector)
return 0;
drm = connector->dev;
ret = drm_modeset_lock(&drm->mode_config.connection_mutex, ctx);
if (ret)
return ret;
conn_state = connector->state;
crtc = conn_state->crtc;
if (!crtc)
return 0;
ret = drm_modeset_lock(&crtc->mutex, ctx);
if (ret)
return ret;
crtc_state = crtc->state;
if (!crtc_state->active)
return 0;
vc4_hdmi = connector_to_vc4_hdmi(connector);
mutex_lock(&vc4_hdmi->mutex);
if (!vc4_hdmi_supports_scrambling(vc4_hdmi)) {
mutex_unlock(&vc4_hdmi->mutex);
return 0;
}
scrambling_needed = vc4_hdmi_mode_needs_scrambling(&vc4_hdmi->saved_adjusted_mode,
vc4_hdmi->output_bpc,
vc4_hdmi->output_format);
if (!scrambling_needed) {
mutex_unlock(&vc4_hdmi->mutex);
return 0;
}
if (conn_state->commit &&
!try_wait_for_completion(&conn_state->commit->hw_done)) {
mutex_unlock(&vc4_hdmi->mutex);
return 0;
}
ret = drm_scdc_readb(connector->ddc, SCDC_TMDS_CONFIG, &config);
if (ret < 0) {
drm_err(drm, "Failed to read TMDS config: %d\n", ret);
mutex_unlock(&vc4_hdmi->mutex);
return 0;
}
if (!!(config & SCDC_SCRAMBLING_ENABLE) == scrambling_needed) {
mutex_unlock(&vc4_hdmi->mutex);
return 0;
}
mutex_unlock(&vc4_hdmi->mutex);
/*
* HDMI 2.0 says that one should not send scrambled data
* prior to configuring the sink scrambling, and that
* TMDS clock/data transmission should be suspended when
* changing the TMDS clock rate in the sink. So let's
* just do a full modeset here, even though some sinks
* would be perfectly happy if were to just reconfigure
* the SCDC settings on the fly.
*/
return drm_atomic_helper_reset_crtc(crtc, ctx);
}
static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi,
struct drm_modeset_acquire_ctx *ctx,
enum drm_connector_status status)
{
struct drm_connector *connector = &vc4_hdmi->connector;
int ret;
Annotation
- Immediate include surface: `drm/display/drm_hdmi_audio_helper.h`, `drm/display/drm_hdmi_cec_helper.h`, `drm/display/drm_hdmi_helper.h`, `drm/display/drm_hdmi_state_helper.h`, `drm/display/drm_scdc_helper.h`, `drm/drm_atomic_helper.h`, `drm/drm_drv.h`, `drm/drm_edid.h`.
- Detected declarations: `function Copyright`, `function vc4_hdmi_mode_needs_scrambling`, `function vc4_hdmi_debugfs_regs`, `function vc4_hdmi_reset`, `function vc5_hdmi_reset`, `function vc4_hdmi_cec_update_clk_div`, `function vc4_hdmi_cec_update_clk_div`, `function vc4_hdmi_handle_hotplug`, `function vc4_hdmi_connector_detect_ctx`, `function vc4_hdmi_connector_get_modes`.
- 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.