Skip to content

Commit

Permalink
gpu: host1x: Stop CDMA before suspending
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Mikko Perttunen authored and Thierry Reding committed Oct 11, 2023
1 parent 9764723 commit 87fafcd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/gpu/host1x/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/host1x/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ int host1x_channel_list_init(struct host1x_channel_list *chlist,
void host1x_channel_list_free(struct host1x_channel_list *chlist);
struct host1x_channel *host1x_channel_get_index(struct host1x *host,
unsigned int index);
void host1x_channel_stop_all(struct host1x *host);

#endif
1 change: 1 addition & 0 deletions drivers/gpu/host1x/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ static int __maybe_unused host1x_runtime_suspend(struct device *dev)
struct host1x *host = dev_get_drvdata(dev);
int err;

host1x_channel_stop_all(host);
host1x_intr_stop(host);
host1x_syncpt_save(host);

Expand Down

0 comments on commit 87fafcd

Please sign in to comment.