linux/drivers/gpu/drm/hisilicon/kirin
Douglas Anderson 918ce0906d drm/hisilicon/kirin: Call drm_atomic_helper_shutdown() at shutdown/unbind 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
and at driver 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.

I have attempted to put this in the right place at unbind time. In
most other DRM drivers the call is made right after the call to
drm_kms_helper_poll_fini(), so I've put it there. That means that this
call will also be made in the case that we hit errors in bind, since
kirin_drm_kms_cleanup() is called both in the bind error path and in
unbind. I believe this is harmless even though it's not needed in the
bind error path.

For handling shutdown, we rely on the common technique of seeing if
the drvdata is NULL to know whether we need to call
drm_atomic_helper_shutdown(). This makes it important to make sure
that the drvdata is NULL if bind failed or if unbind was called. We
don't need the actual check for NULL and we'll rely on the patch
("drm/atomic-helper: drm_atomic_helper_shutdown(NULL) should be a
noop").

Suggested-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230901163944.RFT.6.I21e0916bbd276033f7d31979c0da171458dedd4d@changeid
2023-09-21 10:54:20 -07:00
..
dw_drm_dsi.c drm/hisilicon: Convert to platform remove callback returning void 2023-06-08 09:04:11 -07:00
dw_dsi_reg.h drm/hisilicon/kirin: Use the correct HiSilicon copyright 2021-05-26 21:19:28 +02:00
Kconfig drm/gem: rename GEM CMA helpers to GEM DMA helpers 2022-08-03 18:31:49 +02:00
kirin_ade_reg.h drm/hisilicon/kirin: Use the correct HiSilicon copyright 2021-05-26 21:19:28 +02:00
kirin_drm_ade.c drm/gem: rename struct drm_gem_dma_object.{paddr => dma_addr} 2022-08-03 18:32:27 +02:00
kirin_drm_drv.c drm/hisilicon/kirin: Call drm_atomic_helper_shutdown() at shutdown/unbind time 2023-09-21 10:54:20 -07:00
kirin_drm_drv.h drm/hisilicon/kirin: Use the correct HiSilicon copyright 2021-05-26 21:19:28 +02:00
Makefile