]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/mediatek: Call drm_atomic_helper_shutdown() at shutdown time
authorDouglas Anderson <dianders@chromium.org>
Tue, 11 Jun 2024 17:27:44 +0000 (10:27 -0700)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Thu, 27 Jun 2024 13:56:39 +0000 (13:56 +0000)
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 <mripard@kernel.org>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Fei Shao <fshao@chromium.org>
Tested-by: Fei Shao <fshao@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240611102744.v2.1.I2b014f90afc4729b6ecc7b5ddd1f6dedcea4625b@changeid/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_drm_drv.c

index c9cad3a827376a2647d78b27d7b46cc684e88595..56f409ad7f390fe31ea41f97d28d6c9529395af2 100644 (file)
@@ -976,6 +976,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);
@@ -1007,6 +1014,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,