diff mbox series

[v2] Bluetooth: hci_ldisc: Use speed set by btattach as oper_speed

Message ID 20240820141716.288862-1-frederic.danis@collabora.com
State Accepted
Commit a438b10b0c27d5df6fe9ad0fee38968ffe1f27f9
Headers show
Series [v2] Bluetooth: hci_ldisc: Use speed set by btattach as oper_speed | expand

Commit Message

Frédéric Danis Aug. 20, 2024, 2:17 p.m. UTC
Starting a BCM UART controller not defined as a platform device or
a serdev with "btattach -B /dev/ttyS1 -P bcm -S 3000000" works fine
but the serial port remains at the init_speed, i.e. 115200.

The oper_speed is only set if a device is declared in ACPI, device
tree or as a platform device.

This commit copies the serial port speed fixed by hciattach to the
oper_speed on line discipline opening.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
---
This has been tested with 5.4 kernel only.
Afaict there's no change in this driver which should be impacted by
this commit in latest kernel.

v1 -> v2: Move speed copy from hci_bcm driver to hci_ldisc to be
          more generic

 drivers/bluetooth/hci_ldisc.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index d307c41a5470..395d66e32a2e 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -507,6 +507,9 @@  static int hci_uart_tty_open(struct tty_struct *tty)
 	hu->alignment = 1;
 	hu->padding = 0;
 
+	/* Use serial port speed as oper_speed */
+	hu->oper_speed = tty->termios.c_ospeed;
+
 	INIT_WORK(&hu->init_ready, hci_uart_init_work);
 	INIT_WORK(&hu->write_work, hci_uart_write_work);