Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Tegra host1x Interrupt Management
0004  *
0005  * Copyright (c) 2010-2013, NVIDIA Corporation.
0006  */
0007 
0008 #ifndef __HOST1X_INTR_H
0009 #define __HOST1X_INTR_H
0010 
0011 #include <linux/interrupt.h>
0012 #include <linux/workqueue.h>
0013 
0014 struct host1x_syncpt;
0015 struct host1x;
0016 
0017 enum host1x_intr_action {
0018     /*
0019      * Perform cleanup after a submit has completed.
0020      * 'data' points to a channel
0021      */
0022     HOST1X_INTR_ACTION_SUBMIT_COMPLETE = 0,
0023 
0024     /*
0025      * Wake up a  task.
0026      * 'data' points to a wait_queue_head_t
0027      */
0028     HOST1X_INTR_ACTION_WAKEUP,
0029 
0030     /*
0031      * Wake up a interruptible task.
0032      * 'data' points to a wait_queue_head_t
0033      */
0034     HOST1X_INTR_ACTION_WAKEUP_INTERRUPTIBLE,
0035 
0036     HOST1X_INTR_ACTION_SIGNAL_FENCE,
0037 
0038     HOST1X_INTR_ACTION_COUNT
0039 };
0040 
0041 struct host1x_syncpt_intr {
0042     spinlock_t lock;
0043     struct list_head wait_head;
0044     char thresh_irq_name[12];
0045     struct work_struct work;
0046 };
0047 
0048 struct host1x_waitlist {
0049     struct list_head list;
0050     struct kref refcount;
0051     u32 thresh;
0052     enum host1x_intr_action action;
0053     atomic_t state;
0054     void *data;
0055     int count;
0056 };
0057 
0058 /*
0059  * Schedule an action to be taken when a sync point reaches the given threshold.
0060  *
0061  * @id the sync point
0062  * @thresh the threshold
0063  * @action the action to take
0064  * @data a pointer to extra data depending on action, see above
0065  * @waiter waiter structure - assumes ownership
0066  * @ref must be passed if cancellation is possible, else NULL
0067  *
0068  * This is a non-blocking api.
0069  */
0070 int host1x_intr_add_action(struct host1x *host, struct host1x_syncpt *syncpt,
0071                u32 thresh, enum host1x_intr_action action,
0072                void *data, struct host1x_waitlist *waiter,
0073                void **ref);
0074 
0075 /*
0076  * Unreference an action submitted to host1x_intr_add_action().
0077  * You must call this if you passed non-NULL as ref.
0078  * @ref the ref returned from host1x_intr_add_action()
0079  * @flush wait until any pending handlers have completed before returning.
0080  */
0081 void host1x_intr_put_ref(struct host1x *host, unsigned int id, void *ref,
0082              bool flush);
0083 
0084 /* Initialize host1x sync point interrupt */
0085 int host1x_intr_init(struct host1x *host, unsigned int irq_sync);
0086 
0087 /* Deinitialize host1x sync point interrupt */
0088 void host1x_intr_deinit(struct host1x *host);
0089 
0090 /* Enable host1x sync point interrupt */
0091 void host1x_intr_start(struct host1x *host);
0092 
0093 /* Disable host1x sync point interrupt */
0094 void host1x_intr_stop(struct host1x *host);
0095 
0096 irqreturn_t host1x_syncpt_thresh_fn(void *dev_id);
0097 #endif