Lines Matching +full:host1x +full:- +full:class
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Tegra host1x Command DMA
5 * Copyright (c) 2010-2013, NVIDIA Corporation.
10 #include <linux/dma-mapping.h>
22 *(u32 *)(pb->mapped + pb->size) = host1x_opcode_restart(0); in push_buffer_init()
34 host1x_syncpt_incr(cdma->timeout.syncpt); in cdma_timeout_cpu_incr()
37 host1x_syncpt_load(cdma->timeout.syncpt); in cdma_timeout_cpu_incr()
48 if (cdma->running) in cdma_start()
51 cdma->last_pos = cdma->push_buffer.pos; in cdma_start()
52 start = cdma->push_buffer.dma; in cdma_start()
53 end = cdma->push_buffer.size + 4; in cdma_start()
63 host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT); in cdma_start()
81 cdma->running = true; in cdma_start()
91 struct host1x *host1x = cdma_to_host1x(cdma); in cdma_timeout_restart() local
95 if (cdma->running) in cdma_timeout_restart()
98 cdma->last_pos = cdma->push_buffer.pos; in cdma_timeout_restart()
103 start = cdma->push_buffer.dma; in cdma_timeout_restart()
104 end = cdma->push_buffer.size + 4; in cdma_timeout_restart()
123 dev_dbg(host1x->dev, in cdma_timeout_restart()
127 cdma->last_pos); in cdma_timeout_restart()
132 host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT); in cdma_timeout_restart()
137 cdma->running = true; in cdma_timeout_restart()
147 if (cdma->push_buffer.pos != cdma->last_pos) { in cdma_flush()
148 host1x_ch_writel(ch, cdma->push_buffer.pos, in cdma_flush()
150 cdma->last_pos = cdma->push_buffer.pos; in cdma_flush()
158 mutex_lock(&cdma->lock); in cdma_stop()
160 if (cdma->running) { in cdma_stop()
164 cdma->running = false; in cdma_stop()
167 mutex_unlock(&cdma->lock); in cdma_stop()
170 static void cdma_hw_cmdproc_stop(struct host1x *host, struct host1x_channel *ch, in cdma_hw_cmdproc_stop()
178 cmdproc_stop |= BIT(ch->id); in cdma_hw_cmdproc_stop()
180 cmdproc_stop &= ~BIT(ch->id); in cdma_hw_cmdproc_stop()
185 static void cdma_hw_teardown(struct host1x *host, struct host1x_channel *ch) in cdma_hw_teardown()
190 host1x_sync_writel(host, BIT(ch->id), HOST1X_SYNC_CH_TEARDOWN); in cdma_hw_teardown()
200 struct host1x *host = cdma_to_host1x(cdma); in cdma_freeze()
203 if (cdma->torndown && !cdma->running) { in cdma_freeze()
204 dev_warn(host->dev, "Already torn down\n"); in cdma_freeze()
208 dev_dbg(host->dev, "freezing channel (id %d)\n", ch->id); in cdma_freeze()
212 dev_dbg(host->dev, "%s: DMA GET 0x%x, PUT HW 0x%x / shadow 0x%x\n", in cdma_freeze()
215 cdma->last_pos); in cdma_freeze()
222 cdma->running = false; in cdma_freeze()
223 cdma->torndown = true; in cdma_freeze()
228 struct host1x *host1x = cdma_to_host1x(cdma); in cdma_resume() local
231 dev_dbg(host1x->dev, in cdma_resume()
233 ch->id, getptr); in cdma_resume()
235 cdma_hw_cmdproc_stop(host1x, ch, false); in cdma_resume()
237 cdma->torndown = false; in cdma_resume()
253 struct host1x *host1x = cdma_to_host1x(cdma); in timeout_release_mlock() local
256 switch (ch->client->class) { in timeout_release_mlock()
264 WARN(1, "%s was not updated for class %u", __func__, ch->client->class); in timeout_release_mlock()
268 host1x_common_writel(host1x, 0x0, offset); in timeout_release_mlock()
281 struct host1x *host1x; in cdma_timeout_handler() local
286 host1x = cdma_to_host1x(cdma); in cdma_timeout_handler()
291 mutex_lock(&cdma->lock); in cdma_timeout_handler()
293 if (!cdma->timeout.client) { in cdma_timeout_handler()
294 dev_dbg(host1x->dev, in cdma_timeout_handler()
296 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
301 cdma_hw_cmdproc_stop(host1x, ch, true); in cdma_timeout_handler()
303 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); in cdma_timeout_handler()
306 if ((s32)(syncpt_val - cdma->timeout.syncpt_val) >= 0) { in cdma_timeout_handler()
307 dev_dbg(host1x->dev, in cdma_timeout_handler()
310 cdma_hw_cmdproc_stop(host1x, ch, false); in cdma_timeout_handler()
311 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
315 dev_warn(host1x->dev, "%s: timeout: %u (%s), HW thresh %d, done %d\n", in cdma_timeout_handler()
316 __func__, cdma->timeout.syncpt->id, cdma->timeout.syncpt->name, in cdma_timeout_handler()
317 syncpt_val, cdma->timeout.syncpt_val); in cdma_timeout_handler()
320 host1x_hw_cdma_freeze(host1x, cdma); in cdma_timeout_handler()
325 host1x_cdma_update_sync_queue(cdma, ch->dev); in cdma_timeout_handler()
326 mutex_unlock(&cdma->lock); in cdma_timeout_handler()
334 INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler); in cdma_timeout_init()
335 cdma->timeout.initialized = true; in cdma_timeout_init()
345 if (cdma->timeout.initialized) in cdma_timeout_destroy()
346 cancel_delayed_work(&cdma->timeout.wq); in cdma_timeout_destroy()
348 cdma->timeout.initialized = false; in cdma_timeout_destroy()