summaryrefslogtreecommitdiff
path: root/drivers/gpu/host1x/channel.c
diff options
context:
space:
mode:
authorMikko Perttunen <mperttunen@nvidia.com>2023-09-01 14:15:08 +0300
committerThierry Reding <treding@nvidia.com>2023-10-11 23:52:44 +0300
commit87fafcd53df8ca5b6695a71aa17f2e7aff464ecc (patch)
treef581e382f4f5ecd48a1f6a4f2b310456b9c3b848 /drivers/gpu/host1x/channel.c
parent9764723de613d93b72e95923d25d589f539f07e9 (diff)
downloadlinux-87fafcd53df8ca5b6695a71aa17f2e7aff464ecc.tar.xz
gpu: host1x: Stop CDMA before suspending
Before going into suspend, wait all CDMA to go idle and stop it. This will ensure no channel is still active while we enter suspend, and ensures the driver doesn't think that CDMA is still active when coming back from suspend (as HW state has been reset). Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230901111510.663401-2-cyndis@kapsi.fi
Diffstat (limited to 'drivers/gpu/host1x/channel.c')
-rw-r--r--drivers/gpu/host1x/channel.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/host1x/channel.c b/drivers/gpu/host1x/channel.c
index 79501c957532..08077afe4cde 100644
--- a/drivers/gpu/host1x/channel.c
+++ b/drivers/gpu/host1x/channel.c
@@ -81,6 +81,25 @@ void host1x_channel_stop(struct host1x_channel *channel)
}
EXPORT_SYMBOL(host1x_channel_stop);
+/**
+ * host1x_channel_stop_all() - disable CDMA on allocated channels
+ * @host: host1x instance
+ *
+ * Stop CDMA on allocated channels
+ */
+void host1x_channel_stop_all(struct host1x *host)
+{
+ struct host1x_channel_list *chlist = &host->channel_list;
+ int bit;
+
+ mutex_lock(&chlist->lock);
+
+ for_each_set_bit(bit, chlist->allocated_channels, host->info->nb_channels)
+ host1x_channel_stop(&chlist->channels[bit]);
+
+ mutex_unlock(&chlist->lock);
+}
+
static void release_channel(struct kref *kref)
{
struct host1x_channel *channel =