linux/drivers/media/platform/ti/davinci/vpif.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * VPIF header file
 *
 * Copyright (C) 2009 Texas Instruments Incorporated - https://www.ti.com/
 */

#ifndef VPIF_H
#define VPIF_H

#include <linux/io.h>
#include <linux/videodev2.h>
#include <media/davinci/vpif_types.h>

/* Maximum channel allowed */
#define VPIF_NUM_CHANNELS
#define VPIF_CAPTURE_NUM_CHANNELS
#define VPIF_DISPLAY_NUM_CHANNELS

/* Macros to read/write registers */
extern void __iomem *vpif_base;
extern spinlock_t vpif_lock;

#define regr(reg)
#define regw(value, reg)

/* Register Address Offsets */
#define VPIF_PID
#define VPIF_CH0_CTRL
#define VPIF_CH1_CTRL
#define VPIF_CH2_CTRL
#define VPIF_CH3_CTRL

#define VPIF_INTEN
#define VPIF_INTEN_SET
#define VPIF_INTEN_CLR
#define VPIF_STATUS
#define VPIF_STATUS_CLR
#define VPIF_EMULATION_CTRL
#define VPIF_REQ_SIZE

#define VPIF_CH0_TOP_STRT_ADD_LUMA
#define VPIF_CH0_BTM_STRT_ADD_LUMA
#define VPIF_CH0_TOP_STRT_ADD_CHROMA
#define VPIF_CH0_BTM_STRT_ADD_CHROMA
#define VPIF_CH0_TOP_STRT_ADD_HANC
#define VPIF_CH0_BTM_STRT_ADD_HANC
#define VPIF_CH0_TOP_STRT_ADD_VANC
#define VPIF_CH0_BTM_STRT_ADD_VANC
#define VPIF_CH0_SP_CFG
#define VPIF_CH0_IMG_ADD_OFST
#define VPIF_CH0_HANC_ADD_OFST
#define VPIF_CH0_H_CFG
#define VPIF_CH0_V_CFG_00
#define VPIF_CH0_V_CFG_01
#define VPIF_CH0_V_CFG_02
#define VPIF_CH0_V_CFG_03

#define VPIF_CH1_TOP_STRT_ADD_LUMA
#define VPIF_CH1_BTM_STRT_ADD_LUMA
#define VPIF_CH1_TOP_STRT_ADD_CHROMA
#define VPIF_CH1_BTM_STRT_ADD_CHROMA
#define VPIF_CH1_TOP_STRT_ADD_HANC
#define VPIF_CH1_BTM_STRT_ADD_HANC
#define VPIF_CH1_TOP_STRT_ADD_VANC
#define VPIF_CH1_BTM_STRT_ADD_VANC
#define VPIF_CH1_SP_CFG
#define VPIF_CH1_IMG_ADD_OFST
#define VPIF_CH1_HANC_ADD_OFST
#define VPIF_CH1_H_CFG
#define VPIF_CH1_V_CFG_00
#define VPIF_CH1_V_CFG_01
#define VPIF_CH1_V_CFG_02
#define VPIF_CH1_V_CFG_03

#define VPIF_CH2_TOP_STRT_ADD_LUMA
#define VPIF_CH2_BTM_STRT_ADD_LUMA
#define VPIF_CH2_TOP_STRT_ADD_CHROMA
#define VPIF_CH2_BTM_STRT_ADD_CHROMA
#define VPIF_CH2_TOP_STRT_ADD_HANC
#define VPIF_CH2_BTM_STRT_ADD_HANC
#define VPIF_CH2_TOP_STRT_ADD_VANC
#define VPIF_CH2_BTM_STRT_ADD_VANC
#define VPIF_CH2_SP_CFG
#define VPIF_CH2_IMG_ADD_OFST
#define VPIF_CH2_HANC_ADD_OFST
#define VPIF_CH2_H_CFG
#define VPIF_CH2_V_CFG_00
#define VPIF_CH2_V_CFG_01
#define VPIF_CH2_V_CFG_02
#define VPIF_CH2_V_CFG_03
#define VPIF_CH2_HANC0_STRT
#define VPIF_CH2_HANC0_SIZE
#define VPIF_CH2_HANC1_STRT
#define VPIF_CH2_HANC1_SIZE
#define VPIF_CH2_VANC0_STRT
#define VPIF_CH2_VANC0_SIZE
#define VPIF_CH2_VANC1_STRT
#define VPIF_CH2_VANC1_SIZE

