1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd. */ 3 4 #ifndef _RKISPP_STATS_H 5 #define _RKISPP_STATS_H 6 7 #include <linux/rkispp-config.h> 8 #include <linux/interrupt.h> 9 #include <linux/kfifo.h> 10 #include "common.h" 11 12 #define RKISPP_STATS_READOUT_WORK_SIZE \ 13 (9 * sizeof(struct rkispp_stats_readout_work)) 14 15 struct rkispp_stats_vdev; 16 17 enum rkispp_stats_readout_cmd { 18 RKISPP_READOUT_STATS, 19 }; 20 21 struct rkispp_stats_readout_work { 22 enum rkispp_stats_readout_cmd readout; 23 unsigned long long timestamp; 24 unsigned int meas_type; 25 unsigned int frame_id; 26 }; 27 28 /* 29 * struct rkispp_stats_vdev - ISPP Statistics device 30 * 31 * @irq_lock: buffer queue lock 32 * @stat: stats buffer list 33 * @readout_wq: workqueue for statistics information read 34 */ 35 struct rkispp_stats_vdev { 36 struct rkispp_vdev_node vnode; 37 struct rkispp_device *dev; 38 39 spinlock_t irq_lock; 40 struct list_head stat; 41 struct rkispp_buffer *curr_buf; 42 struct rkispp_buffer *next_buf; 43 struct v4l2_format vdev_fmt; 44 bool streamon; 45 }; 46 47 void rkispp_stats_isr(struct rkispp_stats_vdev *stats_vdev, u32 mis); 48 49 int rkispp_register_stats_vdev(struct rkispp_device *dev); 50 51 void rkispp_unregister_stats_vdev(struct rkispp_device *dev); 52 53 #endif /* _RKISPP_STATS_H */ 54