| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2013 - 2025 Intel Corporation |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef IPU7_ISYS_QUEUE_H |
| 7 |
#define IPU7_ISYS_QUEUE_H |
| 8 |
|
| 9 |
#include <linux/atomic.h> |
| 10 |
#include <linux/container_of.h> |
| 11 |
#include <linux/list.h> |
| 12 |
#include <linux/spinlock_types.h> |
| 13 |
|
| 14 |
#include <media/videobuf2-v4l2.h> |
| 15 |
|
| 16 |
struct device; |
| 17 |
struct ipu7_isys_stream; |
| 18 |
struct ipu7_insys_resp; |
| 19 |
struct ipu7_insys_buffset; |
| 20 |
|
| 21 |
struct ipu7_isys_queue { |
| 22 |
struct vb2_queue vbq; |
| 23 |
struct list_head node; |
| 24 |
struct device *dev; |
| 25 |
spinlock_t lock; |
| 26 |
struct list_head active; |
| 27 |
struct list_head incoming; |
| 28 |
unsigned int fw_output; |
| 29 |
}; |
| 30 |
|
| 31 |
struct ipu7_isys_buffer { |
| 32 |
struct list_head head; |
| 33 |
atomic_t str2mmio_flag; |
| 34 |
}; |
| 35 |
|
| 36 |
struct ipu7_isys_video_buffer { |
| 37 |
struct vb2_v4l2_buffer vb_v4l2; |
| 38 |
struct ipu7_isys_buffer ib; |
| 39 |
dma_addr_t dma_addr; |
| 40 |
}; |
| 41 |
|
| 42 |
#define IPU_ISYS_BUFFER_LIST_FL_INCOMING BIT(0) |
| 43 |
#define IPU_ISYS_BUFFER_LIST_FL_ACTIVE BIT(1) |
| 44 |
#define IPU_ISYS_BUFFER_LIST_FL_SET_STATE BIT(2) |
| 45 |
|
| 46 |
struct ipu7_isys_buffer_list { |
| 47 |
struct list_head head; |
| 48 |
unsigned int nbufs; |
| 49 |
}; |
| 50 |
|
| 51 |
#define vb2_queue_to_isys_queue(__vb2) \ |
| 52 |
container_of(__vb2, struct ipu7_isys_queue, vbq) |
| 53 |
|
| 54 |
#define ipu7_isys_to_isys_video_buffer(__ib) \ |
| 55 |
container_of(__ib, struct ipu7_isys_video_buffer, ib) |
| 56 |
|
| 57 |
#define vb2_buffer_to_ipu7_isys_video_buffer(__vvb) \ |
| 58 |
container_of(__vvb, struct ipu7_isys_video_buffer, vb_v4l2) |
| 59 |
|
| 60 |
#define ipu7_isys_buffer_to_vb2_buffer(__ib) \ |
| 61 |
(&ipu7_isys_to_isys_video_buffer(__ib)->vb_v4l2.vb2_buf) |
| 62 |
|
| 63 |
void ipu7_isys_buffer_list_queue(struct ipu7_isys_buffer_list *bl, |
| 64 |
unsigned long op_flags, |
| 65 |
enum vb2_buffer_state state); |
| 66 |
void ipu7_isys_buffer_to_fw_frame_buff(struct ipu7_insys_buffset *set, |
| 67 |
struct ipu7_isys_stream *stream, |
| 68 |
struct ipu7_isys_buffer_list *bl); |
| 69 |
void ipu7_isys_queue_buf_ready(struct ipu7_isys_stream *stream, |
| 70 |
struct ipu7_insys_resp *info); |
| 71 |
int ipu7_isys_queue_init(struct ipu7_isys_queue *aq); |
| 72 |
#endif /* IPU7_ISYS_QUEUE_H */ |