drm/i915/dp: Add support for out-of-bound hotplug events
authorHans de Goede <hdegoede@redhat.com>
Tue, 17 Aug 2021 21:51:59 +0000 (23:51 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 9 Sep 2021 10:59:07 +0000 (12:59 +0200)
On some Cherry Trail devices, DisplayPort over Type-C is supported through
a USB-PD microcontroller (e.g. a fusb302) + a mux to switch the superspeed
datalines between USB-3 and DP (e.g. a pi3usb30532). The kernel in this
case does the PD/alt-mode negotiation itself, rather then everything being
handled in firmware.

So the kernel itself picks an alt-mode, tells the Type-C "dongle" to switch
to DP mode and sets the mux accordingly. In this setup the HPD pin is not
connected, so the i915 driver needs to respond to a software event and scan
the DP port for changes manually.

This commit adds support for this. Together with the recent addition of
DP alt-mode support to the Type-C subsystem this makes DP over Type-C
work on these devices.

Tested-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210817215201.795062-7-hdegoede@redhat.com
drivers/gpu/drm/i915/display/intel_dp.c

index d28bd8c..161c33b 100644 (file)
@@ -4651,6 +4651,17 @@ static int intel_dp_connector_atomic_check(struct drm_connector *conn,
        return intel_modeset_synced_crtcs(state, conn);
 }
 
+static void intel_dp_oob_hotplug_event(struct drm_connector *connector)
+{
+       struct intel_encoder *encoder = intel_attached_encoder(to_intel_connector(connector));
+       struct drm_i915_private *i915 = to_i915(connector->dev);
+
+       spin_lock_irq(&i915->irq_lock);
+       i915->hotplug.event_bits |= BIT(encoder->hpd_pin);
+       spin_unlock_irq(&i915->irq_lock);
+       queue_delayed_work(system_wq, &i915->hotplug.hotplug_work, 0);
+}
+
 static const struct drm_connector_funcs intel_dp_connector_funcs = {
        .force = intel_dp_force,
        .fill_modes = drm_helper_probe_single_connector_modes,
@@ -4661,6 +4672,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = {
        .destroy = intel_connector_destroy,
        .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
        .atomic_duplicate_state = intel_digital_connector_duplicate_state,
+       .oob_hotplug_event = intel_dp_oob_hotplug_event,
 };
 
 static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = {