From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FC791581F4; Tue, 23 Jul 2024 18:39:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721759977; cv=none; b=bD/J017AD26DH6Q7qaN5pa4hUpzBbin1OYDy15leKuVfC8U1yLincUmLbdWFOyoqg+o0HOfN9uPej//H1f6HLoCUZxbCI5dN9npcRHhH74+im7YFyLfnvV7GHT2fotFY2WjwsotNOejHI54qEh3F4keEGwH5zqCyKDWMvAQL4aQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721759977; c=relaxed/simple; bh=+UkwjURgY5biVXTUyncCgY7WqF+j6rA+g9JILJXi/Jg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OV38Ons4tkPdhhCI2MQD2Cxla88P4eOu7HtfM5RHhi9qjFaJCRO27ceRINSIOLVnzQ5xVDiZMs6ejVSb76/hcDg0YBGF6LyGdQH4rFAh0kZC47Ud85GdOSPZMgnKi3HuKsyu2Ql54T0Q7XcuXgvHztGNVKZYGAi9Tu8n1ppEKT4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=laXEY0rR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="laXEY0rR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC63DC4AF0A; Tue, 23 Jul 2024 18:39:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1721759977; bh=+UkwjURgY5biVXTUyncCgY7WqF+j6rA+g9JILJXi/Jg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=laXEY0rRf31AUAO3J84xIDXf4blWBcBtjKCQ0DKNbDNhBR34UY0JEIRZFtJNo4Yf6 s65Wy16J8T6Xq6PYmDf6jyq5XvG+XBagAZnBKWmHh0iZl3/Lbym7prDYJPyVylfRJ2 VQskll0yqX/wjeEYhS+0ld9eGSlnZHWPFEwQwSNA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Maxime Ripard , Fei Shao , Douglas Anderson , Sasha Levin Subject: [PATCH 6.9 061/163] drm/mediatek: Call drm_atomic_helper_shutdown() at shutdown time Date: Tue, 23 Jul 2024 20:23:10 +0200 Message-ID: <20240723180145.830075500@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240723180143.461739294@linuxfoundation.org> References: <20240723180143.461739294@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Douglas Anderson [ Upstream commit c38896ca6318c2df20bbe6c8e3f633e071fda910 ] Based on grepping through the source code this driver appears to be missing a call to drm_atomic_helper_shutdown() at system shutdown time. Among other things, this means that if a panel is in use that it won't be cleanly powered off at system shutdown time. The fact that we should call drm_atomic_helper_shutdown() in the case of OS shutdown/restart comes straight out of the kernel doc "driver instance overview" in drm_drv.c. This driver users the component model and shutdown happens in the base driver. The "drvdata" for this driver will always be valid if shutdown() is called and as of commit 2a073968289d ("drm/atomic-helper: drm_atomic_helper_shutdown(NULL) should be a noop") we don't need to confirm that "drm" is non-NULL. Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Reviewed-by: Fei Shao Tested-by: Fei Shao Signed-off-by: Douglas Anderson Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20240611102744.v2.1.I2b014f90afc4729b6ecc7b5ddd1f6dedcea4625b@changeid Signed-off-by: Sasha Levin --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 74832c2130921..0b570e194079a 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -950,6 +950,13 @@ static void mtk_drm_remove(struct platform_device *pdev) of_node_put(private->comp_node[i]); } +static void mtk_drm_shutdown(struct platform_device *pdev) +{ + struct mtk_drm_private *private = platform_get_drvdata(pdev); + + drm_atomic_helper_shutdown(private->drm); +} + static int mtk_drm_sys_prepare(struct device *dev) { struct mtk_drm_private *private = dev_get_drvdata(dev); @@ -981,6 +988,7 @@ static const struct dev_pm_ops mtk_drm_pm_ops = { static struct platform_driver mtk_drm_platform_driver = { .probe = mtk_drm_probe, .remove_new = mtk_drm_remove, + .shutdown = mtk_drm_shutdown, .driver = { .name = "mediatek-drm", .pm = &mtk_drm_pm_ops, -- 2.43.0