From: Hans de Goede <hdegoede@redhat.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <maxime.ripard@bootlin.com>,
Sean Paul <seanpaul@chromium.org>,
Daniel Vetter <daniel.vetter@intel.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: David Airlie <airlied@linux.ie>,
intel-gfx <intel-gfx@lists.freedesktop.org>,
linux-usb@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [PATCH 3/3] usb: typec: altmodes/displayport: Notify drm subsys of hotplug events
Date: Mon, 25 Feb 2019 14:20:37 +0100 [thread overview]
Message-ID: <20190225132037.31458-4-hdegoede@redhat.com> (raw)
In-Reply-To: <20190225132037.31458-1-hdegoede@redhat.com>
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@redhat.com>
---
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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-02-25 13:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 13:20 [PATCH 0/3] Propagate DP-over-Type-C hotplug events from Type-C subsys to drm-drivers Hans de Goede
2019-02-25 13:20 ` [PATCH 1/3] drm: Add support for out-of-band hotplug notification Hans de Goede
2019-02-25 13:20 ` [PATCH 2/3] i915: Add support for out-of-bound hotplug events Hans de Goede
2019-02-25 13:20 ` Hans de Goede [this message]
2019-02-25 14:06 ` [PATCH 3/3] usb: typec: altmodes/displayport: Notify drm subsys of " Greg Kroah-Hartman
2019-02-25 16:19 ` Hans de Goede
2019-02-26 7:40 ` kbuild test robot
2019-02-26 16:04 ` kbuild test robot
2019-02-27 9:44 ` Heikki Krogerus
2019-02-27 15:51 ` Hans de Goede
2019-02-27 10:55 ` [PATCH 0/3] Propagate DP-over-Type-C hotplug events from Type-C subsys to drm-drivers Heikki Krogerus
2019-02-27 11:16 ` Jani Nikula
2019-02-27 11:49 ` Heikki Krogerus
2019-02-27 15:45 ` Hans de Goede
2019-02-28 9:15 ` Heikki Krogerus
2019-02-28 11:24 ` Hans de Goede
2019-02-28 14:47 ` Heikki Krogerus
2019-02-28 16:54 ` Hans de Goede
2019-03-04 15:17 ` Heikki Krogerus
2019-03-05 7:45 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190225132037.31458-4-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-usb@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maxime.ripard@bootlin.com \
--cc=rodrigo.vivi@intel.com \
--cc=seanpaul@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).