diff options
Diffstat (limited to 'drivers/misc')
| -rw-r--r-- | drivers/misc/Kconfig | 5 | ||||
| -rw-r--r-- | drivers/misc/Makefile | 2 | ||||
| -rw-r--r-- | drivers/misc/m4sensorhub_gesture.c | 4 | ||||
| -rw-r--r-- | drivers/misc/wakeup_source_notify.c | 51 |
4 files changed, 61 insertions, 1 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 15ac750bec1..5b96da5fda8 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -581,6 +581,11 @@ config BQ5105X_DETECT assumptions are made on how the IC is hooked to the host device. default n +config WAKEUP_SOURCE_NOTIFY + tristate "Notifier of wakeups" + help + Driver to allow early notification of wakeups + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig" diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 3cac621a5cd..2f57dbac599 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -67,4 +67,4 @@ obj-$(CONFIG_MMI_FACTORY) += mmi-factory.o obj-$(CONFIG_MOT_UTAG) += utag/ obj-$(CONFIG_BQ5105X_CTRL) += bq5105x_ctrl.o obj-$(CONFIG_BQ5105X_DETECT) += bq5105x_detect.o - +obj-$(CONFIG_WAKEUP_SOURCE_NOTIFY) += wakeup_source_notify.o diff --git a/drivers/misc/m4sensorhub_gesture.c b/drivers/misc/m4sensorhub_gesture.c index c954bf97f5a..51b6a222519 100644 --- a/drivers/misc/m4sensorhub_gesture.c +++ b/drivers/misc/m4sensorhub_gesture.c @@ -34,6 +34,7 @@ #include <linux/iio/buffer.h> #include <linux/iio/kfifo_buf.h> #include <linux/iio/m4sensorhub/m4sensorhub_gesture.h> +#include <linux/wakeup_source_notify.h> #define m4ges_err(format, args...) KDEBUG(M4SH_ERROR, format, ## args) @@ -102,6 +103,9 @@ static void m4ges_isr(enum m4sensorhub_irqs int_event, void *handle) dd->iiodat.timestamp = iio_get_time_ns(); iio_push_to_buffers(iio, (unsigned char *)&(dd->iiodat)); +#ifdef CONFIG_WAKEUP_SOURCE_NOTIFY + wakeup_source_notify_subscriber(DISPLAY_WAKE_EVENT); +#endif /* CONFIG_WAKEUP_SOURCE_NOTIFY */ m4ges_isr_fail: if (err < 0) diff --git a/drivers/misc/wakeup_source_notify.c b/drivers/misc/wakeup_source_notify.c new file mode 100644 index 00000000000..86ab8b00d0b --- /dev/null +++ b/drivers/misc/wakeup_source_notify.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2014 Motorola Mobility LLC. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <linux/notifier.h> +#include <linux/wakeup_source_notify.h> + +static BLOCKING_NOTIFIER_HEAD(wakeup_source_notifier_list); + +/** + * wakeup_source_register_notify - register a notifier callback for triggering display init + * @nb: pointer to the notifier block for the callback events. + * + */ +void wakeup_source_register_notify(struct notifier_block *nb) +{ + blocking_notifier_chain_register(&wakeup_source_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(wakeup_source_register_notify); + +/** + * wakeup_source_unregister_notify - unregister a notifier callback + * @nb: pointer to the notifier block for the callback events. + * + * wakeup_source_register_notify() must have been previously called + * for this function to work properly. + */ +void wakeup_source_unregister_notify(struct notifier_block *nb) +{ + blocking_notifier_chain_unregister(&wakeup_source_notifier_list, nb); +} +EXPORT_SYMBOL_GPL(wakeup_source_unregister_notify); + +void wakeup_source_notify_subscriber(unsigned long event) +{ + blocking_notifier_call_chain(&wakeup_source_notifier_list, event, NULL); +} +EXPORT_SYMBOL_GPL(wakeup_source_notify_subscriber); + |