#define VPIF_CH3_TOP_STRT_ADD_LUMA
#define VPIF_CH3_BTM_STRT_ADD_LUMA
#define VPIF_CH3_TOP_STRT_ADD_CHROMA
#define VPIF_CH3_BTM_STRT_ADD_CHROMA
#define VPIF_CH3_TOP_STRT_ADD_HANC
#define VPIF_CH3_BTM_STRT_ADD_HANC
#define VPIF_CH3_TOP_STRT_ADD_VANC
#define VPIF_CH3_BTM_STRT_ADD_VANC
#define VPIF_CH3_SP_CFG
#define VPIF_CH3_IMG_ADD_OFST
#define VPIF_CH3_HANC_ADD_OFST
#define VPIF_CH3_H_CFG
#define VPIF_CH3_V_CFG_00
#define VPIF_CH3_V_CFG_01
#define VPIF_CH3_V_CFG_02
#define VPIF_CH3_V_CFG_03
#define VPIF_CH3_HANC0_STRT
#define VPIF_CH3_HANC0_SIZE
#define VPIF_CH3_HANC1_STRT
#define VPIF_CH3_HANC1_SIZE
#define VPIF_CH3_VANC0_STRT
#define VPIF_CH3_VANC0_SIZE
#define VPIF_CH3_VANC1_STRT
#define VPIF_CH3_VANC1_SIZE

#define VPIF_IODFT_CTRL

/* Functions for bit Manipulation */
static inline void vpif_set_bit(u32 reg, u32 bit)
{}

static inline void vpif_clr_bit(u32 reg, u32 bit)
{}

/* Macro for Generating mask */
#ifdef GENERATE_MASK
#undef GENERATE_MASK
#endif

#define GENERATE_MASK(bits, pos)

/* Bit positions in the channel control registers */
#define VPIF_CH_DATA_MODE_BIT
#define VPIF_CH_YC_MUX_BIT
#define VPIF_CH_SDR_FMT_BIT
#define VPIF_CH_HANC_EN_BIT
#define VPIF_CH_VANC_EN_BIT

#define VPIF_CAPTURE_CH_NIP
#define VPIF_DISPLAY_CH_NIP

#define VPIF_DISPLAY_PIX_EN_BIT

#define VPIF_CH_INPUT_FIELD_FRAME_BIT

#define VPIF_CH_FID_POLARITY_BIT
#define VPIF_CH_V_VALID_POLARITY_BIT
#define VPIF_CH_H_VALID_POLARITY_BIT
#define VPIF_CH_DATA_WIDTH_BIT

#define VPIF_CH_CLK_EDGE_CTRL_BIT

/* Mask various length */
#define VPIF_CH_EAVSAV_MASK
#define VPIF_CH_LEN_MASK
#define VPIF_CH_WIDTH_MASK
#define VPIF_CH_LEN_SHIFT

/* VPIF masks for registers */
#define VPIF_REQ_SIZE_MASK

/* bit posotion of interrupt vpif_ch_intr register */
#define VPIF_INTEN_FRAME_CH0
#define VPIF_INTEN_FRAME_CH1
#define VPIF_INTEN_FRAME_CH2
#define VPIF_INTEN_FRAME_CH3

/* bit position of clock and channel enable in vpif_chn_ctrl register */

#define VPIF_CH0_CLK_EN
#define VPIF_CH0_EN
#define VPIF_CH1_CLK_EN
#define VPIF_CH1_EN
#define VPIF_CH2_CLK_EN
#define VPIF_CH2_EN
#define VPIF_CH3_CLK_EN
#define VPIF_CH3_EN
#define VPIF_CH_CLK_EN
#define VPIF_CH_EN

