Lines Matching refs:cdma
50 struct host1x_cdma *cdma = pb_to_cdma(pb); in host1x_pushbuffer_destroy() local
51 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_pushbuffer_destroy()
72 struct host1x_cdma *cdma = pb_to_cdma(pb); in host1x_pushbuffer_init() local
73 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_pushbuffer_init()
185 unsigned int host1x_cdma_wait_locked(struct host1x_cdma *cdma, in host1x_cdma_wait_locked() argument
189 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_wait_locked()
194 space = list_empty(&cdma->sync_queue) ? 1 : 0; in host1x_cdma_wait_locked()
209 trace_host1x_wait_cdma(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_wait_locked()
213 if (cdma->event != CDMA_EVENT_NONE) { in host1x_cdma_wait_locked()
214 mutex_unlock(&cdma->lock); in host1x_cdma_wait_locked()
216 mutex_lock(&cdma->lock); in host1x_cdma_wait_locked()
220 cdma->event = event; in host1x_cdma_wait_locked()
222 mutex_unlock(&cdma->lock); in host1x_cdma_wait_locked()
223 wait_for_completion(&cdma->complete); in host1x_cdma_wait_locked()
224 mutex_lock(&cdma->lock); in host1x_cdma_wait_locked()
236 struct host1x_cdma *cdma, in host1x_cdma_wait_pushbuffer_space() argument
240 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_wait_pushbuffer_space()
247 trace_host1x_wait_cdma(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_wait_pushbuffer_space()
250 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_wait_pushbuffer_space()
253 if (cdma->event != CDMA_EVENT_NONE) { in host1x_cdma_wait_pushbuffer_space()
254 mutex_unlock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
256 mutex_lock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
260 cdma->event = CDMA_EVENT_PUSH_BUFFER_SPACE; in host1x_cdma_wait_pushbuffer_space()
262 mutex_unlock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
263 wait_for_completion(&cdma->complete); in host1x_cdma_wait_pushbuffer_space()
264 mutex_lock(&cdma->lock); in host1x_cdma_wait_pushbuffer_space()
273 static void cdma_start_timer_locked(struct host1x_cdma *cdma, in cdma_start_timer_locked() argument
276 if (cdma->timeout.client) { in cdma_start_timer_locked()
281 cdma->timeout.client = job->client; in cdma_start_timer_locked()
282 cdma->timeout.syncpt = job->syncpt; in cdma_start_timer_locked()
283 cdma->timeout.syncpt_val = job->syncpt_end; in cdma_start_timer_locked()
284 cdma->timeout.start_ktime = ktime_get(); in cdma_start_timer_locked()
286 schedule_delayed_work(&cdma->timeout.wq, in cdma_start_timer_locked()
294 static void stop_cdma_timer_locked(struct host1x_cdma *cdma) in stop_cdma_timer_locked() argument
296 cancel_delayed_work(&cdma->timeout.wq); in stop_cdma_timer_locked()
297 cdma->timeout.client = NULL; in stop_cdma_timer_locked()
310 static void update_cdma_locked(struct host1x_cdma *cdma) in update_cdma_locked() argument
319 list_for_each_entry_safe(job, n, &cdma->sync_queue, list) { in update_cdma_locked()
327 cdma_start_timer_locked(cdma, job); in update_cdma_locked()
333 if (cdma->timeout.client) in update_cdma_locked()
334 stop_cdma_timer_locked(cdma); in update_cdma_locked()
341 struct push_buffer *pb = &cdma->push_buffer; in update_cdma_locked()
345 if (cdma->event == CDMA_EVENT_PUSH_BUFFER_SPACE) in update_cdma_locked()
353 if (cdma->event == CDMA_EVENT_SYNC_QUEUE_EMPTY && in update_cdma_locked()
354 list_empty(&cdma->sync_queue)) in update_cdma_locked()
358 cdma->event = CDMA_EVENT_NONE; in update_cdma_locked()
359 complete(&cdma->complete); in update_cdma_locked()
363 void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, in host1x_cdma_update_sync_queue() argument
366 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_update_sync_queue()
370 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); in host1x_cdma_update_sync_queue()
385 list_for_each_entry(job, &cdma->sync_queue, list) { in host1x_cdma_update_sync_queue()
388 if (!list_is_last(&job->list, &cdma->sync_queue)) in host1x_cdma_update_sync_queue()
411 restart_addr = cdma->last_pos; in host1x_cdma_update_sync_queue()
430 host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get, in host1x_cdma_update_sync_queue()
444 list_for_each_entry_continue(job, &cdma->sync_queue, list) { in host1x_cdma_update_sync_queue()
453 u32 *mapped = cdma->push_buffer.mapped; in host1x_cdma_update_sync_queue()
470 update_cdma_locked(cdma); in host1x_cdma_update_sync_queue()
475 host1x_hw_cdma_resume(host1x, cdma, restart_addr); in host1x_cdma_update_sync_queue()
481 int host1x_cdma_init(struct host1x_cdma *cdma) in host1x_cdma_init() argument
485 mutex_init(&cdma->lock); in host1x_cdma_init()
486 init_completion(&cdma->complete); in host1x_cdma_init()
488 INIT_LIST_HEAD(&cdma->sync_queue); in host1x_cdma_init()
490 cdma->event = CDMA_EVENT_NONE; in host1x_cdma_init()
491 cdma->running = false; in host1x_cdma_init()
492 cdma->torndown = false; in host1x_cdma_init()
494 err = host1x_pushbuffer_init(&cdma->push_buffer); in host1x_cdma_init()
504 int host1x_cdma_deinit(struct host1x_cdma *cdma) in host1x_cdma_deinit() argument
506 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_deinit()
507 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_deinit()
509 if (cdma->running) { in host1x_cdma_deinit()
515 host1x_hw_cdma_timeout_destroy(host1x, cdma); in host1x_cdma_deinit()
523 int host1x_cdma_begin(struct host1x_cdma *cdma, struct host1x_job *job) in host1x_cdma_begin() argument
525 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_begin()
527 mutex_lock(&cdma->lock); in host1x_cdma_begin()
535 mutex_unlock(&cdma->lock); in host1x_cdma_begin()
541 if (!cdma->timeout.initialized) { in host1x_cdma_begin()
544 err = host1x_hw_cdma_timeout_init(host1x, cdma); in host1x_cdma_begin()
546 mutex_unlock(&cdma->lock); in host1x_cdma_begin()
552 if (!cdma->running) in host1x_cdma_begin()
553 host1x_hw_cdma_start(host1x, cdma); in host1x_cdma_begin()
555 cdma->slots_free = 0; in host1x_cdma_begin()
556 cdma->slots_used = 0; in host1x_cdma_begin()
557 cdma->first_get = cdma->push_buffer.pos; in host1x_cdma_begin()
567 void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2) in host1x_cdma_push() argument
569 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_push()
570 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push()
571 u32 slots_free = cdma->slots_free; in host1x_cdma_push()
574 trace_host1x_cdma_push(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_push()
578 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_push()
579 slots_free = host1x_cdma_wait_locked(cdma, in host1x_cdma_push()
583 cdma->slots_free = slots_free - 1; in host1x_cdma_push()
584 cdma->slots_used++; in host1x_cdma_push()
597 void host1x_cdma_push_wide(struct host1x_cdma *cdma, u32 op1, u32 op2, in host1x_cdma_push_wide() argument
600 struct host1x_channel *channel = cdma_to_channel(cdma); in host1x_cdma_push_wide()
601 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_push_wide()
602 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push_wide()
604 unsigned int space = cdma->slots_free; in host1x_cdma_push_wide()
616 host1x_cdma_wait_pushbuffer_space(host1x, cdma, needed); in host1x_cdma_push_wide()
619 cdma->slots_free = space - needed; in host1x_cdma_push_wide()
620 cdma->slots_used += needed; in host1x_cdma_push_wide()
647 void host1x_cdma_end(struct host1x_cdma *cdma, in host1x_cdma_end() argument
650 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_end()
651 bool idle = list_empty(&cdma->sync_queue); in host1x_cdma_end()
653 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_end()
655 job->first_get = cdma->first_get; in host1x_cdma_end()
656 job->num_slots = cdma->slots_used; in host1x_cdma_end()
658 list_add_tail(&job->list, &cdma->sync_queue); in host1x_cdma_end()
662 cdma_start_timer_locked(cdma, job); in host1x_cdma_end()
665 mutex_unlock(&cdma->lock); in host1x_cdma_end()
671 void host1x_cdma_update(struct host1x_cdma *cdma) in host1x_cdma_update() argument
673 mutex_lock(&cdma->lock); in host1x_cdma_update()
674 update_cdma_locked(cdma); in host1x_cdma_update()
675 mutex_unlock(&cdma->lock); in host1x_cdma_update()