qcacld-3.0: Add lock/unlock for idle restart to prevent suspend

During idle restart, system suspend is happening, which is leading
to timeout because idle restart task is frozen during system suspend.
To avoid the timeout, add a wakelock for idle restart to prevent
system suspend.

Change-Id: Iffb6151452680df8cb4fb98e8646112e780881f8
CRs-Fixed: 2490321
This commit is contained in:
Alan Chen 2019-07-15 16:45:09 -07:00 committed by nshrivas
parent 59a9a78079
commit e523cd9f23
3 changed files with 45 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2017 The Linux Foundation. All rights reserved. * Copyright (c) 2015-2017, 2019 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@ -118,4 +118,22 @@ void hdd_hif_close(struct hdd_context *hdd_ctx, void *hif_ctx);
int hdd_hif_open(struct device *dev, void *bdev, const struct hif_bus_id *bid, int hdd_hif_open(struct device *dev, void *bdev, const struct hif_bus_id *bid,
enum qdf_bus_type bus_type, bool reinit); enum qdf_bus_type bus_type, bool reinit);
/**
* hdd_soc_idle_restart_lock() - Takes wakelock for idle restart
*
* This function takes wakelock to prevent suspend during idle restart
*
* Return: none
*/
void hdd_soc_idle_restart_lock(void);
/**
* hdd_soc_idle_restart_unlock() - Releases wakelock for idle restart
*
* This function releases wakelock to allow suspend after idle restart
*
* Return: none
*/
void hdd_soc_idle_restart_unlock(void);
#endif /* __WLAN_HDD_DRIVER_OPS_H__ */ #endif /* __WLAN_HDD_DRIVER_OPS_H__ */

View File

@ -375,6 +375,16 @@ static int check_for_probe_defer(int ret)
} }
#endif #endif
void hdd_soc_idle_restart_lock(void)
{
hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_IDLE_RESTART);
}
void hdd_soc_idle_restart_unlock(void)
{
hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_IDLE_RESTART);
}
static void hdd_soc_load_lock(struct device *dev) static void hdd_soc_load_lock(struct device *dev)
{ {
hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT); hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT);

View File

@ -9406,7 +9406,15 @@ int hdd_psoc_idle_shutdown(struct device *dev)
static int __hdd_psoc_idle_restart(struct hdd_context *hdd_ctx) static int __hdd_psoc_idle_restart(struct hdd_context *hdd_ctx)
{ {
return hdd_wlan_start_modules(hdd_ctx, false); int ret;
hdd_soc_idle_restart_lock();
ret = hdd_wlan_start_modules(hdd_ctx, false);
hdd_soc_idle_restart_unlock();
return ret;
} }
int hdd_psoc_idle_restart(struct device *dev) int hdd_psoc_idle_restart(struct device *dev)
@ -9433,7 +9441,9 @@ int hdd_trigger_psoc_idle_restart(struct hdd_context *hdd_ctx)
return 0; return 0;
} }
hdd_soc_idle_restart_lock();
ret = pld_idle_restart(hdd_ctx->parent_dev, hdd_psoc_idle_restart); ret = pld_idle_restart(hdd_ctx->parent_dev, hdd_psoc_idle_restart);
hdd_soc_idle_restart_unlock();
return ret; return ret;
} }
@ -13693,11 +13703,15 @@ static int hdd_mode_change_psoc_idle_shutdown(struct device *dev)
static int hdd_mode_change_psoc_idle_restart(struct device *dev) static int hdd_mode_change_psoc_idle_restart(struct device *dev)
{ {
struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
int ret;
if (!hdd_ctx) if (!hdd_ctx)
return -EINVAL; return -EINVAL;
hdd_soc_idle_restart_lock();
ret = hdd_wlan_start_modules(hdd_ctx, false);
hdd_soc_idle_restart_unlock();
return hdd_wlan_start_modules(hdd_ctx, false); return ret;
} }
/** /**