From patchwork Fri May 29 17:56:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Noralf_Tr=C3=B8nnes?= X-Patchwork-Id: 11579469 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D93B1392 for ; Fri, 29 May 2020 17:57:18 +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 140A32073B for ; Fri, 29 May 2020 17:57:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 140A32073B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tronnes.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AFA556E95A; Fri, 29 May 2020 17:57:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from asav22.altibox.net (asav22.altibox.net [109.247.116.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id E9E476E957 for ; Fri, 29 May 2020 17:57:05 +0000 (UTC) Received: from localhost.localdomain (unknown [81.166.168.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: noralf.tronnes@ebnett.no) by asav22.altibox.net (Postfix) with ESMTPSA id 6198A200C5; Fri, 29 May 2020 19:57:03 +0200 (CEST) From: =?utf-8?q?Noralf_Tr=C3=B8nnes?= To: dri-devel@lists.freedesktop.org, balbi@kernel.org Subject: [PATCH v3 2/6] drm/client: Add drm_client_modeset_disable() Date: Fri, 29 May 2020 19:56:39 +0200 Message-Id: <20200529175643.46094-3-noralf@tronnes.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200529175643.46094-1-noralf@tronnes.org> References: <20200529175643.46094-1-noralf@tronnes.org> MIME-Version: 1.0 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=LvK8NEVc c=1 sm=1 tr=0 a=OYZzhG0JTxDrWp/F2OJbnw==:117 a=OYZzhG0JTxDrWp/F2OJbnw==:17 a=IkcTkHD0fZMA:10 a=M51BFTxLslgA:10 a=SJz97ENfAAAA:8 a=0d597LMeBdbU6fJEcaIA:9 a=QEXdDO2ut3YA:10 a=vFet0B0WnEQeilDPIY6i:22 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: , Cc: linux-usb@vger.kernel.org, sam@ravnborg.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add a way for clients to disable all outputs. Signed-off-by: Noralf Trønnes --- drivers/gpu/drm/drm_client_modeset.c | 20 ++++++++++++++++++++ include/drm/drm_client.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c index 27e2fb41f14d..977bcd063520 100644 --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -1225,3 +1225,23 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode) return ret; } EXPORT_SYMBOL(drm_client_modeset_dpms); + +/** + * drm_client_modeset_disable() - Disable all outputs + * @client: DRM client + * + * This function disables all outputs by first clearing the modeset array and + * then committing the empty modesets. + * + * Returns: + * Zero on success or negative error code on failure. + */ +int drm_client_modeset_disable(struct drm_client_dev *client) +{ + mutex_lock(&client->modeset_mutex); + drm_client_modeset_release(client); + mutex_unlock(&client->modeset_mutex); + + return drm_client_modeset_commit(client); +} +EXPORT_SYMBOL(drm_client_modeset_disable); diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h index 76704f48fc46..498089b647da 100644 --- a/include/drm/drm_client.h +++ b/include/drm/drm_client.h @@ -168,6 +168,7 @@ int drm_client_modeset_check(struct drm_client_dev *client); int drm_client_modeset_commit_locked(struct drm_client_dev *client); int drm_client_modeset_commit(struct drm_client_dev *client); int drm_client_modeset_dpms(struct drm_client_dev *client, int mode); +int drm_client_modeset_disable(struct drm_client_dev *client); /** * drm_client_for_each_modeset() - Iterate over client modesets