Loading...
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 *
4 * Bluetooth support for Intel devices
5 *
6 * Copyright (C) 2015 Intel Corporation
7 */
8
9struct intel_version {
10 u8 status;
11 u8 hw_platform;
12 u8 hw_variant;
13 u8 hw_revision;
14 u8 fw_variant;
15 u8 fw_revision;
16 u8 fw_build_num;
17 u8 fw_build_ww;
18 u8 fw_build_yy;
19 u8 fw_patch_num;
20} __packed;
21
22struct intel_boot_params {
23 __u8 status;
24 __u8 otp_format;
25 __u8 otp_content;
26 __u8 otp_patch;
27 __le16 dev_revid;
28 __u8 secure_boot;
29 __u8 key_from_hdr;
30 __u8 key_type;
31 __u8 otp_lock;
32 __u8 api_lock;
33 __u8 debug_lock;
34 bdaddr_t otp_bdaddr;
35 __u8 min_fw_build_nn;
36 __u8 min_fw_build_cw;
37 __u8 min_fw_build_yy;
38 __u8 limited_cce;
39 __u8 unlocked_state;
40} __packed;
41
42struct intel_bootup {
43 __u8 zero;
44 __u8 num_cmds;
45 __u8 source;
46 __u8 reset_type;
47 __u8 reset_reason;
48 __u8 ddc_status;
49} __packed;
50
51struct intel_secure_send_result {
52 __u8 result;
53 __le16 opcode;
54 __u8 status;
55} __packed;
56
57struct intel_reset {
58 __u8 reset_type;
59 __u8 patch_enable;
60 __u8 ddc_reload;
61 __u8 boot_option;
62 __le32 boot_param;
63} __packed;
64
65struct intel_debug_features {
66 __u8 page1[16];
67} __packed;
68
69#if IS_ENABLED(CONFIG_BT_INTEL)
70
71int btintel_check_bdaddr(struct hci_dev *hdev);
72int btintel_enter_mfg(struct hci_dev *hdev);
73int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched);
74int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
75int btintel_set_diag(struct hci_dev *hdev, bool enable);
76int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable);
77void btintel_hw_error(struct hci_dev *hdev, u8 code);
78
79void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver);
80int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, u32 plen,
81 const void *param);
82int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name);
83int btintel_set_event_mask(struct hci_dev *hdev, bool debug);
84int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug);
85int btintel_read_version(struct hci_dev *hdev, struct intel_version *ver);
86
87struct regmap *btintel_regmap_init(struct hci_dev *hdev, u16 opcode_read,
88 u16 opcode_write);
89int btintel_send_intel_reset(struct hci_dev *hdev, u32 boot_param);
90int btintel_read_boot_params(struct hci_dev *hdev,
91 struct intel_boot_params *params);
92int btintel_download_firmware(struct hci_dev *dev, const struct firmware *fw,
93 u32 *boot_param);
94void btintel_reset_to_bootloader(struct hci_dev *hdev);
95int btintel_read_debug_features(struct hci_dev *hdev,
96 struct intel_debug_features *features);
97int btintel_set_debug_features(struct hci_dev *hdev,
98 const struct intel_debug_features *features);
99#else
100
101static inline int btintel_check_bdaddr(struct hci_dev *hdev)
102{
103 return -EOPNOTSUPP;
104}
105
106static inline int btintel_enter_mfg(struct hci_dev *hdev)
107{
108 return -EOPNOTSUPP;
109}
110
111static inline int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched)
112{
113 return -EOPNOTSUPP;
114}
115
116static inline int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
117{
118 return -EOPNOTSUPP;
119}
120
121static inline int btintel_set_diag(struct hci_dev *hdev, bool enable)
122{
123 return -EOPNOTSUPP;
124}
125
126static inline int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable)
127{
128 return -EOPNOTSUPP;
129}
130
131static inline void btintel_hw_error(struct hci_dev *hdev, u8 code)
132{
133}
134
135static inline void btintel_version_info(struct hci_dev *hdev,
136 struct intel_version *ver)
137{
138}
139
140static inline int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type,
141 u32 plen, const void *param)
142{
143 return -EOPNOTSUPP;
144}
145
146static inline int btintel_load_ddc_config(struct hci_dev *hdev,
147 const char *ddc_name)
148{
149 return -EOPNOTSUPP;
150}
151
152static inline int btintel_set_event_mask(struct hci_dev *hdev, bool debug)
153{
154 return -EOPNOTSUPP;
155}
156
157static inline int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug)
158{
159 return -EOPNOTSUPP;
160}
161
162static inline int btintel_read_version(struct hci_dev *hdev,
163 struct intel_version *ver)
164{
165 return -EOPNOTSUPP;
166}
167
168static inline struct regmap *btintel_regmap_init(struct hci_dev *hdev,
169 u16 opcode_read,
170 u16 opcode_write)
171{
172 return ERR_PTR(-EINVAL);
173}
174
175static inline int btintel_send_intel_reset(struct hci_dev *hdev,
176 u32 reset_param)
177{
178 return -EOPNOTSUPP;
179}
180
181static inline int btintel_read_boot_params(struct hci_dev *hdev,
182 struct intel_boot_params *params)
183{
184 return -EOPNOTSUPP;
185}
186
187static inline int btintel_download_firmware(struct hci_dev *dev,
188 const struct firmware *fw,
189 u32 *boot_param)
190{
191 return -EOPNOTSUPP;
192}
193
194static inline void btintel_reset_to_bootloader(struct hci_dev *hdev)
195{
196}
197
198static inline int btintel_read_debug_features(struct hci_dev *hdev,
199 struct intel_debug_features *features)
200{
201 return -EOPNOTSUPP;
202}
203
204static inline int btintel_set_debug_features(struct hci_dev *hdev,
205 const struct intel_debug_features *features)
206{
207 return -EOPNOTSUPP;
208}
209
210#endif
1/*
2 *
3 * Bluetooth support for Intel devices
4 *
5 * Copyright (C) 2015 Intel Corporation
6 *
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24struct intel_version {
25 u8 status;
26 u8 hw_platform;
27 u8 hw_variant;
28 u8 hw_revision;
29 u8 fw_variant;
30 u8 fw_revision;
31 u8 fw_build_num;
32 u8 fw_build_ww;
33 u8 fw_build_yy;
34 u8 fw_patch_num;
35} __packed;
36
37struct intel_boot_params {
38 __u8 status;
39 __u8 otp_format;
40 __u8 otp_content;
41 __u8 otp_patch;
42 __le16 dev_revid;
43 __u8 secure_boot;
44 __u8 key_from_hdr;
45 __u8 key_type;
46 __u8 otp_lock;
47 __u8 api_lock;
48 __u8 debug_lock;
49 bdaddr_t otp_bdaddr;
50 __u8 min_fw_build_nn;
51 __u8 min_fw_build_cw;
52 __u8 min_fw_build_yy;
53 __u8 limited_cce;
54 __u8 unlocked_state;
55} __packed;
56
57struct intel_bootup {
58 __u8 zero;
59 __u8 num_cmds;
60 __u8 source;
61 __u8 reset_type;
62 __u8 reset_reason;
63 __u8 ddc_status;
64} __packed;
65
66struct intel_secure_send_result {
67 __u8 result;
68 __le16 opcode;
69 __u8 status;
70} __packed;
71
72#if IS_ENABLED(CONFIG_BT_INTEL)
73
74int btintel_check_bdaddr(struct hci_dev *hdev);
75int btintel_enter_mfg(struct hci_dev *hdev);
76int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched);
77int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
78int btintel_set_diag(struct hci_dev *hdev, bool enable);
79int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable);
80void btintel_hw_error(struct hci_dev *hdev, u8 code);
81
82void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver);
83int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, u32 plen,
84 const void *param);
85int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name);
86int btintel_set_event_mask(struct hci_dev *hdev, bool debug);
87int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug);
88int btintel_read_version(struct hci_dev *hdev, struct intel_version *ver);
89
90struct regmap *btintel_regmap_init(struct hci_dev *hdev, u16 opcode_read,
91 u16 opcode_write);
92
93#else
94
95static inline int btintel_check_bdaddr(struct hci_dev *hdev)
96{
97 return -EOPNOTSUPP;
98}
99
100static inline int btintel_enter_mfg(struct hci_dev *hdev)
101{
102 return -EOPNOTSUPP;
103}
104
105static inline int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched)
106{
107 return -EOPNOTSUPP;
108}
109
110static inline int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
111{
112 return -EOPNOTSUPP;
113}
114
115static inline int btintel_set_diag(struct hci_dev *hdev, bool enable)
116{
117 return -EOPNOTSUPP;
118}
119
120static inline int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable)
121{
122 return -EOPNOTSUPP;
123}
124
125static inline void btintel_hw_error(struct hci_dev *hdev, u8 code)
126{
127}
128
129static inline void btintel_version_info(struct hci_dev *hdev,
130 struct intel_version *ver)
131{
132}
133
134static inline int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type,
135 u32 plen, const void *param)
136{
137 return -EOPNOTSUPP;
138}
139
140static inline int btintel_load_ddc_config(struct hci_dev *hdev,
141 const char *ddc_name)
142{
143 return -EOPNOTSUPP;
144}
145
146static inline int btintel_set_event_mask(struct hci_dev *hdev, bool debug)
147{
148 return -EOPNOTSUPP;
149}
150
151static inline int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug)
152{
153 return -EOPNOTSUPP;
154}
155
156static inline int btintel_read_version(struct hci_dev *hdev,
157 struct intel_version *ver)
158{
159 return -EOPNOTSUPP;
160}
161
162static inline struct regmap *btintel_regmap_init(struct hci_dev *hdev,
163 u16 opcode_read,
164 u16 opcode_write)
165{
166 return ERR_PTR(-EINVAL);
167}
168#endif