diff options
Diffstat (limited to 'drivers/uwb/i1480/i1480-est.c')
-rw-r--r-- | drivers/uwb/i1480/i1480-est.c | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/drivers/uwb/i1480/i1480-est.c b/drivers/uwb/i1480/i1480-est.c new file mode 100644 index 000000000000..7bf8c6febae7 --- /dev/null +++ b/drivers/uwb/i1480/i1480-est.c | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * Intel Wireless UWB Link 1480 | ||
3 | * Event Size tables for Wired Adaptors | ||
4 | * | ||
5 | * Copyright (C) 2005-2006 Intel Corporation | ||
6 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> | ||
7 | * | ||
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. | ||
11 | * | ||
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. | ||
16 | * | ||
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. | ||
21 | * | ||
22 | * | ||
23 | * FIXME: docs | ||
24 | */ | ||
25 | |||
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" | ||
31 | |||
32 | |||
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), | ||
44 | }, | ||
45 | #endif | ||
46 | }; | ||
47 | |||
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 }, | ||
55 | }; | ||
56 | |||
57 | static int i1480_est_init(void) | ||
58 | { | ||
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; | ||
65 | } | ||
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; | ||
71 | } | ||
72 | return 0; | ||
73 | } | ||
74 | module_init(i1480_est_init); | ||
75 | |||
76 | static void i1480_est_exit(void) | ||
77 | { | ||
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)); | ||
82 | } | ||
83 | module_exit(i1480_est_exit); | ||
84 | |||
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"); | ||
88 | |||
89 | /** | ||
90 | * USB device ID's that we handle | ||
91 | * | ||
92 | * [so we are loaded when this kind device is connected] | ||
93 | */ | ||
94 | static struct usb_device_id i1480_est_id_table[] = { | ||
95 | { USB_DEVICE(0x8086, 0xdf3b), }, | ||
96 | { USB_DEVICE(0x8086, 0x0c3b), }, | ||
97 | { }, | ||
98 | }; | ||
99 | MODULE_DEVICE_TABLE(usb, i1480_est_id_table); | ||