• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Intel Wireless UWB Link 1480
4  * Event Size tables for Wired Adaptors
5  *
6  * Copyright (C) 2005-2006 Intel Corporation
7  * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8  *
9  * FIXME: docs
10  */
11 
12 #include <linux/init.h>
13 #include <linux/module.h>
14 #include <linux/usb.h>
15 #include "../uwb.h"
16 #include "dfu/i1480-dfu.h"
17 
18 
19 /** Event size table for wEvents 0x00XX */
20 static struct uwb_est_entry i1480_est_fd00[] = {
21 	/* Anybody expecting this response has to use
22 	 * neh->extra_size to specify the real size that will
23 	 * come back. */
24 	[i1480_EVT_CONFIRM] = { .size = sizeof(struct i1480_evt_confirm) },
25 	[i1480_CMD_SET_IP_MAS] = { .size = sizeof(struct i1480_evt_confirm) },
26 #ifdef i1480_RCEB_EXTENDED
27 	[0x09] = {
28 		.size = sizeof(struct i1480_rceb),
29 		.offset = 1 + offsetof(struct i1480_rceb, wParamLength),
30 	},
31 #endif
32 };
33 
34 /** Event size table for wEvents 0x01XX */
35 static struct uwb_est_entry i1480_est_fd01[] = {
36 	[0xff & i1480_EVT_RM_INIT_DONE] = { .size = sizeof(struct i1480_rceb) },
37 	[0xff & i1480_EVT_DEV_ADD] = { .size = sizeof(struct i1480_rceb) + 9 },
38 	[0xff & i1480_EVT_DEV_RM] = { .size = sizeof(struct i1480_rceb) + 9 },
39 	[0xff & i1480_EVT_DEV_ID_CHANGE] = {
40 		.size = sizeof(struct i1480_rceb) + 2 },
41 };
42 
i1480_est_init(void)43 static int __init i1480_est_init(void)
44 {
45 	int result = uwb_est_register(i1480_CET_VS1, 0x00, 0x8086, 0x0c3b,
46 				      i1480_est_fd00,
47 				      ARRAY_SIZE(i1480_est_fd00));
48 	if (result < 0) {
49 		printk(KERN_ERR "Can't register EST table fd00: %d\n", result);
50 		return result;
51 	}
52 	result = uwb_est_register(i1480_CET_VS1, 0x01, 0x8086, 0x0c3b,
53 				  i1480_est_fd01, ARRAY_SIZE(i1480_est_fd01));
54 	if (result < 0) {
55 		printk(KERN_ERR "Can't register EST table fd01: %d\n", result);
56 		return result;
57 	}
58 	return 0;
59 }
60 module_init(i1480_est_init);
61 
i1480_est_exit(void)62 static void __exit i1480_est_exit(void)
63 {
64 	uwb_est_unregister(i1480_CET_VS1, 0x00, 0x8086, 0x0c3b,
65 			   i1480_est_fd00, ARRAY_SIZE(i1480_est_fd00));
66 	uwb_est_unregister(i1480_CET_VS1, 0x01, 0x8086, 0x0c3b,
67 			   i1480_est_fd01, ARRAY_SIZE(i1480_est_fd01));
68 }
69 module_exit(i1480_est_exit);
70 
71 MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>");
72 MODULE_DESCRIPTION("i1480's Vendor Specific Event Size Tables");
73 MODULE_LICENSE("GPL");
74 
75 /**
76  * USB device ID's that we handle
77  *
78  * [so we are loaded when this kind device is connected]
79  */
80 static struct usb_device_id __used i1480_est_id_table[] = {
81 	{ USB_DEVICE(0x8086, 0xdf3b), },
82 	{ USB_DEVICE(0x8086, 0x0c3b), },
83 	{ },
84 };
85 MODULE_DEVICE_TABLE(usb, i1480_est_id_table);
86