1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Bluetooth support for Intel devices
6 * Copyright (C) 2015 Intel Corporation
11 INTEL_TLV_CNVI_TOP = 0x10,
18 INTEL_TLV_USB_VENDOR_ID,
19 INTEL_TLV_USB_PRODUCT_ID,
20 INTEL_TLV_PCIE_VENDOR_ID,
21 INTEL_TLV_PCIE_DEVICE_ID,
22 INTEL_TLV_PCIE_SUBSYSTEM_ID,
27 INTEL_TLV_FW_BUILD_PRODUCT,
28 INTEL_TLV_FW_BUILD_HW,
34 INTEL_TLV_OTP_PATCH_VER,
35 INTEL_TLV_SECURE_BOOT,
36 INTEL_TLV_KEY_FROM_HDR,
41 INTEL_TLV_LIMITED_CCE,
44 INTEL_TLV_UNLOCKED_STATE
53 struct intel_version_tlv {
75 struct intel_version {
88 struct intel_boot_params {
101 __u8 min_fw_build_nn;
102 __u8 min_fw_build_cw;
103 __u8 min_fw_build_yy;
108 struct intel_bootup {
117 struct intel_secure_send_result {
131 struct intel_debug_features {
135 struct intel_offload_use_cases {
140 #define INTEL_OP_PPAG_CMD 0xFE0B
141 struct hci_ppag_enable_cmd {
142 __le32 ppag_enable_flags;
145 #define INTEL_TLV_TYPE_ID 0x01
147 #define INTEL_TLV_SYSTEM_EXCEPTION 0x00
148 #define INTEL_TLV_FATAL_EXCEPTION 0x01
149 #define INTEL_TLV_DEBUG_EXCEPTION 0x02
150 #define INTEL_TLV_TEST_EXCEPTION 0xDE
152 #define INTEL_HW_PLATFORM(cnvx_bt) ((u8)(((cnvx_bt) & 0x0000ff00) >> 8))
153 #define INTEL_HW_VARIANT(cnvx_bt) ((u8)(((cnvx_bt) & 0x003f0000) >> 16))
154 #define INTEL_CNVX_TOP_TYPE(cnvx_top) ((cnvx_top) & 0x00000fff)
155 #define INTEL_CNVX_TOP_STEP(cnvx_top) (((cnvx_top) & 0x0f000000) >> 24)
156 #define INTEL_CNVX_TOP_PACK_SWAB(t, s) __swab16(((__u16)(((t) << 4) | (s))))
161 INTEL_FIRMWARE_LOADED,
162 INTEL_FIRMWARE_FAILED,
164 INTEL_BROKEN_INITIAL_NCMD,
165 INTEL_BROKEN_SHUTDOWN_LED,
167 INTEL_ROM_LEGACY_NO_WBS_SUPPORT,
168 INTEL_ACPI_RESET_ACTIVE,
173 struct btintel_data {
174 DECLARE_BITMAP(flags, __INTEL_NUM_FLAGS);
175 int (*acpi_reset_method)(struct hci_dev *hdev);
178 #define btintel_set_flag(hdev, nr) \
180 struct btintel_data *intel = hci_get_priv((hdev)); \
181 set_bit((nr), intel->flags); \
184 #define btintel_clear_flag(hdev, nr) \
186 struct btintel_data *intel = hci_get_priv((hdev)); \
187 clear_bit((nr), intel->flags); \
190 #define btintel_wake_up_flag(hdev, nr) \
192 struct btintel_data *intel = hci_get_priv((hdev)); \
193 wake_up_bit(intel->flags, (nr)); \
196 #define btintel_get_flag(hdev) \
197 (((struct btintel_data *)hci_get_priv(hdev))->flags)
199 #define btintel_test_flag(hdev, nr) test_bit((nr), btintel_get_flag(hdev))
200 #define btintel_test_and_clear_flag(hdev, nr) test_and_clear_bit((nr), btintel_get_flag(hdev))
201 #define btintel_wait_on_flag_timeout(hdev, nr, m, to) \
202 wait_on_bit_timeout(btintel_get_flag(hdev), (nr), m, to)
204 #if IS_ENABLED(CONFIG_BT_INTEL)
206 int btintel_check_bdaddr(struct hci_dev *hdev);
207 int btintel_enter_mfg(struct hci_dev *hdev);
208 int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched);
209 int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
210 int btintel_set_diag(struct hci_dev *hdev, bool enable);
212 int btintel_version_info(struct hci_dev *hdev, struct intel_version *ver);
213 int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name);
214 int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug);
215 int btintel_read_version(struct hci_dev *hdev, struct intel_version *ver);
216 struct regmap *btintel_regmap_init(struct hci_dev *hdev, u16 opcode_read,
218 int btintel_send_intel_reset(struct hci_dev *hdev, u32 boot_param);
219 int btintel_read_boot_params(struct hci_dev *hdev,
220 struct intel_boot_params *params);
221 int btintel_download_firmware(struct hci_dev *dev, struct intel_version *ver,
222 const struct firmware *fw, u32 *boot_param);
223 int btintel_configure_setup(struct hci_dev *hdev, const char *driver_name);
224 int btintel_recv_event(struct hci_dev *hdev, struct sk_buff *skb);
225 void btintel_bootup(struct hci_dev *hdev, const void *ptr, unsigned int len);
226 void btintel_secure_send_result(struct hci_dev *hdev,
227 const void *ptr, unsigned int len);
228 int btintel_set_quality_report(struct hci_dev *hdev, bool enable);
231 static inline int btintel_check_bdaddr(struct hci_dev *hdev)
236 static inline int btintel_enter_mfg(struct hci_dev *hdev)
241 static inline int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched)
246 static inline int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
251 static inline int btintel_set_diag(struct hci_dev *hdev, bool enable)
256 static inline int btintel_version_info(struct hci_dev *hdev,
257 struct intel_version *ver)
262 static inline int btintel_load_ddc_config(struct hci_dev *hdev,
263 const char *ddc_name)
268 static inline int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug)
273 static inline int btintel_read_version(struct hci_dev *hdev,
274 struct intel_version *ver)
279 static inline struct regmap *btintel_regmap_init(struct hci_dev *hdev,
283 return ERR_PTR(-EINVAL);
286 static inline int btintel_send_intel_reset(struct hci_dev *hdev,
292 static inline int btintel_read_boot_params(struct hci_dev *hdev,
293 struct intel_boot_params *params)
298 static inline int btintel_download_firmware(struct hci_dev *dev,
299 const struct firmware *fw,
305 static inline int btintel_configure_setup(struct hci_dev *hdev,
306 const char *driver_name)
311 static inline void btintel_bootup(struct hci_dev *hdev,
312 const void *ptr, unsigned int len)
316 static inline void btintel_secure_send_result(struct hci_dev *hdev,
317 const void *ptr, unsigned int len)
321 static inline int btintel_set_quality_report(struct hci_dev *hdev, bool enable)