diff options
| author | Loic Poulain <loic.poulain@intel.com> | 2015-03-25 10:19:30 -0400 |
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2015-03-25 12:31:58 -0400 |
| commit | eb17380972d563a7dd59634cd2fdb614f3b98cdd (patch) | |
| tree | cfd613f8af1d7d61449bcb98512647aee475e2ca /drivers/bluetooth | |
| parent | 99c679acce5d07aa1be63d8afe94df27f0aecb50 (diff) | |
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: Loic Poulain <loic.poulain@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth')
| -rw-r--r-- | drivers/bluetooth/hci_ldisc.c | 11 | ||||
| -rw-r--r-- | drivers/bluetooth/hci_uart.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index dc487b5d1156..48a0c250d5b8 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
| @@ -261,6 +261,16 @@ static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb) | |||
| 261 | return 0; | 261 | return 0; |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | static int hci_uart_setup(struct hci_dev *hdev) | ||
| 265 | { | ||
| 266 | struct hci_uart *hu = hci_get_drvdata(hdev); | ||
| 267 | |||
| 268 | if (hu->proto->setup) | ||
| 269 | return hu->proto->setup(hu); | ||
| 270 | |||
| 271 | return 0; | ||
| 272 | } | ||
| 273 | |||
| 264 | /* ------ LDISC part ------ */ | 274 | /* ------ LDISC part ------ */ |
| 265 | /* hci_uart_tty_open | 275 | /* hci_uart_tty_open |
| 266 | * | 276 | * |
| @@ -426,6 +436,7 @@ static int hci_uart_register_dev(struct hci_uart *hu) | |||
| 426 | hdev->close = hci_uart_close; | 436 | hdev->close = hci_uart_close; |
| 427 | hdev->flush = hci_uart_flush; | 437 | hdev->flush = hci_uart_flush; |
| 428 | hdev->send = hci_uart_send_frame; | 438 | hdev->send = hci_uart_send_frame; |
| 439 | hdev->setup = hci_uart_setup; | ||
| 429 | SET_HCIDEV_DEV(hdev, hu->tty->dev); | 440 | SET_HCIDEV_DEV(hdev, hu->tty->dev); |
| 430 | 441 | ||
| 431 | if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags)) | 442 | if (test_bit(HCI_UART_RAW_DEVICE, &hu->hdev_flags)) |
diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h index 247488edcbf9..074ed29092b4 100644 --- a/drivers/bluetooth/hci_uart.h +++ b/drivers/bluetooth/hci_uart.h | |||
| @@ -59,6 +59,7 @@ struct hci_uart_proto { | |||
| 59 | int (*flush)(struct hci_uart *hu); | 59 | int (*flush)(struct hci_uart *hu); |
| 60 | int (*recv)(struct hci_uart *hu, void *data, int len); | 60 | int (*recv)(struct hci_uart *hu, void *data, int len); |
| 61 | int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb); | 61 | int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb); |
| 62 | int (*setup)(struct hci_uart *hu); | ||
| 62 | struct sk_buff *(*dequeue)(struct hci_uart *hu); | 63 | struct sk_buff *(*dequeue)(struct hci_uart *hu); |
| 63 | }; | 64 | }; |
| 64 | 65 | ||
