Anup Kulkarni
4fcc287f3c
serial: qcom-geni: Enable support for half-duplex mode
...
Enable the use of the RTS pin for direction control in half-duplex modes to
prevent data collisions. Utilize the rs485 structure and callbacks in the
serial core framework to support half-duplex modes. Implement support for
the TIOCSRS485 IOCTL value and the struct serial_rs485.
Signed-off-by: Anup Kulkarni <quic_anupkulk@quicinc.com >
Link: https://lore.kernel.org/r/20250603110145.3835111-1-quic_anupkulk@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-19 13:24:10 +02:00
Jyothi Kumar Seerapu
341a22fa05
serial: qcom-geni: Add support for 8 Mbps baud rate
...
Current GENI UART driver supports Max Baud rate up to 4 Mbps.
Add support to increase maximum baud rate to 8 Mbps.
Signed-off-by: Jyothi Kumar Seerapu <quic_jseerapu@quicinc.com >
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com >
Link: https://lore.kernel.org/r/20250523103721.5042-1-quic_jseerapu@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-19 13:24:07 +02:00
Jiri Slaby (SUSE)
20ca8be9ad
serial: 8250_omap: use uart_port pointer when available
...
There are unnecessary "up->port." accesses on many places in 8250_omap.
"port" is avalable on most places, so instead simply use "port->".
And make port available in omap8250_restore_regs() too. It's used on
many places in there.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250611100319.186924-34-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:37 +02:00
Jiri Slaby (SUSE)
0a6fb2dc93
serial: 8250: use hashtable
...
Instead of open-coding the hash table, use the one provided by
hashtable.h. The semantics is the same, except the code needs not to
compute the hash bucket on its own.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250611100319.186924-33-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:36 +02:00
Jiri Slaby (SUSE)
6529c88f6b
serial: 8250: invert condition to avoid a goto label
...
Use of "goto" in this code is frowned upon:
+-------
|if (port->type == PORT_UNKNOWN)
| goto out_unlock;
|CODE;
|out_unlock:
+-------
Instead, simply do:
+-------
|if (port->type != PORT_UNKNOWN)
| CODE;
+-------
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250611100319.186924-32-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:36 +02:00
Jiri Slaby (SUSE)
05b537a175
serial: 8250: invert serial8250_register_8250_port() CIR condition
...
There is no point in a long 'if' in serial8250_register_8250_port() to
just return ENOSPC for PORT_8250_CIR ports. Invert the condition and
return immediately.
'gpios' variable was moved to its set location.
And return ENODEV instead of ENOSPC. The latter is a leftover from the
previous find-uart 'if'. The former makes a lot more sense in this case.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-31-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:36 +02:00
Jiri Slaby (SUSE)
15c9dc7353
serial: 8250: drop DEBUG_AUTOCONF() macro
...
DEBUG_AUTOCONF() is always disabled (by "#if 0"), so one would need to
recompile the kernel to use it. And even if they did, they would find
out it is broken anyway:
error: variable 'scratch' is used uninitialized whenever 'if' condition is false
Drop it.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-30-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:36 +02:00
Jiri Slaby (SUSE)
8a48517be1
serial: 8250: remove debug prints from ISR
...
These are useless, we have tracing nowadays.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-29-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:36 +02:00
Jiri Slaby (SUSE)
99fc860fae
serial: 8250: extract serial_get_or_create_irq_info()
...
This find-or-create-irq part of the serial_link_irq_chain()'s code is
logically bounded and self-standing. For easier-to-follow code flow,
extract the code to a separate function:
serial_get_or_create_irq_info().
This allows for an easier found-an-irq handling -- simple jump to the
'unlock' label and return. That results in one less 'if' levels.
Note when using guard()s in the upcoming patchset, the label can dropped
altogether.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-28-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:36 +02:00
Jiri Slaby (SUSE)
465fd2fc94
serial: 8250: drop unused frac from serial8250_do_get_divisor()
...
'frac' is not used in the generic implementation of get_divisor. Drop it
from there. (Only some port->get_divisor() compute that and receive it
then to port->set_divisor()).
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-27-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:36 +02:00
Jiri Slaby (SUSE)
590559339f
serial: 8250: lcr compute cleanup
...
* use 'lcr' as variable containing the "computed value" (and not 'cval')
* use 'u8' for the type (and not 'unsigned char')
* drop useless comment
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-26-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:36 +02:00
Jiri Slaby (SUSE)
cdc4a3e0b2
serial: 8250: extract serial8250_set_fcr()
...
serial8250_do_set_termios() consists of many registers and up flags
settings. Extract all these into separate functions. This time, setting
of FCR.
serial8250_do_set_termios() looks sane at this point.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-25-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:36 +02:00
Jiri Slaby (SUSE)
c5d43d6552
serial: 8250: extract serial8250_set_efr()
...
serial8250_do_set_termios() consists of many registers and up flags
settings. Extract all these into separate functions. This time, setting
of EFR for UART_CAP_EFR ports.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250611100319.186924-24-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:35 +02:00
Jiri Slaby (SUSE)
b3be870161
serial: 8250: extract serial8250_set_ier()
...
serial8250_do_set_termios() consists of many registers and up flags
settings. Extract all these into separate functions. This time, setting
of IER.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-23-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:35 +02:00
Jiri Slaby (SUSE)
555ce50f8f
serial: 8250: extract serial8250_set_errors_and_ignores
...
serial8250_do_set_termios() consists of many registers and up flags
settings. Extract all these into separate functions. This time, setting
of ignore_status_mask and read_status_mask.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250611100319.186924-22-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:35 +02:00
Jiri Slaby (SUSE)
3b3d253b65
serial: 8250: extract serial8250_set_afe()
...
serial8250_do_set_termios() consists of many registers and up flags
settings. Extract all these into separate functions. This time, setting
of MCR for UART_CAP_AFE ports.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-21-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:35 +02:00
Jiri Slaby (SUSE)
cc7c9cbef4
serial: 8250: extract serial8250_set_trigger_for_slow_speed()
...
serial8250_do_set_termios() consists of many registers and up flags
settings. Extract all these into separate functions. This time, setting
of trigger level for slow speeds.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-20-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:35 +02:00
Jiri Slaby (SUSE)
0fa5aa0b59
serial: 8250: extract serial8250_set_mini()
...
serial8250_do_set_termios() consists of many registers and up flags
settings. Extract all these into separate functions. This time, setting
of CSIZE for UART_CAP_MINI ports.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-19-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:35 +02:00
Jiri Slaby (SUSE)
aa05931abc
serial: 8250: extract serial8250_clear_interrupts()
...
On three places in 8250_port.c, the interrupts are cleared by reading 4
registers. Extract this to a separate function:
serial8250_clear_interrupts(). And call it from all the places.
Note autoconfig_irq() now uses serial_port_in() instead of serial_in().
But they are the same, in fact (modulo parameter).
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-18-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:35 +02:00
Jiri Slaby (SUSE)
795158691c
serial: 8250: extract serial8250_initialize()
...
serial8250_do_startup() initializes the ports in the middle of the
function. This code can be separated to serial8250_initialize(), so that
serial8250_do_startup() can be readable again.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250611100319.186924-17-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:35 +02:00
Jiri Slaby (SUSE)
a194597c0c
serial: 8250: extract serial8250_THRE_test()
...
serial8250_do_startup() contains a stand-alone code for probing THRE.
Furthermore, the code block is conditional (port->irq and test for
UPF_NO_THRE_TEST).
Move this code to a separate function. The conditional can be evaluated
easier there -- by a simple return in the beginning. So the indentation
level lowers and the code is overall more readable now.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250611100319.186924-16-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:35 +02:00
Jiri Slaby (SUSE)
cc852682f2
serial: 8250: extract serial8250_set_TRG_levels()
...
serial8250_do_startup() contains peculiar trigger levels setup for
special ports (16850, ALTR_16550_*). Move this away to a separate
function: serial8250_set_TRG_levels().
And use switch-case instead of 'if's.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-15-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:34 +02:00
Jiri Slaby (SUSE)
75f8abe8be
serial: 8250: extract serial8250_startup_special()
...
Let the serial8250_do_startup() code handle the special ports (16C950,
DA830, RSA) startup in a separate function:
serial8250_startup_special().
And instead of multiple if-else-if, use switch-case. So that it can be
easily checked for PORT_RSA now too.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-14-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:34 +02:00
Jiri Slaby (SUSE)
5a128fb475
serial: 8250: move RSA functions to 8250_rsa.c
...
They are RSA-specific, so should live in a preexisting 8250_rsa.c. Move
them there.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-13-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:34 +02:00
Jiri Slaby (SUSE)
8725679fc4
serial: 8250: put RSA functions to their namespace
...
Prefix the functions with rsa_, not suffix.
This is a preparation for moving them out to 8250_rsa.c in the next
patch.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-12-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:34 +02:00
Jiri Slaby (SUSE)
a1efa7f624
serial: 8250: invert conditions in RSA functions
...
The code can short-return in case something does not hold. So invert the
conditions and return in those cases immediately. This makes the code
flow more natural and less nested.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-11-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:34 +02:00
Jiri Slaby (SUSE)
33d9ca5daa
serial: 8250: remove CONFIG_SERIAL_8250_RSA inline macros from code
...
All these:
#ifdef CONFIG_SERIAL_8250_RSA
...
#endif
in the 8250 generic code distract the reader. Introduce empty inlines to
handle the !CONFIG_SERIAL_8250_RSA case and handle the '#if's around the
RSA functions definitions.
This means rsa_autoconfig() and rsa_reset() functions were introduced to
contain the particular code.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-10-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:34 +02:00
Jiri Slaby (SUSE)
fc9ceb501e
serial: 8250: sanitize uart_port::serial_{in,out}() types
...
uart_port::{serial_in,serial_out} (and plat_serial8250_port::* likewise)
historically use:
* 'unsigned int' for 32-bit register values in reads and writes, and
* 'int' for offsets.
Make them sane such that:
* 'u32' is used for register values, and
* 'unsigned int' is used for offsets.
While at it, name hooks' parameters, so it is clear what is what.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Cc: Madhavan Srinivasan <maddy@linux.ibm.com >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Nicholas Piggin <npiggin@gmail.com >
Cc: Christophe Leroy <christophe.leroy@csgroup.eu >
Cc: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Cc: Paul Cercueil <paul@crapouillou.net >
Cc: Vladimir Zapolskiy <vz@mleia.com >
Cc: Kunihiko Hayashi <hayashi.kunihiko@socionext.com >
Cc: Masami Hiramatsu <mhiramat@kernel.org >
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-9-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:34 +02:00
Jiri Slaby (SUSE)
2b5eac0f8c
tty: introduce and use tty_port_tty_vhangup() helper
...
This code (tty_get -> vhangup -> tty_put) is repeated on few places.
Introduce a helper similar to tty_port_tty_hangup() (asynchronous) to
handle even vhangup (synchronous).
And use it on those places.
In fact, reuse the tty_port_tty_hangup()'s code and call tty_vhangup()
depending on a new bool parameter.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Cc: Karsten Keil <isdn@linux-pingi.de >
Cc: David Lin <dtwlin@gmail.com >
Cc: Johan Hovold <johan@kernel.org >
Cc: Alex Elder <elder@kernel.org >
Cc: Oliver Neukum <oneukum@suse.com >
Cc: Marcel Holtmann <marcel@holtmann.org >
Cc: Johan Hedberg <johan.hedberg@gmail.com >
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20250611100319.186924-2-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-06-17 13:42:33 +02:00
Ingo Molnar
41cb08555c
treewide, timers: Rename from_timer() to timer_container_of()
...
Move this API to the canonical timer_*() namespace.
[ tglx: Redone against pre rc1 ]
Signed-off-by: Ingo Molnar <mingo@kernel.org >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Link: https://lore.kernel.org/all/aB2X0jCKQO56WdMt@gmail.com
2025-06-08 09:07:37 +02:00
Jiri Slaby (SUSE)
b495021a97
tty: serial: 8250_omap: fix TX with DMA for am33xx
...
Commit 1788cf6a91 ("tty: serial: switch from circ_buf to kfifo")
introduced an error in the TX DMA handling for 8250_omap.
When the OMAP_DMA_TX_KICK flag is set, the "skip_byte" is pulled from
the kfifo and emitted directly in order to start the DMA. While the
kfifo is updated, dma->tx_size is not decreased. This leads to
uart_xmit_advance() called in omap_8250_dma_tx_complete() advancing the
kfifo by one too much.
In practice, transmitting N bytes has been seen to result in the last
N-1 bytes being sent repeatedly.
This change fixes the problem by moving all of the dma setup after the
OMAP_DMA_TX_KICK handling and using kfifo_len() instead of the DMA size
for the 4-byte cutoff check. This slightly changes the behaviour at
buffer wraparound, but it still transmits the correct bytes somehow.
Now, the "skip_byte" would no longer be accounted to the stats. As
previously, dma->tx_size included also this skip byte, up->icount.tx was
updated by aforementioned uart_xmit_advance() in
omap_8250_dma_tx_complete(). Fix this by using the uart_fifo_out()
helper instead of bare kfifo_get().
Based on patch by Mans Rullgard <mans@mansr.com >
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org >
Fixes: 1788cf6a91 ("tty: serial: switch from circ_buf to kfifo")
Link: https://lore.kernel.org/all/20250506150748.3162-1-mans@mansr.com/
Reported-by: Mans Rullgard <mans@mansr.com >
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250522053835.3495975-1-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-22 07:50:45 +02:00
Nicolas Pitre
81cf4d7d23
vt: add VT_GETCONSIZECSRPOS to retrieve console size and cursor position
...
The console dimension and cursor position are available through the
/dev/vcsa interface already. However the /dev/vcsa header format uses
single-byte fields therefore those values are clamped to 255.
As surprizing as this may seem, some people do use 240-column 67-row
screens (a 1920x1080 monitor with 8x16 pixel fonts) which is getting
close to the limit. Monitors with higher resolution are not uncommon
these days (3840x2160 producing a 480x135 character display) and it is
just a matter of time before someone with, say, a braille display using
the Linux VT console and BRLTTY on such a screen reports a bug about
missing and oddly misaligned screen content.
Let's add VT_GETCONSIZECSRPOS for the retrieval of console size and cursor
position without byte-sized limitations. The actual console size limit as
encoded in vt.c is 32767x32767 so using a short here is appropriate. Then
this can be used to get the cursor position when /dev/vcsa reports 255.
The screen dimension may already be obtained using TIOCGWINSZ and adding
the same information to VT_GETCONSIZECSRPOS might be redundant. However
applications that care about cursor position also care about display
size and having 2 separate system calls to obtain them separately is
wasteful. Also, the cursor position can be queried by writing "\e[6n" to
a tty and reading back the result but that may be done only by the actual
application using that tty and not a sideline observer.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Link: https://lore.kernel.org/r/20250520171851.1219676-3-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:41:03 +02:00
Nicolas Pitre
80fa7a0337
vt: bracketed paste support
...
This is comprised of 3 aspects:
- Take note of when applications advertise bracketed paste support via
"\e[?2004h" and "\e[?2004l".
- Insert bracketed paste markers ("\e[200~" and "\e[201~") around pasted
content in paste_selection() when bracketed paste is active.
- Add TIOCL_GETBRACKETEDPASTE to return bracketed paste status so user
space daemons implementing cut-and-paste functionality (e.g. gpm,
BRLTTY) may know when to insert bracketed paste markers.
Link: https://en.wikipedia.org/wiki/Bracketed-paste
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250520171851.1219676-2-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:41:03 +02:00
Nicolas Pitre
c4c7ead7b8
vt: remove VT_RESIZE and VT_RESIZEX from vt_compat_ioctl()
...
They are listed amon those cmd values that "treat 'arg' as an integer"
which is wrong. They should instead fall into the default case. Probably
nobody ever relied on that code since 2009 but still.
Fixes: e92166517e ("tty: handle VT specific compat ioctls in vt driver")
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/pr214s15-36r8-6732-2pop-159nq85o48r7@syhkavp.arg
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:40:05 +02:00
Nicolas Pitre
63f0d28dca
vt: process the full-width ASCII fallback range programmatically
...
This shaves about 170 bytes from ucs.o.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Link: https://lore.kernel.org/r/20250507141535.40655-9-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:39:45 +02:00
Nicolas Pitre
6802f3591f
vt: make use of ucs_get_fallback() when glyph is unavailable
...
Attempt to display a fallback character when given character doesn't
have an available glyph. The substitution may not be as good as the
original character but still way more helpful than a squared question
mark.
Example substitutions: À -> A, ç -> c, ø -> o, ─ -> -, © -> C, etc.
See gen_ucs_fallback_table.py for a comprehensive list.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Link: https://lore.kernel.org/r/20250507141535.40655-8-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:39:45 +02:00
Nicolas Pitre
fe26933cf1
vt: add ucs_get_fallback()
...
This is the code querying the newly introduced tables.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Link: https://lore.kernel.org/r/20250507141535.40655-7-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:39:45 +02:00
Nicolas Pitre
de45d93f00
vt: create ucs_fallback_table.h_shipped with gen_ucs_fallback_table.py
...
The generated table maps complex characters to their simpler fallback
forms for a terminal display when corresponding glyphs are unavailable.
A page-based approach is used to reduce compiled binary footprint.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Link: https://lore.kernel.org/r/20250507141535.40655-6-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:39:45 +02:00
Nicolas Pitre
5071ddc18e
vt: introduce gen_ucs_fallback_table.py to create ucs_fallback_table.h
...
The generated table maps complex characters to their simpler fallback
forms for a terminal display when corresponding glyphs are unavailable.
This includes diacritics, symbols as well as many drawing characters.
Fallback characters aren't perfect replacements, obviously. But they are
still far more useful than a bunch of squared question marks.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250507141535.40655-5-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:39:45 +02:00
Nicolas Pitre
bb9a151676
vt: move glyph determination to a separate function
...
No logical changes. Make it easier for enhancements to come.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Link: https://lore.kernel.org/r/20250507141535.40655-4-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:39:45 +02:00
Nicolas Pitre
68e7a421ab
vt: make sure displayed double-width characters are remembered as such
...
And to do so we ensure the Unicode screen buffer is initialized when
double-width characters are encountered.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Link: https://lore.kernel.org/r/20250507141535.40655-3-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:39:45 +02:00
Nicolas Pitre
a16014c0db
vt: ucs.c: fix misappropriate in_range() usage
...
The in_range() helper accepts a start and a length, not a start and
an end.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250507141535.40655-2-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:39:45 +02:00
Kuan-Wei Chiu
063a896456
serial: max3100: Replace open-coded parity calculation with parity8()
...
Refactor parity calculations to use the standard parity8() helper.
This change eliminates redundant implementations.
Co-developed-by: Yu-Chun Lin <eleanor15x@gmail.com >
Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com >
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com >
Link: https://lore.kernel.org/r/20250515081311.775559-1-visitorckw@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:37:22 +02:00
Dustin Lundquist
e3975aa899
serial: jsm: fix NPE during jsm_uart_port_init
...
No device was set which caused serial_base_ctrl_add to crash.
BUG: kernel NULL pointer dereference, address: 0000000000000050
Oops: Oops: 0000 [#1 ] PREEMPT SMP NOPTI
CPU: 16 UID: 0 PID: 368 Comm: (udev-worker) Not tainted 6.12.25-amd64 #1 Debian 6.12.25-1
RIP: 0010:serial_base_ctrl_add+0x96/0x120
Call Trace:
<TASK>
serial_core_register_port+0x1a0/0x580
? __setup_irq+0x39c/0x660
? __kmalloc_cache_noprof+0x111/0x310
jsm_uart_port_init+0xe8/0x180 [jsm]
jsm_probe_one+0x1f4/0x410 [jsm]
local_pci_probe+0x42/0x90
pci_device_probe+0x22f/0x270
really_probe+0xdb/0x340
? pm_runtime_barrier+0x54/0x90
? __pfx___driver_attach+0x10/0x10
__driver_probe_device+0x78/0x110
driver_probe_device+0x1f/0xa0
__driver_attach+0xba/0x1c0
bus_for_each_dev+0x8c/0xe0
bus_add_driver+0x112/0x1f0
driver_register+0x72/0xd0
jsm_init_module+0x36/0xff0 [jsm]
? __pfx_jsm_init_module+0x10/0x10 [jsm]
do_one_initcall+0x58/0x310
do_init_module+0x60/0x230
Tested with Digi Neo PCIe 8 port card.
Fixes: 84a9582fd2 ("serial: core: Start managing serial controllers to enable runtime PM")
Cc: stable <stable@kernel.org >
Signed-off-by: Dustin Lundquist <dustin@null-ptr.net >
Link: https://lore.kernel.org/r/3f31d4f75863614655c4673027a208be78d022ec.camel@null-ptr.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-21 13:35:58 +02:00
Bartosz Golaszewski
5ee558c5d9
vt: add new dynamically generated files to .gitignore
...
Add new dynamically generated headers to the local .gitignore.
Fixes: c2d2c5c0d6 ("vt: move UCS tables to the "shipped" form")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org >
Reviewed-by: Nicolas Pitre <npitre@baylibre.com >
Link: https://lore.kernel.org/r/20250430122917.72105-1-brgl@bgdev.pl
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-01 17:34:35 +02:00
Zijun Hu
a883620602
serdev: Refine several error or debug messages
...
Refine several dev_err() and dev_dbg() messages to solve:
// hardcoded device name
dev_dbg(dev, "...dev_name_str...")
// repeated device name since dev_dbg() also prints it as prefix
dev_err(dev, "...%s...", dev_name(dev))
// not concise as dev_err(dev, "...%d...", err)
dev_err(dev, "...%pe...", ERR_PTR(err))
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com >
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250425-fix_serdev-v3-1-2e4ea8261640@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-01 17:20:49 +02:00
Rengarajan S
c40b91e38e
8250: microchip: pci1xxxx: Add PCIe Hot reset disable support for Rev C0 and later devices
...
Systems that issue PCIe hot reset requests during a suspend/resume
cycle cause PCI1XXXX device revisions prior to C0 to get its UART
configuration registers reset to hardware default values. This results
in device inaccessibility and data transfer failures. Starting with
Revision C0, support was added in the device hardware (via the Hot
Reset Disable Bit) to allow resetting only the PCIe interface and its
associated logic, but preserving the UART configuration during a hot
reset. This patch enables the hot reset disable feature during suspend/
resume for C0 and later revisions of the device.
Signed-off-by: Rengarajan S <rengarajan.s@microchip.com >
Reviewed-by: Jiri Slaby <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250425145500.29036-1-rengarajan.s@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-01 17:20:33 +02:00
Faraz Ata
f51159c051
tty: serial: samsung_tty: support 18 uart ports
...
ExynosAutov920 SoC supports 18 UART ports, update
the value of UART_NR to accommodate the same.
Signed-off-by: Faraz Ata <faraz.ata@samsung.com >
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org >
Link: https://lore.kernel.org/r/20250429102941.4138463-1-faraz.ata@samsung.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-05-01 17:20:27 +02:00
Greg Kroah-Hartman
689835c00e
Merge 6.15-rc4 into tty-next
...
We need the tty/serial fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-04-28 10:13:28 +02:00
Nicolas Pitre
c2d2c5c0d6
vt: move UCS tables to the "shipped" form
...
Use the "shipped" mechanism to copy pre-generated tables to the build
tree by default. If GENERATE_UCS_TABLES=1 then they are generated at
build time instead. If GENERATE_UCS_TABLES=2 then
gen_ucs_recompose_table.py is invoked with --full.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com >
Suggested-by: Jiri Slaby <jirislaby@kernel.org >
Link: https://lore.kernel.org/r/20250417184849.475581-15-nico@fluxnic.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2025-04-26 11:22:04 +02:00