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()
67 struct host1x_cdma *cdma = pb_to_cdma(pb); in host1x_pushbuffer_init() local
68 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_pushbuffer_init()
133 unsigned int host1x_cdma_wait_locked(struct host1x_cdma *cdma, in host1x_cdma_wait_locked() argument
140 space = list_empty(&cdma->sync_queue) ? 1 : 0; in host1x_cdma_wait_locked()
142 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_wait_locked()
152 trace_host1x_wait_cdma(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_wait_locked()
156 if (cdma->event != CDMA_EVENT_NONE) { in host1x_cdma_wait_locked()
157 mutex_unlock(&cdma->lock); in host1x_cdma_wait_locked()
159 mutex_lock(&cdma->lock); in host1x_cdma_wait_locked()
162 cdma->event = event; in host1x_cdma_wait_locked()
164 mutex_unlock(&cdma->lock); in host1x_cdma_wait_locked()
165 down(&cdma->sem); in host1x_cdma_wait_locked()
166 mutex_lock(&cdma->lock); in host1x_cdma_wait_locked()
175 static void cdma_start_timer_locked(struct host1x_cdma *cdma, in cdma_start_timer_locked() argument
178 struct host1x *host = cdma_to_host1x(cdma); in cdma_start_timer_locked()
180 if (cdma->timeout.client) { in cdma_start_timer_locked()
185 cdma->timeout.client = job->client; in cdma_start_timer_locked()
186 cdma->timeout.syncpt = host1x_syncpt_get(host, job->syncpt_id); in cdma_start_timer_locked()
187 cdma->timeout.syncpt_val = job->syncpt_end; in cdma_start_timer_locked()
188 cdma->timeout.start_ktime = ktime_get(); in cdma_start_timer_locked()
190 schedule_delayed_work(&cdma->timeout.wq, in cdma_start_timer_locked()
198 static void stop_cdma_timer_locked(struct host1x_cdma *cdma) in stop_cdma_timer_locked() argument
200 cancel_delayed_work(&cdma->timeout.wq); in stop_cdma_timer_locked()
201 cdma->timeout.client = 0; in stop_cdma_timer_locked()
214 static void update_cdma_locked(struct host1x_cdma *cdma) in update_cdma_locked() argument
217 struct host1x *host1x = cdma_to_host1x(cdma); in update_cdma_locked()
221 if (!cdma->running) in update_cdma_locked()
228 list_for_each_entry_safe(job, n, &cdma->sync_queue, list) { in update_cdma_locked()
236 cdma_start_timer_locked(cdma, job); in update_cdma_locked()
241 if (cdma->timeout.client) in update_cdma_locked()
242 stop_cdma_timer_locked(cdma); in update_cdma_locked()
249 struct push_buffer *pb = &cdma->push_buffer; in update_cdma_locked()
251 if (cdma->event == CDMA_EVENT_PUSH_BUFFER_SPACE) in update_cdma_locked()
259 if (cdma->event == CDMA_EVENT_SYNC_QUEUE_EMPTY && in update_cdma_locked()
260 list_empty(&cdma->sync_queue)) in update_cdma_locked()
264 cdma->event = CDMA_EVENT_NONE; in update_cdma_locked()
265 up(&cdma->sem); in update_cdma_locked()
269 void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, in host1x_cdma_update_sync_queue() argument
276 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_update_sync_queue()
278 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); in host1x_cdma_update_sync_queue()
293 list_for_each_entry(job, &cdma->sync_queue, list) { in host1x_cdma_update_sync_queue()
318 if (!list_empty(&cdma->sync_queue)) in host1x_cdma_update_sync_queue()
321 restart_addr = cdma->last_pos; in host1x_cdma_update_sync_queue()
324 list_for_each_entry_from(job, &cdma->sync_queue, list) { in host1x_cdma_update_sync_queue()
326 if (job->client != cdma->timeout.client) in host1x_cdma_update_sync_queue()
338 host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get, in host1x_cdma_update_sync_queue()
349 list_for_each_entry_from(job, &cdma->sync_queue, list) in host1x_cdma_update_sync_queue()
350 if (job->client == cdma->timeout.client) in host1x_cdma_update_sync_queue()
356 host1x_hw_cdma_resume(host1x, cdma, restart_addr); in host1x_cdma_update_sync_queue()
362 int host1x_cdma_init(struct host1x_cdma *cdma) in host1x_cdma_init() argument
366 mutex_init(&cdma->lock); in host1x_cdma_init()
367 sema_init(&cdma->sem, 0); in host1x_cdma_init()
369 INIT_LIST_HEAD(&cdma->sync_queue); in host1x_cdma_init()
371 cdma->event = CDMA_EVENT_NONE; in host1x_cdma_init()
372 cdma->running = false; in host1x_cdma_init()
373 cdma->torndown = false; in host1x_cdma_init()
375 err = host1x_pushbuffer_init(&cdma->push_buffer); in host1x_cdma_init()
384 int host1x_cdma_deinit(struct host1x_cdma *cdma) in host1x_cdma_deinit() argument
386 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_deinit()
387 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_deinit()
389 if (cdma->running) { in host1x_cdma_deinit()
395 host1x_hw_cdma_timeout_destroy(host1x, cdma); in host1x_cdma_deinit()
403 int host1x_cdma_begin(struct host1x_cdma *cdma, struct host1x_job *job) in host1x_cdma_begin() argument
405 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_begin()
407 mutex_lock(&cdma->lock); in host1x_cdma_begin()
411 if (!cdma->timeout.initialized) { in host1x_cdma_begin()
413 err = host1x_hw_cdma_timeout_init(host1x, cdma, in host1x_cdma_begin()
416 mutex_unlock(&cdma->lock); in host1x_cdma_begin()
421 if (!cdma->running) in host1x_cdma_begin()
422 host1x_hw_cdma_start(host1x, cdma); in host1x_cdma_begin()
424 cdma->slots_free = 0; in host1x_cdma_begin()
425 cdma->slots_used = 0; in host1x_cdma_begin()
426 cdma->first_get = cdma->push_buffer.pos; in host1x_cdma_begin()
436 void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2) in host1x_cdma_push() argument
438 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_push()
439 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push()
440 u32 slots_free = cdma->slots_free; in host1x_cdma_push()
443 trace_host1x_cdma_push(dev_name(cdma_to_channel(cdma)->dev), in host1x_cdma_push()
447 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_push()
448 slots_free = host1x_cdma_wait_locked(cdma, in host1x_cdma_push()
451 cdma->slots_free = slots_free - 1; in host1x_cdma_push()
452 cdma->slots_used++; in host1x_cdma_push()
462 void host1x_cdma_end(struct host1x_cdma *cdma, in host1x_cdma_end() argument
465 struct host1x *host1x = cdma_to_host1x(cdma); in host1x_cdma_end()
466 bool idle = list_empty(&cdma->sync_queue); in host1x_cdma_end()
468 host1x_hw_cdma_flush(host1x, cdma); in host1x_cdma_end()
470 job->first_get = cdma->first_get; in host1x_cdma_end()
471 job->num_slots = cdma->slots_used; in host1x_cdma_end()
473 list_add_tail(&job->list, &cdma->sync_queue); in host1x_cdma_end()
477 cdma_start_timer_locked(cdma, job); in host1x_cdma_end()
480 mutex_unlock(&cdma->lock); in host1x_cdma_end()
486 void host1x_cdma_update(struct host1x_cdma *cdma) in host1x_cdma_update() argument
488 mutex_lock(&cdma->lock); in host1x_cdma_update()
489 update_cdma_locked(cdma); in host1x_cdma_update()
490 mutex_unlock(&cdma->lock); in host1x_cdma_update()