1 /* 2 * 3 * SPDX-License-Identifier: GPL-2.0 4 * 5 * Copyright (C) 2011-2018 ARM or its affiliates 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; version 2. 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * for more details. 14 * You should have received a copy of the GNU General Public License along 15 * with this program; if not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 * 18 */ 19 20 #ifndef _ISP_V4L2_H_ 21 #define _ISP_V4L2_H_ 22 23 #include <linux/mutex.h> 24 #include <media/videobuf2-core.h> 25 #include <media/v4l2-device.h> 26 #include <media/v4l2-dev.h> 27 28 #include "isp-v4l2-common.h" 29 #include "isp-v4l2-ctrl.h" 30 #include "isp-v4l2-stream.h" 31 #include <linux/platform_device.h> 32 33 typedef struct _isp_v4l2_dev { 34 /* device */ 35 uint32_t ctx_id; 36 struct v4l2_device *v4l2_dev; 37 struct video_device video_dev; 38 struct device *pdev; 39 40 /* lock */ 41 struct mutex mlock; 42 struct mutex notify_lock; 43 struct mutex file_lock; 44 45 /* file handle array for event notify */ 46 struct v4l2_fh *fh_ptr[V4L2_STREAM_TYPE_MAX]; 47 48 /* streams */ 49 isp_v4l2_stream_t *pstreams[V4L2_STREAM_TYPE_MAX]; 50 int32_t stream_id_index[V4L2_STREAM_TYPE_MAX]; 51 atomic_t stream_on_cnt; 52 53 /* controls */ 54 isp_v4l2_ctrl_t isp_v4l2_ctrl; 55 56 /* open counter for stream id */ 57 atomic_t opened; 58 unsigned int stream_mask; 59 unsigned int temper_buf_size; 60 } isp_v4l2_dev_t; 61 62 63 /* V4L2 external interface for probe */ 64 int isp_v4l2_create_instance( struct v4l2_device *v4l2_dev, struct platform_device *pdev, uint32_t hw_isp_addr ); 65 void isp_v4l2_destroy_instance( struct platform_device *pdev ); 66 67 /* Stream finder */ 68 int isp_v4l2_find_stream( isp_v4l2_stream_t **ppstream, 69 int ctx_number, isp_v4l2_stream_type_t stream_type ); 70 isp_v4l2_dev_t *isp_v4l2_get_dev( uint32_t ctx_number ); 71 72 /* Frame ready event */ 73 int isp_v4l2_notify_event( int ctx_num, int stream_id, uint32_t event_type ); 74 75 #endif 76