drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c- Extension
.c- Size
- 67705 bytes
- Lines
- 2064
- 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.
- 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_helper.hdrm/drm_crtc_helper.hdrm/drm_edid.hdrm/drm_modeset_helper_vtables.hdrm/drm_probe_helper.hdrm/amdgpu_drm.hamdgpu.hatom.hatombios_encoders.hatombios_dp.hamdgpu_connectors.hamdgpu_i2c.hamdgpu_display.hlinux/pm_runtime.h
Detected Declarations
struct mode_sizefunction filesfunction amdgpu_connector_property_change_modefunction amdgpu_connector_get_monitor_bpcfunction amdgpu_connector_update_scratch_regsfunction drm_connector_for_each_possible_encoderfunction amdgpu_connector_find_encoderfunction drm_connector_for_each_possible_encoderfunction amdgpu_connector_get_hardcoded_edidfunction amdgpu_connector_get_edidfunction amdgpu_connector_ddc_get_modesfunction amdgpu_connector_best_single_encoderfunction amdgpu_get_native_modefunction amdgpu_connector_lcd_native_modefunction amdgpu_connector_add_common_modesfunction amdgpu_connector_set_propertyfunction amdgpu_connector_fixup_lcd_native_modefunction list_for_each_entry_safefunction amdgpu_connector_lvds_get_modesfunction amdgpu_connector_lvds_mode_validfunction amdgpu_connector_lvds_detectfunction amdgpu_connector_unregisterfunction amdgpu_connector_destroyfunction amdgpu_connector_set_lcd_propertyfunction amdgpu_connector_vga_get_modesfunction amdgpu_connector_vga_mode_validfunction amdgpu_connector_vga_detectfunction linefunction amdgpu_connector_check_hpd_status_unchangedfunction amdgpu_connector_shared_ddcfunction drm_for_each_connector_iterfunction elsefunction linefunction drm_connector_for_each_possible_encoderfunction amdgpu_connector_dvi_encoderfunction drm_connector_for_each_possible_encoderfunction amdgpu_connector_dvi_forcefunction amdgpu_max_hdmi_pixel_clockfunction amdgpu_connector_dvi_mode_validfunction amdgpu_connector_dp_get_modesfunction amdgpu_connector_encoder_get_dp_bridge_encoder_idfunction drm_connector_for_each_possible_encoderfunction amdgpu_connector_encoder_is_hbr2function drm_connector_for_each_possible_encoderfunction amdgpu_connector_is_dp12_capablefunction amdgpu_connector_dp_detectfunction amdgpu_connector_dp_mode_validfunction amdgpu_connector_late_register
Annotated Snippet
struct mode_size {
char name[DRM_DISPLAY_MODE_LEN];
int w;
int h;
} common_modes[] = {
{ "640x480", 640, 480},
{ "800x600", 800, 600},
{ "1024x768", 1024, 768},
{ "1280x720", 1280, 720},
{ "1280x800", 1280, 800},
{"1280x1024", 1280, 1024},
{ "1440x900", 1440, 900},
{"1680x1050", 1680, 1050},
{"1600x1200", 1600, 1200},
{"1920x1080", 1920, 1080},
{"1920x1200", 1920, 1200}
};
n = ARRAY_SIZE(common_modes);
for (i = 0; i < n; i++) {
if (amdgpu_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) {
if (common_modes[i].w > 1024 ||
common_modes[i].h > 768)
continue;
}
if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
if (common_modes[i].w > native_mode->hdisplay ||
common_modes[i].h > native_mode->vdisplay ||
(common_modes[i].w == native_mode->hdisplay &&
common_modes[i].h == native_mode->vdisplay))
continue;
}
mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h, 60, false, false, false);
if (!mode)
return;
strscpy(mode->name, common_modes[i].name, DRM_DISPLAY_MODE_LEN);
drm_mode_probed_add(connector, mode);
}
}
static int amdgpu_connector_set_property(struct drm_connector *connector,
struct drm_property *property,
uint64_t val)
{
struct drm_device *dev = connector->dev;
struct amdgpu_device *adev = drm_to_adev(dev);
struct drm_encoder *encoder;
struct amdgpu_encoder *amdgpu_encoder;
if (property == adev->mode_info.coherent_mode_property) {
struct amdgpu_encoder_atom_dig *dig;
bool new_coherent_mode;
/* need to find digital encoder on connector */
encoder = amdgpu_connector_find_encoder(connector, DRM_MODE_ENCODER_TMDS);
if (!encoder)
return 0;
amdgpu_encoder = to_amdgpu_encoder(encoder);
if (!amdgpu_encoder->enc_priv)
return 0;
dig = amdgpu_encoder->enc_priv;
new_coherent_mode = val ? true : false;
if (dig->coherent_mode != new_coherent_mode) {
dig->coherent_mode = new_coherent_mode;
amdgpu_connector_property_change_mode(&amdgpu_encoder->base);
}
}
if (property == adev->mode_info.audio_property) {
struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
/* need to find digital encoder on connector */
encoder = amdgpu_connector_find_encoder(connector, DRM_MODE_ENCODER_TMDS);
if (!encoder)
return 0;
amdgpu_encoder = to_amdgpu_encoder(encoder);
if (amdgpu_connector->audio != val) {
amdgpu_connector->audio = val;
amdgpu_connector_property_change_mode(&amdgpu_encoder->base);
}
}
if (property == adev->mode_info.dither_property) {
Annotation
- Immediate include surface: `drm/display/drm_dp_helper.h`, `drm/drm_crtc_helper.h`, `drm/drm_edid.h`, `drm/drm_modeset_helper_vtables.h`, `drm/drm_probe_helper.h`, `drm/amdgpu_drm.h`, `amdgpu.h`, `atom.h`.
- Detected declarations: `struct mode_size`, `function files`, `function amdgpu_connector_property_change_mode`, `function amdgpu_connector_get_monitor_bpc`, `function amdgpu_connector_update_scratch_regs`, `function drm_connector_for_each_possible_encoder`, `function amdgpu_connector_find_encoder`, `function drm_connector_for_each_possible_encoder`, `function amdgpu_connector_get_hardcoded_edid`, `function amdgpu_connector_get_edid`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.