From patchwork Sat May 9 14:16:14 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: 11538327 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 5400317EF for ; Sat, 9 May 2020 14:16:59 +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 3C57A21655 for ; Sat, 9 May 2020 14:16:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C57A21655 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 A56B66E358; Sat, 9 May 2020 14:16:49 +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 3FDB26E356 for ; Sat, 9 May 2020 14:16:46 +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 3855D2018F; Sat, 9 May 2020 16:16:43 +0200 (CEST) From: =?utf-8?q?Noralf_Tr=C3=B8nnes?= To: dri-devel@lists.freedesktop.org, linux-usb@vger.kernel.org, lee.jones@linaro.org Subject: [PATCH v2 05/10] drm/client: Add drm_client_modeset_disable() Date: Sat, 9 May 2020 16:16:14 +0200 Message-Id: <20200509141619.32970-6-noralf@tronnes.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200509141619.32970-1-noralf@tronnes.org> References: <20200509141619.32970-1-noralf@tronnes.org> MIME-Version: 1.0 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=R7It5+ZX 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: jingoohan1@gmail.com, daniel.thompson@linaro.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 9d1ab69dd8d0..b96183fadd4c 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