#define VPIF_INT_TOP
#define VPIF_INT_BOTTOM
#define VPIF_INT_BOTH

#define VPIF_CH0_INT_CTRL_SHIFT
#define VPIF_CH1_INT_CTRL_SHIFT
#define VPIF_CH2_INT_CTRL_SHIFT
#define VPIF_CH3_INT_CTRL_SHIFT
#define VPIF_CH_INT_CTRL_SHIFT

#define VPIF_CH2_CLIP_ANC_EN
#define VPIF_CH2_CLIP_ACTIVE_EN

#define VPIF_CH3_CLIP_ANC_EN
#define VPIF_CH3_CLIP_ACTIVE_EN

/* enabled interrupt on both the fields on vpid_ch0_ctrl register */
#define channel0_intr_assert()

/* enabled interrupt on both the fields on vpid_ch1_ctrl register */
#define channel1_intr_assert()

/* enabled interrupt on both the fields on vpid_ch0_ctrl register */
#define channel2_intr_assert()

/* enabled interrupt on both the fields on vpid_ch1_ctrl register */
#define channel3_intr_assert()

#define VPIF_CH_FID_MASK
#define VPIF_CH_FID_SHIFT

#define VPIF_NTSC_VBI_START_FIELD0
#define VPIF_NTSC_VBI_START_FIELD1
#define VPIF_PAL_VBI_START_FIELD0
#define VPIF_PAL_VBI_START_FIELD1

#define VPIF_NTSC_HBI_START_FIELD0
#define VPIF_NTSC_HBI_START_FIELD1
#define VPIF_PAL_HBI_START_FIELD0
#define VPIF_PAL_HBI_START_FIELD1

#define VPIF_NTSC_VBI_COUNT_FIELD0
#define VPIF_NTSC_VBI_COUNT_FIELD1
#define VPIF_PAL_VBI_COUNT_FIELD0
#define VPIF_PAL_VBI_COUNT_FIELD1

#define VPIF_NTSC_HBI_COUNT_FIELD0
#define VPIF_NTSC_HBI_COUNT_FIELD1
#define VPIF_PAL_HBI_COUNT_FIELD0
#define VPIF_PAL_HBI_COUNT_FIELD1

#define VPIF_NTSC_VBI_SAMPLES_PER_LINE
#define VPIF_PAL_VBI_SAMPLES_PER_LINE
#define VPIF_NTSC_HBI_SAMPLES_PER_LINE
#define VPIF_PAL_HBI_SAMPLES_PER_LINE

#define VPIF_CH_VANC_EN
#define VPIF_DMA_REQ_SIZE
#define VPIF_EMULATION_DISABLE

extern u8 irq_vpif_capture_channel[VPIF_NUM_CHANNELS];

/* inline function to enable/disable channel0 */
static inline void enable_channel0(int enable)
{}

/* inline function to enable/disable channel1 */
static inline void enable_channel1(int enable)
{}

/* inline function to enable interrupt for channel0 */
static inline void channel0_intr_enable(int enable)
{}

/* inline function to enable interrupt for channel1 */
static inline void channel1_intr_enable(int enable)
{}

/* inline function to set buffer addresses in case of Y/C non mux mode */
static inline void ch0_set_video_buf_addr_yc_nmux(unsigned long top_strt_luma,
						  unsigned long btm_strt_luma,
						  unsigned long top_strt_chroma,
						  unsigned long btm_strt_chroma)
{}

/* inline function to set buffer addresses in VPIF registers for video data */
static inline void ch0_set_video_buf_addr(unsigned long top_strt_luma,
					  unsigned long btm_strt_luma,
					  unsigned long top_strt_chroma,
					  unsigned long btm_strt_chroma)
{}

static inline void ch1_set_video_buf_addr(unsigned long top_strt_luma,
					  unsigned long btm_strt_luma,
					  unsigned long top_strt_chroma,
					  unsigned long btm_strt_chroma)
{}

static inline void ch0_set_vbi_addr(unsigned long top_vbi,
	unsigned long btm_vbi, unsigned long a, unsigned long b)
{}

static inline void ch0_set_hbi_addr(unsigned long top_vbi,
	unsigned long btm_vbi, unsigned long a, unsigned long b)
{}

static inline void ch1_set_vbi_addr(unsigned long top_vbi,
	unsigned long btm_vbi, unsigned long a, unsigned long b)
{}

static inline void ch1_set_hbi_addr(unsigned long top_vbi,
	unsigned long btm_vbi, unsigned long a, unsigned long b)
{}

/* Inline function to enable raw vbi in the given channel */
static inline void disable_raw_feature(u8 channel_id, u8 index)
{}

static inline void enable_raw_feature(u8 channel_id, u8 index)
{}

/* inline function to enable/disable channel2 */
static inline void enable_channel2(int enable)
{}

/* inline function to enable/disable channel3 */
static inline void enable_channel3(int enable)
{}

/* inline function to enable interrupt for channel2 */
static inline void channel2_intr_enable(int enable)
{}

/* inline function to enable interrupt for channel3 */
static inline void channel3_intr_enable(int enable)
{}

/* inline function to enable raw vbi data for channel2 */
static inline void channel2_raw_enable(int enable, u8 index)
{}

/* inline function to enable raw vbi data for channel3*/
static inline void channel3_raw_enable(int enable, u8 index)
{}

/* function to enable clipping (for both active and blanking regions) on ch 2 */
static inline void channel2_clipping_enable(int enable)
{}

/* function to enable clipping (for both active and blanking regions) on ch 3 */
static inline void channel3_clipping_enable(int enable)
{}

/* inline function to set buffer addresses in case of Y/C non mux mode */
static inline void ch2_set_video_buf_addr_yc_nmux(unsigned long top_strt_luma,
						  unsigned long btm_strt_luma,
						  unsigned long top_strt_chroma,
						  unsigned long btm_strt_chroma)
{}

/* inline function to set buffer addresses in VPIF registers for video data */
static inline void ch2_set_video_buf_addr(unsigned long top_strt_luma,
					  unsigned long btm_strt_luma,
					  unsigned long top_strt_chroma,
					  unsigned long btm_strt_chroma)
{}

static inline void ch3_set_video_buf_addr(unsigned long top_strt_luma,
					  unsigned long btm_strt_luma,
					  unsigned long top_strt_chroma,
					  unsigned long btm_strt_chroma)
{}

/* inline function to set buffer addresses in VPIF registers for vbi data */
static inline void ch2_set_vbi_addr(unsigned long top_strt_luma,
				    unsigned long btm_strt_luma,
				    unsigned long top_strt_chroma,
				    unsigned long btm_strt_chroma)
{}

static inline void ch3_set_vbi_addr(unsigned long top_strt_luma,
				    unsigned long btm_strt_luma,
				    unsigned long top_strt_chroma,
				    unsigned long btm_strt_chroma)
{}

static inline int vpif_intr_status(int channel)
{}

#define VPIF_MAX_NAME

/* This structure will store size parameters as per the mode selected by user */
struct vpif_channel_config_params {};

extern const unsigned int vpif_ch_params_count;
extern const struct vpif_channel_config_params vpif_ch_params[];

struct vpif_video_params;
struct vpif_params;
struct vpif_vbi_params;

int vpif_set_video_params(struct vpif_params *vpifparams, u8 channel_id);
void vpif_set_vbi_display_params(struct vpif_vbi_params *vbiparams,
							u8 channel_id);
int vpif_channel_getfid(u8 channel_id);

enum data_size {};

/* Structure for vpif parameters for raw vbi data */
struct vpif_vbi_params {};

/* structure for vpif parameters */
struct vpif_video_params {};

struct vpif_params {};

#endif				/* End of #ifndef VPIF_H */