drivers/gpu/drm/drm_probe_helper.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_probe_helper.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_probe_helper.c- Extension
.c- Size
- 41442 bytes
- Lines
- 1333
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/export.hlinux/moduleparam.hdrm/drm_bridge.hdrm/drm_client_event.hdrm/drm_crtc.hdrm/drm_edid.hdrm/drm_fourcc.hdrm/drm_managed.hdrm/drm_modeset_helper_vtables.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_sysfs.hdrm_crtc_helper_internal.h
Detected Declarations
function drm_mode_validate_flagfunction drm_mode_validate_pipelinefunction drm_for_each_crtcfunction drm_helper_probe_add_cmdline_modefunction drm_crtc_mode_validfunction drm_encoder_mode_validfunction drm_connector_mode_validfunction drm_kms_helper_disable_hpdfunction drm_kms_helper_enable_hpdfunction reschedule_output_poll_workfunction drm_kms_helper_poll_disablefunction drm_kms_helper_poll_initfunction detect_connector_statusfunction drm_helper_probe_detect_ctxfunction drm_helper_probe_detectfunction drm_helper_probe_get_modesfunction __drm_helper_update_and_validatefunction list_for_each_entryfunction drm_mode_probed_addfunction list_for_each_entryfunction drm_kms_helper_connector_hotplug_eventfunction drm_kms_helper_hotplug_eventfunction output_poll_executefunction testsfunction drm_kms_helper_poll_disablefunction drm_kms_helper_poll_disablefunction drm_kms_helper_poll_initfunction drm_kms_helper_poll_finifunction drm_kms_helper_poll_init_releasefunction drm_kms_helper_poll_initfunction check_connector_changedfunction drm_helper_hpd_irq_eventfunction drm_connector_helper_hpd_irq_eventfunction drm_crtc_helper_mode_valid_fixedfunction drm_connector_helper_get_modes_fixedfunction drm_edid_readfunction drm_connector_helper_tv_get_modesfunction drm_probe_ddcexport drm_kms_helper_poll_enableexport drm_kms_helper_poll_rescheduleexport drm_helper_probe_detectexport drm_helper_probe_single_connector_modesexport drm_kms_helper_hotplug_eventexport drm_kms_helper_connector_hotplug_eventexport drm_kms_helper_is_poll_workerexport drm_kms_helper_poll_disableexport drm_kms_helper_poll_initexport drm_kms_helper_poll_fini
Annotated Snippet
if (*status != MODE_OK) {
/* No point in continuing for crtc check as this encoder
* will not accept the mode anyway. If all encoders
* reject the mode then, at exit, ret will not be
* MODE_OK. */
continue;
}
bridge = drm_bridge_chain_get_first_bridge(encoder);
*status = drm_bridge_chain_mode_valid(bridge,
&connector->display_info,
mode);
drm_bridge_put(bridge);
if (*status != MODE_OK) {
/* There is also no point in continuing for crtc check
* here. */
continue;
}
drm_for_each_crtc(crtc, dev) {
if (!drm_encoder_crtc_ok(encoder, crtc))
continue;
*status = drm_crtc_mode_valid(crtc, mode);
if (*status == MODE_OK) {
/* If we get to this point there is at least
* one combination of encoder+crtc that works
* for this mode. Lets return now. */
return 0;
}
}
}
return 0;
}
static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector)
{
struct drm_cmdline_mode *cmdline_mode;
struct drm_display_mode *mode;
cmdline_mode = &connector->cmdline_mode;
if (!cmdline_mode->specified)
return 0;
/* Only add a GTF mode if we find no matching probed modes */
list_for_each_entry(mode, &connector->probed_modes, head) {
if (mode->hdisplay != cmdline_mode->xres ||
mode->vdisplay != cmdline_mode->yres)
continue;
if (cmdline_mode->refresh_specified) {
/* The probed mode's vrefresh is set until later */
if (drm_mode_vrefresh(mode) != cmdline_mode->refresh)
continue;
}
/* Mark the matching mode as being preferred by the user */
mode->type |= DRM_MODE_TYPE_USERDEF;
return 0;
}
mode = drm_mode_create_from_cmdline_mode(connector->dev,
cmdline_mode);
if (mode == NULL)
return 0;
drm_mode_probed_add(connector, mode);
return 1;
}
enum drm_mode_status drm_crtc_mode_valid(struct drm_crtc *crtc,
const struct drm_display_mode *mode)
{
const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
if (!crtc_funcs || !crtc_funcs->mode_valid)
return MODE_OK;
return crtc_funcs->mode_valid(crtc, mode);
}
enum drm_mode_status drm_encoder_mode_valid(struct drm_encoder *encoder,
const struct drm_display_mode *mode)
{
const struct drm_encoder_helper_funcs *encoder_funcs =
encoder->helper_private;
if (!encoder_funcs || !encoder_funcs->mode_valid)
return MODE_OK;
Annotation
- Immediate include surface: `linux/export.h`, `linux/moduleparam.h`, `drm/drm_bridge.h`, `drm/drm_client_event.h`, `drm/drm_crtc.h`, `drm/drm_edid.h`, `drm/drm_fourcc.h`, `drm/drm_managed.h`.
- Detected declarations: `function drm_mode_validate_flag`, `function drm_mode_validate_pipeline`, `function drm_for_each_crtc`, `function drm_helper_probe_add_cmdline_mode`, `function drm_crtc_mode_valid`, `function drm_encoder_mode_valid`, `function drm_connector_mode_valid`, `function drm_kms_helper_disable_hpd`, `function drm_kms_helper_enable_hpd`, `function reschedule_output_poll_work`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration 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.