• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * linux-5.4/drivers/media/platform/sunxi-vin/vin-stat/vin_h3a.h
3  *
4  * Copyright (c) 2007-2017 Allwinnertech Co., Ltd.
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  */
16 
17 #ifndef _VIN_3A_H_
18 #define _VIN_3A_H_
19 
20 #include <linux/types.h>
21 #include <media/v4l2-event.h>
22 #include <media/v4l2-device.h>
23 
24 #include "../vin-video/vin_video.h"
25 
26 #define STAT_MAX_BUFS		5
27 #define STAT_NEVENTS		8
28 
29 #define STAT_BUF_DONE		0	/* Buffer is ready */
30 #define STAT_NO_BUF		1	/* An error has occurred */
31 
32 struct ispstat_buffer {
33 	void *virt_addr;
34 	void *dma_addr;
35 	u32 buf_size;
36 	u32 frame_number;
37 	u8 empty;
38 };
39 
40 enum ispstat_state_t {
41 	ISPSTAT_DISABLED = 0,
42 	ISPSTAT_ENABLED,
43 };
44 
45 struct isp_dev;
46 
47 struct isp_stat {
48 	struct v4l2_subdev sd;
49 	struct media_pad pad;	/* sink pad */
50 
51 	/* Control */
52 	bool configured;
53 	enum ispstat_state_t state;	/* enabling/disabling state */
54 	struct isp_dev *isp;
55 	struct mutex ioctl_lock; /* serialize private ioctl */
56 
57 	/* Buffer */
58 	u8 stat_en_flag;
59 	u8 sensor_fps;
60 	u8 buf_cnt;
61 	u32 frame_number;
62 	u32 buf_size;
63 	u32 event_type;
64 	struct vin_mm ion_man[STAT_MAX_BUFS]; /* for ion alloc/free manage */
65 	struct ispstat_buffer buf[STAT_MAX_BUFS];
66 	struct ispstat_buffer *active_buf;
67 	struct ispstat_buffer *locked_buf;
68 };
69 
70 void isp_stat_isr(struct isp_stat *stat);
71 int vin_isp_h3a_init(struct isp_dev *isp);
72 void vin_isp_h3a_cleanup(struct isp_dev *isp);
73 
74 #endif /*_VIN_3A_H_*/
75 
76