Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions drivers/gpu/drm/v3d/v3d_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,8 @@ int v3d_gem_init(struct drm_device *dev);
void v3d_gem_destroy(struct drm_device *dev);
void v3d_reset_sms(struct v3d_dev *v3d);
void v3d_reset(struct v3d_dev *v3d);
void v3d_idle_axi(struct v3d_dev *v3d, int core);
void v3d_idle_gca(struct v3d_dev *v3d);
void v3d_invalidate_caches(struct v3d_dev *v3d);
void v3d_clean_caches(struct v3d_dev *v3d);

Expand Down
16 changes: 14 additions & 2 deletions drivers/gpu/drm/v3d/v3d_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,21 @@ v3d_init_core(struct v3d_dev *v3d, int core)
V3D_CORE_WRITE(core, V3D_CTL_L2TFLEND, ~0);
}

static void
void
v3d_idle_axi(struct v3d_dev *v3d, int core)
{
if (v3d->ver >= V3D_GEN_71) {
V3D_WRITE(V3D_GMP_CFG(v3d->ver), V3D_GMP_CFG_STOP_REQ);

if (wait_for((V3D_READ(V3D_GMP_STATUS(v3d->ver)) &
(V3D_GMP_STATUS_RD_COUNT_MASK |
V3D_GMP_STATUS_WR_COUNT_MASK |
V3D_GMP_STATUS_CFG_BUSY)) == 0, 100)) {
DRM_ERROR("Failed to wait for safe GMP shutdown\n");
}
return;
}

V3D_CORE_WRITE(core, V3D_GMP_CFG(v3d->ver), V3D_GMP_CFG_STOP_REQ);

if (wait_for((V3D_CORE_READ(core, V3D_GMP_STATUS(v3d->ver)) &
Expand All @@ -49,7 +61,7 @@ v3d_idle_axi(struct v3d_dev *v3d, int core)
}
}

static void
void
v3d_idle_gca(struct v3d_dev *v3d)
{
if (v3d->ver >= V3D_GEN_41)
Expand Down
7 changes: 7 additions & 0 deletions drivers/gpu/drm/v3d/v3d_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ int v3d_power_suspend(struct device *dev)
/* Always clean V3D caches on shutdown. */
v3d_clean_caches(v3d);

/* Wait until V3D has no active or pending AXI transactions. */
v3d_idle_axi(v3d, 0);
v3d_idle_gca(v3d);

ret = v3d_suspend_sms(v3d);
if (ret) {
/* Staying active: undo the GMP STOP_REQ from v3d_idle_axi(). */
V3D_WRITE(V3D_GMP_CFG(v3d->ver),
V3D_READ(V3D_GMP_CFG(v3d->ver)) & ~V3D_GMP_CFG_STOP_REQ);
v3d_irq_enable(v3d);
return ret;
}
Expand Down
Loading