backlight: move the backlight off operation to the front of the LCD
[firefly-linux-kernel-4.4.55.git] / drivers / video / backlight / backlight.c
index bddc8b17a4d8a688f978aa82c58ff8c7514b21f0..c2ab0cd0cf71a0533aed062c27afd353922cc1a4 100644 (file)
@@ -46,7 +46,8 @@ static int fb_notifier_callback(struct notifier_block *self,
        int fb_blank = 0;
 
        /* If we aren't interested in this event, skip it immediately ... */
-       if (event != FB_EVENT_BLANK && event != FB_EVENT_CONBLANK)
+       if (event != FB_EVENT_BLANK && event != FB_EVENT_CONBLANK &&
+           event != FB_EARLY_EVENT_BLANK)
                return 0;
 
        bd = container_of(self, struct backlight_device, fb_notif);
@@ -56,7 +57,8 @@ static int fb_notifier_callback(struct notifier_block *self,
                    bd->ops->check_fb(bd, evdata->info)) {
                        fb_blank = *(int *)evdata->data;
                        if (fb_blank == FB_BLANK_UNBLANK &&
-                           !bd->fb_bl_on[node]) {
+                           !bd->fb_bl_on[node] &&
+                           event != FB_EARLY_EVENT_BLANK) {
                                bd->fb_bl_on[node] = true;
                                if (!bd->use_count++) {
                                        bd->props.state &= ~BL_CORE_FBBLANK;
@@ -64,7 +66,8 @@ static int fb_notifier_callback(struct notifier_block *self,
                                        backlight_update_status(bd);
                                }
                        } else if (fb_blank != FB_BLANK_UNBLANK &&
-                                  bd->fb_bl_on[node]) {
+                                  bd->fb_bl_on[node] &&
+                                  event == FB_EARLY_EVENT_BLANK) {
                                bd->fb_bl_on[node] = false;
                                if (!(--bd->use_count)) {
                                        bd->props.state |= BL_CORE_FBBLANK;