Skip to content

Commit c478768

Browse files
committed
drm/armada: 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 was fairly easy to update. The drm_device is stored in the drvdata so we just have to make sure the drvdata is NULL whenever the device is not bound. To make things simpler, drm_atomic_helper_shutdown() has been modified to consider a NULL drm_device as a noop in the patch ("drm/atomic-helper: drm_atomic_helper_shutdown(NULL) should be a noop"). Suggested-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Maxime Ripard <mripard@kernel.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230901164111.RFT.1.I3d5598bd73a59b5ded71430736c93f67dc5dea61@changeid
1 parent cd273b7 commit c478768

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/gpu/drm/armada/armada_drv.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ static int armada_drm_bind(struct device *dev)
148148
err_kms:
149149
drm_mode_config_cleanup(&priv->drm);
150150
drm_mm_takedown(&priv->linear);
151+
dev_set_drvdata(dev, NULL);
151152
return ret;
152153
}
153154

@@ -166,6 +167,7 @@ static void armada_drm_unbind(struct device *dev)
166167

167168
drm_mode_config_cleanup(&priv->drm);
168169
drm_mm_takedown(&priv->linear);
170+
dev_set_drvdata(dev, NULL);
169171
}
170172

171173
static void armada_add_endpoints(struct device *dev,
@@ -230,6 +232,11 @@ static int armada_drm_remove(struct platform_device *pdev)
230232
return 0;
231233
}
232234

235+
static void armada_drm_shutdown(struct platform_device *pdev)
236+
{
237+
drm_atomic_helper_shutdown(platform_get_drvdata(pdev));
238+
}
239+
233240
static const struct platform_device_id armada_drm_platform_ids[] = {
234241
{
235242
.name = "armada-drm",
@@ -243,6 +250,7 @@ MODULE_DEVICE_TABLE(platform, armada_drm_platform_ids);
243250
static struct platform_driver armada_drm_platform_driver = {
244251
.probe = armada_drm_probe,
245252
.remove = armada_drm_remove,
253+
.shutdown = armada_drm_shutdown,
246254
.driver = {
247255
.name = "armada-drm",
248256
},

0 commit comments

Comments
 (0)