Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7297a86 authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo
Browse files

rtlwifi: btcoex: add routine to set default port id



Tell wifi and BT firmware the default port ID to set multiports' state
properly, but only 8822be needs this function currently.

Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 2cdd634e
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -1039,6 +1039,28 @@ static void halbtc_fill_h2c_cmd(void *bt_context, u8 element_id,
					cmd_len, cmd_buf);
}

void halbtc_send_wifi_port_id_cmd(void *bt_context)
{
	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
	struct rtl_priv *rtlpriv = btcoexist->adapter;
	u8 cmd_buf[1] = {0};	/* port id [2:0] = 0 */

	rtlpriv->cfg->ops->fill_h2c_cmd(rtlpriv->mac80211.hw, H2C_BT_PORT_ID,
					1, cmd_buf);
}

void halbtc_set_default_port_id_cmd(void *bt_context)
{
	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
	struct rtl_priv *rtlpriv = btcoexist->adapter;
	struct ieee80211_hw *hw = rtlpriv->mac80211.hw;

	if (!rtlpriv->cfg->ops->set_default_port_id_cmd)
		return;

	rtlpriv->cfg->ops->set_default_port_id_cmd(hw);
}

static
void halbtc_set_bt_reg(void *btc_context, u8 reg_type, u32 offset, u32 set_val)
{
+2 −0
Original line number Diff line number Diff line
@@ -691,6 +691,8 @@ void exhalbtc_lps_leave(struct btc_coexist *btcoexist);
void exhalbtc_low_wifi_traffic_notify(struct btc_coexist *btcoexist);
void exhalbtc_set_single_ant_path(struct btc_coexist *btcoexist,
				  u8 single_ant_path);
void halbtc_send_wifi_port_id_cmd(void *bt_context);
void halbtc_set_default_port_id_cmd(void *bt_context);

/* The following are used by wifi_only case */
enum wifionly_chip_interface {
+5 −0
Original line number Diff line number Diff line
@@ -154,6 +154,10 @@ enum rtl8192c_h2c_cmd {
	MAX_H2CCMD
};

enum {
	H2C_BT_PORT_ID = 0x71,
};

#define GET_TX_REPORT_SN_V1(c2h)	(c2h[6])
#define GET_TX_REPORT_ST_V1(c2h)	(c2h[0] & 0xC0)
#define GET_TX_REPORT_RETRY_V1(c2h)	(c2h[2] & 0x3F)
@@ -2257,6 +2261,7 @@ struct rtl_hal_ops {
	void (*bt_coex_off_before_lps) (struct ieee80211_hw *hw);
	void (*fill_h2c_cmd) (struct ieee80211_hw *hw, u8 element_id,
			      u32 cmd_len, u8 *p_cmdbuffer);
	void (*set_default_port_id_cmd)(struct ieee80211_hw *hw);
	bool (*get_btc_status) (void);
	bool (*is_fw_header)(struct rtlwifi_firmware_header *hdr);
	u32 (*rx_command_packet)(struct ieee80211_hw *hw,