diff options
Diffstat (limited to 'drivers/usb')
| -rw-r--r-- | drivers/usb/serial/ark3116.c | 199 |
1 files changed, 99 insertions, 100 deletions
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index d37300e1811a..ca52f12f0e24 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
| @@ -46,10 +46,10 @@ static inline void ARK3116_SND(struct usb_serial *serial, int seq, | |||
| 46 | { | 46 | { |
| 47 | int result; | 47 | int result; |
| 48 | result = usb_control_msg(serial->dev, | 48 | result = usb_control_msg(serial->dev, |
| 49 | usb_sndctrlpipe(serial->dev,0), | 49 | usb_sndctrlpipe(serial->dev, 0), |
| 50 | request, requesttype, value, index, | 50 | request, requesttype, value, index, |
| 51 | NULL,0x00, 1000); | 51 | NULL, 0x00, 1000); |
| 52 | dbg("%03d > ok",seq); | 52 | dbg("%03d > ok", seq); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | static inline void ARK3116_RCV(struct usb_serial *serial, int seq, | 55 | static inline void ARK3116_RCV(struct usb_serial *serial, int seq, |
| @@ -59,27 +59,25 @@ static inline void ARK3116_RCV(struct usb_serial *serial, int seq, | |||
| 59 | { | 59 | { |
| 60 | int result; | 60 | int result; |
| 61 | result = usb_control_msg(serial->dev, | 61 | result = usb_control_msg(serial->dev, |
| 62 | usb_rcvctrlpipe(serial->dev,0), | 62 | usb_rcvctrlpipe(serial->dev, 0), |
| 63 | request, requesttype, value, index, | 63 | request, requesttype, value, index, |
| 64 | buf, 0x0000001, 1000); | 64 | buf, 0x0000001, 1000); |
| 65 | if (result) | 65 | if (result) |
| 66 | dbg("%03d < %d bytes [0x%02X]",seq, result, buf[0]); | 66 | dbg("%03d < %d bytes [0x%02X]", seq, result, buf[0]); |
| 67 | else | 67 | else |
| 68 | dbg("%03d < 0 bytes", seq); | 68 | dbg("%03d < 0 bytes", seq); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | |||
| 72 | static inline void ARK3116_RCV_QUIET(struct usb_serial *serial, | 71 | static inline void ARK3116_RCV_QUIET(struct usb_serial *serial, |
| 73 | __u8 request, __u8 requesttype, | 72 | __u8 request, __u8 requesttype, |
| 74 | __u16 value, __u16 index, char *buf) | 73 | __u16 value, __u16 index, char *buf) |
| 75 | { | 74 | { |
| 76 | usb_control_msg(serial->dev, | 75 | usb_control_msg(serial->dev, |
| 77 | usb_rcvctrlpipe(serial->dev,0), | 76 | usb_rcvctrlpipe(serial->dev, 0), |
| 78 | request, requesttype, value, index, | 77 | request, requesttype, value, index, |
| 79 | buf, 0x0000001, 1000); | 78 | buf, 0x0000001, 1000); |
| 80 | } | 79 | } |
| 81 | 80 | ||
| 82 | |||
| 83 | static int ark3116_attach(struct usb_serial *serial) | 81 | static int ark3116_attach(struct usb_serial *serial) |
| 84 | { | 82 | { |
| 85 | char *buf; | 83 | char *buf; |
| @@ -87,10 +85,10 @@ static int ark3116_attach(struct usb_serial *serial) | |||
| 87 | int i; | 85 | int i; |
| 88 | 86 | ||
| 89 | for (i = 0; i < serial->num_ports; ++i) { | 87 | for (i = 0; i < serial->num_ports; ++i) { |
| 90 | priv = kmalloc (sizeof (struct ark3116_private), GFP_KERNEL); | 88 | priv = kmalloc(sizeof (struct ark3116_private), GFP_KERNEL); |
| 91 | if (!priv) | 89 | if (!priv) |
| 92 | goto cleanup; | 90 | goto cleanup; |
| 93 | memset (priv, 0x00, sizeof (struct ark3116_private)); | 91 | memset(priv, 0x00, sizeof (struct ark3116_private)); |
| 94 | spin_lock_init(&priv->lock); | 92 | spin_lock_init(&priv->lock); |
| 95 | 93 | ||
| 96 | usb_set_serial_port_data(serial->port[i], priv); | 94 | usb_set_serial_port_data(serial->port[i], priv); |
| @@ -98,63 +96,62 @@ static int ark3116_attach(struct usb_serial *serial) | |||
| 98 | 96 | ||
| 99 | buf = kmalloc(1, GFP_KERNEL); | 97 | buf = kmalloc(1, GFP_KERNEL); |
| 100 | if (!buf) { | 98 | if (!buf) { |
| 101 | dbg("error kmalloc -> out of mem ?"); | 99 | dbg("error kmalloc -> out of mem?"); |
| 102 | goto cleanup; | 100 | goto cleanup; |
| 103 | } | 101 | } |
| 104 | 102 | ||
| 105 | /* 3 */ | 103 | /* 3 */ |
| 106 | ARK3116_SND(serial, 3,0xFE,0x40,0x0008,0x0002); | 104 | ARK3116_SND(serial, 3, 0xFE, 0x40, 0x0008, 0x0002); |
| 107 | ARK3116_SND(serial, 4,0xFE,0x40,0x0008,0x0001); | 105 | ARK3116_SND(serial, 4, 0xFE, 0x40, 0x0008, 0x0001); |
| 108 | ARK3116_SND(serial, 5,0xFE,0x40,0x0000,0x0008); | 106 | ARK3116_SND(serial, 5, 0xFE, 0x40, 0x0000, 0x0008); |
| 109 | ARK3116_SND(serial, 6,0xFE,0x40,0x0000,0x000B); | 107 | ARK3116_SND(serial, 6, 0xFE, 0x40, 0x0000, 0x000B); |
| 110 | 108 | ||
| 111 | /* <-- seq7 */ | 109 | /* <-- seq7 */ |
| 112 | ARK3116_RCV(serial, 7,0xFE,0xC0,0x0000,0x0003, 0x00, buf); | 110 | ARK3116_RCV(serial, 7, 0xFE, 0xC0, 0x0000, 0x0003, 0x00, buf); |
| 113 | ARK3116_SND(serial, 8,0xFE,0x40,0x0080,0x0003); | 111 | ARK3116_SND(serial, 8, 0xFE, 0x40, 0x0080, 0x0003); |
| 114 | ARK3116_SND(serial, 9,0xFE,0x40,0x001A,0x0000); | 112 | ARK3116_SND(serial, 9, 0xFE, 0x40, 0x001A, 0x0000); |
| 115 | ARK3116_SND(serial,10,0xFE,0x40,0x0000,0x0001); | 113 | ARK3116_SND(serial, 10, 0xFE, 0x40, 0x0000, 0x0001); |
| 116 | ARK3116_SND(serial,11,0xFE,0x40,0x0000,0x0003); | 114 | ARK3116_SND(serial, 11, 0xFE, 0x40, 0x0000, 0x0003); |
| 117 | 115 | ||
| 118 | /* <-- seq12 */ | 116 | /* <-- seq12 */ |
| 119 | ARK3116_RCV(serial,12,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | 117 | ARK3116_RCV(serial, 12, 0xFE, 0xC0, 0x0000, 0x0004, 0x00, buf); |
| 120 | ARK3116_SND(serial,13,0xFE,0x40,0x0000,0x0004); | 118 | ARK3116_SND(serial, 13, 0xFE, 0x40, 0x0000, 0x0004); |
| 121 | 119 | ||
| 122 | /* 14 */ | 120 | /* 14 */ |
| 123 | ARK3116_RCV(serial,14,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | 121 | ARK3116_RCV(serial, 14, 0xFE, 0xC0, 0x0000, 0x0004, 0x00, buf); |
| 124 | ARK3116_SND(serial,15,0xFE,0x40,0x0000,0x0004); | 122 | ARK3116_SND(serial, 15, 0xFE, 0x40, 0x0000, 0x0004); |
| 125 | 123 | ||
| 126 | /* 16 */ | 124 | /* 16 */ |
| 127 | ARK3116_RCV(serial,16,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | 125 | ARK3116_RCV(serial, 16, 0xFE, 0xC0, 0x0000, 0x0004, 0x00, buf); |
| 128 | /* --> seq17 */ | 126 | /* --> seq17 */ |
| 129 | ARK3116_SND(serial,17,0xFE,0x40,0x0001,0x0004); | 127 | ARK3116_SND(serial, 17, 0xFE, 0x40, 0x0001, 0x0004); |
| 130 | 128 | ||
| 131 | /* <-- seq18 */ | 129 | /* <-- seq18 */ |
| 132 | ARK3116_RCV(serial,18,0xFE,0xC0,0x0000,0x0004, 0x01, buf); | 130 | ARK3116_RCV(serial, 18, 0xFE, 0xC0, 0x0000, 0x0004, 0x01, buf); |
| 133 | 131 | ||
| 134 | /* --> seq19 */ | 132 | /* --> seq19 */ |
| 135 | ARK3116_SND(serial,19,0xFE,0x40,0x0003,0x0004); | 133 | ARK3116_SND(serial, 19, 0xFE, 0x40, 0x0003, 0x0004); |
| 136 | |||
| 137 | 134 | ||
| 138 | /* <-- seq20 */ | 135 | /* <-- seq20 */ |
| 139 | /* seems like serial port status info (RTS, CTS,...) */ | 136 | /* seems like serial port status info (RTS, CTS, ...) */ |
| 140 | /* returns modem control line status ?! */ | 137 | /* returns modem control line status?! */ |
| 141 | ARK3116_RCV(serial,20,0xFE,0xC0,0x0000,0x0006, 0xFF, buf); | 138 | ARK3116_RCV(serial, 20, 0xFE, 0xC0, 0x0000, 0x0006, 0xFF, buf); |
| 142 | 139 | ||
| 143 | /* set 9600 baud & do some init ?! */ | 140 | /* set 9600 baud & do some init?! */ |
| 144 | ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003); | 141 | ARK3116_SND(serial, 147, 0xFE, 0x40, 0x0083, 0x0003); |
| 145 | ARK3116_SND(serial,148,0xFE,0x40,0x0038,0x0000); | 142 | ARK3116_SND(serial, 148, 0xFE, 0x40, 0x0038, 0x0000); |
| 146 | ARK3116_SND(serial,149,0xFE,0x40,0x0001,0x0001); | 143 | ARK3116_SND(serial, 149, 0xFE, 0x40, 0x0001, 0x0001); |
| 147 | ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003); | 144 | ARK3116_SND(serial, 150, 0xFE, 0x40, 0x0003, 0x0003); |
| 148 | ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf); | 145 | ARK3116_RCV(serial, 151, 0xFE, 0xC0, 0x0000, 0x0004, 0x03, buf); |
| 149 | ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003); | 146 | ARK3116_SND(serial, 152, 0xFE, 0x40, 0x0000, 0x0003); |
| 150 | ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf); | 147 | ARK3116_RCV(serial, 153, 0xFE, 0xC0, 0x0000, 0x0003, 0x00, buf); |
| 151 | ARK3116_SND(serial,154,0xFE,0x40,0x0003,0x0003); | 148 | ARK3116_SND(serial, 154, 0xFE, 0x40, 0x0003, 0x0003); |
| 152 | 149 | ||
| 153 | kfree(buf); | 150 | kfree(buf); |
| 154 | return(0); | 151 | return 0; |
| 155 | 152 | ||
| 156 | cleanup: | 153 | cleanup: |
| 157 | for (--i; i>=0; --i) | 154 | for (--i; i >= 0; --i) |
| 158 | usb_set_serial_port_data(serial->port[i], NULL); | 155 | usb_set_serial_port_data(serial->port[i], NULL); |
| 159 | return -ENOMEM; | 156 | return -ENOMEM; |
| 160 | } | 157 | } |
| @@ -183,7 +180,8 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
| 183 | spin_lock_irqsave(&priv->lock, flags); | 180 | spin_lock_irqsave(&priv->lock, flags); |
| 184 | if (!priv->termios_initialized) { | 181 | if (!priv->termios_initialized) { |
| 185 | *(port->tty->termios) = tty_std_termios; | 182 | *(port->tty->termios) = tty_std_termios; |
| 186 | port->tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; | 183 | port->tty->termios->c_cflag = B9600 | CS8 |
| 184 | | CREAD | HUPCL | CLOCAL; | ||
| 187 | priv->termios_initialized = 1; | 185 | priv->termios_initialized = 1; |
| 188 | } | 186 | } |
| 189 | spin_unlock_irqrestore(&priv->lock, flags); | 187 | spin_unlock_irqrestore(&priv->lock, flags); |
| @@ -207,8 +205,8 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
| 207 | } | 205 | } |
| 208 | 206 | ||
| 209 | /* set data bit count (8/7/6/5) */ | 207 | /* set data bit count (8/7/6/5) */ |
| 210 | if (cflag & CSIZE){ | 208 | if (cflag & CSIZE) { |
| 211 | switch (cflag & CSIZE){ | 209 | switch (cflag & CSIZE) { |
| 212 | case CS5: | 210 | case CS5: |
| 213 | config |= 0x00; | 211 | config |= 0x00; |
| 214 | dbg("setting CS5"); | 212 | dbg("setting CS5"); |
| @@ -222,7 +220,8 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
| 222 | dbg("setting CS7"); | 220 | dbg("setting CS7"); |
| 223 | break; | 221 | break; |
| 224 | default: | 222 | default: |
| 225 | err ("CSIZE was set but not CS5-CS8, using CS8!"); | 223 | err("CSIZE was set but not CS5-CS8, using CS8!"); |
| 224 | /* fall through */ | ||
| 226 | case CS8: | 225 | case CS8: |
| 227 | config |= 0x03; | 226 | config |= 0x03; |
| 228 | dbg("setting CS8"); | 227 | dbg("setting CS8"); |
| @@ -230,8 +229,8 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
| 230 | } | 229 | } |
| 231 | } | 230 | } |
| 232 | 231 | ||
| 233 | /* set parity (NONE,EVEN,ODD) */ | 232 | /* set parity (NONE/EVEN/ODD) */ |
| 234 | if (cflag & PARENB){ | 233 | if (cflag & PARENB) { |
| 235 | if (cflag & PARODD) { | 234 | if (cflag & PARODD) { |
| 236 | config |= 0x08; | 235 | config |= 0x08; |
| 237 | dbg("setting parity to ODD"); | 236 | dbg("setting parity to ODD"); |
| @@ -243,20 +242,19 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
| 243 | dbg("setting parity to NONE"); | 242 | dbg("setting parity to NONE"); |
| 244 | } | 243 | } |
| 245 | 244 | ||
| 246 | /* SET STOPBIT (1/2) */ | 245 | /* set stop bit (1/2) */ |
| 247 | if (cflag & CSTOPB) { | 246 | if (cflag & CSTOPB) { |
| 248 | config |= 0x04; | 247 | config |= 0x04; |
| 249 | dbg ("setting 2 stop bits"); | 248 | dbg("setting 2 stop bits"); |
| 250 | } else { | 249 | } else { |
| 251 | dbg ("setting 1 stop bit"); | 250 | dbg("setting 1 stop bit"); |
| 252 | } | 251 | } |
| 253 | 252 | ||
| 254 | 253 | /* set baudrate */ | |
| 255 | /* set baudrate: */ | ||
| 256 | baud = 0; | 254 | baud = 0; |
| 257 | switch (cflag & CBAUD){ | 255 | switch (cflag & CBAUD) { |
| 258 | case B0: | 256 | case B0: |
| 259 | err("can't set 0baud, using 9600 instead"); | 257 | err("can't set 0 baud, using 9600 instead"); |
| 260 | break; | 258 | break; |
| 261 | case B75: baud = 75; break; | 259 | case B75: baud = 75; break; |
| 262 | case B150: baud = 150; break; | 260 | case B150: baud = 150; break; |
| @@ -288,38 +286,40 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
| 288 | */ | 286 | */ |
| 289 | if (baud == 460800) | 287 | if (baud == 460800) |
| 290 | /* strange, for 460800 the formula is wrong | 288 | /* strange, for 460800 the formula is wrong |
| 291 | * (dont use round(), then 9600baud is wrong) */ | 289 | * if using round() then 9600baud is wrong) */ |
| 292 | ark3116_baud = 7; | 290 | ark3116_baud = 7; |
| 293 | else | 291 | else |
| 294 | ark3116_baud = 3000000 / baud; | 292 | ark3116_baud = 3000000 / baud; |
| 295 | 293 | ||
| 296 | /* ? */ | 294 | /* ? */ |
| 297 | ARK3116_RCV(serial,0,0xFE,0xC0,0x0000,0x0003, 0x03, buf); | 295 | ARK3116_RCV(serial, 0, 0xFE, 0xC0, 0x0000, 0x0003, 0x03, buf); |
| 296 | |||
| 298 | /* offset = buf[0]; */ | 297 | /* offset = buf[0]; */ |
| 299 | /* offset = 0x03; */ | 298 | /* offset = 0x03; */ |
| 300 | /* dbg("using 0x%04X as target for 0x0003:",0x0080+offset); */ | 299 | /* dbg("using 0x%04X as target for 0x0003:", 0x0080 + offset); */ |
| 301 | |||
| 302 | 300 | ||
| 303 | /* set baudrate */ | 301 | /* set baudrate */ |
| 304 | dbg("setting baudrate to %d (->reg=%d)",baud,ark3116_baud); | 302 | dbg("setting baudrate to %d (->reg=%d)", baud, ark3116_baud); |
| 305 | ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003); | 303 | ARK3116_SND(serial, 147, 0xFE, 0x40, 0x0083, 0x0003); |
| 306 | ARK3116_SND(serial,148,0xFE,0x40,(ark3116_baud & 0x00FF) ,0x0000); | 304 | ARK3116_SND(serial, 148, 0xFE, 0x40, |
| 307 | ARK3116_SND(serial,149,0xFE,0x40,(ark3116_baud & 0xFF00)>>8,0x0001); | 305 | (ark3116_baud & 0x00FF), 0x0000); |
| 308 | ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003); | 306 | ARK3116_SND(serial, 149, 0xFE, 0x40, |
| 307 | (ark3116_baud & 0xFF00) >> 8, 0x0001); | ||
| 308 | ARK3116_SND(serial, 150, 0xFE, 0x40, 0x0003, 0x0003); | ||
| 309 | 309 | ||
| 310 | /* ? */ | 310 | /* ? */ |
| 311 | ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf); | 311 | ARK3116_RCV(serial, 151, 0xFE, 0xC0, 0x0000, 0x0004, 0x03, buf); |
| 312 | ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003); | 312 | ARK3116_SND(serial, 152, 0xFE, 0x40, 0x0000, 0x0003); |
| 313 | 313 | ||
| 314 | /* set data bit count, stop bit count & parity: */ | 314 | /* set data bit count, stop bit count & parity: */ |
| 315 | dbg("updating bit count, stop bit or parity (cfg=0x%02X)", config); | 315 | dbg("updating bit count, stop bit or parity (cfg=0x%02X)", config); |
| 316 | ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf); | 316 | ARK3116_RCV(serial, 153, 0xFE, 0xC0, 0x0000, 0x0003, 0x00, buf); |
| 317 | ARK3116_SND(serial,154,0xFE,0x40,config,0x0003); | 317 | ARK3116_SND(serial, 154, 0xFE, 0x40, config, 0x0003); |
| 318 | 318 | ||
| 319 | if (cflag & CRTSCTS) | 319 | if (cflag & CRTSCTS) |
| 320 | dbg("CRTSCTS not supported by chipset ?!"); | 320 | dbg("CRTSCTS not supported by chipset?!"); |
| 321 | 321 | ||
| 322 | /* TEST ARK3116_SND(154,0xFE,0x40,0xFFFF, 0x0006); */ | 322 | /* TEST ARK3116_SND(154, 0xFE, 0x40, 0xFFFF, 0x0006); */ |
| 323 | 323 | ||
| 324 | kfree(buf); | 324 | kfree(buf); |
| 325 | return; | 325 | return; |
| @@ -332,11 +332,11 @@ static int ark3116_open(struct usb_serial_port *port, struct file *filp) | |||
| 332 | char *buf; | 332 | char *buf; |
| 333 | int result = 0; | 333 | int result = 0; |
| 334 | 334 | ||
| 335 | dbg("%s - port %d", __FUNCTION__, port->number); | 335 | dbg("%s - port %d", __FUNCTION__, port->number); |
| 336 | 336 | ||
| 337 | buf = kmalloc(1, GFP_KERNEL); | 337 | buf = kmalloc(1, GFP_KERNEL); |
| 338 | if (!buf) { | 338 | if (!buf) { |
| 339 | dbg("error kmalloc -> out of mem ?"); | 339 | dbg("error kmalloc -> out of mem?"); |
| 340 | return -ENOMEM; | 340 | return -ENOMEM; |
| 341 | } | 341 | } |
| 342 | 342 | ||
| @@ -345,38 +345,37 @@ static int ark3116_open(struct usb_serial_port *port, struct file *filp) | |||
| 345 | return result; | 345 | return result; |
| 346 | 346 | ||
| 347 | /* open */ | 347 | /* open */ |
| 348 | ARK3116_RCV(serial,111,0xFE,0xC0,0x0000,0x0003, 0x02, buf); | 348 | ARK3116_RCV(serial, 111, 0xFE, 0xC0, 0x0000, 0x0003, 0x02, buf); |
| 349 | 349 | ||
| 350 | ARK3116_SND(serial,112,0xFE,0x40,0x0082,0x0003); | 350 | ARK3116_SND(serial, 112, 0xFE, 0x40, 0x0082, 0x0003); |
| 351 | ARK3116_SND(serial,113,0xFE,0x40,0x001A,0x0000); | 351 | ARK3116_SND(serial, 113, 0xFE, 0x40, 0x001A, 0x0000); |
| 352 | ARK3116_SND(serial,114,0xFE,0x40,0x0000,0x0001); | 352 | ARK3116_SND(serial, 114, 0xFE, 0x40, 0x0000, 0x0001); |
| 353 | ARK3116_SND(serial,115,0xFE,0x40,0x0002,0x0003); | 353 | ARK3116_SND(serial, 115, 0xFE, 0x40, 0x0002, 0x0003); |
| 354 | 354 | ||
| 355 | ARK3116_RCV(serial,116,0xFE,0xC0,0x0000,0x0004, 0x03, buf); | 355 | ARK3116_RCV(serial, 116, 0xFE, 0xC0, 0x0000, 0x0004, 0x03, buf); |
| 356 | ARK3116_SND(serial,117,0xFE,0x40,0x0002,0x0004); | 356 | ARK3116_SND(serial, 117, 0xFE, 0x40, 0x0002, 0x0004); |
| 357 | 357 | ||
| 358 | ARK3116_RCV(serial,118,0xFE,0xC0,0x0000,0x0004, 0x02, buf); | 358 | ARK3116_RCV(serial, 118, 0xFE, 0xC0, 0x0000, 0x0004, 0x02, buf); |
| 359 | ARK3116_SND(serial,119,0xFE,0x40,0x0000,0x0004); | 359 | ARK3116_SND(serial, 119, 0xFE, 0x40, 0x0000, 0x0004); |
| 360 | 360 | ||
| 361 | ARK3116_RCV(serial,120,0xFE,0xC0,0x0000,0x0004, 0x00, buf); | 361 | ARK3116_RCV(serial, 120, 0xFE, 0xC0, 0x0000, 0x0004, 0x00, buf); |
| 362 | 362 | ||
| 363 | ARK3116_SND(serial,121,0xFE,0x40,0x0001,0x0004); | 363 | ARK3116_SND(serial, 121, 0xFE, 0x40, 0x0001, 0x0004); |
| 364 | 364 | ||
| 365 | ARK3116_RCV(serial,122,0xFE,0xC0,0x0000,0x0004, 0x01, buf); | 365 | ARK3116_RCV(serial, 122, 0xFE, 0xC0, 0x0000, 0x0004, 0x01, buf); |
| 366 | 366 | ||
| 367 | ARK3116_SND(serial,123,0xFE,0x40,0x0003,0x0004); | 367 | ARK3116_SND(serial, 123, 0xFE, 0x40, 0x0003, 0x0004); |
| 368 | 368 | ||
| 369 | /* returns different values (control lines ?!) */ | 369 | /* returns different values (control lines?!) */ |
| 370 | ARK3116_RCV(serial,124,0xFE,0xC0,0x0000,0x0006, 0xFF, buf); | 370 | ARK3116_RCV(serial, 124, 0xFE, 0xC0, 0x0000, 0x0006, 0xFF, buf); |
| 371 | 371 | ||
| 372 | /* initialise termios: */ | 372 | /* initialise termios */ |
| 373 | if (port->tty) | 373 | if (port->tty) |
| 374 | ark3116_set_termios(port, &tmp_termios); | 374 | ark3116_set_termios(port, &tmp_termios); |
| 375 | 375 | ||
| 376 | kfree(buf); | 376 | kfree(buf); |
| 377 | 377 | ||
| 378 | return result; | 378 | return result; |
| 379 | |||
| 380 | } | 379 | } |
| 381 | 380 | ||
| 382 | static int ark3116_ioctl(struct usb_serial_port *port, struct file *file, | 381 | static int ark3116_ioctl(struct usb_serial_port *port, struct file *file, |
| @@ -417,7 +416,7 @@ static int ark3116_tiocmget(struct usb_serial_port *port, struct file *file) | |||
| 417 | char *buf; | 416 | char *buf; |
| 418 | char temp; | 417 | char temp; |
| 419 | 418 | ||
| 420 | /* seems like serial port status info (RTS, CTS,...) is stored | 419 | /* seems like serial port status info (RTS, CTS, ...) is stored |
| 421 | * in reg(?) 0x0006 | 420 | * in reg(?) 0x0006 |
| 422 | * pcb connection point 11 = GND -> sets bit4 of response | 421 | * pcb connection point 11 = GND -> sets bit4 of response |
| 423 | * pcb connection point 7 = GND -> sets bit6 of response | 422 | * pcb connection point 7 = GND -> sets bit6 of response |
| @@ -429,16 +428,16 @@ static int ark3116_tiocmget(struct usb_serial_port *port, struct file *file) | |||
| 429 | return -ENOMEM; | 428 | return -ENOMEM; |
| 430 | } | 429 | } |
| 431 | 430 | ||
| 432 | /* read register: */ | 431 | /* read register */ |
| 433 | ARK3116_RCV_QUIET(serial,0xFE,0xC0,0x0000,0x0006,buf); | 432 | ARK3116_RCV_QUIET(serial, 0xFE, 0xC0, 0x0000, 0x0006, buf); |
| 434 | temp = buf[0]; | 433 | temp = buf[0]; |
| 435 | kfree(buf); | 434 | kfree(buf); |
| 436 | 435 | ||
| 437 | /* i do not really know if bit4=CTS and bit6=DSR... was just a | 436 | /* i do not really know if bit4=CTS and bit6=DSR... just a |
| 438 | * quick guess !! | 437 | * quick guess! |
| 439 | */ | 438 | */ |
| 440 | return (temp & (1<<4) ? TIOCM_CTS : 0) | | 439 | return (temp & (1<<4) ? TIOCM_CTS : 0) |
| 441 | (temp & (1<<6) ? TIOCM_DSR : 0); | 440 | | (temp & (1<<6) ? TIOCM_DSR : 0); |
| 442 | } | 441 | } |
| 443 | 442 | ||
| 444 | static struct usb_driver ark3116_driver = { | 443 | static struct usb_driver ark3116_driver = { |
