Skip to content

Commit 87fafcd

Browse files
cyndisthierryreding
authored andcommitted
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
1 parent 9764723 commit 87fafcd

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

drivers/gpu/host1x/channel.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,25 @@ void host1x_channel_stop(struct host1x_channel *channel)
8181
}
8282
EXPORT_SYMBOL(host1x_channel_stop);
8383

84+
/**
85+
* host1x_channel_stop_all() - disable CDMA on allocated channels
86+
* @host: host1x instance
87+
*
88+
* Stop CDMA on allocated channels
89+
*/
90+
void host1x_channel_stop_all(struct host1x *host)
91+
{
92+
struct host1x_channel_list *chlist = &host->channel_list;
93+
int bit;
94+
95+
mutex_lock(&chlist->lock);
96+
97+
for_each_set_bit(bit, chlist->allocated_channels, host->info->nb_channels)
98+
host1x_channel_stop(&chlist->channels[bit]);
99+
100+
mutex_unlock(&chlist->lock);
101+
}
102+
84103
static void release_channel(struct kref *kref)
85104
{
86105
struct host1x_channel *channel =

drivers/gpu/host1x/channel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ int host1x_channel_list_init(struct host1x_channel_list *chlist,
4040
void host1x_channel_list_free(struct host1x_channel_list *chlist);
4141
struct host1x_channel *host1x_channel_get_index(struct host1x *host,
4242
unsigned int index);
43+
void host1x_channel_stop_all(struct host1x *host);
4344

4445
#endif

drivers/gpu/host1x/dev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ static int __maybe_unused host1x_runtime_suspend(struct device *dev)
655655
struct host1x *host = dev_get_drvdata(dev);
656656
int err;
657657

658+
host1x_channel_stop_all(host);
658659
host1x_intr_stop(host);
659660
host1x_syncpt_save(host);
660661

0 commit comments

Comments
 (0)