qcacmn: Make hif_sleep_entry pci specific

Snoc does not use the force wake mechanism.  Isolate force
wake code to reduce dummy implementations.

Change-Id: Ief32778cadb7d1b9c905535ea0d01604246c72df
CRs-Fixed: 986480
This commit is contained in:
Houston Hoffman
2016-03-14 21:11:49 -07:00
committed by Vishwajith Upendra
parent e61d4e1382
commit 63777f221f
3 changed files with 78 additions and 61 deletions

View File

@@ -1492,40 +1492,6 @@ static struct service_to_pipe target_service_to_ce_map_wlan_epping[] = {
{0, 0, 0,}, /* Must be last */
};
static void hif_sleep_entry(void *arg)
{
struct HIF_CE_state *hif_state = (struct HIF_CE_state *)arg;
struct hif_softc *scn = HIF_GET_SOFTC(hif_state);
uint32_t idle_ms;
if (scn->recovery)
return;
if (hif_is_driver_unloading(scn))
return;
qdf_spin_lock_irqsave(&hif_state->keep_awake_lock);
if (hif_state->verified_awake == false) {
idle_ms = qdf_system_ticks_to_msecs(qdf_system_ticks()
- hif_state->sleep_ticks);
if (idle_ms >= HIF_MIN_SLEEP_INACTIVITY_TIME_MS) {
if (!qdf_atomic_read(&scn->link_suspended)) {
soc_wake_reset(scn);
hif_state->fake_sleep = false;
}
} else {
qdf_timer_stop(&hif_state->sleep_timer);
qdf_timer_start(&hif_state->sleep_timer,
HIF_SLEEP_INACTIVITY_TIMER_PERIOD_MS);
}
} else {
qdf_timer_stop(&hif_state->sleep_timer);
qdf_timer_start(&hif_state->sleep_timer,
HIF_SLEEP_INACTIVITY_TIMER_PERIOD_MS);
}
qdf_spin_unlock_irqrestore(&hif_state->keep_awake_lock);
}
/**
* hif_get_target_ce_config() - get copy engine configuration
* @target_ce_config_ret: basic copy engine configuration
@@ -1666,11 +1632,6 @@ void hif_unconfig_ce(struct hif_softc *hif_sc)
pipe_info->buf_sz = 0;
}
}
if (hif_state->sleep_timer_init) {
qdf_timer_stop(&hif_state->sleep_timer);
qdf_timer_free(&hif_state->sleep_timer);
hif_state->sleep_timer_init = false;
}
if (hif_sc->athdiag_procfs_inited) {
athdiag_procfs_remove();
hif_sc->athdiag_procfs_inited = false;
@@ -1701,14 +1662,6 @@ int hif_config_ce(struct hif_softc *scn)
scn->notice_send = true;
hif_state->keep_awake_count = 0;
hif_state->fake_sleep = false;
hif_state->sleep_ticks = 0;
qdf_timer_init(NULL, &hif_state->sleep_timer,
hif_sleep_entry, (void *)hif_state,
QDF_TIMER_TYPE_WAKE_APPS);
hif_state->sleep_timer_init = true;
hif_state->fw_indicator_address = FW_INDICATOR_ADDRESS;
hif_config_rri_on_ddr(scn);

View File

@@ -291,18 +291,5 @@ static inline void ce_irq_disable(struct hif_softc *scn, int ce_id)
/* For Rome only need to wake up target */
A_TARGET_ACCESS_BEGIN(scn);
}
/**
* soc_wake_reset() - soc_wake_reset
* @scn: hif_softc
*
* Return: void
*/
static inline void soc_wake_reset(struct hif_softc *scn)
{
hif_write32_mb(scn->mem +
PCIE_LOCAL_BASE_ADDRESS +
PCIE_SOC_WAKE_ADDRESS,
PCIE_SOC_WAKE_RESET);
}
#endif /* HIF_PCI */
#endif /* __HIF_IO32_PCI_H__ */

View File

