Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Tegra host1x Interrupt Management
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (c) 2010-2013, NVIDIA Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #ifndef __HOST1X_INTR_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #define __HOST1X_INTR_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct host1x_syncpt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct host1x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) enum host1x_intr_action {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	 * Perform cleanup after a submit has completed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	 * 'data' points to a channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	HOST1X_INTR_ACTION_SUBMIT_COMPLETE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	 * Wake up a  task.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	 * 'data' points to a wait_queue_head_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	HOST1X_INTR_ACTION_WAKEUP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	 * Wake up a interruptible task.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	 * 'data' points to a wait_queue_head_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	HOST1X_INTR_ACTION_WAKEUP_INTERRUPTIBLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	HOST1X_INTR_ACTION_COUNT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct host1x_syncpt_intr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	struct list_head wait_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	char thresh_irq_name[12];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	struct work_struct work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct host1x_waitlist {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	struct kref refcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	u32 thresh;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	enum host1x_intr_action action;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	atomic_t state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	void *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	int count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)  * Schedule an action to be taken when a sync point reaches the given threshold.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)  * @id the sync point
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)  * @thresh the threshold
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)  * @action the action to take
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)  * @data a pointer to extra data depending on action, see above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)  * @waiter waiter structure - assumes ownership
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)  * @ref must be passed if cancellation is possible, else NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)  * This is a non-blocking api.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) int host1x_intr_add_action(struct host1x *host, struct host1x_syncpt *syncpt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 			   u32 thresh, enum host1x_intr_action action,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 			   void *data, struct host1x_waitlist *waiter,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 			   void **ref);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)  * Unreference an action submitted to host1x_intr_add_action().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)  * You must call this if you passed non-NULL as ref.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)  * @ref the ref returned from host1x_intr_add_action()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) void host1x_intr_put_ref(struct host1x *host, unsigned int id, void *ref);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) /* Initialize host1x sync point interrupt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) int host1x_intr_init(struct host1x *host, unsigned int irq_sync);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /* Deinitialize host1x sync point interrupt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) void host1x_intr_deinit(struct host1x *host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) /* Enable host1x sync point interrupt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) void host1x_intr_start(struct host1x *host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) /* Disable host1x sync point interrupt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) void host1x_intr_stop(struct host1x *host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) irqreturn_t host1x_syncpt_thresh_fn(void *dev_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #endif