From patchwork Fri Jun 23 09:42:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 13290210 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D737CEB64D7 for ; Fri, 23 Jun 2023 09:42:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 045A410E633; Fri, 23 Jun 2023 09:42:49 +0000 (UTC) Received: from mail-4022.proton.ch (mail-4022.proton.ch [185.70.40.22]) by gabe.freedesktop.org (Postfix) with ESMTPS id CA76110E032 for ; Fri, 23 Jun 2023 09:42:46 +0000 (UTC) Date: Fri, 23 Jun 2023 09:42:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1687513363; x=1687772563; bh=gT/hFPfbITG4VFPtNeo5wwjwThRz+wCwdxQi8gMQgRU=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=swE33TT9/MK2TY8wU6FxZBZWfAFn3FIJLh5qZ+jfLRK6VoK4kflk5ND9GwyFFpHX5 DYcusR5tx8wKp9D6pt7MQjGs1DtkmirGqEIQ4/R0DiBA0NoPm9vUnZGCkSFL0ODaqW 6eDy5IKFtMsDS0Js25eGQZFcBk3i68z7KCGBnmqpdl0MuHanWJT8U6dDna11clBdug Pjh//SpX+pupBi2Qxz8W1GG6vFV3BqR1pyuYW303+vJiTNZl8Y+a3h32YfpAuLUFlx D5m8anhYkx9s/rHNzBnOMU59/4Yjxo9mdO4SOfvgGT4jSmZBHsE3+KkG0covy452Xk lYgUwh1sOrOlg== To: intel-gfx@lists.freedesktop.org From: Simon Ser Message-ID: <20230623094229.120264-1-contact@emersion.fr> Feedback-ID: 1358184:user:proton MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v2] i915/display/hotplug: use drm_kms_helper_connector_hotplug_event() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jani Nikula , Lucas De Marchi , Rodrigo Vivi Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This adds more information to the hotplug uevent and lets user-space know that it's about a particular connector only. v2: don't rely on the changed HPD pin bitmask to count changed connectors (Jani) Signed-off-by: Simon Ser Cc: Jani Nikula Cc: Ville Syrjälä Cc: Rodrigo Vivi Cc: Gustavo Sousa Cc: Imre Deak Cc: Lucas De Marchi --- drivers/gpu/drm/i915/display/intel_hotplug.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c b/drivers/gpu/drm/i915/display/intel_hotplug.c index 1160fa20433b..0ff5ed46ae1e 100644 --- a/drivers/gpu/drm/i915/display/intel_hotplug.c +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c @@ -376,6 +376,8 @@ static void i915_hotplug_work_func(struct work_struct *work) u32 changed = 0, retry = 0; u32 hpd_event_bits; u32 hpd_retry_bits; + struct drm_connector *first_changed_connector = NULL; + int changed_connectors = 0; mutex_lock(&dev_priv->drm.mode_config.mutex); drm_dbg_kms(&dev_priv->drm, "running encoder hotplug functions\n"); @@ -428,6 +430,11 @@ static void i915_hotplug_work_func(struct work_struct *work) break; case INTEL_HOTPLUG_CHANGED: changed |= hpd_bit; + changed_connectors++; + if (!first_changed_connector) { + drm_connector_get(&connector->base); + first_changed_connector = &connector->base; + } break; case INTEL_HOTPLUG_RETRY: retry |= hpd_bit; @@ -438,9 +445,14 @@ static void i915_hotplug_work_func(struct work_struct *work) drm_connector_list_iter_end(&conn_iter); mutex_unlock(&dev_priv->drm.mode_config.mutex); - if (changed) + if (changed_connectors == 1) + drm_kms_helper_connector_hotplug_event(first_changed_connector); + else if (changed_connectors > 0) drm_kms_helper_hotplug_event(&dev_priv->drm); + if (first_changed_connector) + drm_connector_put(first_changed_connector); + /* Remove shared HPD pins that have changed */ retry &= ~changed; if (retry) {