From c803632b846f194002beef03bc216ab844feba7f Mon Sep 17 00:00:00 2001 From: Rishabh Bhatnagar Date: Wed, 29 May 2019 16:36:55 -0700 Subject: [PATCH] esoc: Add mdm error-fatal notifier hook Add an error-fatal notifier hook to the list of other client hooks, which would notify the clients about modem's unexpected reset or error-fatal. Change-Id: I185c4b05795b7ffb0768c240f25cc487f3d67b63 Signed-off-by: Rishabh Bhatnagar --- drivers/esoc/esoc-mdm-drv.c | 19 ++++++++++++++++++- include/linux/esoc_client.h | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/esoc/esoc-mdm-drv.c b/drivers/esoc/esoc-mdm-drv.c index 557d66b48fc0..da743e7ff0e3 100644 --- a/drivers/esoc/esoc-mdm-drv.c +++ b/drivers/esoc/esoc-mdm-drv.c @@ -67,6 +67,7 @@ struct mdm_drv { static void esoc_client_link_power_off(struct esoc_clink *esoc_clink, unsigned int flags); +static void esoc_client_link_mdm_crash(struct esoc_clink *esoc_clink); static int esoc_msm_restart_handler(struct notifier_block *nb, unsigned long action, void *data) @@ -161,10 +162,11 @@ static void mdm_ssr_fn(struct work_struct *work) struct mdm_drv *mdm_drv = container_of(work, struct mdm_drv, ssr_work); struct mdm_ctrl *mdm = get_esoc_clink_data(mdm_drv->esoc_clink); + esoc_client_link_mdm_crash(mdm_drv->esoc_clink); + mdm_wait_for_status_low(mdm, false); esoc_mdm_log("Starting SSR work\n"); - /* * If restarting esoc fails, the SSR framework triggers a kernel panic */ @@ -208,6 +210,21 @@ static void esoc_client_link_power_off(struct esoc_clink *esoc_clink, } } +static void esoc_client_link_mdm_crash(struct esoc_clink *esoc_clink) +{ + int i; + struct esoc_client_hook *client_hook; + + dev_dbg(&esoc_clink->dev, "Calling mdm_crash hooks\n"); + esoc_mdm_log("Calling mdm_crash hooks\n"); + + for (i = 0; i < ESOC_MAX_HOOKS; i++) { + client_hook = esoc_clink->client_hook[i]; + if (client_hook && client_hook->esoc_link_mdm_crash) + client_hook->esoc_link_mdm_crash(client_hook->priv); + } +} + static void mdm_crash_shutdown(const struct subsys_desc *mdm_subsys) { struct esoc_clink *esoc_clink = diff --git a/include/linux/esoc_client.h b/include/linux/esoc_client.h index 3d29683d1fab..a9a98015b727 100644 --- a/include/linux/esoc_client.h +++ b/include/linux/esoc_client.h @@ -20,6 +20,7 @@ struct esoc_client_hook { int (*esoc_link_power_on)(void *priv, unsigned int flags); void (*esoc_link_power_off)(void *priv, unsigned int flags); u64 (*esoc_link_get_id)(void *priv); + void (*esoc_link_mdm_crash)(void *priv); }; /*