xref: /OK3568_Linux_fs/kernel/drivers/media/usb/pvrusb2/pvrusb2-devattr.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun #ifndef __PVRUSB2_DEVATTR_H
7*4882a593Smuzhiyun #define __PVRUSB2_DEVATTR_H
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #include <linux/mod_devicetable.h>
10*4882a593Smuzhiyun #include <linux/videodev2.h>
11*4882a593Smuzhiyun #ifdef CONFIG_VIDEO_PVRUSB2_DVB
12*4882a593Smuzhiyun #include "pvrusb2-dvb.h"
13*4882a593Smuzhiyun #endif
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun /*
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun   This header defines structures used to describe attributes of a device.
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun */
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun #define PVR2_CLIENT_ID_NULL 0
23*4882a593Smuzhiyun #define PVR2_CLIENT_ID_MSP3400 1
24*4882a593Smuzhiyun #define PVR2_CLIENT_ID_CX25840 2
25*4882a593Smuzhiyun #define PVR2_CLIENT_ID_SAA7115 3
26*4882a593Smuzhiyun #define PVR2_CLIENT_ID_TUNER 4
27*4882a593Smuzhiyun #define PVR2_CLIENT_ID_CS53L32A 5
28*4882a593Smuzhiyun #define PVR2_CLIENT_ID_WM8775 6
29*4882a593Smuzhiyun #define PVR2_CLIENT_ID_DEMOD 7
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun struct pvr2_device_client_desc {
32*4882a593Smuzhiyun 	/* One ovr PVR2_CLIENT_ID_xxxx */
33*4882a593Smuzhiyun 	unsigned char module_id;
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun 	/* Null-terminated array of I2C addresses to try in order
36*4882a593Smuzhiyun 	   initialize the module.  It's safe to make this null terminated
37*4882a593Smuzhiyun 	   since we're never going to encounter an i2c device with an
38*4882a593Smuzhiyun 	   address of zero.  If this is a null pointer or zero-length,
39*4882a593Smuzhiyun 	   then no I2C addresses have been specified, in which case we'll
40*4882a593Smuzhiyun 	   try some compiled in defaults for now. */
41*4882a593Smuzhiyun 	unsigned char *i2c_address_list;
42*4882a593Smuzhiyun };
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun struct pvr2_device_client_table {
45*4882a593Smuzhiyun 	const struct pvr2_device_client_desc *lst;
46*4882a593Smuzhiyun 	unsigned char cnt;
47*4882a593Smuzhiyun };
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun struct pvr2_string_table {
51*4882a593Smuzhiyun 	const char **lst;
52*4882a593Smuzhiyun 	unsigned int cnt;
53*4882a593Smuzhiyun };
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun #define PVR2_ROUTING_SCHEME_HAUPPAUGE 0
56*4882a593Smuzhiyun #define PVR2_ROUTING_SCHEME_GOTVIEW 1
57*4882a593Smuzhiyun #define PVR2_ROUTING_SCHEME_ONAIR 2
58*4882a593Smuzhiyun #define PVR2_ROUTING_SCHEME_AV400 3
59*4882a593Smuzhiyun #define PVR2_ROUTING_SCHEME_HAUP160XXX 4
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun #define PVR2_DIGITAL_SCHEME_NONE 0
62*4882a593Smuzhiyun #define PVR2_DIGITAL_SCHEME_HAUPPAUGE 1
63*4882a593Smuzhiyun #define PVR2_DIGITAL_SCHEME_ONAIR 2
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun #define PVR2_LED_SCHEME_NONE 0
66*4882a593Smuzhiyun #define PVR2_LED_SCHEME_HAUPPAUGE 1
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun #define PVR2_IR_SCHEME_NONE 0
69*4882a593Smuzhiyun #define PVR2_IR_SCHEME_24XXX 1 /* FX2-controlled IR */
70*4882a593Smuzhiyun #define PVR2_IR_SCHEME_ZILOG 2 /* HVR-1950 style (must be taken out of reset) */
71*4882a593Smuzhiyun #define PVR2_IR_SCHEME_24XXX_MCE 3 /* 24xxx MCE device */
72*4882a593Smuzhiyun #define PVR2_IR_SCHEME_29XXX 4 /* Original 29xxx device */
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun /* This describes a particular hardware type (except for the USB device ID
75*4882a593Smuzhiyun    which must live in a separate structure due to environmental
76*4882a593Smuzhiyun    constraints).  See the top of pvrusb2-hdw.c for where this is
77*4882a593Smuzhiyun    instantiated. */
78*4882a593Smuzhiyun struct pvr2_device_desc {
79*4882a593Smuzhiyun 	/* Single line text description of hardware */
80*4882a593Smuzhiyun 	const char *description;
81*4882a593Smuzhiyun 
82*4882a593Smuzhiyun 	/* Single token identifier for hardware */
83*4882a593Smuzhiyun 	const char *shortname;
84*4882a593Smuzhiyun 
85*4882a593Smuzhiyun 	/* List of additional client modules we need to load */
86*4882a593Smuzhiyun 	struct pvr2_string_table client_modules;
87*4882a593Smuzhiyun 
88*4882a593Smuzhiyun 	/* List of defined client modules we need to load */
89*4882a593Smuzhiyun 	struct pvr2_device_client_table client_table;
90*4882a593Smuzhiyun 
91*4882a593Smuzhiyun 	/* List of FX2 firmware file names we should search; if empty then
92*4882a593Smuzhiyun 	   FX2 firmware check / load is skipped and we assume the device
93*4882a593Smuzhiyun 	   was initialized from internal ROM. */
94*4882a593Smuzhiyun 	struct pvr2_string_table fx2_firmware;
95*4882a593Smuzhiyun 
96*4882a593Smuzhiyun #ifdef CONFIG_VIDEO_PVRUSB2_DVB
97*4882a593Smuzhiyun 	/* callback functions to handle attachment of digital tuner & demod */
98*4882a593Smuzhiyun 	const struct pvr2_dvb_props *dvb_props;
99*4882a593Smuzhiyun 
100*4882a593Smuzhiyun #endif
101*4882a593Smuzhiyun 	/* Initial standard bits to use for this device, if not zero.
102*4882a593Smuzhiyun 	   Anything set here is also implied as an available standard.
103*4882a593Smuzhiyun 	   Note: This is ignored if overridden on the module load line via
104*4882a593Smuzhiyun 	   the video_std module option. */
105*4882a593Smuzhiyun 	v4l2_std_id default_std_mask;
106*4882a593Smuzhiyun 
107*4882a593Smuzhiyun 	/* V4L tuner type ID to use with this device (only used if the
108*4882a593Smuzhiyun 	   driver could not discover the type any other way). */
109*4882a593Smuzhiyun 	int default_tuner_type;
110*4882a593Smuzhiyun 
111*4882a593Smuzhiyun 	/* Signal routing scheme used by device, contains one of
112*4882a593Smuzhiyun 	   PVR2_ROUTING_SCHEME_XXX.  Schemes have to be defined as we
113*4882a593Smuzhiyun 	   encounter them.  This is an arbitrary integer scheme id; its
114*4882a593Smuzhiyun 	   meaning is contained entirely within the driver and is
115*4882a593Smuzhiyun 	   interpreted by logic which must send commands to the chip-level
116*4882a593Smuzhiyun 	   drivers (search for things which touch this field). */
117*4882a593Smuzhiyun 	unsigned char signal_routing_scheme;
118*4882a593Smuzhiyun 
119*4882a593Smuzhiyun 	/* Indicates scheme for controlling device's LED (if any).  The
120*4882a593Smuzhiyun 	   driver will turn on the LED when streaming is underway.  This
121*4882a593Smuzhiyun 	   contains one of PVR2_LED_SCHEME_XXX. */
122*4882a593Smuzhiyun 	unsigned char led_scheme;
123*4882a593Smuzhiyun 
124*4882a593Smuzhiyun 	/* Control scheme to use if there is a digital tuner.  This
125*4882a593Smuzhiyun 	   contains one of PVR2_DIGITAL_SCHEME_XXX.  This is an arbitrary
126*4882a593Smuzhiyun 	   integer scheme id; its meaning is contained entirely within the
127*4882a593Smuzhiyun 	   driver and is interpreted by logic which must control the
128*4882a593Smuzhiyun 	   streaming pathway (search for things which touch this field). */
129*4882a593Smuzhiyun 	unsigned char digital_control_scheme;
130*4882a593Smuzhiyun 
131*4882a593Smuzhiyun 	/* If set, we don't bother trying to load cx23416 firmware. */
132*4882a593Smuzhiyun 	unsigned int flag_skip_cx23416_firmware:1;
133*4882a593Smuzhiyun 
134*4882a593Smuzhiyun 	/* If set, the encoder must be healthy in order for digital mode to
135*4882a593Smuzhiyun 	   work (otherwise we assume that digital streaming will work even
136*4882a593Smuzhiyun 	   if we fail to locate firmware for the encoder).  If the device
137*4882a593Smuzhiyun 	   doesn't support digital streaming then this flag has no
138*4882a593Smuzhiyun 	   effect. */
139*4882a593Smuzhiyun 	unsigned int flag_digital_requires_cx23416:1;
140*4882a593Smuzhiyun 
141*4882a593Smuzhiyun 	/* Device has a hauppauge eeprom which we can interrogate. */
142*4882a593Smuzhiyun 	unsigned int flag_has_hauppauge_rom:1;
143*4882a593Smuzhiyun 
144*4882a593Smuzhiyun 	/* Device does not require a powerup command to be issued. */
145*4882a593Smuzhiyun 	unsigned int flag_no_powerup:1;
146*4882a593Smuzhiyun 
147*4882a593Smuzhiyun 	/* Device has a cx25840 - this enables special additional logic to
148*4882a593Smuzhiyun 	   handle it. */
149*4882a593Smuzhiyun 	unsigned int flag_has_cx25840:1;
150*4882a593Smuzhiyun 
151*4882a593Smuzhiyun 	/* Device has a wm8775 - this enables special additional logic to
152*4882a593Smuzhiyun 	   ensure that it is found. */
153*4882a593Smuzhiyun 	unsigned int flag_has_wm8775:1;
154*4882a593Smuzhiyun 
155*4882a593Smuzhiyun 	/* Indicate IR scheme of hardware.  If not set, then it is assumed
156*4882a593Smuzhiyun 	   that IR can work without any help from the driver. */
157*4882a593Smuzhiyun 	unsigned int ir_scheme:3;
158*4882a593Smuzhiyun 
159*4882a593Smuzhiyun 	/* These bits define which kinds of sources the device can handle.
160*4882a593Smuzhiyun 	   Note: Digital tuner presence is inferred by the
161*4882a593Smuzhiyun 	   digital_control_scheme enumeration. */
162*4882a593Smuzhiyun 	unsigned int flag_has_fmradio:1;       /* Has FM radio receiver */
163*4882a593Smuzhiyun 	unsigned int flag_has_analogtuner:1;   /* Has analog tuner */
164*4882a593Smuzhiyun 	unsigned int flag_has_composite:1;     /* Has composite input */
165*4882a593Smuzhiyun 	unsigned int flag_has_svideo:1;        /* Has s-video input */
166*4882a593Smuzhiyun 	unsigned int flag_fx2_16kb:1;          /* 16KB FX2 firmware OK here */
167*4882a593Smuzhiyun 
168*4882a593Smuzhiyun 	/* If this driver is considered experimental, i.e. not all aspects
169*4882a593Smuzhiyun 	   are working correctly and/or it is untested, mark that fact
170*4882a593Smuzhiyun 	   with this flag. */
171*4882a593Smuzhiyun 	unsigned int flag_is_experimental:1;
172*4882a593Smuzhiyun };
173*4882a593Smuzhiyun 
174*4882a593Smuzhiyun extern struct usb_device_id pvr2_device_table[];
175*4882a593Smuzhiyun 
176*4882a593Smuzhiyun #endif /* __PVRUSB2_HDW_INTERNAL_H */
177