Commit eb173809 authored by Loic Poulain's avatar Loic Poulain Committed by Marcel Holtmann

Bluetooth: hci_uart: Add setup callback

Some Bluetooth controllers require initialization before being
used (vendor config, firmware download). Add possibility for a
HCI UART proto to implement this early init via the setup callback.
Signed-off-by: default avatarLoic Poulain <loic.poulain@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 99c679ac
...@@ -261,6 +261,16 @@ static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -261,6 +261,16 @@ static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
return 0; return 0;
} }
static int hci_uart_setup(struct hci_dev *hdev)
{
struct hci_uart *hu = hci_get_drvdata(hdev);
if (hu->proto->setup)
return hu->proto->setup(hu);
return 0;
}
/* ------ LDISC part ------ */ /* ------ LDISC part ------ */
/* hci_uart_tty_open /* hci_uart_tty_open
* *
...@@ -426,6 +436,7 @@ static int hci_uart_register_dev(struct hci_uart *hu) ...@@ -426,6 +436,7 @@ static int hci_uart_register_dev(struct hci_uart *hu)
hdev->close = hci_uart_close; hdev->close = hci_uart_close;
hdev->flush = hci_uart_flush; hdev->flush = hci_uart_flush;
hdev->send = hci_uart_send_frame; hdev->send = hci_uart_send_frame;
hdev->setup = hci_uart_setup;
SET_HCIDEV_DEV(hdev, hu->tty->dev); SET_HCIDEV_DEV(hdev, hu->tty->dev);
if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags)) if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags))
......
...@@ -59,6 +59,7 @@ struct hci_uart_proto { ...@@ -59,6 +59,7 @@ struct hci_uart_proto {
int (*flush)(struct hci_uart *hu); int (*flush)(struct hci_uart *hu);
int (*recv)(struct hci_uart *hu, void *data, int len); int (*recv)(struct hci_uart *hu, void *data, int len);
int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb); int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb);
int (*setup)(struct hci_uart *hu);
struct sk_buff *(*dequeue)(struct hci_uart *hu); struct sk_buff *(*dequeue)(struct hci_uart *hu);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment