162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci   cx231xx_vbi.h - driver for Conexant Cx23100/101/102 USB video capture devices
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci   Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
662306a36Sopenharmony_ci		Based on cx88 driver
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef _CX231XX_VBI_H
1162306a36Sopenharmony_ci#define _CX231XX_VBI_H
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciextern struct vb2_ops cx231xx_vbi_qops;
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define   NTSC_VBI_START_LINE 10	/* line 10 - 21 */
1662306a36Sopenharmony_ci#define   NTSC_VBI_END_LINE   21
1762306a36Sopenharmony_ci#define   NTSC_VBI_LINES	  (NTSC_VBI_END_LINE-NTSC_VBI_START_LINE+1)
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define   PAL_VBI_START_LINE  6
2062306a36Sopenharmony_ci#define   PAL_VBI_END_LINE    23
2162306a36Sopenharmony_ci#define   PAL_VBI_LINES       (PAL_VBI_END_LINE-PAL_VBI_START_LINE+1)
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#define   VBI_STRIDE            1440
2462306a36Sopenharmony_ci#define   VBI_SAMPLES_PER_LINE  1440
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#define   CX231XX_NUM_VBI_PACKETS       4
2762306a36Sopenharmony_ci#define   CX231XX_NUM_VBI_BUFS          5
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/* stream functions */
3062306a36Sopenharmony_ciint cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
3162306a36Sopenharmony_ci			  int num_bufs, int max_pkt_size,
3262306a36Sopenharmony_ci			  int (*bulk_copy) (struct cx231xx *dev,
3362306a36Sopenharmony_ci					    struct urb *urb));
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_civoid cx231xx_uninit_vbi_isoc(struct cx231xx *dev);
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* vbi data copy functions */
3862306a36Sopenharmony_ciu32 cx231xx_get_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
3962306a36Sopenharmony_ci			 u8 sav_eav, u8 *p_buffer, u32 buffer_size);
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ciu32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
4262306a36Sopenharmony_ci			  u8 *p_line, u32 length, int field_number);
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_civoid cx231xx_reset_vbi_buffer(struct cx231xx *dev,
4562306a36Sopenharmony_ci			      struct cx231xx_dmaqueue *dma_q);
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciint cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
4862306a36Sopenharmony_ci			u8 *p_buffer, u32 bytes_to_copy);
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ciu8 cx231xx_is_vbi_buffer_done(struct cx231xx *dev,
5162306a36Sopenharmony_ci			      struct cx231xx_dmaqueue *dma_q);
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#endif
54