@@ -37,6 +37,7 @@
#include "if_pci.h"
#include "hif.h"
#include "hif_main.h"
#include "ce_main.h"
#include "ce_api.h"
#include "ce_internal.h"
#include "ce_reg.h"
@@ -1348,6 +1349,65 @@ void hif_wake_target_cpu(struct hif_softc *scn)
QDF_ASSERT(rv == QDF_STATUS_SUCCESS);
}
/**
* soc_wake_reset() - allow the target to go to sleep
* @scn: hif_softc
*
* Clear the force wake register. This is done by
* hif_sleep_entry and cancel defered timer sleep.
*/
static void soc_wake_reset(struct hif_softc *scn)
{
hif_write32_mb(scn->mem +
PCIE_LOCAL_BASE_ADDRESS +
PCIE_SOC_WAKE_ADDRESS,
PCIE_SOC_WAKE_RESET);
}
/**
* hif_sleep_entry() - gate target sleep
* @arg: hif context
*
* This function is the callback for the sleep timer.
* Check if last force awake critical section was at least
* HIF_MIN_SLEEP_INACTIVITY_TIME_MS time ago. if it was,
* allow the target to go to sleep and cancel the sleep timer.
* otherwise reschedule the sleep timer.
*/
static void hif_sleep_entry(void *arg)
{
struct HIF_CE_state *hif_state = (struct HIF_CE_state *)arg;
struct hif_softc *scn = HIF_GET_SOFTC(hif_state);
uint32_t idle_ms;
if (scn->recovery)
return;
if (hif_is_driver_unloading(scn))
return;
qdf_spin_lock_irqsave(&hif_state->keep_awake_lock);
if (hif_state->verified_awake == false) {
idle_ms = qdf_system_ticks_to_msecs(qdf_system_ticks()
- hif_state->sleep_ticks);
if (idle_ms >= HIF_MIN_SLEEP_INACTIVITY_TIME_MS) {
if (!qdf_atomic_read(&scn->link_suspended)) {
soc_wake_reset(scn);
hif_state->fake_sleep = false;
}
} else {
qdf_timer_stop(&hif_state->sleep_timer);
qdf_timer_start(&hif_state->sleep_timer,
HIF_SLEEP_INACTIVITY_TIMER_PERIOD_MS);
}
} else {
qdf_timer_stop(&hif_state->sleep_timer);
qdf_timer_start(&hif_state->sleep_timer,
HIF_SLEEP_INACTIVITY_TIMER_PERIOD_MS);
}
qdf_spin_unlock_irqrestore(&hif_state->keep_awake_lock);
}
#define HIF_HIA_MAX_POLL_LOOP 1000000
#define HIF_HIA_POLLING_DELAY_MS 10
@@ -1635,16 +1695,28 @@ done:
int hif_bus_configure(struct hif_softc *hif_sc)
{
int status = 0;
struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(hif_sc);
hif_ce_prepare_config(hif_sc);
/* initialize sleep state adjust variables */
hif_state->sleep_timer_init = true;
hif_state->keep_awake_count = 0;
hif_state->fake_sleep = false;
hif_state->sleep_ticks = 0;
qdf_timer_init(NULL, &hif_state->sleep_timer,
hif_sleep_entry, (void *)hif_state,
QDF_TIMER_TYPE_WAKE_APPS);
hif_state->sleep_timer_init = true;
if (ADRASTEA_BU) {
status = hif_wlan_enable(hif_sc);
if (status) {
HIF_ERROR("%s: hif_wlan_enable error = %d",
__func__, status);
return status;
goto timer_free;
}
}
@@ -1686,6 +1758,11 @@ disable_wlan:
if (ADRASTEA_BU)
hif_wlan_disable(hif_sc);
timer_free:
qdf_timer_stop(&hif_state->sleep_timer);
qdf_timer_free(&hif_state->sleep_timer);
hif_state->sleep_timer_init = false;
HIF_ERROR("%s: failed, status = %d", __func__, status);
return status;
}