brintos

brintos / linux-shallow public Read only

0
0
Text · 4.1 KiB · ae9cf5b Raw
140 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3 *  cx18 functions to query card hardware4 *5 *  Derived from ivtv-cards.c6 *7 *  Copyright (C) 2007  Hans Verkuil <hverkuil@xs4all.nl>8 *  Copyright (C) 2008  Andy Walls <awalls@md.metrocast.net>9 */10 11/* hardware flags */12#define CX18_HW_TUNER			(1 << 0)13#define CX18_HW_TVEEPROM		(1 << 1)14#define CX18_HW_CS5345			(1 << 2)15#define CX18_HW_DVB			(1 << 3)16#define CX18_HW_418_AV			(1 << 4)17#define CX18_HW_GPIO_MUX		(1 << 5)18#define CX18_HW_GPIO_RESET_CTRL		(1 << 6)19#define CX18_HW_Z8F0811_IR_HAUP		(1 << 7)20 21/* video inputs */22#define	CX18_CARD_INPUT_VID_TUNER	123#define	CX18_CARD_INPUT_SVIDEO1		224#define	CX18_CARD_INPUT_SVIDEO2		325#define	CX18_CARD_INPUT_COMPOSITE1	426#define	CX18_CARD_INPUT_COMPOSITE2	527#define	CX18_CARD_INPUT_COMPONENT1	628 29/* audio inputs */30#define	CX18_CARD_INPUT_AUD_TUNER	131#define	CX18_CARD_INPUT_LINE_IN1	232#define	CX18_CARD_INPUT_LINE_IN2	333 34#define CX18_CARD_MAX_VIDEO_INPUTS 635#define CX18_CARD_MAX_AUDIO_INPUTS 336#define CX18_CARD_MAX_TUNERS	   237 38/* V4L2 capability aliases */39#define CX18_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \40			  V4L2_CAP_AUDIO | V4L2_CAP_READWRITE | \41			  V4L2_CAP_STREAMING | V4L2_CAP_VBI_CAPTURE | \42			  V4L2_CAP_SLICED_VBI_CAPTURE)43 44struct cx18_card_video_input {45	u8  video_type;		/* video input type */46	u8  audio_index;	/* index in cx18_card_audio_input array */47	u32 video_input;	/* hardware video input */48};49 50struct cx18_card_audio_input {51	u8  audio_type;		/* audio input type */52	u32 audio_input;	/* hardware audio input */53	u16 muxer_input;	/* hardware muxer input for boards with a54				   multiplexer chip */55};56 57struct cx18_card_pci_info {58	u16 device;59	u16 subsystem_vendor;60	u16 subsystem_device;61};62 63/* GPIO definitions */64 65/* The mask is the set of bits used by the operation */66 67struct cx18_gpio_init { /* set initial GPIO DIR and OUT values */68	u32 direction;	/* DIR setting. Leave to 0 if no init is needed */69	u32 initial_value;70};71 72struct cx18_gpio_i2c_slave_reset {73	u32 active_lo_mask; /* GPIO outputs that reset i2c chips when low */74	u32 active_hi_mask; /* GPIO outputs that reset i2c chips when high */75	int msecs_asserted; /* time period reset must remain asserted */76	int msecs_recovery; /* time after deassert for chips to be ready */77	u32 ir_reset_mask;  /* GPIO to reset the Zilog Z8F0811 IR controller */78};79 80struct cx18_gpio_audio_input {	/* select tuner/line in input */81	u32 mask;		/* leave to 0 if not supported */82	u32 tuner;83	u32 linein;84	u32 radio;85};86 87struct cx18_card_tuner {88	v4l2_std_id std;	/* standard for which the tuner is suitable */89	int	    tuner;	/* tuner ID (from tuner.h) */90};91 92struct cx18_card_tuner_i2c {93	unsigned short radio[2];/* radio tuner i2c address to probe */94	unsigned short demod[3];/* demodulator i2c address to probe */95	unsigned short tv[4];	/* tv tuner i2c addresses to probe */96};97 98struct cx18_ddr {		/* DDR config data */99	u32 chip_config;100	u32 refresh;101	u32 timing1;102	u32 timing2;103	u32 tune_lane;104	u32 initial_emrs;105};106 107/* for card information/parameters */108struct cx18_card {109	int type;110	char *name;111	char *comment;112	u32 v4l2_capabilities;113	u32 hw_audio_ctrl;	/* hardware used for the V4L2 controls (only114				   1 dev allowed currently) */115	u32 hw_muxer;		/* hardware used to multiplex audio input */116	u32 hw_all;		/* all hardware used by the board */117	struct cx18_card_video_input video_inputs[CX18_CARD_MAX_VIDEO_INPUTS];118	struct cx18_card_audio_input audio_inputs[CX18_CARD_MAX_AUDIO_INPUTS];119	struct cx18_card_audio_input radio_input;120 121	/* GPIO card-specific settings */122	u8 xceive_pin;		/* XCeive tuner GPIO reset pin */123	struct cx18_gpio_init		 gpio_init;124	struct cx18_gpio_i2c_slave_reset gpio_i2c_slave_reset;125	struct cx18_gpio_audio_input    gpio_audio_input;126 127	struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS];128	struct cx18_card_tuner_i2c *i2c;129 130	struct cx18_ddr ddr;131 132	/* list of device and subsystem vendor/devices that133	   correspond to this card type. */134	const struct cx18_card_pci_info *pci_list;135};136 137int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input);138int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *input);139const struct cx18_card *cx18_get_card(u16 index);140