aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/cp210x.c
diff options
context:
space:
mode:
authorCraig Shelley <craig@microtron.org.uk>2009-06-11 08:54:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-11 11:51:05 -0400
commit4cc27bd6d7d6750dba33b4ccb4585c00b8fca7d2 (patch)
tree850f1c65ca1e66757c4e846a6029b564039b210a /drivers/usb/serial/cp210x.c
parent93ef1f1fbce37f14666e4856ff933d4a1b735d02 (diff)
USB: CP210X Replace CP2101 with CP210x
This patch replaces the string "CP2101" with "CP210x" within cp210x.c This is to reduce confusion about the fact that the driver is actually compatible with CP2101, CP2102 and CP2103 devices. Signed-off-by: Craig Shelley <craig@microtron.org.uk> (Fixed some collisions merging) Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/serial/cp210x.c')
-rw-r--r--drivers/usb/serial/cp210x.c194
1 files changed, 97 insertions, 97 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index b50f27fa11d0..16a154d3b2fe 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Silicon Laboratories CP2101/CP2102 USB to RS232 serial adaptor driver 2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver
3 * 3 *
4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk) 4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk)
5 * 5 *
@@ -28,29 +28,29 @@
28 * Version Information 28 * Version Information
29 */ 29 */
30#define DRIVER_VERSION "v0.09" 30#define DRIVER_VERSION "v0.09"
31#define DRIVER_DESC "Silicon Labs CP2101/CP2102 RS232 serial adaptor driver" 31#define DRIVER_DESC "Silicon Labs CP210x RS232 serial adaptor driver"
32 32
33/* 33/*
34 * Function Prototypes 34 * Function Prototypes
35 */ 35 */
36static int cp2101_open(struct tty_struct *, struct usb_serial_port *, 36static int cp210x_open(struct tty_struct *, struct usb_serial_port *,
37 struct file *); 37 struct file *);
38static void cp2101_cleanup(struct usb_serial_port *); 38static void cp210x_cleanup(struct usb_serial_port *);
39static void cp2101_close(struct usb_serial_port *); 39static void cp210x_close(struct usb_serial_port *);
40static void cp2101_get_termios(struct tty_struct *, 40static void cp210x_get_termios(struct tty_struct *,
41 struct usb_serial_port *port); 41 struct usb_serial_port *port);
42static void cp2101_get_termios_port(struct usb_serial_port *port, 42static void cp210x_get_termios_port(struct usb_serial_port *port,
43 unsigned int *cflagp, unsigned int *baudp); 43 unsigned int *cflagp, unsigned int *baudp);
44static void cp2101_set_termios(struct tty_struct *, struct usb_serial_port *, 44static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *,
45 struct ktermios*); 45 struct ktermios*);
46static int cp2101_tiocmget(struct tty_struct *, struct file *); 46static int cp210x_tiocmget(struct tty_struct *, struct file *);
47static int cp2101_tiocmset(struct tty_struct *, struct file *, 47static int cp210x_tiocmset(struct tty_struct *, struct file *,
48 unsigned int, unsigned int); 48 unsigned int, unsigned int);
49static int cp2101_tiocmset_port(struct usb_serial_port *port, struct file *, 49static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *,
50 unsigned int, unsigned int); 50 unsigned int, unsigned int);
51static void cp2101_break_ctl(struct tty_struct *, int); 51static void cp210x_break_ctl(struct tty_struct *, int);
52static int cp2101_startup(struct usb_serial *); 52static int cp210x_startup(struct usb_serial *);
53static void cp2101_shutdown(struct usb_serial *); 53static void cp210x_shutdown(struct usb_serial *);
54 54
55static int debug; 55static int debug;
56 56
@@ -114,30 +114,30 @@ static struct usb_device_id id_table [] = {
114 114
115MODULE_DEVICE_TABLE(usb, id_table); 115MODULE_DEVICE_TABLE(usb, id_table);
116 116
117static struct usb_driver cp2101_driver = { 117static struct usb_driver cp210x_driver = {
118 .name = "cp2101", 118 .name = "cp210x",
119 .probe = usb_serial_probe, 119 .probe = usb_serial_probe,
120 .disconnect = usb_serial_disconnect, 120 .disconnect = usb_serial_disconnect,
121 .id_table = id_table, 121 .id_table = id_table,
122 .no_dynamic_id = 1, 122 .no_dynamic_id = 1,
123}; 123};
124 124
125static struct usb_serial_driver cp2101_device = { 125static struct usb_serial_driver cp210x_device = {
126 .driver = { 126 .driver = {
127 .owner = THIS_MODULE, 127 .owner = THIS_MODULE,
128 .name = "cp2101", 128 .name = "cp210x",
129 }, 129 },
130 .usb_driver = &cp2101_driver, 130 .usb_driver = &cp210x_driver,
131 .id_table = id_table, 131 .id_table = id_table,
132 .num_ports = 1, 132 .num_ports = 1,
133 .open = cp2101_open, 133 .open = cp210x_open,
134 .close = cp2101_close, 134 .close = cp210x_close,
135 .break_ctl = cp2101_break_ctl, 135 .break_ctl = cp210x_break_ctl,
136 .set_termios = cp2101_set_termios, 136 .set_termios = cp210x_set_termios,
137 .tiocmget = cp2101_tiocmget, 137 .tiocmget = cp210x_tiocmget,
138 .tiocmset = cp2101_tiocmset, 138 .tiocmset = cp210x_tiocmset,
139 .attach = cp2101_startup, 139 .attach = cp210x_startup,
140 .shutdown = cp2101_shutdown, 140 .shutdown = cp210x_shutdown,
141}; 141};
142 142
143/* Config request types */ 143/* Config request types */
@@ -212,13 +212,13 @@ static struct usb_serial_driver cp2101_device = {
212#define CONTROL_WRITE_RTS 0x0200 212#define CONTROL_WRITE_RTS 0x0200
213 213
214/* 214/*
215 * cp2101_get_config 215 * cp210x_get_config
216 * Reads from the CP2101 configuration registers 216 * Reads from the CP210x configuration registers
217 * 'size' is specified in bytes. 217 * 'size' is specified in bytes.
218 * 'data' is a pointer to a pre-allocated array of integers large 218 * 'data' is a pointer to a pre-allocated array of integers large
219 * enough to hold 'size' bytes (with 4 bytes to each integer) 219 * enough to hold 'size' bytes (with 4 bytes to each integer)
220 */ 220 */
221static int cp2101_get_config(struct usb_serial_port *port, u8 request, 221static int cp210x_get_config(struct usb_serial_port *port, u8 request,
222 unsigned int *data, int size) 222 unsigned int *data, int size)
223{ 223{
224 struct usb_serial *serial = port->serial; 224 struct usb_serial *serial = port->serial;
@@ -256,12 +256,12 @@ static int cp2101_get_config(struct usb_serial_port *port, u8 request,
256} 256}
257 257
258/* 258/*
259 * cp2101_set_config 259 * cp210x_set_config
260 * Writes to the CP2101 configuration registers 260 * Writes to the CP210x configuration registers
261 * Values less than 16 bits wide are sent directly 261 * Values less than 16 bits wide are sent directly
262 * 'size' is specified in bytes. 262 * 'size' is specified in bytes.
263 */ 263 */
264static int cp2101_set_config(struct usb_serial_port *port, u8 request, 264static int cp210x_set_config(struct usb_serial_port *port, u8 request,
265 unsigned int *data, int size) 265 unsigned int *data, int size)
266{ 266{
267 struct usb_serial *serial = port->serial; 267 struct usb_serial *serial = port->serial;
@@ -312,21 +312,21 @@ static int cp2101_set_config(struct usb_serial_port *port, u8 request,
312} 312}
313 313
314/* 314/*
315 * cp2101_set_config_single 315 * cp210x_set_config_single
316 * Convenience function for calling cp2101_set_config on single data values 316 * Convenience function for calling cp210x_set_config on single data values
317 * without requiring an integer pointer 317 * without requiring an integer pointer
318 */ 318 */
319static inline int cp2101_set_config_single(struct usb_serial_port *port, 319static inline int cp210x_set_config_single(struct usb_serial_port *port,
320 u8 request, unsigned int data) 320 u8 request, unsigned int data)
321{ 321{
322 return cp2101_set_config(port, request, &data, 2); 322 return cp210x_set_config(port, request, &data, 2);
323} 323}
324 324
325/* 325/*
326 * cp2101_quantise_baudrate 326 * cp210x_quantise_baudrate
327 * Quantises the baud rate as per AN205 Table 1 327 * Quantises the baud rate as per AN205 Table 1
328 */ 328 */
329static unsigned int cp2101_quantise_baudrate(unsigned int baud) { 329static unsigned int cp210x_quantise_baudrate(unsigned int baud) {
330 if (baud <= 56) baud = 0; 330 if (baud <= 56) baud = 0;
331 else if (baud <= 300) baud = 300; 331 else if (baud <= 300) baud = 300;
332 else if (baud <= 600) baud = 600; 332 else if (baud <= 600) baud = 600;
@@ -363,7 +363,7 @@ static unsigned int cp2101_quantise_baudrate(unsigned int baud) {
363 return baud; 363 return baud;
364} 364}
365 365
366static int cp2101_open(struct tty_struct *tty, struct usb_serial_port *port, 366static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port,
367 struct file *filp) 367 struct file *filp)
368{ 368{
369 struct usb_serial *serial = port->serial; 369 struct usb_serial *serial = port->serial;
@@ -371,7 +371,7 @@ static int cp2101_open(struct tty_struct *tty, struct usb_serial_port *port,
371 371
372 dbg("%s - port %d", __func__, port->number); 372 dbg("%s - port %d", __func__, port->number);
373 373
374 if (cp2101_set_config_single(port, CP210X_IFC_ENABLE, UART_ENABLE)) { 374 if (cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_ENABLE)) {
375 dev_err(&port->dev, "%s - Unable to enable UART\n", 375 dev_err(&port->dev, "%s - Unable to enable UART\n",
376 __func__); 376 __func__);
377 return -EPROTO; 377 return -EPROTO;
@@ -393,17 +393,17 @@ static int cp2101_open(struct tty_struct *tty, struct usb_serial_port *port,
393 } 393 }
394 394
395 /* Configure the termios structure */ 395 /* Configure the termios structure */
396 cp2101_get_termios(tty, port); 396 cp210x_get_termios(tty, port);
397 397
398 /* Set the DTR and RTS pins low */ 398 /* Set the DTR and RTS pins low */
399 cp2101_tiocmset_port(tty ? (struct usb_serial_port *) tty->driver_data 399 cp210x_tiocmset_port(tty ? (struct usb_serial_port *) tty->driver_data
400 : port, 400 : port,
401 NULL, TIOCM_DTR | TIOCM_RTS, 0); 401 NULL, TIOCM_DTR | TIOCM_RTS, 0);
402 402
403 return 0; 403 return 0;
404} 404}
405 405
406static void cp2101_cleanup(struct usb_serial_port *port) 406static void cp210x_cleanup(struct usb_serial_port *port)
407{ 407{
408 struct usb_serial *serial = port->serial; 408 struct usb_serial *serial = port->serial;
409 409
@@ -418,7 +418,7 @@ static void cp2101_cleanup(struct usb_serial_port *port)
418 } 418 }
419} 419}
420 420
421static void cp2101_close(struct usb_serial_port *port) 421static void cp210x_close(struct usb_serial_port *port)
422{ 422{
423 dbg("%s - port %d", __func__, port->number); 423 dbg("%s - port %d", __func__, port->number);
424 424
@@ -429,23 +429,23 @@ static void cp2101_close(struct usb_serial_port *port)
429 429
430 mutex_lock(&port->serial->disc_mutex); 430 mutex_lock(&port->serial->disc_mutex);
431 if (!port->serial->disconnected) 431 if (!port->serial->disconnected)
432 cp2101_set_config_single(port, CP210X_IFC_ENABLE, UART_DISABLE); 432 cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_DISABLE);
433 mutex_unlock(&port->serial->disc_mutex); 433 mutex_unlock(&port->serial->disc_mutex);
434} 434}
435 435
436/* 436/*
437 * cp2101_get_termios 437 * cp210x_get_termios
438 * Reads the baud rate, data bits, parity, stop bits and flow control mode 438 * Reads the baud rate, data bits, parity, stop bits and flow control mode
439 * from the device, corrects any unsupported values, and configures the 439 * from the device, corrects any unsupported values, and configures the
440 * termios structure to reflect the state of the device 440 * termios structure to reflect the state of the device
441 */ 441 */
442static void cp2101_get_termios(struct tty_struct *tty, 442static void cp210x_get_termios(struct tty_struct *tty,
443 struct usb_serial_port *port) 443 struct usb_serial_port *port)
444{ 444{
445 unsigned int baud; 445 unsigned int baud;
446 446
447 if (tty) { 447 if (tty) {
448 cp2101_get_termios_port(tty->driver_data, 448 cp210x_get_termios_port(tty->driver_data,
449 &tty->termios->c_cflag, &baud); 449 &tty->termios->c_cflag, &baud);
450 tty_encode_baud_rate(tty, baud, baud); 450 tty_encode_baud_rate(tty, baud, baud);
451 } 451 }
@@ -453,15 +453,15 @@ static void cp2101_get_termios(struct tty_struct *tty,
453 else { 453 else {
454 unsigned int cflag; 454 unsigned int cflag;
455 cflag = 0; 455 cflag = 0;
456 cp2101_get_termios_port(port, &cflag, &baud); 456 cp210x_get_termios_port(port, &cflag, &baud);
457 } 457 }
458} 458}
459 459
460/* 460/*
461 * cp2101_get_termios_port 461 * cp210x_get_termios_port
462 * This is the heart of cp2101_get_termios which always uses a &usb_serial_port. 462 * This is the heart of cp210x_get_termios which always uses a &usb_serial_port.
463 */ 463 */
464static void cp2101_get_termios_port(struct usb_serial_port *port, 464static void cp210x_get_termios_port(struct usb_serial_port *port,
465 unsigned int *cflagp, unsigned int *baudp) 465 unsigned int *cflagp, unsigned int *baudp)
466{ 466{
467 unsigned int cflag, modem_ctl[4]; 467 unsigned int cflag, modem_ctl[4];
@@ -470,17 +470,17 @@ static void cp2101_get_termios_port(struct usb_serial_port *port,
470 470
471 dbg("%s - port %d", __func__, port->number); 471 dbg("%s - port %d", __func__, port->number);
472 472
473 cp2101_get_config(port, CP210X_GET_BAUDDIV, &baud, 2); 473 cp210x_get_config(port, CP210X_GET_BAUDDIV, &baud, 2);
474 /* Convert to baudrate */ 474 /* Convert to baudrate */
475 if (baud) 475 if (baud)
476 baud = cp2101_quantise_baudrate((BAUD_RATE_GEN_FREQ + baud/2)/ baud); 476 baud = cp210x_quantise_baudrate((BAUD_RATE_GEN_FREQ + baud/2)/ baud);
477 477
478 dbg("%s - baud rate = %d", __func__, baud); 478 dbg("%s - baud rate = %d", __func__, baud);
479 *baudp = baud; 479 *baudp = baud;
480 480
481 cflag = *cflagp; 481 cflag = *cflagp;
482 482
483 cp2101_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); 483 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
484 cflag &= ~CSIZE; 484 cflag &= ~CSIZE;
485 switch (bits & BITS_DATA_MASK) { 485 switch (bits & BITS_DATA_MASK) {
486 case BITS_DATA_5: 486 case BITS_DATA_5:
@@ -505,14 +505,14 @@ static void cp2101_get_termios_port(struct usb_serial_port *port,
505 cflag |= CS8; 505 cflag |= CS8;
506 bits &= ~BITS_DATA_MASK; 506 bits &= ~BITS_DATA_MASK;
507 bits |= BITS_DATA_8; 507 bits |= BITS_DATA_8;
508 cp2101_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 508 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
509 break; 509 break;
510 default: 510 default:
511 dbg("%s - Unknown number of data bits, using 8", __func__); 511 dbg("%s - Unknown number of data bits, using 8", __func__);
512 cflag |= CS8; 512 cflag |= CS8;
513 bits &= ~BITS_DATA_MASK; 513 bits &= ~BITS_DATA_MASK;
514 bits |= BITS_DATA_8; 514 bits |= BITS_DATA_8;
515 cp2101_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 515 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
516 break; 516 break;
517 } 517 }
518 518
@@ -535,20 +535,20 @@ static void cp2101_get_termios_port(struct usb_serial_port *port,
535 __func__); 535 __func__);
536 cflag &= ~PARENB; 536 cflag &= ~PARENB;
537 bits &= ~BITS_PARITY_MASK; 537 bits &= ~BITS_PARITY_MASK;
538 cp2101_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 538 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
539 break; 539 break;
540 case BITS_PARITY_SPACE: 540 case BITS_PARITY_SPACE:
541 dbg("%s - parity = SPACE (not supported, disabling parity)", 541 dbg("%s - parity = SPACE (not supported, disabling parity)",
542 __func__); 542 __func__);
543 cflag &= ~PARENB; 543 cflag &= ~PARENB;
544 bits &= ~BITS_PARITY_MASK; 544 bits &= ~BITS_PARITY_MASK;
545 cp2101_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 545 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
546 break; 546 break;
547 default: 547 default:
548 dbg("%s - Unknown parity mode, disabling parity", __func__); 548 dbg("%s - Unknown parity mode, disabling parity", __func__);
549 cflag &= ~PARENB; 549 cflag &= ~PARENB;
550 bits &= ~BITS_PARITY_MASK; 550 bits &= ~BITS_PARITY_MASK;
551 cp2101_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 551 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
552 break; 552 break;
553 } 553 }
554 554
@@ -561,7 +561,7 @@ static void cp2101_get_termios_port(struct usb_serial_port *port,
561 dbg("%s - stop bits = 1.5 (not supported, using 1 stop bit)", 561 dbg("%s - stop bits = 1.5 (not supported, using 1 stop bit)",
562 __func__); 562 __func__);
563 bits &= ~BITS_STOP_MASK; 563 bits &= ~BITS_STOP_MASK;
564 cp2101_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 564 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
565 break; 565 break;
566 case BITS_STOP_2: 566 case BITS_STOP_2:
567 dbg("%s - stop bits = 2", __func__); 567 dbg("%s - stop bits = 2", __func__);
@@ -571,11 +571,11 @@ static void cp2101_get_termios_port(struct usb_serial_port *port,
571 dbg("%s - Unknown number of stop bits, using 1 stop bit", 571 dbg("%s - Unknown number of stop bits, using 1 stop bit",
572 __func__); 572 __func__);
573 bits &= ~BITS_STOP_MASK; 573 bits &= ~BITS_STOP_MASK;
574 cp2101_set_config(port, CP210X_SET_LINE_CTL, &bits, 2); 574 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
575 break; 575 break;
576 } 576 }
577 577
578 cp2101_get_config(port, CP210X_GET_FLOW, modem_ctl, 16); 578 cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
579 if (modem_ctl[0] & 0x0008) { 579 if (modem_ctl[0] & 0x0008) {
580 dbg("%s - flow control = CRTSCTS", __func__); 580 dbg("%s - flow control = CRTSCTS", __func__);
581 cflag |= CRTSCTS; 581 cflag |= CRTSCTS;
@@ -587,7 +587,7 @@ static void cp2101_get_termios_port(struct usb_serial_port *port,
587 *cflagp = cflag; 587 *cflagp = cflag;
588} 588}
589 589
590static void cp2101_set_termios(struct tty_struct *tty, 590static void cp210x_set_termios(struct tty_struct *tty,
591 struct usb_serial_port *port, struct ktermios *old_termios) 591 struct usb_serial_port *port, struct ktermios *old_termios)
592{ 592{
593 unsigned int cflag, old_cflag; 593 unsigned int cflag, old_cflag;
@@ -602,13 +602,13 @@ static void cp2101_set_termios(struct tty_struct *tty,
602 tty->termios->c_cflag &= ~CMSPAR; 602 tty->termios->c_cflag &= ~CMSPAR;
603 cflag = tty->termios->c_cflag; 603 cflag = tty->termios->c_cflag;
604 old_cflag = old_termios->c_cflag; 604 old_cflag = old_termios->c_cflag;
605 baud = cp2101_quantise_baudrate(tty_get_baud_rate(tty)); 605 baud = cp210x_quantise_baudrate(tty_get_baud_rate(tty));
606 606
607 /* If the baud rate is to be updated*/ 607 /* If the baud rate is to be updated*/
608 if (baud != tty_termios_baud_rate(old_termios) && baud != 0) { 608 if (baud != tty_termios_baud_rate(old_termios) && baud != 0) {
609 dbg("%s - Setting baud rate to %d baud", __func__, 609 dbg("%s - Setting baud rate to %d baud", __func__,
610 baud); 610 baud);
611 if (cp2101_set_config_single(port, CP210X_SET_BAUDDIV, 611 if (cp210x_set_config_single(port, CP210X_SET_BAUDDIV,
612 ((BAUD_RATE_GEN_FREQ + baud/2) / baud))) { 612 ((BAUD_RATE_GEN_FREQ + baud/2) / baud))) {
613 dbg("Baud rate requested not supported by device\n"); 613 dbg("Baud rate requested not supported by device\n");
614 baud = tty_termios_baud_rate(old_termios); 614 baud = tty_termios_baud_rate(old_termios);
@@ -619,7 +619,7 @@ static void cp2101_set_termios(struct tty_struct *tty,
619 619
620 /* If the number of data bits is to be updated */ 620 /* If the number of data bits is to be updated */
621 if ((cflag & CSIZE) != (old_cflag & CSIZE)) { 621 if ((cflag & CSIZE) != (old_cflag & CSIZE)) {
622 cp2101_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); 622 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
623 bits &= ~BITS_DATA_MASK; 623 bits &= ~BITS_DATA_MASK;
624 switch (cflag & CSIZE) { 624 switch (cflag & CSIZE) {
625 case CS5: 625 case CS5:
@@ -643,19 +643,19 @@ static void cp2101_set_termios(struct tty_struct *tty,
643 dbg("%s - data bits = 9", __func__); 643 dbg("%s - data bits = 9", __func__);
644 break;*/ 644 break;*/
645 default: 645 default:
646 dbg("cp2101 driver does not " 646 dbg("cp210x driver does not "
647 "support the number of bits requested," 647 "support the number of bits requested,"
648 " using 8 bit mode\n"); 648 " using 8 bit mode\n");
649 bits |= BITS_DATA_8; 649 bits |= BITS_DATA_8;
650 break; 650 break;
651 } 651 }
652 if (cp2101_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 652 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
653 dbg("Number of data bits requested " 653 dbg("Number of data bits requested "
654 "not supported by device\n"); 654 "not supported by device\n");
655 } 655 }
656 656
657 if ((cflag & (PARENB|PARODD)) != (old_cflag & (PARENB|PARODD))) { 657 if ((cflag & (PARENB|PARODD)) != (old_cflag & (PARENB|PARODD))) {
658 cp2101_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); 658 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
659 bits &= ~BITS_PARITY_MASK; 659 bits &= ~BITS_PARITY_MASK;
660 if (cflag & PARENB) { 660 if (cflag & PARENB) {
661 if (cflag & PARODD) { 661 if (cflag & PARODD) {
@@ -666,13 +666,13 @@ static void cp2101_set_termios(struct tty_struct *tty,
666 dbg("%s - parity = EVEN", __func__); 666 dbg("%s - parity = EVEN", __func__);
667 } 667 }
668 } 668 }
669 if (cp2101_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 669 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
670 dbg("Parity mode not supported " 670 dbg("Parity mode not supported "
671 "by device\n"); 671 "by device\n");
672 } 672 }
673 673
674 if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) { 674 if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) {
675 cp2101_get_config(port, CP210X_GET_LINE_CTL, &bits, 2); 675 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
676 bits &= ~BITS_STOP_MASK; 676 bits &= ~BITS_STOP_MASK;
677 if (cflag & CSTOPB) { 677 if (cflag & CSTOPB) {
678 bits |= BITS_STOP_2; 678 bits |= BITS_STOP_2;
@@ -681,13 +681,13 @@ static void cp2101_set_termios(struct tty_struct *tty,
681 bits |= BITS_STOP_1; 681 bits |= BITS_STOP_1;
682 dbg("%s - stop bits = 1", __func__); 682 dbg("%s - stop bits = 1", __func__);
683 } 683 }
684 if (cp2101_set_config(port, CP210X_SET_LINE_CTL, &bits, 2)) 684 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
685 dbg("Number of stop bits requested " 685 dbg("Number of stop bits requested "
686 "not supported by device\n"); 686 "not supported by device\n");
687 } 687 }
688 688
689 if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { 689 if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
690 cp2101_get_config(port, CP210X_GET_FLOW, modem_ctl, 16); 690 cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
691 dbg("%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x", 691 dbg("%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x",
692 __func__, modem_ctl[0], modem_ctl[1], 692 __func__, modem_ctl[0], modem_ctl[1],
693 modem_ctl[2], modem_ctl[3]); 693 modem_ctl[2], modem_ctl[3]);
@@ -707,19 +707,19 @@ static void cp2101_set_termios(struct tty_struct *tty,
707 dbg("%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x", 707 dbg("%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x",
708 __func__, modem_ctl[0], modem_ctl[1], 708 __func__, modem_ctl[0], modem_ctl[1],
709 modem_ctl[2], modem_ctl[3]); 709 modem_ctl[2], modem_ctl[3]);
710 cp2101_set_config(port, CP210X_SET_FLOW, modem_ctl, 16); 710 cp210x_set_config(port, CP210X_SET_FLOW, modem_ctl, 16);
711 } 711 }
712 712
713} 713}
714 714
715static int cp2101_tiocmset (struct tty_struct *tty, struct file *file, 715static int cp210x_tiocmset (struct tty_struct *tty, struct file *file,
716 unsigned int set, unsigned int clear) 716 unsigned int set, unsigned int clear)
717{ 717{
718 struct usb_serial_port *port = tty->driver_data; 718 struct usb_serial_port *port = tty->driver_data;
719 return cp2101_tiocmset_port(port, file, set, clear); 719 return cp210x_tiocmset_port(port, file, set, clear);
720} 720}
721 721
722static int cp2101_tiocmset_port(struct usb_serial_port *port, struct file *file, 722static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *file,
723 unsigned int set, unsigned int clear) 723 unsigned int set, unsigned int clear)
724{ 724{
725 unsigned int control = 0; 725 unsigned int control = 0;
@@ -745,10 +745,10 @@ static int cp2101_tiocmset_port(struct usb_serial_port *port, struct file *file,
745 745
746 dbg("%s - control = 0x%.4x", __func__, control); 746 dbg("%s - control = 0x%.4x", __func__, control);
747 747
748 return cp2101_set_config(port, CP210X_SET_MHS, &control, 2); 748 return cp210x_set_config(port, CP210X_SET_MHS, &control, 2);
749} 749}
750 750
751static int cp2101_tiocmget (struct tty_struct *tty, struct file *file) 751static int cp210x_tiocmget (struct tty_struct *tty, struct file *file)
752{ 752{
753 struct usb_serial_port *port = tty->driver_data; 753 struct usb_serial_port *port = tty->driver_data;
754 unsigned int control; 754 unsigned int control;
@@ -756,7 +756,7 @@ static int cp2101_tiocmget (struct tty_struct *tty, struct file *file)
756 756
757 dbg("%s - port %d", __func__, port->number); 757 dbg("%s - port %d", __func__, port->number);
758 758
759 cp2101_get_config(port, CP210X_GET_MDMSTS, &control, 1); 759 cp210x_get_config(port, CP210X_GET_MDMSTS, &control, 1);
760 760
761 result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0) 761 result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0)
762 |((control & CONTROL_RTS) ? TIOCM_RTS : 0) 762 |((control & CONTROL_RTS) ? TIOCM_RTS : 0)
@@ -770,7 +770,7 @@ static int cp2101_tiocmget (struct tty_struct *tty, struct file *file)
770 return result; 770 return result;
771} 771}
772 772
773static void cp2101_break_ctl (struct tty_struct *tty, int break_state) 773static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
774{ 774{
775 struct usb_serial_port *port = tty->driver_data; 775 struct usb_serial_port *port = tty->driver_data;
776 unsigned int state; 776 unsigned int state;
@@ -782,17 +782,17 @@ static void cp2101_break_ctl (struct tty_struct *tty, int break_state)
782 state = BREAK_ON; 782 state = BREAK_ON;
783 dbg("%s - turning break %s", __func__, 783 dbg("%s - turning break %s", __func__,
784 state == BREAK_OFF ? "off" : "on"); 784 state == BREAK_OFF ? "off" : "on");
785 cp2101_set_config(port, CP210X_SET_BREAK, &state, 2); 785 cp210x_set_config(port, CP210X_SET_BREAK, &state, 2);
786} 786}
787 787
788static int cp2101_startup(struct usb_serial *serial) 788static int cp210x_startup(struct usb_serial *serial)
789{ 789{
790 /* CP2101 buffers behave strangely unless device is reset */ 790 /* cp210x buffers behave strangely unless device is reset */
791 usb_reset_device(serial->dev); 791 usb_reset_device(serial->dev);
792 return 0; 792 return 0;
793} 793}
794 794
795static void cp2101_shutdown(struct usb_serial *serial) 795static void cp210x_shutdown(struct usb_serial *serial)
796{ 796{
797 int i; 797 int i;
798 798
@@ -800,21 +800,21 @@ static void cp2101_shutdown(struct usb_serial *serial)
800 800
801 /* Stop reads and writes on all ports */ 801 /* Stop reads and writes on all ports */
802 for (i = 0; i < serial->num_ports; ++i) 802 for (i = 0; i < serial->num_ports; ++i)
803 cp2101_cleanup(serial->port[i]); 803 cp210x_cleanup(serial->port[i]);
804} 804}
805 805
806static int __init cp2101_init(void) 806static int __init cp210x_init(void)
807{ 807{
808 int retval; 808 int retval;
809 809
810 retval = usb_serial_register(&cp2101_device); 810 retval = usb_serial_register(&cp210x_device);
811 if (retval) 811 if (retval)
812 return retval; /* Failed to register */ 812 return retval; /* Failed to register */
813 813
814 retval = usb_register(&cp2101_driver); 814 retval = usb_register(&cp210x_driver);
815 if (retval) { 815 if (retval) {
816 /* Failed to register */ 816 /* Failed to register */
817 usb_serial_deregister(&cp2101_device); 817 usb_serial_deregister(&cp210x_device);
818 return retval; 818 return retval;
819 } 819 }
820 820
@@ -824,14 +824,14 @@ static int __init cp2101_init(void)
824 return 0; 824 return 0;
825} 825}
826 826
827static void __exit cp2101_exit(void) 827static void __exit cp210x_exit(void)
828{ 828{
829 usb_deregister(&cp2101_driver); 829 usb_deregister(&cp210x_driver);
830 usb_serial_deregister(&cp2101_device); 830 usb_serial_deregister(&cp210x_device);
831} 831}
832 832
833module_init(cp2101_init); 833module_init(cp210x_init);
834module_exit(cp2101_exit); 834module_exit(cp210x_exit);
835 835
836MODULE_DESCRIPTION(DRIVER_DESC); 836MODULE_DESCRIPTION(DRIVER_DESC);
837MODULE_VERSION(DRIVER_VERSION); 837MODULE_VERSION(DRIVER_VERSION);