~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to drivers/staging/serqt_usb2/serqt_usb2.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#define QUATECH_HSU200B 0xC0B1  /* HSU200B */
42
42
#define QUATECH_HSU200C 0xC0B2  /* HSU200C */
43
43
#define QUATECH_HSU200D 0xC0B3  /* HSU200D */
44
 
#define QUATECH_SSU100_2  0xC120        /* SSU100_2 */
45
 
#define QUATECH_DSU100_2  0xC140        /* DSU100_2 */
46
 
#define QUATECH_DSU400_2  0xC150        /* DSU400_2 */
47
 
#define QUATECH_QSU100_2  0xC160        /* QSU100_2 */
48
 
#define QUATECH_QSU400_2  0xC170        /* QSU400_2 */
49
 
#define QUATECH_ESU400_2  0xC180        /* ESU400_2 */
50
 
#define QUATECH_ESU100_2  0xC1A0        /* ESU100_2 */
51
44
 
52
45
#define QT_SET_GET_DEVICE           0xc2
53
46
#define QT_OPEN_CLOSE_CHANNEL       0xca
125
118
#define MODEM_CTRL          0x40
126
119
#define RS232_MODE          0x00
127
120
 
128
 
static const struct usb_device_id serqt_id_table[] = {
 
121
static const struct usb_device_id id_table[] = {
129
122
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_SSU200)},
130
123
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_DSU100)},
131
124
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_DSU200)},
143
136
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_HSU200B)},
144
137
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_HSU200C)},
145
138
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_HSU200D)},
146
 
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_SSU100_2)},
147
 
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_DSU100_2)},
148
 
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_DSU400_2)},
149
 
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_QSU100_2)},
150
 
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_QSU400_2)},
151
 
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_ESU400_2)},
152
 
        {USB_DEVICE(USB_VENDOR_ID_QUATECH, QUATECH_ESU100_2)},
153
139
        {}                      /* Terminating entry */
154
140
};
155
 
 
156
 
MODULE_DEVICE_TABLE(usb, serqt_id_table);
 
141
MODULE_DEVICE_TABLE(usb, id_table);
157
142
 
158
143
struct qt_get_device_data {
159
144
        __u8 porta;
195
180
        char closePending;
196
181
};
197
182
 
198
 
static struct usb_driver serqt_usb_driver = {
199
 
        .name = "quatech-usb-serial",
200
 
        .probe = usb_serial_probe,
201
 
        .disconnect = usb_serial_disconnect,
202
 
        .id_table = serqt_id_table,
203
 
};
204
 
 
205
183
static int port_paranoia_check(struct usb_serial_port *port,
206
184
                               const char *function)
