blob: 41c642cc523fcc63a42262cafc3616d90249f233 [file] [log] [blame]
Marcel Holtmann48f0ed12015-04-06 00:52:11 -07001/*
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
Marcel Holtmann59a077c2015-04-06 00:52:13 -070024struct 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
Marcel Holtmannccd6da22015-04-09 00:35:19 -070057struct 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
Tedd Ho-Jeong Ane5889af2018-01-24 09:19:18 -080072struct intel_reset {
73 __u8 reset_type;
74 __u8 patch_enable;
75 __u8 ddc_reload;
76 __u8 boot_option;
77 __le32 boot_param;
78} __packed;
79
Marcel Holtmann48f0ed12015-04-06 00:52:11 -070080#if IS_ENABLED(CONFIG_BT_INTEL)
81
82int btintel_check_bdaddr(struct hci_dev *hdev);
Loic Poulain28dc4b92015-12-03 16:10:22 +010083int btintel_enter_mfg(struct hci_dev *hdev);
84int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched);
Marcel Holtmann48f0ed12015-04-06 00:52:11 -070085int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
Marcel Holtmann6d2e50d2015-10-09 14:42:08 +020086int btintel_set_diag(struct hci_dev *hdev, bool enable);
Marcel Holtmann3e247672015-10-17 16:00:28 +020087int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable);
Marcel Holtmann973bb972015-07-05 14:37:38 +020088void btintel_hw_error(struct hci_dev *hdev, u8 code);
Marcel Holtmann48f0ed12015-04-06 00:52:11 -070089
Marcel Holtmann7feb99e2015-07-05 15:02:07 +020090void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver);
Marcel Holtmann09df1232015-07-05 14:55:36 +020091int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, u32 plen,
92 const void *param);
Loic Poulain145f2362015-09-04 17:54:34 +020093int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name);
Marcel Holtmann213445b2015-10-21 02:45:19 +020094int btintel_set_event_mask(struct hci_dev *hdev, bool debug);
95int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug);
Loic Poulain6c483de2015-12-06 16:18:34 +010096int btintel_read_version(struct hci_dev *hdev, struct intel_version *ver);
Marcel Holtmann09df1232015-07-05 14:55:36 +020097
Loic Poulaind06f1072015-10-01 18:16:21 +020098struct regmap *btintel_regmap_init(struct hci_dev *hdev, u16 opcode_read,
99 u16 opcode_write);
Tedd Ho-Jeong Ane5889af2018-01-24 09:19:18 -0800100int btintel_send_intel_reset(struct hci_dev *hdev, u32 boot_param);
Tedd Ho-Jeong Anfaf174d2018-01-24 09:19:20 -0800101int btintel_read_boot_params(struct hci_dev *hdev,
102 struct intel_boot_params *params);
Tedd Ho-Jeong Anfbbe83c2018-01-24 09:19:21 -0800103int btintel_download_firmware(struct hci_dev *dev, const struct firmware *fw,
104 u32 *boot_param);
Marcel Holtmann48f0ed12015-04-06 00:52:11 -0700105#else
106
107static inline int btintel_check_bdaddr(struct hci_dev *hdev)
108{
109 return -EOPNOTSUPP;
110}
111
Loic Poulain28dc4b92015-12-03 16:10:22 +0100112static inline int btintel_enter_mfg(struct hci_dev *hdev)
113{
114 return -EOPNOTSUPP;
115}
116
117static inline int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched)
118{
119 return -EOPNOTSUPP;
120}
121
Marcel Holtmann48f0ed12015-04-06 00:52:11 -0700122static inline int btintel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
123{
124 return -EOPNOTSUPP;
125}
126
Marcel Holtmann6d2e50d2015-10-09 14:42:08 +0200127static inline int btintel_set_diag(struct hci_dev *hdev, bool enable)
128{
129 return -EOPNOTSUPP;
130}
131
Marcel Holtmann3e247672015-10-17 16:00:28 +0200132static inline int btintel_set_diag_mfg(struct hci_dev *hdev, bool enable)
133{
134 return -EOPNOTSUPP;
135}
136
Marcel Holtmann973bb972015-07-05 14:37:38 +0200137static inline void btintel_hw_error(struct hci_dev *hdev, u8 code)
138{
139}
140
Vincent Stehlé0eee53c2015-09-03 23:08:45 +0200141static inline void btintel_version_info(struct hci_dev *hdev,
142 struct intel_version *ver)
Marcel Holtmann7feb99e2015-07-05 15:02:07 +0200143{
144}
145
Marcel Holtmann09df1232015-07-05 14:55:36 +0200146static inline int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type,
147 u32 plen, const void *param)
148{
149 return -EOPNOTSUPP;
150}
151
Loic Poulain145f2362015-09-04 17:54:34 +0200152static inline int btintel_load_ddc_config(struct hci_dev *hdev,
153 const char *ddc_name)
154{
155 return -EOPNOTSUPP;
156}
157
Marcel Holtmann213445b2015-10-21 02:45:19 +0200158static inline int btintel_set_event_mask(struct hci_dev *hdev, bool debug)
159{
160 return -EOPNOTSUPP;
161}
162
163static inline int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug)
164{
165 return -EOPNOTSUPP;
166}
167
Loic Poulain6c483de2015-12-06 16:18:34 +0100168static inline int btintel_read_version(struct hci_dev *hdev,
169 struct intel_version *ver)
170{
171 return -EOPNOTSUPP;
172}
173
Loic Poulaind06f1072015-10-01 18:16:21 +0200174static inline struct regmap *btintel_regmap_init(struct hci_dev *hdev,
175 u16 opcode_read,
176 u16 opcode_write)
177{
178 return ERR_PTR(-EINVAL);
179}
Tedd Ho-Jeong Ane5889af2018-01-24 09:19:18 -0800180
181static inline int btintel_send_intel_reset(struct hci_dev *hdev,
182 u32 reset_param)
183{
184 return -EOPNOTSUPP;
185}
Tedd Ho-Jeong Anfaf174d2018-01-24 09:19:20 -0800186
187static inline int btintel_read_boot_params(struct hci_dev *hdev,
188 struct intel_boot_params *params)
189{
190 return -EOPNOTSUPP;
191}
Tedd Ho-Jeong Anfbbe83c2018-01-24 09:19:21 -0800192
193static inline int btintel_download_firmware(struct hci_dev *dev,
194 const struct firmware *fw,
195 u32 *boot_param)
196{
197 return -EOPNOTSUPP;
198}
Marcel Holtmann48f0ed12015-04-06 00:52:11 -0700199#endif