summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2025-11-10 12:12:11 +0100
committerJohan Hovold <johan@kernel.org>2025-11-17 11:23:24 +0100
commitcde24373724bd3a0937b7af9453dfc6d7433c726 (patch)
tree83cdd746641727e7995bc20e4e816b9daaea7ad7
parent96e5d1b1e69097cb89f8002770cccf464c0dfa1c (diff)
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>
-rw-r--r--drivers/usb/serial/ftdi_sio.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 58dbf922208c..d77c1ccafe05 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1246,6 +1246,7 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set,
static u32 get_ftdi_divisor(struct tty_struct *tty,
struct usb_serial_port *port)
{
+ const struct ftdi_quirk *quirk = usb_get_serial_data(port->serial);
struct ftdi_private *priv = usb_get_serial_port_data(port);
struct device *dev = &port->dev;
u32 div_value = 0;
@@ -1305,17 +1306,8 @@ static u32 get_ftdi_divisor(struct tty_struct *tty,
case FT232R:
case FTX:
if (baud <= 3000000) {
- u16 product_id = le16_to_cpu(
- port->serial->dev->descriptor.idProduct);
- if (((product_id == FTDI_NDI_HUC_PID) ||
- (product_id == FTDI_NDI_SPECTRA_SCU_PID) ||
- (product_id == FTDI_NDI_FUTURE_2_PID) ||
- (product_id == FTDI_NDI_FUTURE_3_PID) ||
- (product_id == FTDI_NDI_AURORA_SCU_PID) ||
- (product_id == FTDI_NDI_EMGUIDE_GEMINI_PID)) &&
- (baud == 19200)) {
+ if (quirk == &ftdi_ndi_quirk && baud == 19200)
baud = 1200000;
- }
div_value = ftdi_232bm_baud_to_divisor(baud);
} else {
dev_dbg(dev, "%s - Baud rate too high!\n", __func__);