Added screen-off notifier.
authorAustin Zhang <austin.zhang@intel.com>
Thu, 5 Jul 2012 12:33:05 +0000 (20:33 +0800)
committerAustin Zhang <austin.zhang@intel.com>
Mon, 16 Jul 2012 04:15:33 +0000 (12:15 +0800)
Added notifier which indicating the screen is turned off, then we
should disable some devices from this stage, for example, we should
disable touch panel after screen off so that 'touch' will not light
on the LCD again when there is being pended suspend process due to
wakeup event, like insert USB cable.

Signed-off-by: Austin Zhang <austin.zhang@intel.com>
drivers/staging/mrst.mcg/drv/mdfld_dsi_output.c

index d4ec3ab..58287e6 100755 (executable)
@@ -34,6 +34,7 @@
 #include <linux/pm_runtime.h>
 #include "psb_drv.h"
 #include "mdfld_dsi_lvds_bridge.h"
+#include <linux/notifier.h>
 
 #define MDFLD_DSI_BRIGHTNESS_MAX_LEVEL 100
 
@@ -545,8 +546,30 @@ static int mdfld_dsi_connector_mode_valid(struct drm_connector * connector, stru
        return MODE_OK;
 }
 
+static BLOCKING_NOTIFIER_HEAD(screen_notifier_list);
+
+int screen_register_receiver(struct notifier_block *nb)
+{
+       return blocking_notifier_chain_register(&screen_notifier_list, nb);
+}
+EXPORT_SYMBOL(screen_register_receiver);
+
+int screen_unregister_receiver(struct notifier_block *nb)
+{
+       return blocking_notifier_chain_unregister(&screen_notifier_list, nb);
+}
+EXPORT_SYMBOL(screen_unregister_receiver);
+
+int screen_notifier_call_chain(unsigned long val, void *v)
+{
+       return blocking_notifier_call_chain(&screen_notifier_list, val, v);
+}
+EXPORT_SYMBOL(screen_notifier_call_chain);
+
 static void mdfld_dsi_connector_dpms(struct drm_connector *connector, int mode)
 {
+       screen_notifier_call_chain((unsigned int)mode, connector);
+
        if (early_suspend)
                return;