wcnss: add API to check if wcnss is undergoing an SSR
Wlan driver should not read registers from wcnss or
try to communicate with the chip when it is undergoing
a subsystem-restart. Added an API with the wcnss platform
driver to check if ssr is in progress, this API will be
used by the wlan driver to protect register access and
other prohibited operations.
Change-Id: Ia0d93e774af126d84dbaabf5c36a2c90fdbd58be
CRs-Fixed: 621974
Signed-off-by: Mihir Shete <smihir@codeaurora.org>
diff --git a/drivers/net/wireless/wcnss/wcnss_wlan.c b/drivers/net/wireless/wcnss/wcnss_wlan.c
index e0b30ba..d079cf0 100644
--- a/drivers/net/wireless/wcnss/wcnss_wlan.c
+++ b/drivers/net/wireless/wcnss/wcnss_wlan.c
@@ -275,6 +275,7 @@
u16 unsafe_ch_count;
u16 unsafe_ch_list[WCNSS_MAX_CH_NUM];
void *wcnss_notif_hdle;
+ u8 is_shutdown;
} *penv = NULL;
static ssize_t wcnss_wlan_macaddr_store(struct device *dev,
@@ -643,12 +644,20 @@
int wcnss_device_ready(void)
{
- if (penv && penv->pdev && penv->nv_downloaded)
+ if (penv && penv->pdev && penv->nv_downloaded &&
+ !wcnss_device_is_shutdown())
return 1;
return 0;
}
EXPORT_SYMBOL(wcnss_device_ready);
+int wcnss_device_is_shutdown(void)
+{
+ if (penv && penv->is_shutdown)
+ return 1;
+ return 0;
+}
+EXPORT_SYMBOL(wcnss_device_is_shutdown);
struct resource *wcnss_wlan_get_memory_map(struct device *dev)
{
@@ -1689,6 +1698,11 @@
{
pr_debug("%s: wcnss notification event: %lu\n", __func__, code);
+ if (SUBSYS_BEFORE_SHUTDOWN == code)
+ penv->is_shutdown = 1;
+ else if (SUBSYS_AFTER_POWERUP == code)
+ penv->is_shutdown = 0;
+
return NOTIFY_DONE;
}
diff --git a/include/linux/wcnss_wlan.h b/include/linux/wcnss_wlan.h
index 5e0b71e..a07db8e 100644
--- a/include/linux/wcnss_wlan.h
+++ b/include/linux/wcnss_wlan.h
@@ -66,6 +66,7 @@
void *wcnss_prealloc_get(unsigned int size);
int wcnss_prealloc_put(void *ptr);
int wcnss_device_ready(void);
+int wcnss_device_is_shutdown(void);
int wcnss_wlan_iris_xo_mode(void);
int wcnss_set_wlan_unsafe_channel(
u16 *unsafe_ch_list, u16 ch_count);