Commit | Line | Data |
---|---|---|
c88a96b0 HV |
1 | /* |
2 | * vivid-core.h - core datastructures | |
3 | * | |
4 | * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved. | |
5 | * | |
6 | * This program is free software; you may redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; version 2 of the License. | |
9 | * | |
10 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
11 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
12 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
13 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | |
14 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | |
15 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
16 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
17 | * SOFTWARE. | |
18 | */ | |
19 | ||
20 | #ifndef _VIVID_CORE_H_ | |
21 | #define _VIVID_CORE_H_ | |
22 | ||
23 | #include <linux/fb.h> | |
c139990e | 24 | #include <media/videobuf2-v4l2.h> |
c88a96b0 HV |
25 | #include <media/v4l2-device.h> |
26 | #include <media/v4l2-dev.h> | |
27 | #include <media/v4l2-ctrls.h> | |
e07d46e7 | 28 | #include <media/v4l2-tpg.h> |
c88a96b0 HV |
29 | #include "vivid-rds-gen.h" |
30 | #include "vivid-vbi-gen.h" | |
31 | ||
32 | #define dprintk(dev, level, fmt, arg...) \ | |
33 | v4l2_dbg(level, vivid_debug, &dev->v4l2_dev, fmt, ## arg) | |
34 | ||
35 | /* Maximum allowed frame rate | |
36 | * | |
37 | * vivid will allow setting timeperframe in [1/FPS_MAX - FPS_MAX/1] range. | |
38 | * | |
39 | * Ideally FPS_MAX should be infinity, i.e. practically UINT_MAX, but that | |
40 | * might hit application errors when they manipulate these values. | |
41 | * | |
42 | * Besides, for tpf < 10ms image-generation logic should be changed, to avoid | |
43 | * producing frames with equal content. | |
44 | */ | |
45 | #define FPS_MAX 100 | |
46 | ||
47 | /* The maximum number of clip rectangles */ | |
48 | #define MAX_CLIPS 16 | |
49 | /* The maximum number of inputs */ | |
50 | #define MAX_INPUTS 16 | |
51 | /* The maximum number of outputs */ | |
52 | #define MAX_OUTPUTS 16 | |
53 | /* The maximum up or down scaling factor is 4 */ | |
54 | #define MAX_ZOOM 4 | |
55 | /* The maximum image width/height are set to 4K DMT */ | |
56 | #define MAX_WIDTH 4096 | |
57 | #define MAX_HEIGHT 2160 | |
58 | /* The minimum image width/height */ | |
59 | #define MIN_WIDTH 16 | |
60 | #define MIN_HEIGHT 16 | |
61 | /* The data_offset of plane 0 for the multiplanar formats */ | |
62 | #define PLANE0_DATA_OFFSET 128 | |
63 | ||
64 | /* The supported TV frequency range in MHz */ | |
65 | #define MIN_TV_FREQ (44U * 16U) | |
66 | #define MAX_TV_FREQ (958U * 16U) | |
67 | ||
68 | /* The number of samples returned in every SDR buffer */ | |
69 | #define SDR_CAP_SAMPLES_PER_BUF 0x4000 | |
70 | ||
71 | /* used by the threads to know when to resync internal counters */ | |
72 | #define JIFFIES_PER_DAY (3600U * 24U * HZ) | |
73 | #define JIFFIES_RESYNC (JIFFIES_PER_DAY * (0xf0000000U / JIFFIES_PER_DAY)) | |
74 | ||
75 | extern const struct v4l2_rect vivid_min_rect; | |
76 | extern const struct v4l2_rect vivid_max_rect; | |
77 | extern unsigned vivid_debug; | |
78 | ||
79 | struct vivid_fmt { | |
c88a96b0 | 80 | u32 fourcc; /* v4l2 format id */ |
c88a96b0 HV |
81 | bool is_yuv; |
82 | bool can_do_overlay; | |
96c76efa | 83 | u8 vdownsampling[TPG_MAX_PLANES]; |
c88a96b0 HV |
84 | u32 alpha_mask; |
85 | u8 planes; | |
96c76efa | 86 | u8 buffers; |
c501abcf | 87 | u32 data_offset[TPG_MAX_PLANES]; |
96c76efa | 88 | u32 bit_depth[TPG_MAX_PLANES]; |
c88a96b0 HV |
89 | }; |
90 | ||
91 | extern struct vivid_fmt vivid_formats[]; | |
92 | ||
93 | /* buffer for one video frame */ | |
94 | struct vivid_buffer { | |
95 | /* common v4l buffer stuff -- must be first */ | |
2d700715 | 96 | struct vb2_v4l2_buffer vb; |
c88a96b0 HV |
97 | struct list_head list; |
98 | }; | |
99 | ||
100 | enum vivid_input { | |
101 | WEBCAM, | |
102 | TV, | |
103 | SVID, | |
104 | HDMI, | |
105 | }; | |
106 | ||
107 | enum vivid_signal_mode { | |
108 | CURRENT_DV_TIMINGS, | |
109 | CURRENT_STD = CURRENT_DV_TIMINGS, | |
110 | NO_SIGNAL, | |
111 | NO_LOCK, | |
112 | OUT_OF_RANGE, | |
113 | SELECTED_DV_TIMINGS, | |
114 | SELECTED_STD = SELECTED_DV_TIMINGS, | |
115 | CYCLE_DV_TIMINGS, | |
116 | CYCLE_STD = CYCLE_DV_TIMINGS, | |
117 | CUSTOM_DV_TIMINGS, | |
118 | }; | |
119 | ||
cd8adbe7 HV |
120 | enum vivid_colorspace { |
121 | VIVID_CS_170M, | |
122 | VIVID_CS_709, | |
123 | VIVID_CS_SRGB, | |
124 | VIVID_CS_ADOBERGB, | |
125 | VIVID_CS_2020, | |
1d780535 | 126 | VIVID_CS_DCI_P3, |
cd8adbe7 HV |
127 | VIVID_CS_240M, |
128 | VIVID_CS_SYS_M, | |
129 | VIVID_CS_SYS_BG, | |
130 | }; | |
131 | ||
c88a96b0 HV |
132 | #define VIVID_INVALID_SIGNAL(mode) \ |
133 | ((mode) == NO_SIGNAL || (mode) == NO_LOCK || (mode) == OUT_OF_RANGE) | |
134 | ||
135 | struct vivid_dev { | |
136 | unsigned inst; | |
137 | struct v4l2_device v4l2_dev; | |
138 | struct v4l2_ctrl_handler ctrl_hdl_user_gen; | |
139 | struct v4l2_ctrl_handler ctrl_hdl_user_vid; | |
140 | struct v4l2_ctrl_handler ctrl_hdl_user_aud; | |
141 | struct v4l2_ctrl_handler ctrl_hdl_streaming; | |
142 | struct v4l2_ctrl_handler ctrl_hdl_sdtv_cap; | |
63344b65 | 143 | struct v4l2_ctrl_handler ctrl_hdl_loop_cap; |
c88a96b0 HV |
144 | struct video_device vid_cap_dev; |
145 | struct v4l2_ctrl_handler ctrl_hdl_vid_cap; | |
146 | struct video_device vid_out_dev; | |
147 | struct v4l2_ctrl_handler ctrl_hdl_vid_out; | |
148 | struct video_device vbi_cap_dev; | |
149 | struct v4l2_ctrl_handler ctrl_hdl_vbi_cap; | |
150 | struct video_device vbi_out_dev; | |
151 | struct v4l2_ctrl_handler ctrl_hdl_vbi_out; | |
152 | struct video_device radio_rx_dev; | |
153 | struct v4l2_ctrl_handler ctrl_hdl_radio_rx; | |
154 | struct video_device radio_tx_dev; | |
155 | struct v4l2_ctrl_handler ctrl_hdl_radio_tx; | |
156 | struct video_device sdr_cap_dev; | |
157 | struct v4l2_ctrl_handler ctrl_hdl_sdr_cap; | |
158 | spinlock_t slock; | |
159 | struct mutex mutex; | |
160 | ||
161 | /* capabilities */ | |
162 | u32 vid_cap_caps; | |
163 | u32 vid_out_caps; | |
164 | u32 vbi_cap_caps; | |
165 | u32 vbi_out_caps; | |
166 | u32 sdr_cap_caps; | |
167 | u32 radio_rx_caps; | |
168 | u32 radio_tx_caps; | |
169 | ||
170 | /* supported features */ | |
171 | bool multiplanar; | |
172 | unsigned num_inputs; | |
173 | u8 input_type[MAX_INPUTS]; | |
174 | u8 input_name_counter[MAX_INPUTS]; | |
175 | unsigned num_outputs; | |
176 | u8 output_type[MAX_OUTPUTS]; | |
177 | u8 output_name_counter[MAX_OUTPUTS]; | |
178 | bool has_audio_inputs; | |
179 | bool has_audio_outputs; | |
180 | bool has_vid_cap; | |
181 | bool has_vid_out; | |
182 | bool has_vbi_cap; | |
183 | bool has_raw_vbi_cap; | |
184 | bool has_sliced_vbi_cap; | |
185 | bool has_vbi_out; | |
186 | bool has_raw_vbi_out; | |
187 | bool has_sliced_vbi_out; | |
188 | bool has_radio_rx; | |
189 | bool has_radio_tx; | |
190 | bool has_sdr_cap; | |
191 | bool has_fb; | |
192 | ||
193 | bool can_loop_video; | |
194 | ||
195 | /* controls */ | |
196 | struct v4l2_ctrl *brightness; | |
197 | struct v4l2_ctrl *contrast; | |
198 | struct v4l2_ctrl *saturation; | |
199 | struct v4l2_ctrl *hue; | |
200 | struct { | |
201 | /* autogain/gain cluster */ | |
202 | struct v4l2_ctrl *autogain; | |
203 | struct v4l2_ctrl *gain; | |
204 | }; | |
205 | struct v4l2_ctrl *volume; | |
206 | struct v4l2_ctrl *mute; | |
207 | struct v4l2_ctrl *alpha; | |
208 | struct v4l2_ctrl *button; | |
209 | struct v4l2_ctrl *boolean; | |
210 | struct v4l2_ctrl *int32; | |
211 | struct v4l2_ctrl *int64; | |
212 | struct v4l2_ctrl *menu; | |
213 | struct v4l2_ctrl *string; | |
214 | struct v4l2_ctrl *bitmask; | |
215 | struct v4l2_ctrl *int_menu; | |
216 | struct v4l2_ctrl *test_pattern; | |
217 | struct v4l2_ctrl *colorspace; | |
218 | struct v4l2_ctrl *rgb_range_cap; | |
219 | struct v4l2_ctrl *real_rgb_range_cap; | |
220 | struct { | |
221 | /* std_signal_mode/standard cluster */ | |
222 | struct v4l2_ctrl *ctrl_std_signal_mode; | |
223 | struct v4l2_ctrl *ctrl_standard; | |
224 | }; | |
225 | struct { | |
226 | /* dv_timings_signal_mode/timings cluster */ | |
227 | struct v4l2_ctrl *ctrl_dv_timings_signal_mode; | |
228 | struct v4l2_ctrl *ctrl_dv_timings; | |
229 | }; | |
230 | struct v4l2_ctrl *ctrl_has_crop_cap; | |
231 | struct v4l2_ctrl *ctrl_has_compose_cap; | |
232 | struct v4l2_ctrl *ctrl_has_scaler_cap; | |
233 | struct v4l2_ctrl *ctrl_has_crop_out; | |
234 | struct v4l2_ctrl *ctrl_has_compose_out; | |
235 | struct v4l2_ctrl *ctrl_has_scaler_out; | |
236 | struct v4l2_ctrl *ctrl_tx_mode; | |
237 | struct v4l2_ctrl *ctrl_tx_rgb_range; | |
238 | ||
239 | struct v4l2_ctrl *radio_tx_rds_pi; | |
240 | struct v4l2_ctrl *radio_tx_rds_pty; | |
241 | struct v4l2_ctrl *radio_tx_rds_mono_stereo; | |
242 | struct v4l2_ctrl *radio_tx_rds_art_head; | |
243 | struct v4l2_ctrl *radio_tx_rds_compressed; | |
244 | struct v4l2_ctrl *radio_tx_rds_dyn_pty; | |
245 | struct v4l2_ctrl *radio_tx_rds_ta; | |
246 | struct v4l2_ctrl *radio_tx_rds_tp; | |
247 | struct v4l2_ctrl *radio_tx_rds_ms; | |
248 | struct v4l2_ctrl *radio_tx_rds_psname; | |
249 | struct v4l2_ctrl *radio_tx_rds_radiotext; | |
250 | ||
251 | struct v4l2_ctrl *radio_rx_rds_pty; | |
252 | struct v4l2_ctrl *radio_rx_rds_ta; | |
253 | struct v4l2_ctrl *radio_rx_rds_tp; | |
254 | struct v4l2_ctrl *radio_rx_rds_ms; | |
255 | struct v4l2_ctrl *radio_rx_rds_psname; | |
256 | struct v4l2_ctrl *radio_rx_rds_radiotext; | |
257 | ||
258 | unsigned input_brightness[MAX_INPUTS]; | |
259 | unsigned osd_mode; | |
260 | unsigned button_pressed; | |
261 | bool sensor_hflip; | |
262 | bool sensor_vflip; | |
263 | bool hflip; | |
264 | bool vflip; | |
265 | bool vbi_cap_interlaced; | |
266 | bool loop_video; | |
c79aa6ae | 267 | bool reduced_fps; |
c88a96b0 HV |
268 | |
269 | /* Framebuffer */ | |
270 | unsigned long video_pbase; | |
271 | void *video_vbase; | |
272 | u32 video_buffer_size; | |
273 | int display_width; | |
274 | int display_height; | |
275 | int display_byte_stride; | |
276 | int bits_per_pixel; | |
277 | int bytes_per_pixel; | |
278 | struct fb_info fb_info; | |
279 | struct fb_var_screeninfo fb_defined; | |
280 | struct fb_fix_screeninfo fb_fix; | |
281 | ||
282 | /* Error injection */ | |
283 | bool queue_setup_error; | |
284 | bool buf_prepare_error; | |
285 | bool start_streaming_error; | |
286 | bool dqbuf_error; | |
287 | bool seq_wrap; | |
288 | bool time_wrap; | |
d6dd645e | 289 | u64 time_wrap_offset; |
c88a96b0 HV |
290 | unsigned perc_dropped_buffers; |
291 | enum vivid_signal_mode std_signal_mode; | |
292 | unsigned query_std_last; | |
293 | v4l2_std_id query_std; | |
294 | enum tpg_video_aspect std_aspect_ratio; | |
295 | ||
296 | enum vivid_signal_mode dv_timings_signal_mode; | |
297 | char **query_dv_timings_qmenu; | |
298 | unsigned query_dv_timings_size; | |
299 | unsigned query_dv_timings_last; | |
300 | unsigned query_dv_timings; | |
301 | enum tpg_video_aspect dv_timings_aspect_ratio; | |
302 | ||
303 | /* Input */ | |
304 | unsigned input; | |
305 | v4l2_std_id std_cap; | |
306 | struct v4l2_dv_timings dv_timings_cap; | |
307 | u32 service_set_cap; | |
308 | struct vivid_vbi_gen_data vbi_gen; | |
309 | u8 *edid; | |
310 | unsigned edid_blocks; | |
311 | unsigned edid_max_blocks; | |
312 | unsigned webcam_size_idx; | |
313 | unsigned webcam_ival_idx; | |
314 | unsigned tv_freq; | |
315 | unsigned tv_audmode; | |
316 | unsigned tv_field_cap; | |
317 | unsigned tv_audio_input; | |
318 | ||
319 | /* Capture Overlay */ | |
320 | struct v4l2_framebuffer fb_cap; | |
321 | struct v4l2_fh *overlay_cap_owner; | |
322 | void *fb_vbase_cap; | |
323 | int overlay_cap_top, overlay_cap_left; | |
324 | enum v4l2_field overlay_cap_field; | |
325 | void *bitmap_cap; | |
326 | struct v4l2_clip clips_cap[MAX_CLIPS]; | |
327 | struct v4l2_clip try_clips_cap[MAX_CLIPS]; | |
328 | unsigned clipcount_cap; | |
329 | ||
330 | /* Output */ | |
331 | unsigned output; | |
332 | v4l2_std_id std_out; | |
333 | struct v4l2_dv_timings dv_timings_out; | |
334 | u32 colorspace_out; | |
3e8a78d1 HV |
335 | u32 ycbcr_enc_out; |
336 | u32 quantization_out; | |
ca5316db | 337 | u32 xfer_func_out; |
c88a96b0 | 338 | u32 service_set_out; |
ddcaee9d | 339 | unsigned bytesperline_out[TPG_MAX_PLANES]; |
c88a96b0 HV |
340 | unsigned tv_field_out; |
341 | unsigned tv_audio_output; | |
342 | bool vbi_out_have_wss; | |
343 | u8 vbi_out_wss[2]; | |
344 | bool vbi_out_have_cc[2]; | |
345 | u8 vbi_out_cc[2][2]; | |
346 | bool dvi_d_out; | |
347 | u8 *scaled_line; | |
348 | u8 *blended_line; | |
349 | unsigned cur_scaled_line; | |
350 | ||
351 | /* Output Overlay */ | |
352 | void *fb_vbase_out; | |
353 | bool overlay_out_enabled; | |
354 | int overlay_out_top, overlay_out_left; | |
355 | void *bitmap_out; | |
356 | struct v4l2_clip clips_out[MAX_CLIPS]; | |
357 | struct v4l2_clip try_clips_out[MAX_CLIPS]; | |
358 | unsigned clipcount_out; | |
359 | unsigned fbuf_out_flags; | |
360 | u32 chromakey_out; | |
361 | u8 global_alpha_out; | |
362 | ||
363 | /* video capture */ | |
364 | struct tpg_data tpg; | |
365 | unsigned ms_vid_cap; | |
366 | bool must_blank[VIDEO_MAX_FRAME]; | |
367 | ||
368 | const struct vivid_fmt *fmt_cap; | |
369 | struct v4l2_fract timeperframe_vid_cap; | |
370 | enum v4l2_field field_cap; | |
371 | struct v4l2_rect src_rect; | |
372 | struct v4l2_rect fmt_cap_rect; | |
373 | struct v4l2_rect crop_cap; | |
374 | struct v4l2_rect compose_cap; | |
375 | struct v4l2_rect crop_bounds_cap; | |
376 | struct vb2_queue vb_vid_cap_q; | |
377 | struct list_head vid_cap_active; | |
378 | struct vb2_queue vb_vbi_cap_q; | |
379 | struct list_head vbi_cap_active; | |
380 | ||
381 | /* thread for generating video capture stream */ | |
382 | struct task_struct *kthread_vid_cap; | |
383 | unsigned long jiffies_vid_cap; | |
384 | u32 cap_seq_offset; | |
385 | u32 cap_seq_count; | |
386 | bool cap_seq_resync; | |
387 | u32 vid_cap_seq_start; | |
388 | u32 vid_cap_seq_count; | |
389 | bool vid_cap_streaming; | |
390 | u32 vbi_cap_seq_start; | |
391 | u32 vbi_cap_seq_count; | |
392 | bool vbi_cap_streaming; | |
393 | bool stream_sliced_vbi_cap; | |
394 | ||
395 | /* video output */ | |
396 | const struct vivid_fmt *fmt_out; | |
397 | struct v4l2_fract timeperframe_vid_out; | |
398 | enum v4l2_field field_out; | |
399 | struct v4l2_rect sink_rect; | |
400 | struct v4l2_rect fmt_out_rect; | |
401 | struct v4l2_rect crop_out; | |
402 | struct v4l2_rect compose_out; | |
403 | struct v4l2_rect compose_bounds_out; | |
404 | struct vb2_queue vb_vid_out_q; | |
405 | struct list_head vid_out_active; | |
406 | struct vb2_queue vb_vbi_out_q; | |
407 | struct list_head vbi_out_active; | |
408 | ||
409 | /* video loop precalculated rectangles */ | |
410 | ||
411 | /* | |
412 | * Intersection between what the output side composes and the capture side | |
413 | * crops. I.e., what actually needs to be copied from the output buffer to | |
414 | * the capture buffer. | |
415 | */ | |
416 | struct v4l2_rect loop_vid_copy; | |
417 | /* The part of the output buffer that (after scaling) corresponds to loop_vid_copy. */ | |
418 | struct v4l2_rect loop_vid_out; | |
419 | /* The part of the capture buffer that (after scaling) corresponds to loop_vid_copy. */ | |
420 | struct v4l2_rect loop_vid_cap; | |
421 | /* | |
422 | * The intersection of the framebuffer, the overlay output window and | |
423 | * loop_vid_copy. I.e., the part of the framebuffer that actually should be | |
424 | * blended with the compose_out rectangle. This uses the framebuffer origin. | |
425 | */ | |
426 | struct v4l2_rect loop_fb_copy; | |
427 | /* The same as loop_fb_copy but with compose_out origin. */ | |
428 | struct v4l2_rect loop_vid_overlay; | |
429 | /* | |
430 | * The part of the capture buffer that (after scaling) corresponds | |
431 | * to loop_vid_overlay. | |
432 | */ | |
433 | struct v4l2_rect loop_vid_overlay_cap; | |
434 | ||
435 | /* thread for generating video output stream */ | |
436 | struct task_struct *kthread_vid_out; | |
437 | unsigned long jiffies_vid_out; | |
438 | u32 out_seq_offset; | |
439 | u32 out_seq_count; | |
440 | bool out_seq_resync; | |
441 | u32 vid_out_seq_start; | |
442 | u32 vid_out_seq_count; | |
443 | bool vid_out_streaming; | |
444 | u32 vbi_out_seq_start; | |
445 | u32 vbi_out_seq_count; | |
446 | bool vbi_out_streaming; | |
447 | bool stream_sliced_vbi_out; | |
448 | ||
449 | /* SDR capture */ | |
450 | struct vb2_queue vb_sdr_cap_q; | |
451 | struct list_head sdr_cap_active; | |
7615f4bc AP |
452 | u32 sdr_pixelformat; /* v4l2 format id */ |
453 | unsigned sdr_buffersize; | |
c88a96b0 HV |
454 | unsigned sdr_adc_freq; |
455 | unsigned sdr_fm_freq; | |
f335c3f2 | 456 | unsigned sdr_fm_deviation; |
c88a96b0 HV |
457 | int sdr_fixp_src_phase; |
458 | int sdr_fixp_mod_phase; | |
459 | ||
460 | bool tstamp_src_is_soe; | |
461 | bool has_crop_cap; | |
462 | bool has_compose_cap; | |
463 | bool has_scaler_cap; | |
464 | bool has_crop_out; | |
465 | bool has_compose_out; | |
466 | bool has_scaler_out; | |
467 | ||
468 | /* thread for generating SDR stream */ | |
469 | struct task_struct *kthread_sdr_cap; | |
470 | unsigned long jiffies_sdr_cap; | |
471 | u32 sdr_cap_seq_offset; | |
472 | u32 sdr_cap_seq_count; | |
473 | bool sdr_cap_seq_resync; | |
474 | ||
475 | /* RDS generator */ | |
476 | struct vivid_rds_gen rds_gen; | |
477 | ||
478 | /* Radio receiver */ | |
479 | unsigned radio_rx_freq; | |
480 | unsigned radio_rx_audmode; | |
481 | int radio_rx_sig_qual; | |
482 | unsigned radio_rx_hw_seek_mode; | |
483 | bool radio_rx_hw_seek_prog_lim; | |
484 | bool radio_rx_rds_controls; | |
485 | bool radio_rx_rds_enabled; | |
486 | unsigned radio_rx_rds_use_alternates; | |
487 | unsigned radio_rx_rds_last_block; | |
488 | struct v4l2_fh *radio_rx_rds_owner; | |
489 | ||
490 | /* Radio transmitter */ | |
491 | unsigned radio_tx_freq; | |
492 | unsigned radio_tx_subchans; | |
493 | bool radio_tx_rds_controls; | |
494 | unsigned radio_tx_rds_last_block; | |
495 | struct v4l2_fh *radio_tx_rds_owner; | |
496 | ||
497 | /* Shared between radio receiver and transmitter */ | |
498 | bool radio_rds_loop; | |
499 | struct timespec radio_rds_init_ts; | |
500 | }; | |
501 | ||
502 | static inline bool vivid_is_webcam(const struct vivid_dev *dev) | |
503 | { | |
504 | return dev->input_type[dev->input] == WEBCAM; | |
505 | } | |
506 | ||
507 | static inline bool vivid_is_tv_cap(const struct vivid_dev *dev) | |
508 | { | |
509 | return dev->input_type[dev->input] == TV; | |
510 | } | |
511 | ||
512 | static inline bool vivid_is_svid_cap(const struct vivid_dev *dev) | |
513 | { | |
514 | return dev->input_type[dev->input] == SVID; | |
515 | } | |
516 | ||
517 | static inline bool vivid_is_hdmi_cap(const struct vivid_dev *dev) | |
518 | { | |
519 | return dev->input_type[dev->input] == HDMI; | |
520 | } | |
521 | ||
522 | static inline bool vivid_is_sdtv_cap(const struct vivid_dev *dev) | |
523 | { | |
524 | return vivid_is_tv_cap(dev) || vivid_is_svid_cap(dev); | |
525 | } | |
526 | ||
527 | static inline bool vivid_is_svid_out(const struct vivid_dev *dev) | |
528 | { | |
529 | return dev->output_type[dev->output] == SVID; | |
530 | } | |
531 | ||
532 | static inline bool vivid_is_hdmi_out(const struct vivid_dev *dev) | |
533 | { | |
534 | return dev->output_type[dev->output] == HDMI; | |
535 | } | |
536 | ||
c88a96b0 | 537 | #endif |