summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/m4sensorhub-core.c16
-rw-r--r--drivers/mfd/m4sensorhub-irq.c4
-rw-r--r--include/linux/m4sensorhub.h1
3 files changed, 19 insertions, 2 deletions
diff --git a/drivers/mfd/m4sensorhub-core.c b/drivers/mfd/m4sensorhub-core.c
index 4002c75971e..0da3d71dd41 100644
--- a/drivers/mfd/m4sensorhub-core.c
+++ b/drivers/mfd/m4sensorhub-core.c
@@ -559,12 +559,28 @@ static ssize_t m4sensorhub_get_firmware_version(struct device *dev,
static DEVICE_ATTR(firmware_version, S_IRUGO,
m4sensorhub_get_firmware_version, NULL);
+static ssize_t m4sensorhub_disable_interrupts(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ int ret;
+
+ ret = m4sensorhub_irq_disable_all(&m4sensorhub_misc_data);
+ if (ret < 0) {
+ KDEBUG(M4SH_ERROR, "Unable to disable all m4 interrupts\n");
+ return ret;
+ }
+ return count;
+}
+static DEVICE_ATTR(disable_interrupts, S_IWUSR, NULL,
+ m4sensorhub_disable_interrupts);
+
static struct attribute *m4sensorhub_control_attributes[] = {
&dev_attr_tcmd.attr,
&dev_attr_log_level.attr,
&dev_attr_debug_level.attr,
&dev_attr_firmware_version.attr,
&dev_attr_download_status.attr,
+ &dev_attr_disable_interrupts.attr,
NULL
};
diff --git a/drivers/mfd/m4sensorhub-irq.c b/drivers/mfd/m4sensorhub-irq.c
index 7cafe559472..d569c47a8c5 100644
--- a/drivers/mfd/m4sensorhub-irq.c
+++ b/drivers/mfd/m4sensorhub-irq.c
@@ -46,7 +46,6 @@
/* --------------- Global Declarations -------------- */
/* ------------ Local Function Prototypes ----------- */
-static int m4sensorhub_irq_disable_all(struct m4sensorhub_data *m4sensorhub);
static unsigned short get_enable_reg(enum m4sensorhub_irqs event);
static void irq_work_func(struct work_struct *work);
#ifdef CONFIG_DEBUG_FS
@@ -543,7 +542,7 @@ static unsigned short get_enable_reg(enum m4sensorhub_irqs event)
return ret;
}
-static int m4sensorhub_irq_disable_all(struct m4sensorhub_data *m4sensorhub)
+int m4sensorhub_irq_disable_all(struct m4sensorhub_data *m4sensorhub)
{
int i;
@@ -558,6 +557,7 @@ static int m4sensorhub_irq_disable_all(struct m4sensorhub_data *m4sensorhub)
}
return 0;
}
+EXPORT_SYMBOL_GPL(m4sensorhub_irq_disable_all);
static void irq_work_func(struct work_struct *work)
{
diff --git a/include/linux/m4sensorhub.h b/include/linux/m4sensorhub.h
index 68629074746..deb6bd0d45a 100644
--- a/include/linux/m4sensorhub.h
+++ b/include/linux/m4sensorhub.h
@@ -222,6 +222,7 @@ int m4sensorhub_register_initcall(int(*initfunc)(struct init_calldata *),
void m4sensorhub_unregister_initcall(
int(*initfunc)(struct init_calldata *));
+int m4sensorhub_irq_disable_all(struct m4sensorhub_data *m4sensorhub);
#endif /* __KERNEL__ */
#endif /* __M4SENSORHUB_H__ */