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

Commit ed1d0f22 authored by Dundi Raviteja's avatar Dundi Raviteja
Browse files

wlan: Update BT enable/disable status to firmware

Update BT enable/disable status coming from
wcnss to firmware.

Usage:
Enable BT:
$ echo BT_ENABLED 1 BLE 0 A2DP 0 SCO 0 >
	/sys/devices/platform/soc/a000000.qcom,wcnss-wlan/bt_profile

Disable BT:
$ echo BT_ENABLED 0 BLE 0 A2DP 0 SCO 0 >
	/sys/devices/platform/soc/a000000.qcom,wcnss-wlan/bt_profile

Change-Id: I57df353427cb33bef9ebe904db071692294e4c86
CRs-Fixed: 2807024
parent b050978e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1796,6 +1796,7 @@ struct hdd_context_s
    v_BOOL_t btCoexModeSet;
    v_BOOL_t isPnoEnable;
    bool     is_sco_enabled;
    bool     is_bt_enabled;
    macAddrSpoof_t spoofMacAddr;
    /* flag to decide if driver need to scan DFS channels or not */
    v_BOOL_t  disable_dfs_flag;
+44 −2
Original line number Diff line number Diff line
@@ -3929,6 +3929,7 @@ int hdd_process_bt_sco_profile(hdd_context_t *hdd_ctx,
			       bool bt_enabled, bool bt_sco)
{
	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hdd_ctx->hHal);
	uint8_t no_of_states_changed = 0;
	hdd_station_ctx_t *hdd_sta_ctx;
	eConnectionState conn_state;
	hdd_adapter_t *adapter;
@@ -3941,6 +3942,49 @@ int hdd_process_bt_sco_profile(hdd_context_t *hdd_ctx,
		return -EINVAL;
	}
	/**
	 * At a time only one status can be changed compared to
	 * previous command (BT_ENABLED/SCO)
	 * If no.of states changed is greater than one it is
	 * an invalid command.
	 */
	if (bt_enabled != hdd_ctx->is_bt_enabled)
		no_of_states_changed++;
	if (bt_sco != hdd_ctx->is_sco_enabled)
		no_of_states_changed++;
	if (no_of_states_changed > 1) {
		hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Multiple states changed",
		       __func__);
		return -EINVAL;
	}
	INIT_COMPLETION(hdd_ctx->sw_pta_comp);
	if (bt_enabled != hdd_ctx->is_bt_enabled) {
		hal_status = sme_bt_req(hdd_ctx->hHal,
					hdd_sco_resp_callback,
					adapter->sessionId, bt_enabled);
		if (!HAL_STATUS_SUCCESS(hal_status)) {
			hddLog(VOS_TRACE_LEVEL_ERROR,
			       "%s: Error sending sme sco indication request",
			       __func__);
			return -EINVAL;
		}
		rc = wait_for_completion_timeout(&hdd_ctx->sw_pta_comp,
				msecs_to_jiffies(WLAN_WAIT_TIME_SW_PTA));
		if (!rc) {
			hddLog(VOS_TRACE_LEVEL_ERROR,
			       FL("Target response timed out for sw_pta_comp"));
			return -EINVAL;
		}
		hdd_ctx->is_bt_enabled = bt_enabled;
		return 0;
	}
	if (bt_sco) {
		if (hdd_ctx->is_sco_enabled) {
			hddLog(VOS_TRACE_LEVEL_ERROR,
@@ -3957,8 +4001,6 @@ int hdd_process_bt_sco_profile(hdd_context_t *hdd_ctx,
		sco_status = false;
	}
	INIT_COMPLETION(hdd_ctx->sw_pta_comp);
	hal_status = sme_sco_req(hdd_ctx->hHal,
				 hdd_sco_resp_callback,
				 adapter->sessionId, sco_status);
+13 −0
Original line number Diff line number Diff line
@@ -4218,5 +4218,18 @@ eHalStatus sme_sw_pta_req(tHalHandle hal,
eHalStatus sme_sco_req(tHalHandle hal,
		       void (*resp_callback)(uint8_t resp_status),
		       uint8_t session_id, uint8_t req_status);

/**
 * sme_bt_req() - Send bt status to sme
 * @hal: The handle returned by mac_open
 * @resp_callback: callback to indicate sco response to hdd
 * @session_id: session id
 * @req_status: sco request status
 *
 * Return: HAL_STATUS
 */
eHalStatus sme_bt_req(tHalHandle hal,
		       void (*resp_callback)(uint8_t resp_status),
		       uint8_t session_id, uint8_t req_status);
#endif /* FEATURE_WLAN_SW_PTA */
#endif //#if !defined( __SME_API_H )
+8 −0
Original line number Diff line number Diff line
@@ -15745,4 +15745,12 @@ eHalStatus sme_sco_req(tHalHandle hal,
	return sme_sw_pta_req(hal, resp_callback, session_id,
			      SCO_STATUS, sizeof(req_status), &req_status);
}
eHalStatus sme_bt_req(tHalHandle hal,
		      void (*resp_callback)(uint8_t resp_status),
		      uint8_t session_id, uint8_t req_status)
{
	return sme_sw_pta_req(hal, resp_callback, session_id,
			      BT_STATUS, sizeof(req_status), &req_status);
}
#endif /* FEATURE_WLAN_SW_PTA */