Lines Matching +full:tegra186 +full:- +full:display
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (c) 2010-2015, NVIDIA Corporation.
10 #include <linux/dma-fence.h>
26 struct host1x_syncpt_base *bases = host->bases; in host1x_syncpt_base_request()
29 for (i = 0; i < host->info->nb_bases; i++) in host1x_syncpt_base_request()
33 if (i >= host->info->nb_bases) in host1x_syncpt_base_request()
43 base->requested = false; in host1x_syncpt_base_free()
47 * host1x_syncpt_alloc() - allocate a syncpoint
62 struct host1x_syncpt *sp = host->syncpt; in host1x_syncpt_alloc()
69 mutex_lock(&host->syncpt_mutex); in host1x_syncpt_alloc()
71 for (i = 0; i < host->info->nb_pts && kref_read(&sp->ref); i++, sp++) in host1x_syncpt_alloc()
74 if (i >= host->info->nb_pts) in host1x_syncpt_alloc()
78 sp->base = host1x_syncpt_base_request(host); in host1x_syncpt_alloc()
79 if (!sp->base) in host1x_syncpt_alloc()
83 full_name = kasprintf(GFP_KERNEL, "%u-%s", sp->id, name); in host1x_syncpt_alloc()
87 sp->name = full_name; in host1x_syncpt_alloc()
90 sp->client_managed = true; in host1x_syncpt_alloc()
92 sp->client_managed = false; in host1x_syncpt_alloc()
94 kref_init(&sp->ref); in host1x_syncpt_alloc()
96 mutex_unlock(&host->syncpt_mutex); in host1x_syncpt_alloc()
100 host1x_syncpt_base_free(sp->base); in host1x_syncpt_alloc()
101 sp->base = NULL; in host1x_syncpt_alloc()
103 mutex_unlock(&host->syncpt_mutex); in host1x_syncpt_alloc()
109 * host1x_syncpt_id() - retrieve syncpoint ID
118 return sp->id; in host1x_syncpt_id()
123 * host1x_syncpt_incr_max() - update the value sent to hardware
129 return (u32)atomic_add_return(incrs, &sp->max_val); in host1x_syncpt_incr_max()
138 struct host1x_syncpt *sp_base = host->syncpt; in host1x_syncpt_restore()
143 * Unassign syncpt from channels for purposes of Tegra186 in host1x_syncpt_restore()
165 struct host1x_syncpt *sp_base = host->syncpt; in host1x_syncpt_save()
187 val = host1x_hw_syncpt_load(sp->host, sp); in host1x_syncpt_load()
188 trace_host1x_syncpt_load_min(sp->id, val); in host1x_syncpt_load()
198 host1x_hw_syncpt_load_wait_base(sp->host, sp); in host1x_syncpt_load_wait_base()
200 return sp->base_val; in host1x_syncpt_load_wait_base()
204 * host1x_syncpt_incr() - increment syncpoint value from CPU, updating cache
209 return host1x_hw_syncpt_cpu_incr(sp->host, sp); in host1x_syncpt_incr()
214 * host1x_syncpt_wait() - wait for a syncpoint to reach a given value
226 host1x_hw_syncpt_load(sp->host, sp); in host1x_syncpt_wait()
237 return -EAGAIN; in host1x_syncpt_wait()
256 host1x_hw_syncpt_load(sp->host, sp); in host1x_syncpt_wait()
258 return -EAGAIN; in host1x_syncpt_wait()
275 current_val = (u32)atomic_read(&sp->min_val); in host1x_syncpt_is_expired()
277 return ((current_val - thresh) & 0x80000000U) == 0U; in host1x_syncpt_is_expired()
286 syncpt = devm_kcalloc(host->dev, host->info->nb_pts, sizeof(*syncpt), in host1x_syncpt_init()
289 return -ENOMEM; in host1x_syncpt_init()
291 bases = devm_kcalloc(host->dev, host->info->nb_bases, sizeof(*bases), in host1x_syncpt_init()
294 return -ENOMEM; in host1x_syncpt_init()
296 for (i = 0; i < host->info->nb_pts; i++) { in host1x_syncpt_init()
301 for (i = 0; i < host->info->nb_bases; i++) in host1x_syncpt_init()
304 mutex_init(&host->syncpt_mutex); in host1x_syncpt_init()
305 host->syncpt = syncpt; in host1x_syncpt_init()
306 host->bases = bases; in host1x_syncpt_init()
309 host->nop_sp = host1x_syncpt_alloc(host, 0, "reserved-nop"); in host1x_syncpt_init()
310 if (!host->nop_sp) in host1x_syncpt_init()
311 return -ENOMEM; in host1x_syncpt_init()
313 if (host->info->reserve_vblank_syncpts) { in host1x_syncpt_init()
314 kref_init(&host->syncpt[26].ref); in host1x_syncpt_init()
315 kref_init(&host->syncpt[27].ref); in host1x_syncpt_init()
322 * host1x_syncpt_request() - request a syncpoint
334 struct host1x *host = dev_get_drvdata(client->host->parent); in host1x_syncpt_request()
336 return host1x_syncpt_alloc(host, flags, dev_name(client->dev)); in host1x_syncpt_request()
344 atomic_set(&sp->max_val, host1x_syncpt_read(sp)); in syncpt_release()
346 sp->locked = false; in syncpt_release()
348 mutex_lock(&sp->host->syncpt_mutex); in syncpt_release()
350 host1x_syncpt_base_free(sp->base); in syncpt_release()
351 kfree(sp->name); in syncpt_release()
352 sp->base = NULL; in syncpt_release()
353 sp->name = NULL; in syncpt_release()
354 sp->client_managed = false; in syncpt_release()
356 mutex_unlock(&sp->host->syncpt_mutex); in syncpt_release()
360 * host1x_syncpt_put() - free a requested syncpoint
372 kref_put(&sp->ref, syncpt_release); in host1x_syncpt_put()
378 struct host1x_syncpt *sp = host->syncpt; in host1x_syncpt_deinit()
381 for (i = 0; i < host->info->nb_pts; i++, sp++) in host1x_syncpt_deinit()
382 kfree(sp->name); in host1x_syncpt_deinit()
386 * host1x_syncpt_read_max() - read maximum syncpoint value
396 return (u32)atomic_read(&sp->max_val); in host1x_syncpt_read_max()
401 * host1x_syncpt_read_min() - read minimum syncpoint value
411 return (u32)atomic_read(&sp->min_val); in host1x_syncpt_read_min()
416 * host1x_syncpt_read() - read the current syncpoint value
427 return host->info->nb_pts; in host1x_syncpt_nb_pts()
432 return host->info->nb_bases; in host1x_syncpt_nb_bases()
437 return host->info->nb_mlocks; in host1x_syncpt_nb_mlocks()
441 * host1x_syncpt_get_by_id() - obtain a syncpoint by ID
448 if (id >= host->info->nb_pts) in host1x_syncpt_get_by_id()
451 if (kref_get_unless_zero(&host->syncpt[id].ref)) in host1x_syncpt_get_by_id()
452 return &host->syncpt[id]; in host1x_syncpt_get_by_id()
459 * host1x_syncpt_get_by_id_noref() - obtain a syncpoint by ID but don't
467 if (id >= host->info->nb_pts) in host1x_syncpt_get_by_id_noref()
470 return &host->syncpt[id]; in host1x_syncpt_get_by_id_noref()
475 * host1x_syncpt_get() - increment syncpoint refcount
480 kref_get(&sp->ref); in host1x_syncpt_get()
487 * host1x_syncpt_get_base() - obtain the wait base associated with a syncpoint
492 return sp ? sp->base : NULL; in host1x_syncpt_get_base()
497 * host1x_syncpt_base_id() - retrieve the ID of a syncpoint wait base
502 return base->id; in host1x_syncpt_base_id()
511 * host1x_syncpt_release_vblank_reservation() - Make VBLANK syncpoint
518 * reserved at initialization time. This should be called by the display
525 struct host1x *host = dev_get_drvdata(client->host->parent); in host1x_syncpt_release_vblank_reservation()
527 if (!host->info->reserve_vblank_syncpts) in host1x_syncpt_release_vblank_reservation()
530 kref_put(&host->syncpt[syncpt_id].ref, do_nothing); in host1x_syncpt_release_vblank_reservation()