cp210x.c (89bb957ec8b054ea9994974f03848cb2f129f50c) cp210x.c (660f3b1410d327e8cd29adb5b834caa66ebbd7d4)
1/*
2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver
3 *
4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.

--- 290 unchanged lines hidden (view full) ---

299
300 /* Convert data into an array of integers */
301 for (i = 0; i < length; i++)
302 data[i] = le32_to_cpu(buf[i]);
303
304 kfree(buf);
305
306 if (result != size) {
1/*
2 * Silicon Laboratories CP210x USB to RS232 serial adaptor driver
3 *
4 * Copyright (C) 2005 Craig Shelley (craig@microtron.org.uk)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.

--- 290 unchanged lines hidden (view full) ---

299
300 /* Convert data into an array of integers */
301 for (i = 0; i < length; i++)
302 data[i] = le32_to_cpu(buf[i]);
303
304 kfree(buf);
305
306 if (result != size) {
307 dbg("%s - Unable to send config request, "
308 "request=0x%x size=%d result=%d",
309 __func__, request, size, result);
307 dev_dbg(&port->dev, "%s - Unable to send config request, request=0x%x size=%d result=%d\n",
308 __func__, request, size, result);
310 if (result > 0)
311 result = -EPROTO;
312
313 return result;
314 }
315
316 return 0;
317}

--- 38 unchanged lines hidden (view full) ---

356 request, REQTYPE_HOST_TO_INTERFACE, data[0],
357 port_priv->bInterfaceNumber, NULL, 0,
358 USB_CTRL_SET_TIMEOUT);
359 }
360
361 kfree(buf);
362
363 if ((size > 2 && result != size) || result < 0) {
309 if (result > 0)
310 result = -EPROTO;
311
312 return result;
313 }
314
315 return 0;
316}

--- 38 unchanged lines hidden (view full) ---

355 request, REQTYPE_HOST_TO_INTERFACE, data[0],
356 port_priv->bInterfaceNumber, NULL, 0,
357 USB_CTRL_SET_TIMEOUT);
358 }
359
360 kfree(buf);
361
362 if ((size > 2 && result != size) || result < 0) {
364 dbg("%s - Unable to send request, "
365 "request=0x%x size=%d result=%d",
366 __func__, request, size, result);
363 dev_dbg(&port->dev, "%s - Unable to send request, request=0x%x size=%d result=%d\n",
364 __func__, request, size, result);
367 if (result > 0)
368 result = -EPROTO;
369
370 return result;
371 }
372
373 return 0;
374}

--- 107 unchanged lines hidden (view full) ---

482
483/*
484 * cp210x_get_termios_port
485 * This is the heart of cp210x_get_termios which always uses a &usb_serial_port.
486 */
487static void cp210x_get_termios_port(struct usb_serial_port *port,
488 unsigned int *cflagp, unsigned int *baudp)
489{
365 if (result > 0)
366 result = -EPROTO;
367
368 return result;
369 }
370
371 return 0;
372}

--- 107 unchanged lines hidden (view full) ---

