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 struct host1x *host = cdma_to_host1x(cdma); in cdma_start_timer_locked()
278 if (cdma->timeout.client) { in cdma_start_timer_locked()
283 cdma->timeout.client = job->client; in cdma_start_timer_locked()
284 cdma->timeout.syncpt = host1x_syncpt_get(host, job->syncpt_id); in cdma_start_timer_locked()
285 cdma->timeout.syncpt_val = job->syncpt_end; in cdma_start_timer_locked()
286 cdma->timeout.start_ktime = ktime_get(); in cdma_start_timer_locked()
288 schedule_delayed_work(&cdma->timeout.wq, in cdma_start_timer_locked()
296 static void stop_cdma_timer_locked(struct host1x_cdma *cdma) in stop_cdma_timer_locked() argument
298 cancel_delayed_work(&cdma->timeout.wq); in stop_cdma_timer_locked()
299 cdma->timeout.client = NULL; in stop_cdma_timer_locked()
312 static void update_cdma_locked(struct host1x_cdma *cdma) in update_cdma_locked() argument
315 struct host1x *host1x = cdma_to_host1x(cdma); in update_cdma_locked()
319 if (!cdma->running) in update_cdma_locked()
326 list_for_each_entry_safe(job, n, &cdma->sync_queue, list) { in update_cdma_locked()
334 cdma_start_timer_locked(cdma, job); in update_cdma_locked()
340 if (cdma->timeout.client) in update_cdma_locked()
341 stop_cdma_timer_locked(cdma); in update_cdma_locked()
348 struct push_buffer *pb = &cdma->push_buffer; in update_cdma_locked()
352 if (cdma->event == CDMA_EVENT_PUSH_BUFFER_SPACE) in update_cdma_locked()
360 if (cdma->event == CDMA_EVENT_SYNC_QUEUE_EMPTY && in update_cdma_locked()
361 list_empty(&cdma->sync_queue)) in update_cdma_locked()
365 cdma->event = CDMA_EVENT_NONE; in update_cdma_locked()
366 complete(&cdma->complete); in update_cdma_locked()
370 void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, in host1x_cdma_update_sync_queue() argument
373 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_update_sync_queue()
377 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); in host1x_cdma_update_sync_queue()
392 list_for_each_entry(job, &cdma->sync_queue, list) { in host1x_cdma_update_sync_queue()
395 if (!list_is_last(&job->list, &cdma->sync_queue)) in host1x_cdma_update_sync_queue()
418 restart_addr = cdma->last_pos; in host1x_cdma_update_sync_queue()
434 host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get, in host1x_cdma_update_sync_queue()
443 host1x_hw_cdma_resume(host1x, cdma, restart_addr); in host1x_cdma_update_sync_queue()
449 int host1x_cdma_init(struct host1x_cdma *cdma) in host1x_cdma_init() argument
453 mutex_init(&cdma->lock); in host1x_cdma_init()
454 init_completion(&cdma->complete); in host1x_cdma_init()
456 INIT_LIST_HEAD(&cdma->sync_queue); in host1x_cdma_init()
458 cdma->event = CDMA_EVENT_NONE; in host1x_cdma_init()
459 cdma->running = false; in host1x_cdma_init()
460 cdma->torndown = false; in host1x_cdma_init()
462 err = host1x_pushbuffer_init(&cdma->push_buffer); in host1x_cdma_init()
472 int host1x_cdma_deinit(struct host1x_cdma *cdma) in host1x_cdma_deinit() argument
474 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_deinit()
475 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_deinit()
477 if (cdma->running) { in host1x_cdma_deinit()
483 host1x_hw_cdma_timeout_destroy(host1x, cdma); in host1x_cdma_deinit()
491 int host1x_cdma_begin(struct host1x_cdma *cdma, struct host1x_job *job) in host1x_cdma_begin() argument
493 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_begin()
495 mutex_lock(&cdma->lock); in host1x_cdma_begin()
499 if (!cdma->timeout.initialized) { in host1x_cdma_begin()
502 err = host1x_hw_cdma_timeout_init(host1x, cdma, in host1x_cdma_begin()
505 mutex_unlock(&cdma->lock); in host1x_cdma_begin()
511 if (!cdma->running) in host1x_cdma_begin()
512 host1x_hw_cdma_start(host1x, cdma); in host1x_cdma_begin()
514 cdma->slots_free = 0; in host1x_cdma_begin()
515 cdma->slots_used = 0; in host1x_cdma_begin()
516 cdma->first_get = cdma->push_buffer.pos; in host1x_cdma_begin()
526 void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2) in host1x_cdma_push() argument
528 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_push()
529 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push()
530 u32 slots_free = cdma->slots_free; in host1x_cdma_push()
533 trace_host1x_cdma_push(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_push()
537 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_push()
538 slots_free = host1x_cdma_wait_locked(cdma, in host1x_cdma_push()
542 cdma->slots_free = slots_free - 1; in host1x_cdma_push()
543 cdma->slots_used++; in host1x_cdma_push()
556 void host1x_cdma_push_wide(struct host1x_cdma *cdma, u32 op1, u32 op2, in host1x_cdma_push_wide() argument
559 struct host1x_channel *channel = cdma_to_channel(cdma); in host1x_cdma_push_wide()
560 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_push_wide()
561 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push_wide()
563 unsigned int space = cdma->slots_free; in host1x_cdma_push_wide()
575 host1x_cdma_wait_pushbuffer_space(host1x, cdma, needed); in host1x_cdma_push_wide()
578 cdma->slots_free = space - needed; in host1x_cdma_push_wide()
579 cdma->slots_used += needed; in host1x_cdma_push_wide()
606 void host1x_cdma_end(struct host1x_cdma *cdma, in host1x_cdma_end() argument
609 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_end()
610 bool idle = list_empty(&cdma->sync_queue); in host1x_cdma_end()
612 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_end()
614 job->first_get = cdma->first_get; in host1x_cdma_end()
615 job->num_slots = cdma->slots_used; in host1x_cdma_end()
617 list_add_tail(&job->list, &cdma->sync_queue); in host1x_cdma_end()
621 cdma_start_timer_locked(cdma, job); in host1x_cdma_end()
624 mutex_unlock(&cdma->lock); in host1x_cdma_end()
630 void host1x_cdma_update(struct host1x_cdma *cdma) in host1x_cdma_update() argument
632 mutex_lock(&cdma->lock); in host1x_cdma_update()
633 update_cdma_locked(cdma); in host1x_cdma_update()
634 mutex_unlock(&cdma->lock); in host1x_cdma_update()