1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /*
3 * Copyright (C) 2024-2025 Intel Corporation
4 */
5
6 #include "fw/api/coex.h"
7
8 #include "coex.h"
9 #include "mld.h"
10 #include "hcmd.h"
11 #include "mlo.h"
12
iwl_mld_send_bt_init_conf(struct iwl_mld * mld)13 int iwl_mld_send_bt_init_conf(struct iwl_mld *mld)
14 {
15 struct iwl_bt_coex_cmd cmd = {
16 .mode = cpu_to_le32(BT_COEX_NW),
17 .enabled_modules = cpu_to_le32(BT_COEX_MPLUT_ENABLED |
18 BT_COEX_HIGH_BAND_RET),
19 };
20
21 return iwl_mld_send_cmd_pdu(mld, BT_CONFIG, &cmd);
22 }
23
iwl_mld_handle_bt_coex_notif(struct iwl_mld * mld,struct iwl_rx_packet * pkt)24 void iwl_mld_handle_bt_coex_notif(struct iwl_mld *mld,
25 struct iwl_rx_packet *pkt)
26 {
27 const struct iwl_bt_coex_profile_notif *notif = (void *)pkt->data;
28 const struct iwl_bt_coex_profile_notif zero_notif = {};
29 /* zeroed structure means that BT is OFF */
30 bool bt_is_active = memcmp(notif, &zero_notif, sizeof(*notif));
31
32 if (bt_is_active == mld->bt_is_active)
33 return;
34
35 IWL_DEBUG_INFO(mld, "BT was turned %s\n", bt_is_active ? "ON" : "OFF");
36
37 mld->bt_is_active = bt_is_active;
38
39 iwl_mld_emlsr_check_bt(mld);
40 }
41