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 <hdegoede@xxxxxxxxxx> --- 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 <linux/module.h> #include <linux/usb/pd_vdo.h> #include <linux/usb/typec_dp.h> +#include <drm/drm_probe_helper.h> #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[] = { -- 2.20.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx