From patchwork Mon Feb 25 13:20:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10828559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 58B171805 for ; Mon, 25 Feb 2019 13:20:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 472452B615 for ; Mon, 25 Feb 2019 13:20:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 452C82B65B; Mon, 25 Feb 2019 13:20:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 964762B615 for ; Mon, 25 Feb 2019 13:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727136AbfBYNUr (ORCPT ); Mon, 25 Feb 2019 08:20:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45564 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726921AbfBYNUq (ORCPT ); Mon, 25 Feb 2019 08:20:46 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15A123097027; Mon, 25 Feb 2019 13:20:46 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-117-17.ams2.redhat.com [10.36.117.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2915660857; Mon, 25 Feb 2019 13:20:42 +0000 (UTC) From: Hans de Goede To: Maarten Lankhorst , Maxime Ripard , Sean Paul , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Greg Kroah-Hartman , Heikki Krogerus Cc: Hans de Goede , David Airlie , intel-gfx , dri-devel@lists.freedesktop.org, linux-usb@vger.kernel.org Subject: [PATCH 1/3] drm: Add support for out-of-band hotplug notification Date: Mon, 25 Feb 2019 14:20:35 +0100 Message-Id: <20190225132037.31458-2-hdegoede@redhat.com> In-Reply-To: <20190225132037.31458-1-hdegoede@redhat.com> References: <20190225132037.31458-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 25 Feb 2019 13:20:46 +0000 (UTC) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On some hardware a hotplug event notification may come from outside the display driver / device. One example of this is laptops with hybrid graphics where one or more outputs are connected to the discrete GPU only. In this case if the discrete GPU is fully powered down to save power, a hotplug to one of these outputs will not be noticed through normal means. These laptops have another mechanism to detect the hotplug which will typically raise an event on the ACPI video bus. Another example of this is some USB Type-C setups where the hardware muxes the DisplayPort data and aux-lines but does not pass the altmode HPD status bit to the GPUs DP HPD pin. This commit adds a loose coupling to the drm subsys allowing event-sources to notify drm-drivers of such events without needing a reference to a drm-device or a drm-connector. This loose coupling is implemented through a blocking notifier. drm-drivers interested in oob hotplug events can register themselves to receive notifations and event-sources call drm_kms_call_oob_hotplug_notifier_chain to let any listeners know about events. An earlier attempt has been done to implement this functionality with a tight coupling, where the event-source would somehow figure out the right drm-connector to deliver the event to and then send it directly to that drm-connector. Such a tight coupling approach has several issues with lifetime management of the coupled objects as well as introducing several probe-ordering issues. Therefor the tight coupling approach has been abandoned. Note for now drm_kms_call_oob_hotplug_notifier_chain's event parameter can only have 1 value: DRM_OOB_HOTPLUG_TYPE_C_DP. The ACPI videobus hotplug event case is currently already supported in the nouveau driver by registering a generic acpi event notifier. Signed-off-by: Hans de Goede --- Documentation/gpu/drm-kms-helpers.rst | 1 + drivers/gpu/drm/drm_probe_helper.c | 67 +++++++++++++++++++++++++++ include/drm/drm_probe_helper.h | 12 +++++ 3 files changed, 80 insertions(+) diff --git a/Documentation/gpu/drm-kms-helpers.rst b/Documentation/gpu/drm-kms-helpers.rst index b422eb8edf16..f144d68f8e7a 100644 --- a/Documentation/gpu/drm-kms-helpers.rst +++ b/Documentation/gpu/drm-kms-helpers.rst @@ -249,6 +249,7 @@ Output Probing Helper Functions Reference .. kernel-doc:: drivers/gpu/drm/drm_probe_helper.c :doc: output probing helper overview + :doc: out-of-band hotplug event helper overview .. kernel-doc:: drivers/gpu/drm/drm_probe_helper.c :export: diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 6fd08e04b323..4f0b421514ef 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -792,3 +793,69 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) return changed; } EXPORT_SYMBOL(drm_helper_hpd_irq_event); + +/** + * DOC: out-of-band hotplug event helper overview + * + * On some hardware a hotplug event notification may come from outside + * the display driver / device. + * + * One example of this is laptops with hybrid graphics where one or more + * outputs are connected to the discrete GPU only. In this case if the discrete + * GPU is fully powered down to save power, a hotplug to one of these outputs + * will not be noticed through normal means. These laptops have another + * mechanism to detect the hotplug which will typically raise an event on the + * ACPI video bus. + * + * Another example of this is some USB Type-C setups where the hardware + * muxes the DisplayPort data and aux-lines but does not pass the altmode + * HPD status bit to the GPUs DP HPD pin. + * + * The oob hotplug helper functions allow a drm display driver to listen + * for such oob events and allow other subsystems to notify listeners of + * these events. + */ + +static BLOCKING_NOTIFIER_HEAD(drm_kms_oob_hotplug_notifier_head); + +/** + * drm_kms_register_oob_hotplug_notifier - register an oob hotplug notifier + * @nb: notifier_block to register + * + * Drivers can use this helper function to register a notifier for + * out-of-band hotplug events. + */ +int drm_kms_register_oob_hotplug_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_register( + &drm_kms_oob_hotplug_notifier_head, nb); +} +EXPORT_SYMBOL(drm_kms_register_oob_hotplug_notifier); + +/** + * drm_kms_unregister_oob_hotplug_notifier - unregister an oob hotplug notifier + * @nb: notifier_block to register + * + * Drivers can use this helper function to unregister a notifier for + * out-of-band hotplug events. + */ +int drm_kms_unregister_oob_hotplug_notifier(struct notifier_block *nb) +{ + return blocking_notifier_chain_unregister( + &drm_kms_oob_hotplug_notifier_head, nb); +} +EXPORT_SYMBOL(drm_kms_unregister_oob_hotplug_notifier); + +/** + * drm_kms_call_oob_hotplug_notifier_chain - notify about an oob hotplug event + * @event: enum drm_kms_oob_hotplug_event value describing the event + * + * Out-of-band hotplug event sources can call this helper function to notify + * kms-drivers about an oob hotplug event. + */ +int drm_kms_call_oob_hotplug_notifier_chain(unsigned long event) +{ + return blocking_notifier_call_chain( + &drm_kms_oob_hotplug_notifier_head, event, NULL); +} +EXPORT_SYMBOL(drm_kms_call_oob_hotplug_notifier_chain); diff --git a/include/drm/drm_probe_helper.h b/include/drm/drm_probe_helper.h index 8d3ed2834d34..68cfce47d35f 100644 --- a/include/drm/drm_probe_helper.h +++ b/include/drm/drm_probe_helper.h @@ -24,4 +24,16 @@ void drm_kms_helper_poll_disable(struct drm_device *dev); void drm_kms_helper_poll_enable(struct drm_device *dev); bool drm_kms_helper_is_poll_worker(void); +/** + * enum drm_kms_oob_hotplug_event - out-of-band hotplug events + * @DRM_OOB_HOTPLUG_TYPE_C_DP: DisplayPort over Type-C hotplug event + */ +enum drm_kms_oob_hotplug_event { + DRM_OOB_HOTPLUG_TYPE_C_DP = 0, +}; + +int drm_kms_register_oob_hotplug_notifier(struct notifier_block *nb); +int drm_kms_unregister_oob_hotplug_notifier(struct notifier_block *nb); +int drm_kms_call_oob_hotplug_notifier_chain(unsigned long event); + #endif From patchwork Mon Feb 25 13:20:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10828565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCAC11399 for ; Mon, 25 Feb 2019 13:20:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCC732B614 for ; Mon, 25 Feb 2019 13:20:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B13B12B615; Mon, 25 Feb 2019 13:20:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 440DE2B61E for ; Mon, 25 Feb 2019 13:20:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727146AbfBYNUu (ORCPT ); Mon, 25 Feb 2019 08:20:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56592 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726921AbfBYNUu (ORCPT ); Mon, 25 Feb 2019 08:20:50 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F2896C04BD51; Mon, 25 Feb 2019 13:20:49 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-117-17.ams2.redhat.com [10.36.117.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AE8860863; Mon, 25 Feb 2019 13:20:46 +0000 (UTC) From: Hans de Goede To: Maarten Lankhorst , Maxime Ripard , Sean Paul , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Greg Kroah-Hartman , Heikki Krogerus Cc: Hans de Goede , David Airlie , intel-gfx , dri-devel@lists.freedesktop.org, linux-usb@vger.kernel.org Subject: [PATCH 2/3] i915: Add support for out-of-bound hotplug events Date: Mon, 25 Feb 2019 14:20:36 +0100 Message-Id: <20190225132037.31458-3-hdegoede@redhat.com> In-Reply-To: <20190225132037.31458-1-hdegoede@redhat.com> References: <20190225132037.31458-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 25 Feb 2019 13:20:50 +0000 (UTC) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Hans de Goede --- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_irq.c | 2 ++ drivers/gpu/drm/i915/intel_hotplug.c | 38 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b1c31967194b..5d8c585ddbf7 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -153,6 +153,7 @@ enum hpd_pin { struct i915_hotplug { struct work_struct hotplug_work; + struct notifier_block oob_notifier; struct { unsigned long last_jiffies; @@ -2632,6 +2633,7 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, u32 pin_mask, u32 long_mask); void intel_hpd_init(struct drm_i915_private *dev_priv); void intel_hpd_init_work(struct drm_i915_private *dev_priv); +void intel_hpd_fini_work(struct drm_i915_private *dev_priv); void intel_hpd_cancel_work(struct drm_i915_private *dev_priv); enum hpd_pin intel_hpd_pin_default(struct drm_i915_private *dev_priv, enum port port); diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 8211045a981b..14f3323b721b 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -4965,6 +4965,8 @@ void intel_irq_fini(struct drm_i915_private *i915) for (i = 0; i < MAX_L3_SLICES; ++i) kfree(i915->l3_parity.remap_info[i]); + + intel_hpd_fini_work(i915); } /** diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c index e24174d08fed..221878fa26af 100644 --- a/drivers/gpu/drm/i915/intel_hotplug.c +++ b/drivers/gpu/drm/i915/intel_hotplug.c @@ -518,6 +518,36 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, schedule_work(&dev_priv->hotplug.hotplug_work); } +static int intel_hpd_oob_notifier(struct notifier_block *nb, + unsigned long event, void *data) +{ + struct drm_i915_private *dev_priv = + container_of(nb, struct drm_i915_private, hotplug.oob_notifier); + struct intel_encoder *encoder; + u32 bits = 0; + + /* We only support DP over Type-C notifications */ + if (event != DRM_OOB_HOTPLUG_TYPE_C_DP) + return NOTIFY_DONE; + + /* Schedule a hotplug check for each DP encoder, except for EDP ones */ + for_each_intel_dp(&dev_priv->drm, encoder) { + if (encoder->type == INTEL_OUTPUT_EDP) + continue; + + bits |= BIT(encoder->hpd_pin); + } + + if (bits) { + spin_lock_irq(&dev_priv->irq_lock); + dev_priv->hotplug.event_bits |= bits; + spin_unlock_irq(&dev_priv->irq_lock); + schedule_work(&dev_priv->hotplug.hotplug_work); + } + + return NOTIFY_DONE; +} + /** * intel_hpd_init - initializes and enables hpd support * @dev_priv: i915 device instance @@ -640,6 +670,14 @@ void intel_hpd_init_work(struct drm_i915_private *dev_priv) INIT_WORK(&dev_priv->hotplug.poll_init_work, i915_hpd_poll_init_work); INIT_DELAYED_WORK(&dev_priv->hotplug.reenable_work, intel_hpd_irq_storm_reenable_work); + dev_priv->hotplug.oob_notifier.notifier_call = intel_hpd_oob_notifier; + drm_kms_register_oob_hotplug_notifier(&dev_priv->hotplug.oob_notifier); +} + +void intel_hpd_fini_work(struct drm_i915_private *dev_priv) +{ + drm_kms_unregister_oob_hotplug_notifier( + &dev_priv->hotplug.oob_notifier); } void intel_hpd_cancel_work(struct drm_i915_private *dev_priv) From patchwork Mon Feb 25 13:20:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10828571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B3BD91399 for ; Mon, 25 Feb 2019 13:20:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A39202B647 for ; Mon, 25 Feb 2019 13:20:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 970B02B65F; Mon, 25 Feb 2019 13:20:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 284902B663 for ; Mon, 25 Feb 2019 13:20:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727148AbfBYNUx (ORCPT ); Mon, 25 Feb 2019 08:20:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33946 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726921AbfBYNUx (ORCPT ); Mon, 25 Feb 2019 08:20:53 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB3C1307D978; Mon, 25 Feb 2019 13:20:52 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-117-17.ams2.redhat.com [10.36.117.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4234F60857; Mon, 25 Feb 2019 13:20:50 +0000 (UTC) From: Hans de Goede To: Maarten Lankhorst , Maxime Ripard , Sean Paul , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Greg Kroah-Hartman , Heikki Krogerus Cc: Hans de Goede , David Airlie , intel-gfx , dri-devel@lists.freedesktop.org, linux-usb@vger.kernel.org Subject: [PATCH 3/3] usb: typec: altmodes/displayport: Notify drm subsys of hotplug events Date: Mon, 25 Feb 2019 14:20:37 +0100 Message-Id: <20190225132037.31458-4-hdegoede@redhat.com> In-Reply-To: <20190225132037.31458-1-hdegoede@redhat.com> References: <20190225132037.31458-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 25 Feb 2019 13:20:52 +0000 (UTC) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the new drm_kms_call_oob_hotplug_notifier_chain() function to load drm/kms drivers know about DisplayPort over Type-C hotplug events. Signed-off-by: Hans de Goede --- drivers/usb/typec/altmodes/displayport.c | 34 ++++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c index 35161594e368..87760ea252d6 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -13,6 +13,7 @@ #include #include #include +#include #define DP_HEADER(cmd) (VDO(USB_TYPEC_DP_SID, 1, cmd) | \ VDO_OPOS(USB_TYPEC_DP_MODE)) @@ -67,12 +68,23 @@ struct dp_altmode { const struct typec_altmode *port; }; -static int dp_altmode_notify(struct dp_altmode *dp) +static int dp_altmode_notify(struct dp_altmode *dp, unsigned long conf) +{ + int ret; + + ret = typec_altmode_notify(dp->alt, conf, &dp->data); + if (ret) + return ret; + + drm_kms_call_oob_hotplug_notifier_chain(DRM_OOB_HOTPLUG_TYPE_C_DP); + return 0; +} + +static int dp_altmode_notify_dp(struct dp_altmode *dp) { u8 state = get_count_order(DP_CONF_GET_PIN_ASSIGN(dp->data.conf)); - return typec_altmode_notify(dp->alt, TYPEC_MODAL_STATE(state), - &dp->data); + return dp_altmode_notify(dp, TYPEC_MODAL_STATE(state)); } static int dp_altmode_configure(struct dp_altmode *dp, u8 con) @@ -145,10 +157,9 @@ static int dp_altmode_configured(struct dp_altmode *dp) sysfs_notify(&dp->alt->dev.kobj, "displayport", "configuration"); if (!dp->data.conf) - return typec_altmode_notify(dp->alt, TYPEC_STATE_USB, - &dp->data); + return dp_altmode_notify(dp, TYPEC_STATE_USB); - ret = dp_altmode_notify(dp); + ret = dp_altmode_notify_dp(dp); if (ret) return ret; @@ -162,7 +173,7 @@ static int dp_altmode_configure_vdm(struct dp_altmode *dp, u32 conf) u32 header = DP_HEADER(DP_CMD_CONFIGURE); int ret; - ret = typec_altmode_notify(dp->alt, TYPEC_STATE_SAFE, &dp->data); + ret = dp_altmode_notify(dp, TYPEC_STATE_SAFE); if (ret) { dev_err(&dp->alt->dev, "unable to put to connector to safe mode\n"); @@ -172,10 +183,9 @@ static int dp_altmode_configure_vdm(struct dp_altmode *dp, u32 conf) ret = typec_altmode_vdm(dp->alt, header, &conf, 2); if (ret) { if (DP_CONF_GET_PIN_ASSIGN(dp->data.conf)) - dp_altmode_notify(dp); + dp_altmode_notify_dp(dp); else - typec_altmode_notify(dp->alt, TYPEC_STATE_USB, - &dp->data); + dp_altmode_notify(dp, TYPEC_STATE_USB); } return ret; @@ -241,7 +251,7 @@ static void dp_altmode_attention(struct typec_altmode *alt, const u32 vdo) if (dp_altmode_status_update(dp)) dev_warn(&alt->dev, "%s: status update failed\n", __func__); - if (dp_altmode_notify(dp)) + if (dp_altmode_notify_dp(dp)) dev_err(&alt->dev, "%s: notification failed\n", __func__); if (old_state == DP_STATE_IDLE && dp->state != DP_STATE_IDLE) @@ -556,6 +566,8 @@ static void dp_altmode_remove(struct typec_altmode *alt) sysfs_remove_group(&alt->dev.kobj, &dp_altmode_group); cancel_work_sync(&dp->work); + + drm_kms_call_oob_hotplug_notifier_chain(DRM_OOB_HOTPLUG_TYPE_C_DP); } static const struct typec_device_id dp_typec_id[] = {