Skip to content

Commit cde2437

Browse files
committed
USB: serial: ftdi_sio: clean up NDI speed hack
NDI devices remap the 19200 line speed to 1.2 Mbps. Use the quirk pointer from the match table to enable the quirk instead of comparing PIDs on every speed change. Signed-off-by: Johan Hovold <johan@kernel.org>
1 parent 96e5d1b commit cde2437

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

drivers/usb/serial/ftdi_sio.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,7 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set,
12461246
static u32 get_ftdi_divisor(struct tty_struct *tty,
12471247
struct usb_serial_port *port)
12481248
{
1249+
const struct ftdi_quirk *quirk = usb_get_serial_data(port->serial);
12491250
struct ftdi_private *priv = usb_get_serial_port_data(port);
12501251
struct device *dev = &port->dev;
12511252
u32 div_value = 0;
@@ -1305,17 +1306,8 @@ static u32 get_ftdi_divisor(struct tty_struct *tty,
13051306
case FT232R:
13061307
case FTX:
13071308
if (baud <= 3000000) {
1308-
u16 product_id = le16_to_cpu(
1309-
port->serial->dev->descriptor.idProduct);
1310-
if (((product_id == FTDI_NDI_HUC_PID) ||
1311-
(product_id == FTDI_NDI_SPECTRA_SCU_PID) ||
1312-
(product_id == FTDI_NDI_FUTURE_2_PID) ||
1313-
(product_id == FTDI_NDI_FUTURE_3_PID) ||
1314-
(product_id == FTDI_NDI_AURORA_SCU_PID) ||
1315-
(product_id == FTDI_NDI_EMGUIDE_GEMINI_PID)) &&
1316-
(baud == 19200)) {
1309+
if (quirk == &ftdi_ndi_quirk && baud == 19200)
13171310
baud = 1200000;
1318-
}
13191311
div_value = ftdi_232bm_baud_to_divisor(baud);
13201312
} else {
13211313
dev_dbg(dev, "%s - Baud rate too high!\n", __func__);

0 commit comments

Comments
 (0)