drivers/gpu/drm/i915/display/intel_hotplug.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/intel_hotplug.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/intel_hotplug.c- Extension
.c- Size
- 40418 bytes
- Lines
- 1343
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/debugfs.hlinux/kernel.hdrm/drm_print.hdrm/drm_probe_helper.hintel_connector.hintel_display_core.hintel_display_power.hintel_display_rpm.hintel_display_types.hintel_display_utils.hintel_dp.hintel_hdcp.hintel_hotplug.hintel_hotplug_irq.hintel_parent.h
Detected Declarations
function intel_hpd_pin_defaultfunction intel_connector_hpd_pinfunction intel_hpd_irq_storm_detectfunction detection_work_enabledfunction mod_delayed_detection_workfunction queue_delayed_detection_workfunction queue_detection_workfunction intel_hpd_irq_storm_switch_to_pollingfunction intel_hpd_irq_storm_reenable_workfunction for_each_hpd_pinfunction intel_hotplug_detect_connectorfunction intel_encoder_hotplugfunction intel_encoder_has_hpd_pulsefunction hpd_pin_has_pulsefunction for_each_intel_encoderfunction hpd_pin_is_blockedfunction get_blocked_hpd_pin_maskfunction for_each_hpd_pinfunction i915_digport_work_funcfunction for_each_intel_encoderfunction intel_hpd_trigger_irqfunction i915_hotplug_work_funcfunction triggeredfunction encodersfunction intel_irq_init_hwfunction for_each_hpd_pinfunction i915_hpd_poll_detect_connectorsfunction i915_hpd_poll_init_workfunction i915_hpd_poll_init_workfunction intel_hpd_poll_enablefunction intel_hpd_poll_disablefunction intel_hpd_poll_finifunction intel_hpd_init_earlyfunction cancel_all_detection_workfunction intel_hpd_cancel_workfunction queue_work_for_missed_irqsfunction for_each_hpd_pinfunction block_hpd_pinfunction unblock_hpd_pinfunction intel_hpd_unblockfunction intel_hpd_blockfunction intel_hpd_blockfunction intel_hpd_enable_detection_workfunction intel_hpd_disable_detection_workfunction intel_hpd_schedule_detectionfunction i915_hpd_storm_ctl_showfunction i915_hpd_storm_ctl_writefunction i915_hpd_storm_ctl_open
Annotated Snippet
static const struct file_operations i915_hpd_storm_ctl_fops = {
.owner = THIS_MODULE,
.open = i915_hpd_storm_ctl_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = i915_hpd_storm_ctl_write
};
static int i915_hpd_short_storm_ctl_show(struct seq_file *m, void *data)
{
struct intel_display *display = m->private;
seq_printf(m, "Enabled: %s\n",
str_yes_no(display->hotplug.hpd_short_storm_enabled));
return 0;
}
static int
i915_hpd_short_storm_ctl_open(struct inode *inode, struct file *file)
{
return single_open(file, i915_hpd_short_storm_ctl_show,
inode->i_private);
}
static ssize_t i915_hpd_short_storm_ctl_write(struct file *file,
const char __user *ubuf,
size_t len, loff_t *offp)
{
struct seq_file *m = file->private_data;
struct intel_display *display = m->private;
struct intel_hotplug *hotplug = &display->hotplug;
char *newline;
char tmp[16];
int i;
bool new_state;
if (len >= sizeof(tmp))
return -EINVAL;
if (copy_from_user(tmp, ubuf, len))
return -EFAULT;
tmp[len] = '\0';
/* Strip newline, if any */
newline = strchr(tmp, '\n');
if (newline)
*newline = '\0';
/* Reset to the "default" state for this system */
if (strcmp(tmp, "reset") == 0)
new_state = !HAS_DP_MST(display);
else if (kstrtobool(tmp, &new_state) != 0)
return -EINVAL;
drm_dbg_kms(display->drm, "%sabling HPD short storm detection\n",
new_state ? "En" : "Dis");
spin_lock_irq(&display->irq.lock);
hotplug->hpd_short_storm_enabled = new_state;
/* Reset the HPD storm stats so we don't accidentally trigger a storm */
for_each_hpd_pin(i)
hotplug->stats[i].count = 0;
spin_unlock_irq(&display->irq.lock);
/* Re-enable hpd immediately if we were in an irq storm */
flush_delayed_work(&display->hotplug.reenable_work);
return len;
}
static const struct file_operations i915_hpd_short_storm_ctl_fops = {
.owner = THIS_MODULE,
.open = i915_hpd_short_storm_ctl_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
.write = i915_hpd_short_storm_ctl_write,
};
void intel_hpd_debugfs_register(struct intel_display *display)
{
struct dentry *debugfs_root = display->drm->debugfs_root;
debugfs_create_file("i915_hpd_storm_ctl", 0644, debugfs_root,
display, &i915_hpd_storm_ctl_fops);
debugfs_create_file("i915_hpd_short_storm_ctl", 0644, debugfs_root,
display, &i915_hpd_short_storm_ctl_fops);
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/kernel.h`, `drm/drm_print.h`, `drm/drm_probe_helper.h`, `intel_connector.h`, `intel_display_core.h`, `intel_display_power.h`, `intel_display_rpm.h`.
- Detected declarations: `function intel_hpd_pin_default`, `function intel_connector_hpd_pin`, `function intel_hpd_irq_storm_detect`, `function detection_work_enabled`, `function mod_delayed_detection_work`, `function queue_delayed_detection_work`, `function queue_detection_work`, `function intel_hpd_irq_storm_switch_to_polling`, `function intel_hpd_irq_storm_reenable_work`, `function for_each_hpd_pin`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.