linux/drivers/media/test-drivers/vivid/vivid-core.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0-only */
   2/*
   3 * vivid-core.h - core datastructures
   4 *
   5 * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
   6 */
   7
   8#ifndef _VIVID_CORE_H_
   9#define _VIVID_CORE_H_
  10
  11#include <linux/fb.h>
  12#include <linux/workqueue.h>
  13#include <media/cec.h>
  14#include <media/videobuf2-v4l2.h>
  15#include <media/v4l2-device.h>
  16#include <media/v4l2-dev.h>
  17#include <media/v4l2-ctrls.h>
  18#include <media/tpg/v4l2-tpg.h>
  19#include "vivid-rds-gen.h"
  20#include "vivid-vbi-gen.h"
  21
  22#define dprintk(dev, level, fmt, arg...) \
  23        v4l2_dbg(level, vivid_debug, &dev->v4l2_dev, fmt, ## arg)
  24
  25/* The maximum number of clip rectangles */
  26#define MAX_CLIPS  16
  27/* The maximum number of inputs */
  28#define MAX_INPUTS 16
  29/* The maximum number of outputs */
  30#define MAX_OUTPUTS 16
  31/* The maximum up or down scaling factor is 4 */
  32#define MAX_ZOOM  4
  33/* The maximum image width/height are set to 4K DMT */
  34#define MAX_WIDTH  4096
  35#define MAX_HEIGHT 2160
  36/* The minimum image width/height */
  37#define MIN_WIDTH  16
  38#define MIN_HEIGHT 16
  39/* The data_offset of plane 0 for the multiplanar formats */
  40#define PLANE0_DATA_OFFSET 128
  41
  42/* The supported TV frequency range in MHz */
  43#define MIN_TV_FREQ (44U * 16U)
  44#define MAX_TV_FREQ (958U * 16U)
  45
  46/* The number of samples returned in every SDR buffer */
  47#define SDR_CAP_SAMPLES_PER_BUF 0x4000
  48
  49/* used by the threads to know when to resync internal counters */
  50#define JIFFIES_PER_DAY (3600U * 24U * HZ)
  51#define JIFFIES_RESYNC (JIFFIES_PER_DAY * (0xf0000000U / JIFFIES_PER_DAY))
  52
  53extern const struct v4l2_rect vivid_min_rect;
  54extern const struct v4l2_rect vivid_max_rect;
  55extern unsigned vivid_debug;
  56
  57struct vivid_fmt {
  58        u32     fourcc;          /* v4l2 format id */
  59        enum    tgp_color_enc color_enc;
  60        bool    can_do_overlay;
  61        u8      vdownsampling[TPG_MAX_PLANES];
  62        u32     alpha_mask;
  63        u8      planes;
  64        u8      buffers;
  65        u32     data_offset[TPG_MAX_PLANES];
  66        u32     bit_depth[TPG_MAX_PLANES];
  67};
  68
  69extern struct vivid_fmt vivid_formats[];
  70
  71/* buffer for one video frame */
  72struct vivid_buffer {
  73        /* common v4l buffer stuff -- must be first */
  74        struct vb2_v4l2_buffer vb;
  75        struct list_head        list;
  76};
  77
  78enum vivid_input {
  79        WEBCAM,
  80        TV,
  81        SVID,
  82        HDMI,
  83};
  84
  85enum vivid_signal_mode {
  86        CURRENT_DV_TIMINGS,
  87        CURRENT_STD = CURRENT_DV_TIMINGS,
  88        NO_SIGNAL,
  89        NO_LOCK,
  90        OUT_OF_RANGE,
  91        SELECTED_DV_TIMINGS,
  92        SELECTED_STD = SELECTED_DV_TIMINGS,
  93        CYCLE_DV_TIMINGS,
  94        CYCLE_STD = CYCLE_DV_TIMINGS,
  95        CUSTOM_DV_TIMINGS,
  96};
  97
  98enum vivid_colorspace {
  99        VIVID_CS_170M,
 100        VIVID_CS_709,
 101        VIVID_CS_SRGB,
 102        VIVID_CS_OPRGB,
 103        VIVID_CS_2020,
 104        VIVID_CS_DCI_P3,
 105        VIVID_CS_240M,
 106        VIVID_CS_SYS_M,
 107        VIVID_CS_SYS_BG,
 108};
 109
 110#define VIVID_INVALID_SIGNAL(mode) \
 111        ((mode) == NO_SIGNAL || (mode) == NO_LOCK || (mode) == OUT_OF_RANGE)
 112
 113struct vivid_cec_work {
 114        struct list_head        list;
 115        struct delayed_work     work;
 116        struct cec_adapter      *adap;
 117        struct vivid_dev        *dev;
 118        unsigned int            usecs;
 119        unsigned int            timeout_ms;
 120        u8                      tx_status;
 121        struct cec_msg          msg;
 122};
 123
 124struct vivid_dev {
 125        unsigned                        inst;
 126        struct v4l2_device              v4l2_dev;
 127#ifdef CONFIG_MEDIA_CONTROLLER
 128        struct media_device             mdev;
 129        struct media_pad                vid_cap_pad;
 130        struct media_pad                vid_out_pad;
 131        struct media_pad                vbi_cap_pad;
 132        struct media_pad                vbi_out_pad;
 133        struct media_pad                sdr_cap_pad;
 134        struct media_pad                meta_cap_pad;
 135        struct media_pad                meta_out_pad;
 136        struct media_pad                touch_cap_pad;
 137#endif
 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;
 143        struct v4l2_ctrl_handler        ctrl_hdl_loop_cap;
 144        struct v4l2_ctrl_handler        ctrl_hdl_fb;
 145        struct video_device             vid_cap_dev;
 146        struct v4l2_ctrl_handler        ctrl_hdl_vid_cap;
 147        struct video_device             vid_out_dev;
 148        struct v4l2_ctrl_handler        ctrl_hdl_vid_out;
 149        struct video_device             vbi_cap_dev;
 150        struct v4l2_ctrl_handler        ctrl_hdl_vbi_cap;
 151        struct video_device             vbi_out_dev;
 152        struct v4l2_ctrl_handler        ctrl_hdl_vbi_out;
 153        struct video_device             radio_rx_dev;
 154        struct v4l2_ctrl_handler        ctrl_hdl_radio_rx;
 155        struct video_device             radio_tx_dev;
 156        struct v4l2_ctrl_handler        ctrl_hdl_radio_tx;
 157        struct video_device             sdr_cap_dev;
 158        struct v4l2_ctrl_handler        ctrl_hdl_sdr_cap;
 159        struct video_device             meta_cap_dev;
 160        struct v4l2_ctrl_handler        ctrl_hdl_meta_cap;
 161        struct video_device             meta_out_dev;
 162        struct v4l2_ctrl_handler        ctrl_hdl_meta_out;
 163        struct video_device             touch_cap_dev;
 164        struct v4l2_ctrl_handler        ctrl_hdl_touch_cap;
 165
 166        spinlock_t                      slock;
 167        struct mutex                    mutex;
 168
 169        /* capabilities */
 170        u32                             vid_cap_caps;
 171        u32                             vid_out_caps;
 172        u32                             vbi_cap_caps;
 173        u32                             vbi_out_caps;
 174        u32                             sdr_cap_caps;
 175        u32                             radio_rx_caps;
 176        u32                             radio_tx_caps;
 177        u32                             meta_cap_caps;
 178        u32                             meta_out_caps;
 179        u32                             touch_cap_caps;
 180
 181        /* supported features */
 182        bool                            multiplanar;
 183        unsigned                        num_inputs;
 184        unsigned int                    num_hdmi_inputs;
 185        u8                              input_type[MAX_INPUTS];
 186        u8                              input_name_counter[MAX_INPUTS];
 187        unsigned                        num_outputs;
 188        unsigned int                    num_hdmi_outputs;
 189        u8                              output_type[MAX_OUTPUTS];
 190        u8                              output_name_counter[MAX_OUTPUTS];
 191        bool                            has_audio_inputs;
 192        bool                            has_audio_outputs;
 193        bool                            has_vid_cap;
 194        bool                            has_vid_out;
 195        bool                            has_vbi_cap;
 196        bool                            has_raw_vbi_cap;
 197        bool                            has_sliced_vbi_cap;
 198        bool                            has_vbi_out;
 199        bool                            has_raw_vbi_out;
 200        bool                            has_sliced_vbi_out;
 201        bool                            has_radio_rx;
 202        bool                            has_radio_tx;
 203        bool                            has_sdr_cap;
 204        bool                            has_fb;
 205        bool                            has_meta_cap;
 206        bool                            has_meta_out;
 207        bool                            has_tv_tuner;
 208        bool                            has_touch_cap;
 209
 210        bool                            can_loop_video;
 211
 212        /* controls */
 213        struct v4l2_ctrl                *brightness;
 214        struct v4l2_ctrl                *contrast;
 215        struct v4l2_ctrl                *saturation;
 216        struct v4l2_ctrl                *hue;
 217        struct {
 218                /* autogain/gain cluster */
 219                struct v4l2_ctrl        *autogain;
 220                struct v4l2_ctrl        *gain;
 221        };
 222        struct v4l2_ctrl                *volume;
 223        struct v4l2_ctrl                *mute;
 224        struct v4l2_ctrl                *alpha;
 225        struct v4l2_ctrl                *button;
 226        struct v4l2_ctrl                *boolean;
 227        struct v4l2_ctrl                *int32;
 228        struct v4l2_ctrl                *int64;
 229        struct v4l2_ctrl                *menu;
 230        struct v4l2_ctrl                *string;
 231        struct v4l2_ctrl                *bitmask;
 232        struct v4l2_ctrl                *int_menu;
 233        struct v4l2_ctrl                *ro_int32;
 234        struct v4l2_ctrl                *test_pattern;
 235        struct v4l2_ctrl                *colorspace;
 236        struct v4l2_ctrl                *rgb_range_cap;
 237        struct v4l2_ctrl                *real_rgb_range_cap;
 238        struct {
 239                /* std_signal_mode/standard cluster */
 240                struct v4l2_ctrl        *ctrl_std_signal_mode;
 241                struct v4l2_ctrl        *ctrl_standard;
 242        };
 243        struct {
 244                /* dv_timings_signal_mode/timings cluster */
 245                struct v4l2_ctrl        *ctrl_dv_timings_signal_mode;
 246                struct v4l2_ctrl        *ctrl_dv_timings;
 247        };
 248        struct v4l2_ctrl                *ctrl_display_present;
 249        struct v4l2_ctrl                *ctrl_has_crop_cap;
 250        struct v4l2_ctrl                *ctrl_has_compose_cap;
 251        struct v4l2_ctrl                *ctrl_has_scaler_cap;
 252        struct v4l2_ctrl                *ctrl_has_crop_out;
 253        struct v4l2_ctrl                *ctrl_has_compose_out;
 254        struct v4l2_ctrl                *ctrl_has_scaler_out;
 255        struct v4l2_ctrl                *ctrl_tx_mode;
 256        struct v4l2_ctrl                *ctrl_tx_rgb_range;
 257        struct v4l2_ctrl                *ctrl_tx_edid_present;
 258        struct v4l2_ctrl                *ctrl_tx_hotplug;
 259        struct v4l2_ctrl                *ctrl_tx_rxsense;
 260
 261        struct v4l2_ctrl                *ctrl_rx_power_present;
 262
 263        struct v4l2_ctrl                *radio_tx_rds_pi;
 264        struct v4l2_ctrl                *radio_tx_rds_pty;
 265        struct v4l2_ctrl                *radio_tx_rds_mono_stereo;
 266        struct v4l2_ctrl                *radio_tx_rds_art_head;
 267        struct v4l2_ctrl                *radio_tx_rds_compressed;
 268        struct v4l2_ctrl                *radio_tx_rds_dyn_pty;
 269        struct v4l2_ctrl                *radio_tx_rds_ta;
 270        struct v4l2_ctrl                *radio_tx_rds_tp;
 271        struct v4l2_ctrl                *radio_tx_rds_ms;
 272        struct v4l2_ctrl                *radio_tx_rds_psname;
 273        struct v4l2_ctrl                *radio_tx_rds_radiotext;
 274
 275        struct v4l2_ctrl                *radio_rx_rds_pty;
 276        struct v4l2_ctrl                *radio_rx_rds_ta;
 277        struct v4l2_ctrl                *radio_rx_rds_tp;
 278        struct v4l2_ctrl                *radio_rx_rds_ms;
 279        struct v4l2_ctrl                *radio_rx_rds_psname;
 280        struct v4l2_ctrl                *radio_rx_rds_radiotext;
 281
 282        unsigned                        input_brightness[MAX_INPUTS];
 283        unsigned                        osd_mode;
 284        unsigned                        button_pressed;
 285        bool                            sensor_hflip;
 286        bool                            sensor_vflip;
 287        bool                            hflip;
 288        bool                            vflip;
 289        bool                            vbi_cap_interlaced;
 290        bool                            loop_video;
 291        bool                            reduced_fps;
 292
 293        /* Framebuffer */
 294        unsigned long                   video_pbase;
 295        void                            *video_vbase;
 296        u32                             video_buffer_size;
 297        int                             display_width;
 298        int                             display_height;
 299        int                             display_byte_stride;
 300        int                             bits_per_pixel;
 301        int                             bytes_per_pixel;
 302        struct fb_info                  fb_info;
 303        struct fb_var_screeninfo        fb_defined;
 304        struct fb_fix_screeninfo        fb_fix;
 305
 306        /* Error injection */
 307        bool                            disconnect_error;
 308        bool                            queue_setup_error;
 309        bool                            buf_prepare_error;
 310        bool                            start_streaming_error;
 311        bool                            dqbuf_error;
 312        bool                            req_validate_error;
 313        bool                            seq_wrap;
 314        bool                            time_wrap;
 315        u64                             time_wrap_offset;
 316        unsigned                        perc_dropped_buffers;
 317        enum vivid_signal_mode          std_signal_mode[MAX_INPUTS];
 318        unsigned int                    query_std_last[MAX_INPUTS];
 319        v4l2_std_id                     query_std[MAX_INPUTS];
 320        enum tpg_video_aspect           std_aspect_ratio[MAX_INPUTS];
 321
 322        enum vivid_signal_mode          dv_timings_signal_mode[MAX_INPUTS];
 323        char                            **query_dv_timings_qmenu;
 324        char                            *query_dv_timings_qmenu_strings;
 325        unsigned                        query_dv_timings_size;
 326        unsigned int                    query_dv_timings_last[MAX_INPUTS];
 327        unsigned int                    query_dv_timings[MAX_INPUTS];
 328        enum tpg_video_aspect           dv_timings_aspect_ratio[MAX_INPUTS];
 329
 330        /* Input */
 331        unsigned                        input;
 332        v4l2_std_id                     std_cap[MAX_INPUTS];
 333        struct v4l2_dv_timings          dv_timings_cap[MAX_INPUTS];
 334        int                             dv_timings_cap_sel[MAX_INPUTS];
 335        u32                             service_set_cap;
 336        struct vivid_vbi_gen_data       vbi_gen;
 337        u8                              *edid;
 338        unsigned                        edid_blocks;
 339        unsigned                        edid_max_blocks;
 340        unsigned                        webcam_size_idx;
 341        unsigned                        webcam_ival_idx;
 342        unsigned                        tv_freq;
 343        unsigned                        tv_audmode;
 344        unsigned                        tv_field_cap;
 345        unsigned                        tv_audio_input;
 346
 347        u32                             power_present;
 348
 349        /* Capture Overlay */
 350        struct v4l2_framebuffer         fb_cap;
 351        struct v4l2_fh                  *overlay_cap_owner;
 352        void                            *fb_vbase_cap;
 353        int                             overlay_cap_top, overlay_cap_left;
 354        enum v4l2_field                 overlay_cap_field;
 355        void                            *bitmap_cap;
 356        struct v4l2_clip                clips_cap[MAX_CLIPS];
 357        struct v4l2_clip                try_clips_cap[MAX_CLIPS];
 358        unsigned                        clipcount_cap;
 359
 360        /* Output */
 361        unsigned                        output;
 362        v4l2_std_id                     std_out;
 363        struct v4l2_dv_timings          dv_timings_out;
 364        u32                             colorspace_out;
 365        u32                             ycbcr_enc_out;
 366        u32                             hsv_enc_out;
 367        u32                             quantization_out;
 368        u32                             xfer_func_out;
 369        u32                             service_set_out;
 370        unsigned                        bytesperline_out[TPG_MAX_PLANES];
 371        unsigned                        tv_field_out;
 372        unsigned                        tv_audio_output;
 373        bool                            vbi_out_have_wss;
 374        u8                              vbi_out_wss[2];
 375        bool                            vbi_out_have_cc[2];
 376        u8                              vbi_out_cc[2][2];
 377        bool                            dvi_d_out;
 378        u8                              *scaled_line;
 379        u8                              *blended_line;
 380        unsigned                        cur_scaled_line;
 381        bool                            display_present[MAX_OUTPUTS];
 382
 383        /* Output Overlay */
 384        void                            *fb_vbase_out;
 385        bool                            overlay_out_enabled;
 386        int                             overlay_out_top, overlay_out_left;
 387        void                            *bitmap_out;
 388        struct v4l2_clip                clips_out[MAX_CLIPS];
 389        struct v4l2_clip                try_clips_out[MAX_CLIPS];
 390        unsigned                        clipcount_out;
 391        unsigned                        fbuf_out_flags;
 392        u32                             chromakey_out;
 393        u8                              global_alpha_out;
 394
 395        /* video capture */
 396        struct tpg_data                 tpg;
 397        unsigned                        ms_vid_cap;
 398        bool                            must_blank[VIDEO_MAX_FRAME];
 399
 400        const struct vivid_fmt          *fmt_cap;
 401        struct v4l2_fract               timeperframe_vid_cap;
 402        enum v4l2_field                 field_cap;
 403        struct v4l2_rect                src_rect;
 404        struct v4l2_rect                fmt_cap_rect;
 405        struct v4l2_rect                crop_cap;
 406        struct v4l2_rect                compose_cap;
 407        struct v4l2_rect                crop_bounds_cap;
 408        struct vb2_queue                vb_vid_cap_q;
 409        struct list_head                vid_cap_active;
 410        struct vb2_queue                vb_vbi_cap_q;
 411        struct list_head                vbi_cap_active;
 412        struct vb2_queue                vb_meta_cap_q;
 413        struct list_head                meta_cap_active;
 414        struct vb2_queue                vb_touch_cap_q;
 415        struct list_head                touch_cap_active;
 416
 417        /* thread for generating video capture stream */
 418        struct task_struct              *kthread_vid_cap;
 419        unsigned long                   jiffies_vid_cap;
 420        u64                             cap_stream_start;
 421        u64                             cap_frame_period;
 422        u64                             cap_frame_eof_offset;
 423        u32                             cap_seq_offset;
 424        u32                             cap_seq_count;
 425        bool                            cap_seq_resync;
 426        u32                             vid_cap_seq_start;
 427        u32                             vid_cap_seq_count;
 428        bool                            vid_cap_streaming;
 429        u32                             vbi_cap_seq_start;
 430        u32                             vbi_cap_seq_count;
 431        bool                            vbi_cap_streaming;
 432        u32                             meta_cap_seq_start;
 433        u32                             meta_cap_seq_count;
 434        bool                            meta_cap_streaming;
 435
 436        /* Touch capture */
 437        struct task_struct              *kthread_touch_cap;
 438        unsigned long                   jiffies_touch_cap;
 439        u64                             touch_cap_stream_start;
 440        u32                             touch_cap_seq_offset;
 441        bool                            touch_cap_seq_resync;
 442        u32                             touch_cap_seq_start;
 443        u32                             touch_cap_seq_count;
 444        bool                            touch_cap_streaming;
 445        struct v4l2_fract               timeperframe_tch_cap;
 446        struct v4l2_pix_format          tch_format;
 447        int                             tch_pat_random;
 448
 449        /* video output */
 450        const struct vivid_fmt          *fmt_out;
 451        struct v4l2_fract               timeperframe_vid_out;
 452        enum v4l2_field                 field_out;
 453        struct v4l2_rect                sink_rect;
 454        struct v4l2_rect                fmt_out_rect;
 455        struct v4l2_rect                crop_out;
 456        struct v4l2_rect                compose_out;
 457        struct v4l2_rect                compose_bounds_out;
 458        struct vb2_queue                vb_vid_out_q;
 459        struct list_head                vid_out_active;
 460        struct vb2_queue                vb_vbi_out_q;
 461        struct list_head                vbi_out_active;
 462        struct vb2_queue                vb_meta_out_q;
 463        struct list_head                meta_out_active;
 464
 465        /* video loop precalculated rectangles */
 466
 467        /*
 468         * Intersection between what the output side composes and the capture side
 469         * crops. I.e., what actually needs to be copied from the output buffer to
 470         * the capture buffer.
 471         */
 472        struct v4l2_rect                loop_vid_copy;
 473        /* The part of the output buffer that (after scaling) corresponds to loop_vid_copy. */
 474        struct v4l2_rect                loop_vid_out;
 475        /* The part of the capture buffer that (after scaling) corresponds to loop_vid_copy. */
 476        struct v4l2_rect                loop_vid_cap;
 477        /*
 478         * The intersection of the framebuffer, the overlay output window and
 479         * loop_vid_copy. I.e., the part of the framebuffer that actually should be
 480         * blended with the compose_out rectangle. This uses the framebuffer origin.
 481         */
 482        struct v4l2_rect                loop_fb_copy;
 483        /* The same as loop_fb_copy but with compose_out origin. */
 484        struct v4l2_rect                loop_vid_overlay;
 485        /*
 486         * The part of the capture buffer that (after scaling) corresponds
 487         * to loop_vid_overlay.
 488         */
 489        struct v4l2_rect                loop_vid_overlay_cap;
 490
 491        /* thread for generating video output stream */
 492        struct task_struct              *kthread_vid_out;
 493        unsigned long                   jiffies_vid_out;
 494        u32                             out_seq_offset;
 495        u32                             out_seq_count;
 496        bool                            out_seq_resync;
 497        u32                             vid_out_seq_start;
 498        u32                             vid_out_seq_count;
 499        bool                            vid_out_streaming;
 500        u32                             vbi_out_seq_start;
 501        u32                             vbi_out_seq_count;
 502        bool                            vbi_out_streaming;
 503        bool                            stream_sliced_vbi_out;
 504        u32                             meta_out_seq_start;
 505        u32                             meta_out_seq_count;
 506        bool                            meta_out_streaming;
 507
 508        /* SDR capture */
 509        struct vb2_queue                vb_sdr_cap_q;
 510        struct list_head                sdr_cap_active;
 511        u32                             sdr_pixelformat; /* v4l2 format id */
 512        unsigned                        sdr_buffersize;
 513        unsigned                        sdr_adc_freq;
 514        unsigned                        sdr_fm_freq;
 515        unsigned                        sdr_fm_deviation;
 516        int                             sdr_fixp_src_phase;
 517        int                             sdr_fixp_mod_phase;
 518
 519        bool                            tstamp_src_is_soe;
 520        bool                            has_crop_cap;
 521        bool                            has_compose_cap;
 522        bool                            has_scaler_cap;
 523        bool                            has_crop_out;
 524        bool                            has_compose_out;
 525        bool                            has_scaler_out;
 526
 527        /* thread for generating SDR stream */
 528        struct task_struct              *kthread_sdr_cap;
 529        unsigned long                   jiffies_sdr_cap;
 530        u32                             sdr_cap_seq_offset;
 531        u32                             sdr_cap_seq_count;
 532        bool                            sdr_cap_seq_resync;
 533
 534        /* RDS generator */
 535        struct vivid_rds_gen            rds_gen;
 536
 537        /* Radio receiver */
 538        unsigned                        radio_rx_freq;
 539        unsigned                        radio_rx_audmode;
 540        int                             radio_rx_sig_qual;
 541        unsigned                        radio_rx_hw_seek_mode;
 542        bool                            radio_rx_hw_seek_prog_lim;
 543        bool                            radio_rx_rds_controls;
 544        bool                            radio_rx_rds_enabled;
 545        unsigned                        radio_rx_rds_use_alternates;
 546        unsigned                        radio_rx_rds_last_block;
 547        struct v4l2_fh                  *radio_rx_rds_owner;
 548
 549        /* Radio transmitter */
 550        unsigned                        radio_tx_freq;
 551        unsigned                        radio_tx_subchans;
 552        bool                            radio_tx_rds_controls;
 553        unsigned                        radio_tx_rds_last_block;
 554        struct v4l2_fh                  *radio_tx_rds_owner;
 555
 556        /* Shared between radio receiver and transmitter */
 557        bool                            radio_rds_loop;
 558        ktime_t                         radio_rds_init_time;
 559
 560        /* CEC */
 561        struct cec_adapter              *cec_rx_adap;
 562        struct cec_adapter              *cec_tx_adap[MAX_OUTPUTS];
 563        struct workqueue_struct         *cec_workqueue;
 564        spinlock_t                      cec_slock;
 565        struct list_head                cec_work_list;
 566        unsigned int                    cec_xfer_time_jiffies;
 567        unsigned long                   cec_xfer_start_jiffies;
 568        u8                              cec_output2bus_map[MAX_OUTPUTS];
 569
 570        /* CEC OSD String */
 571        char                            osd[14];
 572        unsigned long                   osd_jiffies;
 573
 574        bool                            meta_pts;
 575        bool                            meta_scr;
 576};
 577
 578static inline bool vivid_is_webcam(const struct vivid_dev *dev)
 579{
 580        return dev->input_type[dev->input] == WEBCAM;
 581}
 582
 583static inline bool vivid_is_tv_cap(const struct vivid_dev *dev)
 584{
 585        return dev->input_type[dev->input] == TV;
 586}
 587
 588static inline bool vivid_is_svid_cap(const struct vivid_dev *dev)
 589{
 590        return dev->input_type[dev->input] == SVID;
 591}
 592
 593static inline bool vivid_is_hdmi_cap(const struct vivid_dev *dev)
 594{
 595        return dev->input_type[dev->input] == HDMI;
 596}
 597
 598static inline bool vivid_is_sdtv_cap(const struct vivid_dev *dev)
 599{
 600        return vivid_is_tv_cap(dev) || vivid_is_svid_cap(dev);
 601}
 602
 603static inline bool vivid_is_svid_out(const struct vivid_dev *dev)
 604{
 605        return dev->output_type[dev->output] == SVID;
 606}
 607
 608static inline bool vivid_is_hdmi_out(const struct vivid_dev *dev)
 609{
 610        return dev->output_type[dev->output] == HDMI;
 611}
 612
 613#endif
 614