Linux 5.9.7
[linux/fpc-iii.git] / drivers / bluetooth / btintel.h
blob08e20606fb5870098203f506071ffdae3ac50bbd
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
4 * Bluetooth support for Intel devices
6 * Copyright (C) 2015 Intel Corporation
7 */
9 struct 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;
22 struct 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;
42 struct 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;
51 struct intel_secure_send_result {
52 __u8 result;
53 __le16 opcode;
54 __u8 status;
55 } __packed;
57 struct intel_reset {
58 __u8 reset_type;
59 __u8 patch_enable;
60 __u8 ddc_reload;
61 __u8 boot_option;
62 __le32 boot_param;
63 } __packed;
65 struct intel_debug_features {
66 __u8 page1[16];
67 } __packed;
69 #if IS_ENABLED(CONFIG_BT_INTEL)
71 int btintel_check_bdaddr(struct hci_dev *hdev);
72 int btintel_enter_mfg(struct hci_dev *hdev);
73 int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched);
74 int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
75 int btintel_set_diag(struct hci_dev *hdev, bool enable);
76 int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable);
77 void btintel_hw_error(struct hci_dev *hdev, u8 code);
79 void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver);
80 int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, u32 plen,
81 const void *param);
82 int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name);
83 int btintel_set_event_mask(struct hci_dev *hdev, bool debug);
84 int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug);
85 int btintel_read_version(struct hci_dev *hdev, struct intel_version *ver);
87 struct regmap *btintel_regmap_init(struct hci_dev *hdev, u16 opcode_read,
88 u16 opcode_write);
89 int btintel_send_intel_reset(struct hci_dev *hdev, u32 boot_param);
90 int btintel_read_boot_params(struct hci_dev *hdev,
91 struct intel_boot_params *params);
92 int btintel_download_firmware(struct hci_dev *dev, const struct firmware *fw,
93 u32 *boot_param);
94 void btintel_reset_to_bootloader(struct hci_dev *hdev);
95 int btintel_read_debug_features(struct hci_dev *hdev,
96 struct intel_debug_features *features);
97 int btintel_set_debug_features(struct hci_dev *hdev,
98 const struct intel_debug_features *features);
99 #else
101 static inline int btintel_check_bdaddr(struct hci_dev *hdev)
103 return -EOPNOTSUPP;
106 static inline int btintel_enter_mfg(struct hci_dev *hdev)
108 return -EOPNOTSUPP;
111 static inline int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched)
113 return -EOPNOTSUPP;
116 static inline int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
118 return -EOPNOTSUPP;
121 static inline int btintel_set_diag(struct hci_dev *hdev, bool enable)
123 return -EOPNOTSUPP;
126 static inline int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable)
128 return -EOPNOTSUPP;
131 static inline void btintel_hw_error(struct hci_dev *hdev, u8 code)
135 static inline void btintel_version_info(struct hci_dev *hdev,
136 struct intel_version *ver)
140 static inline int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type,
141 u32 plen, const void *param)
143 return -EOPNOTSUPP;
146 static inline int btintel_load_ddc_config(struct hci_dev *hdev,
147 const char *ddc_name)
149 return -EOPNOTSUPP;
152 static inline int btintel_set_event_mask(struct hci_dev *hdev, bool debug)
154 return -EOPNOTSUPP;
157 static inline int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug)
159 return -EOPNOTSUPP;
162 static inline int btintel_read_version(struct hci_dev *hdev,
163 struct intel_version *ver)
165 return -EOPNOTSUPP;
168 static inline struct regmap *btintel_regmap_init(struct hci_dev *hdev,
169 u16 opcode_read,
170 u16 opcode_write)
172 return ERR_PTR(-EINVAL);
175 static inline int btintel_send_intel_reset(struct hci_dev *hdev,
176 u32 reset_param)
178 return -EOPNOTSUPP;
181 static inline int btintel_read_boot_params(struct hci_dev *hdev,
182 struct intel_boot_params *params)
184 return -EOPNOTSUPP;
187 static inline int btintel_download_firmware(struct hci_dev *dev,
188 const struct firmware *fw,
189 u32 *boot_param)
191 return -EOPNOTSUPP;
194 static inline void btintel_reset_to_bootloader(struct hci_dev *hdev)
198 static inline int btintel_read_debug_features(struct hci_dev *hdev,
199 struct intel_debug_features *features)
201 return -EOPNOTSUPP;
204 static inline int btintel_set_debug_features(struct hci_dev *hdev,
205 const struct intel_debug_features *features)
207 return -EOPNOTSUPP;
210 #endif