diff options
author | Balakrishna Godavarthi <bgodavar@codeaurora.org> | 2019-01-16 07:31:15 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2019-01-22 03:51:18 -0500 |
commit | 5c0a1001c8beecc29c2364171f3a1080e864a672 (patch) | |
tree | 5cf76610782addbd3768d0852f17976fb401ef19 /drivers/bluetooth | |
parent | fa7f3a8d56b38a3ed1880a3780afba82387da277 (diff) |
Bluetooth: hci_qca: Add helper to set device address
This patch add qca_set_bdaddr() to set the device
address for latest Qualcomm Bluetooth chipset wcn3990 and above.
Signed-off-by: Balakrishna Godavarthi <bgodavar@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/btqca.c | 19 | ||||
-rw-r--r-- | drivers/bluetooth/btqca.h | 8 | ||||
-rw-r--r-- | drivers/bluetooth/hci_qca.c | 5 |
3 files changed, 30 insertions, 2 deletions
diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c index ec9e03a6b778..612268574fc7 100644 --- a/drivers/bluetooth/btqca.c +++ b/drivers/bluetooth/btqca.c | |||
@@ -391,6 +391,25 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, | |||
391 | } | 391 | } |
392 | EXPORT_SYMBOL_GPL(qca_uart_setup); | 392 | EXPORT_SYMBOL_GPL(qca_uart_setup); |
393 | 393 | ||
394 | int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) | ||
395 | { | ||
396 | struct sk_buff *skb; | ||
397 | int err; | ||
398 | |||
399 | skb = __hci_cmd_sync_ev(hdev, EDL_WRITE_BD_ADDR_OPCODE, 6, bdaddr, | ||
400 | HCI_EV_VENDOR, HCI_INIT_TIMEOUT); | ||
401 | if (IS_ERR(skb)) { | ||
402 | err = PTR_ERR(skb); | ||
403 | bt_dev_err(hdev, "QCA Change address cmd failed (%d)", err); | ||
404 | return err; | ||
405 | } | ||
406 | |||
407 | kfree_skb(skb); | ||
408 | |||
409 | return 0; | ||
410 | } | ||
411 | EXPORT_SYMBOL_GPL(qca_set_bdaddr); | ||
412 | |||
394 | MODULE_AUTHOR("Ben Young Tae Kim <ytkim@qca.qualcomm.com>"); | 413 | MODULE_AUTHOR("Ben Young Tae Kim <ytkim@qca.qualcomm.com>"); |
395 | MODULE_DESCRIPTION("Bluetooth support for Qualcomm Atheros family ver " VERSION); | 414 | MODULE_DESCRIPTION("Bluetooth support for Qualcomm Atheros family ver " VERSION); |
396 | MODULE_VERSION(VERSION); | 415 | MODULE_VERSION(VERSION); |
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h index 0c01f375fe83..c72c56ea7480 100644 --- a/drivers/bluetooth/btqca.h +++ b/drivers/bluetooth/btqca.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #define EDL_PATCH_CMD_OPCODE (0xFC00) | 21 | #define EDL_PATCH_CMD_OPCODE (0xFC00) |
22 | #define EDL_NVM_ACCESS_OPCODE (0xFC0B) | 22 | #define EDL_NVM_ACCESS_OPCODE (0xFC0B) |
23 | #define EDL_WRITE_BD_ADDR_OPCODE (0xFC14) | ||
23 | #define EDL_PATCH_CMD_LEN (1) | 24 | #define EDL_PATCH_CMD_LEN (1) |
24 | #define EDL_PATCH_VER_REQ_CMD (0x19) | 25 | #define EDL_PATCH_VER_REQ_CMD (0x19) |
25 | #define EDL_PATCH_TLV_REQ_CMD (0x1E) | 26 | #define EDL_PATCH_TLV_REQ_CMD (0x1E) |
@@ -140,7 +141,7 @@ int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr); | |||
140 | int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, | 141 | int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, |
141 | enum qca_btsoc_type soc_type, u32 soc_ver); | 142 | enum qca_btsoc_type soc_type, u32 soc_ver); |
142 | int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version); | 143 | int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version); |
143 | 144 | int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr); | |
144 | #else | 145 | #else |
145 | 146 | ||
146 | static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr) | 147 | static inline int qca_set_bdaddr_rome(struct hci_dev *hdev, const bdaddr_t *bdaddr) |
@@ -159,4 +160,9 @@ static inline int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version) | |||
159 | return -EOPNOTSUPP; | 160 | return -EOPNOTSUPP; |
160 | } | 161 | } |
161 | 162 | ||
163 | static inline int qca_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) | ||
164 | { | ||
165 | return -EOPNOTSUPP; | ||
166 | } | ||
167 | |||
162 | #endif | 168 | #endif |
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index f036c8f98ea3..53ac5ade532b 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c | |||
@@ -1241,7 +1241,10 @@ static int qca_setup(struct hci_uart *hu) | |||
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | /* Setup bdaddr */ | 1243 | /* Setup bdaddr */ |
1244 | hu->hdev->set_bdaddr = qca_set_bdaddr_rome; | 1244 | if (qcadev->btsoc_type == QCA_WCN3990) |
1245 | hu->hdev->set_bdaddr = qca_set_bdaddr; | ||
1246 | else | ||
1247 | hu->hdev->set_bdaddr = qca_set_bdaddr_rome; | ||
1245 | 1248 | ||
1246 | return ret; | 1249 | return ret; |
1247 | } | 1250 | } |