480
481/*
482 * cp210x_get_termios_port
483 * This is the heart of cp210x_get_termios which always uses a &usb_serial_port.
484 */
485static void cp210x_get_termios_port(struct usb_serial_port *port,
486 unsigned int *cflagp, unsigned int *baudp)
487{
488 struct device *dev = &port->dev;
490 unsigned int cflag, modem_ctl[4];
491 unsigned int baud;
492 unsigned int bits;
493
494 cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, 4);
495
489 unsigned int cflag, modem_ctl[4];
490 unsigned int baud;
491 unsigned int bits;
492
493 cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, 4);
494
496 dbg("%s - baud rate = %d", __func__, baud);
495 dev_dbg(dev, "%s - baud rate = %d\n", __func__, baud);
497 *baudp = baud;
498
499 cflag = *cflagp;
500
501 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
502 cflag &= ~CSIZE;
503 switch (bits & BITS_DATA_MASK) {
504 case BITS_DATA_5:
496 *baudp = baud;
497
498 cflag = *cflagp;
499
500 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
501 cflag &= ~CSIZE;
502 switch (bits & BITS_DATA_MASK) {
503 case BITS_DATA_5:
505 dbg("%s - data bits = 5", __func__);
504 dev_dbg(dev, "%s - data bits = 5\n", __func__);
506 cflag |= CS5;
507 break;
508 case BITS_DATA_6:
505 cflag |= CS5;
506 break;
507 case BITS_DATA_6:
509 dbg("%s - data bits = 6", __func__);
508 dev_dbg(dev, "%s - data bits = 6\n", __func__);
510 cflag |= CS6;
511 break;
512 case BITS_DATA_7:
509 cflag |= CS6;
510 break;
511 case BITS_DATA_7:
513 dbg("%s - data bits = 7", __func__);
512 dev_dbg(dev, "%s - data bits = 7\n", __func__);
514 cflag |= CS7;
515 break;
516 case BITS_DATA_8:
513 cflag |= CS7;
514 break;
515 case BITS_DATA_8:
517 dbg("%s - data bits = 8", __func__);
516 dev_dbg(dev, "%s - data bits = 8\n", __func__);
518 cflag |= CS8;
519 break;
520 case BITS_DATA_9:
517 cflag |= CS8;
518 break;
519 case BITS_DATA_9:
521 dbg("%s - data bits = 9 (not supported, using 8 data bits)",
522 __func__);
520 dev_dbg(dev, "%s - data bits = 9 (not supported, using 8 data bits)\n", __func__);
523 cflag |= CS8;
524 bits &= ~BITS_DATA_MASK;
525 bits |= BITS_DATA_8;
526 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
527 break;
528 default:
521 cflag |= CS8;
522 bits &= ~BITS_DATA_MASK;
523 bits |= BITS_DATA_8;
524 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
525 break;
526 default:
529 dbg("%s - Unknown number of data bits, using 8", __func__);
527 dev_dbg(dev, "%s - Unknown number of data bits, using 8\n", __func__);
530 cflag |= CS8;
531 bits &= ~BITS_DATA_MASK;
532 bits |= BITS_DATA_8;
533 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
534 break;
535 }
536
537 switch (bits & BITS_PARITY_MASK) {
538 case BITS_PARITY_NONE:
528 cflag |= CS8;
529 bits &= ~BITS_DATA_MASK;
530 bits |= BITS_DATA_8;
531 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
532 break;
533 }
534
535 switch (bits & BITS_PARITY_MASK) {
536 case BITS_PARITY_NONE:
539 dbg("%s - parity = NONE", __func__);
537 dev_dbg(dev, "%s - parity = NONE\n", __func__);
540 cflag &= ~PARENB;
541 break;
542 case BITS_PARITY_ODD:
538 cflag &= ~PARENB;
539 break;
540 case BITS_PARITY_ODD:
543 dbg("%s - parity = ODD", __func__);
541 dev_dbg(dev, "%s - parity = ODD\n", __func__);
544 cflag |= (PARENB|PARODD);
545 break;
546 case BITS_PARITY_EVEN:
542 cflag |= (PARENB|PARODD);
543 break;
544 case BITS_PARITY_EVEN:
547 dbg("%s - parity = EVEN", __func__);
545 dev_dbg(dev, "%s - parity = EVEN\n", __func__);
548 cflag &= ~PARODD;
549 cflag |= PARENB;
550 break;
551 case BITS_PARITY_MARK:
546 cflag &= ~PARODD;
547 cflag |= PARENB;
548 break;
549 case BITS_PARITY_MARK:
552 dbg("%s - parity = MARK", __func__);
550 dev_dbg(dev, "%s - parity = MARK\n", __func__);
553 cflag |= (PARENB|PARODD|CMSPAR);
554 break;
555 case BITS_PARITY_SPACE:
551 cflag |= (PARENB|PARODD|CMSPAR);
552 break;
553 case BITS_PARITY_SPACE:
556 dbg("%s - parity = SPACE", __func__);
554 dev_dbg(dev, "%s - parity = SPACE\n", __func__);
557 cflag &= ~PARODD;
558 cflag |= (PARENB|CMSPAR);
559 break;
560 default:
555 cflag &= ~PARODD;
556 cflag |= (PARENB|CMSPAR);
557 break;
558 default:
561 dbg("%s - Unknown parity mode, disabling parity", __func__);
559 dev_dbg(dev, "%s - Unknown parity mode, disabling parity\n", __func__);
562 cflag &= ~PARENB;
563 bits &= ~BITS_PARITY_MASK;
564 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
565 break;
566 }
567
568 cflag &= ~CSTOPB;
569 switch (bits & BITS_STOP_MASK) {
570 case BITS_STOP_1:
560 cflag &= ~PARENB;
561 bits &= ~BITS_PARITY_MASK;
562 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
563 break;
564 }
565
566 cflag &= ~CSTOPB;
567 switch (bits & BITS_STOP_MASK) {
568 case BITS_STOP_1:
571 dbg("%s - stop bits = 1", __func__);
569 dev_dbg(dev, "%s - stop bits = 1\n", __func__);
572 break;
573 case BITS_STOP_1_5:
570 break;
571 case BITS_STOP_1_5:
574 dbg("%s - stop bits = 1.5 (not supported, using 1 stop bit)",
575 __func__);
572 dev_dbg(dev, "%s - stop bits = 1.5 (not supported, using 1 stop bit)\n", __func__);
576 bits &= ~BITS_STOP_MASK;
577 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
578 break;
579 case BITS_STOP_2:
573 bits &= ~BITS_STOP_MASK;
574 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
575 break;
576 case BITS_STOP_2:
580 dbg("%s - stop bits = 2", __func__);
577 dev_dbg(dev, "%s - stop bits = 2\n", __func__);
581 cflag |= CSTOPB;
582 break;
583 default:
578 cflag |= CSTOPB;
579 break;
580 default:
584 dbg("%s - Unknown number of stop bits, using 1 stop bit",
585 __func__);
581 dev_dbg(dev, "%s - Unknown number of stop bits, using 1 stop bit\n", __func__);
586 bits &= ~BITS_STOP_MASK;
587 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
588 break;
589 }
590
591 cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
592 if (modem_ctl[0] & 0x0008) {
582 bits &= ~BITS_STOP_MASK;
583 cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2);
584 break;
585 }
586
587 cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
588 if (modem_ctl[0] & 0x0008) {
593 dbg("%s - flow control = CRTSCTS", __func__);
589 dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__);
594 cflag |= CRTSCTS;
595 } else {
590 cflag |= CRTSCTS;
591 } else {
596 dbg("%s - flow control = NONE", __func__);
592 dev_dbg(dev, "%s - flow control = NONE\n", __func__);
597 cflag &= ~CRTSCTS;
598 }
599
600 *cflagp = cflag;
601}
602
603/*
604 * CP2101 supports the following baud rates:

--- 30 unchanged lines hidden (view full) ---

635
636 /* This maps the requested rate to a rate valid on cp2102 or cp2103,
637 * or to an arbitrary rate in [1M,2M].
638 *
639 * NOTE: B0 is not implemented.
640 */
641 baud = cp210x_quantise_baudrate(baud);
642
593 cflag &= ~CRTSCTS;
594 }
595
596 *cflagp = cflag;
597}
598
599/*
600 * CP2101 supports the following baud rates:

--- 30 unchanged lines hidden (view full) ---

631
632 /* This maps the requested rate to a rate valid on cp2102 or cp2103,
633 * or to an arbitrary rate in [1M,2M].
634 *
635 * NOTE: B0 is not implemented.
636 */
637 baud = cp210x_quantise_baudrate(baud);
638
643 dbg("%s - setting baud rate to %u", __func__, baud);
639 dev_dbg(&port->dev, "%s - setting baud rate to %u\n", __func__, baud);
644 if (cp210x_set_config(port, CP210X_SET_BAUDRATE, &baud,
645 sizeof(baud))) {
646 dev_warn(&port->dev, "failed to set baud rate to %u\n", baud);
647 if (old_termios)
648 baud = old_termios->c_ospeed;
649 else
650 baud = 9600;
651 }
652
653 tty_encode_baud_rate(tty, baud, baud);
654}
655
656static void cp210x_set_termios(struct tty_struct *tty,
657 struct usb_serial_port *port, struct ktermios *old_termios)
658{
640 if (cp210x_set_config(port, CP210X_SET_BAUDRATE, &baud,
641 sizeof(baud))) {
642 dev_warn(&port->dev, "failed to set baud rate to %u\n", baud);
643 if (old_termios)
644 baud = old_termios->c_ospeed;
645 else
646 baud = 9600;
647 }
648
649 tty_encode_baud_rate(tty, baud, baud);
650}
651
652static void cp210x_set_termios(struct tty_struct *tty,
653 struct usb_serial_port *port, struct ktermios *old_termios)
654{
655 struct device *dev = &port->dev;
659 unsigned int cflag, old_cflag;
660 unsigned int bits;
661 unsigned int modem_ctl[4];
662
656 unsigned int cflag, old_cflag;
657 unsigned int bits;
658 unsigned int modem_ctl[4];
659
663 dbg("%s - port %d", __func__, port->number);
660 dev_dbg(dev, "%s - port %d\n", __func__, port->number);
664
665 if (!tty)
666 return;
667
668 cflag = tty->termios->c_cflag;
669 old_cflag = old_termios->c_cflag;
670
671 if (tty->termios->c_ospeed != old_termios->c_ospeed)
672 cp210x_change_speed(tty, port, old_termios);
673
674 /* If the number of data bits is to be updated */
675 if ((cflag & CSIZE) != (old_cflag & CSIZE)) {
676 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
677 bits &= ~BITS_DATA_MASK;
678 switch (cflag & CSIZE) {
679 case CS5:
680 bits |= BITS_DATA_5;
661
662 if (!tty)
663 return;
664
665 cflag = tty->termios->c_cflag;
666 old_cflag = old_termios->c_cflag;
667
668 if (tty->termios->c_ospeed != old_termios->c_ospeed)
669 cp210x_change_speed(tty, port, old_termios);
670
671 /* If the number of data bits is to be updated */
672 if ((cflag & CSIZE) != (old_cflag & CSIZE)) {
673 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
674 bits &= ~BITS_DATA_MASK;
675 switch (cflag & CSIZE) {
676 case CS5:
677 bits |= BITS_DATA_5;
681 dbg("%s - data bits = 5", __func__);
678 dev_dbg(dev, "%s - data bits = 5\n", __func__);
682 break;
683 case CS6:
684 bits |= BITS_DATA_6;
679 break;
680 case CS6:
681 bits |= BITS_DATA_6;
685 dbg("%s - data bits = 6", __func__);
682 dev_dbg(dev, "%s - data bits = 6\n", __func__);
686 break;
687 case CS7:
688 bits |= BITS_DATA_7;
683 break;
684 case CS7:
685 bits |= BITS_DATA_7;
689 dbg("%s - data bits = 7", __func__);
686 dev_dbg(dev, "%s - data bits = 7\n", __func__);
690 break;
691 case CS8:
692 bits |= BITS_DATA_8;
687 break;
688 case CS8:
689 bits |= BITS_DATA_8;
693 dbg("%s - data bits = 8", __func__);
690 dev_dbg(dev, "%s - data bits = 8\n", __func__);
694 break;
695 /*case CS9:
696 bits |= BITS_DATA_9;
691 break;
692 /*case CS9:
693 bits |= BITS_DATA_9;
697 dbg("%s - data bits = 9", __func__);
694 dev_dbg(dev, "%s - data bits = 9\n", __func__);
698 break;*/
699 default:
695 break;*/
696 default:
700 dbg("cp210x driver does not "
701 "support the number of bits requested,"
702 " using 8 bit mode");
697 dev_dbg(dev, "cp210x driver does not support the number of bits requested, using 8 bit mode\n");
703 bits |= BITS_DATA_8;
704 break;
705 }
706 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
698 bits |= BITS_DATA_8;
699 break;
700 }
701 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
707 dbg("Number of data bits requested "
708 "not supported by device");
702 dev_dbg(dev, "Number of data bits requested not supported by device\n");
709 }
710
711 if ((cflag & (PARENB|PARODD|CMSPAR)) !=
712 (old_cflag & (PARENB|PARODD|CMSPAR))) {
713 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
714 bits &= ~BITS_PARITY_MASK;
715 if (cflag & PARENB) {
716 if (cflag & CMSPAR) {
703 }
704
705 if ((cflag & (PARENB|PARODD|CMSPAR)) !=
706 (old_cflag & (PARENB|PARODD|CMSPAR))) {
707 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
708 bits &= ~BITS_PARITY_MASK;
709 if (cflag & PARENB) {
710 if (cflag & CMSPAR) {
717 if (cflag & PARODD) {
718 bits |= BITS_PARITY_MARK;
719 dbg("%s - parity = MARK", __func__);
720 } else {
721 bits |= BITS_PARITY_SPACE;
722 dbg("%s - parity = SPACE", __func__);
723 }
711 if (cflag & PARODD) {
712 bits |= BITS_PARITY_MARK;
713 dev_dbg(dev, "%s - parity = MARK\n", __func__);
714 } else {
715 bits |= BITS_PARITY_SPACE;
716 dev_dbg(dev, "%s - parity = SPACE\n", __func__);
717 }
724 } else {
718 } else {
725 if (cflag & PARODD) {
726 bits |= BITS_PARITY_ODD;
727 dbg("%s - parity = ODD", __func__);
728 } else {
729 bits |= BITS_PARITY_EVEN;
730 dbg("%s - parity = EVEN", __func__);
731 }
719 if (cflag & PARODD) {
720 bits |= BITS_PARITY_ODD;
721 dev_dbg(dev, "%s - parity = ODD\n", __func__);
722 } else {
723 bits |= BITS_PARITY_EVEN;
724 dev_dbg(dev, "%s - parity = EVEN\n", __func__);
725 }
732 }
733 }
734 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
726 }
727 }
728 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
735 dbg("Parity mode not supported by device");
729 dev_dbg(dev, "Parity mode not supported by device\n");
736 }
737
738 if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) {
739 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
740 bits &= ~BITS_STOP_MASK;
741 if (cflag & CSTOPB) {
742 bits |= BITS_STOP_2;
730 }
731
732 if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) {
733 cp210x_get_config(port, CP210X_GET_LINE_CTL, &bits, 2);
734 bits &= ~BITS_STOP_MASK;
735 if (cflag & CSTOPB) {
736 bits |= BITS_STOP_2;
743 dbg("%s - stop bits = 2", __func__);
737 dev_dbg(dev, "%s - stop bits = 2\n", __func__);
744 } else {
745 bits |= BITS_STOP_1;
738 } else {
739 bits |= BITS_STOP_1;
746 dbg("%s - stop bits = 1", __func__);
740 dev_dbg(dev, "%s - stop bits = 1\n", __func__);
747 }
748 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
741 }
742 if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))
749 dbg("Number of stop bits requested "
750 "not supported by device");
743 dev_dbg(dev, "Number of stop bits requested not supported by device\n");
751 }
752
753 if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
754 cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
744 }
745
746 if ((cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
747 cp210x_get_config(port, CP210X_GET_FLOW, modem_ctl, 16);
755 dbg("%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x",
756 __func__, modem_ctl[0], modem_ctl[1],
757 modem_ctl[2], modem_ctl[3]);
748 dev_dbg(dev, "%s - read modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x\n",
749 __func__, modem_ctl[0], modem_ctl[1],
750 modem_ctl[2], modem_ctl[3]);
758
759 if (cflag & CRTSCTS) {
760 modem_ctl[0] &= ~0x7B;
761 modem_ctl[0] |= 0x09;
762 modem_ctl[1] = 0x80;
751
752 if (cflag & CRTSCTS) {
753 modem_ctl[0] &= ~0x7B;
754 modem_ctl[0] |= 0x09;
755 modem_ctl[1] = 0x80;
763 dbg("%s - flow control = CRTSCTS", __func__);
756 dev_dbg(dev, "%s - flow control = CRTSCTS\n", __func__);
764 } else {
765 modem_ctl[0] &= ~0x7B;
766 modem_ctl[0] |= 0x01;
767 modem_ctl[1] |= 0x40;
757 } else {
758 modem_ctl[0] &= ~0x7B;
759 modem_ctl[0] |= 0x01;
760 modem_ctl[1] |= 0x40;
768 dbg("%s - flow control = NONE", __func__);
761 dev_dbg(dev, "%s - flow control = NONE\n", __func__);
769 }
770
762 }
763
771 dbg("%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x",
772 __func__, modem_ctl[0], modem_ctl[1],
773 modem_ctl[2], modem_ctl[3]);
764 dev_dbg(dev, "%s - write modem controls = 0x%.4x 0x%.4x 0x%.4x 0x%.4x\n",
765 __func__, modem_ctl[0], modem_ctl[1],
766 modem_ctl[2], modem_ctl[3]);
774 cp210x_set_config(port, CP210X_SET_FLOW, modem_ctl, 16);
775 }
776
777}
778
779static int cp210x_tiocmset (struct tty_struct *tty,
780 unsigned int set, unsigned int clear)
781{

--- 18 unchanged lines hidden (view full) ---

800 control &= ~CONTROL_RTS;
801 control |= CONTROL_WRITE_RTS;
802 }
803 if (clear & TIOCM_DTR) {
804 control &= ~CONTROL_DTR;
805 control |= CONTROL_WRITE_DTR;
806 }
807
767 cp210x_set_config(port, CP210X_SET_FLOW, modem_ctl, 16);
768 }
769
770}
771
772static int cp210x_tiocmset (struct tty_struct *tty,
773 unsigned int set, unsigned int clear)
774{

--- 18 unchanged lines hidden (view full) ---

793 control &= ~CONTROL_RTS;
794 control |= CONTROL_WRITE_RTS;
795 }
796 if (clear & TIOCM_DTR) {
797 control &= ~CONTROL_DTR;
798 control |= CONTROL_WRITE_DTR;
799 }
800
808 dbg("%s - control = 0x%.4x", __func__, control);
801 dev_dbg(&port->dev, "%s - control = 0x%.4x\n", __func__, control);
809
810 return cp210x_set_config(port, CP210X_SET_MHS, &control, 2);
811}
812
813static void cp210x_dtr_rts(struct usb_serial_port *p, int on)
814{
815 if (on)
816 cp210x_tiocmset_port(p, TIOCM_DTR|TIOCM_RTS, 0);

--- 11 unchanged lines hidden (view full) ---

828
829 result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0)
830 |((control & CONTROL_RTS) ? TIOCM_RTS : 0)
831 |((control & CONTROL_CTS) ? TIOCM_CTS : 0)
832 |((control & CONTROL_DSR) ? TIOCM_DSR : 0)
833 |((control & CONTROL_RING)? TIOCM_RI : 0)
834 |((control & CONTROL_DCD) ? TIOCM_CD : 0);
835
802
803 return cp210x_set_config(port, CP210X_SET_MHS, &control, 2);
804}
805
806static void cp210x_dtr_rts(struct usb_serial_port *p, int on)
807{
808 if (on)
809 cp210x_tiocmset_port(p, TIOCM_DTR|TIOCM_RTS, 0);

--- 11 unchanged lines hidden (view full) ---

821
822 result = ((control & CONTROL_DTR) ? TIOCM_DTR : 0)
823 |((control & CONTROL_RTS) ? TIOCM_RTS : 0)
824 |((control & CONTROL_CTS) ? TIOCM_CTS : 0)
825 |((control & CONTROL_DSR) ? TIOCM_DSR : 0)
826 |((control & CONTROL_RING)? TIOCM_RI : 0)
827 |((control & CONTROL_DCD) ? TIOCM_CD : 0);
828
836 dbg("%s - control = 0x%.2x", __func__, control);
829 dev_dbg(&port->dev, "%s - control = 0x%.2x\n", __func__, control);
837
838 return result;
839}
840
841static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
842{
843 struct usb_serial_port *port = tty->driver_data;
844 unsigned int state;
845
846 if (break_state == 0)
847 state = BREAK_OFF;
848 else
849 state = BREAK_ON;
830
831 return result;
832}
833
834static void cp210x_break_ctl (struct tty_struct *tty, int break_state)
835{
836 struct usb_serial_port *port = tty->driver_data;
837 unsigned int state;
838
839 if (break_state == 0)
840 state = BREAK_OFF;
841 else
842 state = BREAK_ON;
850 dbg("%s - turning break %s", __func__,
851 state == BREAK_OFF ? "off" : "on");
843 dev_dbg(&port->dev, "%s - turning break %s\n", __func__,
844 state == BREAK_OFF ? "off" : "on");
852 cp210x_set_config(port, CP210X_SET_BREAK, &state, 2);
853}
854
855static int cp210x_startup(struct usb_serial *serial)
856{
857 struct cp210x_port_private *port_priv;
858 int i;
859

--- 37 unchanged lines hidden ---
845 cp210x_set_config(port, CP210X_SET_BREAK, &state, 2);
846}
847
848static int cp210x_startup(struct usb_serial *serial)
849{
850 struct cp210x_port_private *port_priv;
851 int i;
852

--- 37 unchanged lines hidden ---