Skip to content

Commit db5be3a

Browse files
Laurent Pincharttomba
authored andcommitted
drm: rcar-du: Ensure correct suspend/resume ordering with VSP
The VSP serves as an interface to memory and a compositor to the DU. It therefore needs to be suspended after and resumed before the DU, to be properly stopped and restarted in a controlled fashion driven by the DU driver. This currently works by chance. Avoid relying on luck by enforcing the correct suspend/resume ordering with device links. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Tested-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com> Reviewed-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com> Link: https://patch.msgid.link/20260323164526.2292491-2-laurent.pinchart+renesas@ideasonboard.com Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
1 parent d37690b commit db5be3a

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

drivers/gpu/drm/renesas/rcar-du/rcar_du_vsp.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <drm/drm_vblank.h>
2121

2222
#include <linux/bitops.h>
23+
#include <linux/device.h>
2324
#include <linux/dma-mapping.h>
2425
#include <linux/of_platform.h>
2526
#include <linux/platform_device.h>
@@ -458,6 +459,9 @@ static void rcar_du_vsp_cleanup(struct drm_device *dev, void *res)
458459

459460
kfree(vsp->planes);
460461

462+
if (vsp->link)
463+
device_link_del(vsp->link);
464+
461465
put_device(vsp->vsp);
462466
}
463467

@@ -482,6 +486,18 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
482486
if (ret < 0)
483487
return ret;
484488

489+
/*
490+
* Enforce suspend/resume ordering between the DU (consumer) and the
491+
* VSP (supplier). The DU will be suspended before and resume after the
492+
* VSP.
493+
*/
494+
vsp->link = device_link_add(rcdu->dev, vsp->vsp, DL_FLAG_STATELESS);
495+
if (!vsp->link) {
496+
dev_err(rcdu->dev, "Failed to create device link to VSP %s\n",
497+
dev_name(vsp->vsp));
498+
return -EINVAL;
499+
}
500+
485501
ret = vsp1_du_init(vsp->vsp);
486502
if (ret < 0)
487503
return ret;

drivers/gpu/drm/renesas/rcar-du/rcar_du_vsp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <drm/drm_plane.h>
1414

15+
struct device_link;
1516
struct drm_framebuffer;
1617
struct rcar_du_format_info;
1718
struct rcar_du_vsp;
@@ -26,6 +27,7 @@ struct rcar_du_vsp_plane {
2627
struct rcar_du_vsp {
2728
unsigned int index;
2829
struct device *vsp;
30+
struct device_link *link;
2931
struct rcar_du_device *dev;
3032
struct rcar_du_vsp_plane *planes;
3133
unsigned int num_planes;

0 commit comments

Comments
 (0)