162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci#ifndef __PVRUSB2_DEVATTR_H
762306a36Sopenharmony_ci#define __PVRUSB2_DEVATTR_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/mod_devicetable.h>
1062306a36Sopenharmony_ci#include <linux/videodev2.h>
1162306a36Sopenharmony_ci#ifdef CONFIG_VIDEO_PVRUSB2_DVB
1262306a36Sopenharmony_ci#include "pvrusb2-dvb.h"
1362306a36Sopenharmony_ci#endif
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/*
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci  This header defines structures used to describe attributes of a device.
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci*/
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define PVR2_CLIENT_ID_NULL 0
2362306a36Sopenharmony_ci#define PVR2_CLIENT_ID_MSP3400 1
2462306a36Sopenharmony_ci#define PVR2_CLIENT_ID_CX25840 2
2562306a36Sopenharmony_ci#define PVR2_CLIENT_ID_SAA7115 3
2662306a36Sopenharmony_ci#define PVR2_CLIENT_ID_TUNER 4
2762306a36Sopenharmony_ci#define PVR2_CLIENT_ID_CS53L32A 5
2862306a36Sopenharmony_ci#define PVR2_CLIENT_ID_WM8775 6
2962306a36Sopenharmony_ci#define PVR2_CLIENT_ID_DEMOD 7
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_cistruct pvr2_device_client_desc {
3262306a36Sopenharmony_ci	/* One ovr PVR2_CLIENT_ID_xxxx */
3362306a36Sopenharmony_ci	unsigned char module_id;
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci	/* Null-terminated array of I2C addresses to try in order
3662306a36Sopenharmony_ci	   initialize the module.  It's safe to make this null terminated
3762306a36Sopenharmony_ci	   since we're never going to encounter an i2c device with an
3862306a36Sopenharmony_ci	   address of zero.  If this is a null pointer or zero-length,
3962306a36Sopenharmony_ci	   then no I2C addresses have been specified, in which case we'll
4062306a36Sopenharmony_ci	   try some compiled in defaults for now. */
4162306a36Sopenharmony_ci	unsigned char *i2c_address_list;
4262306a36Sopenharmony_ci};
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_cistruct pvr2_device_client_table {
4562306a36Sopenharmony_ci	const struct pvr2_device_client_desc *lst;
4662306a36Sopenharmony_ci	unsigned char cnt;
4762306a36Sopenharmony_ci};
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_cistruct pvr2_string_table {
5162306a36Sopenharmony_ci	const char **lst;
5262306a36Sopenharmony_ci	unsigned int cnt;
5362306a36Sopenharmony_ci};
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci#define PVR2_ROUTING_SCHEME_HAUPPAUGE 0
5662306a36Sopenharmony_ci#define PVR2_ROUTING_SCHEME_GOTVIEW 1
5762306a36Sopenharmony_ci#define PVR2_ROUTING_SCHEME_ONAIR 2
5862306a36Sopenharmony_ci#define PVR2_ROUTING_SCHEME_AV400 3
5962306a36Sopenharmony_ci#define PVR2_ROUTING_SCHEME_HAUP160XXX 4
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#define PVR2_DIGITAL_SCHEME_NONE 0
6262306a36Sopenharmony_ci#define PVR2_DIGITAL_SCHEME_HAUPPAUGE 1
6362306a36Sopenharmony_ci#define PVR2_DIGITAL_SCHEME_ONAIR 2
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#define PVR2_LED_SCHEME_NONE 0
6662306a36Sopenharmony_ci#define PVR2_LED_SCHEME_HAUPPAUGE 1
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci#define PVR2_IR_SCHEME_NONE 0
6962306a36Sopenharmony_ci#define PVR2_IR_SCHEME_24XXX 1 /* FX2-controlled IR */
7062306a36Sopenharmony_ci#define PVR2_IR_SCHEME_ZILOG 2 /* HVR-1950 style (must be taken out of reset) */
7162306a36Sopenharmony_ci#define PVR2_IR_SCHEME_24XXX_MCE 3 /* 24xxx MCE device */
7262306a36Sopenharmony_ci#define PVR2_IR_SCHEME_29XXX 4 /* Original 29xxx device */
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci/* This describes a particular hardware type (except for the USB device ID
7562306a36Sopenharmony_ci   which must live in a separate structure due to environmental
7662306a36Sopenharmony_ci   constraints).  See the top of pvrusb2-hdw.c for where this is
7762306a36Sopenharmony_ci   instantiated. */
7862306a36Sopenharmony_cistruct pvr2_device_desc {
7962306a36Sopenharmony_ci	/* Single line text description of hardware */
8062306a36Sopenharmony_ci	const char *description;
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci	/* Single token identifier for hardware */
8362306a36Sopenharmony_ci	const char *shortname;
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci	/* List of additional client modules we need to load */
8662306a36Sopenharmony_ci	struct pvr2_string_table client_modules;
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci	/* List of defined client modules we need to load */
8962306a36Sopenharmony_ci	struct pvr2_device_client_table client_table;
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci	/* List of FX2 firmware file names we should search; if empty then
9262306a36Sopenharmony_ci	   FX2 firmware check / load is skipped and we assume the device
9362306a36Sopenharmony_ci	   was initialized from internal ROM. */
9462306a36Sopenharmony_ci	struct pvr2_string_table fx2_firmware;
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci#ifdef CONFIG_VIDEO_PVRUSB2_DVB
9762306a36Sopenharmony_ci	/* callback functions to handle attachment of digital tuner & demod */
9862306a36Sopenharmony_ci	const struct pvr2_dvb_props *dvb_props;
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci#endif
10162306a36Sopenharmony_ci	/* Initial standard bits to use for this device, if not zero.
10262306a36Sopenharmony_ci	   Anything set here is also implied as an available standard.
10362306a36Sopenharmony_ci	   Note: This is ignored if overridden on the module load line via
10462306a36Sopenharmony_ci	   the video_std module option. */
10562306a36Sopenharmony_ci	v4l2_std_id default_std_mask;
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci	/* V4L tuner type ID to use with this device (only used if the
10862306a36Sopenharmony_ci	   driver could not discover the type any other way). */
10962306a36Sopenharmony_ci	int default_tuner_type;
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci	/* Signal routing scheme used by device, contains one of
11262306a36Sopenharmony_ci	   PVR2_ROUTING_SCHEME_XXX.  Schemes have to be defined as we
11362306a36Sopenharmony_ci	   encounter them.  This is an arbitrary integer scheme id; its
11462306a36Sopenharmony_ci	   meaning is contained entirely within the driver and is
11562306a36Sopenharmony_ci	   interpreted by logic which must send commands to the chip-level
11662306a36Sopenharmony_ci	   drivers (search for things which touch this field). */
11762306a36Sopenharmony_ci	unsigned char signal_routing_scheme;
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ci	/* Indicates scheme for controlling device's LED (if any).  The
12062306a36Sopenharmony_ci	   driver will turn on the LED when streaming is underway.  This
12162306a36Sopenharmony_ci	   contains one of PVR2_LED_SCHEME_XXX. */
12262306a36Sopenharmony_ci	unsigned char led_scheme;
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci	/* Control scheme to use if there is a digital tuner.  This
12562306a36Sopenharmony_ci	   contains one of PVR2_DIGITAL_SCHEME_XXX.  This is an arbitrary
12662306a36Sopenharmony_ci	   integer scheme id; its meaning is contained entirely within the
12762306a36Sopenharmony_ci	   driver and is interpreted by logic which must control the
12862306a36Sopenharmony_ci	   streaming pathway (search for things which touch this field). */
12962306a36Sopenharmony_ci	unsigned char digital_control_scheme;
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci	/* If set, we don't bother trying to load cx23416 firmware. */
13262306a36Sopenharmony_ci	unsigned int flag_skip_cx23416_firmware:1;
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci	/* If set, the encoder must be healthy in order for digital mode to
13562306a36Sopenharmony_ci	   work (otherwise we assume that digital streaming will work even
13662306a36Sopenharmony_ci	   if we fail to locate firmware for the encoder).  If the device
13762306a36Sopenharmony_ci	   doesn't support digital streaming then this flag has no
13862306a36Sopenharmony_ci	   effect. */
13962306a36Sopenharmony_ci	unsigned int flag_digital_requires_cx23416:1;
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci	/* Device has a hauppauge eeprom which we can interrogate. */
14262306a36Sopenharmony_ci	unsigned int flag_has_hauppauge_rom:1;
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci	/* Device does not require a powerup command to be issued. */
14562306a36Sopenharmony_ci	unsigned int flag_no_powerup:1;
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci	/* Device has a cx25840 - this enables special additional logic to
14862306a36Sopenharmony_ci	   handle it. */
14962306a36Sopenharmony_ci	unsigned int flag_has_cx25840:1;
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci	/* Device has a wm8775 - this enables special additional logic to
15262306a36Sopenharmony_ci	   ensure that it is found. */
15362306a36Sopenharmony_ci	unsigned int flag_has_wm8775:1;
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci	/* Indicate IR scheme of hardware.  If not set, then it is assumed
15662306a36Sopenharmony_ci	   that IR can work without any help from the driver. */
15762306a36Sopenharmony_ci	unsigned int ir_scheme:3;
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci	/* These bits define which kinds of sources the device can handle.
16062306a36Sopenharmony_ci	   Note: Digital tuner presence is inferred by the
16162306a36Sopenharmony_ci	   digital_control_scheme enumeration. */
16262306a36Sopenharmony_ci	unsigned int flag_has_fmradio:1;       /* Has FM radio receiver */
16362306a36Sopenharmony_ci	unsigned int flag_has_analogtuner:1;   /* Has analog tuner */
16462306a36Sopenharmony_ci	unsigned int flag_has_composite:1;     /* Has composite input */
16562306a36Sopenharmony_ci	unsigned int flag_has_svideo:1;        /* Has s-video input */
16662306a36Sopenharmony_ci	unsigned int flag_fx2_16kb:1;          /* 16KB FX2 firmware OK here */
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci	/* If this driver is considered experimental, i.e. not all aspects
16962306a36Sopenharmony_ci	   are working correctly and/or it is untested, mark that fact
17062306a36Sopenharmony_ci	   with this flag. */
17162306a36Sopenharmony_ci	unsigned int flag_is_experimental:1;
17262306a36Sopenharmony_ci};
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ciextern struct usb_device_id pvr2_device_table[];
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ci#endif /* __PVRUSB2_HDW_INTERNAL_H */
177