diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-21 00:15:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 19:47:53 -0400 |
commit | 50260b69bbec383058875de26dbde28b1a6f8d00 (patch) | |
tree | 5e2ac6a032807373838710138edeba78fd056108 /drivers/usb | |
parent | bde621854f1958a6000834c7c089b528118e5a9a (diff) |
[PATCH] USB: add nokia_dku2 driver
This driver comes from the gnokii project.
Was further cleaned up by me to match recent usb-serial core changes.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/Kconfig | 9 | ||||
-rw-r--r-- | drivers/usb/serial/Makefile | 1 | ||||
-rw-r--r-- | drivers/usb/serial/nokia_dku2.c | 142 |
3 files changed, 152 insertions, 0 deletions
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 9438909e87a5..7b5e8e4ee2bb 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
@@ -394,6 +394,15 @@ config USB_SERIAL_MCT_U232 | |||
394 | To compile this driver as a module, choose M here: the | 394 | To compile this driver as a module, choose M here: the |
395 | module will be called mct_u232. | 395 | module will be called mct_u232. |
396 | 396 | ||
397 | config USB_SERIAL_NOKIA_DKU2 | ||
398 | tristate "USB Nokia DKU2 Driver" | ||
399 | depends on USB_SERIAL | ||
400 | help | ||
401 | Say Y here if you want to use a Nokia DKU2 device. | ||
402 | |||
403 | To compile this driver as a module, choose M here: the | ||
404 | module will be called nokia_dku2. | ||
405 | |||
397 | config USB_SERIAL_PL2303 | 406 | config USB_SERIAL_PL2303 |
398 | tristate "USB Prolific 2303 Single Port Serial Driver" | 407 | tristate "USB Prolific 2303 Single Port Serial Driver" |
399 | depends on USB_SERIAL | 408 | depends on USB_SERIAL |
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index 6c7cdcc99a9e..55fd461793b7 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile | |||
@@ -31,6 +31,7 @@ obj-$(CONFIG_USB_SERIAL_KEYSPAN_PDA) += keyspan_pda.o | |||
31 | obj-$(CONFIG_USB_SERIAL_KLSI) += kl5kusb105.o | 31 | obj-$(CONFIG_USB_SERIAL_KLSI) += kl5kusb105.o |
32 | obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += kobil_sct.o | 32 | obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += kobil_sct.o |
33 | obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o | 33 | obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o |
34 | obj-$(CONFIG_USB_SERIAL_NOKIA_DKU2) += nokia_dku2.o | ||
34 | obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o | 35 | obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o |
35 | obj-$(CONFIG_USB_SERIAL_OPTION) += option.o | 36 | obj-$(CONFIG_USB_SERIAL_OPTION) += option.o |
36 | obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o | 37 | obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o |
diff --git a/drivers/usb/serial/nokia_dku2.c b/drivers/usb/serial/nokia_dku2.c new file mode 100644 index 000000000000..fad01bef3a64 --- /dev/null +++ b/drivers/usb/serial/nokia_dku2.c | |||
@@ -0,0 +1,142 @@ | |||
1 | /* | ||
2 | * Nokia DKU2 USB driver | ||
3 | * | ||
4 | * Copyright (C) 2004 | ||
5 | * Author: C Kemp | ||
6 | * | ||
7 | * This program is largely derived from work by the linux-usb group | ||
8 | * and associated source files. Please see the usb/serial files for | ||
9 | * individual credits and copyrights. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * 20.09.2005 - Matthias Blaesing <matthias.blaesing@rwth-aachen.de> | ||
17 | * Added short name to device structure to make driver load into kernel 2.6.13 | ||
18 | * | ||
19 | * 20.09.2005 - Matthias Blaesing <matthias.blaesing@rwth-aachen.de> | ||
20 | * Added usb_deregister to exit code - to allow remove and reinsert of module | ||
21 | */ | ||
22 | |||
23 | |||
24 | #include <linux/config.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/init.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/tty.h> | ||
30 | #include <linux/tty_driver.h> | ||
31 | #include <linux/tty_flip.h> | ||
32 | #include <linux/module.h> | ||
33 | #include <linux/usb.h> | ||
34 | #include "usb-serial.h" | ||
35 | |||
36 | |||
37 | #define NOKIA_VENDOR_ID 0x0421 | ||
38 | #define NOKIA7600_PRODUCT_ID 0x0400 | ||
39 | #define NOKIA6230_PRODUCT_ID 0x040f | ||
40 | #define NOKIA6170_PRODUCT_ID 0x0416 | ||
41 | #define NOKIA6670_PRODUCT_ID 0x041d | ||
42 | #define NOKIA6680_PRODUCT_ID 0x041e | ||
43 | #define NOKIA6230i_PRODUCT_ID 0x0428 | ||
44 | |||
45 | #define NOKIA_AT_PORT 0x82 | ||
46 | #define NOKIA_FBUS_PORT 0x86 | ||
47 | |||
48 | /* | ||
49 | * Version Information | ||
50 | */ | ||
51 | #define DRIVER_VERSION "v0.2" | ||
52 | #define DRIVER_AUTHOR "C Kemp" | ||
53 | #define DRIVER_DESC "Nokia DKU2 Driver" | ||
54 | |||
55 | static struct usb_device_id id_table [] = { | ||
56 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA7600_PRODUCT_ID) }, | ||
57 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6230_PRODUCT_ID) }, | ||
58 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6170_PRODUCT_ID) }, | ||
59 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6670_PRODUCT_ID) }, | ||
60 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6680_PRODUCT_ID) }, | ||
61 | { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6230i_PRODUCT_ID) }, | ||
62 | { } /* Terminating entry */ | ||
63 | }; | ||
64 | MODULE_DEVICE_TABLE(usb, id_table); | ||
65 | |||
66 | /* The only thing which makes this device different from a generic | ||
67 | * device is that we have to set an alternative configuration to make | ||
68 | * the relevant endpoints available. In 2.6 this is really easy... */ | ||
69 | static int nokia_probe(struct usb_serial *serial, | ||
70 | const struct usb_device_id *id) | ||
71 | { | ||
72 | int retval = -ENODEV; | ||
73 | |||
74 | if (serial->interface->altsetting[0].endpoint[0].desc.bEndpointAddress == NOKIA_AT_PORT) { | ||
75 | /* the AT port */ | ||
76 | dev_info(&serial->dev->dev, "Nokia AT Port:\n"); | ||
77 | retval = 0; | ||
78 | } else if (serial->interface->num_altsetting == 2 && | ||
79 | serial->interface->altsetting[1].endpoint[0].desc.bEndpointAddress == NOKIA_FBUS_PORT) { | ||
80 | /* the FBUS port */ | ||
81 | dev_info(&serial->dev->dev, "Nokia FBUS Port:\n"); | ||
82 | usb_set_interface(serial->dev, 10, 1); | ||
83 | retval = 0; | ||
84 | } | ||
85 | |||
86 | return retval; | ||
87 | } | ||
88 | |||
89 | static struct usb_driver nokia_driver = { | ||
90 | .owner = THIS_MODULE, | ||
91 | .name = "nokia_dku2", | ||
92 | .probe = usb_serial_probe, | ||
93 | .disconnect = usb_serial_disconnect, | ||
94 | .id_table = id_table, | ||
95 | }; | ||
96 | |||
97 | static struct usb_serial_driver nokia_serial_driver = { | ||
98 | .driver = { | ||
99 | .owner = THIS_MODULE, | ||
100 | .name = "nokia_dku2", | ||
101 | }, | ||
102 | .description = "Nokia 7600/6230(i)/6170/66x0 DKU2 driver", | ||
103 | .id_table = id_table, | ||
104 | .num_interrupt_in = 1, | ||
105 | .num_bulk_in = 1, | ||
106 | .num_bulk_out = 1, | ||
107 | .num_ports = 1, | ||
108 | .probe = nokia_probe, | ||
109 | }; | ||
110 | |||
111 | static int __init nokia_init(void) | ||
112 | { | ||
113 | int retval; | ||
114 | |||
115 | retval = usb_serial_register(&nokia_serial_driver); | ||
116 | if (retval) | ||
117 | return retval; | ||
118 | |||
119 | retval = usb_register(&nokia_driver); | ||
120 | if (retval) { | ||
121 | usb_serial_deregister(&nokia_serial_driver); | ||
122 | return retval; | ||
123 | } | ||
124 | |||
125 | info(DRIVER_VERSION " " DRIVER_AUTHOR); | ||
126 | info(DRIVER_DESC); | ||
127 | |||
128 | return retval; | ||
129 | } | ||
130 | |||
131 | static void __exit nokia_exit(void) | ||
132 | { | ||
133 | usb_deregister(&nokia_driver); | ||
134 | usb_serial_deregister(&nokia_serial_driver); | ||
135 | } | ||
136 | |||
137 | module_init(nokia_init); | ||
138 | module_exit(nokia_exit); | ||
139 | |||
140 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
141 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
142 | MODULE_LICENSE("GPL"); | ||