wl1271: Implement delayed entry into ELP
Implement delayed entry into ELP. This will promote the following: - Less redundant sleep/wake cycles (better perf) - Avoids known firmware issues with going to ELP too fast after an operation Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Vidhya Govindan <vidhya.govindan@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
1e2b79761d
commit
37b70a8185
|
@ -373,6 +373,7 @@ struct wl1271 {
|
||||||
bool elp;
|
bool elp;
|
||||||
|
|
||||||
struct completion *elp_compl;
|
struct completion *elp_compl;
|
||||||
|
struct delayed_work elp_work;
|
||||||
|
|
||||||
/* we can be in psm, but not in elp, we have to differentiate */
|
/* we can be in psm, but not in elp, we have to differentiate */
|
||||||
bool psm;
|
bool psm;
|
||||||
|
|
|
@ -1226,6 +1226,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)
|
||||||
skb_queue_head_init(&wl->tx_queue);
|
skb_queue_head_init(&wl->tx_queue);
|
||||||
|
|
||||||
INIT_WORK(&wl->filter_work, wl1271_filter_work);
|
INIT_WORK(&wl->filter_work, wl1271_filter_work);
|
||||||
|
INIT_DELAYED_WORK(&wl->elp_work, wl1271_elp_work);
|
||||||
wl->channel = WL1271_DEFAULT_CHANNEL;
|
wl->channel = WL1271_DEFAULT_CHANNEL;
|
||||||
wl->scanning = false;
|
wl->scanning = false;
|
||||||
wl->default_key = 0;
|
wl->default_key = 0;
|
||||||
|
|
|
@ -27,25 +27,43 @@
|
||||||
|
|
||||||
#define WL1271_WAKEUP_TIMEOUT 500
|
#define WL1271_WAKEUP_TIMEOUT 500
|
||||||
|
|
||||||
|
void wl1271_elp_work(struct work_struct *work)
|
||||||
|
{
|
||||||
|
struct delayed_work *dwork;
|
||||||
|
struct wl1271 *wl;
|
||||||
|
|
||||||
|
dwork = container_of(work, struct delayed_work, work);
|
||||||
|
wl = container_of(dwork, struct wl1271, elp_work);
|
||||||
|
|
||||||
|
wl1271_debug(DEBUG_PSM, "elp work");
|
||||||
|
|
||||||
|
mutex_lock(&wl->mutex);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME: below, by means of the "true", ELP has been disabled for now
|
||||||
|
* to work around a firmware bug. To be enabled upon receiving a new
|
||||||
|
* firmware version.
|
||||||
|
*/
|
||||||
|
if (true || wl->elp || !wl->psm)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
wl1271_debug(DEBUG_PSM, "chip to elp");
|
||||||
|
wl1271_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_SLEEP);
|
||||||
|
wl->elp = true;
|
||||||
|
|
||||||
|
out:
|
||||||
|
mutex_unlock(&wl->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ELP_ENTRY_DELAY 5
|
||||||
|
|
||||||
/* Routines to toggle sleep mode while in ELP */
|
/* Routines to toggle sleep mode while in ELP */
|
||||||
void wl1271_ps_elp_sleep(struct wl1271 *wl)
|
void wl1271_ps_elp_sleep(struct wl1271 *wl)
|
||||||
{
|
{
|
||||||
/*
|
if (wl->psm) {
|
||||||
* FIXME: due to a problem in the firmware (causing a firmware
|
cancel_delayed_work(&wl->elp_work);
|
||||||
* crash), ELP entry is prevented below. Remove the "true" to
|
ieee80211_queue_delayed_work(wl->hw, &wl->elp_work,
|
||||||
* re-enable ELP entry.
|
msecs_to_jiffies(ELP_ENTRY_DELAY));
|
||||||
*/
|
|
||||||
if (true || wl->elp || !wl->psm)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Go to ELP unless there is work already pending - pending work
|
|
||||||
* will immediately wakeup the chipset anyway.
|
|
||||||
*/
|
|
||||||
if (!work_pending(&wl->irq_work) && !work_pending(&wl->tx_work)) {
|
|
||||||
wl1271_debug(DEBUG_PSM, "chip to elp");
|
|
||||||
wl1271_write32(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, ELPCTRL_SLEEP);
|
|
||||||
wl->elp = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,6 @@
|
||||||
int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode);
|
int wl1271_ps_set_mode(struct wl1271 *wl, enum wl1271_cmd_ps_mode mode);
|
||||||
void wl1271_ps_elp_sleep(struct wl1271 *wl);
|
void wl1271_ps_elp_sleep(struct wl1271 *wl);
|
||||||
int wl1271_ps_elp_wakeup(struct wl1271 *wl, bool chip_awake);
|
int wl1271_ps_elp_wakeup(struct wl1271 *wl, bool chip_awake);
|
||||||
|
void wl1271_elp_work(struct work_struct *work);
|
||||||
|
|
||||||
#endif /* __WL1271_PS_H__ */
|
#endif /* __WL1271_PS_H__ */
|
||||||
|
|
Loading…
Reference in New Issue