platform/loongarch: laptop: Adjust resume order for loongson_hotkey_resume()
authorHuacai Chen <chenhuacai@loongson.cn>
Sat, 29 Oct 2022 08:29:31 +0000 (16:29 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Sat, 29 Oct 2022 08:29:31 +0000 (16:29 +0800)
Some laptops don't support SW_LID, but still have backlight control,
move backlight resuming before SW_LID event handling so as to avoid
backlight mistake due to early return.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
drivers/platform/loongarch/loongson-laptop.c

index f0166ad..0e6f4ef 100644 (file)
@@ -199,6 +199,13 @@ static int loongson_hotkey_resume(struct device *dev)
        struct key_entry ke;
        struct backlight_device *bd;
 
+       bd = backlight_device_get_by_type(BACKLIGHT_PLATFORM);
+       if (bd) {
+               loongson_laptop_backlight_update(bd) ?
+               pr_warn("Loongson_backlight: resume brightness failed") :
+               pr_info("Loongson_backlight: resume brightness %d\n", bd->props.brightness);
+       }
+
        /*
         * Only if the firmware supports SW_LID event model, we can handle the
         * event. This is for the consideration of development board without EC.
@@ -228,13 +235,6 @@ static int loongson_hotkey_resume(struct device *dev)
                }
        }
 
-       bd = backlight_device_get_by_type(BACKLIGHT_PLATFORM);
-       if (bd) {
-               loongson_laptop_backlight_update(bd) ?
-               pr_warn("Loongson_backlight: resume brightness failed") :
-               pr_info("Loongson_backlight: resume brightness %d\n", bd->props.brightness);
-       }
-
        return 0;
 }