Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / drivers / uwb / i1480 / i1480-est.c
blobd5de5e131d4794e345523293b9dde55ed4c78e93
1 /*
2 * Intel Wireless UWB Link 1480
3 * Event Size tables for Wired Adaptors
5 * Copyright (C) 2005-2006 Intel Corporation
6 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
23 * FIXME: docs
26 #include <linux/init.h>
27 #include <linux/module.h>
28 #include <linux/usb.h>
29 #include <linux/uwb.h>
30 #include "dfu/i1480-dfu.h"
33 /** Event size table for wEvents 0x00XX */
34 static struct uwb_est_entry i1480_est_fd00[] = {
35 /* Anybody expecting this response has to use
36 * neh->extra_size to specify the real size that will
37 * come back. */
38 [i1480_EVT_CONFIRM] = { .size = sizeof(struct i1480_evt_confirm) },
39 [i1480_CMD_SET_IP_MAS] = { .size = sizeof(struct i1480_evt_confirm) },
40 #ifdef i1480_RCEB_EXTENDED
41 [0x09] = {
42 .size = sizeof(struct i1480_rceb),
43 .offset = 1 + offsetof(struct i1480_rceb, wParamLength),
45 #endif
48 /** Event size table for wEvents 0x01XX */
49 static struct uwb_est_entry i1480_est_fd01[] = {
50 [0xff & i1480_EVT_RM_INIT_DONE] = { .size = sizeof(struct i1480_rceb) },
51 [0xff & i1480_EVT_DEV_ADD] = { .size = sizeof(struct i1480_rceb) + 9 },
52 [0xff & i1480_EVT_DEV_RM] = { .size = sizeof(struct i1480_rceb) + 9 },
53 [0xff & i1480_EVT_DEV_ID_CHANGE] = {
54 .size = sizeof(struct i1480_rceb) + 2 },
57 static int __init i1480_est_init(void)
59 int result = uwb_est_register(i1480_CET_VS1, 0x00, 0x8086, 0x0c3b,
60 i1480_est_fd00,
61 ARRAY_SIZE(i1480_est_fd00));
62 if (result < 0) {
63 printk(KERN_ERR "Can't register EST table fd00: %d\n", result);
64 return result;
66 result = uwb_est_register(i1480_CET_VS1, 0x01, 0x8086, 0x0c3b,
67 i1480_est_fd01, ARRAY_SIZE(i1480_est_fd01));
68 if (result < 0) {
69 printk(KERN_ERR "Can't register EST table fd01: %d\n", result);
70 return result;
72 return 0;
74 module_init(i1480_est_init);
76 static void __exit i1480_est_exit(void)
78 uwb_est_unregister(i1480_CET_VS1, 0x00, 0x8086, 0x0c3b,
79 i1480_est_fd00, ARRAY_SIZE(i1480_est_fd00));
80 uwb_est_unregister(i1480_CET_VS1, 0x01, 0x8086, 0x0c3b,
81 i1480_est_fd01, ARRAY_SIZE(i1480_est_fd01));
83 module_exit(i1480_est_exit);
85 MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>");
86 MODULE_DESCRIPTION("i1480's Vendor Specific Event Size Tables");
87 MODULE_LICENSE("GPL");
89 /**
90 * USB device ID's that we handle
92 * [so we are loaded when this kind device is connected]
94 static struct usb_device_id __used i1480_est_id_table[] = {
95 { USB_DEVICE(0x8086, 0xdf3b), },
96 { USB_DEVICE(0x8086, 0x0c3b), },
97 { },
99 MODULE_DEVICE_TABLE(usb, i1480_est_id_table);