qcacld-3.0: add CDS API to check if driver state module stop

Add a CDS API to check if the driver state is module stop and
also register for QDF wrapper for the same.

Change-Id: I99fbdda593ca229ef8db956c609735ae6509d511
CRs-Fixed: 2912747
This commit is contained in:
Vevek Venkatesan 2021-03-31 12:16:19 +05:30 • committed by snandini
commit d03b22c36f
3 changed files with 27 additions and 11 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -60,7 +60,7 @@
* CDS_DRIVER_STATE_UNLOADING: Driver remove is in progress.
* CDS_DRIVER_STATE_RECOVERING: Recovery in progress.
* CDS_DRIVER_STATE_BAD: Driver in bad state.
* CDS_DRIVER_STATE_MODULE_STOPPING: Module stop in progress.
* CDS_DRIVER_STATE_MODULE_STOP: Module stop in progress or done.
* CDS_DRIVER_STATE_ASSERTING_TARGET: Driver assert target in progress.
*/
enum cds_driver_state {
@ -71,7 +71,7 @@ enum cds_driver_state {
CDS_DRIVER_STATE_RECOVERING = BIT(3),
CDS_DRIVER_STATE_BAD = BIT(4),
CDS_DRIVER_STATE_FW_READY = BIT(5),
CDS_DRIVER_STATE_MODULE_STOPPING = BIT(6),
CDS_DRIVER_STATE_MODULE_STOP = BIT(6),
CDS_DRIVER_STATE_ASSERTING_TARGET = BIT(7),
};
@ -163,6 +163,18 @@ static inline bool cds_is_target_ready(void)
return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_FW_READY);
}
/**
* cds_is_driver_state_module_stop - Is module stop is in-progress or done
*
* Return: true if driver state is module stop and false otherwise.
*/
static inline bool cds_is_driver_state_module_stop(void)
{
enum cds_driver_state state = cds_get_driver_state();
return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_MODULE_STOP);
}
/**
* cds_set_recovery_in_progress() - Set recovery in progress
* @value: value to set
@ -248,18 +260,18 @@ static inline void cds_set_unload_in_progress(uint8_t value)
}
/**
* cds_set_module_stop_in_progress() - Setting module stop in progress
* cds_set_driver_state_module_stop() - Setting module stop in progress or done
*
* @value: value to set
*
* Return: none
*/
static inline void cds_set_module_stop_in_progress(bool value)
static inline void cds_set_driver_state_module_stop(bool value)
{
if (value)
cds_set_driver_state(CDS_DRIVER_STATE_MODULE_STOPPING);
cds_set_driver_state(CDS_DRIVER_STATE_MODULE_STOP);
else
cds_clear_driver_state(CDS_DRIVER_STATE_MODULE_STOPPING);
cds_clear_driver_state(CDS_DRIVER_STATE_MODULE_STOP);
}
/**

View file

@ -248,6 +248,8 @@ QDF_STATUS cds_init(void)
qdf_register_self_recovery_callback(cds_trigger_recovery_psoc);
qdf_register_fw_down_callback(cds_is_fw_down);
qdf_register_is_driver_unloading_callback(cds_is_driver_unloading);
qdf_register_is_driver_state_module_stop_callback(
cds_is_driver_state_module_stop);
qdf_register_recovering_state_query_callback(cds_is_driver_recovering);
qdf_register_drv_connected_callback(cds_is_drv_connected);
qdf_register_drv_supported_callback(cds_is_drv_supported);
@ -276,6 +278,7 @@ void cds_deinit(void)
qdf_register_recovering_state_query_callback(NULL);
qdf_register_fw_down_callback(NULL);
qdf_register_is_driver_unloading_callback(NULL);
qdf_register_is_driver_state_module_stop_callback(NULL);
qdf_register_self_recovery_callback(NULL);
qdf_register_wmi_send_recv_qmi_callback(NULL);

View file

@ -3900,6 +3900,8 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit)
return 0;
}
cds_set_driver_state_module_stop(false);
switch (hdd_ctx->driver_status) {
case DRIVER_MODULES_UNINITIALIZED:
hdd_nofl_debug("Wlan transitioning (UNINITIALIZED -> CLOSED)");
@ -4176,6 +4178,7 @@ release_lock:
cds_shutdown_notifier_purge();
hdd_check_for_leaks(hdd_ctx, reinit);
hdd_debug_domain_set(QDF_DEBUG_DOMAIN_INIT);
cds_set_driver_state_module_stop(true);
hdd_exit();
@ -14298,7 +14301,7 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode)
return -EINVAL;
}
cds_set_module_stop_in_progress(true);
cds_set_driver_state_module_stop(true);
debugfs_threads = hdd_return_debugfs_threads_count();
@ -14308,7 +14311,7 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode)
if (IS_IDLE_STOP && !ftm_mode) {
hdd_psoc_idle_timer_start(hdd_ctx);
cds_set_module_stop_in_progress(false);
cds_set_driver_state_module_stop(false);
hdd_bus_bw_compute_timer_stop(hdd_ctx);
return -EAGAIN;
@ -14477,8 +14480,6 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode)
hdd_debug("Wlan transitioned (now CLOSED)");
done:
cds_set_module_stop_in_progress(false);
hdd_exit();
return ret;