summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tty: serial: 8250: add DFL bus driver for Altera 16550.Matthew Gerlach2023-01-193-0/+180
| | | | | | | | | | | | Add a Device Feature List (DFL) bus driver for the Altera 16550 implementation of UART. Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Marco Pagani <marpagan@redhat.com> Link: https://lore.kernel.org/r/20230115151447.1353428-5-matthew.gerlach@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* fpga: dfl: add basic support for DFHv1Matthew Gerlach2023-01-193-51/+213
| | | | | | | | | | | | | | | | | | | Version 1 of the Device Feature Header (DFH) definition adds functionality to the Device Feature List (DFL) bus. A DFHv1 header may have one or more parameter blocks that further describes the HW to SW. Add support to the DFL bus to parse the MSI-X parameter. The location of a feature's register set is explicitly described in DFHv1 and can be relative to the base of the DFHv1 or an absolute address. Parse the location and pass the information to DFL driver. Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230115151447.1353428-4-matthew.gerlach@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* fpga: dfl: Add DFHv1 Register DefinitionsBasheer Ahmed Muddebihal2023-01-191-0/+32
| | | | | | | | | | | | | This patch adds the definitions for DFHv1 header and related register bitfields. Signed-off-by: Basheer Ahmed Muddebihal <basheer.ahmed.muddebihal@linux.intel.com> Co-developed-by: Matthew Gerlach <matthew.gerlach@linux.intel.com> Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230115151447.1353428-3-matthew.gerlach@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Documentation: fpga: dfl: Add documentation for DFHv1Matthew Gerlach2023-01-191-0/+119
| | | | | | | | | | | Add documentation describing the extensions provided by Version 1 of the Device Feature Header (DFHv1). Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Tom Rix <trix@redhat.com> Link: https://lore.kernel.org/r/20230115151447.1353428-2-matthew.gerlach@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: moxa: Rename dtr/rts parameters/variables to activeIlpo Järvinen2023-01-191-26/+26
| | | | | | | | | Use active consistently for naming parameters and variables. Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-13-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Call ->dtr_rts() parameter active consistentlyIlpo Järvinen2023-01-1912-28/+28
| | | | | | | | | | | Convert various parameter names for ->dtr_rts() and related functions from onoff, on, and raise to active. Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-12-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Return bool from tty_termios_hw_change()Ilpo Järvinen2023-01-192-5/+5
| | | | | | | | | | Change tty_termios_hw_change() to return bool. Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Reviewed-by: Johan Hovold <johan@kernel.org> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-11-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: Make uart_handle_cts_change() status param bool activeIlpo Järvinen2023-01-195-10/+8
| | | | | | | | | | | | | | | | Convert uart_handle_cts_change() to bool which is more appropriate than unsigned int. Rename status to active to better describe what the parameter means. While at it, make the comment about the active parameter easier to parse. Cleanup callsites from operations that are not necessary with bool. Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-10-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty/serial: Make ->dcd_change()+uart_handle_dcd_change() status bool activeIlpo Järvinen2023-01-195-15/+14
| | | | | | | | | | | | | | Convert status parameter for ->dcd_change() and uart_handle_dcd_change() to bool which matches to how the parameter is used. Rename status to active to better describe what the parameter means. Acked-by: Rodolfo Giometti <giometti@enneenne.com> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-9-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Convert ->dtr_rts() to take bool argumentIlpo Järvinen2023-01-1916-50/+52
| | | | | | | | | | | | | | | | Convert the raise/on parameter in ->dtr_rts() to bool through the callchain. The parameter is used like bool. In USB serial, there remains a few implicit bool -> larger type conversions because some devices use u8 in their control messages. In moxa_tiocmget(), dtr variable was reused for line status which requires int so use a separate variable for status. Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-8-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Convert ->carrier_raised() and callchains to boolIlpo Järvinen2023-01-1912-34/+32
| | | | | | | | | | | | | | | | | | | | | | | Return boolean from ->carrier_raised() instead of 0 and 1. Make the return type change also to tty_port_carrier_raised() that makes the ->carrier_raised() call (+ cd variable in moxa into which its return value is stored). Also cleans up a few unnecessary constructs related to this change: return xx ? 1 : 0; -> return xx; if (xx) return 1; return 0; -> return xx; Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-7-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: Convert uart_{,port_}startup() init_hw param to boolIlpo Järvinen2023-01-191-5/+5
| | | | | | | | | | Convert init_hw parameter in uart_startup() and uart_port_startup() to bool as code treats them like bool. Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-6-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: moxa: Make local var storing tty_port_initialized() boolIlpo Järvinen2023-01-191-1/+1
| | | | | | | | | | | | Return type of tty_port_initialized() is bool, use matching type for the local variable. Also reorder the local vars to reverse-xmas-tree while at it. Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-5-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Cleanup tty_port_set_active() bool parameterIlpo Järvinen2023-01-194-11/+11
| | | | | | | | | Make callers pass true/false consistently for bool val. Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-4-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Cleamup tty_port_set_suspended() bool parameterIlpo Järvinen2023-01-191-4/+4
| | | | | | | | | Make callers pass true/false consistently for bool val. Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-3-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Cleanup tty_port_set_initialized() bool parameterIlpo Järvinen2023-01-1911-20/+20
| | | | | | | | | | Make callers pass true/false consistently for bool val. Reviewed-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230117090358.4796-2-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: pic32: Add checks for devm_clk_get() in pic32_uart_probe()Yuan Can2023-01-191-0/+2
| | | | | | | | | As the devm_clk_get() may return ERR_PTR, its return value needs to be checked to avoid invalid poineter dereference. Signed-off-by: Yuan Can <yuancan@huawei.com> Link: https://lore.kernel.org/r/20221125093832.33386-1-yuancan@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: stm32: Add support for rs485 RX_DURING_TX output GPIOChristoph Niedermaier2023-01-191-1/+5
| | | | | | | | | | | If a RX_DURING_TX GPIO is defined by the DT property "rs485-rx-during-tx-gpios" this patch switches this GPIO accordingly to the RS485 flag RX_DURING_TX in user space. Controlled by this GPIO, now the hardware is responsible for connecting or disconnecting RX during TX. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> Link: https://lore.kernel.org/r/20221202104127.122761-4-cniedermaier@dh-electronics.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: imx: Add support for RS485 RX_DURING_TX output GPIOChristoph Niedermaier2023-01-191-2/+8
| | | | | | | | | | | | If a RX_DURING_TX GPIO is defined by the DT property "rs485-rx-during-tx-gpios" this patch switches this GPIO accordingly to the RS485 flag RX_DURING_TX in user space. In addition, the i.MX UART receiver is no longer turned on and off during sending, because now the hardware is responsible for connecting or disconnecting RX during TX controlled by this GPIO. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> Link: https://lore.kernel.org/r/20221202104127.122761-3-cniedermaier@dh-electronics.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: core: Add option to output RS485 RX_DURING_TX state via GPIOChristoph Niedermaier2023-01-192-0/+13
| | | | | | | | | | | This patch provides a generic GPIO variable for outputting the state of RS485 RX_DURING_TX. The GPIO is defined by the devicetree property "rs485-rx-during-tx-gpios". To use it in a low level serial driver, the evaluation of this variable must be implemented there accordingly. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> Link: https://lore.kernel.org/r/20221202104127.122761-2-cniedermaier@dh-electronics.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* dt-bindings: serial: rs485: Add GPIO controlling RX enable during TXChristoph Niedermaier2023-01-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a binding for a generic definition of an output GPIO that sets the state of rs485-rx-during-tx. The idea is that the hardware already controls the option receiving during sending before it gets to the signal receiving hardware. The standard RS485 is a half-duplex bus that in most cases is driven by an UART controller. The advantage of using this GPIO is that it is independent of the capabilities of the UART core and the UART driver. On the hardware side the interface to the bus is controlled by a transceiver, that has a pin called RE (RX Enable) or similar, which connects the bus to the RX signal of the UART controller. The GPIO can switch between two states to control the RE pin via an electrical circuit: - Active: The RE pin is always active. The UART RX see everything on the bus and therefore also what happens with the TX signal on the bus. - Inactive: The RE pin is always active, but during sending on the bus the pin RE is inactive. So basically the receiving during sending is suppressed. A possible circuit diagram could look like this: ┌──────────────────┐ │ RS485 │ TX ───────────────┤D │ │ Transceiver │ RTS ────┬──────────┤DE │ │ │ │ │ ┌─────┐ │ │ └─┤& │ │ │ │ ├──┤!RE │ !rx_during_tx_gpio ──────┤ │ │ │ └─────┘ │ │ │ │ RX ───────────────┤R │ │ │ └──────────────────┘ Here the RTS pin of the UART core is used to control TX via the transceiver pin DE (Drive Enable). RE and rx_during_tx_gpio are active low. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20221202104127.122761-1-cniedermaier@dh-electronics.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: tegra: Add missing clk_disable_unprepare() in tegra_uart_hw_init()Yi Yang2023-01-191-1/+6
| | | | | | | | | | | | | Add the missing clk_disable_unprepare() before return from tegra_uart_hw_init() in the error handling path. When request_irq() fails in tegra_uart_startup(), 'tup->uart_clk' has been enabled, fix it by adding clk_disable_unprepare(). Fixes: cc9ca4d95846 ("serial: tegra: Only print FIFO error message when an error occurs") Fixes: d781ec21bae6 ("serial: tegra: report clk rate errors") Signed-off-by: Yi Yang <yiyang13@huawei.com> Link: https://lore.kernel.org/r/20221126020852.113378-1-yiyang13@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: sc16is7xx: setup GPIO controller later in probeIsaac True2023-01-191-25/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GPIO controller component of the sc16is7xx driver is setup too early, which can result in a race condition where another device tries to utilise the GPIO lines before the sc16is7xx device has finished initialising. This issue manifests itself as an Oops when the GPIO lines are configured: Unable to handle kernel read from unreadable memory at virtual address ... pc : sc16is7xx_gpio_direction_output+0x68/0x108 [sc16is7xx] lr : sc16is7xx_gpio_direction_output+0x4c/0x108 [sc16is7xx] ... Call trace: sc16is7xx_gpio_direction_output+0x68/0x108 [sc16is7xx] gpiod_direction_output_raw_commit+0x64/0x318 gpiod_direction_output+0xb0/0x170 create_gpio_led+0xec/0x198 gpio_led_probe+0x16c/0x4f0 platform_drv_probe+0x5c/0xb0 really_probe+0xe8/0x448 driver_probe_device+0xe8/0x138 __device_attach_driver+0x94/0x118 bus_for_each_drv+0x8c/0xe0 __device_attach+0x100/0x1b8 device_initial_probe+0x28/0x38 bus_probe_device+0xa4/0xb0 deferred_probe_work_func+0x90/0xe0 process_one_work+0x1c4/0x480 worker_thread+0x54/0x430 kthread+0x138/0x150 ret_from_fork+0x10/0x1c This patch moves the setup of the GPIO controller functions to later in the probe function, ensuring the sc16is7xx device has already finished initialising by the time other devices try to make use of the GPIO lines. The error handling has also been reordered to reflect the new initialisation order. Co-developed-by: Wen-chien Jesse Sung <jesse.sung@canonical.com> Signed-off-by: Wen-chien Jesse Sung <jesse.sung@canonical.com> Signed-off-by: Isaac True <isaac.true@canonical.com> Link: https://lore.kernel.org/r/20221130105529.698385-1-isaac.true@canonical.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: msm: add lock annotation to msm_set_baud_rate()Krzysztof Kozlowski2023-01-191-0/+1
| | | | | | | | | msm_set_baud_rate() releases and re-acquires the port->lock, thus add lock annotation for Sparse static code checks. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230109152212.343476-1-krzysztof.kozlowski@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: sccnxp: Use devm_clk_get_enabled() helperChristophe JAILLET2023-01-191-11/+1
| | | | | | | | | | | | | | | | The devm_clk_get_enabled() helper: - calls devm_clk_get() - calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code. This also avoids some other warnings/issues. (see [1]) [1]: https://lore.kernel.org/all/20221118233101.never.215-kees@kernel.org/ Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/735a807c2df835aa436dcbc76b374f983f89a9af.1672419577.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: ucc_uart: Add of_node_put() in ucc_uart_remove()Liang He2023-01-191-0/+2
| | | | | | | | | In ucc_uart_probe(), we have added proper of_node_put() in the failure paths. However, we miss it before we free *qe_port* in the remove() function. Signed-off-by: Liang He <windhl@126.com> Link: https://lore.kernel.org/r/20221205085437.1163682-1-windhl@126.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: add support for serial engine DMABartosz Golaszewski2023-01-191-59/+255
| | | | | | | | | | | | | The qcom-geni-serial driver currently only works in SE FIFO mode. This limits the UART speed to around 180 kB/s. In order to achieve higher speeds we need to use SE DMA mode. Keep the console port working in FIFO mode but extend the code to use DMA for the high-speed port. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-15-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* soc: qcom-geni-se: add more symbol definitionsBartosz Golaszewski2023-01-191-0/+3
| | | | | | | | | | The following symbols will be used when adding support for SE DMA in the qcom geni serial driver. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-14-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: use of_device_id dataBartosz Golaszewski2023-01-191-12/+34
| | | | | | | | | | | Instead of checking the device compatible in probe(), assign the device-specific data to struct of_device_id. We'll use it later when providing SE DMA support. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-13-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: drop the return value from handle_rxBartosz Golaszewski2023-01-191-8/+6
| | | | | | | | | The return value of the handle_rx() callback is never checked. Drop it. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-12-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: refactor qcom_geni_serial_send_chunk_fifo()Bartosz Golaszewski2023-01-191-18/+10
| | | | | | | | | | Shuffle the code a bit, drop unneeded variables, make types of others more consistent and use uart_xmit_advance() instead of handling tail->xmit manually. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-11-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: split out the FIFO tx codeBartosz Golaszewski2023-01-191-27/+33
| | | | | | | | | | qcom_geni_serial_handle_tx() is pretty big, let's move the code that handles the actual writing of data to a separate function which makes sense in preparation for introducing a dma variant of handle_tx(). Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-10-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: remove unneeded tabsBartosz Golaszewski2023-01-191-12/+12
| | | | | | | | | Remove redundant indentation in struct member assignment. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-9-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: refactor qcom_geni_serial_isr()Bartosz Golaszewski2023-01-191-6/+4
| | | | | | | | | | Simplify the conditions in qcom_geni_serial_isr() and fix indentation. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20221229155030.418800-8-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: remove stray newlinesBartosz Golaszewski2023-01-191-2/+0
| | | | | | | | | | Remove stray newlines around #ifdefs for consistency with the rest of the driver code. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-7-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: improve the to_dev_port() macroBartosz Golaszewski2023-01-191-17/+19
| | | | | | | | | | | | The member we want to resolve in struct qcom_geni_serial_port is called uport so we don't need an additional redundant parameter in this macro. While at it: turn the macro into a static inline function. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-6-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: align #define valuesBartosz Golaszewski2023-01-191-31/+31
| | | | | | | | | Keep the #define symbols aligned for better readability. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-5-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: remove unused symbolsBartosz Golaszewski2023-01-191-15/+0
| | | | | | | | | Drop all unused symbols from the driver. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-4-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: drop unneeded forward definitionsBartosz Golaszewski2023-01-191-42/+37
| | | | | | | | | | If we shuffle the code a bit, we can drop all forward definitions of various static functions. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-3-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: qcom-geni-serial: stop operations in progress at shutdownBartosz Golaszewski2023-01-191-0/+2
| | | | | | | | | | | | We don't stop transmissions in progress at shutdown. This is fine with FIFO SE mode but with DMA (support for which we'll introduce later) it causes trouble so fix it now. Fixes: e83766334f96 ("tty: serial: qcom_geni_serial: No need to stop tx/rx on UART shutdown") Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20221229155030.418800-2-brgl@bgdev.pl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt: cache row count in con_scroll()Jiri Slaby (SUSE)2023-01-191-3/+4
| | | | | | | | | | It's used on few places, so make the code easier to follow by caching the subtraction result. 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/20230112080136.4929-11-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt: saner names for more scroll variablesJiri Slaby (SUSE)2023-01-191-18/+22
| | | | | | | | | | Rename more variables (t, b, s, d) -> (top, bottom, src, dst) to make them more obvious. 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/20230112080136.4929-10-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt: separate array juggling to juggle_array()Jiri Slaby (SUSE)2023-01-191-24/+28
| | | | | | | | | | | | | | | | | The algorithm used for scrolling is the array juggling. It has complexity O(N) and space complexity O(1). I.e. quite fast w/o requirements for temporary storage. Move the algorithm to a separate function so it is obvious what it is. It is almost generic (except the array type), so if anyone else wants array rotation, feel free to make it generic and move it to include/. And rename all the variables from i, j, k, sz, d, and so on to something saner. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20230112080136.4929-9-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt: simplify some unicode conditionsJiri Slaby (SUSE)2023-01-191-49/+36
| | | | | | | | | | | | | After previous patches, we can simply test vc->vc_uni_lines, so do so in many unicode functions. This makes the code more compact. And even use if (!) return; in vc_uniscr_scroll(), so that the whole code is indented on the left. 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/20230112080136.4929-8-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt: replace BUG_ON() by WARN_ON_ONCE()Jiri Slaby (SUSE)2023-01-191-1/+2
| | | | | | | | | | | | | | No need to panic in vc_uniscr_copy_line(), just warn. This should never happen though, as vc_uniscr_check() is supposed to be called before vc_uniscr_copy_line(). And the former checks vc->vc_uni_lines already. In any case, use _ONCE as vc_uniscr_copy_line() is called repeatedly for each line. So don't flood the logs, just in 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/20230112080136.4929-7-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt: remove struct uni_screenJiri Slaby (SUSE)2023-01-192-61/+59
| | | | | | | | | | | | | It contains only lines with pointers to characters (u32s). So use simple clear 'u32 **lines' all over the code. This avoids zero-length arrays. It also makes the allocation less error-prone (size of the struct wasn't taken into account at all). 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/20230112080136.4929-6-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt: remove char32_t typedefJiri Slaby (SUSE)2023-01-191-14/+12
| | | | | | | | | | It boils down to uint32_t, so use u32 directly, instead. This makes the code more obvious. 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/20230112080136.4929-5-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt: use sizeof(*variable) where possibleJiri Slaby (SUSE)2023-01-191-5/+5
| | | | | | | | | | Instead of sizeof(type), use sizeof(*variable) which is preferred. We are going to remove the unicode's char32_t typedef, so this makes the switch easier. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20230112080136.4929-4-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt: remove reference to undefined NO_VC_UNI_SCREENJiri Slaby (SUSE)2023-01-191-3/+0
| | | | | | | | | NO_VC_UNI_SCREEN is defined nowhere. Remove the last reference to 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/20230112080136.4929-3-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt: drop get_vc_uniscr()Jiri Slaby (SUSE)2023-01-191-17/+10
| | | | | | | | | | | Its definition depends on the NO_VC_UNI_SCREEN macro. But that is never defined, so remove all this completely. I.e. expand the macro to vc->vc_uni_screen everywhere. 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/20230112080136.4929-2-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>