From patchwork Tue Nov 8 00:27:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhinakaran Pandiyan X-Patchwork-Id: 9416277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4C9D06022E for ; Tue, 8 Nov 2016 00:28:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C95A28527 for ; Tue, 8 Nov 2016 00:28:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F80F28768; Tue, 8 Nov 2016 00:28:25 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8B7528527 for ; Tue, 8 Nov 2016 00:28:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B7296E0B4; Tue, 8 Nov 2016 00:28:23 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C3926E0B4 for ; Tue, 8 Nov 2016 00:28:22 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP; 07 Nov 2016 16:28:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,459,1473145200"; d="scan'208";a="188781969" Received: from nuc-skylake.jf.intel.com ([10.54.75.23]) by fmsmga004.fm.intel.com with ESMTP; 07 Nov 2016 16:28:21 -0800 From: Dhinakaran Pandiyan To: intel-gfx@lists.freedesktop.org Date: Mon, 7 Nov 2016 16:27:30 -0800 Message-Id: <1478564850-19766-1-git-send-email-dhinakaran.pandiyan@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20161107161445.GY4617@intel.com> References: <20161107161445.GY4617@intel.com> Cc: Dhinakaran Pandiyan Subject: [Intel-gfx] [PATCH v2] drm/i915/dp: Update connector status for DP MST hotplugs X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Hotplugging a monitor in DP MST configuration triggers short pulses. Although the short pulse handling path ends up in the MST hotplug function, we do not perform a detect before sending the hotplug uvent. This leads to the connector status not being updated when the userspace calls DRM_IOCTL_MODE_GETCONNECTOR. So, let's call the connector function ->detect() to update the connector status before sending the uevent. v2: Update connector status inside mode_config mutex (Ville) Signed-off-by: Dhinakaran Pandiyan --- drivers/gpu/drm/i915/intel_dp_mst.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index 3ffbd69..8e36a96 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c @@ -492,8 +492,28 @@ static void intel_dp_mst_hotplug(struct drm_dp_mst_topology_mgr *mgr) struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr); struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); struct drm_device *dev = intel_dig_port->base.base.dev; + struct intel_connector *intel_connector; + bool changed = false; + enum drm_connector_status old_status; + struct drm_mode_config *mode_config = &dev->mode_config; + + mutex_lock(&mode_config->mutex); + for_each_intel_connector(dev, intel_connector) { + struct drm_connector *connector = &(intel_connector->base); + + if (intel_connector->mst_port != intel_dp) + continue; + + old_status = connector->status; + connector->status = connector->funcs->detect(connector, false); + + if (old_status != connector->status) + changed = true; + } + mutex_unlock(&mode_config->mutex); - drm_kms_helper_hotplug_event(dev); + if (changed) + drm_kms_helper_hotplug_event(dev); } static const struct drm_dp_mst_topology_cbs mst_cbs = {