| 
									
										
										
										
											2012-06-20 23:09:41 -03:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * DVB USB framework | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2004-6 Patrick Boettcher <patrick.boettcher@desy.de> | 
					
						
							|  |  |  |  * Copyright (C) 2012 Antti Palosaari <crope@iki.fi> | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2012-06-20 23:09:41 -03:00
										 |  |  |  *    This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |  *    it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |  *    the Free Software Foundation; either version 2 of the License, or | 
					
						
							|  |  |  |  *    (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2012-06-20 23:09:41 -03:00
										 |  |  |  *    This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  *    but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  *    GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *    You should have received a copy of the GNU General Public License along | 
					
						
							|  |  |  |  *    with this program; if not, write to the Free Software Foundation, Inc., | 
					
						
							|  |  |  |  *    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-06-20 23:09:41 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | #ifndef DVB_USB_H
 | 
					
						
							|  |  |  | #define DVB_USB_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | #include <linux/usb/input.h>
 | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | #include <linux/firmware.h>
 | 
					
						
							|  |  |  | #include <media/rc-core.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "dvb_frontend.h"
 | 
					
						
							|  |  |  | #include "dvb_demux.h"
 | 
					
						
							|  |  |  | #include "dvb_net.h"
 | 
					
						
							|  |  |  | #include "dmxdev.h"
 | 
					
						
							| 
									
										
										
										
											2012-08-05 19:50:15 -03:00
										 |  |  | #include "dvb-usb-ids.h"
 | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * device file: /dev/dvb/adapter[0-1]/frontend[0-2] | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * |-- device | 
					
						
							|  |  |  |  * |   |-- adapter0 | 
					
						
							|  |  |  |  * |   |   |-- frontend0 | 
					
						
							|  |  |  |  * |   |   |-- frontend1 | 
					
						
							|  |  |  |  * |   |   `-- frontend2 | 
					
						
							|  |  |  |  * |   `-- adapter1 | 
					
						
							|  |  |  |  * |       |-- frontend0 | 
					
						
							|  |  |  |  * |       |-- frontend1 | 
					
						
							|  |  |  |  * |       `-- frontend2 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Commonly used variable names: | 
					
						
							|  |  |  |  * d = pointer to device (struct dvb_usb_device *) | 
					
						
							|  |  |  |  * adap = pointer to adapter (struct dvb_usb_adapter *) | 
					
						
							|  |  |  |  * fe = pointer to frontend (struct dvb_frontend *) | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use macros defined in that file to resolve needed pointers. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-16 17:58:53 -03:00
										 |  |  | /* helper macros for every DVB USB driver use */ | 
					
						
							| 
									
										
										
										
											2012-06-18 20:09:07 -03:00
										 |  |  | #define adap_to_d(adap) (container_of(adap, struct dvb_usb_device, \
 | 
					
						
							|  |  |  | 		adapter[adap->id])) | 
					
						
							| 
									
										
										
										
											2012-06-16 17:58:53 -03:00
										 |  |  | #define adap_to_priv(adap) (adap_to_d(adap)->priv)
 | 
					
						
							|  |  |  | #define fe_to_adap(fe) ((struct dvb_usb_adapter *) ((fe)->dvb->priv))
 | 
					
						
							|  |  |  | #define fe_to_d(fe) (adap_to_d(fe_to_adap(fe)))
 | 
					
						
							|  |  |  | #define fe_to_priv(fe) (fe_to_d(fe)->priv)
 | 
					
						
							|  |  |  | #define d_to_priv(d) (d->priv)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-22 19:41:59 -03:00
										 |  |  | #define dvb_usb_dbg_usb_control_msg(udev, r, t, v, i, b, l) { \
 | 
					
						
							|  |  |  | 	char *direction; \ | 
					
						
							|  |  |  | 	if (t == (USB_TYPE_VENDOR | USB_DIR_OUT)) \ | 
					
						
							|  |  |  | 		direction = ">>>"; \ | 
					
						
							|  |  |  | 	else \ | 
					
						
							|  |  |  | 		direction = "<<<"; \ | 
					
						
							|  |  |  | 	dev_dbg(&udev->dev, "%s: %02x %02x %02x %02x %02x %02x %02x %02x " \ | 
					
						
							|  |  |  | 			"%s %*ph\n",  __func__, t, r, v & 0xff, v >> 8, \ | 
					
						
							|  |  |  | 			i & 0xff, i >> 8, l & 0xff, l >> 8, direction, l, b); \ | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-16 13:56:37 -03:00
										 |  |  | #define DVB_USB_STREAM_BULK(endpoint_, count_, size_) { \
 | 
					
						
							|  |  |  | 	.type = USB_BULK, \ | 
					
						
							|  |  |  | 	.count = count_, \ | 
					
						
							|  |  |  | 	.endpoint = endpoint_, \ | 
					
						
							|  |  |  | 	.u = { \ | 
					
						
							|  |  |  | 		.bulk = { \ | 
					
						
							|  |  |  | 			.buffersize = size_, \ | 
					
						
							|  |  |  | 		} \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define DVB_USB_STREAM_ISOC(endpoint_, count_, frames_, size_, interval_) { \
 | 
					
						
							|  |  |  | 	.type = USB_ISOC, \ | 
					
						
							|  |  |  | 	.count = count_, \ | 
					
						
							|  |  |  | 	.endpoint = endpoint_, \ | 
					
						
							|  |  |  | 	.u = { \ | 
					
						
							|  |  |  | 		.isoc = { \ | 
					
						
							|  |  |  | 			.framesperurb = frames_, \ | 
					
						
							|  |  |  | 			.framesize = size_,\ | 
					
						
							|  |  |  | 			.interval = interval_, \ | 
					
						
							|  |  |  | 		} \ | 
					
						
							|  |  |  | 	} \ | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-04 20:12:55 -03:00
										 |  |  | #define DVB_USB_DEVICE(vend, prod, props_, name_, rc) \
 | 
					
						
							|  |  |  | 	.match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ | 
					
						
							|  |  |  | 	.idVendor = (vend), \ | 
					
						
							|  |  |  | 	.idProduct = (prod), \ | 
					
						
							| 
									
										
										
										
											2012-06-12 01:34:22 -03:00
										 |  |  | 	.driver_info = (kernel_ulong_t) &((const struct dvb_usb_driver_info) { \ | 
					
						
							| 
									
										
										
										
											2012-06-04 20:12:55 -03:00
										 |  |  | 		.props = (props_), \ | 
					
						
							|  |  |  | 		.name = (name_), \ | 
					
						
							|  |  |  | 		.rc_map = (rc), \ | 
					
						
							|  |  |  | 	}) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | struct dvb_usb_device; | 
					
						
							|  |  |  | struct dvb_usb_adapter; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * structure for carrying all needed data from the device driver to the general | 
					
						
							|  |  |  |  * dvb usb routines | 
					
						
							|  |  |  |  * @name: device name | 
					
						
							|  |  |  |  * @rc_map: name of rc codes table | 
					
						
							|  |  |  |  * @props: structure containing all device properties | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-06-16 13:56:37 -03:00
										 |  |  | struct dvb_usb_driver_info { | 
					
						
							|  |  |  | 	const char *name; | 
					
						
							|  |  |  | 	const char *rc_map; | 
					
						
							|  |  |  | 	const struct dvb_usb_device_properties *props; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * structure for remote controller configuration | 
					
						
							|  |  |  |  * @map_name: name of rc codes table | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  |  * @allowed_protos: protocol(s) supported by the driver | 
					
						
							|  |  |  |  * @change_protocol: callback to change protocol | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * @query: called to query an event from the device | 
					
						
							|  |  |  |  * @interval: time in ms between two queries | 
					
						
							|  |  |  |  * @driver_type: used to point if a device supports raw mode | 
					
						
							|  |  |  |  * @bulk_mode: device supports bulk mode for rc (disable polling mode) | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  |  */ | 
					
						
							|  |  |  | struct dvb_usb_rc { | 
					
						
							| 
									
										
										
										
											2012-07-05 19:57:07 -03:00
										 |  |  | 	const char *map_name; | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	u64 allowed_protos; | 
					
						
							| 
									
										
										
										
											2012-10-11 19:11:54 -03:00
										 |  |  | 	int (*change_protocol)(struct rc_dev *dev, u64 *rc_type); | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	int (*query) (struct dvb_usb_device *d); | 
					
						
							|  |  |  | 	unsigned int interval; | 
					
						
							| 
									
										
										
										
											2013-04-20 20:02:12 -03:00
										 |  |  | 	enum rc_driver_type driver_type; | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	bool bulk_mode; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * usb streaming configration for adapter | 
					
						
							|  |  |  |  * @type: urb type | 
					
						
							|  |  |  |  * @count: count of used urbs | 
					
						
							|  |  |  |  * @endpoint: stream usb endpoint number | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  |  */ | 
					
						
							|  |  |  | struct usb_data_stream_properties { | 
					
						
							|  |  |  | #define USB_BULK  1
 | 
					
						
							|  |  |  | #define USB_ISOC  2
 | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	u8 type; | 
					
						
							|  |  |  | 	u8 count; | 
					
						
							|  |  |  | 	u8 endpoint; | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	union { | 
					
						
							|  |  |  | 		struct { | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 			unsigned int buffersize; /* per URB */ | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 		} bulk; | 
					
						
							|  |  |  | 		struct { | 
					
						
							|  |  |  | 			int framesperurb; | 
					
						
							|  |  |  | 			int framesize; | 
					
						
							|  |  |  | 			int interval; | 
					
						
							|  |  |  | 		} isoc; | 
					
						
							|  |  |  | 	} u; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * properties of dvb usb device adapter | 
					
						
							|  |  |  |  * @caps: adapter capabilities | 
					
						
							|  |  |  |  * @pid_filter_count: pid count of adapter pid-filter | 
					
						
							|  |  |  |  * @pid_filter_ctrl: called to enable/disable pid-filter | 
					
						
							|  |  |  |  * @pid_filter: called to set/unset pid for filtering | 
					
						
							|  |  |  |  * @stream: adapter usb stream configuration | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  |  */ | 
					
						
							|  |  |  | #define MAX_NO_OF_FE_PER_ADAP 3
 | 
					
						
							|  |  |  | struct dvb_usb_adapter_properties { | 
					
						
							| 
									
										
										
										
											2012-05-29 18:05:40 -03:00
										 |  |  | #define DVB_USB_ADAP_HAS_PID_FILTER               0x01
 | 
					
						
							|  |  |  | #define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02
 | 
					
						
							|  |  |  | #define DVB_USB_ADAP_NEED_PID_FILTERING           0x04
 | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	u8 caps; | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	u8 pid_filter_count; | 
					
						
							| 
									
										
										
										
											2012-05-29 18:05:40 -03:00
										 |  |  | 	int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int); | 
					
						
							|  |  |  | 	int (*pid_filter) (struct dvb_usb_adapter *, int, u16, int); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-29 16:12:17 -03:00
										 |  |  | 	struct usb_data_stream_properties stream; | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * struct dvb_usb_device_properties - properties of a dvb-usb-device | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * @driver_name: name of the owning driver module | 
					
						
							| 
									
										
										
										
											2012-05-23 15:03:56 -03:00
										 |  |  |  * @owner: owner of the dvb_adapter | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * @adapter_nr: values from the DVB_DEFINE_MOD_OPT_ADAPTER_NR() macro | 
					
						
							|  |  |  |  * @bInterfaceNumber: usb interface number driver binds | 
					
						
							|  |  |  |  * @size_of_priv: bytes allocated for the driver private data | 
					
						
							|  |  |  |  * @generic_bulk_ctrl_endpoint: bulk control endpoint number for sent | 
					
						
							|  |  |  |  * @generic_bulk_ctrl_endpoint_response: bulk control endpoint number for | 
					
						
							|  |  |  |  *  receive | 
					
						
							|  |  |  |  * @generic_bulk_ctrl_delay: delay between bulk control sent and receive message | 
					
						
							|  |  |  |  * @identify_state: called to determine the firmware state (cold or warm) and | 
					
						
							|  |  |  |  *  return possible firmware file name to be loaded | 
					
						
							|  |  |  |  * @firmware: name of the firmware file to be loaded | 
					
						
							|  |  |  |  * @download_firmware: called to download the firmware | 
					
						
							|  |  |  |  * @i2c_algo: i2c_algorithm if the device has i2c-adapter | 
					
						
							|  |  |  |  * @num_adapters: dvb usb device adapter count | 
					
						
							|  |  |  |  * @get_adapter_count: called to resolve adapter count | 
					
						
							|  |  |  |  * @adapter: array of all adapter properties of device | 
					
						
							|  |  |  |  * @power_ctrl: called to enable/disable power of the device | 
					
						
							|  |  |  |  * @read_config: called to resolve device configuration | 
					
						
							|  |  |  |  * @read_mac_address: called to resolve adapter mac-address | 
					
						
							|  |  |  |  * @frontend_attach: called to attach the possible frontends | 
					
						
							|  |  |  |  * @tuner_attach: called to attach the possible tuners | 
					
						
							|  |  |  |  * @frontend_ctrl: called to power on/off active frontend | 
					
						
							|  |  |  |  * @streaming_ctrl: called to start/stop the usb streaming of adapter | 
					
						
							| 
									
										
										
										
											2012-05-23 10:44:15 -03:00
										 |  |  |  * @init: called after adapters are created in order to finalize device | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  *  configuration | 
					
						
							|  |  |  |  * @exit: called when driver is unloaded | 
					
						
							|  |  |  |  * @get_rc_config: called to resolve used remote controller configuration | 
					
						
							|  |  |  |  * @get_stream_config: called to resolve input and output stream configuration | 
					
						
							|  |  |  |  *  of the adapter just before streaming is started. input stream is transport | 
					
						
							|  |  |  |  *  stream from the demodulator and output stream is usb stream to host. | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  |  */ | 
					
						
							|  |  |  | #define MAX_NO_OF_ADAPTER_PER_DEVICE 2
 | 
					
						
							|  |  |  | struct dvb_usb_device_properties { | 
					
						
							| 
									
										
										
										
											2012-05-26 11:43:24 -03:00
										 |  |  | 	const char *driver_name; | 
					
						
							| 
									
										
										
										
											2012-05-23 15:03:56 -03:00
										 |  |  | 	struct module *owner; | 
					
						
							| 
									
										
										
										
											2012-05-23 16:23:44 -03:00
										 |  |  | 	short *adapter_nr; | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 17:34:41 -03:00
										 |  |  | 	u8 bInterfaceNumber; | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	unsigned int size_of_priv; | 
					
						
							|  |  |  | 	u8 generic_bulk_ctrl_endpoint; | 
					
						
							|  |  |  | 	u8 generic_bulk_ctrl_endpoint_response; | 
					
						
							| 
									
										
										
										
											2012-06-20 20:27:42 -03:00
										 |  |  | 	unsigned int generic_bulk_ctrl_delay; | 
					
						
							| 
									
										
										
										
											2012-05-25 12:28:43 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-18 23:42:53 -03:00
										 |  |  | #define WARM                  0
 | 
					
						
							|  |  |  | #define COLD                  1
 | 
					
						
							|  |  |  | 	int (*identify_state) (struct dvb_usb_device *, const char **); | 
					
						
							| 
									
										
										
										
											2012-05-25 12:28:43 -03:00
										 |  |  | 	const char *firmware; | 
					
						
							| 
									
										
										
										
											2012-06-18 23:42:53 -03:00
										 |  |  | #define RECONNECTS_USB        1
 | 
					
						
							| 
									
										
										
										
											2012-05-24 14:44:21 -03:00
										 |  |  | 	int (*download_firmware) (struct dvb_usb_device *, | 
					
						
							|  |  |  | 			const struct firmware *); | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	struct i2c_algorithm *i2c_algo; | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	unsigned int num_adapters; | 
					
						
							|  |  |  | 	int (*get_adapter_count) (struct dvb_usb_device *); | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  | 	struct dvb_usb_adapter_properties adapter[MAX_NO_OF_ADAPTER_PER_DEVICE]; | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	int (*power_ctrl) (struct dvb_usb_device *, int); | 
					
						
							| 
									
										
										
										
											2012-05-24 22:18:37 -03:00
										 |  |  | 	int (*read_config) (struct dvb_usb_device *d); | 
					
						
							| 
									
										
										
										
											2012-06-15 21:17:04 -03:00
										 |  |  | 	int (*read_mac_address) (struct dvb_usb_adapter *, u8 []); | 
					
						
							| 
									
										
										
										
											2012-06-12 01:05:20 -03:00
										 |  |  | 	int (*frontend_attach) (struct dvb_usb_adapter *); | 
					
						
							|  |  |  | 	int (*tuner_attach) (struct dvb_usb_adapter *); | 
					
						
							|  |  |  | 	int (*frontend_ctrl) (struct dvb_frontend *, int); | 
					
						
							| 
									
										
										
										
											2012-06-26 00:04:33 -03:00
										 |  |  | 	int (*streaming_ctrl) (struct dvb_frontend *, int); | 
					
						
							| 
									
										
										
										
											2012-05-23 10:44:15 -03:00
										 |  |  | 	int (*init) (struct dvb_usb_device *); | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	void (*exit) (struct dvb_usb_device *); | 
					
						
							| 
									
										
										
										
											2012-05-26 11:43:24 -03:00
										 |  |  | 	int (*get_rc_config) (struct dvb_usb_device *, struct dvb_usb_rc *); | 
					
						
							| 
									
										
										
										
											2012-06-18 22:54:16 -03:00
										 |  |  | #define DVB_USB_FE_TS_TYPE_188        0
 | 
					
						
							|  |  |  | #define DVB_USB_FE_TS_TYPE_204        1
 | 
					
						
							|  |  |  | #define DVB_USB_FE_TS_TYPE_RAW        2
 | 
					
						
							|  |  |  | 	int (*get_stream_config) (struct dvb_frontend *,  u8 *, | 
					
						
							| 
									
										
										
										
											2012-05-28 21:28:01 -03:00
										 |  |  | 			struct usb_data_stream_properties *); | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * generic object of an usb stream | 
					
						
							|  |  |  |  * @buf_num: number of buffer allocated | 
					
						
							|  |  |  |  * @buf_size: size of each buffer in buf_list | 
					
						
							|  |  |  |  * @buf_list: array containing all allocate buffers for streaming | 
					
						
							|  |  |  |  * @dma_addr: list of dma_addr_t for each buffer in buf_list | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * @urbs_initialized: number of URBs initialized | 
					
						
							|  |  |  |  * @urbs_submitted: number of URBs submitted | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  |  */ | 
					
						
							|  |  |  | #define MAX_NO_URBS_FOR_DATA_STREAM 10
 | 
					
						
							|  |  |  | struct usb_data_stream { | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	struct usb_device *udev; | 
					
						
							|  |  |  | 	struct usb_data_stream_properties props; | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define USB_STATE_INIT    0x00
 | 
					
						
							|  |  |  | #define USB_STATE_URB_BUF 0x01
 | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	u8 state; | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	void (*complete) (struct usb_data_stream *, u8 *, size_t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	struct urb    *urb_list[MAX_NO_URBS_FOR_DATA_STREAM]; | 
					
						
							|  |  |  | 	int            buf_num; | 
					
						
							|  |  |  | 	unsigned long  buf_size; | 
					
						
							|  |  |  | 	u8            *buf_list[MAX_NO_URBS_FOR_DATA_STREAM]; | 
					
						
							|  |  |  | 	dma_addr_t     dma_addr[MAX_NO_URBS_FOR_DATA_STREAM]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int urbs_initialized; | 
					
						
							|  |  |  | 	int urbs_submitted; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void *user_priv; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * dvb adapter object on dvb usb device | 
					
						
							|  |  |  |  * @props: pointer to adapter properties | 
					
						
							|  |  |  |  * @stream: adapter the usb data stream | 
					
						
							|  |  |  |  * @id: index of this adapter (starting with 0) | 
					
						
							|  |  |  |  * @ts_type: transport stream, input stream, type | 
					
						
							| 
									
										
										
										
											2012-08-14 22:21:06 -03:00
										 |  |  |  * @suspend_resume_active: set when there is ongoing suspend / resume | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * @pid_filtering: is hardware pid_filtering used or not | 
					
						
							|  |  |  |  * @feed_count: current feed count | 
					
						
							|  |  |  |  * @max_feed_count: maimum feed count device can handle | 
					
						
							|  |  |  |  * @dvb_adap: adapter dvb_adapter | 
					
						
							|  |  |  |  * @dmxdev: adapter dmxdev | 
					
						
							|  |  |  |  * @demux: adapter software demuxer | 
					
						
							|  |  |  |  * @dvb_net: adapter dvb_net interfaces | 
					
						
							|  |  |  |  * @sync_mutex: mutex used to sync control and streaming of the adapter | 
					
						
							|  |  |  |  * @fe: adapter frontends | 
					
						
							|  |  |  |  * @fe_init: rerouted frontend-init function | 
					
						
							|  |  |  |  * @fe_sleep: rerouted frontend-sleep function | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  |  */ | 
					
						
							|  |  |  | struct dvb_usb_adapter { | 
					
						
							| 
									
										
										
										
											2012-06-12 16:25:01 -03:00
										 |  |  | 	const struct dvb_usb_adapter_properties *props; | 
					
						
							| 
									
										
										
										
											2012-05-29 18:05:40 -03:00
										 |  |  | 	struct usb_data_stream stream; | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	u8 id; | 
					
						
							| 
									
										
										
										
											2012-06-18 22:54:16 -03:00
										 |  |  | 	u8 ts_type; | 
					
						
							| 
									
										
										
										
											2012-08-14 22:21:06 -03:00
										 |  |  | 	bool suspend_resume_active; | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	bool pid_filtering; | 
					
						
							|  |  |  | 	u8 feed_count; | 
					
						
							|  |  |  | 	u8 max_feed_count; | 
					
						
							|  |  |  | 	s8 active_fe; | 
					
						
							| 
									
										
										
										
											2013-03-09 00:16:32 -03:00
										 |  |  | #define ADAP_INIT                0
 | 
					
						
							|  |  |  | #define ADAP_SLEEP               1
 | 
					
						
							|  |  |  | #define ADAP_STREAMING           2
 | 
					
						
							|  |  |  | 	unsigned long state_bits; | 
					
						
							| 
									
										
										
										
											2012-06-17 00:27:00 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 	/* dvb */ | 
					
						
							|  |  |  | 	struct dvb_adapter   dvb_adap; | 
					
						
							|  |  |  | 	struct dmxdev        dmxdev; | 
					
						
							|  |  |  | 	struct dvb_demux     demux; | 
					
						
							|  |  |  | 	struct dvb_net       dvb_net; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-29 22:20:24 -03:00
										 |  |  | 	struct dvb_frontend *fe[MAX_NO_OF_FE_PER_ADAP]; | 
					
						
							|  |  |  | 	int (*fe_init[MAX_NO_OF_FE_PER_ADAP]) (struct dvb_frontend *); | 
					
						
							|  |  |  | 	int (*fe_sleep[MAX_NO_OF_FE_PER_ADAP]) (struct dvb_frontend *); | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * dvb usb device object | 
					
						
							|  |  |  |  * @props: device properties | 
					
						
							|  |  |  |  * @name: device name | 
					
						
							|  |  |  |  * @rc_map: name of rc codes table | 
					
						
							| 
									
										
										
										
											2012-12-09 21:23:30 -03:00
										 |  |  |  * @rc_polling_active: set when RC polling is active | 
					
						
							| 
									
										
										
										
											2012-06-20 22:22:14 -03:00
										 |  |  |  * @udev: pointer to the device's struct usb_device | 
					
						
							|  |  |  |  * @rc: remote controller configuration | 
					
						
							|  |  |  |  * @powered: indicated whether the device is power or not | 
					
						
							|  |  |  |  * @usb_mutex: mutex for usb control messages | 
					
						
							|  |  |  |  * @i2c_mutex: mutex for i2c-transfers | 
					
						
							|  |  |  |  * @i2c_adap: device's i2c-adapter | 
					
						
							|  |  |  |  * @rc_dev: rc device for the remote control | 
					
						
							|  |  |  |  * @rc_query_work: work for polling remote | 
					
						
							|  |  |  |  * @priv: private data of the actual driver (allocate by dvb usb, size defined | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  |  *  in size_of_priv of dvb_usb_properties). | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | struct dvb_usb_device { | 
					
						
							| 
									
										
										
										
											2012-06-12 16:25:01 -03:00
										 |  |  | 	const struct dvb_usb_device_properties *props; | 
					
						
							| 
									
										
										
										
											2012-05-24 20:00:28 -03:00
										 |  |  | 	const char *name; | 
					
						
							| 
									
										
										
										
											2012-05-25 10:19:03 -03:00
										 |  |  | 	const char *rc_map; | 
					
						
							| 
									
										
										
										
											2012-12-09 21:23:30 -03:00
										 |  |  | 	bool rc_polling_active; | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 	struct usb_device *udev; | 
					
						
							| 
									
										
										
										
											2012-06-20 00:32:53 -03:00
										 |  |  | 	struct dvb_usb_rc rc; | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 	int powered; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* locking */ | 
					
						
							|  |  |  | 	struct mutex usb_mutex; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* i2c */ | 
					
						
							|  |  |  | 	struct mutex i2c_mutex; | 
					
						
							|  |  |  | 	struct i2c_adapter i2c_adap; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* remote control */ | 
					
						
							|  |  |  | 	struct rc_dev *rc_dev; | 
					
						
							|  |  |  | 	char rc_phys[64]; | 
					
						
							|  |  |  | 	struct delayed_work rc_query_work; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void *priv; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 16:23:40 -03:00
										 |  |  | extern int dvb_usbv2_probe(struct usb_interface *, | 
					
						
							| 
									
										
										
										
											2012-05-23 16:23:44 -03:00
										 |  |  | 		const struct usb_device_id *); | 
					
						
							| 
									
										
										
										
											2012-06-07 16:23:40 -03:00
										 |  |  | extern void dvb_usbv2_disconnect(struct usb_interface *); | 
					
						
							| 
									
										
										
										
											2012-06-11 17:47:04 -03:00
										 |  |  | extern int dvb_usbv2_suspend(struct usb_interface *, pm_message_t); | 
					
						
							|  |  |  | extern int dvb_usbv2_resume(struct usb_interface *); | 
					
						
							| 
									
										
										
										
											2012-08-14 22:21:07 -03:00
										 |  |  | extern int dvb_usbv2_reset_resume(struct usb_interface *); | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* the generic read/write method for device control */ | 
					
						
							| 
									
										
										
										
											2012-06-20 20:27:42 -03:00
										 |  |  | extern int dvb_usbv2_generic_rw(struct dvb_usb_device *, u8 *, u16, u8 *, u16); | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | extern int dvb_usbv2_generic_write(struct dvb_usb_device *, u8 *, u16); | 
					
						
							| 
									
										
										
										
											2013-02-26 13:01:48 -03:00
										 |  |  | /* caller must hold lock when locked versions are called */ | 
					
						
							|  |  |  | extern int dvb_usbv2_generic_rw_locked(struct dvb_usb_device *, | 
					
						
							|  |  |  | 		u8 *, u16, u8 *, u16); | 
					
						
							|  |  |  | extern int dvb_usbv2_generic_write_locked(struct dvb_usb_device *, u8 *, u16); | 
					
						
							| 
									
										
										
										
											2012-05-23 10:06:09 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif
 |