]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Prolific PL2303 USB to serial adaptor driver | |
3 | * | |
4d0dce3e | 4 | * Copyright (C) 2001-2007 Greg Kroah-Hartman (greg@kroah.com) |
1da177e4 LT |
5 | * Copyright (C) 2003 IBM Corp. |
6 | * | |
7 | * Original driver for 2.2.x by anonymous | |
8 | * | |
4d0dce3e GKH |
9 | * This program is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU General Public License version | |
11 | * 2 as published by the Free Software Foundation. | |
1da177e4 | 12 | * |
3a0f43e9 AC |
13 | * See Documentation/usb/usb-serial.txt for more information on using this |
14 | * driver | |
1da177e4 LT |
15 | */ |
16 | ||
1da177e4 LT |
17 | #include <linux/kernel.h> |
18 | #include <linux/errno.h> | |
19 | #include <linux/init.h> | |
20 | #include <linux/slab.h> | |
21 | #include <linux/tty.h> | |
22 | #include <linux/tty_driver.h> | |
23 | #include <linux/tty_flip.h> | |
24 | #include <linux/serial.h> | |
25 | #include <linux/module.h> | |
26 | #include <linux/moduleparam.h> | |
27 | #include <linux/spinlock.h> | |
3a0f43e9 | 28 | #include <linux/uaccess.h> |
1da177e4 | 29 | #include <linux/usb.h> |
a969888c | 30 | #include <linux/usb/serial.h> |
b2d6d98f | 31 | #include <asm/unaligned.h> |
1da177e4 LT |
32 | #include "pl2303.h" |
33 | ||
7d40d7e8 | 34 | static const struct usb_device_id id_table[] = { |
1da177e4 LT |
35 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) }, |
36 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) }, | |
3d861494 | 37 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, |
1da177e4 LT |
38 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, |
39 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, | |
b483b6aa | 40 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) }, |
4be2fa18 | 41 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) }, |
727df356 | 42 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) }, |
18344a1c | 43 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, |
96a3e79e | 44 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, |
1da177e4 | 45 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
8a28dea3 | 46 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, |
1da177e4 LT |
47 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
48 | { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) }, | |
49 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, | |
50 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID_UCSGT) }, | |
51 | { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID) }, | |
58381719 | 52 | { USB_DEVICE(ITEGNO_VENDOR_ID, ITEGNO_PRODUCT_ID_2080) }, |
1da177e4 LT |
53 | { USB_DEVICE(MA620_VENDOR_ID, MA620_PRODUCT_ID) }, |
54 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID) }, | |
55 | { USB_DEVICE(TRIPP_VENDOR_ID, TRIPP_PRODUCT_ID) }, | |
56 | { USB_DEVICE(RADIOSHACK_VENDOR_ID, RADIOSHACK_PRODUCT_ID) }, | |
57 | { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, | |
58 | { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) }, | |
59 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, | |
60 | { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, | |
a8310f3b | 61 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_SX1) }, |
1da177e4 | 62 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, |
a8310f3b | 63 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) }, |
e7beb667 | 64 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_EF81) }, |
912299f6 | 65 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_ID_S81) }, /* Benq/Siemens S81 */ |
acbb36f1 | 66 | { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, |
c6c27721 CL |
67 | { USB_DEVICE(NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID) }, |
68 | { USB_DEVICE(CA_42_CA42_VENDOR_ID, CA_42_CA42_PRODUCT_ID) }, | |
6cceb05f | 69 | { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) }, |
c6c27721 | 70 | { USB_DEVICE(LEADTEK_VENDOR_ID, LEADTEK_9531_PRODUCT_ID) }, |
491b04ce | 71 | { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, |
3b928474 | 72 | { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) }, |
b7aa94b6 | 73 | { USB_DEVICE(BELKIN_VENDOR_ID, BELKIN_PRODUCT_ID) }, |
8fd80133 | 74 | { USB_DEVICE(ALCOR_VENDOR_ID, ALCOR_PRODUCT_ID) }, |
2d94b981 | 75 | { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) }, |
9e3285db | 76 | { USB_DEVICE(COREGA_VENDOR_ID, COREGA_PRODUCT_ID) }, |
cc311ee7 | 77 | { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) }, |
7c992001 | 78 | { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, |
af4b8514 | 79 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, |
8540d666 | 80 | { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) }, |
f36ecd5d | 81 | { USB_DEVICE(ZEAGLE_VENDOR_ID, ZEAGLE_N2ITION3_PRODUCT_ID) }, |
49276560 | 82 | { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) }, |
35904e6b | 83 | { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) }, |
9a61d726 | 84 | { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) }, |
598f0b70 | 85 | { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) }, |
1da177e4 LT |
86 | { } /* Terminating entry */ |
87 | }; | |
88 | ||
372db8a7 | 89 | MODULE_DEVICE_TABLE(usb, id_table); |
1da177e4 | 90 | |
1da177e4 LT |
91 | #define SET_LINE_REQUEST_TYPE 0x21 |
92 | #define SET_LINE_REQUEST 0x20 | |
93 | ||
94 | #define SET_CONTROL_REQUEST_TYPE 0x21 | |
95 | #define SET_CONTROL_REQUEST 0x22 | |
96 | #define CONTROL_DTR 0x01 | |
97 | #define CONTROL_RTS 0x02 | |
98 | ||
99 | #define BREAK_REQUEST_TYPE 0x21 | |
3a0f43e9 | 100 | #define BREAK_REQUEST 0x23 |
1da177e4 LT |
101 | #define BREAK_ON 0xffff |
102 | #define BREAK_OFF 0x0000 | |
103 | ||
104 | #define GET_LINE_REQUEST_TYPE 0xa1 | |
105 | #define GET_LINE_REQUEST 0x21 | |
106 | ||
107 | #define VENDOR_WRITE_REQUEST_TYPE 0x40 | |
108 | #define VENDOR_WRITE_REQUEST 0x01 | |
109 | ||
110 | #define VENDOR_READ_REQUEST_TYPE 0xc0 | |
111 | #define VENDOR_READ_REQUEST 0x01 | |
112 | ||
113 | #define UART_STATE 0x08 | |
114 | #define UART_STATE_TRANSIENT_MASK 0x74 | |
115 | #define UART_DCD 0x01 | |
116 | #define UART_DSR 0x02 | |
117 | #define UART_BREAK_ERROR 0x04 | |
118 | #define UART_RING 0x08 | |
119 | #define UART_FRAME_ERROR 0x10 | |
120 | #define UART_PARITY_ERROR 0x20 | |
121 | #define UART_OVERRUN_ERROR 0x40 | |
122 | #define UART_CTS 0x80 | |
123 | ||
1da177e4 LT |
124 | |
125 | enum pl2303_type { | |
e8bbd5c4 GKH |
126 | type_0, /* don't know the difference between type 0 and */ |
127 | type_1, /* type 1, until someone from prolific tells us... */ | |
128 | HX, /* HX version of the pl2303 chip */ | |
1da177e4 LT |
129 | }; |
130 | ||
8bf769eb JH |
131 | struct pl2303_serial_private { |
132 | enum pl2303_type type; | |
133 | }; | |
134 | ||
1da177e4 LT |
135 | struct pl2303_private { |
136 | spinlock_t lock; | |
1da177e4 LT |
137 | u8 line_control; |
138 | u8 line_status; | |
623c8263 JH |
139 | |
140 | u8 line_settings[7]; | |
1da177e4 LT |
141 | }; |
142 | ||
ccfe8188 | 143 | static int pl2303_vendor_read(u16 value, u16 index, |
eb44da0b SS |
144 | struct usb_serial *serial, unsigned char *buf) |
145 | { | |
ccfe8188 JH |
146 | int res; |
147 | ||
148 | res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | |
eb44da0b SS |
149 | VENDOR_READ_REQUEST, VENDOR_READ_REQUEST_TYPE, |
150 | value, index, buf, 1, 100); | |
ccfe8188 | 151 | |
7b5789a8 | 152 | dev_dbg(&serial->interface->dev, "0x%x:0x%x:0x%x:0x%x %d - %x\n", |
d8789b2b GKH |
153 | VENDOR_READ_REQUEST_TYPE, VENDOR_READ_REQUEST, value, index, |
154 | res, buf[0]); | |
ccfe8188 | 155 | |
eb44da0b SS |
156 | return res; |
157 | } | |
158 | ||
ccfe8188 | 159 | static int pl2303_vendor_write(u16 value, u16 index, struct usb_serial *serial) |
eb44da0b | 160 | { |
ccfe8188 JH |
161 | int res; |
162 | ||
163 | res = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | |
eb44da0b SS |
164 | VENDOR_WRITE_REQUEST, VENDOR_WRITE_REQUEST_TYPE, |
165 | value, index, NULL, 0, 100); | |
ccfe8188 | 166 | |
7b5789a8 | 167 | dev_dbg(&serial->interface->dev, "0x%x:0x%x:0x%x:0x%x %d\n", |
d8789b2b GKH |
168 | VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, value, index, |
169 | res); | |
ccfe8188 | 170 | |
eb44da0b SS |
171 | return res; |
172 | } | |
173 | ||
372db8a7 | 174 | static int pl2303_startup(struct usb_serial *serial) |
1da177e4 | 175 | { |
8bf769eb | 176 | struct pl2303_serial_private *spriv; |
1da177e4 | 177 | enum pl2303_type type = type_0; |
3e152505 | 178 | unsigned char *buf; |
8bf769eb JH |
179 | |
180 | spriv = kzalloc(sizeof(*spriv), GFP_KERNEL); | |
181 | if (!spriv) | |
182 | return -ENOMEM; | |
1da177e4 | 183 | |
3e152505 | 184 | buf = kmalloc(10, GFP_KERNEL); |
8bf769eb JH |
185 | if (!buf) { |
186 | kfree(spriv); | |
3e152505 | 187 | return -ENOMEM; |
8bf769eb | 188 | } |
3e152505 | 189 | |
b52e1113 | 190 | if (serial->dev->descriptor.bDeviceClass == 0x02) |
1da177e4 | 191 | type = type_0; |
b52e1113 | 192 | else if (serial->dev->descriptor.bMaxPacketSize0 == 0x40) |
e8bbd5c4 | 193 | type = HX; |
281393ad GKH |
194 | else if (serial->dev->descriptor.bDeviceClass == 0x00) |
195 | type = type_1; | |
196 | else if (serial->dev->descriptor.bDeviceClass == 0xFF) | |
1da177e4 | 197 | type = type_1; |
b52e1113 | 198 | dev_dbg(&serial->interface->dev, "device type: %d\n", type); |
1da177e4 | 199 | |
8bf769eb JH |
200 | spriv->type = type; |
201 | usb_set_serial_data(serial, spriv); | |
3e152505 SS |
202 | |
203 | pl2303_vendor_read(0x8484, 0, serial, buf); | |
204 | pl2303_vendor_write(0x0404, 0, serial); | |
205 | pl2303_vendor_read(0x8484, 0, serial, buf); | |
206 | pl2303_vendor_read(0x8383, 0, serial, buf); | |
207 | pl2303_vendor_read(0x8484, 0, serial, buf); | |
208 | pl2303_vendor_write(0x0404, 1, serial); | |
209 | pl2303_vendor_read(0x8484, 0, serial, buf); | |
210 | pl2303_vendor_read(0x8383, 0, serial, buf); | |
211 | pl2303_vendor_write(0, 1, serial); | |
212 | pl2303_vendor_write(1, 0, serial); | |
e8bbd5c4 | 213 | if (type == HX) |
034d1527 | 214 | pl2303_vendor_write(2, 0x44, serial); |
e8bbd5c4 GKH |
215 | else |
216 | pl2303_vendor_write(2, 0x24, serial); | |
3e152505 SS |
217 | |
218 | kfree(buf); | |
ccfe8188 | 219 | |
1da177e4 | 220 | return 0; |
8bf769eb | 221 | } |
1da177e4 | 222 | |
8bf769eb JH |
223 | static void pl2303_release(struct usb_serial *serial) |
224 | { | |
ccfe8188 | 225 | struct pl2303_serial_private *spriv = usb_get_serial_data(serial); |
8bf769eb | 226 | |
8bf769eb JH |
227 | kfree(spriv); |
228 | } | |
229 | ||
230 | static int pl2303_port_probe(struct usb_serial_port *port) | |
231 | { | |
232 | struct pl2303_private *priv; | |
233 | ||
234 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | |
235 | if (!priv) | |
236 | return -ENOMEM; | |
237 | ||
238 | spin_lock_init(&priv->lock); | |
8bf769eb JH |
239 | |
240 | usb_set_serial_port_data(port, priv); | |
241 | ||
d7be6221 JH |
242 | port->port.drain_delay = 256; |
243 | ||
8bf769eb JH |
244 | return 0; |
245 | } | |
246 | ||
247 | static int pl2303_port_remove(struct usb_serial_port *port) | |
248 | { | |
ccfe8188 | 249 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
8bf769eb | 250 | |
8bf769eb JH |
251 | kfree(priv); |
252 | ||
253 | return 0; | |
1da177e4 LT |
254 | } |
255 | ||
f45d0a5a | 256 | static int pl2303_set_control_lines(struct usb_serial_port *port, u8 value) |
1da177e4 | 257 | { |
f45d0a5a | 258 | struct usb_device *dev = port->serial->dev; |
1da177e4 | 259 | int retval; |
3a0f43e9 | 260 | |
372db8a7 TG |
261 | retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
262 | SET_CONTROL_REQUEST, SET_CONTROL_REQUEST_TYPE, | |
263 | value, 0, NULL, 0, 100); | |
ccfe8188 | 264 | |
f45d0a5a | 265 | dev_dbg(&port->dev, "%s - value = %d, retval = %d\n", __func__, |
d8789b2b | 266 | value, retval); |
ccfe8188 | 267 | |
1da177e4 LT |
268 | return retval; |
269 | } | |
270 | ||
15e7cead JH |
271 | static void pl2303_encode_baudrate(struct tty_struct *tty, |
272 | struct usb_serial_port *port, | |
273 | u8 buf[4]) | |
1da177e4 | 274 | { |
7e12a6fc GKH |
275 | const int baud_sup[] = { 75, 150, 300, 600, 1200, 1800, 2400, 3600, |
276 | 4800, 7200, 9600, 14400, 19200, 28800, 38400, | |
277 | 57600, 115200, 230400, 460800, 500000, 614400, | |
278 | 921600, 1228800, 2457600, 3000000, 6000000 }; | |
279 | ||
692ed4dd GKH |
280 | struct usb_serial *serial = port->serial; |
281 | struct pl2303_serial_private *spriv = usb_get_serial_data(serial); | |
15e7cead | 282 | int baud; |
7e12a6fc | 283 | int i; |
1da177e4 | 284 | |
7e12a6fc GKH |
285 | /* |
286 | * NOTE: Only the values defined in baud_sup are supported! | |
287 | * => if unsupported values are set, the PL2303 seems to use | |
288 | * 9600 baud (at least my PL2303X always does) | |
289 | */ | |
95da310e | 290 | baud = tty_get_baud_rate(tty); |
d8789b2b | 291 | dev_dbg(&port->dev, "baud requested = %d\n", baud); |
b2d6d98f JH |
292 | if (!baud) |
293 | return; | |
692ed4dd | 294 | |
7e12a6fc GKH |
295 | /* Set baudrate to nearest supported value */ |
296 | for (i = 0; i < ARRAY_SIZE(baud_sup); ++i) { | |
297 | if (baud_sup[i] > baud) | |
298 | break; | |
299 | } | |
692ed4dd | 300 | |
7e12a6fc GKH |
301 | if (i == ARRAY_SIZE(baud_sup)) |
302 | baud = baud_sup[i - 1]; | |
303 | else if (i > 0 && (baud_sup[i] - baud) > (baud - baud_sup[i - 1])) | |
304 | baud = baud_sup[i - 1]; | |
305 | else | |
306 | baud = baud_sup[i]; | |
692ed4dd | 307 | |
7e12a6fc GKH |
308 | /* type_0, type_1 only support up to 1228800 baud */ |
309 | if (spriv->type != HX) | |
310 | baud = min_t(int, baud, 1228800); | |
692ed4dd | 311 | |
54dc5792 | 312 | if (baud <= 115200) { |
692ed4dd GKH |
313 | put_unaligned_le32(baud, buf); |
314 | } else { | |
315 | /* | |
1796a228 GKH |
316 | * Apparently the formula for higher speeds is: |
317 | * baudrate = 12M * 32 / (2^buf[1]) / buf[0] | |
692ed4dd | 318 | */ |
1796a228 GKH |
319 | unsigned tmp = 12000000 * 32 / baud; |
320 | buf[3] = 0x80; | |
692ed4dd | 321 | buf[2] = 0; |
1796a228 GKH |
322 | buf[1] = (tmp >= 256); |
323 | while (tmp >= 256) { | |
324 | tmp >>= 2; | |
325 | buf[1] <<= 1; | |
326 | } | |
327 | buf[0] = tmp; | |
692ed4dd GKH |
328 | } |
329 | ||
15e7cead | 330 | /* Save resulting baud rate */ |
b2d6d98f JH |
331 | tty_encode_baud_rate(tty, baud, baud); |
332 | dev_dbg(&port->dev, "baud set = %d\n", baud); | |
15e7cead JH |
333 | } |
334 | ||
335 | static void pl2303_set_termios(struct tty_struct *tty, | |
336 | struct usb_serial_port *port, struct ktermios *old_termios) | |
337 | { | |
338 | struct usb_serial *serial = port->serial; | |
339 | struct pl2303_serial_private *spriv = usb_get_serial_data(serial); | |
340 | struct pl2303_private *priv = usb_get_serial_port_data(port); | |
341 | unsigned long flags; | |
15e7cead JH |
342 | unsigned char *buf; |
343 | int i; | |
344 | u8 control; | |
345 | ||
15e7cead JH |
346 | if (old_termios && !tty_termios_hw_change(&tty->termios, old_termios)) |
347 | return; | |
348 | ||
15e7cead JH |
349 | buf = kzalloc(7, GFP_KERNEL); |
350 | if (!buf) { | |
15e7cead JH |
351 | /* Report back no change occurred */ |
352 | if (old_termios) | |
353 | tty->termios = *old_termios; | |
354 | return; | |
355 | } | |
356 | ||
357 | i = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | |
358 | GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE, | |
359 | 0, 0, buf, 7, 100); | |
360 | dev_dbg(&port->dev, "0xa1:0x21:0:0 %d - %7ph\n", i, buf); | |
361 | ||
a3132499 CL |
362 | switch (C_CSIZE(tty)) { |
363 | case CS5: | |
364 | buf[6] = 5; | |
365 | break; | |
366 | case CS6: | |
367 | buf[6] = 6; | |
368 | break; | |
369 | case CS7: | |
370 | buf[6] = 7; | |
371 | break; | |
372 | default: | |
373 | case CS8: | |
374 | buf[6] = 8; | |
15e7cead | 375 | } |
a3132499 | 376 | dev_dbg(&port->dev, "data bits = %d\n", buf[6]); |
15e7cead | 377 | |
692ed4dd GKH |
378 | /* For reference buf[0]:buf[3] baud rate value */ |
379 | pl2303_encode_baudrate(tty, port, &buf[0]); | |
15e7cead | 380 | |
1da177e4 LT |
381 | /* For reference buf[4]=0 is 1 stop bits */ |
382 | /* For reference buf[4]=1 is 1.5 stop bits */ | |
383 | /* For reference buf[4]=2 is 2 stop bits */ | |
87265b45 JH |
384 | if (C_CSTOPB(tty)) { |
385 | /* | |
386 | * NOTE: Comply with "real" UARTs / RS232: | |
29cf1b72 FS |
387 | * use 1.5 instead of 2 stop bits with 5 data bits |
388 | */ | |
87265b45 | 389 | if (C_CSIZE(tty) == CS5) { |
29cf1b72 | 390 | buf[4] = 1; |
d8789b2b | 391 | dev_dbg(&port->dev, "stop bits = 1.5\n"); |
29cf1b72 FS |
392 | } else { |
393 | buf[4] = 2; | |
d8789b2b | 394 | dev_dbg(&port->dev, "stop bits = 2\n"); |
29cf1b72 | 395 | } |
1da177e4 LT |
396 | } else { |
397 | buf[4] = 0; | |
d8789b2b | 398 | dev_dbg(&port->dev, "stop bits = 1\n"); |
1da177e4 LT |
399 | } |
400 | ||
87265b45 | 401 | if (C_PARENB(tty)) { |
1da177e4 LT |
402 | /* For reference buf[5]=0 is none parity */ |
403 | /* For reference buf[5]=1 is odd parity */ | |
404 | /* For reference buf[5]=2 is even parity */ | |
405 | /* For reference buf[5]=3 is mark parity */ | |
406 | /* For reference buf[5]=4 is space parity */ | |
87265b45 JH |
407 | if (C_PARODD(tty)) { |
408 | if (tty->termios.c_cflag & CMSPAR) { | |
6dd81b45 | 409 | buf[5] = 3; |
d8789b2b | 410 | dev_dbg(&port->dev, "parity = mark\n"); |
6dd81b45 FS |
411 | } else { |
412 | buf[5] = 1; | |
d8789b2b | 413 | dev_dbg(&port->dev, "parity = odd\n"); |
6dd81b45 | 414 | } |
1da177e4 | 415 | } else { |
87265b45 | 416 | if (tty->termios.c_cflag & CMSPAR) { |
6dd81b45 | 417 | buf[5] = 4; |
d8789b2b | 418 | dev_dbg(&port->dev, "parity = space\n"); |
6dd81b45 FS |
419 | } else { |
420 | buf[5] = 2; | |
d8789b2b | 421 | dev_dbg(&port->dev, "parity = even\n"); |
6dd81b45 | 422 | } |
1da177e4 LT |
423 | } |
424 | } else { | |
425 | buf[5] = 0; | |
d8789b2b | 426 | dev_dbg(&port->dev, "parity = none\n"); |
1da177e4 LT |
427 | } |
428 | ||
623c8263 JH |
429 | /* |
430 | * Some PL2303 are known to lose bytes if you change serial settings | |
431 | * even to the same values as before. Thus we actually need to filter | |
432 | * in this specific case. | |
433 | * | |
434 | * Note that the tty_termios_hw_change check above is not sufficient | |
435 | * as a previously requested baud rate may differ from the one | |
436 | * actually used (and stored in old_termios). | |
437 | * | |
438 | * NOTE: No additional locking needed for line_settings as it is | |
439 | * only used in set_termios, which is serialised against itself. | |
440 | */ | |
441 | if (!old_termios || memcmp(buf, priv->line_settings, 7)) { | |
442 | i = usb_control_msg(serial->dev, | |
443 | usb_sndctrlpipe(serial->dev, 0), | |
444 | SET_LINE_REQUEST, SET_LINE_REQUEST_TYPE, | |
445 | 0, 0, buf, 7, 100); | |
446 | ||
447 | dev_dbg(&port->dev, "0x21:0x20:0:0 %d\n", i); | |
448 | ||
449 | if (i == 7) | |
450 | memcpy(priv->line_settings, buf, 7); | |
451 | } | |
1da177e4 LT |
452 | |
453 | /* change control lines if we are switching to or from B0 */ | |
454 | spin_lock_irqsave(&priv->lock, flags); | |
455 | control = priv->line_control; | |
87265b45 | 456 | if (C_BAUD(tty) == B0) |
1da177e4 | 457 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); |
2d8f4447 | 458 | else if (old_termios && (old_termios->c_cflag & CBAUD) == B0) |
1da177e4 LT |
459 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); |
460 | if (control != priv->line_control) { | |
461 | control = priv->line_control; | |
462 | spin_unlock_irqrestore(&priv->lock, flags); | |
f45d0a5a | 463 | pl2303_set_control_lines(port, control); |
1da177e4 LT |
464 | } else { |
465 | spin_unlock_irqrestore(&priv->lock, flags); | |
466 | } | |
372db8a7 | 467 | |
87265b45 | 468 | memset(buf, 0, 7); |
372db8a7 TG |
469 | i = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
470 | GET_LINE_REQUEST, GET_LINE_REQUEST_TYPE, | |
471 | 0, 0, buf, 7, 100); | |
715cf92a | 472 | dev_dbg(&port->dev, "0xa1:0x21:0:0 %d - %7ph\n", i, buf); |
1da177e4 | 473 | |
87265b45 | 474 | if (C_CRTSCTS(tty)) { |
e8bbd5c4 | 475 | if (spriv->type == HX) |
034d1527 | 476 | pl2303_vendor_write(0x0, 0x61, serial); |
e8bbd5c4 GKH |
477 | else |
478 | pl2303_vendor_write(0x0, 0x41, serial); | |
715f9527 | 479 | } else { |
eb44da0b | 480 | pl2303_vendor_write(0x0, 0x0, serial); |
1da177e4 | 481 | } |
572d3138 TG |
482 | |
483 | kfree(buf); | |
484 | } | |
485 | ||
335f8514 AC |
486 | static void pl2303_dtr_rts(struct usb_serial_port *port, int on) |
487 | { | |
488 | struct pl2303_private *priv = usb_get_serial_port_data(port); | |
489 | unsigned long flags; | |
490 | u8 control; | |
491 | ||
492 | spin_lock_irqsave(&priv->lock, flags); | |
335f8514 AC |
493 | if (on) |
494 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); | |
495 | else | |
496 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); | |
497 | control = priv->line_control; | |
498 | spin_unlock_irqrestore(&priv->lock, flags); | |
ccfe8188 | 499 | |
f45d0a5a | 500 | pl2303_set_control_lines(port, control); |
335f8514 AC |
501 | } |
502 | ||
503 | static void pl2303_close(struct usb_serial_port *port) | |
572d3138 | 504 | { |
8b0127b2 | 505 | usb_serial_generic_close(port); |
572d3138 | 506 | usb_kill_urb(port->interrupt_in_urb); |
1da177e4 LT |
507 | } |
508 | ||
a509a7e4 | 509 | static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) |
1da177e4 | 510 | { |
1da177e4 | 511 | struct usb_serial *serial = port->serial; |
8bf769eb | 512 | struct pl2303_serial_private *spriv = usb_get_serial_data(serial); |
1da177e4 LT |
513 | int result; |
514 | ||
e8bbd5c4 | 515 | if (spriv->type != HX) { |
1694899f D |
516 | usb_clear_halt(serial->dev, port->write_urb->pipe); |
517 | usb_clear_halt(serial->dev, port->read_urb->pipe); | |
3e152505 | 518 | } else { |
1da177e4 | 519 | /* reset upstream data pipes */ |
eb44da0b SS |
520 | pl2303_vendor_write(8, 0, serial); |
521 | pl2303_vendor_write(9, 0, serial); | |
1da177e4 LT |
522 | } |
523 | ||
1da177e4 | 524 | /* Setup termios */ |
95da310e | 525 | if (tty) |
2d8f4447 | 526 | pl2303_set_termios(tty, port, NULL); |
1da177e4 | 527 | |
372db8a7 | 528 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
1da177e4 | 529 | if (result) { |
ccfe8188 JH |
530 | dev_err(&port->dev, "failed to submit interrupt urb: %d\n", |
531 | result); | |
db6e9186 | 532 | return result; |
1da177e4 | 533 | } |
d4691c3f | 534 | |
f5230a53 | 535 | result = usb_serial_generic_open(tty, port); |
d4691c3f JH |
536 | if (result) { |
537 | usb_kill_urb(port->interrupt_in_urb); | |
538 | return result; | |
539 | } | |
540 | ||
1da177e4 LT |
541 | return 0; |
542 | } | |
543 | ||
20b9d177 | 544 | static int pl2303_tiocmset(struct tty_struct *tty, |
372db8a7 | 545 | unsigned int set, unsigned int clear) |
1da177e4 | 546 | { |
95da310e | 547 | struct usb_serial_port *port = tty->driver_data; |
1da177e4 LT |
548 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
549 | unsigned long flags; | |
550 | u8 control; | |
6f1efd6c | 551 | int ret; |
6fdd8e8e | 552 | |
372db8a7 | 553 | spin_lock_irqsave(&priv->lock, flags); |
1da177e4 LT |
554 | if (set & TIOCM_RTS) |
555 | priv->line_control |= CONTROL_RTS; | |
556 | if (set & TIOCM_DTR) | |
557 | priv->line_control |= CONTROL_DTR; | |
558 | if (clear & TIOCM_RTS) | |
559 | priv->line_control &= ~CONTROL_RTS; | |
560 | if (clear & TIOCM_DTR) | |
561 | priv->line_control &= ~CONTROL_DTR; | |
562 | control = priv->line_control; | |
372db8a7 | 563 | spin_unlock_irqrestore(&priv->lock, flags); |
1da177e4 | 564 | |
5ddbb26b JH |
565 | ret = pl2303_set_control_lines(port, control); |
566 | if (ret) | |
567 | return usb_translate_errors(ret); | |
6f1efd6c | 568 | |
5ddbb26b | 569 | return 0; |
1da177e4 LT |
570 | } |
571 | ||
60b33c13 | 572 | static int pl2303_tiocmget(struct tty_struct *tty) |
1da177e4 | 573 | { |
95da310e | 574 | struct usb_serial_port *port = tty->driver_data; |
1da177e4 LT |
575 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
576 | unsigned long flags; | |
577 | unsigned int mcr; | |
578 | unsigned int status; | |
579 | unsigned int result; | |
580 | ||
372db8a7 | 581 | spin_lock_irqsave(&priv->lock, flags); |
1da177e4 LT |
582 | mcr = priv->line_control; |
583 | status = priv->line_status; | |
372db8a7 | 584 | spin_unlock_irqrestore(&priv->lock, flags); |
1da177e4 LT |
585 | |
586 | result = ((mcr & CONTROL_DTR) ? TIOCM_DTR : 0) | |
587 | | ((mcr & CONTROL_RTS) ? TIOCM_RTS : 0) | |
588 | | ((status & UART_CTS) ? TIOCM_CTS : 0) | |
589 | | ((status & UART_DSR) ? TIOCM_DSR : 0) | |
590 | | ((status & UART_RING) ? TIOCM_RI : 0) | |
591 | | ((status & UART_DCD) ? TIOCM_CD : 0); | |
592 | ||
d8789b2b | 593 | dev_dbg(&port->dev, "%s - result = %x\n", __func__, result); |
1da177e4 LT |
594 | |
595 | return result; | |
596 | } | |
597 | ||
335f8514 AC |
598 | static int pl2303_carrier_raised(struct usb_serial_port *port) |
599 | { | |
600 | struct pl2303_private *priv = usb_get_serial_port_data(port); | |
ccfe8188 | 601 | |
335f8514 AC |
602 | if (priv->line_status & UART_DCD) |
603 | return 1; | |
ccfe8188 | 604 | |
335f8514 AC |
605 | return 0; |
606 | } | |
607 | ||
824d11be | 608 | static int pl2303_tiocmiwait(struct tty_struct *tty, unsigned long arg) |
1da177e4 | 609 | { |
824d11be | 610 | struct usb_serial_port *port = tty->driver_data; |
1da177e4 LT |
611 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
612 | unsigned long flags; | |
613 | unsigned int prevstatus; | |
614 | unsigned int status; | |
615 | unsigned int changed; | |
616 | ||
372db8a7 | 617 | spin_lock_irqsave(&priv->lock, flags); |
1da177e4 | 618 | prevstatus = priv->line_status; |
372db8a7 | 619 | spin_unlock_irqrestore(&priv->lock, flags); |
1da177e4 LT |
620 | |
621 | while (1) { | |
6d0cad65 | 622 | interruptible_sleep_on(&port->port.delta_msr_wait); |
1da177e4 LT |
623 | /* see if a signal did it */ |
624 | if (signal_pending(current)) | |
625 | return -ERESTARTSYS; | |
372db8a7 | 626 | |
40509ca9 JH |
627 | if (port->serial->disconnected) |
628 | return -EIO; | |
629 | ||
372db8a7 | 630 | spin_lock_irqsave(&priv->lock, flags); |
1da177e4 | 631 | status = priv->line_status; |
372db8a7 TG |
632 | spin_unlock_irqrestore(&priv->lock, flags); |
633 | ||
3a0f43e9 | 634 | changed = prevstatus ^ status; |
372db8a7 | 635 | |
1da177e4 LT |
636 | if (((arg & TIOCM_RNG) && (changed & UART_RING)) || |
637 | ((arg & TIOCM_DSR) && (changed & UART_DSR)) || | |
638 | ((arg & TIOCM_CD) && (changed & UART_DCD)) || | |
3a0f43e9 | 639 | ((arg & TIOCM_CTS) && (changed & UART_CTS))) { |
1da177e4 LT |
640 | return 0; |
641 | } | |
642 | prevstatus = status; | |
643 | } | |
644 | /* NOTREACHED */ | |
645 | return 0; | |
646 | } | |
647 | ||
00a0d0d6 | 648 | static int pl2303_ioctl(struct tty_struct *tty, |
372db8a7 | 649 | unsigned int cmd, unsigned long arg) |
1da177e4 | 650 | { |
67b9946d | 651 | struct serial_struct ser; |
95da310e | 652 | struct usb_serial_port *port = tty->driver_data; |
d8789b2b | 653 | |
1da177e4 | 654 | switch (cmd) { |
67b9946d JT |
655 | case TIOCGSERIAL: |
656 | memset(&ser, 0, sizeof ser); | |
657 | ser.type = PORT_16654; | |
e5b1e206 | 658 | ser.line = port->minor; |
1143832e | 659 | ser.port = port->port_number; |
67b9946d JT |
660 | ser.baud_base = 460800; |
661 | ||
662 | if (copy_to_user((void __user *)arg, &ser, sizeof ser)) | |
663 | return -EFAULT; | |
664 | ||
665 | return 0; | |
3a0f43e9 | 666 | default: |
3a0f43e9 | 667 | break; |
1da177e4 | 668 | } |
ccfe8188 | 669 | |
1da177e4 LT |
670 | return -ENOIOCTLCMD; |
671 | } | |
672 | ||
95da310e | 673 | static void pl2303_break_ctl(struct tty_struct *tty, int break_state) |
1da177e4 | 674 | { |
95da310e | 675 | struct usb_serial_port *port = tty->driver_data; |
1da177e4 LT |
676 | struct usb_serial *serial = port->serial; |
677 | u16 state; | |
678 | int result; | |
679 | ||
1da177e4 LT |
680 | if (break_state == 0) |
681 | state = BREAK_OFF; | |
682 | else | |
683 | state = BREAK_ON; | |
ccfe8188 | 684 | |
d8789b2b | 685 | dev_dbg(&port->dev, "%s - turning break %s\n", __func__, |
3a0f43e9 | 686 | state == BREAK_OFF ? "off" : "on"); |
1da177e4 | 687 | |
372db8a7 TG |
688 | result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
689 | BREAK_REQUEST, BREAK_REQUEST_TYPE, state, | |
690 | 0, NULL, 0, 100); | |
1da177e4 | 691 | if (result) |
d8789b2b | 692 | dev_err(&port->dev, "error sending break = %d\n", result); |
1da177e4 LT |
693 | } |
694 | ||
97bb13ec FL |
695 | static void pl2303_update_line_status(struct usb_serial_port *port, |
696 | unsigned char *data, | |
697 | unsigned int actual_length) | |
698 | { | |
97bb13ec | 699 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
d14fc1a7 | 700 | struct tty_struct *tty; |
97bb13ec FL |
701 | unsigned long flags; |
702 | u8 status_idx = UART_STATE; | |
95f209f9 | 703 | u8 length = UART_STATE + 1; |
d14fc1a7 | 704 | u8 prev_line_status; |
9c537616 | 705 | u16 idv, idp; |
97bb13ec | 706 | |
9c537616 TG |
707 | idv = le16_to_cpu(port->serial->dev->descriptor.idVendor); |
708 | idp = le16_to_cpu(port->serial->dev->descriptor.idProduct); | |
709 | ||
9c537616 TG |
710 | if (idv == SIEMENS_VENDOR_ID) { |
711 | if (idp == SIEMENS_PRODUCT_ID_X65 || | |
712 | idp == SIEMENS_PRODUCT_ID_SX1 || | |
713 | idp == SIEMENS_PRODUCT_ID_X75) { | |
9c537616 TG |
714 | length = 1; |
715 | status_idx = 0; | |
716 | } | |
97bb13ec FL |
717 | } |
718 | ||
719 | if (actual_length < length) | |
a009b75a | 720 | return; |
97bb13ec | 721 | |
3a0f43e9 | 722 | /* Save off the uart status for others to look at */ |
97bb13ec | 723 | spin_lock_irqsave(&priv->lock, flags); |
d14fc1a7 | 724 | prev_line_status = priv->line_status; |
97bb13ec FL |
725 | priv->line_status = data[status_idx]; |
726 | spin_unlock_irqrestore(&priv->lock, flags); | |
ccfe8188 | 727 | |
430eb0d2 JW |
728 | if (priv->line_status & UART_BREAK_ERROR) |
729 | usb_serial_handle_break(port); | |
ccfe8188 | 730 | |
6d0cad65 | 731 | wake_up_interruptible(&port->port.delta_msr_wait); |
d14fc1a7 LP |
732 | |
733 | tty = tty_port_tty_get(&port->port); | |
734 | if (!tty) | |
735 | return; | |
736 | if ((priv->line_status ^ prev_line_status) & UART_DCD) | |
737 | usb_serial_handle_dcd_change(port, tty, | |
738 | priv->line_status & UART_DCD); | |
739 | tty_kref_put(tty); | |
97bb13ec | 740 | } |
1da177e4 | 741 | |
7d12e780 | 742 | static void pl2303_read_int_callback(struct urb *urb) |
1da177e4 | 743 | { |
cdc97792 | 744 | struct usb_serial_port *port = urb->context; |
1da177e4 | 745 | unsigned char *data = urb->transfer_buffer; |
97bb13ec | 746 | unsigned int actual_length = urb->actual_length; |
461d696a GKH |
747 | int status = urb->status; |
748 | int retval; | |
1da177e4 | 749 | |
461d696a | 750 | switch (status) { |
1da177e4 LT |
751 | case 0: |
752 | /* success */ | |
753 | break; | |
754 | case -ECONNRESET: | |
755 | case -ENOENT: | |
756 | case -ESHUTDOWN: | |
757 | /* this urb is terminated, clean up */ | |
d8789b2b GKH |
758 | dev_dbg(&port->dev, "%s - urb shutting down with status: %d\n", |
759 | __func__, status); | |
1da177e4 LT |
760 | return; |
761 | default: | |
d8789b2b GKH |
762 | dev_dbg(&port->dev, "%s - nonzero urb status received: %d\n", |
763 | __func__, status); | |
1da177e4 LT |
764 | goto exit; |
765 | } | |
766 | ||
59d33f2f | 767 | usb_serial_debug_data(&port->dev, __func__, |
372db8a7 TG |
768 | urb->actual_length, urb->transfer_buffer); |
769 | ||
97bb13ec | 770 | pl2303_update_line_status(port, data, actual_length); |
1da177e4 | 771 | |
1da177e4 | 772 | exit: |
461d696a | 773 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
ccfe8188 | 774 | if (retval) { |
d8789b2b | 775 | dev_err(&port->dev, |
372db8a7 | 776 | "%s - usb_submit_urb failed with result %d\n", |
441b62c1 | 777 | __func__, retval); |
ccfe8188 | 778 | } |
1da177e4 LT |
779 | } |
780 | ||
f08e07ac | 781 | static void pl2303_process_read_urb(struct urb *urb) |
d4fc4a7b | 782 | { |
f08e07ac JH |
783 | struct usb_serial_port *port = urb->context; |
784 | struct pl2303_private *priv = usb_get_serial_port_data(port); | |
d4fc4a7b | 785 | unsigned char *data = urb->transfer_buffer; |
d4fc4a7b | 786 | char tty_flag = TTY_NORMAL; |
f08e07ac JH |
787 | unsigned long flags; |
788 | u8 line_status; | |
789 | int i; | |
790 | ||
791 | /* update line status */ | |
792 | spin_lock_irqsave(&priv->lock, flags); | |
793 | line_status = priv->line_status; | |
794 | priv->line_status &= ~UART_STATE_TRANSIENT_MASK; | |
795 | spin_unlock_irqrestore(&priv->lock, flags); | |
f08e07ac JH |
796 | |
797 | if (!urb->actual_length) | |
798 | return; | |
799 | ||
ccfe8188 JH |
800 | /* |
801 | * Break takes precedence over parity, which takes precedence over | |
802 | * framing errors. | |
803 | */ | |
d4fc4a7b AC |
804 | if (line_status & UART_BREAK_ERROR) |
805 | tty_flag = TTY_BREAK; | |
806 | else if (line_status & UART_PARITY_ERROR) | |
807 | tty_flag = TTY_PARITY; | |
808 | else if (line_status & UART_FRAME_ERROR) | |
809 | tty_flag = TTY_FRAME; | |
d4fc4a7b | 810 | |
3ba19fe3 JH |
811 | if (tty_flag != TTY_NORMAL) |
812 | dev_dbg(&port->dev, "%s - tty_flag = %d\n", __func__, | |
813 | tty_flag); | |
d4fc4a7b AC |
814 | /* overrun is special, not associated with a char */ |
815 | if (line_status & UART_OVERRUN_ERROR) | |
92a19f9c | 816 | tty_insert_flip_char(&port->port, 0, TTY_OVERRUN); |
9388e2e7 | 817 | |
d45cc8df | 818 | if (port->port.console && port->sysrq) { |
d4fc4a7b | 819 | for (i = 0; i < urb->actual_length; ++i) |
6ee9f4b4 | 820 | if (!usb_serial_handle_sysrq_char(port, data[i])) |
92a19f9c JS |
821 | tty_insert_flip_char(&port->port, data[i], |
822 | tty_flag); | |
d45cc8df | 823 | } else { |
2f693357 | 824 | tty_insert_flip_string_fixed_flag(&port->port, data, tty_flag, |
d45cc8df | 825 | urb->actual_length); |
9388e2e7 | 826 | } |
1da177e4 | 827 | |
2e124b4a | 828 | tty_flip_buffer_push(&port->port); |
1da177e4 LT |
829 | } |
830 | ||
572d3138 TG |
831 | static struct usb_serial_driver pl2303_device = { |
832 | .driver = { | |
833 | .owner = THIS_MODULE, | |
834 | .name = "pl2303", | |
835 | }, | |
836 | .id_table = id_table, | |
572d3138 | 837 | .num_ports = 1, |
7919c2fd | 838 | .bulk_in_size = 256, |
3efeaff6 | 839 | .bulk_out_size = 256, |
572d3138 TG |
840 | .open = pl2303_open, |
841 | .close = pl2303_close, | |
ccfe8188 | 842 | .dtr_rts = pl2303_dtr_rts, |
335f8514 | 843 | .carrier_raised = pl2303_carrier_raised, |
572d3138 TG |
844 | .ioctl = pl2303_ioctl, |
845 | .break_ctl = pl2303_break_ctl, | |
846 | .set_termios = pl2303_set_termios, | |
847 | .tiocmget = pl2303_tiocmget, | |
848 | .tiocmset = pl2303_tiocmset, | |
824d11be | 849 | .tiocmiwait = pl2303_tiocmiwait, |
f08e07ac | 850 | .process_read_urb = pl2303_process_read_urb, |
572d3138 | 851 | .read_int_callback = pl2303_read_int_callback, |
572d3138 | 852 | .attach = pl2303_startup, |
f9c99bb8 | 853 | .release = pl2303_release, |
8bf769eb JH |
854 | .port_probe = pl2303_port_probe, |
855 | .port_remove = pl2303_port_remove, | |
572d3138 | 856 | }; |
1da177e4 | 857 | |
f667ddad AS |
858 | static struct usb_serial_driver * const serial_drivers[] = { |
859 | &pl2303_device, NULL | |
860 | }; | |
861 | ||
68e24113 | 862 | module_usb_serial_driver(serial_drivers, id_table); |
1da177e4 | 863 | |
ccfe8188 | 864 | MODULE_DESCRIPTION("Prolific PL2303 USB to serial adaptor driver"); |
1da177e4 | 865 | MODULE_LICENSE("GPL"); |