From patchwork Fri Oct 15 16:33:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12562497 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E1DDC433F5 for ; Fri, 15 Oct 2021 16:33:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id ADA1C61164 for ; Fri, 15 Oct 2021 16:33:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ADA1C61164 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 00D5D6ED99; Fri, 15 Oct 2021 16:33:49 +0000 (UTC) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 993046EDCA for ; Fri, 15 Oct 2021 16:33:47 +0000 (UTC) Date: Fri, 15 Oct 2021 16:33:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634315624; bh=G+FOKvcpvh9Ah07Dv52OX46vIKQvPQHN/sG+RPUHAl8=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:From; b=Oz1WF1H1CVYZLziWXSRWNmyaVdpwDB+1Y6RRSMIuA7JPc+cAoVeT4QoNcW0FwAda+ oKtnSH2M3/kQVNLlvA0T/t+ksn3zHyt/T9yWPbqHBbZO8V+UfEzgPCvZU1UqtecCnh 6d0LejST6d8aWm5LVNhUpaE3YQhyw7vvzg6fC97BQ9j5V57Oy4psdwN8k+6SU/rpZ7 wa6coN5JmKG28/MdxNPBN67fmerJzmDlLDre0KUfE99V7Bc2ewP0mMnbzuA9jvSKnY aIsUlipAE6DeEUgAi/vYGZjGpa/o8r2t6TYMBCQtoVinxgBrsKNWOve5WI00dyG3FE YLggOb4OF+vyA== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH v3 1/6] drm/sysfs: introduce drm_sysfs_connector_hotplug_event Message-ID: <20211015163336.95188-2-contact@emersion.fr> In-Reply-To: <20211015163336.95188-1-contact@emersion.fr> References: <20211015163336.95188-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This function sends a hotplug uevent with a CONNECTOR property. Signed-off-by: Simon Ser Reviewed-by: Sam Ravnborg --- drivers/gpu/drm/drm_sysfs.c | 25 +++++++++++++++++++++++++ include/drm/drm_sysfs.h | 1 + 2 files changed, 26 insertions(+) diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 76ff6ec3421b..430e00b16eec 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -409,6 +409,31 @@ void drm_sysfs_hotplug_event(struct drm_device *dev) } EXPORT_SYMBOL(drm_sysfs_hotplug_event); +/** + * drm_sysfs_connector_hotplug_event - generate a DRM uevent for any connector + * change + * @connector: connector which has changed + * + * Send a uevent for the DRM connector specified by @connector. This will send + * a uevent with the properties HOTPLUG=1 and CONNECTOR. + */ +void drm_sysfs_connector_hotplug_event(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + char hotplug_str[] = "HOTPLUG=1", conn_id[21]; + char *envp[] = { hotplug_str, conn_id, NULL }; + + snprintf(conn_id, sizeof(conn_id), + "CONNECTOR=%u", connector->base.id); + + drm_dbg_kms(connector->dev, + "[CONNECTOR:%d:%s] generating connector hotplug event\n", + connector->base.id, connector->name); + + kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp); +} +EXPORT_SYMBOL(drm_sysfs_connector_hotplug_event); + /** * drm_sysfs_connector_status_event - generate a DRM uevent for connector * property status change diff --git a/include/drm/drm_sysfs.h b/include/drm/drm_sysfs.h index d454ef617b2c..6273cac44e47 100644 --- a/include/drm/drm_sysfs.h +++ b/include/drm/drm_sysfs.h @@ -11,6 +11,7 @@ int drm_class_device_register(struct device *dev); void drm_class_device_unregister(struct device *dev); void drm_sysfs_hotplug_event(struct drm_device *dev); +void drm_sysfs_connector_hotplug_event(struct drm_connector *connector); void drm_sysfs_connector_status_event(struct drm_connector *connector, struct drm_property *property); #endif From patchwork Fri Oct 15 16:33:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12562503 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A40DC433EF for ; Fri, 15 Oct 2021 16:33:58 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1E46F60E0C for ; Fri, 15 Oct 2021 16:33:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1E46F60E0C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5AF886EDA8; Fri, 15 Oct 2021 16:33:53 +0000 (UTC) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 55EB26E514 for ; Fri, 15 Oct 2021 16:33:49 +0000 (UTC) Date: Fri, 15 Oct 2021 16:33:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634315627; bh=qw7tVZ9fPz5TV4PBSVZRHvRtrIFKMES7KV0U7AIbfjM=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:From; b=AxvKb0xq0FUmgBAs0bTftwx2vRVny1wXn6T5Re0oLh8AgmGZHE6saqjH0lr+KBnDp HRNneBT65VsImC0tW+c+5n83jvRWUmiK+pfFLLktkC1qrMd6kdWibzg5RDfyx+seOW 2JfJPMzXjozyiULDnwFt0NQwywt9Mqo2Fy2xSaBfv0vku3faKeAqM1u23tT83YhWGp TYlCvYlIaU/UeCEz7tg7HIkJk/VRLUK/fLJ3OnmrCif6OOd019HODH7hrS+NLQrDlA /PTInhSEHNIcZn5VA1gVnVvt/3jJIuPxk1w2jjVC3IvyGSkBrVy5HpYmBsX5q4NjPU Ggd7KxDOBtaog== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH v3 2/6] drm/probe-helper: add drm_kms_helper_connector_hotplug_event Message-ID: <20211015163336.95188-3-contact@emersion.fr> In-Reply-To: <20211015163336.95188-1-contact@emersion.fr> References: <20211015163336.95188-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This function is the same as drm_kms_helper_hotplug_event, but takes a connector instead of a device. Signed-off-by: Simon Ser Reviewed-by: Sam Ravnborg --- drivers/gpu/drm/drm_probe_helper.c | 23 +++++++++++++++++++++++ include/drm/drm_probe_helper.h | 1 + 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 61d5c57f23e1..3aef3b188c99 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -604,6 +604,9 @@ EXPORT_SYMBOL(drm_helper_probe_single_connector_modes); * * This function must be called from process context with no mode * setting locks held. + * + * If only a single connector has changed, consider calling + * drm_kms_helper_connector_hotplug_event() instead. */ void drm_kms_helper_hotplug_event(struct drm_device *dev) { @@ -616,6 +619,26 @@ void drm_kms_helper_hotplug_event(struct drm_device *dev) } EXPORT_SYMBOL(drm_kms_helper_hotplug_event); +/** + * drm_kms_helper_connector_hotplug_event - fire off a KMS connector hotplug event + * @connector: drm_connector which has changed + * + * This is the same as drm_kms_helper_hotplug_event(), except it fires a more + * fine-grained uevent for a single connector. + */ +void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + + /* send a uevent + call fbdev */ + drm_sysfs_connector_hotplug_event(connector); + if (dev->mode_config.funcs->output_poll_changed) + dev->mode_config.funcs->output_poll_changed(dev); + + drm_client_dev_hotplug(dev); +} +EXPORT_SYMBOL(drm_kms_helper_connector_hotplug_event); + static void output_poll_execute(struct work_struct *work) { struct delayed_work *delayed_work = to_delayed_work(work); diff --git a/include/drm/drm_probe_helper.h b/include/drm/drm_probe_helper.h index 04c57564c397..48300aa6ca71 100644 --- a/include/drm/drm_probe_helper.h +++ b/include/drm/drm_probe_helper.h @@ -20,6 +20,7 @@ void drm_kms_helper_poll_fini(struct drm_device *dev); bool drm_helper_hpd_irq_event(struct drm_device *dev); bool drm_connector_helper_hpd_irq_event(struct drm_connector *connector); void drm_kms_helper_hotplug_event(struct drm_device *dev); +void drm_kms_helper_connector_hotplug_event(struct drm_connector *connector); void drm_kms_helper_poll_disable(struct drm_device *dev); void drm_kms_helper_poll_enable(struct drm_device *dev); From patchwork Fri Oct 15 16:33:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12562509 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2137C433FE for ; Fri, 15 Oct 2021 16:34:05 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6A37E61242 for ; Fri, 15 Oct 2021 16:34:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6A37E61242 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0635A6ED85; Fri, 15 Oct 2021 16:34:02 +0000 (UTC) Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) by gabe.freedesktop.org (Postfix) with ESMTPS id 466636EDA3 for ; Fri, 15 Oct 2021 16:33:53 +0000 (UTC) Date: Fri, 15 Oct 2021 16:33:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634315631; bh=XLIJ55ALy/8LCOy7rJgXHOmSSFsu4ET0domvXc9V4Dg=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:From; b=zBy5gvoudi+M4pgSf0t+jx4GL1Yw9q2Q0+BYvo91gPYlKPTYKjVsWTcgAu7L24fPA 0iWlSKoAAsakpghGNuOyD/Nbr1J5+w+UWgvu80o8e4jxXustongN6jd42l8bivpihO xbvIdvhzL0WR5rduZllwcFltDcMskbc9a7HfrnDcIgw803IIsj14uxmo0yoDQrGzzq eDjcdsZc7lwKXmwiY5u2mIfWCsY1xpO6qkweTYkus7RwRlbvODh7WAoT2Bgkr2ID6g ttGgzvF5JK1KvWED4F/S6Cb3ZvFq5RR3Nw5CR3LxAJmP5p74VM3XYpuX5LCtqRa4YF 8nOJgOpnnmVcA== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH v3 3/6] drm/connector: use drm_sysfs_connector_hotplug_event Message-ID: <20211015163336.95188-4-contact@emersion.fr> In-Reply-To: <20211015163336.95188-1-contact@emersion.fr> References: <20211015163336.95188-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In drm_connector_register, use drm_sysfs_connector_hotplug_event instead of drm_sysfs_hotplug_event, because the hotplug event only updates a single connector. Signed-off-by: Simon Ser Reviewed-by: Sam Ravnborg Acked-by: Pekka Paalanen --- drivers/gpu/drm/drm_connector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index ec3973e8963c..a50c82bc2b2f 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -547,7 +547,7 @@ int drm_connector_register(struct drm_connector *connector) connector->registration_state = DRM_CONNECTOR_REGISTERED; /* Let userspace know we have a new connector */ - drm_sysfs_hotplug_event(connector->dev); + drm_sysfs_connector_hotplug_event(connector); if (connector->privacy_screen) drm_privacy_screen_register_notifier(connector->privacy_screen, From patchwork Fri Oct 15 16:33:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12562507 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DAFAC433EF for ; Fri, 15 Oct 2021 16:34:04 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D219460E0C for ; Fri, 15 Oct 2021 16:34:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D219460E0C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 63F176ED8A; Fri, 15 Oct 2021 16:34:02 +0000 (UTC) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 830966ED8A for ; Fri, 15 Oct 2021 16:33:55 +0000 (UTC) Date: Fri, 15 Oct 2021 16:33:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634315633; bh=CnvreGlcEPa564fSRV4zjlMRLFUjbxEgCnXwMFyXIk0=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:From; b=BKC9Jq1ZOcXvZXG2vxG1aYAhvlokXn5ILNkbaK8IjQq7/OZ6WbWkCSK1ZFEskMNkT qyoVZg6hiIsAuiz9uofBuarbX6TM90CQnWheX/rao6n6VOPrh7lm4OHqivfy750ZYC 6TFuCik0HKrgvLdv5KjDdbSFiZwsO1r+0cWI6lnEIPCAbPL0cSUntBVdOeqwPWwCAm HdGglogZhj6ykVx48osklVWpl2VkvN1zuQq3p4YguNCRB6lbE/AxGIbZEqCId5zJ9Q mFD40K0MqBw8ta0WSgfAX/mpN6kXv7b895LlWyihVc6hN3Sf2n9w9jpmFw3mOUceaE OmGeTwDphojEA== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH v3 4/6] amdgpu: use drm_kms_helper_connector_hotplug_event Message-ID: <20211015163336.95188-5-contact@emersion.fr> In-Reply-To: <20211015163336.95188-1-contact@emersion.fr> References: <20211015163336.95188-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When updating a single connector, use drm_kms_helper_connector_hotplug_event instead of drm_kms_helper_hotplug_event. Signed-off-by: Simon Ser Reviewed-by: Harry Wentland Acked-by: Harry Wentland --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 ++++---- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 9b1fc54555ee..c261e57d9a22 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2652,7 +2652,7 @@ static void handle_hpd_irq(void *param) drm_modeset_unlock_all(dev); if (aconnector->base.force == DRM_FORCE_UNSPECIFIED) - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } else if (dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD)) { if (new_connection_type == dc_connection_none && @@ -2666,7 +2666,7 @@ static void handle_hpd_irq(void *param) drm_modeset_unlock_all(dev); if (aconnector->base.force == DRM_FORCE_UNSPECIFIED) - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } mutex_unlock(&aconnector->hpd_lock); @@ -2833,7 +2833,7 @@ static void handle_hpd_rx_irq(void *param) dm_restore_drm_connector_state(dev, connector); drm_modeset_unlock_all(dev); - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } else if (dc_link_detect(dc_link, DETECT_REASON_HPDRX)) { if (aconnector->fake_enable) @@ -2846,7 +2846,7 @@ static void handle_hpd_rx_irq(void *param) dm_restore_drm_connector_state(dev, connector); drm_modeset_unlock_all(dev); - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } } #ifdef CONFIG_DRM_AMD_DC_HDCP diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c index 87daa78a32b8..23e789855d17 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -1241,7 +1241,7 @@ static ssize_t trigger_hotplug(struct file *f, const char __user *buf, dm_restore_drm_connector_state(dev, connector); drm_modeset_unlock_all(dev); - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } else if (param[0] == 0) { if (!aconnector->dc_link) goto unlock; @@ -1263,7 +1263,7 @@ static ssize_t trigger_hotplug(struct file *f, const char __user *buf, dm_restore_drm_connector_state(dev, connector); drm_modeset_unlock_all(dev); - drm_kms_helper_hotplug_event(dev); + drm_kms_helper_connector_hotplug_event(connector); } unlock: From patchwork Fri Oct 15 16:33:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12562499 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90802C433EF for ; Fri, 15 Oct 2021 16:33:53 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 416C360E0C for ; Fri, 15 Oct 2021 16:33:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 416C360E0C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5DDB76E329; Fri, 15 Oct 2021 16:33:52 +0000 (UTC) Received: from mail-4022.proton.ch (mail-4022.proton.ch [185.70.40.22]) by gabe.freedesktop.org (Postfix) with ESMTPS id 608026E329 for ; Fri, 15 Oct 2021 16:33:50 +0000 (UTC) Date: Fri, 15 Oct 2021 16:33:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634315628; bh=aPO+eW2W5skbHtCOR+vFJXQIAh0kKiUACv5iHW3hLww=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:From; b=Ca+EuksK387XK2ccd7YBKnUbk/lKfl934A83CGrqObPhbLOQcxNGPtnKPzr2S+hmD NWw4XFm1EjjZQv15+ZVnueb0AUvHOPNeItxMlumGlTdRAxl/o8EKffpcFMwaAYx8Ql yHcG+Nh9O4taJeObaekXO7pdQilSqPk5gq3qJK1xEGgigfnWnvYsA0pyAOu67JDLcc cQ9WrTXG0lI06chfVnUDUo6UAWUj+usx+xQvUkzZI3v/z/FCSESVxj5EgJXLZXHHNC D9jiOlt02ys4enBtfQRIW+JyCOOHIFkrEzjfkyyxPtHTSbE5kQ48WzVipyZjLfiHSQ 6F55NWK2l34FA== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH v3 5/6] drm/probe-helper: use drm_kms_helper_connector_hotplug_event Message-ID: <20211015163336.95188-6-contact@emersion.fr> In-Reply-To: <20211015163336.95188-1-contact@emersion.fr> References: <20211015163336.95188-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If an hotplug event only updates a single connector, use drm_kms_helper_connector_hotplug_event instead of drm_kms_helper_hotplug_event. Signed-off-by: Simon Ser --- drivers/gpu/drm/drm_probe_helper.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 3aef3b188c99..6049dc92324b 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -927,7 +927,7 @@ EXPORT_SYMBOL(drm_connector_helper_hpd_irq_event); */ bool drm_helper_hpd_irq_event(struct drm_device *dev) { - struct drm_connector *connector; + struct drm_connector *connector, *changed_connector = NULL; struct drm_connector_list_iter conn_iter; bool changed = false; @@ -941,15 +941,27 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) if (!(connector->polled & DRM_CONNECTOR_POLL_HPD)) continue; - if (check_connector_changed(connector)) + if (check_connector_changed(connector)) { + if (changed) { + if (changed_connector) + drm_connector_put(changed_connector); + changed_connector = NULL; + } else { + drm_connector_get(connector); + changed_connector = connector; + } + changed = true; + } } drm_connector_list_iter_end(&conn_iter); mutex_unlock(&dev->mode_config.mutex); - if (changed) { + if (changed_connector) { + drm_kms_helper_connector_hotplug_event(changed_connector); + drm_connector_put(changed_connector); + } else if (changed) { drm_kms_helper_hotplug_event(dev); - DRM_DEBUG_KMS("Sent hotplug event\n"); } return changed; From patchwork Fri Oct 15 16:33:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12562505 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4699C433EF for ; Fri, 15 Oct 2021 16:34:00 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 781EE61242 for ; Fri, 15 Oct 2021 16:34:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 781EE61242 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D0A76EDAC; Fri, 15 Oct 2021 16:33:53 +0000 (UTC) Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9E6656E329 for ; Fri, 15 Oct 2021 16:33:51 +0000 (UTC) Date: Fri, 15 Oct 2021 16:33:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634315629; bh=aCE9y3qSThbD2y1rUgyiT7Irei9XmhQaPbaufThP6Ts=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:From; b=sdojlnRfrUoIgvW0m2HrNGXri+4wnDGX1wD/1ynwXxydobs190m/sKTymhFzi/Y92 uMBtKN7IMc3vlCX15b1018sQMoMv2rwspV8ZXJUG4wAPt9Vbtx9uBjaSj9JIZcid88 fszyX27hNP6t+aLqmPgx2lHnHFoOZS2t6s7xoe6A3U6lWbGOocayjfhy9Fx4yi1kNC XzulrxnjYCx0AtzHDjdGIWP1AAj1w4VVA+mzHXT478NW1r/pM72nj1tgF0rwI2YWTM LAX76650Ky6Nj6Q12PkbzPfj2SKk79dkMV6+KC3mIy+eToGYQsCL//UIOaymS1MaRI 0ZoVAgWFubHPA== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH v3 6/6] i915/display/dp: send a more fine-grained link-status uevent Message-ID: <20211015163336.95188-7-contact@emersion.fr> In-Reply-To: <20211015163336.95188-1-contact@emersion.fr> References: <20211015163336.95188-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When link-status changes, send a hotplug uevent which contains the connector and property ID. That way, user-space can more easily figure out that only the link-status property of this connector has been updated. Signed-off-by: Simon Ser Reported-by: kernel test robot --- drivers/gpu/drm/i915/display/intel_dp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 04175f359fd6..afbe34b6e5be 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -5264,6 +5264,8 @@ static void intel_dp_modeset_retry_work_fn(struct work_struct *work) mutex_unlock(&connector->dev->mode_config.mutex); /* Send Hotplug uevent so userspace can reprobe */ drm_kms_helper_hotplug_event(connector->dev); + drm_sysfs_connector_status_event(connector, + connector->dev->mode_config.link_status_property); } bool