mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
tty: serial: imx: Add fast path when rs485 delays are 0
Right now, even when `delay_rts_before_send` and `delay_rts_after_send` are 0, the hrtimer is triggered (with timeout 0) which can introduce a few 100us of additional overhead on slower i.MX platforms. Implement a fast path when the delays are 0, where the RTS signal is toggled immediately instead of going through an hrtimer. This fast path behaves identical to the code before delay support was implemented. Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Harald Seiler <hws@denx.de> Link: https://lore.kernel.org/r/20220119145204.238767-1-hws@denx.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
fcc446c8aa
commit
582e9a24fc
1 changed files with 14 additions and 4 deletions
|
@ -455,9 +455,14 @@ static void imx_uart_stop_tx(struct uart_port *port)
|
|||
if (port->rs485.flags & SER_RS485_ENABLED) {
|
||||
if (sport->tx_state == SEND) {
|
||||
sport->tx_state = WAIT_AFTER_SEND;
|
||||
start_hrtimer_ms(&sport->trigger_stop_tx,
|
||||
|
||||
if (port->rs485.delay_rts_after_send > 0) {
|
||||
start_hrtimer_ms(&sport->trigger_stop_tx,
|
||||
port->rs485.delay_rts_after_send);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/* continue without any delay */
|
||||
}
|
||||
|
||||
if (sport->tx_state == WAIT_AFTER_RTS ||
|
||||
|
@ -698,9 +703,14 @@ static void imx_uart_start_tx(struct uart_port *port)
|
|||
imx_uart_stop_rx(port);
|
||||
|
||||
sport->tx_state = WAIT_AFTER_RTS;
|
||||
start_hrtimer_ms(&sport->trigger_start_tx,
|
||||
|
||||
if (port->rs485.delay_rts_before_send > 0) {
|
||||
start_hrtimer_ms(&sport->trigger_start_tx,
|
||||
port->rs485.delay_rts_before_send);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
/* continue without any delay */
|
||||
}
|
||||
|
||||
if (sport->tx_state == WAIT_AFTER_SEND
|
||||
|
|
Loading…
Add table
Reference in a new issue