summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun KS <arunks@codeaurora.org>2017-01-16 15:27:48 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2017-05-02 12:15:43 -0700
commit5fd242b1280bd6a70cd7d7c13528c679df7260f8 (patch)
tree0fb0474e903e9b2c01b4257956bc5e9cbf60224c
parent40d37c9304d63754207c9ad28b62a24dc7dbf8cc (diff)
esoc: Add err_fatal signal status to clink_ops
Auto_boot esoc devices can boot and crash before esoc driver comes up. But there is no way for the user space code to know that it has crashed by looking at status line alone. Hence, create a new ioctl entry to export status of err_fatal line to user space. Change-Id: Ie7d6115c749d4c63f06aefca29ba457d38eccc7f Signed-off-by: Arun KS <arunks@codeaurora.org>
-rw-r--r--drivers/esoc/esoc-mdm-4x.c14
-rw-r--r--drivers/esoc/esoc.h4
-rw-r--r--drivers/esoc/esoc_dev.c8
-rw-r--r--include/uapi/linux/esoc_ctrl.h1
4 files changed, 21 insertions, 6 deletions
diff --git a/drivers/esoc/esoc-mdm-4x.c b/drivers/esoc/esoc-mdm-4x.c
index 1e5f35d8422d..4511a859683a 100644
--- a/drivers/esoc/esoc-mdm-4x.c
+++ b/drivers/esoc/esoc-mdm-4x.c
@@ -481,7 +481,7 @@ static irqreturn_t mdm_pblrdy_change(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static int mdm_get_status(u32 *status, struct esoc_clink *esoc)
+static void mdm_get_status(u32 *status, struct esoc_clink *esoc)
{
struct mdm_ctrl *mdm = get_esoc_clink_data(esoc);
@@ -489,7 +489,16 @@ static int mdm_get_status(u32 *status, struct esoc_clink *esoc)
*status = 0;
else
*status = 1;
- return 0;
+}
+
+static void mdm_get_err_fatal(u32 *status, struct esoc_clink *esoc)
+{
+ struct mdm_ctrl *mdm = get_esoc_clink_data(esoc);
+
+ if (gpio_get_value(MDM_GPIO(mdm, MDM2AP_ERRFATAL)) == 0)
+ *status = 0;
+ else
+ *status = 1;
}
static void mdm_configure_debug(struct mdm_ctrl *mdm)
@@ -966,6 +975,7 @@ static int mdm9x55_setup_hw(struct mdm_ctrl *mdm,
static struct esoc_clink_ops mdm_cops = {
.cmd_exe = mdm_cmd_exe,
.get_status = mdm_get_status,
+ .get_err_fatal = mdm_get_err_fatal,
.notify = mdm_notify,
};
diff --git a/drivers/esoc/esoc.h b/drivers/esoc/esoc.h
index 755fb24bd60a..e2e9002052ee 100644
--- a/drivers/esoc/esoc.h
+++ b/drivers/esoc/esoc.h
@@ -83,11 +83,13 @@ struct esoc_clink {
* struct esoc_clink_ops: Operations to control external soc
* @cmd_exe: Execute control command
* @get_status: Get current status, or response to previous command
+ * @get_err_fatal: Get status of err fatal signal
* @notify_esoc: notify external soc of events
*/
struct esoc_clink_ops {
int (*cmd_exe)(enum esoc_cmd cmd, struct esoc_clink *dev);
- int (*get_status)(u32 *status, struct esoc_clink *dev);
+ void (*get_status)(u32 *status, struct esoc_clink *dev);
+ void (*get_err_fatal)(u32 *status, struct esoc_clink *dev);
void (*notify)(enum esoc_notify notify, struct esoc_clink *dev);
};
diff --git a/drivers/esoc/esoc_dev.c b/drivers/esoc/esoc_dev.c
index ffb2237da5fa..7197d03f0ca5 100644
--- a/drivers/esoc/esoc_dev.c
+++ b/drivers/esoc/esoc_dev.c
@@ -224,9 +224,11 @@ static long esoc_dev_ioctl(struct file *file, unsigned int cmd,
clink_ops->notify(esoc_cmd, esoc_clink);
break;
case ESOC_GET_STATUS:
- err = clink_ops->get_status(&status, esoc_clink);
- if (err)
- return err;
+ clink_ops->get_status(&status, esoc_clink);
+ put_user(status, (unsigned int __user *)uarg);
+ break;
+ case ESOC_GET_ERR_FATAL:
+ clink_ops->get_err_fatal(&status, esoc_clink);
put_user(status, (unsigned int __user *)uarg);
break;
case ESOC_WAIT_FOR_CRASH:
diff --git a/include/uapi/linux/esoc_ctrl.h b/include/uapi/linux/esoc_ctrl.h
index 57266ed29fb3..d0743790e09c 100644
--- a/include/uapi/linux/esoc_ctrl.h
+++ b/include/uapi/linux/esoc_ctrl.h
@@ -7,6 +7,7 @@
#define ESOC_WAIT_FOR_REQ _IOR(ESOC_CODE, 2, unsigned int)
#define ESOC_NOTIFY _IOW(ESOC_CODE, 3, unsigned int)
#define ESOC_GET_STATUS _IOR(ESOC_CODE, 4, unsigned int)
+#define ESOC_GET_ERR_FATAL _IOR(ESOC_CODE, 5, unsigned int)
#define ESOC_WAIT_FOR_CRASH _IOR(ESOC_CODE, 6, unsigned int)
#define ESOC_REG_REQ_ENG _IO(ESOC_CODE, 7)
#define ESOC_REG_CMD_ENG _IO(ESOC_CODE, 8)