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

Commit 2434756a authored by Jingxiang Ge's avatar Jingxiang Ge Committed by Madan Koyyalamudi
Browse files

qcacld-3.0: check sta connected state for dynamic rtpm

Current even without connection, there is possible
rtpm is vote for up, which block suspend. which cause
more power consumption.

change as only allow pm qos vote when sta connected.

Change-Id: I44176ee233d4b2fb1d7a0d51936c847b2ce5f327
CRs-Fixed: 3019401
parent f4e2dd67
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -273,6 +273,14 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress(
 */
void hdd_abort_ongoing_sta_connection(struct hdd_context *hdd_ctx);

/**
 * hdd_is_any_sta_connected() - check if any sta in connected state
 * @hdd_ctx: hdd context
 *
 * Return: true if any connected sta
 */
bool hdd_is_any_sta_connected(struct hdd_context *hdd_ctx);

/**
 * hdd_sme_roam_callback() - hdd sme roam callback
 * @context: pointer to adapter context
+1 −0
Original line number Diff line number Diff line
@@ -516,6 +516,7 @@ typedef enum {
	NET_DEV_HOLD_DISPLAY_TXRX_STATS = 58,
	NET_DEV_HOLD_GET_MODE_SPECIFIC_IF_COUNT = 59,
	NET_DEV_HOLD_START_PRE_CAC_TRANS = 60,
	NET_DEV_HOLD_IS_ANY_STA_CONNECTED = 61,

	/* Keep it at the end */
	NET_DEV_HOLD_ID_MAX
+31 −0
Original line number Diff line number Diff line
@@ -470,6 +470,37 @@ void hdd_abort_ongoing_sta_connection(struct hdd_context *hdd_ctx)
	}
}

bool hdd_is_any_sta_connected(struct hdd_context *hdd_ctx)
{
	struct hdd_adapter *adapter = NULL, *next_adapter = NULL;
	struct hdd_station_ctx *hdd_sta_ctx;
	wlan_net_dev_ref_dbgid dbgid =
				NET_DEV_HOLD_IS_ANY_STA_CONNECTED;

	if (!hdd_ctx) {
		hdd_err("HDD context is NULL");
		return false;
	}

	hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
					   dbgid) {
		hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
		if (QDF_STA_MODE == adapter->device_mode ||
		    QDF_P2P_CLIENT_MODE == adapter->device_mode) {
			if (eConnectionState_Associated ==
				   hdd_sta_ctx->conn_info.conn_state) {
				hdd_adapter_dev_put_debug(adapter, dbgid);
				if (next_adapter)
					hdd_adapter_dev_put_debug(next_adapter,
								  dbgid);
				return true;
			}
		}
		hdd_adapter_dev_put_debug(adapter, dbgid);
	}
	return false;
}

/**
 * hdd_remove_beacon_filter() - remove beacon filter
 * @adapter: Pointer to the hdd adapter
+1 −0
Original line number Diff line number Diff line
@@ -5952,6 +5952,7 @@ static char *net_dev_ref_debug_string_from_id(wlan_net_dev_ref_dbgid dbgid)
		"NET_DEV_HOLD_DISPLAY_TXRX_STATS",
		"NET_DEV_HOLD_GET_MODE_SPECIFIC_IF_COUNT",
		"NET_DEV_HOLD_START_PRE_CAC_TRANS",
		"NET_DEV_HOLD_IS_ANY_STA_CONNECTED",
		"NET_DEV_HOLD_ID_MAX"};
	int32_t num_dbg_strings = QDF_ARRAY_SIZE(strings);

+7 −2
Original line number Diff line number Diff line
@@ -1185,6 +1185,7 @@ int wlan_hdd_pm_qos_notify(struct notifier_block *nb, unsigned long curr_val,
	struct hdd_context *hdd_ctx = container_of(nb, struct hdd_context,
						   pm_qos_notifier);
	void *hif_ctx;
	bool is_any_sta_connected = false;

	if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) {
		hdd_debug_rl("Driver Module closed; skipping pm qos notify");
@@ -1197,11 +1198,15 @@ int wlan_hdd_pm_qos_notify(struct notifier_block *nb, unsigned long curr_val,
		return -EINVAL;
	}

	hdd_debug("PM QOS update: runtime_pm_prevented %d Current value: %ld",
		  hdd_ctx->runtime_pm_prevented, curr_val);
	is_any_sta_connected = hdd_is_any_sta_connected(hdd_ctx);

	hdd_debug("PM QOS update: runtime_pm_prevented %d Current value: %ld, is_any_sta_connected %d",
		  hdd_ctx->runtime_pm_prevented, curr_val,
		  is_any_sta_connected);
	qdf_spin_lock_irqsave(&hdd_ctx->pm_qos_lock);

	if (!hdd_ctx->runtime_pm_prevented &&
	    is_any_sta_connected &&
	    curr_val != wlan_hdd_get_pm_qos_cpu_latency()) {
		hif_pm_runtime_get_noresume(hif_ctx, RTPM_ID_QOS_NOTIFY);
		hdd_ctx->runtime_pm_prevented = true;