aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/tegra/host/nvhost_intr.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/tegra/host/nvhost_intr.h')
-rw-r--r--drivers/video/tegra/host/nvhost_intr.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/drivers/video/tegra/host/nvhost_intr.h b/drivers/video/tegra/host/nvhost_intr.h
new file mode 100644
index 00000000000..26ab04ebd4a
--- /dev/null
+++ b/drivers/video/tegra/host/nvhost_intr.h
@@ -0,0 +1,115 @@
1/*
2 * drivers/video/tegra/host/nvhost_intr.h
3 *
4 * Tegra Graphics Host Interrupt Management
5 *
6 * Copyright (c) 2010-2012, NVIDIA Corporation.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __NVHOST_INTR_H
22#define __NVHOST_INTR_H
23
24#include <linux/kthread.h>
25#include <linux/semaphore.h>
26#include <linux/interrupt.h>
27
28struct nvhost_channel;
29
30enum nvhost_intr_action {
31 /**
32 * Perform cleanup after a submit has completed.
33 * 'data' points to a channel
34 */
35 NVHOST_INTR_ACTION_SUBMIT_COMPLETE = 0,
36
37 /**
38 * Save a HW context.
39 * 'data' points to a context
40 */
41 NVHOST_INTR_ACTION_CTXSAVE,
42
43 /**
44 * Wake up a task.
45 * 'data' points to a wait_queue_head_t
46 */
47 NVHOST_INTR_ACTION_WAKEUP,
48
49 /**
50 * Wake up a interruptible task.
51 * 'data' points to a wait_queue_head_t
52 */
53 NVHOST_INTR_ACTION_WAKEUP_INTERRUPTIBLE,
54
55 NVHOST_INTR_ACTION_COUNT
56};
57
58struct nvhost_intr;
59
60struct nvhost_intr_syncpt {
61 struct nvhost_intr *intr;
62 u8 id;
63 u8 irq_requested;
64 u16 irq;
65 spinlock_t lock;
66 struct list_head wait_head;
67 char thresh_irq_name[12];
68};
69
70struct nvhost_intr {
71 struct nvhost_intr_syncpt *syncpt;
72 struct mutex mutex;
73 int host_general_irq;
74 bool host_general_irq_requested;
75};
76#define intr_to_dev(x) container_of(x, struct nvhost_master, intr)
77#define intr_op(intr) (intr_to_dev(intr)->op.intr)
78#define intr_syncpt_to_intr(is) (is->intr)
79
80/**
81 * Schedule an action to be taken when a sync point reaches the given threshold.
82 *
83 * @id the sync point
84 * @thresh the threshold
85 * @action the action to take
86 * @data a pointer to extra data depending on action, see above
87 * @waiter waiter allocated with nvhost_intr_alloc_waiter - assumes ownership
88 * @ref must be passed if cancellation is possible, else NULL
89 *
90 * This is a non-blocking api.
91 */
92int nvhost_intr_add_action(struct nvhost_intr *intr, u32 id, u32 thresh,
93 enum nvhost_intr_action action, void *data,
94 void *waiter,
95 void **ref);
96
97/**
98 * Allocate a waiter.
99 */
100void *nvhost_intr_alloc_waiter(void);
101
102/**
103 * Unreference an action submitted to nvhost_intr_add_action().
104 * You must call this if you passed non-NULL as ref.
105 * @ref the ref returned from nvhost_intr_add_action()
106 */
107void nvhost_intr_put_ref(struct nvhost_intr *intr, void *ref);
108
109int nvhost_intr_init(struct nvhost_intr *intr, u32 irq_gen, u32 irq_sync);
110void nvhost_intr_deinit(struct nvhost_intr *intr);
111void nvhost_intr_start(struct nvhost_intr *intr, u32 hz);
112void nvhost_intr_stop(struct nvhost_intr *intr);
113
114irqreturn_t nvhost_syncpt_thresh_fn(int irq, void *dev_id);
115#endif