2 * drivers/video/tegra/host/nvhost_intr.h
4 * Tegra Graphics Host Interrupt Management
6 * Copyright (c) 2010, NVIDIA Corporation.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef __NVHOST_INTR_H
24 #define __NVHOST_INTR_H
26 #include <linux/kthread.h>
27 #include <linux/semaphore.h>
29 #include "nvhost_hardware.h"
31 struct nvhost_channel;
33 enum nvhost_intr_action {
35 * Perform cleanup after a submit has completed.
36 * 'data' points to a channel
38 NVHOST_INTR_ACTION_SUBMIT_COMPLETE = 0,
42 * 'data' points to a context
44 NVHOST_INTR_ACTION_CTXSAVE,
48 * 'data' points to a wait_queue_head_t
50 NVHOST_INTR_ACTION_WAKEUP,
53 * Wake up a interruptible task.
54 * 'data' points to a wait_queue_head_t
56 NVHOST_INTR_ACTION_WAKEUP_INTERRUPTIBLE,
58 NVHOST_INTR_ACTION_COUNT
61 struct nvhost_intr_syncpt {
66 struct list_head wait_head;
67 char thresh_irq_name[12];
71 struct nvhost_intr_syncpt syncpt[NV_HOST1X_SYNCPT_NB_PTS];
73 bool host1x_isr_started;
77 * Schedule an action to be taken when a sync point reaches the given threshold.
80 * @thresh the threshold
81 * @action the action to take
82 * @data a pointer to extra data depending on action, see above
83 * @ref must be passed if cancellation is possible, else NULL
85 * This is a non-blocking api.
87 int nvhost_intr_add_action(struct nvhost_intr *intr, u32 id, u32 thresh,
88 enum nvhost_intr_action action, void *data,
92 * Unreference an action submitted to nvhost_intr_add_action().
93 * You must call this if you passed non-NULL as ref.
94 * @ref the ref returned from nvhost_intr_add_action()
96 void nvhost_intr_put_ref(struct nvhost_intr *intr, void *ref);
98 int nvhost_intr_init(struct nvhost_intr *intr, u32 irq_gen, u32 irq_sync);
99 void nvhost_intr_deinit(struct nvhost_intr *intr);
100 void nvhost_intr_configure(struct nvhost_intr *intr, u32 hz);