summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vboxvideo
diff options
context:
space:
mode:
authorDouglas Anderson <dianders@chromium.org>2023-09-02 02:39:56 +0300
committerDouglas Anderson <dianders@chromium.org>2023-09-21 20:51:55 +0300
commit3c4babae3c4a1ae05f8f3f5f3d50c440ead7ca6a (patch)
tree43939c4253e5188757bacd17d54c667609e855b4 /drivers/gpu/drm/vboxvideo
parent10c8204c8b172234f11a0482a89fb4affadfaab5 (diff)
downloadlinux-3c4babae3c4a1ae05f8f3f5f3d50c440ead7ca6a.tar.xz
drm: Call drm_atomic_helper_shutdown() at shutdown/remove time for misc drivers
Based on grepping through the source code these drivers appear to be missing a call to drm_atomic_helper_shutdown() at system shutdown time and at driver remove (or unbind) 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 and at driver remove (or unbind) time comes straight out of the kernel doc "driver instance overview" in drm_drv.c. A few notes about these fixes: - I confirmed that these drivers were all DRIVER_MODESET type drivers, which I believe makes this relevant. - I confirmed that these drivers were all DRIVER_ATOMIC. - When adding drm_atomic_helper_shutdown() to the remove/unbind path, I added it after drm_kms_helper_poll_fini() when the driver had it. This seemed to be what other drivers did. If drm_kms_helper_poll_fini() wasn't there I added it straight after drm_dev_unregister(). - This patch deals with drivers using the component model in similar ways as the patch ("drm: Call drm_atomic_helper_shutdown() at shutdown time for misc drivers") - These fixes rely on the patch ("drm/atomic-helper: drm_atomic_helper_shutdown(NULL) should be a noop") to simplify shutdown. Suggested-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> # tilcdc Acked-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230901163944.RFT.5.I771eb4bd03d8772b19e7dcfaef3e2c167bce5846@changeid
Diffstat (limited to 'drivers/gpu/drm/vboxvideo')
-rw-r--r--drivers/gpu/drm/vboxvideo/vbox_drv.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c
index 4fee15c97c34..047b95812334 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_drv.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c
@@ -12,6 +12,7 @@
#include <linux/vt_kern.h>
#include <drm/drm_aperture.h>
+#include <drm/drm_atomic_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_fbdev_generic.h>
#include <drm/drm_file.h>
@@ -97,11 +98,19 @@ static void vbox_pci_remove(struct pci_dev *pdev)
struct vbox_private *vbox = pci_get_drvdata(pdev);
drm_dev_unregister(&vbox->ddev);
+ drm_atomic_helper_shutdown(&vbox->ddev);
vbox_irq_fini(vbox);
vbox_mode_fini(vbox);
vbox_hw_fini(vbox);
}
+static void vbox_pci_shutdown(struct pci_dev *pdev)
+{
+ struct vbox_private *vbox = pci_get_drvdata(pdev);
+
+ drm_atomic_helper_shutdown(&vbox->ddev);
+}
+
static int vbox_pm_suspend(struct device *dev)
{
struct vbox_private *vbox = dev_get_drvdata(dev);
@@ -165,6 +174,7 @@ static struct pci_driver vbox_pci_driver = {
.id_table = pciidlist,
.probe = vbox_pci_probe,
.remove = vbox_pci_remove,
+ .shutdown = vbox_pci_shutdown,
.driver.pm = pm_sleep_ptr(&vbox_pm_ops),
};