Linux Audio

Check our new training course

Loading...
v4.6
 
  1/*
  2 * Tegra host1x Interrupt Management
  3 *
  4 * Copyright (c) 2010-2013, NVIDIA Corporation.
  5 *
  6 * This program is free software; you can redistribute it and/or modify it
  7 * under the terms and conditions of the GNU General Public License,
  8 * version 2, as published by the Free Software Foundation.
  9 *
 10 * This program is distributed in the hope it will be useful, but WITHOUT
 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 13 * more details.
 14 *
 15 * You should have received a copy of the GNU General Public License
 16 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 17 */
 18
 19#ifndef __HOST1X_INTR_H
 20#define __HOST1X_INTR_H
 21
 22#include <linux/interrupt.h>
 23#include <linux/workqueue.h>
 24
 
 25struct host1x;
 26
 27enum host1x_intr_action {
 28	/*
 29	 * Perform cleanup after a submit has completed.
 30	 * 'data' points to a channel
 31	 */
 32	HOST1X_INTR_ACTION_SUBMIT_COMPLETE = 0,
 33
 34	/*
 35	 * Wake up a  task.
 36	 * 'data' points to a wait_queue_head_t
 37	 */
 38	HOST1X_INTR_ACTION_WAKEUP,
 39
 40	/*
 41	 * Wake up a interruptible task.
 42	 * 'data' points to a wait_queue_head_t
 43	 */
 44	HOST1X_INTR_ACTION_WAKEUP_INTERRUPTIBLE,
 45
 46	HOST1X_INTR_ACTION_COUNT
 47};
 48
 49struct host1x_syncpt_intr {
 50	spinlock_t lock;
 51	struct list_head wait_head;
 52	char thresh_irq_name[12];
 53	struct work_struct work;
 54};
 55
 56struct host1x_waitlist {
 57	struct list_head list;
 58	struct kref refcount;
 59	u32 thresh;
 60	enum host1x_intr_action action;
 61	atomic_t state;
 62	void *data;
 63	int count;
 64};
 65
 66/*
 67 * Schedule an action to be taken when a sync point reaches the given threshold.
 68 *
 69 * @id the sync point
 70 * @thresh the threshold
 71 * @action the action to take
 72 * @data a pointer to extra data depending on action, see above
 73 * @waiter waiter structure - assumes ownership
 74 * @ref must be passed if cancellation is possible, else NULL
 75 *
 76 * This is a non-blocking api.
 77 */
 78int host1x_intr_add_action(struct host1x *host, u32 id, u32 thresh,
 79	enum host1x_intr_action action, void *data,
 80	struct host1x_waitlist *waiter, void **ref);
 
 81
 82/*
 83 * Unreference an action submitted to host1x_intr_add_action().
 84 * You must call this if you passed non-NULL as ref.
 85 * @ref the ref returned from host1x_intr_add_action()
 86 */
 87void host1x_intr_put_ref(struct host1x *host, u32 id, void *ref);
 88
 89/* Initialize host1x sync point interrupt */
 90int host1x_intr_init(struct host1x *host, unsigned int irq_sync);
 91
 92/* Deinitialize host1x sync point interrupt */
 93void host1x_intr_deinit(struct host1x *host);
 94
 95/* Enable host1x sync point interrupt */
 96void host1x_intr_start(struct host1x *host);
 97
 98/* Disable host1x sync point interrupt */
 99void host1x_intr_stop(struct host1x *host);
100
101irqreturn_t host1x_syncpt_thresh_fn(void *dev_id);
102#endif
v5.4
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Tegra host1x Interrupt Management
 4 *
 5 * Copyright (c) 2010-2013, NVIDIA Corporation.
 
 
 
 
 
 
 
 
 
 
 
 
 6 */
 7
 8#ifndef __HOST1X_INTR_H
 9#define __HOST1X_INTR_H
10
11#include <linux/interrupt.h>
12#include <linux/workqueue.h>
13
14struct host1x_syncpt;
15struct host1x;
16
17enum host1x_intr_action {
18	/*
19	 * Perform cleanup after a submit has completed.
20	 * 'data' points to a channel
21	 */
22	HOST1X_INTR_ACTION_SUBMIT_COMPLETE = 0,
23
24	/*
25	 * Wake up a  task.
26	 * 'data' points to a wait_queue_head_t
27	 */
28	HOST1X_INTR_ACTION_WAKEUP,
29
30	/*
31	 * Wake up a interruptible task.
32	 * 'data' points to a wait_queue_head_t
33	 */
34	HOST1X_INTR_ACTION_WAKEUP_INTERRUPTIBLE,
35
36	HOST1X_INTR_ACTION_COUNT
37};
38
39struct host1x_syncpt_intr {
40	spinlock_t lock;
41	struct list_head wait_head;
42	char thresh_irq_name[12];
43	struct work_struct work;
44};
45
46struct host1x_waitlist {
47	struct list_head list;
48	struct kref refcount;
49	u32 thresh;
50	enum host1x_intr_action action;
51	atomic_t state;
52	void *data;
53	int count;
54};
55
56/*
57 * Schedule an action to be taken when a sync point reaches the given threshold.
58 *
59 * @id the sync point
60 * @thresh the threshold
61 * @action the action to take
62 * @data a pointer to extra data depending on action, see above
63 * @waiter waiter structure - assumes ownership
64 * @ref must be passed if cancellation is possible, else NULL
65 *
66 * This is a non-blocking api.
67 */
68int host1x_intr_add_action(struct host1x *host, struct host1x_syncpt *syncpt,
69			   u32 thresh, enum host1x_intr_action action,
70			   void *data, struct host1x_waitlist *waiter,
71			   void **ref);
72
73/*
74 * Unreference an action submitted to host1x_intr_add_action().
75 * You must call this if you passed non-NULL as ref.
76 * @ref the ref returned from host1x_intr_add_action()
77 */
78void host1x_intr_put_ref(struct host1x *host, unsigned int id, void *ref);
79
80/* Initialize host1x sync point interrupt */
81int host1x_intr_init(struct host1x *host, unsigned int irq_sync);
82
83/* Deinitialize host1x sync point interrupt */
84void host1x_intr_deinit(struct host1x *host);
85
86/* Enable host1x sync point interrupt */
87void host1x_intr_start(struct host1x *host);
88
89/* Disable host1x sync point interrupt */
90void host1x_intr_stop(struct host1x *host);
91
92irqreturn_t host1x_syncpt_thresh_fn(void *dev_id);
93#endif