icnss2: Handle AON ready event

During cold boot AON sends multiple DOWN and UP notifications
as part of its FW update. ICNSS driver should not initiate
any QMI handshakes and should wait till correct FW is flashed.

After successfully flashing correct FW, AON will send ready event.
Once AON ready event receives ICNSS driver sets AON ready bit and
proceeds with QMI handshakes.

Similarly in AON SSR, this change handles UP notification only if
AON ready bit is set.

Change-Id: I326d731cd3f619cef9fa8c072a1e898f4b21a6ce
CRs-Fixed: 3491699
This commit is contained in:
Dundi Raviteja
2023-05-28 08:43:23 +05:30
parent 401152234c
commit de80f12c97
3 changed files with 60 additions and 2 deletions

View File

@@ -47,6 +47,8 @@
#include <trace/hooks/remoteproc.h>
#ifdef SLATE_MODULE_ENABLED
#include <linux/soc/qcom/slatecom_interface.h>
#include <linux/soc/qcom/slate_events_bridge_intf.h>
#include <uapi/linux/slatecom_interface.h>
#endif
#include "main.h"
#include "qmi.h"
@@ -2345,6 +2347,43 @@ static int icnss_wpss_ssr_register_notifier(struct icnss_priv *priv)
}
#ifdef SLATE_MODULE_ENABLED
static int icnss_slate_event_notifier_nb(struct notifier_block *nb,
unsigned long event, void *data)
{
if (event == SLATE_STATUS) {
struct icnss_priv *priv = container_of(nb, struct icnss_priv,
seb_nb);
enum boot_status status = *(enum boot_status *)data;
if (status == SLATE_READY) {
icnss_pr_dbg("Slate ready received, state: 0x%lx\n",
priv->state);
set_bit(ICNSS_SLATE_READY, &priv->state);
set_bit(ICNSS_SLATE_UP, &priv->state);
complete(&priv->slate_boot_complete);
}
}
return NOTIFY_OK;
}
static int icnss_register_slate_event_notifier(struct icnss_priv *priv)
{
int ret = 0;
priv->seb_nb.notifier_call = icnss_slate_event_notifier_nb;
priv->seb_handle = seb_register_for_slate_event(SLATE_STATUS,
&priv->seb_nb);
if (IS_ERR_OR_NULL(priv->seb_handle)) {
ret = priv->seb_handle ? PTR_ERR(priv->seb_handle) : -EINVAL;
icnss_pr_err("SLATE event register notifier failed: %d\n",
ret);
}
return ret;
}
static int icnss_slate_notifier_nb(struct notifier_block *nb,
unsigned long code,
void *data)
@@ -2355,7 +2394,8 @@ static int icnss_slate_notifier_nb(struct notifier_block *nb,
icnss_pr_vdbg("Slate-subsys-notify: event %lu\n", code);
if (code == QCOM_SSR_AFTER_POWERUP) {
if (code == QCOM_SSR_AFTER_POWERUP &&
test_bit(ICNSS_SLATE_READY, &priv->state)) {
set_bit(ICNSS_SLATE_UP, &priv->state);
complete(&priv->slate_boot_complete);
icnss_pr_dbg("Slate boot complete, state: 0x%lx\n",
@@ -2413,6 +2453,11 @@ static int icnss_slate_ssr_unregister_notifier(struct icnss_priv *priv)
return 0;
}
#else
static int icnss_register_slate_event_notifier(struct icnss_priv *priv)
{
return 0;
}
static int icnss_slate_ssr_register_notifier(struct icnss_priv *priv)
{
return 0;
@@ -2756,8 +2801,10 @@ static int icnss_enable_recovery(struct icnss_priv *priv)
icnss_modem_ssr_register_notifier(priv);
if (priv->is_slate_rfa)
if (priv->is_slate_rfa) {
icnss_slate_ssr_register_notifier(priv);
icnss_register_slate_event_notifier(priv);
}
if (test_bit(SSR_ONLY, &priv->ctrl_params.quirks)) {
icnss_pr_dbg("PDR disabled through module parameter\n");