1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * cx18 init/start/stop/exit stream functions 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Derived from ivtv-streams.h 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 8*4882a593Smuzhiyun * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 9*4882a593Smuzhiyun */ 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun u32 cx18_find_handle(struct cx18 *cx); 12*4882a593Smuzhiyun struct cx18_stream *cx18_handle_to_stream(struct cx18 *cx, u32 handle); 13*4882a593Smuzhiyun int cx18_streams_setup(struct cx18 *cx); 14*4882a593Smuzhiyun int cx18_streams_register(struct cx18 *cx); 15*4882a593Smuzhiyun void cx18_streams_cleanup(struct cx18 *cx, int unregister); 16*4882a593Smuzhiyun 17*4882a593Smuzhiyun #define CX18_ENC_STREAM_TYPE_IDX_FW_MDL_MIN (3) 18*4882a593Smuzhiyun void cx18_stream_rotate_idx_mdls(struct cx18 *cx); 19*4882a593Smuzhiyun cx18_stream_enabled(struct cx18_stream * s)20*4882a593Smuzhiyunstatic inline bool cx18_stream_enabled(struct cx18_stream *s) 21*4882a593Smuzhiyun { 22*4882a593Smuzhiyun return s->video_dev.v4l2_dev || 23*4882a593Smuzhiyun (s->dvb && s->dvb->enabled) || 24*4882a593Smuzhiyun (s->type == CX18_ENC_STREAM_TYPE_IDX && 25*4882a593Smuzhiyun s->cx->stream_buffers[CX18_ENC_STREAM_TYPE_IDX] != 0); 26*4882a593Smuzhiyun } 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun /* Related to submission of mdls to firmware */ cx18_stream_load_fw_queue(struct cx18_stream * s)29*4882a593Smuzhiyunstatic inline void cx18_stream_load_fw_queue(struct cx18_stream *s) 30*4882a593Smuzhiyun { 31*4882a593Smuzhiyun schedule_work(&s->out_work_order); 32*4882a593Smuzhiyun } 33*4882a593Smuzhiyun cx18_stream_put_mdl_fw(struct cx18_stream * s,struct cx18_mdl * mdl)34*4882a593Smuzhiyunstatic inline void cx18_stream_put_mdl_fw(struct cx18_stream *s, 35*4882a593Smuzhiyun struct cx18_mdl *mdl) 36*4882a593Smuzhiyun { 37*4882a593Smuzhiyun /* Put mdl on q_free; the out work handler will move mdl(s) to q_busy */ 38*4882a593Smuzhiyun cx18_enqueue(s, mdl, &s->q_free); 39*4882a593Smuzhiyun cx18_stream_load_fw_queue(s); 40*4882a593Smuzhiyun } 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun void cx18_out_work_handler(struct work_struct *work); 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun /* Capture related */ 45*4882a593Smuzhiyun int cx18_start_v4l2_encode_stream(struct cx18_stream *s); 46*4882a593Smuzhiyun int cx18_stop_v4l2_encode_stream(struct cx18_stream *s, int gop_end); 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun void cx18_stop_all_captures(struct cx18 *cx); 49