Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 1 | /* dvb-usb.h is part of the DVB USB library. |
| 2 | * |
| 3 | * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de) |
| 4 | * see dvb-usb-init.c for copyright information. |
| 5 | * |
| 6 | * the headerfile, all dvb-usb-drivers have to include. |
| 7 | * |
| 8 | * TODO: clean-up the structures for unused fields and update the comments |
| 9 | */ |
| 10 | #ifndef DVB_USB_H |
| 11 | #define DVB_USB_H |
| 12 | |
| 13 | #include <linux/input.h> |
| 14 | #include <linux/usb.h> |
| 15 | #include <linux/firmware.h> |
| 16 | #include <linux/mutex.h> |
| 17 | #include <media/rc-core.h> |
| 18 | |
| 19 | #include "dvb_frontend.h" |
| 20 | #include "dvb_demux.h" |
| 21 | #include "dvb_net.h" |
| 22 | #include "dmxdev.h" |
| 23 | |
| 24 | #include "dvb-pll.h" |
| 25 | |
| 26 | #include "dvb-usb-ids.h" |
| 27 | |
| 28 | /* debug */ |
| 29 | #ifdef CONFIG_DVB_USB_DEBUG |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 30 | #define dprintk(var, level, args...) \ |
| 31 | do { if ((var & level)) { printk(args); } } while (0) |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 32 | |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 33 | #define debug_dump(b, l, func) {\ |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 34 | int loop_; \ |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 35 | for (loop_ = 0; loop_ < l; loop_++) \ |
| 36 | func("%02x ", b[loop_]); \ |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 37 | func("\n");\ |
| 38 | } |
| 39 | #define DVB_USB_DEBUG_STATUS |
| 40 | #else |
| 41 | #define dprintk(args...) |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 42 | #define debug_dump(b, l, func) |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 43 | |
| 44 | #define DVB_USB_DEBUG_STATUS " (debugging is not enabled)" |
| 45 | |
| 46 | #endif |
| 47 | |
| 48 | /* generic log methods - taken from usb.h */ |
| 49 | #ifndef DVB_USB_LOG_PREFIX |
| 50 | #define DVB_USB_LOG_PREFIX "dvb-usb (please define a log prefix)" |
| 51 | #endif |
| 52 | |
| 53 | #undef err |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 54 | #define err(format, arg...) \ |
| 55 | printk(KERN_ERR DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 56 | #undef info |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 57 | #define info(format, arg...) \ |
| 58 | printk(KERN_INFO DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 59 | #undef warn |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 60 | #define warn(format, arg...) \ |
| 61 | printk(KERN_WARNING DVB_USB_LOG_PREFIX ": " format "\n" , ## arg) |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 62 | |
Antti Palosaari | 7dfd124 | 2012-05-24 20:00:28 -0300 | [diff] [blame^] | 63 | struct dvb_usb_driver_info { |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 64 | const char *name; |
Antti Palosaari | 7dfd124 | 2012-05-24 20:00:28 -0300 | [diff] [blame^] | 65 | const struct dvb_usb_device_properties *props; |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | static inline u8 rc5_custom(struct rc_map_table *key) |
| 69 | { |
| 70 | return (key->scancode >> 8) & 0xff; |
| 71 | } |
| 72 | |
| 73 | static inline u8 rc5_data(struct rc_map_table *key) |
| 74 | { |
| 75 | return key->scancode & 0xff; |
| 76 | } |
| 77 | |
| 78 | static inline u16 rc5_scan(struct rc_map_table *key) |
| 79 | { |
| 80 | return key->scancode & 0xffff; |
| 81 | } |
| 82 | |
| 83 | struct dvb_usb_device; |
| 84 | struct dvb_usb_adapter; |
| 85 | struct usb_data_stream; |
| 86 | |
| 87 | /** |
| 88 | * Properties of USB streaming - TODO this structure should be somewhere else |
| 89 | * describes the kind of USB transfer used for data-streaming. |
| 90 | * (BULK or ISOC) |
| 91 | */ |
| 92 | struct usb_data_stream_properties { |
| 93 | #define USB_BULK 1 |
| 94 | #define USB_ISOC 2 |
| 95 | int type; |
| 96 | int count; |
| 97 | int endpoint; |
| 98 | |
| 99 | union { |
| 100 | struct { |
| 101 | int buffersize; /* per URB */ |
| 102 | } bulk; |
| 103 | struct { |
| 104 | int framesperurb; |
| 105 | int framesize; |
| 106 | int interval; |
| 107 | } isoc; |
| 108 | } u; |
| 109 | }; |
| 110 | |
| 111 | /** |
| 112 | * struct dvb_usb_adapter_properties - properties of a dvb-usb-adapter. |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 113 | * A DVB-USB-Adapter is basically a dvb_adapter which is present on a |
| 114 | * USB-device. |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 115 | * @caps: capabilities of the DVB USB device. |
| 116 | * @pid_filter_count: number of PID filter position in the optional hardware |
| 117 | * PID-filter. |
| 118 | * @num_frontends: number of frontends of the DVB USB adapter. |
| 119 | * @frontend_ctrl: called to power on/off active frontend. |
| 120 | * @streaming_ctrl: called to start and stop the MPEG2-TS streaming of the |
| 121 | * device (not URB submitting/killing). |
| 122 | * @pid_filter_ctrl: called to en/disable the PID filter, if any. |
| 123 | * @pid_filter: called to set/unset a PID for filtering. |
| 124 | * @frontend_attach: called to attach the possible frontends (fill fe-field |
| 125 | * of struct dvb_usb_device). |
| 126 | * @tuner_attach: called to attach the correct tuner and to fill pll_addr, |
| 127 | * pll_desc and pll_init_buf of struct dvb_usb_device). |
| 128 | * @stream: configuration of the USB streaming |
| 129 | */ |
| 130 | struct dvb_usb_adapter_fe_properties { |
| 131 | #define DVB_USB_ADAP_HAS_PID_FILTER 0x01 |
| 132 | #define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02 |
| 133 | #define DVB_USB_ADAP_NEED_PID_FILTERING 0x04 |
| 134 | #define DVB_USB_ADAP_RECEIVES_204_BYTE_TS 0x08 |
| 135 | #define DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD 0x10 |
| 136 | int caps; |
| 137 | int pid_filter_count; |
| 138 | |
| 139 | int (*streaming_ctrl) (struct dvb_usb_adapter *, int); |
| 140 | int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int); |
| 141 | int (*pid_filter) (struct dvb_usb_adapter *, int, u16, int); |
| 142 | |
| 143 | int (*frontend_attach) (struct dvb_usb_adapter *); |
| 144 | int (*tuner_attach) (struct dvb_usb_adapter *); |
| 145 | |
| 146 | struct usb_data_stream_properties stream; |
| 147 | |
| 148 | int size_of_priv; |
| 149 | }; |
| 150 | |
| 151 | #define MAX_NO_OF_FE_PER_ADAP 3 |
| 152 | struct dvb_usb_adapter_properties { |
| 153 | int size_of_priv; |
| 154 | |
| 155 | int (*frontend_ctrl) (struct dvb_frontend *, int); |
| 156 | int (*fe_ioctl_override) (struct dvb_frontend *, |
| 157 | unsigned int, void *, unsigned int); |
| 158 | |
| 159 | int num_frontends; |
| 160 | struct dvb_usb_adapter_fe_properties fe[MAX_NO_OF_FE_PER_ADAP]; |
| 161 | }; |
| 162 | |
| 163 | /** |
| 164 | * struct dvb_rc_legacy - old properties of remote controller |
| 165 | * @rc_map_table: a hard-wired array of struct rc_map_table (NULL to disable |
| 166 | * remote control handling). |
| 167 | * @rc_map_size: number of items in @rc_map_table. |
| 168 | * @rc_query: called to query an event event. |
| 169 | * @rc_interval: time in ms between two queries. |
| 170 | */ |
| 171 | struct dvb_rc_legacy { |
| 172 | /* remote control properties */ |
| 173 | #define REMOTE_NO_KEY_PRESSED 0x00 |
| 174 | #define REMOTE_KEY_PRESSED 0x01 |
| 175 | #define REMOTE_KEY_REPEAT 0x02 |
| 176 | struct rc_map_table *rc_map_table; |
| 177 | int rc_map_size; |
| 178 | int (*rc_query) (struct dvb_usb_device *, u32 *, int *); |
| 179 | int rc_interval; |
| 180 | }; |
| 181 | |
| 182 | /** |
| 183 | * struct dvb_rc properties of remote controller, using rc-core |
| 184 | * @rc_codes: name of rc codes table |
| 185 | * @protocol: type of protocol(s) currently used by the driver |
| 186 | * @allowed_protos: protocol(s) supported by the driver |
| 187 | * @driver_type: Used to point if a device supports raw mode |
| 188 | * @change_protocol: callback to change protocol |
| 189 | * @rc_query: called to query an event event. |
| 190 | * @rc_interval: time in ms between two queries. |
| 191 | * @bulk_mode: device supports bulk mode for RC (disable polling mode) |
| 192 | */ |
| 193 | struct dvb_rc { |
| 194 | char *rc_codes; |
| 195 | u64 protocol; |
| 196 | u64 allowed_protos; |
| 197 | enum rc_driver_type driver_type; |
| 198 | int (*change_protocol)(struct rc_dev *dev, u64 rc_type); |
| 199 | char *module_name; |
| 200 | int (*rc_query) (struct dvb_usb_device *d); |
| 201 | int rc_interval; |
| 202 | bool bulk_mode; /* uses bulk mode */ |
| 203 | }; |
| 204 | |
| 205 | /** |
| 206 | * enum dvb_usb_mode - Specifies if it is using a legacy driver or a new one |
| 207 | * based on rc-core |
| 208 | * This is initialized/used only inside dvb-usb-remote.c. |
| 209 | * It shouldn't be set by the drivers. |
| 210 | */ |
| 211 | enum dvb_usb_mode { |
| 212 | DVB_RC_LEGACY, |
| 213 | DVB_RC_CORE, |
| 214 | }; |
| 215 | |
| 216 | /** |
| 217 | * struct dvb_usb_device_properties - properties of a dvb-usb-device |
Antti Palosaari | 654e62d | 2012-05-23 15:03:56 -0300 | [diff] [blame] | 218 | * @owner: owner of the dvb_adapter |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 219 | * @usb_ctrl: which USB device-side controller is in use. Needed for firmware |
| 220 | * download. |
| 221 | * @firmware: name of the firmware file. |
| 222 | * @download_firmware: called to download the firmware when the usb_ctrl is |
| 223 | * DEVICE_SPECIFIC. |
| 224 | * @no_reconnect: device doesn't do a reconnect after downloading the firmware, |
| 225 | * so do the warm initialization right after it |
| 226 | * |
| 227 | * @size_of_priv: how many bytes shall be allocated for the private field |
| 228 | * of struct dvb_usb_device. |
| 229 | * |
| 230 | * @power_ctrl: called to enable/disable power of the device. |
| 231 | * @read_mac_address: called to read the MAC address of the device. |
| 232 | * @identify_state: called to determine the state (cold or warm), when it |
| 233 | * is not distinguishable by the USB IDs. |
Antti Palosaari | dc78693 | 2012-05-23 10:44:15 -0300 | [diff] [blame] | 234 | * @init: called after adapters are created in order to finalize device |
| 235 | * configuration. |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 236 | * |
| 237 | * @rc: remote controller properties |
| 238 | * |
| 239 | * @i2c_algo: i2c_algorithm if the device has I2CoverUSB. |
| 240 | * |
| 241 | * @generic_bulk_ctrl_endpoint: most of the DVB USB devices have a generic |
| 242 | * endpoint which received control messages with bulk transfers. When this |
| 243 | * is non-zero, one can use dvb_usb_generic_rw and dvb_usb_generic_write- |
| 244 | * helper functions. |
| 245 | * |
| 246 | * @generic_bulk_ctrl_endpoint_response: some DVB USB devices use a separate |
| 247 | * endpoint for responses to control messages sent with bulk transfers via |
| 248 | * the generic_bulk_ctrl_endpoint. When this is non-zero, this will be used |
| 249 | * instead of the generic_bulk_ctrl_endpoint when reading usb responses in |
| 250 | * the dvb_usb_generic_rw helper function. |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 251 | */ |
| 252 | #define MAX_NO_OF_ADAPTER_PER_DEVICE 2 |
| 253 | struct dvb_usb_device_properties { |
Antti Palosaari | 654e62d | 2012-05-23 15:03:56 -0300 | [diff] [blame] | 254 | struct module *owner; |
Antti Palosaari | 55b1f70 | 2012-05-23 16:23:44 -0300 | [diff] [blame] | 255 | short *adapter_nr; |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 256 | |
| 257 | #define DVB_USB_IS_AN_I2C_ADAPTER 0x01 |
| 258 | int caps; |
| 259 | |
| 260 | #define DEVICE_SPECIFIC 0 |
| 261 | #define CYPRESS_AN2135 1 |
| 262 | #define CYPRESS_AN2235 2 |
| 263 | #define CYPRESS_FX2 3 |
| 264 | int usb_ctrl; |
Antti Palosaari | 496e827 | 2012-05-23 20:45:05 -0300 | [diff] [blame] | 265 | |
| 266 | #define RECONNECTS_USB 1 |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 267 | int (*download_firmware) (struct dvb_usb_device *, |
| 268 | const struct firmware *); |
Antti Palosaari | 8b9dff5 | 2012-05-24 09:31:45 -0300 | [diff] [blame] | 269 | int (*get_firmware_name) (struct dvb_usb_device *, const char **); |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 270 | |
| 271 | int size_of_priv; |
| 272 | |
| 273 | int num_adapters; |
| 274 | struct dvb_usb_adapter_properties adapter[MAX_NO_OF_ADAPTER_PER_DEVICE]; |
| 275 | |
| 276 | int (*power_ctrl) (struct dvb_usb_device *, int); |
| 277 | int (*read_mac_address) (struct dvb_usb_device *, u8 []); |
Antti Palosaari | 496e827 | 2012-05-23 20:45:05 -0300 | [diff] [blame] | 278 | |
| 279 | #define WARM 0 |
| 280 | #define COLD 1 |
| 281 | int (*identify_state) (struct dvb_usb_device *); |
Antti Palosaari | dc78693 | 2012-05-23 10:44:15 -0300 | [diff] [blame] | 282 | int (*init) (struct dvb_usb_device *); |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 283 | |
| 284 | struct { |
| 285 | enum dvb_usb_mode mode; /* Drivers shouldn't touch on it */ |
| 286 | struct dvb_rc_legacy legacy; |
| 287 | struct dvb_rc core; |
| 288 | } rc; |
| 289 | |
| 290 | struct i2c_algorithm *i2c_algo; |
| 291 | |
| 292 | int generic_bulk_ctrl_endpoint; |
| 293 | int generic_bulk_ctrl_endpoint_response; |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 294 | }; |
| 295 | |
| 296 | /** |
| 297 | * struct usb_data_stream - generic object of an USB stream |
| 298 | * @buf_num: number of buffer allocated. |
| 299 | * @buf_size: size of each buffer in buf_list. |
| 300 | * @buf_list: array containing all allocate buffers for streaming. |
| 301 | * @dma_addr: list of dma_addr_t for each buffer in buf_list. |
| 302 | * |
| 303 | * @urbs_initialized: number of URBs initialized. |
| 304 | * @urbs_submitted: number of URBs submitted. |
| 305 | */ |
| 306 | #define MAX_NO_URBS_FOR_DATA_STREAM 10 |
| 307 | struct usb_data_stream { |
| 308 | struct usb_device *udev; |
| 309 | struct usb_data_stream_properties props; |
| 310 | |
| 311 | #define USB_STATE_INIT 0x00 |
| 312 | #define USB_STATE_URB_BUF 0x01 |
| 313 | int state; |
| 314 | |
| 315 | void (*complete) (struct usb_data_stream *, u8 *, size_t); |
| 316 | |
| 317 | struct urb *urb_list[MAX_NO_URBS_FOR_DATA_STREAM]; |
| 318 | int buf_num; |
| 319 | unsigned long buf_size; |
| 320 | u8 *buf_list[MAX_NO_URBS_FOR_DATA_STREAM]; |
| 321 | dma_addr_t dma_addr[MAX_NO_URBS_FOR_DATA_STREAM]; |
| 322 | |
| 323 | int urbs_initialized; |
| 324 | int urbs_submitted; |
| 325 | |
| 326 | void *user_priv; |
| 327 | }; |
| 328 | |
| 329 | /** |
| 330 | * struct dvb_usb_adapter - a DVB adapter on a USB device |
| 331 | * @id: index of this adapter (starting with 0). |
| 332 | * |
| 333 | * @feedcount: number of reqested feeds (used for streaming-activation) |
| 334 | * @pid_filtering: is hardware pid_filtering used or not. |
| 335 | * |
| 336 | * @pll_addr: I2C address of the tuner for programming |
| 337 | * @pll_init: array containing the initialization buffer |
| 338 | * @pll_desc: pointer to the appropriate struct dvb_pll_desc |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 339 | * @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod or |
| 340 | * the board |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 341 | * |
| 342 | * @dvb_adap: device's dvb_adapter. |
| 343 | * @dmxdev: device's dmxdev. |
| 344 | * @demux: device's software demuxer. |
| 345 | * @dvb_net: device's dvb_net interfaces. |
| 346 | * @dvb_frontend: device's frontend. |
| 347 | * @max_feed_count: how many feeds can be handled simultaneously by this |
| 348 | * device |
| 349 | * |
| 350 | * @fe_init: rerouted frontend-init (wakeup) function. |
| 351 | * @fe_sleep: rerouted frontend-sleep function. |
| 352 | * |
| 353 | * @stream: the usb data stream. |
| 354 | */ |
| 355 | struct dvb_usb_fe_adapter { |
| 356 | struct dvb_frontend *fe; |
| 357 | |
| 358 | int (*fe_init) (struct dvb_frontend *); |
| 359 | int (*fe_sleep) (struct dvb_frontend *); |
| 360 | |
| 361 | struct usb_data_stream stream; |
| 362 | |
| 363 | int pid_filtering; |
| 364 | int max_feed_count; |
| 365 | |
| 366 | void *priv; |
| 367 | }; |
| 368 | |
| 369 | struct dvb_usb_adapter { |
| 370 | struct dvb_usb_device *dev; |
| 371 | struct dvb_usb_adapter_properties props; |
| 372 | |
| 373 | #define DVB_USB_ADAP_STATE_INIT 0x000 |
| 374 | #define DVB_USB_ADAP_STATE_DVB 0x001 |
| 375 | int state; |
| 376 | |
| 377 | u8 id; |
| 378 | |
| 379 | int feedcount; |
| 380 | |
| 381 | /* dvb */ |
| 382 | struct dvb_adapter dvb_adap; |
| 383 | struct dmxdev dmxdev; |
| 384 | struct dvb_demux demux; |
| 385 | struct dvb_net dvb_net; |
| 386 | |
| 387 | struct dvb_usb_fe_adapter fe_adap[MAX_NO_OF_FE_PER_ADAP]; |
| 388 | int active_fe; |
| 389 | int num_frontends_initialized; |
| 390 | |
| 391 | void *priv; |
| 392 | }; |
| 393 | |
| 394 | /** |
| 395 | * struct dvb_usb_device - object of a DVB USB device |
| 396 | * @props: copy of the struct dvb_usb_properties this device belongs to. |
| 397 | * @desc: pointer to the device's struct dvb_usb_device_description. |
| 398 | * @state: initialization and runtime state of the device. |
| 399 | * |
| 400 | * @powered: indicated whether the device is power or not. |
| 401 | * Powered is in/decremented for each call to modify the state. |
| 402 | * @udev: pointer to the device's struct usb_device. |
| 403 | * |
| 404 | * @usb_mutex: semaphore of USB control messages (reading needs two messages) |
| 405 | * @i2c_mutex: semaphore for i2c-transfers |
| 406 | * |
| 407 | * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB |
| 408 | * |
| 409 | * @rc_dev: rc device for the remote control (rc-core mode) |
| 410 | * @input_dev: input device for the remote control (legacy mode) |
| 411 | * @rc_query_work: struct work_struct frequent rc queries |
| 412 | * @last_event: last triggered event |
| 413 | * @last_state: last state (no, pressed, repeat) |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 414 | * @priv: private data of the actual driver (allocate by dvb-usb, size defined |
| 415 | * in size_of_priv of dvb_usb_properties). |
| 416 | */ |
| 417 | struct dvb_usb_device { |
| 418 | struct dvb_usb_device_properties props; |
Antti Palosaari | 7dfd124 | 2012-05-24 20:00:28 -0300 | [diff] [blame^] | 419 | const char *name; |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 420 | |
| 421 | struct usb_device *udev; |
| 422 | |
| 423 | #define DVB_USB_STATE_INIT 0x000 |
| 424 | #define DVB_USB_STATE_I2C 0x001 |
| 425 | #define DVB_USB_STATE_DVB 0x002 |
| 426 | #define DVB_USB_STATE_REMOTE 0x004 |
| 427 | int state; |
| 428 | |
| 429 | int powered; |
| 430 | |
| 431 | /* locking */ |
| 432 | struct mutex usb_mutex; |
| 433 | |
| 434 | /* i2c */ |
| 435 | struct mutex i2c_mutex; |
| 436 | struct i2c_adapter i2c_adap; |
| 437 | |
| 438 | int num_adapters_initialized; |
| 439 | struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE]; |
| 440 | |
| 441 | /* remote control */ |
| 442 | struct rc_dev *rc_dev; |
| 443 | struct input_dev *input_dev; |
| 444 | char rc_phys[64]; |
| 445 | struct delayed_work rc_query_work; |
| 446 | u32 last_event; |
| 447 | int last_state; |
| 448 | |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 449 | void *priv; |
| 450 | }; |
| 451 | |
| 452 | extern int dvb_usbv2_device_init(struct usb_interface *, |
Antti Palosaari | 55b1f70 | 2012-05-23 16:23:44 -0300 | [diff] [blame] | 453 | const struct usb_device_id *); |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 454 | extern void dvb_usbv2_device_exit(struct usb_interface *); |
| 455 | |
| 456 | /* the generic read/write method for device control */ |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 457 | extern int dvb_usbv2_generic_rw(struct dvb_usb_device *, u8 *, u16, u8 *, u16, |
| 458 | int); |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 459 | extern int dvb_usbv2_generic_write(struct dvb_usb_device *, u8 *, u16); |
| 460 | |
| 461 | /* commonly used remote control parsing */ |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 462 | extern int dvb_usbv2_nec_rc_key_to_event(struct dvb_usb_device *, u8[], u32 *, |
| 463 | int *); |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 464 | |
| 465 | /* commonly used firmware download types and function */ |
| 466 | struct hexline { |
| 467 | u8 len; |
| 468 | u32 addr; |
| 469 | u8 type; |
| 470 | u8 data[255]; |
| 471 | u8 chk; |
| 472 | }; |
Antti Palosaari | 4e60d95 | 2012-05-24 14:44:21 -0300 | [diff] [blame] | 473 | extern int usbv2_cypress_load_firmware(struct usb_device *udev, |
| 474 | const struct firmware *fw, int type); |
| 475 | extern int dvb_usbv2_get_hexline(const struct firmware *fw, struct hexline *hx, |
| 476 | int *pos); |
Antti Palosaari | c79b339 | 2012-05-23 10:06:09 -0300 | [diff] [blame] | 477 | |
| 478 | #endif |