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

Commit b050978e authored by Dundi Raviteja's avatar Dundi Raviteja Committed by Gerrit - the friendly Code Review server
Browse files

wlan: Get bt_profile status from wcnss driver

bt_profile entry in sysfs is created by wcnss driver,
so get the status of bt_profile from wcnss driver and
process it in hdd.

Change-Id: I526473dbecbb12ca454e99bfe73dbc85fee4ea17
CRs-Fixed: 2800939
parent aa090901
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -2433,4 +2433,30 @@ static inline void hdd_fill_last_rx(hdd_adapter_t *adapter)
#else
void hdd_fill_last_rx(hdd_adapter_t *adapter);
#endif

#ifdef FEATURE_WLAN_SW_PTA
/**
 * hdd_process_bt_sco_profile - process BT SCO profile
 * @hdd_ctx: pointer to HDD context
 * @bt_enabled: status of BT
 * @bt_sco: status of SCO
 *
 * Return: 0 on success, error on failure
 */
int hdd_process_bt_sco_profile(hdd_context_t *hdd_ctx,
			       bool bt_enabled, bool bt_sco);

/**
 * hdd_is_sw_pta_enabled - is sw pta enabled
 * @hdd_ctx: pointer to HDD context
 *
 * Return: bool
 */
bool hdd_is_sw_pta_enabled(hdd_context_t *hdd_ctx);
#else
static inline bool hdd_is_sw_pta_enabled(hdd_context_t *hdd_ctx)
{
	return 0;
}
#endif
#endif    // end #if !defined( WLAN_HDD_MAIN_H )
+10 −3
Original line number Diff line number Diff line
@@ -620,6 +620,13 @@ static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] =
};
#endif /* WLAN_NL80211_TESTMODE */
#ifdef FEATURE_WLAN_SW_PTA
bool hdd_is_sw_pta_enabled(hdd_context_t *hdd_ctx)
{
	return hdd_ctx->cfg_ini->is_sw_pta_enabled;
}
#endif
#ifdef FEATURE_WLAN_CH_AVOID
/*
 * FUNCTION: wlan_hdd_send_avoid_freq_event
@@ -15810,7 +15817,7 @@ int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy,
     * for every second, so indicating framework that scan is aborted
     * and return success.
     */
    if (pHddCtx->cfg_ini->is_sw_pta_enabled && pHddCtx->is_sco_enabled) {
    if (hdd_is_sw_pta_enabled(pHddCtx) && pHddCtx->is_sco_enabled) {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                  FL("BT SCO operation in progress"));
        hdd_cfg80211_scan_done(pAdapter, request, true);
@@ -16338,7 +16345,7 @@ int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter,
    /**
     * If sw pta is enabled, new connections should not allowed.
     */
    if (pHddCtx->cfg_ini->is_sw_pta_enabled && pHddCtx->is_sco_enabled) {
    if (hdd_is_sw_pta_enabled(pHddCtx) && pHddCtx->is_sco_enabled) {
        hddLog(VOS_TRACE_LEVEL_ERROR, "%s: BT SCO operation in progress",
               __func__);
        return -EINVAL;
@@ -20101,7 +20108,7 @@ void hdd_cfg80211_sched_scan_done_callback(void *callbackContext,
    /**
     * If sw pta is enabled, scan results should not send to framework.
     */
    if (pHddCtx->cfg_ini->is_sw_pta_enabled && pHddCtx->is_sco_enabled) {
    if (hdd_is_sw_pta_enabled(pHddCtx) && pHddCtx->is_sco_enabled) {
        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
                  FL("BT SCO operation in progress"));
        return;
+30 −14
Original line number Diff line number Diff line
@@ -3925,8 +3925,8 @@ static void hdd_sco_resp_callback(uint8_t sco_status)
	complete(&hdd_ctx->sw_pta_comp);
}
static ssize_t __hdd_process_bt_sco_profile(hdd_context_t *hdd_ctx,
					    char *profile_mode)
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);
	hdd_station_ctx_t *hdd_sta_ctx;
@@ -3941,24 +3941,20 @@ static ssize_t __hdd_process_bt_sco_profile(hdd_context_t *hdd_ctx,
		return -EINVAL;
	}
	if (!strcmp(profile_mode, "ENABLE")) {
	if (bt_sco) {
		if (hdd_ctx->is_sco_enabled) {
			hddLog(VOS_TRACE_LEVEL_ERROR, "%s: BT SCO is already enabled",
			       __func__);
			hddLog(VOS_TRACE_LEVEL_ERROR,
			       "%s: BT SCO is already enabled", __func__);
			return 0;
		}
		sco_status = true;
	} else if (!strcmp(profile_mode, "DISABLE")) {
	} else {
		if (!hdd_ctx->is_sco_enabled) {
			hddLog(VOS_TRACE_LEVEL_ERROR, "%s: BT SCO is already disabled",
			       __func__);
			hddLog(VOS_TRACE_LEVEL_ERROR,
			       "%s: BT SCO is already disabled", __func__);
			return 0;
		}
		sco_status = false;
	} else {
		hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid profile mode %s",
		       __func__, profile_mode);
		return -EINVAL;
	}
	INIT_COMPLETION(hdd_ctx->sw_pta_comp);
@@ -3981,7 +3977,7 @@ static ssize_t __hdd_process_bt_sco_profile(hdd_context_t *hdd_ctx,
		return -EINVAL;
	}
	if (!strcmp(profile_mode, "DISABLE")) {
	if (!bt_sco) {
		hdd_ctx->is_sco_enabled = false;
		mac_ctx->isCoexScoIndSet = 0;
		return 0;
@@ -4032,6 +4028,23 @@ static ssize_t __hdd_process_bt_sco_profile(hdd_context_t *hdd_ctx,
	return 0;
}
static void hdd_init_sw_pta(hdd_context_t *hdd_ctx)
{
	init_completion(&hdd_ctx->sw_pta_comp);
}
static void hdd_deinit_sw_pta(hdd_context_t *hdd_ctx)
{
	complete(&hdd_ctx->sw_pta_comp);
}
#else
static void hdd_init_sw_pta(hdd_context_t *hdd_ctx)
{
}
static void hdd_deinit_sw_pta(hdd_context_t *hdd_ctx)
{
}
#endif
static int hdd_driver_command(hdd_adapter_t *pAdapter,
@@ -12632,6 +12645,7 @@ void hdd_wlan_exit(hdd_context_t *pHddCtx)
      wlan_hdd_ftm_close(pHddCtx);
      goto free_hdd_ctx;
   }
   hdd_deinit_sw_pta(pHddCtx);
   /* DeRegister with platform driver as client for Suspend/Resume */
   vosStatus = hddDeregisterPmOps(pHddCtx);
@@ -14752,6 +14766,8 @@ int hdd_wlan_startup(struct device *dev )
   hdd_assoc_registerFwdEapolCB(pVosContext);
   mutex_init(&pHddCtx->cache_channel_lock);
   hdd_init_sw_pta(pHddCtx);
   goto success;
err_open_cesium_nl_sock:
+21 −0
Original line number Diff line number Diff line
@@ -604,4 +604,25 @@ void vos_reset_recovery_reason(void);
VOS_STATUS vos_smd_open(const char *szname, WCTS_ControlBlockType* wcts_cb);

void wlan_unregister_driver(void);

#ifdef FEATURE_WLAN_SW_PTA
/**
 * vos_process_bt_profile - process BT profile
 * @bt_enabled: status of BT
 * @ble: status of BLE
 * @a2dp: stautus of A2DP
 * @bt_sco: status of SCO
 *
 * Return: 0 on success and error on failure
 */
int vos_process_bt_profile(bool bt_enabled, bool ble,
			   bool a2dp, bool bt_sco);
#else
static inline int
vos_process_bt_profile(bool bt_enabled, bool ble,
		       bool a2dp, bool bt_sco)
{
	return -ENOTSUPP;
}
#endif /* FEATURE_WLAN_SW_PTA */
#endif // if !defined __VOS_NVITEM_H
+36 −0
Original line number Diff line number Diff line
@@ -3986,6 +3986,42 @@ void wlan_unregister_driver(void )
{
	wcnss_unregister_driver(&driver_ops);
}

#ifdef FEATURE_WLAN_SW_PTA
int vos_process_bt_profile(bool bt_enabled, bool ble,
			   bool a2dp, bool bt_sco)
{
	v_CONTEXT_t vos_ctx = vos_get_global_context(VOS_MODULE_ID_SYS, NULL);
	hdd_context_t *hdd_ctx;
	int ret;

	if (!vos_ctx) {
		VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
			  "%s: Global VOS context is Null", __func__);
		return -EINVAL;
	}

	hdd_ctx = vos_get_context(VOS_MODULE_ID_HDD, vos_ctx);
	if (wlan_hdd_validate_context(hdd_ctx)) {
		if (hdd_ctx && hdd_ctx->isLogpInProgress)
			return -EAGAIN;
		return -EINVAL;
	}

	if (!hdd_ctx->cfg_ini->is_sw_pta_enabled) {
		VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
			  "%s: sw pta is not enabled", __func__);
		return -EINVAL;
	}

	ret = hdd_process_bt_sco_profile(hdd_ctx, bt_enabled, bt_sco);
	if (ret)
		VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
			  "%s: Unable to process bt sco profile", __func__);

	return ret;
}
#endif
#else
VOS_STATUS vos_smd_open(const char *szname, WCTS_ControlBlockType* wcts_cb)
{
Loading