1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2021-2022 Bootlin
4  * Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
5  */
6 
7 #ifndef _SUN6I_ISP_PARAMS_H_
8 #define _SUN6I_ISP_PARAMS_H_
9 
10 #include <media/v4l2-device.h>
11 
12 #define SUN6I_ISP_PARAMS_NAME		"sun6i-isp-params"
13 
14 struct sun6i_isp_device;
15 
16 struct sun6i_isp_params_state {
17 	struct list_head		queue; /* Queue and buffers lock. */
18 	spinlock_t			lock;
19 
20 	struct sun6i_isp_buffer		*pending;
21 
22 	bool				configured;
23 	bool				streaming;
24 };
25 
26 struct sun6i_isp_params {
27 	struct sun6i_isp_params_state	state;
28 
29 	struct video_device		video_dev;
30 	struct vb2_queue		queue;
31 	struct mutex			lock; /* Queue lock. */
32 	struct media_pad		pad;
33 
34 	struct v4l2_format		format;
35 };
36 
37 /* Params */
38 
39 void sun6i_isp_params_configure(struct sun6i_isp_device *isp_dev);
40 
41 /* State */
42 
43 void sun6i_isp_params_state_update(struct sun6i_isp_device *isp_dev,
44 				   bool *update);
45 void sun6i_isp_params_state_complete(struct sun6i_isp_device *isp_dev);
46 
47 /* Params */
48 
49 int sun6i_isp_params_setup(struct sun6i_isp_device *isp_dev);
50 void sun6i_isp_params_cleanup(struct sun6i_isp_device *isp_dev);
51 
52 #endif
53