Lines Matching refs:cdma
51 struct host1x_cdma *cdma = pb_to_cdma(pb); in host1x_pushbuffer_destroy() local
52 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_pushbuffer_destroy()
73 struct host1x_cdma *cdma = pb_to_cdma(pb); in host1x_pushbuffer_init() local
74 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_pushbuffer_init()
175 unsigned int host1x_cdma_wait_locked(struct host1x_cdma *cdma, in host1x_cdma_wait_locked() argument
179 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_wait_locked()
184 space = list_empty(&cdma->sync_queue) ? 1 : 0; in host1x_cdma_wait_locked()
199 trace_host1x_wait_cdma(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_wait_locked()
203 if (cdma->event != CDMA_EVENT_NONE) { in host1x_cdma_wait_locked()
204 mutex_unlock(&cdma->lock); in host1x_cdma_wait_locked()
206 mutex_lock(&cdma->lock); in host1x_cdma_wait_locked()
210 cdma->event = event; in host1x_cdma_wait_locked()
212 mutex_unlock(&cdma->lock); in host1x_cdma_wait_locked()
213 down(&cdma->sem); in host1x_cdma_wait_locked()
214 mutex_lock(&cdma->lock); in host1x_cdma_wait_locked()
224 static void cdma_start_timer_locked(struct host1x_cdma *cdma, in cdma_start_timer_locked() argument
227 struct host1x *host = cdma_to_host1x(cdma); in cdma_start_timer_locked()
229 if (cdma->timeout.client) { in cdma_start_timer_locked()
234 cdma->timeout.client = job->client; in cdma_start_timer_locked()
235 cdma->timeout.syncpt = host1x_syncpt_get(host, job->syncpt_id); in cdma_start_timer_locked()
236 cdma->timeout.syncpt_val = job->syncpt_end; in cdma_start_timer_locked()
237 cdma->timeout.start_ktime = ktime_get(); in cdma_start_timer_locked()
239 schedule_delayed_work(&cdma->timeout.wq, in cdma_start_timer_locked()
247 static void stop_cdma_timer_locked(struct host1x_cdma *cdma) in stop_cdma_timer_locked() argument
249 cancel_delayed_work(&cdma->timeout.wq); in stop_cdma_timer_locked()
250 cdma->timeout.client = NULL; in stop_cdma_timer_locked()
263 static void update_cdma_locked(struct host1x_cdma *cdma) in update_cdma_locked() argument
266 struct host1x *host1x = cdma_to_host1x(cdma); in update_cdma_locked()
270 if (!cdma->running) in update_cdma_locked()
277 list_for_each_entry_safe(job, n, &cdma->sync_queue, list) { in update_cdma_locked()
285 cdma_start_timer_locked(cdma, job); in update_cdma_locked()
291 if (cdma->timeout.client) in update_cdma_locked()
292 stop_cdma_timer_locked(cdma); in update_cdma_locked()
299 struct push_buffer *pb = &cdma->push_buffer; in update_cdma_locked()
303 if (cdma->event == CDMA_EVENT_PUSH_BUFFER_SPACE) in update_cdma_locked()
311 if (cdma->event == CDMA_EVENT_SYNC_QUEUE_EMPTY && in update_cdma_locked()
312 list_empty(&cdma->sync_queue)) in update_cdma_locked()
316 cdma->event = CDMA_EVENT_NONE; in update_cdma_locked()
317 up(&cdma->sem); in update_cdma_locked()
321 void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, in host1x_cdma_update_sync_queue() argument
324 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_update_sync_queue()
328 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); in host1x_cdma_update_sync_queue()
343 list_for_each_entry(job, &cdma->sync_queue, list) { in host1x_cdma_update_sync_queue()
368 if (!list_empty(&cdma->sync_queue)) in host1x_cdma_update_sync_queue()
371 restart_addr = cdma->last_pos; in host1x_cdma_update_sync_queue()
374 list_for_each_entry_from(job, &cdma->sync_queue, list) { in host1x_cdma_update_sync_queue()
376 if (job->client != cdma->timeout.client) in host1x_cdma_update_sync_queue()
388 host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get, in host1x_cdma_update_sync_queue()
401 list_for_each_entry_from(job, &cdma->sync_queue, list) in host1x_cdma_update_sync_queue()
402 if (job->client == cdma->timeout.client) in host1x_cdma_update_sync_queue()
408 host1x_hw_cdma_resume(host1x, cdma, restart_addr); in host1x_cdma_update_sync_queue()
414 int host1x_cdma_init(struct host1x_cdma *cdma) in host1x_cdma_init() argument
418 mutex_init(&cdma->lock); in host1x_cdma_init()
419 sema_init(&cdma->sem, 0); in host1x_cdma_init()
421 INIT_LIST_HEAD(&cdma->sync_queue); in host1x_cdma_init()
423 cdma->event = CDMA_EVENT_NONE; in host1x_cdma_init()
424 cdma->running = false; in host1x_cdma_init()
425 cdma->torndown = false; in host1x_cdma_init()
427 err = host1x_pushbuffer_init(&cdma->push_buffer); in host1x_cdma_init()
437 int host1x_cdma_deinit(struct host1x_cdma *cdma) in host1x_cdma_deinit() argument
439 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_deinit()
440 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_deinit()
442 if (cdma->running) { in host1x_cdma_deinit()
448 host1x_hw_cdma_timeout_destroy(host1x, cdma); in host1x_cdma_deinit()
456 int host1x_cdma_begin(struct host1x_cdma *cdma, struct host1x_job *job) in host1x_cdma_begin() argument
458 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_begin()
460 mutex_lock(&cdma->lock); in host1x_cdma_begin()
464 if (!cdma->timeout.initialized) { in host1x_cdma_begin()
467 err = host1x_hw_cdma_timeout_init(host1x, cdma, in host1x_cdma_begin()
470 mutex_unlock(&cdma->lock); in host1x_cdma_begin()
476 if (!cdma->running) in host1x_cdma_begin()
477 host1x_hw_cdma_start(host1x, cdma); in host1x_cdma_begin()
479 cdma->slots_free = 0; in host1x_cdma_begin()
480 cdma->slots_used = 0; in host1x_cdma_begin()
481 cdma->first_get = cdma->push_buffer.pos; in host1x_cdma_begin()
491 void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2) in host1x_cdma_push() argument
493 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_push()
494 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push()
495 u32 slots_free = cdma->slots_free; in host1x_cdma_push()
498 trace_host1x_cdma_push(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_push()
502 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_push()
503 slots_free = host1x_cdma_wait_locked(cdma, in host1x_cdma_push()
507 cdma->slots_free = slots_free - 1; in host1x_cdma_push()
508 cdma->slots_used++; in host1x_cdma_push()
518 void host1x_cdma_end(struct host1x_cdma *cdma, in host1x_cdma_end() argument
521 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_end()
522 bool idle = list_empty(&cdma->sync_queue); in host1x_cdma_end()
524 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_end()
526 job->first_get = cdma->first_get; in host1x_cdma_end()
527 job->num_slots = cdma->slots_used; in host1x_cdma_end()
529 list_add_tail(&job->list, &cdma->sync_queue); in host1x_cdma_end()
533 cdma_start_timer_locked(cdma, job); in host1x_cdma_end()
536 mutex_unlock(&cdma->lock); in host1x_cdma_end()
542 void host1x_cdma_update(struct host1x_cdma *cdma) in host1x_cdma_update() argument
544 mutex_lock(&cdma->lock); in host1x_cdma_update()
545 update_cdma_locked(cdma); in host1x_cdma_update()
546 mutex_unlock(&cdma->lock); in host1x_cdma_update()