11c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil/* 21c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * cx18 init/start/stop/exit stream functions 31c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * 41c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * Derived from ivtv-streams.h 51c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * 61c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 76afdeaf865b729287e02aafc61d8d013b89996efAndy Walls * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 81c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * 91c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * This program is free software; you can redistribute it and/or modify 101c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * it under the terms of the GNU General Public License as published by 111c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * the Free Software Foundation; either version 2 of the License, or 121c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * (at your option) any later version. 131c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * 141c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * This program is distributed in the hope that it will be useful, 151c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * but WITHOUT ANY WARRANTY; without even the implied warranty of 161c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 171c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * GNU General Public License for more details. 181c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * 191c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * You should have received a copy of the GNU General Public License 201c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * along with this program; if not, write to the Free Software 211c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 221c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil * 02111-1307 USA 231c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil */ 241c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil 251c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuilu32 cx18_find_handle(struct cx18 *cx); 26ee2d64f5ccc71b5c5191e92ea91a12b65f9ca060Andy Wallsstruct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle); 271c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuilint cx18_streams_setup(struct cx18 *cx); 281c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuilint cx18_streams_register(struct cx18 *cx); 293f98387efa9333c5765d36e144c47c107d6ba64aHans Verkuilvoid cx18_streams_cleanup(struct cx18 *cx, int unregister); 301c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil 31ef99179710d6ec04d6783afdf8387523c7087920Andy Walls#define CX18_ENC_STREAM_TYPE_IDX_FW_MDL_MIN (3) 32ef99179710d6ec04d6783afdf8387523c7087920Andy Wallsvoid cx18_stream_rotate_idx_mdls(struct cx18 *cx); 33ef99179710d6ec04d6783afdf8387523c7087920Andy Walls 3479f3e96018dc55ff7819a6a1ac3740a1d7103589Andy Wallsstatic inline bool cx18_stream_enabled(struct cx18_stream *s) 3579f3e96018dc55ff7819a6a1ac3740a1d7103589Andy Walls{ 36754f9969c323559a12bce1475f3c1e6574129856Andy Walls return s->video_dev || 37754f9969c323559a12bce1475f3c1e6574129856Andy Walls (s->dvb && s->dvb->enabled) || 3879f3e96018dc55ff7819a6a1ac3740a1d7103589Andy Walls (s->type == CX18_ENC_STREAM_TYPE_IDX && 3979f3e96018dc55ff7819a6a1ac3740a1d7103589Andy Walls s->cx->stream_buffers[CX18_ENC_STREAM_TYPE_IDX] != 0); 4079f3e96018dc55ff7819a6a1ac3740a1d7103589Andy Walls} 4179f3e96018dc55ff7819a6a1ac3740a1d7103589Andy Walls 4252fcb3ecc6707f52dfe4297f96b7609d4ba517fbAndy Walls/* Related to submission of mdls to firmware */ 4321a278b85d3c6b8064af0c03aec3205e28aad3b7Andy Wallsstatic inline void cx18_stream_load_fw_queue(struct cx18_stream *s) 4421a278b85d3c6b8064af0c03aec3205e28aad3b7Andy Walls{ 45a3bc5e3304c9ba8e7504597026d9ca93784d1239Tejun Heo schedule_work(&s->out_work_order); 4621a278b85d3c6b8064af0c03aec3205e28aad3b7Andy Walls} 4721a278b85d3c6b8064af0c03aec3205e28aad3b7Andy Walls 4852fcb3ecc6707f52dfe4297f96b7609d4ba517fbAndy Wallsstatic inline void cx18_stream_put_mdl_fw(struct cx18_stream *s, 4952fcb3ecc6707f52dfe4297f96b7609d4ba517fbAndy Walls struct cx18_mdl *mdl) 5021a278b85d3c6b8064af0c03aec3205e28aad3b7Andy Walls{ 5152fcb3ecc6707f52dfe4297f96b7609d4ba517fbAndy Walls /* Put mdl on q_free; the out work handler will move mdl(s) to q_busy */ 5252fcb3ecc6707f52dfe4297f96b7609d4ba517fbAndy Walls cx18_enqueue(s, mdl, &s->q_free); 5321a278b85d3c6b8064af0c03aec3205e28aad3b7Andy Walls cx18_stream_load_fw_queue(s); 5421a278b85d3c6b8064af0c03aec3205e28aad3b7Andy Walls} 5521a278b85d3c6b8064af0c03aec3205e28aad3b7Andy Walls 5687116159517ecf6b9cf62a136f2935a63833c485Andy Wallsvoid cx18_out_work_handler(struct work_struct *work); 5787116159517ecf6b9cf62a136f2935a63833c485Andy Walls 5887116159517ecf6b9cf62a136f2935a63833c485Andy Walls/* Capture related */ 591c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuilint cx18_start_v4l2_encode_stream(struct cx18_stream *s); 601c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuilint cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end); 611c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuil 621c1e45d17b663d4749af456ab7c2fc1f36405ef8Hans Verkuilvoid cx18_stop_all_captures(struct cx18 *cx); 63