From patchwork Mon Oct 18 08:47:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12565359 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 ED8EFC433FE for ; Mon, 18 Oct 2021 08:47:36 +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 B952E60F02 for ; Mon, 18 Oct 2021 08:47:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B952E60F02 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 4E12388E41; Mon, 18 Oct 2021 08:47:35 +0000 (UTC) Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) by gabe.freedesktop.org (Postfix) with ESMTPS id A924F88EF2 for ; Mon, 18 Oct 2021 08:47:33 +0000 (UTC) Date: Mon, 18 Oct 2021 08:47:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634546851; bh=+y0rRtkssxzbjvE8UQNuS0lAQ3Z8DvWBR4Uu8yw+/UQ=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=ofvSsBMv5bTcGKh5yB1e+vktQxS+GHSgRbQXKIpP0m6Yl5mNRNh234VwoFlfs9lNj yt5oVQEraNRHXpOl/mrkvH7Acb5K9znCaEkVRiupvHviy5jwsQ03OhBE7r9PEL1dlR 6GrycMfqI7mD690CECJeN6nFYkiEXKP+KTRvMrhtBxmOLFZ3hBkQfWGWuubWAkFkAj zkty9XvvdUfINc5iFT9Do5dcBASLTqsOWp+WTkXln/DpRlT639BjEJdEQjKcqawqio MuqEXIFwXeHSR9h54IOhW7+nnn84kU7MvfkMMkYTSOkg5i+6CJmWN0VViC/3aRLKHZ FSah0XGnYPAMw== To: dri-devel@lists.freedesktop.org From: Simon Ser Cc: Sam Ravnborg , Harry Wentland Subject: [PATCH v4 2/6] drm/probe-helper: add drm_kms_helper_connector_hotplug_event Message-ID: <20211018084707.32253-3-contact@emersion.fr> In-Reply-To: <20211018084707.32253-1-contact@emersion.fr> References: <20211018084707.32253-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 Acked-by: Harry Wentland --- 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);