summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-usb/dvb-usb.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb/dvb-usb/dvb-usb.h')
-rw-r--r--linux/drivers/media/dvb/dvb-usb/dvb-usb.h140
1 files changed, 117 insertions, 23 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb.h b/linux/drivers/media/dvb/dvb-usb/dvb-usb.h
index 1b02ee001..ee2cacc05 100644
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -50,14 +50,31 @@
#undef warn
#define warn(format, arg...) printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg)
+/**
+ * struct dvb_usb_device_description - name and its according USB IDs
+ * @name: real name of the box, regardless which DVB USB device class is in use
+ * @cold_ids: array of struct usb_device_id which describe the device in
+ * pre-firmware state
+ * @warm_ids: array of struct usb_device_id which describe the device in
+ * post-firmware state
+ *
+ * Each DVB USB device class can have one or more actual devices, this struct
+ * assigns a name to it.
+ */
struct dvb_usb_device_description {
- const char *name; /* real name of the box */
+ const char *name;
#define DVB_USB_ID_MAX_NUM 15
- struct usb_device_id *cold_ids[DVB_USB_ID_MAX_NUM]; /* list of USB ids when this device is at pre firmware state */
- struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM]; /* list of USB ids when this device is at post firmware state */
+ struct usb_device_id *cold_ids[DVB_USB_ID_MAX_NUM];
+ struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM];
};
+/**
+ * struct dvb_usb_rc_key - a remote control key and its input-event
+ * @custom: the vendor/custom part of the key
+ * @data: the actual key part
+ * @event: the input event assigned to key identified by custom and data
+ */
struct dvb_usb_rc_key {
u8 custom,data;
u32 event;
@@ -65,7 +82,54 @@ struct dvb_usb_rc_key {
struct dvb_usb_device;
-/* properties of an dvb-usb-device */
+/**
+ * struct dvb_usb_properties - properties of a dvb-usb-device
+ * @caps: capabilites of the DVB USB device.
+ * @pid_filter_count: number of PID filter position in the optional hardware
+ * PID-filter.
+ *
+ * @usb_ctrl: which USB device-side controller is in use. Needed for firmware
+ * download.
+ * @firmware: name of the firmware file.
+ *
+ * @size_of_priv: how many bytes shall be allocated for the private field
+ * of struct dvb_usb_device.
+ *
+ * @power_ctrl: called to enable/disable power of the device.
+ * @streaming_crtl: called to start and stop the MPEG2-TS streaming of the
+ * device (not URB submitting/killing).
+ * @pid_filter_ctrl: called to en/disable the PID filter, if any.
+ * @pid_filter: called to set/unset a PID for filtering.
+ *
+ * @read_mac_address: called to read the MAC address of the device.
+ *
+ * @frontend_attach: called to attach the possible frontends (fill fe-field
+ * of struct dvb_usb_device).
+ * @tuner_attach: called to attach the correct tuner and to fill pll_addr,
+ * pll_desc and pll_init_buf of struct dvb_usb_device).
+ * @identify_state: called to determine the state (cold or warm), when it
+ * is not distinguishable by the USB IDs.
+ *
+ * @rc_key_map: a hard-wired array of struct dvb_usb_rc_key (NULL to disable
+ * remote control handling).
+ * @rc_key_map_size: number of items in @rc_key_map.
+ * @rc_query: called to query an event event.
+ * @rc_interval: time in ms between two queries.
+ *
+ * @i2c_algo: i2c_algorithm if the device has I2CoverUSB.
+ *
+ * @generic_bulk_ctrl_endpoint: most of the DVB USB devices have a generic
+ * endpoint which received control messages with bulk transfers. When this
+ * is non-zero, one can use dvb_usb_generic_rw and dvb_usb_generic_write-
+ * helper functions.
+ *
+ * @urb: describes the kind of USB transfer used for MPEG2-TS-streaming.
+ * Currently only BULK is implemented
+ *
+ * @num_device_descs: number of struct dvb_usb_device_description in @devices
+ * @devices: array of struct dvb_usb_device_description compatibles with these
+ * properties.
+ */
struct dvb_usb_properties {
#define DVB_USB_HAS_PID_FILTER 0x01
@@ -78,25 +142,22 @@ struct dvb_usb_properties {
#define CYPRESS_AN2135 0
#define CYPRESS_AN2235 1
#define CYPRESS_FX2 2
- int usb_ctrl; /* usb controller */
- const char *firmware; /* valid firmware filenames */
+ int usb_ctrl;
+ const char *firmware;
int size_of_priv;
- int (*streaming_ctrl) (struct dvb_usb_device *, int); /* control the MPEG2-TS streaming of the device */
- int (*pid_filter) (struct dvb_usb_device *, int, u16, int); /* if the device has a hardware pid filter */
- int (*pid_filter_ctrl) (struct dvb_usb_device *, int); /* if the device has a hardware pid filter to en-/disable */
-
- int (*read_mac_address) (struct dvb_usb_device *, u8 []); /* callback for reading the MAC address */
+ int (*power_ctrl) (struct dvb_usb_device *, int);
+ int (*streaming_ctrl) (struct dvb_usb_device *, int);
+ int (*pid_filter_ctrl) (struct dvb_usb_device *, int);
+ int (*pid_filter) (struct dvb_usb_device *, int, u16, int);
- int (*power_ctrl) (struct dvb_usb_device *, int); /* power control callback of the device */
+ int (*read_mac_address) (struct dvb_usb_device *, u8 []);
+ int (*frontend_attach) (struct dvb_usb_device *);
+ int (*tuner_attach) (struct dvb_usb_device *);
- int (*frontend_attach) (struct dvb_usb_device *); /* each device has to know about its frontends */
- int (*tuner_attach) (struct dvb_usb_device *); /* each device has to know about its tuners */
-
- int (*identify_state) (struct usb_device *, struct dvb_usb_properties *, struct dvb_usb_device_description **, int *);
- /* if the state (cold or warm) is not distinguishable by the USB IDs,
- * the dvb-usb-device has to provie this callback to determine it*/
+ int (*identify_state) (struct usb_device *, struct dvb_usb_properties *,
+ struct dvb_usb_device_description **, int *);
/* remote control properties */
#define REMOTE_NO_KEY_PRESSED 0x00
@@ -104,16 +165,13 @@ struct dvb_usb_properties {
#define REMOTE_KEY_REPEAT 0x02
struct dvb_usb_rc_key *rc_key_map;
int rc_key_map_size;
- int (*query_rc) (struct dvb_usb_device *, u32 *, int *); /* remote query callback - NULL no ir-receiver */
+ int (*rc_query) (struct dvb_usb_device *, u32 *, int *);
int rc_interval;
-/* i2c algorithm, if any */
struct i2c_algorithm *i2c_algo;
-/* endpoint for generic bulk read/write operations (used by many drivers for controlling the device) */
int generic_bulk_ctrl_endpoint;
-/* MPEG2 TS transfer description */
struct {
#define DVB_USB_BULK 1
#define DVB_USB_ISOC 2
@@ -136,6 +194,42 @@ struct dvb_usb_properties {
struct dvb_usb_device_description devices[];
};
+
+/**
+ * struct dvb_usb_device - object of a DVB USB device
+ * @props: copy of the struct dvb_usb_properties this device belongs to.
+ * @desc: pointer to the device's struct dvb_usb_device_description.
+ * @state: initialization and runtime state of the device.
+ *
+ * @udev: pointer to the device's struct usb_device.
+ * @urb_list: array of dynamically allocated struct urb for the MPEG2-TS-
+ * streaming.
+ * @buffer: buffer used to streaming.
+ * @dma_handle: dma_addr_t for buffer.
+ * @urbs_initialized: number of URBs initialized.
+ * @urbs_submitted: number of URBs submitted.
+ * @feedcount: number of reqested feeds (used for streaming-activation)
+ * @pid_filtering: is hardware pid_filtering used or not.
+ * @usb_sem: semaphore of USB control messages (reading needs two messages)
+ * @i2c_sem: semaphore for i2c-transfers
+ * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB
+ * @dvb_adap: device's dvb_adapter.
+ * @dmxdev: device's dmxdev.
+ * @demux: device's software demuxer.
+ * @dvb_net: device's dvb_net interfaces.
+ * @dvb_frontend: device's frontend.
+ * @max_feed_count: how many feeds can be handled simultaneously by this
+ * device
+ * @fe_sleep: rerouted frontend-sleep function.
+ * @fe_init: rerouted frontend-init (wakeup) function.
+ * @rc_input_dev: input device for the remote control.
+ * @rc_query_work: struct work_struct frequent rc queries
+ * @last_event: last triggered event
+ * @last_state: last state (no, pressed, repeat)
+ * @owner: owner of the dvb_adapter
+ * @priv: private data of the actual driver (allocate by dvb-usb, size defined
+ * in size_of_priv of dvb_usb_properties).
+ */
struct dvb_usb_device {
struct dvb_usb_properties props;
struct dvb_usb_device_description *desc;
@@ -147,7 +241,7 @@ struct dvb_usb_device {
#define DVB_USB_STATE_I2C 0x008
#define DVB_USB_STATE_REMOTE 0x010
#define DVB_USB_STATE_URB_SUBMIT 0x020
- int init_state;
+ int state;
/* usb */
struct usb_device *udev;