Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/mediatek: Call drm_atomic_helper_shutdown() at shutdown time

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>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240611102744.v2.1.I2b014f90afc4729b6ecc7b5ddd1f6dedcea4625b@changeid

authored by

Douglas Anderson and committed by
Maxime Ripard
c38896ca 0320ca14

+8
+8
drivers/gpu/drm/mediatek/mtk_drm_drv.c
··· 952 952 of_node_put(private->comp_node[i]); 953 953 } 954 954 955 + static void mtk_drm_shutdown(struct platform_device *pdev) 956 + { 957 + struct mtk_drm_private *private = platform_get_drvdata(pdev); 958 + 959 + drm_atomic_helper_shutdown(private->drm); 960 + } 961 + 955 962 static int mtk_drm_sys_prepare(struct device *dev) 956 963 { 957 964 struct mtk_drm_private *private = dev_get_drvdata(dev); ··· 990 983 static struct platform_driver mtk_drm_platform_driver = { 991 984 .probe = mtk_drm_probe, 992 985 .remove_new = mtk_drm_remove, 986 + .shutdown = mtk_drm_shutdown, 993 987 .driver = { 994 988 .name = "mediatek-drm", 995 989 .pm = &mtk_drm_pm_ops,