msm: ipa: eth: Prevent suspend for 2 seconds after device resume

Hold wake lock for 2 seconds after a device resume for allowing the
device to settle and link interrupts to arrive after a resume.

Change-Id: I91fd3d689895a9526d66d613a273cb7cc231fb2e
Signed-off-by: Jinesh K. Jayakumar <jineshk@codeaurora.org>
tirimbino
Jinesh K. Jayakumar 5 years ago committed by Gerrit - the friendly Code Review server
parent 6e0829cb46
commit b3201eeadf
  1. 7
      drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth.c
  2. 30
      drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth_i.h
  3. 6
      drivers/platform/msm/ipa/ipa_v3/ethernet/ipa_eth_pci.c

@ -571,9 +571,10 @@ static int ipa_eth_pm_notifier_event_suspend_prepare(
* and reverts the device suspension by aborting the system suspend.
*/
if (ipa_eth_net_check_active(eth_dev)) {
pr_info("%s: %s is active, preventing suspend for some time",
IPA_ETH_SUBSYS, eth_dev->net_dev->name);
ipa_eth_dev_wakeup_event(eth_dev);
pr_info("%s: %s is active, preventing suspend for %u ms",
IPA_ETH_SUBSYS, eth_dev->net_dev->name,
IPA_ETH_WAKE_TIME_MS);
pm_wakeup_dev_event(eth_dev->dev, IPA_ETH_WAKE_TIME_MS, false);
return NOTIFY_BAD;
}

@ -35,8 +35,12 @@
#define IPA_ETH_IPC_LOGDBG_DEFAULT false
#endif
/* Time to remain awake after a suspend abort due to NIC activity */
#define IPA_ETH_WAKE_TIME_MS 500
/* Time for NIC HW to settle down (ex. receive link interrupt) after a resume */
#define IPA_ETH_RESUME_SETTLE_MS 2000
#define IPA_ETH_PFDEV (ipa3_ctx ? ipa3_ctx->pdev : NULL)
#define IPA_ETH_SUBSYS "ipa_eth"
@ -161,9 +165,31 @@ extern bool ipa_eth_ipc_logdbg;
bool ipa_eth_is_ready(void);
bool ipa_eth_all_ready(void);
static inline void ipa_eth_dev_wakeup_event(struct ipa_eth_device *eth_dev)
static inline void ipa_eth_dev_assume_active_ms(
struct ipa_eth_device *eth_dev,
unsigned int msec)
{
eth_dev_priv(eth_dev)->assume_active +=
DIV_ROUND_UP(msec, IPA_ETH_WAKE_TIME_MS);
pm_system_wakeup();
}
static inline void ipa_eth_dev_assume_active_inc(
struct ipa_eth_device *eth_dev,
unsigned int count)
{
eth_dev_priv(eth_dev)->assume_active += count;
pm_system_wakeup();
}
static inline void ipa_eth_dev_assume_active_dec(
struct ipa_eth_device *eth_dev,
unsigned int count)
{
pm_wakeup_dev_event(eth_dev->dev, IPA_ETH_WAKE_TIME_MS, false);
if (eth_dev_priv(eth_dev)->assume_active > count)
eth_dev_priv(eth_dev)->assume_active -= count;
else
eth_dev_priv(eth_dev)->assume_active = 0;
}
struct ipa_eth_device *ipa_eth_alloc_device(

@ -374,7 +374,7 @@ static int ipa_eth_pci_suspend_late_handler(struct device *dev)
IPA_ETH_SUBSYS, eth_dev->net_dev->name);
/* Have PM_SUSPEND_PREPARE give us one wakeup time quanta */
eth_dev_priv(eth_dev)->assume_active++;
ipa_eth_dev_assume_active_inc(eth_dev, 1);
return -EAGAIN;
}
@ -428,8 +428,8 @@ static int ipa_eth_pci_resume_handler(struct device *dev)
"Device resume delegated to net driver");
rc = eth_dev_pm_ops(eth_dev)->resume(dev);
/* Give some time after a resume for the device to settle */
eth_dev_priv(eth_dev)->assume_active++;
/* Give some time for device to settle after a resume */
ipa_eth_dev_assume_active_ms(eth_dev, IPA_ETH_RESUME_SETTLE_MS);
}
if (rc)

Loading…
Cancel
Save