Skip to contentSkip to conversation

platform/x86: asus-wmi: Only Tell EC the OS will handle display hotkeys from asus_nb_wmi

PATCH Superseded Hans de Goede 3 participants 9 messages May 21, 2019 – Jun 12, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: asus-wmi: Only Tell EC the OS will handle display hotkeys from asus_nb_wmi

Commit 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey") causes the backlight to be permanently off on various EeePC laptop models using the eeepc-wmi driver (Asus EeePC 1015BX, Asus EeePC 1025C).

The asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL) call added by that commit is made conditional in this commit and only enabled in the quirk_entry structs in the asus-nb-wmi driver fixing the broken display / backlight on various EeePC laptop models.

Cc João Paulo Rechi Vita <[email protected]>
Fixes 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey")
---
 drivers/platform/x86/asus-nb-wmi.c | 8 ++++++++
 drivers/platform/x86/asus-wmi.c    | 2 +-
 drivers/platform/x86/asus-wmi.h    | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-nb-wmi.c +8 -0
index b6f2ff95c3ed..59f3a37a44d7 100644
@@ -78,10 +78,12 @@ static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
 
 static struct quirk_entry quirk_asus_unknown = {
 	.wapf = 0,
+	.wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_q500a = {
 	.i8042_filter = asus_q500a_i8042_filter,
+	.wmi_backlight_set_devstate = true,
 };
 
 /*
@@ -92,26 +94,32 @@ static struct quirk_entry quirk_asus_q500a = {
 static struct quirk_entry quirk_asus_x55u = {
 	.wapf = 4,
 	.wmi_backlight_power = true,
+	.wmi_backlight_set_devstate = true,
 	.no_display_toggle = true,
 };
 
 static struct quirk_entry quirk_asus_wapf4 = {
 	.wapf = 4,
+	.wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_x200ca = {
 	.wapf = 2,
+	.wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_ux303ub = {
 	.wmi_backlight_native = true,
+	.wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_x550lb = {
+	.wmi_backlight_set_devstate = true,
 	.xusb2pr = 0x01D9,
 };
 
 static struct quirk_entry quirk_asus_forceals = {
+	.wmi_backlight_set_devstate = true,
 	.wmi_force_als_set = true,
 };
 
drivers/platform/x86/asus-wmi.c +1 -1
index ee1fa93708ec..a66e99500c12 100644
@@ -2131,7 +2131,7 @@ static int asus_wmi_add(struct platform_device *pdev)
 		err = asus_wmi_backlight_init(asus);
 		if (err && err != -ENODEV)
 			goto fail_backlight;
-	} else
+	} else if (asus->driver->quirks->wmi_backlight_set_devstate)
 		err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
 	status = wmi_install_notify_handler(asus->driver->event_guid,
drivers/platform/x86/asus-wmi.h +1 -0
index 6c1311f4b04d..57a79bddb286 100644
@@ -44,6 +44,7 @@ struct quirk_entry {
 	bool store_backlight_power;
 	bool wmi_backlight_power;
 	bool wmi_backlight_native;
+	bool wmi_backlight_set_devstate;
 	bool wmi_force_als_set;
 	int wapf;
 	/*
Signature · 1 line
2.21.0
#1 lore raw
Quoted 11 lines · Hans de Goede

Commit 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey") causes the backlight to be permanently off on various EeePC laptop models using the eeepc-wmi driver (Asus EeePC 1015BX, Asus EeePC 1025C).

The asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL) call added by that commit is made conditional in this commit and only enabled in the quirk_entry structs in the asus-nb-wmi driver fixing the broken display / backlight on various EeePC laptop models.

Hmm... doesn't apply.

Quoted 87 lines
Cc João Paulo Rechi Vita <[email protected]>
Fixes 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey")
---
 drivers/platform/x86/asus-nb-wmi.c | 8 ++++++++
 drivers/platform/x86/asus-wmi.c    | 2 +-
 drivers/platform/x86/asus-wmi.h    | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-nb-wmi.c +8 -0
index b6f2ff95c3ed..59f3a37a44d7 100644
@@ -78,10 +78,12 @@ static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
 
 static struct quirk_entry quirk_asus_unknown = {
        .wapf = 0,
+       .wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_q500a = {
        .i8042_filter = asus_q500a_i8042_filter,
+       .wmi_backlight_set_devstate = true,
 };
 
 /*
@@ -92,26 +94,32 @@ static struct quirk_entry quirk_asus_q500a = {
 static struct quirk_entry quirk_asus_x55u = {
        .wapf = 4,
        .wmi_backlight_power = true,
+       .wmi_backlight_set_devstate = true,
        .no_display_toggle = true,
 };
 
 static struct quirk_entry quirk_asus_wapf4 = {
        .wapf = 4,
+       .wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_x200ca = {
        .wapf = 2,
+       .wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_ux303ub = {
        .wmi_backlight_native = true,
+       .wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_x550lb = {
+       .wmi_backlight_set_devstate = true,
        .xusb2pr = 0x01D9,
 };
 
 static struct quirk_entry quirk_asus_forceals = {
+       .wmi_backlight_set_devstate = true,
        .wmi_force_als_set = true,
 };
 
drivers/platform/x86/asus-wmi.c +1 -1
index ee1fa93708ec..a66e99500c12 100644
@@ -2131,7 +2131,7 @@ static int asus_wmi_add(struct platform_device *pdev)
                err = asus_wmi_backlight_init(asus);
                if (err && err != -ENODEV)
                        goto fail_backlight;
-       } else
+       } else if (asus->driver->quirks->wmi_backlight_set_devstate)
                err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
        status = wmi_install_notify_handler(asus->driver->event_guid,
drivers/platform/x86/asus-wmi.h +1 -1
index 6c1311f4b04d..57a79bddb286 100644
@@ -44,6 +44,7 @@ struct quirk_entry {
        bool store_backlight_power;
        bool wmi_backlight_power;
        bool wmi_backlight_native;
+       bool wmi_backlight_set_devstate;
        bool wmi_force_als_set;
        int wapf;
        /*
--

2.21.0

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw

Hi,

Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Hans de Goede

Commit 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey") causes the backlight to be permanently off on various EeePC laptop models using the eeepc-wmi driver (Asus EeePC 1015BX, Asus EeePC 1025C).

Quoted 7 lines
Quoted 5 lines

The asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL) call added by that commit is made conditional in this commit and only enabled in the quirk_entry structs in the asus-nb-wmi driver fixing the broken display / backlight on various EeePC laptop models.

Hmm... doesn't apply.

That is likely because your review-andy branch contain a whole-bunch of asus-wmi patches.

Since this is a patch fixing a regression this should go to the fixes branch. As the other patches so far are only in your review-andy branch it is probably best to merge this patch to for-next + fixes first and then rebase the set you have in review-andy on top, so that this can go to fixes without getting a merge conflict when the rest of the patches show up...

Regards,

Hans

Quoted 90 lines
Quoted 88 lines
Cc João Paulo Rechi Vita <[email protected]>
Fixes 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey")
---
  drivers/platform/x86/asus-nb-wmi.c | 8 ++++++++
  drivers/platform/x86/asus-wmi.c    | 2 +-
  drivers/platform/x86/asus-wmi.h    | 1 +
  3 files changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-nb-wmi.c +8 -0
index b6f2ff95c3ed..59f3a37a44d7 100644
@@ -78,10 +78,12 @@ static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
 
  static struct quirk_entry quirk_asus_unknown = {
         .wapf = 0,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_q500a = {
         .i8042_filter = asus_q500a_i8042_filter,
+       .wmi_backlight_set_devstate = true,
  };
 
  /*
@@ -92,26 +94,32 @@ static struct quirk_entry quirk_asus_q500a = {
  static struct quirk_entry quirk_asus_x55u = {
         .wapf = 4,
         .wmi_backlight_power = true,
+       .wmi_backlight_set_devstate = true,
         .no_display_toggle = true,
  };
 
  static struct quirk_entry quirk_asus_wapf4 = {
         .wapf = 4,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_x200ca = {
         .wapf = 2,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_ux303ub = {
         .wmi_backlight_native = true,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_x550lb = {
+       .wmi_backlight_set_devstate = true,
         .xusb2pr = 0x01D9,
  };
 
  static struct quirk_entry quirk_asus_forceals = {
+       .wmi_backlight_set_devstate = true,
         .wmi_force_als_set = true,
  };
 
drivers/platform/x86/asus-wmi.c +1 -1
index ee1fa93708ec..a66e99500c12 100644
@@ -2131,7 +2131,7 @@ static int asus_wmi_add(struct platform_device *pdev)
                 err = asus_wmi_backlight_init(asus);
                 if (err && err != -ENODEV)
                         goto fail_backlight;
-       } else
+       } else if (asus->driver->quirks->wmi_backlight_set_devstate)
                 err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
         status = wmi_install_notify_handler(asus->driver->event_guid,
drivers/platform/x86/asus-wmi.h +1 -1
index 6c1311f4b04d..57a79bddb286 100644
@@ -44,6 +44,7 @@ struct quirk_entry {
         bool store_backlight_power;
         bool wmi_backlight_power;
         bool wmi_backlight_native;
+       bool wmi_backlight_set_devstate;
         bool wmi_force_als_set;
         int wapf;
         /*
--

2.21.0

#3 lore raw

Hi,

Quoted 21 lines · Hans de Goede

Hi,

Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Hans de Goede

Commit 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey") causes the backlight to be permanently off on various EeePC laptop models using the eeepc-wmi driver (Asus EeePC 1015BX, Asus EeePC 1025C).

Quoted 7 lines
Quoted 5 lines

The asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL) call added by that commit is made conditional in this commit and only enabled in the quirk_entry structs in the asus-nb-wmi driver fixing the broken display / backlight on various EeePC laptop models.

Hmm... doesn't apply.

That is likely because your review-andy branch contain a whole-bunch of asus-wmi patches.

Quoted 6 lines

Since this is a patch fixing a regression this should go to the fixes branch. As the other patches so far are only in your review-andy branch it is probably best to merge this patch to for-next + fixes first and then rebase the set you have in review-andy on top, so that this can go to fixes without getting a merge conflict when the rest of the patches show up...

Ping? This is a 5.x regression fix, as such it would be really good to get this into 5.2 and then cherry-picked into 5.y.z.

Regards,

Hans

Quoted 89 lines
Quoted 89 lines
Quoted 87 lines
Cc João Paulo Rechi Vita <[email protected]>
Fixes 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey")

---
  drivers/platform/x86/asus-nb-wmi.c | 8 ++++++++
  drivers/platform/x86/asus-wmi.c    | 2 +-
  drivers/platform/x86/asus-wmi.h    | 1 +

  3 files changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-nb-wmi.c +8 -0
index b6f2ff95c3ed..59f3a37a44d7 100644
@@ -78,10 +78,12 @@ static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
 
   static struct quirk_entry quirk_asus_unknown = {
          .wapf = 0,
+       .wmi_backlight_set_devstate = true,
   };
 
   static struct quirk_entry quirk_asus_q500a = {
          .i8042_filter = asus_q500a_i8042_filter,
+       .wmi_backlight_set_devstate = true,
   };
 
   /*
@@ -92,26 +94,32 @@ static struct quirk_entry quirk_asus_q500a = {
   static struct quirk_entry quirk_asus_x55u = {
          .wapf = 4,
          .wmi_backlight_power = true,
+       .wmi_backlight_set_devstate = true,
          .no_display_toggle = true,
   };
 
   static struct quirk_entry quirk_asus_wapf4 = {
          .wapf = 4,
+       .wmi_backlight_set_devstate = true,
   };
 
   static struct quirk_entry quirk_asus_x200ca = {
          .wapf = 2,
+       .wmi_backlight_set_devstate = true,
   };
 
   static struct quirk_entry quirk_asus_ux303ub = {
          .wmi_backlight_native = true,
+       .wmi_backlight_set_devstate = true,
   };
 
   static struct quirk_entry quirk_asus_x550lb = {
+       .wmi_backlight_set_devstate = true,
          .xusb2pr = 0x01D9,
   };
 
   static struct quirk_entry quirk_asus_forceals = {
+       .wmi_backlight_set_devstate = true,
          .wmi_force_als_set = true,
   };
 
drivers/platform/x86/asus-wmi.c +1 -1
index ee1fa93708ec..a66e99500c12 100644
@@ -2131,7 +2131,7 @@ static int asus_wmi_add(struct platform_device *pdev)
                  err = asus_wmi_backlight_init(asus);
                  if (err && err != -ENODEV)
                          goto fail_backlight;
-       } else
+       } else if (asus->driver->quirks->wmi_backlight_set_devstate)
                  err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
          status = wmi_install_notify_handler(asus->driver->event_guid,
drivers/platform/x86/asus-wmi.h +1 -0
index 6c1311f4b04d..57a79bddb286 100644
@@ -44,6 +44,7 @@ struct quirk_entry {
          bool store_backlight_power;
          bool wmi_backlight_power;
          bool wmi_backlight_native;
+       bool wmi_backlight_set_devstate;
          bool wmi_force_als_set;
          int wapf;
          /*
Signature · 1 line
2.21.0
#4 lore raw
Quoted 32 lines · Hans de Goede

Hi,

Quoted 21 lines · Hans de Goede

Hi,

Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Hans de Goede

Commit 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey") causes the backlight to be permanently off on various EeePC laptop models using the eeepc-wmi driver (Asus EeePC 1015BX, Asus EeePC 1025C).

Quoted 7 lines
Quoted 5 lines

The asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL) call added by that commit is made conditional in this commit and only enabled in the quirk_entry structs in the asus-nb-wmi driver fixing the broken display / backlight on various EeePC laptop models.

Hmm... doesn't apply.

That is likely because your review-andy branch contain a whole-bunch of asus-wmi patches.

Quoted 6 lines

Since this is a patch fixing a regression this should go to the fixes branch. As the other patches so far are only in your review-andy branch it is probably best to merge this patch to for-next + fixes first and then rebase the set you have in review-andy on top, so that this can go to fixes without getting a merge conflict when the rest of the patches show up...

Quoted 3 lines

Ping? This is a 5.x regression fix, as such it would be really good to get this into 5.2 and then cherry-picked into 5.y.z.

It doesn't apply to our fixes branch.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw

Hi,

Quoted 33 lines · Andy Shevchenko
Quoted 32 lines · Hans de Goede

Hi,

Quoted 27 lines · Hans de Goede

Hi,

Quoted 7 lines · Andy Shevchenko
Quoted 6 lines · Hans de Goede

Commit 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey") causes the backlight to be permanently off on various EeePC laptop models using the eeepc-wmi driver (Asus EeePC 1015BX, Asus EeePC 1025C).

Quoted 7 lines
Quoted 5 lines

The asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL) call added by that commit is made conditional in this commit and only enabled in the quirk_entry structs in the asus-nb-wmi driver fixing the broken display / backlight on various EeePC laptop models.

Hmm... doesn't apply.

That is likely because your review-andy branch contain a whole-bunch of asus-wmi patches.

Since this is a patch fixing a regression this should go to the fixes branch. As the other patches so far are only in your review-andy branch it is probably best to merge this patch to for-next + fixes first and then rebase the set you have in review-andy on top, so that this can go to fixes without getting a merge conflict when the rest of the patches show up...

Quoted 5 lines
Quoted 3 lines

Ping? This is a 5.x regression fix, as such it would be really good to get this into 5.2 and then cherry-picked into 5.y.z.

It doesn't apply to our fixes branch.

Weird. I will resend the patch rebased on top of 5.2-rc4.

Regards,

Hans

#6 lore raw
In reply to Hans de Goede
Quoted 88 lines · Hans de Goede

Commit 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey") causes the backlight to be permanently off on various EeePC laptop models using the eeepc-wmi driver (Asus EeePC 1015BX, Asus EeePC 1025C).

The asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL) call added by that commit is made conditional in this commit and only enabled in the quirk_entry structs in the asus-nb-wmi driver fixing the broken display / backlight on various EeePC laptop models.

Cc João Paulo Rechi Vita <[email protected]>
Fixes 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey")
---
 drivers/platform/x86/asus-nb-wmi.c | 8 ++++++++
 drivers/platform/x86/asus-wmi.c    | 2 +-
 drivers/platform/x86/asus-wmi.h    | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-nb-wmi.c +8 -0
index b6f2ff95c3ed..59f3a37a44d7 100644
@@ -78,10 +78,12 @@ static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
 
 static struct quirk_entry quirk_asus_unknown = {
        .wapf = 0,
+       .wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_q500a = {
        .i8042_filter = asus_q500a_i8042_filter,
+       .wmi_backlight_set_devstate = true,
 };
 
 /*
@@ -92,26 +94,32 @@ static struct quirk_entry quirk_asus_q500a = {
 static struct quirk_entry quirk_asus_x55u = {
        .wapf = 4,
        .wmi_backlight_power = true,
+       .wmi_backlight_set_devstate = true,
        .no_display_toggle = true,
 };
 
 static struct quirk_entry quirk_asus_wapf4 = {
        .wapf = 4,
+       .wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_x200ca = {
        .wapf = 2,
+       .wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_ux303ub = {
        .wmi_backlight_native = true,
+       .wmi_backlight_set_devstate = true,
 };
 
 static struct quirk_entry quirk_asus_x550lb = {
+       .wmi_backlight_set_devstate = true,
        .xusb2pr = 0x01D9,
 };
 
 static struct quirk_entry quirk_asus_forceals = {
+       .wmi_backlight_set_devstate = true,
        .wmi_force_als_set = true,
 };
 
drivers/platform/x86/asus-wmi.c +1 -1
index ee1fa93708ec..a66e99500c12 100644
@@ -2131,7 +2131,7 @@ static int asus_wmi_add(struct platform_device *pdev)
                err = asus_wmi_backlight_init(asus);
                if (err && err != -ENODEV)
                        goto fail_backlight;
-       } else
+       } else if (asus->driver->quirks->wmi_backlight_set_devstate)
                err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
        status = wmi_install_notify_handler(asus->driver->event_guid,
drivers/platform/x86/asus-wmi.h +0 -0
index 6c1311f4b04d..57a79bddb286 100644

drivers/platform/x86/asus-wmi.h struct quirk_entry { · line 47

Quoted 4 lines
drivers/platform/x86/asus-wmi.h +1 -0
@@ -44,6 +44,7 @@ struct quirk_entry {
        bool store_backlight_power;
        bool wmi_backlight_power;
        bool wmi_backlight_native;
+       bool wmi_backlight_set_devstate;

Wouldn't it be better to add this field to struct asus_wmi_driver instead, and set it in asus_nb_wmi_driver only? This way we wouldn't need to make sure it is present in all quirk entries from this driver, current and future.

I've tested both the original patch and my suggestion above and in both cases the "turn off backlight" hotkey continued to work fine on a machine where asus-nb-wmi is used (I don't have access to any machine using the eeepc driver).

Quoted 6 lines
drivers/platform/x86/asus-wmi.h +0 -1
        bool wmi_force_als_set;
        int wapf;
        /*
--

2.21.0

#7 lore raw

Hi João,

Quoted 99 lines · João Paulo Rechi Vita
Quoted 88 lines · Hans de Goede

Commit 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey") causes the backlight to be permanently off on various EeePC laptop models using the eeepc-wmi driver (Asus EeePC 1015BX, Asus EeePC 1025C).

The asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL) call added by that commit is made conditional in this commit and only enabled in the quirk_entry structs in the asus-nb-wmi driver fixing the broken display / backlight on various EeePC laptop models.

Cc João Paulo Rechi Vita <[email protected]>
Fixes 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey")
---
  drivers/platform/x86/asus-nb-wmi.c | 8 ++++++++
  drivers/platform/x86/asus-wmi.c    | 2 +-
  drivers/platform/x86/asus-wmi.h    | 1 +
  3 files changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-nb-wmi.c +8 -0
index b6f2ff95c3ed..59f3a37a44d7 100644
@@ -78,10 +78,12 @@ static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
 
  static struct quirk_entry quirk_asus_unknown = {
         .wapf = 0,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_q500a = {
         .i8042_filter = asus_q500a_i8042_filter,
+       .wmi_backlight_set_devstate = true,
  };
 
  /*
@@ -92,26 +94,32 @@ static struct quirk_entry quirk_asus_q500a = {
  static struct quirk_entry quirk_asus_x55u = {
         .wapf = 4,
         .wmi_backlight_power = true,
+       .wmi_backlight_set_devstate = true,
         .no_display_toggle = true,
  };
 
  static struct quirk_entry quirk_asus_wapf4 = {
         .wapf = 4,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_x200ca = {
         .wapf = 2,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_ux303ub = {
         .wmi_backlight_native = true,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_x550lb = {
+       .wmi_backlight_set_devstate = true,
         .xusb2pr = 0x01D9,
  };
 
  static struct quirk_entry quirk_asus_forceals = {
+       .wmi_backlight_set_devstate = true,
         .wmi_force_als_set = true,
  };
 
drivers/platform/x86/asus-wmi.c +1 -1
index ee1fa93708ec..a66e99500c12 100644
@@ -2131,7 +2131,7 @@ static int asus_wmi_add(struct platform_device *pdev)
                 err = asus_wmi_backlight_init(asus);
                 if (err && err != -ENODEV)
                         goto fail_backlight;
-       } else
+       } else if (asus->driver->quirks->wmi_backlight_set_devstate)
                 err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
         status = wmi_install_notify_handler(asus->driver->event_guid,
drivers/platform/x86/asus-wmi.h +0 -0
index 6c1311f4b04d..57a79bddb286 100644

drivers/platform/x86/asus-wmi.h struct quirk_entry { · line 47

Quoted 4 lines
drivers/platform/x86/asus-wmi.h +1 -0
@@ -44,6 +44,7 @@ struct quirk_entry {
         bool store_backlight_power;
         bool wmi_backlight_power;
         bool wmi_backlight_native;
+       bool wmi_backlight_set_devstate;

Wouldn't it be better to add this field to struct asus_wmi_driver instead, and set it in asus_nb_wmi_driver only? This way we wouldn't need to make sure it is present in all quirk entries from this driver, current and future.

Quoted 4 lines

I've tested both the original patch and my suggestion above and in both cases the "turn off backlight" hotkey continued to work fine on a machine where asus-nb-wmi is used (I don't have access to any machine using the eeepc driver).

I deliberately put in the quirks struct so that if necessary we can enable / disable it easily on a per model (rather then per driver) case in the future.

Regards,

Hans

#8 lore raw
Quoted 103 lines · Hans de Goede

Hi João,

Quoted 99 lines · João Paulo Rechi Vita
Quoted 88 lines · Hans de Goede

Commit 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey") causes the backlight to be permanently off on various EeePC laptop models using the eeepc-wmi driver (Asus EeePC 1015BX, Asus EeePC 1025C).

The asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL) call added by that commit is made conditional in this commit and only enabled in the quirk_entry structs in the asus-nb-wmi driver fixing the broken display / backlight on various EeePC laptop models.

Cc João Paulo Rechi Vita <[email protected]>
Fixes 78f3ac76d9e5 ("platform/x86: asus-wmi: Tell the EC the OS will handle the display off hotkey")
---
  drivers/platform/x86/asus-nb-wmi.c | 8 ++++++++
  drivers/platform/x86/asus-wmi.c    | 2 +-
  drivers/platform/x86/asus-wmi.h    | 1 +
  3 files changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-nb-wmi.c +8 -0
index b6f2ff95c3ed..59f3a37a44d7 100644
@@ -78,10 +78,12 @@ static bool asus_q500a_i8042_filter(unsigned char data, unsigned char str,
 
  static struct quirk_entry quirk_asus_unknown = {
         .wapf = 0,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_q500a = {
         .i8042_filter = asus_q500a_i8042_filter,
+       .wmi_backlight_set_devstate = true,
  };
 
  /*
@@ -92,26 +94,32 @@ static struct quirk_entry quirk_asus_q500a = {
  static struct quirk_entry quirk_asus_x55u = {
         .wapf = 4,
         .wmi_backlight_power = true,
+       .wmi_backlight_set_devstate = true,
         .no_display_toggle = true,
  };
 
  static struct quirk_entry quirk_asus_wapf4 = {
         .wapf = 4,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_x200ca = {
         .wapf = 2,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_ux303ub = {
         .wmi_backlight_native = true,
+       .wmi_backlight_set_devstate = true,
  };
 
  static struct quirk_entry quirk_asus_x550lb = {
+       .wmi_backlight_set_devstate = true,
         .xusb2pr = 0x01D9,
  };
 
  static struct quirk_entry quirk_asus_forceals = {
+       .wmi_backlight_set_devstate = true,
         .wmi_force_als_set = true,
  };
 
drivers/platform/x86/asus-wmi.c +1 -1
index ee1fa93708ec..a66e99500c12 100644
@@ -2131,7 +2131,7 @@ static int asus_wmi_add(struct platform_device *pdev)
                 err = asus_wmi_backlight_init(asus);
                 if (err && err != -ENODEV)
                         goto fail_backlight;
-       } else
+       } else if (asus->driver->quirks->wmi_backlight_set_devstate)
                 err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, 2, NULL);
 
         status = wmi_install_notify_handler(asus->driver->event_guid,
drivers/platform/x86/asus-wmi.h +0 -0
index 6c1311f4b04d..57a79bddb286 100644

drivers/platform/x86/asus-wmi.h struct quirk_entry { · line 47

Quoted 4 lines
drivers/platform/x86/asus-wmi.h +1 -0
@@ -44,6 +44,7 @@ struct quirk_entry {
         bool store_backlight_power;
         bool wmi_backlight_power;
         bool wmi_backlight_native;
+       bool wmi_backlight_set_devstate;

Wouldn't it be better to add this field to struct asus_wmi_driver instead, and set it in asus_nb_wmi_driver only? This way we wouldn't need to make sure it is present in all quirk entries from this driver, current and future.

Quoted 9 lines
Quoted 4 lines

I've tested both the original patch and my suggestion above and in both cases the "turn off backlight" hotkey continued to work fine on a machine where asus-nb-wmi is used (I don't have access to any machine using the eeepc driver).

I deliberately put in the quirks struct so that if necessary we can enable / disable it easily on a per model (rather then per driver) case in the future.

You are right that it will be easier to change it if we ever need to, although I don't expect it to happen in the near future (famous last words). It would be nice to not have to add it to every quirk entry, current and new though. But I do not have another suggestion atm, so I'm fine with your original approach.

......................................................................................
João Paulo Rechi Vita | Endless