xref: /linux/drivers/bluetooth/btbcm.h (revision af873fcecef567abf8a3468b06dd4e4aab46da6d)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *
4  *  Bluetooth support for Broadcom devices
5  *
6  *  Copyright (C) 2015  Intel Corporation
7  */
8 
9 #define BCM_UART_CLOCK_48MHZ	0x01
10 #define BCM_UART_CLOCK_24MHZ	0x02
11 
12 struct bcm_update_uart_baud_rate {
13 	__le16 zero;
14 	__le32 baud_rate;
15 } __packed;
16 
17 struct bcm_write_uart_clock_setting {
18 	__u8 type;
19 } __packed;
20 
21 struct bcm_set_sleep_mode {
22 	__u8 sleep_mode;
23 	__u8 idle_host;
24 	__u8 idle_dev;
25 	__u8 bt_wake_active;
26 	__u8 host_wake_active;
27 	__u8 allow_host_sleep;
28 	__u8 combine_modes;
29 	__u8 tristate_control;
30 	__u8 usb_auto_sleep;
31 	__u8 usb_resume_timeout;
32 	__u8 break_to_host;
33 	__u8 pulsed_host_wake;
34 } __packed;
35 
36 struct bcm_set_pcm_int_params {
37 	__u8 routing;
38 	__u8 rate;
39 	__u8 frame_sync;
40 	__u8 sync_mode;
41 	__u8 clock_mode;
42 } __packed;
43 
44 struct bcm_set_pcm_format_params {
45 	__u8 lsb_first;
46 	__u8 fill_value;
47 	__u8 fill_method;
48 	__u8 fill_num;
49 	__u8 right_justify;
50 } __packed;
51 
52 #if IS_ENABLED(CONFIG_BT_BCM)
53 
54 int btbcm_check_bdaddr(struct hci_dev *hdev);
55 int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
56 int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw);
57 
58 int btbcm_setup_patchram(struct hci_dev *hdev);
59 int btbcm_setup_apple(struct hci_dev *hdev);
60 
61 int btbcm_initialize(struct hci_dev *hdev, char *fw_name, size_t len,
62 		     bool reinit);
63 int btbcm_finalize(struct hci_dev *hdev);
64 
65 #else
66 
67 static inline int btbcm_check_bdaddr(struct hci_dev *hdev)
68 {
69 	return -EOPNOTSUPP;
70 }
71 
72 static inline int btbcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
73 {
74 	return -EOPNOTSUPP;
75 }
76 
77 static inline int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw)
78 {
79 	return -EOPNOTSUPP;
80 }
81 
82 static inline int btbcm_setup_patchram(struct hci_dev *hdev)
83 {
84 	return 0;
85 }
86 
87 static inline int btbcm_setup_apple(struct hci_dev *hdev)
88 {
89 	return 0;
90 }
91 
92 static inline int btbcm_initialize(struct hci_dev *hdev, char *fw_name,
93 				   size_t len, bool reinit)
94 {
95 	return 0;
96 }
97 
98 static inline int btbcm_finalize(struct hci_dev *hdev)
99 {
100 	return 0;
101 }
102 
103 #endif
104