Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Mikko Perttunen and committed by
Thierry Reding
87fafcd5 9764723d

+21
+19
drivers/gpu/host1x/channel.c
··· 81 81 } 82 82 EXPORT_SYMBOL(host1x_channel_stop); 83 83 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 + 84 103 static void release_channel(struct kref *kref) 85 104 { 86 105 struct host1x_channel *channel =
+1
drivers/gpu/host1x/channel.h
··· 40 40 void host1x_channel_list_free(struct host1x_channel_list *chlist); 41 41 struct host1x_channel *host1x_channel_get_index(struct host1x *host, 42 42 unsigned int index); 43 + void host1x_channel_stop_all(struct host1x *host); 43 44 44 45 #endif
+1
drivers/gpu/host1x/dev.c
··· 655 655 struct host1x *host = dev_get_drvdata(dev); 656 656 int err; 657 657 658 + host1x_channel_stop_all(host); 658 659 host1x_intr_stop(host); 659 660 host1x_syncpt_save(host); 660 661