207
185
{
304
282
 
305
283
        quatech_port = urb->context;
306
284
 
307
 
        dbg("%s - port %d\n", __func__, quatech_port->port_num);
308
 
 
309
285
        tty = tty_port_tty_get(&quatech_port->port->port);
310
286
 
311
287
        if (tty)
351
327
        /* index = MINOR(port->tty->device) - serial->minor; */
352
328
        index = tty->index - serial->minor;
353
329
 
354
 
        dbg("%s - port %d\n", __func__, port->number);
355
330
        dbg("%s - port->RxHolding = %d\n", __func__, qt_port->RxHolding);
356
331
 
357
332
        if (port_paranoia_check(port, __func__) != 0) {
726
701
        int i;
727
702
        int status;
728
703
 
729
 
        dbg("enterting %s", __func__);
730
 
 
731
704
        /* Now setup per port private data */
732
705
        for (i = 0; i < serial->num_ports; i++) {
733
706
                port = serial->port[i];
855
828
        struct quatech_port *qt_port;
856
829
        int i;
857
830
 
858
 
        dbg("enterting %s", __func__);
859
 
 
860
831
        for (i = 0; i < serial->num_ports; i++) {
861
832
                port = serial->port[i];
862
833
                if (!port)
882
853
        if (port_paranoia_check(port, __func__))
883
854
                return -ENODEV;
884
855
 
885
 
        dbg("%s - port %d\n", __func__, port->number);
886
 
 
887
856
        serial = port->serial;
888
857
 
889
858
        if (serial_paranoia_check(serial, __func__))
1006
975
 
1007
976
        serial = get_usb_serial(port, __func__);
1008
977
 
1009
 
        dbg("%s - port %d\n", __func__, port->number);
1010
 
 
1011
978
        if (serial->num_bulk_out) {
1012
979
                if (port->write_urb->status == -EINPROGRESS)
1013
980
                        chars = port->write_urb->transfer_buffer_length;
1054
1021
        unsigned int index;
1055
1022
        status = 0;
1056
1023
 
1057
 
        dbg("%s - port %d\n", __func__, port->number);
1058
 
 
1059
1024
        tty = tty_port_tty_get(&port->port);
1060
1025
        index = tty->index - serial->minor;
1061
1026
 
1109
1074
        if (serial == NULL)
1110
1075
                return -ENODEV;
1111
1076
 
1112
 
        dbg("%s - port %d\n", __func__, port->number);
1113
 
 
1114
1077
        if (count == 0) {
1115
1078
                dbg("%s - write request of 0 bytes\n", __func__);
1116
1079
                return 0;
1173
1136
 
1174
1137
        mutex_lock(&qt_port->lock);
1175
1138
 
1176
 
        dbg("%s - port %d\n", __func__, port->number);
1177
 
 
1178
1139
        if (serial->num_bulk_out) {
1179
1140
                if (port->write_urb->status != -EINPROGRESS)
1180
1141
                        retval = port->bulk_out_size;
1241
1202
        int baud, divisor, remainder;
1242
1203
        int status;
1243
1204
 
1244
 
        dbg("%s", __func__);
1245
 
 
1246
1205
        index = tty->index - port->serial->minor;
1247
1206
 
1248
1207
        switch (cflag) {
1365
1324
 
1366
1325
        mutex_lock(&qt_port->lock);
1367
1326
 
1368
 
        dbg("%s - port %d\n", __func__, port->number);
1369
 
 
1370
1327
        result =
1371
1328
            usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
1372
1329
                            QT_BREAK_CONTROL, 0x40, onoff, index, NULL, 0, 300);
1385
1342
        int status;
1386
1343
        unsigned int index;
1387
1344
 
1388
 
        dbg("%s - port %d, tty =0x%p\n", __func__, port->number, tty);
1389
 
 
1390
1345
        index = tty->index - serial->minor;
1391
1346
        status =
1392
1347
            BoxGetRegister(port->serial, index, MODEM_CONTROL_REGISTER, &mcr);
1426
1381
        int status;
1427
1382
        unsigned int index;
1428
1383
 
1429
 
        dbg("%s - port %d\n", __func__, port->number);
1430
 
 
1431
1384
        index = tty->index - serial->minor;
1432
1385
        status =
1433
1386
            BoxGetRegister(port->serial, index, MODEM_CONTROL_REGISTER, &mcr);
1461
1414
        struct quatech_port *qt_port = qt_get_port_private(port);
1462
1415
        int retval = -ENODEV;
1463
1416
 
1464
 
        dbg("In %s\n", __func__);
1465
 
 
1466
1417
        if (!serial)
1467
1418
                return -ENODEV;
1468
1419
 
1469
1420
        mutex_lock(&qt_port->lock);
1470
 
 
1471
 
        dbg("%s - port %d\n", __func__, port->number);
1472
 
        dbg("%s - port->RxHolding = %d\n", __func__, qt_port->RxHolding);
1473
 
 
1474
1421
        retval = qt_real_tiocmget(tty, port, serial);
1475
 
 
1476
1422
        mutex_unlock(&qt_port->lock);
1477
1423
        return retval;
1478
1424
}
1486
1432
        struct quatech_port *qt_port = qt_get_port_private(port);
1487
1433
        int retval = -ENODEV;
1488
1434
 
1489
 
        dbg("In %s\n", __func__);
1490
 
 
1491
1435
        if (!serial)
1492
1436
                return -ENODEV;
1493
1437
 
1494
1438
        mutex_lock(&qt_port->lock);
1495
 
 
1496
 
        dbg("%s - port %d\n", __func__, port->number);
1497
 
        dbg("%s - qt_port->RxHolding = %d\n", __func__, qt_port->RxHolding);
1498
 
 
1499
1439
        retval = qt_real_tiocmset(tty, port, serial, set);
1500
 
 
1501
1440
        mutex_unlock(&qt_port->lock);
1502
1441
        return retval;
1503
1442
}
1508
1447
        struct usb_serial *serial = get_usb_serial(port, __func__);
1509
1448
        struct quatech_port *qt_port;
1510
1449
 
1511
 
        dbg("%s - port %d\n", __func__, port->number);
1512
 
 
1513
1450
        if (!serial)
1514
1451
                return;
1515
1452
 
1519
1456
 
1520
1457
        /* pass on to the driver specific version of this function */
1521
1458
        qt_port->RxHolding = 1;
1522
 
        dbg("%s - port->RxHolding = 1\n", __func__);
1523
1459
 
1524
1460
        mutex_unlock(&qt_port->lock);
1525
1461
        return;
1539
1475
 
1540
1476
        mutex_lock(&qt_port->lock);
1541
1477
 
1542
 
        dbg("%s - port %d\n", __func__, port->number);
1543
 
 
1544
1478
        if (qt_port->RxHolding == 1) {
1545
1479
                dbg("%s -qt_port->RxHolding == 1\n", __func__);
1546
1480
 
1559
1493
                                          qt_read_bulk_callback, port);
1560
1494
                        result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
1561
1495
                        if (result)
1562
 
                                err("%s - failed restarting read urb, error %d",
1563
 
                                    __func__, result);
 
1496
                                dev_err(&port->dev,
 
1497
                                        "%s - failed restarting read urb, error %d\n",
 
1498
                                        __func__, result);
1564
1499
                }
1565
1500
        }
1566
1501
        mutex_unlock(&qt_port->lock);
1589
1524
                   .name = "serqt",
1590
1525
                   },
1591
1526
        .description = DRIVER_DESC,
1592
 
        .id_table = serqt_id_table,
 
1527
        .id_table = id_table,
1593
1528
        .num_ports = 8,
1594
1529
        .open = qt_open,
1595
1530
        .close = qt_close,
1612
1547
        &quatech_device, NULL
1613
1548
};
1614
1549
 
1615
 
module_usb_serial_driver(serqt_usb_driver, serial_drivers);
 
1550
module_usb_serial_driver(serial_drivers, id_table);
1616
1551
 
1617
1552
MODULE_AUTHOR(DRIVER_AUTHOR);
1618
1553
MODULE_DESCRIPTION(DRIVER_DESC);