diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/cypress_m8.c | 251 |
1 files changed, 152 insertions, 99 deletions
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 012e63e05806..05c44ae3ed32 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -453,8 +453,8 @@ static int generic_startup (struct usb_serial *serial) | |||
453 | priv->cbr_mask = B300; | 453 | priv->cbr_mask = B300; |
454 | usb_set_serial_port_data(serial->port[0], priv); | 454 | usb_set_serial_port_data(serial->port[0], priv); |
455 | 455 | ||
456 | return (0); | 456 | return 0; |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | static int cypress_earthmate_startup (struct usb_serial *serial) | 460 | static int cypress_earthmate_startup (struct usb_serial *serial) |
@@ -464,14 +464,15 @@ static int cypress_earthmate_startup (struct usb_serial *serial) | |||
464 | dbg("%s", __FUNCTION__); | 464 | dbg("%s", __FUNCTION__); |
465 | 465 | ||
466 | if (generic_startup(serial)) { | 466 | if (generic_startup(serial)) { |
467 | dbg("%s - Failed setting up port %d", __FUNCTION__, serial->port[0]->number); | 467 | dbg("%s - Failed setting up port %d", __FUNCTION__, |
468 | serial->port[0]->number); | ||
468 | return 1; | 469 | return 1; |
469 | } | 470 | } |
470 | 471 | ||
471 | priv = usb_get_serial_port_data(serial->port[0]); | 472 | priv = usb_get_serial_port_data(serial->port[0]); |
472 | priv->chiptype = CT_EARTHMATE; | 473 | priv->chiptype = CT_EARTHMATE; |
473 | 474 | ||
474 | return (0); | 475 | return 0; |
475 | } /* cypress_earthmate_startup */ | 476 | } /* cypress_earthmate_startup */ |
476 | 477 | ||
477 | 478 | ||
@@ -482,14 +483,15 @@ static int cypress_hidcom_startup (struct usb_serial *serial) | |||
482 | dbg("%s", __FUNCTION__); | 483 | dbg("%s", __FUNCTION__); |
483 | 484 | ||
484 | if (generic_startup(serial)) { | 485 | if (generic_startup(serial)) { |
485 | dbg("%s - Failed setting up port %d", __FUNCTION__, serial->port[0]->number); | 486 | dbg("%s - Failed setting up port %d", __FUNCTION__, |
487 | serial->port[0]->number); | ||
486 | return 1; | 488 | return 1; |
487 | } | 489 | } |
488 | 490 | ||
489 | priv = usb_get_serial_port_data(serial->port[0]); | 491 | priv = usb_get_serial_port_data(serial->port[0]); |
490 | priv->chiptype = CT_CYPHIDCOM; | 492 | priv->chiptype = CT_CYPHIDCOM; |
491 | 493 | ||
492 | return (0); | 494 | return 0; |
493 | } /* cypress_hidcom_startup */ | 495 | } /* cypress_hidcom_startup */ |
494 | 496 | ||
495 | 497 | ||
@@ -909,7 +911,8 @@ static int cypress_ioctl (struct usb_serial_port *port, struct file * file, unsi | |||
909 | } /* cypress_ioctl */ | 911 | } /* cypress_ioctl */ |
910 | 912 | ||
911 | 913 | ||
912 | static void cypress_set_termios (struct usb_serial_port *port, struct termios *old_termios) | 914 | static void cypress_set_termios (struct usb_serial_port *port, |
915 | struct termios *old_termios) | ||
913 | { | 916 | { |
914 | struct cypress_private *priv = usb_get_serial_port_data(port); | 917 | struct cypress_private *priv = usb_get_serial_port_data(port); |
915 | struct tty_struct *tty; | 918 | struct tty_struct *tty; |
@@ -918,7 +921,7 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
918 | unsigned long flags; | 921 | unsigned long flags; |
919 | __u8 oldlines; | 922 | __u8 oldlines; |
920 | int linechange = 0; | 923 | int linechange = 0; |
921 | 924 | ||
922 | dbg("%s - port %d", __FUNCTION__, port->number); | 925 | dbg("%s - port %d", __FUNCTION__, port->number); |
923 | 926 | ||
924 | tty = port->tty; | 927 | tty = port->tty; |
@@ -931,10 +934,12 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
931 | if (!priv->termios_initialized) { | 934 | if (!priv->termios_initialized) { |
932 | if (priv->chiptype == CT_EARTHMATE) { | 935 | if (priv->chiptype == CT_EARTHMATE) { |
933 | *(tty->termios) = tty_std_termios; | 936 | *(tty->termios) = tty_std_termios; |
934 | tty->termios->c_cflag = B4800 | CS8 | CREAD | HUPCL | CLOCAL; | 937 | tty->termios->c_cflag = B4800 | CS8 | CREAD | HUPCL | |
938 | CLOCAL; | ||
935 | } else if (priv->chiptype == CT_CYPHIDCOM) { | 939 | } else if (priv->chiptype == CT_CYPHIDCOM) { |
936 | *(tty->termios) = tty_std_termios; | 940 | *(tty->termios) = tty_std_termios; |
937 | tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | 941 | tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | |
942 | CLOCAL; | ||
938 | } | 943 | } |
939 | priv->termios_initialized = 1; | 944 | priv->termios_initialized = 1; |
940 | } | 945 | } |
@@ -946,12 +951,15 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
946 | /* check if there are new settings */ | 951 | /* check if there are new settings */ |
947 | if (old_termios) { | 952 | if (old_termios) { |
948 | if ((cflag != old_termios->c_cflag) || | 953 | if ((cflag != old_termios->c_cflag) || |
949 | (RELEVANT_IFLAG(iflag) != RELEVANT_IFLAG(old_termios->c_iflag))) { | 954 | (RELEVANT_IFLAG(iflag) != |
950 | dbg("%s - attempting to set new termios settings", __FUNCTION__); | 955 | RELEVANT_IFLAG(old_termios->c_iflag))) { |
951 | /* should make a copy of this in case something goes wrong in the function, we can restore it */ | 956 | dbg("%s - attempting to set new termios settings", |
957 | __FUNCTION__); | ||
958 | /* should make a copy of this in case something goes | ||
959 | * wrong in the function, we can restore it */ | ||
952 | spin_lock_irqsave(&priv->lock, flags); | 960 | spin_lock_irqsave(&priv->lock, flags); |
953 | priv->tmp_termios = *(tty->termios); | 961 | priv->tmp_termios = *(tty->termios); |
954 | spin_unlock_irqrestore(&priv->lock, flags); | 962 | spin_unlock_irqrestore(&priv->lock, flags); |
955 | } else { | 963 | } else { |
956 | dbg("%s - nothing to do, exiting", __FUNCTION__); | 964 | dbg("%s - nothing to do, exiting", __FUNCTION__); |
957 | return; | 965 | return; |
@@ -962,21 +970,34 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
962 | /* set number of data bits, parity, stop bits */ | 970 | /* set number of data bits, parity, stop bits */ |
963 | /* when parity is disabled the parity type bit is ignored */ | 971 | /* when parity is disabled the parity type bit is ignored */ |
964 | 972 | ||
965 | stop_bits = cflag & CSTOPB ? 1 : 0; /* 1 means 2 stop bits, 0 means 1 stop bit */ | 973 | /* 1 means 2 stop bits, 0 means 1 stop bit */ |
966 | 974 | stop_bits = cflag & CSTOPB ? 1 : 0; | |
975 | |||
967 | if (cflag & PARENB) { | 976 | if (cflag & PARENB) { |
968 | parity_enable = 1; | 977 | parity_enable = 1; |
969 | parity_type = cflag & PARODD ? 1 : 0; /* 1 means odd parity, 0 means even parity */ | 978 | /* 1 means odd parity, 0 means even parity */ |
979 | parity_type = cflag & PARODD ? 1 : 0; | ||
970 | } else | 980 | } else |
971 | parity_enable = parity_type = 0; | 981 | parity_enable = parity_type = 0; |
972 | 982 | ||
973 | if (cflag & CSIZE) { | 983 | if (cflag & CSIZE) { |
974 | switch (cflag & CSIZE) { | 984 | switch (cflag & CSIZE) { |
975 | case CS5: data_bits = 0; break; | 985 | case CS5: |
976 | case CS6: data_bits = 1; break; | 986 | data_bits = 0; |
977 | case CS7: data_bits = 2; break; | 987 | break; |
978 | case CS8: data_bits = 3; break; | 988 | case CS6: |
979 | default: err("%s - CSIZE was set, but not CS5-CS8", __FUNCTION__); data_bits = 3; | 989 | data_bits = 1; |
990 | break; | ||
991 | case CS7: | ||
992 | data_bits = 2; | ||
993 | break; | ||
994 | case CS8: | ||
995 | data_bits = 3; | ||
996 | break; | ||
997 | default: | ||
998 | err("%s - CSIZE was set, but not CS5-CS8", | ||
999 | __FUNCTION__); | ||
1000 | data_bits = 3; | ||
980 | } | 1001 | } |
981 | } else | 1002 | } else |
982 | data_bits = 3; | 1003 | data_bits = 3; |
@@ -991,63 +1012,85 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
991 | } else { | 1012 | } else { |
992 | baud_mask = (cflag & CBAUD); | 1013 | baud_mask = (cflag & CBAUD); |
993 | switch(baud_mask) { | 1014 | switch(baud_mask) { |
994 | case B300: dbg("%s - setting baud 300bps", __FUNCTION__); break; | 1015 | case B300: |
995 | case B600: dbg("%s - setting baud 600bps", __FUNCTION__); break; | 1016 | dbg("%s - setting baud 300bps", __FUNCTION__); |
996 | case B1200: dbg("%s - setting baud 1200bps", __FUNCTION__); break; | 1017 | break; |
997 | case B2400: dbg("%s - setting baud 2400bps", __FUNCTION__); break; | 1018 | case B600: |
998 | case B4800: dbg("%s - setting baud 4800bps", __FUNCTION__); break; | 1019 | dbg("%s - setting baud 600bps", __FUNCTION__); |
999 | case B9600: dbg("%s - setting baud 9600bps", __FUNCTION__); break; | 1020 | break; |
1000 | case B19200: dbg("%s - setting baud 19200bps", __FUNCTION__); break; | 1021 | case B1200: |
1001 | case B38400: dbg("%s - setting baud 38400bps", __FUNCTION__); break; | 1022 | dbg("%s - setting baud 1200bps", __FUNCTION__); |
1002 | case B57600: dbg("%s - setting baud 57600bps", __FUNCTION__); break; | 1023 | break; |
1003 | case B115200: dbg("%s - setting baud 115200bps", __FUNCTION__); break; | 1024 | case B2400: |
1004 | default: dbg("%s - unknown masked baud rate", __FUNCTION__); | 1025 | dbg("%s - setting baud 2400bps", __FUNCTION__); |
1026 | break; | ||
1027 | case B4800: | ||
1028 | dbg("%s - setting baud 4800bps", __FUNCTION__); | ||
1029 | break; | ||
1030 | case B9600: | ||
1031 | dbg("%s - setting baud 9600bps", __FUNCTION__); | ||
1032 | break; | ||
1033 | case B19200: | ||
1034 | dbg("%s - setting baud 19200bps", __FUNCTION__); | ||
1035 | break; | ||
1036 | case B38400: | ||
1037 | dbg("%s - setting baud 38400bps", __FUNCTION__); | ||
1038 | break; | ||
1039 | case B57600: | ||
1040 | dbg("%s - setting baud 57600bps", __FUNCTION__); | ||
1041 | break; | ||
1042 | case B115200: | ||
1043 | dbg("%s - setting baud 115200bps", __FUNCTION__); | ||
1044 | break; | ||
1045 | default: | ||
1046 | dbg("%s - unknown masked baud rate", __FUNCTION__); | ||
1005 | } | 1047 | } |
1006 | priv->line_control = (CONTROL_DTR | CONTROL_RTS); | 1048 | priv->line_control = (CONTROL_DTR | CONTROL_RTS); |
1007 | } | 1049 | } |
1008 | spin_unlock_irqrestore(&priv->lock, flags); | 1050 | spin_unlock_irqrestore(&priv->lock, flags); |
1009 | |||
1010 | dbg("%s - sending %d stop_bits, %d parity_enable, %d parity_type, %d data_bits (+5)", __FUNCTION__, | ||
1011 | stop_bits, parity_enable, parity_type, data_bits); | ||
1012 | 1051 | ||
1013 | cypress_serial_control(port, baud_mask, data_bits, stop_bits, parity_enable, | 1052 | dbg("%s - sending %d stop_bits, %d parity_enable, %d parity_type, " |
1014 | parity_type, 0, CYPRESS_SET_CONFIG); | 1053 | "%d data_bits (+5)", __FUNCTION__, stop_bits, |
1054 | parity_enable, parity_type, data_bits); | ||
1055 | |||
1056 | cypress_serial_control(port, baud_mask, data_bits, stop_bits, | ||
1057 | parity_enable, parity_type, 0, CYPRESS_SET_CONFIG); | ||
1015 | 1058 | ||
1016 | /* we perform a CYPRESS_GET_CONFIG so that the current settings are filled into the private structure | 1059 | /* we perform a CYPRESS_GET_CONFIG so that the current settings are |
1017 | * this should confirm that all is working if it returns what we just set */ | 1060 | * filled into the private structure this should confirm that all is |
1061 | * working if it returns what we just set */ | ||
1018 | cypress_serial_control(port, 0, 0, 0, 0, 0, 0, CYPRESS_GET_CONFIG); | 1062 | cypress_serial_control(port, 0, 0, 0, 0, 0, 0, CYPRESS_GET_CONFIG); |
1019 | 1063 | ||
1020 | /* Here we can define custom tty settings for devices | 1064 | /* Here we can define custom tty settings for devices; the main tty |
1021 | * | 1065 | * termios flag base comes from empeg.c */ |
1022 | * the main tty termios flag base comes from empeg.c | ||
1023 | */ | ||
1024 | 1066 | ||
1025 | spin_lock_irqsave(&priv->lock, flags); | 1067 | spin_lock_irqsave(&priv->lock, flags); |
1026 | if ( (priv->chiptype == CT_EARTHMATE) && (priv->baud_rate == 4800) ) { | 1068 | if ( (priv->chiptype == CT_EARTHMATE) && (priv->baud_rate == 4800) ) { |
1027 | 1069 | dbg("Using custom termios settings for a baud rate of " | |
1028 | dbg("Using custom termios settings for a baud rate of 4800bps."); | 1070 | "4800bps."); |
1029 | /* define custom termios settings for NMEA protocol */ | 1071 | /* define custom termios settings for NMEA protocol */ |
1030 | 1072 | ||
1031 | tty->termios->c_iflag /* input modes - */ | 1073 | tty->termios->c_iflag /* input modes - */ |
1032 | &= ~(IGNBRK /* disable ignore break */ | 1074 | &= ~(IGNBRK /* disable ignore break */ |
1033 | | BRKINT /* disable break causes interrupt */ | 1075 | | BRKINT /* disable break causes interrupt */ |
1034 | | PARMRK /* disable mark parity errors */ | 1076 | | PARMRK /* disable mark parity errors */ |
1035 | | ISTRIP /* disable clear high bit of input characters */ | 1077 | | ISTRIP /* disable clear high bit of input char */ |
1036 | | INLCR /* disable translate NL to CR */ | 1078 | | INLCR /* disable translate NL to CR */ |
1037 | | IGNCR /* disable ignore CR */ | 1079 | | IGNCR /* disable ignore CR */ |
1038 | | ICRNL /* disable translate CR to NL */ | 1080 | | ICRNL /* disable translate CR to NL */ |
1039 | | IXON); /* disable enable XON/XOFF flow control */ | 1081 | | IXON); /* disable enable XON/XOFF flow control */ |
1040 | 1082 | ||
1041 | tty->termios->c_oflag /* output modes */ | 1083 | tty->termios->c_oflag /* output modes */ |
1042 | &= ~OPOST; /* disable postprocess output characters */ | 1084 | &= ~OPOST; /* disable postprocess output char */ |
1043 | |||
1044 | tty->termios->c_lflag /* line discipline modes */ | ||
1045 | &= ~(ECHO /* disable echo input characters */ | ||
1046 | | ECHONL /* disable echo new line */ | ||
1047 | | ICANON /* disable erase, kill, werase, and rprnt special characters */ | ||
1048 | | ISIG /* disable interrupt, quit, and suspend special characters */ | ||
1049 | | IEXTEN); /* disable non-POSIX special characters */ | ||
1050 | 1085 | ||
1086 | tty->termios->c_lflag /* line discipline modes */ | ||
1087 | &= ~(ECHO /* disable echo input characters */ | ||
1088 | | ECHONL /* disable echo new line */ | ||
1089 | | ICANON /* disable erase, kill, werase, and rprnt | ||
1090 | special characters */ | ||
1091 | | ISIG /* disable interrupt, quit, and suspend | ||
1092 | special characters */ | ||
1093 | | IEXTEN); /* disable non-POSIX special characters */ | ||
1051 | } /* CT_CYPHIDCOM: Application should handle this for device */ | 1094 | } /* CT_CYPHIDCOM: Application should handle this for device */ |
1052 | 1095 | ||
1053 | linechange = (priv->line_control != oldlines); | 1096 | linechange = (priv->line_control != oldlines); |
@@ -1060,7 +1103,7 @@ static void cypress_set_termios (struct usb_serial_port *port, struct termios *o | |||
1060 | } | 1103 | } |
1061 | } /* cypress_set_termios */ | 1104 | } /* cypress_set_termios */ |
1062 | 1105 | ||
1063 | 1106 | ||
1064 | /* returns amount of data still left in soft buffer */ | 1107 | /* returns amount of data still left in soft buffer */ |
1065 | static int cypress_chars_in_buffer(struct usb_serial_port *port) | 1108 | static int cypress_chars_in_buffer(struct usb_serial_port *port) |
1066 | { | 1109 | { |
@@ -1088,7 +1131,7 @@ static void cypress_throttle (struct usb_serial_port *port) | |||
1088 | 1131 | ||
1089 | spin_lock_irqsave(&priv->lock, flags); | 1132 | spin_lock_irqsave(&priv->lock, flags); |
1090 | priv->rx_flags = THROTTLED; | 1133 | priv->rx_flags = THROTTLED; |
1091 | spin_unlock_irqrestore(&priv->lock, flags); | 1134 | spin_unlock_irqrestore(&priv->lock, flags); |
1092 | } | 1135 | } |
1093 | 1136 | ||
1094 | 1137 | ||
@@ -1110,7 +1153,8 @@ static void cypress_unthrottle (struct usb_serial_port *port) | |||
1110 | 1153 | ||
1111 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 1154 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
1112 | if (result) | 1155 | if (result) |
1113 | dev_err(&port->dev, "%s - failed submitting read urb, error %d\n", __FUNCTION__, result); | 1156 | dev_err(&port->dev, "%s - failed submitting read urb, " |
1157 | "error %d\n", __FUNCTION__, result); | ||
1114 | } | 1158 | } |
1115 | } | 1159 | } |
1116 | 1160 | ||
@@ -1122,7 +1166,7 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
1122 | struct tty_struct *tty; | 1166 | struct tty_struct *tty; |
1123 | unsigned char *data = urb->transfer_buffer; | 1167 | unsigned char *data = urb->transfer_buffer; |
1124 | unsigned long flags; | 1168 | unsigned long flags; |
1125 | char tty_flag = TTY_NORMAL; | 1169 | char tty_flag = TTY_NORMAL; |
1126 | int havedata = 0; | 1170 | int havedata = 0; |
1127 | int bytes = 0; | 1171 | int bytes = 0; |
1128 | int result; | 1172 | int result; |
@@ -1131,7 +1175,8 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
1131 | dbg("%s - port %d", __FUNCTION__, port->number); | 1175 | dbg("%s - port %d", __FUNCTION__, port->number); |
1132 | 1176 | ||
1133 | if (urb->status) { | 1177 | if (urb->status) { |
1134 | dbg("%s - nonzero read status received: %d", __FUNCTION__, urb->status); | 1178 | dbg("%s - nonzero read status received: %d", __FUNCTION__, |
1179 | urb->status); | ||
1135 | return; | 1180 | return; |
1136 | } | 1181 | } |
1137 | 1182 | ||
@@ -1155,51 +1200,55 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
1155 | case 32: | 1200 | case 32: |
1156 | /* This is for the CY7C64013... */ | 1201 | /* This is for the CY7C64013... */ |
1157 | priv->current_status = data[0] & 0xF8; | 1202 | priv->current_status = data[0] & 0xF8; |
1158 | bytes = data[1]+2; | 1203 | bytes = data[1] + 2; |
1159 | i=2; | 1204 | i = 2; |
1160 | if (bytes > 2) | 1205 | if (bytes > 2) |
1161 | havedata = 1; | 1206 | havedata = 1; |
1162 | break; | 1207 | break; |
1163 | case 8: | 1208 | case 8: |
1164 | /* This is for the CY7C63743... */ | 1209 | /* This is for the CY7C63743... */ |
1165 | priv->current_status = data[0] & 0xF8; | 1210 | priv->current_status = data[0] & 0xF8; |
1166 | bytes = (data[0] & 0x07)+1; | 1211 | bytes = (data[0] & 0x07) + 1; |
1167 | i=1; | 1212 | i = 1; |
1168 | if (bytes > 1) | 1213 | if (bytes > 1) |
1169 | havedata = 1; | 1214 | havedata = 1; |
1170 | break; | 1215 | break; |
1171 | default: | 1216 | default: |
1172 | dbg("%s - wrong packet size - received %d bytes", __FUNCTION__, urb->actual_length); | 1217 | dbg("%s - wrong packet size - received %d bytes", |
1218 | __FUNCTION__, urb->actual_length); | ||
1173 | spin_unlock_irqrestore(&priv->lock, flags); | 1219 | spin_unlock_irqrestore(&priv->lock, flags); |
1174 | goto continue_read; | 1220 | goto continue_read; |
1175 | } | 1221 | } |
1176 | spin_unlock_irqrestore(&priv->lock, flags); | 1222 | spin_unlock_irqrestore(&priv->lock, flags); |
1177 | 1223 | ||
1178 | usb_serial_debug_data (debug, &port->dev, __FUNCTION__, urb->actual_length, data); | 1224 | usb_serial_debug_data (debug, &port->dev, __FUNCTION__, |
1225 | urb->actual_length, data); | ||
1179 | 1226 | ||
1180 | spin_lock_irqsave(&priv->lock, flags); | 1227 | spin_lock_irqsave(&priv->lock, flags); |
1181 | /* check to see if status has changed */ | 1228 | /* check to see if status has changed */ |
1182 | if (priv != NULL) { | 1229 | if (priv != NULL) { |
1183 | if (priv->current_status != priv->prev_status) { | 1230 | if (priv->current_status != priv->prev_status) { |
1184 | priv->diff_status |= priv->current_status ^ priv->prev_status; | 1231 | priv->diff_status |= priv->current_status ^ |
1232 | priv->prev_status; | ||
1185 | wake_up_interruptible(&priv->delta_msr_wait); | 1233 | wake_up_interruptible(&priv->delta_msr_wait); |
1186 | priv->prev_status = priv->current_status; | 1234 | priv->prev_status = priv->current_status; |
1187 | } | 1235 | } |
1188 | } | 1236 | } |
1189 | spin_unlock_irqrestore(&priv->lock, flags); | 1237 | spin_unlock_irqrestore(&priv->lock, flags); |
1190 | 1238 | ||
1191 | /* hangup, as defined in acm.c... this might be a bad place for it though */ | 1239 | /* hangup, as defined in acm.c... this might be a bad place for it |
1192 | if (tty && !(tty->termios->c_cflag & CLOCAL) && !(priv->current_status & UART_CD)) { | 1240 | * though */ |
1241 | if (tty && !(tty->termios->c_cflag & CLOCAL) && | ||
1242 | !(priv->current_status & UART_CD)) { | ||
1193 | dbg("%s - calling hangup", __FUNCTION__); | 1243 | dbg("%s - calling hangup", __FUNCTION__); |
1194 | tty_hangup(tty); | 1244 | tty_hangup(tty); |
1195 | goto continue_read; | 1245 | goto continue_read; |
1196 | } | 1246 | } |
1197 | 1247 | ||
1198 | /* There is one error bit... I'm assuming it is a parity error indicator | 1248 | /* There is one error bit... I'm assuming it is a parity error |
1199 | * as the generic firmware will set this bit to 1 if a parity error occurs. | 1249 | * indicator as the generic firmware will set this bit to 1 if a |
1200 | * I can not find reference to any other error events. | 1250 | * parity error occurs. |
1201 | * | 1251 | * I can not find reference to any other error events. */ |
1202 | */ | ||
1203 | spin_lock_irqsave(&priv->lock, flags); | 1252 | spin_lock_irqsave(&priv->lock, flags); |
1204 | if (priv->current_status & CYP_ERROR) { | 1253 | if (priv->current_status & CYP_ERROR) { |
1205 | spin_unlock_irqrestore(&priv->lock, flags); | 1254 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -1211,7 +1260,8 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
1211 | /* process read if there is data other than line status */ | 1260 | /* process read if there is data other than line status */ |
1212 | if (tty && (bytes > i)) { | 1261 | if (tty && (bytes > i)) { |
1213 | for (; i < bytes ; ++i) { | 1262 | for (; i < bytes ; ++i) { |
1214 | dbg("pushing byte number %d - %d - %c",i,data[i],data[i]); | 1263 | dbg("pushing byte number %d - %d - %c", i, data[i], |
1264 | data[i]); | ||
1215 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | 1265 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { |
1216 | tty_flip_buffer_push(tty); | 1266 | tty_flip_buffer_push(tty); |
1217 | } | 1267 | } |
@@ -1221,25 +1271,28 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
1221 | } | 1271 | } |
1222 | 1272 | ||
1223 | spin_lock_irqsave(&priv->lock, flags); | 1273 | spin_lock_irqsave(&priv->lock, flags); |
1224 | priv->bytes_in += bytes; /* control and status byte(s) are also counted */ | 1274 | /* control and status byte(s) are also counted */ |
1275 | priv->bytes_in += bytes; | ||
1225 | spin_unlock_irqrestore(&priv->lock, flags); | 1276 | spin_unlock_irqrestore(&priv->lock, flags); |
1226 | 1277 | ||
1227 | continue_read: | 1278 | continue_read: |
1228 | 1279 | ||
1229 | /* Continue trying to always read... unless the port has closed. */ | 1280 | /* Continue trying to always read... unless the port has closed. */ |
1230 | 1281 | ||
1231 | if (port->open_count > 0) { | 1282 | if (port->open_count > 0) { |
1232 | usb_fill_int_urb(port->interrupt_in_urb, port->serial->dev, | 1283 | usb_fill_int_urb(port->interrupt_in_urb, port->serial->dev, |
1233 | usb_rcvintpipe(port->serial->dev, port->interrupt_in_endpointAddress), | 1284 | usb_rcvintpipe(port->serial->dev, |
1234 | port->interrupt_in_urb->transfer_buffer, | 1285 | port->interrupt_in_endpointAddress), |
1235 | port->interrupt_in_urb->transfer_buffer_length, | 1286 | port->interrupt_in_urb->transfer_buffer, |
1236 | cypress_read_int_callback, port, | 1287 | port->interrupt_in_urb->transfer_buffer_length, |
1237 | interval); | 1288 | cypress_read_int_callback, port, interval); |
1238 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); | 1289 | result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); |
1239 | if (result) | 1290 | if (result) |
1240 | dev_err(&urb->dev->dev, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__, result); | 1291 | dev_err(&urb->dev->dev, "%s - failed resubmitting " |
1292 | "read urb, error %d\n", __FUNCTION__, | ||
1293 | result); | ||
1241 | } | 1294 | } |
1242 | 1295 | ||
1243 | return; | 1296 | return; |
1244 | } /* cypress_read_int_callback */ | 1297 | } /* cypress_read_int_callback */ |
1245 | 1298 | ||