18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci   cx231xx_vbi.h - driver for Conexant Cx23100/101/102 USB video capture devices
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci   Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
68c2ecf20Sopenharmony_ci		Based on cx88 driver
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef _CX231XX_VBI_H
118c2ecf20Sopenharmony_ci#define _CX231XX_VBI_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciextern struct vb2_ops cx231xx_vbi_qops;
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define   NTSC_VBI_START_LINE 10	/* line 10 - 21 */
168c2ecf20Sopenharmony_ci#define   NTSC_VBI_END_LINE   21
178c2ecf20Sopenharmony_ci#define   NTSC_VBI_LINES	  (NTSC_VBI_END_LINE-NTSC_VBI_START_LINE+1)
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define   PAL_VBI_START_LINE  6
208c2ecf20Sopenharmony_ci#define   PAL_VBI_END_LINE    23
218c2ecf20Sopenharmony_ci#define   PAL_VBI_LINES       (PAL_VBI_END_LINE-PAL_VBI_START_LINE+1)
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define   VBI_STRIDE            1440
248c2ecf20Sopenharmony_ci#define   VBI_SAMPLES_PER_LINE  1440
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define   CX231XX_NUM_VBI_PACKETS       4
278c2ecf20Sopenharmony_ci#define   CX231XX_NUM_VBI_BUFS          5
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* stream functions */
308c2ecf20Sopenharmony_ciint cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
318c2ecf20Sopenharmony_ci			  int num_bufs, int max_pkt_size,
328c2ecf20Sopenharmony_ci			  int (*bulk_copy) (struct cx231xx *dev,
338c2ecf20Sopenharmony_ci					    struct urb *urb));
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_civoid cx231xx_uninit_vbi_isoc(struct cx231xx *dev);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/* vbi data copy functions */
388c2ecf20Sopenharmony_ciu32 cx231xx_get_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
398c2ecf20Sopenharmony_ci			 u8 sav_eav, u8 *p_buffer, u32 buffer_size);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciu32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
428c2ecf20Sopenharmony_ci			  u8 *p_line, u32 length, int field_number);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_civoid cx231xx_reset_vbi_buffer(struct cx231xx *dev,
458c2ecf20Sopenharmony_ci			      struct cx231xx_dmaqueue *dma_q);
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciint cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
488c2ecf20Sopenharmony_ci			u8 *p_buffer, u32 bytes_to_copy);
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciu8 cx231xx_is_vbi_buffer_done(struct cx231xx *dev,
518c2ecf20Sopenharmony_ci			      struct cx231xx_dmaqueue *dma_q);
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#endif
54