summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Jain <ajain@motorola.com>2014-06-30 16:05:49 -0500
committerJee Su Chang <w20740@motorola.com>2014-07-10 16:58:09 +0000
commit9e3e9ec9a545ce65cf325f4c7eab401ab0269184 (patch)
tree352abbf179994e7229303239001a78f0e7c735f0
parent2f02ffa1a9d46c192d19fed48190beceb9b6ec21 (diff)
downloadolio-linux-3.10-9e3e9ec9a545ce65cf325f4c7eab401ab0269184.tar.xz
olio-linux-3.10-9e3e9ec9a545ce65cf325f4c7eab401ab0269184.zip
IKXCLOCK-1435: early init of display
Change-Id: I2996c32892066b5874e011c4fe7454d5ebae1aad
-rw-r--r--arch/arm/configs/minnow_defconfig1
-rw-r--r--drivers/input/touchscreen/atmxt.c5
-rw-r--r--drivers/mfd/tps65912-irq.c6
-rw-r--r--drivers/mfd/tps65912-key.c5
-rw-r--r--drivers/misc/Kconfig5
-rw-r--r--drivers/misc/Makefile2
-rw-r--r--drivers/misc/m4sensorhub_gesture.c4
-rw-r--r--drivers/misc/wakeup_source_notify.c51
-rw-r--r--drivers/video/omap2/displays/panel-minnow.c50
-rw-r--r--include/linux/mfd/tps65912.h6
-rw-r--r--include/linux/wakeup_source_notify.h31
11 files changed, 156 insertions, 10 deletions
diff --git a/arch/arm/configs/minnow_defconfig b/arch/arm/configs/minnow_defconfig
index 67a7f417d4c..902e0dfcd52 100644
--- a/arch/arm/configs/minnow_defconfig
+++ b/arch/arm/configs/minnow_defconfig
@@ -1152,6 +1152,7 @@ CONFIG_MMI_FACTORY=y
CONFIG_MOT_UTAG=y
CONFIG_BQ5105X_CTRL=y
CONFIG_BQ5105X_DETECT=y
+CONFIG_WAKEUP_SOURCE_NOTIFY=y
# CONFIG_C2PORT is not set
#
diff --git a/drivers/input/touchscreen/atmxt.c b/drivers/input/touchscreen/atmxt.c
index 7b06475b922..06c5e2b5d8f 100644
--- a/drivers/input/touchscreen/atmxt.c
+++ b/drivers/input/touchscreen/atmxt.c
@@ -37,6 +37,7 @@
#include <linux/string.h>
#include <linux/firmware.h>
#include <linux/input/mt.h>
+#include <linux/wakeup_source_notify.h>
static int atmxt_probe(struct i2c_client *client,
const struct i2c_device_id *id);
@@ -2718,6 +2719,10 @@ static void atmxt_report_touches(struct atmxt_driver_data *dd)
}
input_sync(dd->in_dev);
+#ifdef CONFIG_WAKEUP_SOURCE_NOTIFY
+ if (atmxt_get_ic_state(dd) == ATMXT_IC_AOT)
+ wakeup_source_notify_subscriber(DISPLAY_WAKE_EVENT);
+#endif /* CONFIG_WAKEUP_SOURCE_NOTIFY */
/* Hold to allow events time to propagate up */
wake_lock_timeout(&dd->timed_lock, 0.5 * HZ);
diff --git a/drivers/mfd/tps65912-irq.c b/drivers/mfd/tps65912-irq.c
index 110d714421b..766ed7dd8f5 100644
--- a/drivers/mfd/tps65912-irq.c
+++ b/drivers/mfd/tps65912-irq.c
@@ -24,12 +24,6 @@
#include <linux/mfd/tps65912.h>
#include <linux/input.h>
-enum pwrkey_states {
- PWRKEY_RELEASE, /* Power key released state. */
- PWRKEY_PRESS, /* Power key pressed state. */
- PWRKEY_UNKNOWN, /* Unknown power key state. */
-};
-
static inline int irq_to_tps65912_irq(struct tps65912 *tps65912,
int irq)
{
diff --git a/drivers/mfd/tps65912-key.c b/drivers/mfd/tps65912-key.c
index 37dac69cf7e..e3e55ee67a6 100644
--- a/drivers/mfd/tps65912-key.c
+++ b/drivers/mfd/tps65912-key.c
@@ -23,6 +23,7 @@
#include <linux/input.h>
#include <linux/gpio.h>
#include <linux/mfd/tps65912.h>
+#include <linux/wakeup_source_notify.h>
struct tps65912_key_data {
struct input_dev *input_dev;
@@ -100,6 +101,10 @@ void tps65912_broadcast_key_event(struct tps65912 *tps65912,
input_report_key(key->input_dev, code, value);
/*sync with input subsystem to solve the key cached problem*/
input_sync(key->input_dev);
+#ifdef CONFIG_WAKEUP_SOURCE_NOTIFY
+ if (value == PWRKEY_PRESS)
+ wakeup_source_notify_subscriber(DISPLAY_WAKE_EVENT);
+#endif /* CONFIG_WAKEUP_SOURCE_NOTIFY */
}
}
EXPORT_SYMBOL(tps65912_broadcast_key_event);
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);
+
diff --git a/drivers/video/omap2/displays/panel-minnow.c b/drivers/video/omap2/displays/panel-minnow.c
index 4c629fc9189..469f505516b 100644
--- a/drivers/video/omap2/displays/panel-minnow.c
+++ b/drivers/video/omap2/displays/panel-minnow.c
@@ -39,6 +39,8 @@
#include <video/omapdss.h>
#include <video/omap-panel-data.h>
#include <video/mipi_display.h>
+#include <linux/notifier.h>
+#include <linux/wakeup_source_notify.h>
#include "../dss/dss.h"
@@ -248,6 +250,7 @@ static struct minnow_panel_attr panel_attr_table[MINNOW_PANEL_MAX] = {
#ifdef PANEL_PERF_TIME
#define GET_ELAPSE_TIME(last) jiffies_to_msecs((unsigned long)jiffies-last)
#endif
+
struct minnow_panel_data {
struct mutex lock; /* mutex */
struct wake_lock wake_lock; /* wake_lock */
@@ -325,6 +328,10 @@ struct minnow_panel_data {
unsigned long last_ulps;
unsigned long last_update;
#endif
+#ifdef CONFIG_WAKEUP_SOURCE_NOTIFY
+ struct notifier_block displayenable_nb;
+ struct work_struct early_init_work;
+#endif /* CONFIG_WAKEUP_SOURCE_NOTIFY */
};
/* panel parameter passed from boot-loader */
@@ -345,6 +352,33 @@ static int minnow_panel_update_locked(struct minnow_panel_data *mpd);
static void minnow_panel_esd_work(struct work_struct *work);
static void minnow_panel_ulps_work(struct work_struct *work);
+static int minnow_panel_enable(struct omap_dss_device *dssdev);
+
+#ifdef CONFIG_WAKEUP_SOURCE_NOTIFY
+static int omapdss_displayenable_notify(struct notifier_block *self,
+ unsigned long action, void *dev)
+{
+ struct minnow_panel_data *mpd =
+ container_of(self, struct minnow_panel_data, displayenable_nb);
+ dev_info(&mpd->dssdev->dev, "%s, action is %lu", __func__, action);
+ if (action == DISPLAY_WAKE_EVENT) {
+ /* Queue work to init the display */
+ queue_work(mpd->workqueue, &mpd->early_init_work);
+ }
+ return NOTIFY_OK;
+}
+
+static void minnow_panel_early_init_func(struct work_struct *work)
+{
+ struct minnow_panel_data *mpd;
+ int r;
+ mpd = container_of(work, struct minnow_panel_data, early_init_work);
+ r = minnow_panel_enable(mpd->dssdev);
+ if (r)
+ dev_err(&mpd->dssdev->dev, "minnow_panel_enable failed: %d\n",
+ r);
+}
+#endif /* CONFIG_WAKEUP_SOURCE_NOTIFY */
#ifdef CONFIG_OMAP2_DSS_DEBUGFS
static void minnow_panel_dump_regs(struct seq_file *s)
@@ -2178,6 +2212,12 @@ static int minnow_panel_probe(struct omap_dss_device *dssdev)
#endif
wake_lock_init(&mpd->wake_lock, WAKE_LOCK_SUSPEND, "minnow-panel");
+#ifdef CONFIG_WAKEUP_SOURCE_NOTIFY
+ INIT_WORK(&mpd->early_init_work, minnow_panel_early_init_func);
+ mpd->displayenable_nb.notifier_call = omapdss_displayenable_notify;
+ wakeup_source_register_notify(&mpd->displayenable_nb);
+#endif /* CONFIG_WAKEUP_SOURCE_NOTIFY */
+
return 0;
err_vc_id:
@@ -2210,6 +2250,10 @@ static void __exit minnow_panel_remove(struct omap_dss_device *dssdev)
}
#endif
+#ifdef CONFIG_WAKEUP_SOURCE_NOTIFY
+ wakeup_source_unregister_notify(&mpd->displayenable_nb);
+ cancel_work_sync(&mpd->early_init_work);
+#endif /* CONFIG_WAKEUP_SOURCE_NOTIFY */
minnow_panel_cancel_ulps_work(mpd);
minnow_panel_cancel_esd_work(mpd);
destroy_workqueue(mpd->workqueue);
@@ -2481,13 +2525,13 @@ static int minnow_panel_enable(struct omap_dss_device *dssdev)
{
struct minnow_panel_data *mpd = dev_get_drvdata(&dssdev->dev);
bool update;
- int r = -EINVAL;
+ int r = 0;
+ mutex_lock(&mpd->lock);
dev_info(&dssdev->dev, "%s: current state = %d\n",
__func__, dssdev->state);
if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) {
- mutex_lock(&mpd->lock);
minnow_panel_cancel_ulps_work(mpd);
minnow_panel_cancel_esd_work(mpd);
@@ -2509,8 +2553,8 @@ static int minnow_panel_enable(struct omap_dss_device *dssdev)
dev_info(&dssdev->dev, "Display enabled successfully "
"%s update!\n", update ? "with" : "without");
}
- mutex_unlock(&mpd->lock);
}
+ mutex_unlock(&mpd->lock);
return r;
}
diff --git a/include/linux/mfd/tps65912.h b/include/linux/mfd/tps65912.h
index c32637166f2..426f5e5e08f 100644
--- a/include/linux/mfd/tps65912.h
+++ b/include/linux/mfd/tps65912.h
@@ -278,6 +278,12 @@
/* Number of total regulators available */
#define TPS65912_NUM_REGULATOR (TPS65912_NUM_DCDC + TPS65912_NUM_LDO)
+enum pwrkey_states {
+ PWRKEY_RELEASE, /* Power key released state. */
+ PWRKEY_PRESS, /* Power key pressed state. */
+ PWRKEY_UNKNOWN, /* Unknown power key state. */
+};
+
struct tps65912_register_init_data {
u8 addr;
u16 data;
diff --git a/include/linux/wakeup_source_notify.h b/include/linux/wakeup_source_notify.h
new file mode 100644
index 00000000000..9109d1cec0f
--- /dev/null
+++ b/include/linux/wakeup_source_notify.h
@@ -0,0 +1,31 @@
+/*
+ * 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/>.
+ */
+
+#ifndef WAKEUP_SOURCEE_NOTIFY_H
+#define WAKEUP_SOURCE_NOTIFY_H
+
+#ifdef __KERNEL__
+
+enum display_wakeup_request {
+ DISPLAY_WAKE_EVENT,
+};
+
+extern void wakeup_source_register_notify(struct notifier_block *nb);
+extern void wakeup_source_unregister_notify(struct notifier_block *nb);
+extern void wakeup_source_notify_subscriber(unsigned long event);
+#endif /* __KERNEL__ */
+
+#endif /* WAKEUP_SOURCE_NOTIFY_H */