Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at v4.19-rc4 104 lines 2.8 kB view raw
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_syncpt; 26struct host1x; 27 28enum host1x_intr_action { 29 /* 30 * Perform cleanup after a submit has completed. 31 * 'data' points to a channel 32 */ 33 HOST1X_INTR_ACTION_SUBMIT_COMPLETE = 0, 34 35 /* 36 * Wake up a task. 37 * 'data' points to a wait_queue_head_t 38 */ 39 HOST1X_INTR_ACTION_WAKEUP, 40 41 /* 42 * Wake up a interruptible task. 43 * 'data' points to a wait_queue_head_t 44 */ 45 HOST1X_INTR_ACTION_WAKEUP_INTERRUPTIBLE, 46 47 HOST1X_INTR_ACTION_COUNT 48}; 49 50struct host1x_syncpt_intr { 51 spinlock_t lock; 52 struct list_head wait_head; 53 char thresh_irq_name[12]; 54 struct work_struct work; 55}; 56 57struct host1x_waitlist { 58 struct list_head list; 59 struct kref refcount; 60 u32 thresh; 61 enum host1x_intr_action action; 62 atomic_t state; 63 void *data; 64 int count; 65}; 66 67/* 68 * Schedule an action to be taken when a sync point reaches the given threshold. 69 * 70 * @id the sync point 71 * @thresh the threshold 72 * @action the action to take 73 * @data a pointer to extra data depending on action, see above 74 * @waiter waiter structure - assumes ownership 75 * @ref must be passed if cancellation is possible, else NULL 76 * 77 * This is a non-blocking api. 78 */ 79int host1x_intr_add_action(struct host1x *host, struct host1x_syncpt *syncpt, 80 u32 thresh, enum host1x_intr_action action, 81 void *data, struct host1x_waitlist *waiter, 82 void **ref); 83 84/* 85 * Unreference an action submitted to host1x_intr_add_action(). 86 * You must call this if you passed non-NULL as ref. 87 * @ref the ref returned from host1x_intr_add_action() 88 */ 89void host1x_intr_put_ref(struct host1x *host, unsigned int id, void *ref); 90 91/* Initialize host1x sync point interrupt */ 92int host1x_intr_init(struct host1x *host, unsigned int irq_sync); 93 94/* Deinitialize host1x sync point interrupt */ 95void host1x_intr_deinit(struct host1x *host); 96 97/* Enable host1x sync point interrupt */ 98void host1x_intr_start(struct host1x *host); 99 100/* Disable host1x sync point interrupt */ 101void host1x_intr_stop(struct host1x *host); 102 103irqreturn_t host1x_syncpt_thresh_fn(void *dev_id); 104#endif