Skip to contentSkip to conversation

asus-wmi: restore kbd led level after resume

PATCH In review Oleksij Rempel 3 participants 7 messages Sep 14, 2015 – Sep 25, 2015 1 message not in the archive

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

PATCH 1/1 asus-wmi: restore kbd led level after resume

Afters suspend/resume cycle with closed lid the kbd backlight level is lost. This patch will will restore this value to last known level.

---
 drivers/platform/x86/asus-wmi.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/platform/x86/asus-wmi.c +17 -2
index efbc3f0..1f7d80f 100644
@@ -582,7 +582,7 @@ static void asus_wmi_led_exit(struct asus_wmi *asus)
 
 static int asus_wmi_led_init(struct asus_wmi *asus)
 {
-	int rv = 0;
+	int rv = 0, led_val;
 
 	asus->led_workqueue = create_singlethread_workqueue("led_workqueue");
 	if (!asus->led_workqueue)
@@ -602,9 +602,11 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
 			goto error;
 	}
 
-	if (kbd_led_read(asus, NULL, NULL) >= 0) {
+	led_val = kbd_led_read(asus, NULL, NULL);
+	if (led_val >= 0) {
 		INIT_WORK(&asus->kbd_led_work, kbd_led_update);
 
+		asus->kbd_led_wk = led_val;
 		asus->kbd_led.name = "asus::kbd_backlight";
 		asus->kbd_led.brightness_set = kbd_led_set;
 		asus->kbd_led.brightness_get = kbd_led_get;
@@ -2160,6 +2162,16 @@ static int asus_hotk_thaw(struct device *device)
 	return 0;
 }
 
+static int asus_hotk_resume(struct device *device)
+{
+	struct asus_wmi *asus = dev_get_drvdata(device);
+
+	if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
+		queue_work(asus->led_workqueue, &asus->kbd_led_work);
+
+	return 0;
+}
+
 static int asus_hotk_restore(struct device *device)
 {
 	struct asus_wmi *asus = dev_get_drvdata(device);
@@ -2190,6 +2202,8 @@ static int asus_hotk_restore(struct device *device)
 		bl = !asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_UWB);
 		rfkill_set_sw_state(asus->uwb.rfkill, bl);
 	}
+	if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
+		queue_work(asus->led_workqueue, &asus->kbd_led_work);
 
 	return 0;
 }
@@ -2197,6 +2211,7 @@ static int asus_hotk_restore(struct device *device)
 static const struct dev_pm_ops asus_pm_ops = {
 	.thaw = asus_hotk_thaw,
 	.restore = asus_hotk_restore,
+	.resume = asus_hotk_resume,
 };
 
 static int asus_wmi_probe(struct platform_device *pdev)
Signature · 1 line
2.5.0

A message that is not in the archive (sent off-list or not yet received): CAHR064h++fTgHzCNK9oxALROoL=DuoksTykaDrfY2+hBgoyfrQ@mail.gmail.com

maintainer
#2 lore raw
Quoted 75 lines · Corentin Chary
Quoted 71 lines · Oleksij Rempel

Afters suspend/resume cycle with closed lid the kbd backlight level is lost. This patch will will restore this value to last known level.

---
 drivers/platform/x86/asus-wmi.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/platform/x86/asus-wmi.c +1 -1
index efbc3f0..1f7d80f 100644
@@ -582,7 +582,7 @@ static void asus_wmi_led_exit(struct asus_wmi *asus)
 
 static int asus_wmi_led_init(struct asus_wmi *asus)
 {
-       int rv = 0;
+       int rv = 0, led_val;
 
        asus->led_workqueue =
 create_singlethread_workqueue("led_workqueue");
        if (!asus->led_workqueue)
drivers/platform/x86/asus-wmi.c +15 -1
@@ -602,9 +602,11 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
                        goto error;
        }
 
-       if (kbd_led_read(asus, NULL, NULL) >= 0) {
+       led_val = kbd_led_read(asus, NULL, NULL);
+       if (led_val >= 0) {
                INIT_WORK(&asus->kbd_led_work, kbd_led_update);
 
+               asus->kbd_led_wk = led_val;
                asus->kbd_led.name = "asus::kbd_backlight";
                asus->kbd_led.brightness_set = kbd_led_set;
                asus->kbd_led.brightness_get = kbd_led_get;
@@ -2160,6 +2162,16 @@ static int asus_hotk_thaw(struct device *device)
        return 0;
 }
 
+static int asus_hotk_resume(struct device *device)
+{
+       struct asus_wmi *asus = dev_get_drvdata(device);
+
+       if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
+               queue_work(asus->led_workqueue, &asus->kbd_led_work);
+
+       return 0;
+}
+
 static int asus_hotk_restore(struct device *device)
 {
        struct asus_wmi *asus = dev_get_drvdata(device);
@@ -2190,6 +2202,8 @@ static int asus_hotk_restore(struct device *device)
                bl = !asus_wmi_get_devstate_simple(asus,
 ASUS_WMI_DEVID_UWB);
                rfkill_set_sw_state(asus->uwb.rfkill, bl);
        }
+       if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
+               queue_work(asus->led_workqueue, &asus->kbd_led_work);
 
        return 0;

}

drivers/platform/x86/asus-wmi.c +1 -0
@@ -2197,6 +2211,7 @@ static int asus_hotk_restore(struct device *device)
 static const struct dev_pm_ops asus_pm_ops = {
        .thaw = asus_hotk_thaw,
        .restore = asus_hotk_restore,
+       .resume = asus_hotk_resume,
 };
 
Quoted 8 lines
Quoted 4 lines
drivers/platform/x86/asus-wmi.c +0 -1
 static int asus_wmi_probe(struct platform_device *pdev)
--

2.5.0

Looks good to me.

Again, without HTML, to the right address. Sorry for the mess.

Signature · 2 lines
Corentin Chary
http://xf.iksaif.net
#3 lore raw
In reply to Oleksij Rempel
Quoted 4 lines · Oleksij Rempel

Afters suspend/resume cycle with closed lid the kbd backlight level is lost. This patch will will restore this value to last known level.

Hi Oleksij,

Please always run scripts/get_maintainer.pl -f path/to/files/changed

And include *all* the maintainers and lists on Cc. This will ensure a faster response.

Quoted 31 lines
---
 drivers/platform/x86/asus-wmi.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/platform/x86/asus-wmi.c +4 -2
index efbc3f0..1f7d80f 100644
@@ -582,7 +582,7 @@ static void asus_wmi_led_exit(struct asus_wmi *asus)
 
 static int asus_wmi_led_init(struct asus_wmi *asus)
 {
-	int rv = 0;
+	int rv = 0, led_val;
 
 	asus->led_workqueue = create_singlethread_workqueue("led_workqueue");
 	if (!asus->led_workqueue)
@@ -602,9 +602,11 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
 			goto error;
 	}
 
-	if (kbd_led_read(asus, NULL, NULL) >= 0) {
+	led_val = kbd_led_read(asus, NULL, NULL);
+	if (led_val >= 0) {
 		INIT_WORK(&asus->kbd_led_work, kbd_led_update);
 
+		asus->kbd_led_wk = led_val;
 		asus->kbd_led.name = "asus::kbd_backlight";
 		asus->kbd_led.brightness_set = kbd_led_set;
 		asus->kbd_led.brightness_get = kbd_led_get;

drivers/platform/x86/asus-wmi.c static int asus_hotk_thaw(struct device *device) · line 2169

Quoted 8 lines
drivers/platform/x86/asus-wmi.c +5 -0
@@ -2160,6 +2162,16 @@ static int asus_hotk_thaw(struct device *device)
 	return 0;
 }
 
+static int asus_hotk_resume(struct device *device)
+{
+	struct asus_wmi *asus = dev_get_drvdata(device);
+
+	if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
	if (asus->kbd_led.dev)

	should be sufficient, I don't see the dev pointer being stored as an
	errno.

	Corentin?
Quoted 9 lines
drivers/platform/x86/asus-wmi.c +5 -0
+		queue_work(asus->led_workqueue, &asus->kbd_led_work);
+
+	return 0;
+}
+
 static int asus_hotk_restore(struct device *device)
 {
 	struct asus_wmi *asus = dev_get_drvdata(device);

drivers/platform/x86/asus-wmi.c static int asus_hotk_restore(struct device *device) · line 2206

Quoted 5 lines
drivers/platform/x86/asus-wmi.c +2 -0
@@ -2190,6 +2202,8 @@ static int asus_hotk_restore(struct device *device)
 		bl = !asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_UWB);
 		rfkill_set_sw_state(asus->uwb.rfkill, bl);
 	}
+	if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
+		queue_work(asus->led_workqueue, &asus->kbd_led_work);

Ditto

Quoted 19 lines
drivers/platform/x86/asus-wmi.c +1 -0
 	return 0;
 }
@@ -2197,6 +2211,7 @@ static int asus_hotk_restore(struct device *device)
 static const struct dev_pm_ops asus_pm_ops = {
 	.thaw = asus_hotk_thaw,
 	.restore = asus_hotk_restore,
+	.resume = asus_hotk_resume,
 };
 
 static int asus_wmi_probe(struct platform_device *pdev)
Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#4 lore raw

Hi,

Am 19.09.2015 um 00:31 schrieb Darren Hart:

Quoted 47 lines · Oleksij Rempel
Quoted 4 lines

Afters suspend/resume cycle with closed lid the kbd backlight level is lost. This patch will will restore this value to last known level.

Hi Oleksij,

Please always run scripts/get_maintainer.pl -f path/to/files/changed

And include *all* the maintainers and lists on Cc. This will ensure a faster response.

Quoted 34 lines
---
 drivers/platform/x86/asus-wmi.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/platform/x86/asus-wmi.c +4 -2
index efbc3f0..1f7d80f 100644
@@ -582,7 +582,7 @@ static void asus_wmi_led_exit(struct asus_wmi *asus)
 
 static int asus_wmi_led_init(struct asus_wmi *asus)
 {
-	int rv = 0;
+	int rv = 0, led_val;
 
 	asus->led_workqueue = create_singlethread_workqueue("led_workqueue");
 	if (!asus->led_workqueue)
@@ -602,9 +602,11 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
 			goto error;
 	}
 
-	if (kbd_led_read(asus, NULL, NULL) >= 0) {
+	led_val = kbd_led_read(asus, NULL, NULL);
+	if (led_val >= 0) {
 		INIT_WORK(&asus->kbd_led_work, kbd_led_update);
 
+		asus->kbd_led_wk = led_val;
 		asus->kbd_led.name = "asus::kbd_backlight";
 		asus->kbd_led.brightness_set = kbd_led_set;
 		asus->kbd_led.brightness_get = kbd_led_get;
@@ -2160,6 +2162,16 @@ static int asus_hotk_thaw(struct device *device)
 	return 0;
 }
 
Quoted 12 lines

drivers/platform/x86/asus-wmi.c static int asus_hotk_thaw(struct device *device) · line 2169

Quoted 5 lines
drivers/platform/x86/asus-wmi.c +5 -0
+static int asus_hotk_resume(struct device *device)
+{
+	struct asus_wmi *asus = dev_get_drvdata(device);
+
+	if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
	if (asus->kbd_led.dev)

	should be sufficient, I don't see the dev pointer being stored as an
	errno.

	Corentin?

led_classdev_register
led_classdev_next_name

    device_create_with_groups
      device_create_groups_vargs
        retval = -ENODEV;
        retval = -ENOMEM;
        return ERR_PTR(retval);

if (IS_ERR(led_cdev->dev))

this is how dev pointer is stored as errno.

Quoted 37 lines
Quoted 9 lines
drivers/platform/x86/asus-wmi.c +5 -0
+		queue_work(asus->led_workqueue, &asus->kbd_led_work);
+
+	return 0;
+}
+
 static int asus_hotk_restore(struct device *device)
 {
 	struct asus_wmi *asus = dev_get_drvdata(device);

drivers/platform/x86/asus-wmi.c static int asus_hotk_restore(struct device *device) · line 2206

Quoted 5 lines
drivers/platform/x86/asus-wmi.c +2 -0
@@ -2190,6 +2202,8 @@ static int asus_hotk_restore(struct device *device)
 		bl = !asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_UWB);
 		rfkill_set_sw_state(asus->uwb.rfkill, bl);
 	}
+	if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
+		queue_work(asus->led_workqueue, &asus->kbd_led_work);

Ditto

Quoted 19 lines
drivers/platform/x86/asus-wmi.c +1 -0
 	return 0;
 }
@@ -2197,6 +2211,7 @@ static int asus_hotk_restore(struct device *device)
 static const struct dev_pm_ops asus_pm_ops = {
 	.thaw = asus_hotk_thaw,
 	.restore = asus_hotk_restore,
+	.resume = asus_hotk_resume,
 };
 
 static int asus_wmi_probe(struct platform_device *pdev)
Signature · 6 lines
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Regards,
Oleksij
#5 lore raw
Quoted 65 lines · Oleksij Rempel

Hi,

Am 19.09.2015 um 00:31 schrieb Darren Hart:

Quoted 47 lines · Oleksij Rempel
Quoted 4 lines

Afters suspend/resume cycle with closed lid the kbd backlight level is lost. This patch will will restore this value to last known level.

Hi Oleksij,

Please always run scripts/get_maintainer.pl -f path/to/files/changed

And include *all* the maintainers and lists on Cc. This will ensure a faster response.

Quoted 34 lines
---
 drivers/platform/x86/asus-wmi.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/platform/x86/asus-wmi.c +4 -2
index efbc3f0..1f7d80f 100644
@@ -582,7 +582,7 @@ static void asus_wmi_led_exit(struct asus_wmi *asus)
 
 static int asus_wmi_led_init(struct asus_wmi *asus)
 {
-	int rv = 0;
+	int rv = 0, led_val;
 
 	asus->led_workqueue = create_singlethread_workqueue("led_workqueue");
 	if (!asus->led_workqueue)
@@ -602,9 +602,11 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
 			goto error;
 	}
 
-	if (kbd_led_read(asus, NULL, NULL) >= 0) {
+	led_val = kbd_led_read(asus, NULL, NULL);
+	if (led_val >= 0) {
 		INIT_WORK(&asus->kbd_led_work, kbd_led_update);
 
+		asus->kbd_led_wk = led_val;
 		asus->kbd_led.name = "asus::kbd_backlight";
 		asus->kbd_led.brightness_set = kbd_led_set;
 		asus->kbd_led.brightness_get = kbd_led_get;
@@ -2160,6 +2162,16 @@ static int asus_hotk_thaw(struct device *device)
 	return 0;
 }
 
Quoted 12 lines

drivers/platform/x86/asus-wmi.c static int asus_hotk_thaw(struct device *device) · line 2169

Quoted 5 lines
drivers/platform/x86/asus-wmi.c +5 -0
+static int asus_hotk_resume(struct device *device)
+{
+	struct asus_wmi *asus = dev_get_drvdata(device);
+
+	if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
	if (asus->kbd_led.dev)

	should be sufficient, I don't see the dev pointer being stored as an
	errno.

	Corentin?

led_classdev_register
led_classdev_next_name

Quoted 8 lines
    device_create_with_groups
      device_create_groups_vargs
        retval = -ENODEV;
        retval = -ENOMEM;
        return ERR_PTR(retval);

if (IS_ERR(led_cdev->dev))

this is how dev pointer is stored as errno.

Ah! Thank you for the correction. Noted.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
#6 lore raw

Am 21.09.2015 um 19:12 schrieb Darren Hart:

Quoted 73 lines · Oleksij Rempel
Quoted 72 lines

Hi,

Am 19.09.2015 um 00:31 schrieb Darren Hart:

Quoted 47 lines · Oleksij Rempel
Quoted 4 lines

Afters suspend/resume cycle with closed lid the kbd backlight level is lost. This patch will will restore this value to last known level.

Hi Oleksij,

Please always run scripts/get_maintainer.pl -f path/to/files/changed

And include *all* the maintainers and lists on Cc. This will ensure a faster response.

Quoted 34 lines
---
 drivers/platform/x86/asus-wmi.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/platform/x86/asus-wmi.c +4 -2
index efbc3f0..1f7d80f 100644
@@ -582,7 +582,7 @@ static void asus_wmi_led_exit(struct asus_wmi *asus)
 
 static int asus_wmi_led_init(struct asus_wmi *asus)
 {
-	int rv = 0;
+	int rv = 0, led_val;
 
 	asus->led_workqueue = create_singlethread_workqueue("led_workqueue");
 	if (!asus->led_workqueue)
@@ -602,9 +602,11 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
 			goto error;
 	}
 
-	if (kbd_led_read(asus, NULL, NULL) >= 0) {
+	led_val = kbd_led_read(asus, NULL, NULL);
+	if (led_val >= 0) {
 		INIT_WORK(&asus->kbd_led_work, kbd_led_update);
 
+		asus->kbd_led_wk = led_val;
 		asus->kbd_led.name = "asus::kbd_backlight";
 		asus->kbd_led.brightness_set = kbd_led_set;
 		asus->kbd_led.brightness_get = kbd_led_get;
@@ -2160,6 +2162,16 @@ static int asus_hotk_thaw(struct device *device)
 	return 0;
 }
 
Quoted 12 lines

drivers/platform/x86/asus-wmi.c static int asus_hotk_thaw(struct device *device) · line 2169

Quoted 5 lines
drivers/platform/x86/asus-wmi.c +5 -0
+static int asus_hotk_resume(struct device *device)
+{
+	struct asus_wmi *asus = dev_get_drvdata(device);
+
+	if (!IS_ERR_OR_NULL(asus->kbd_led.dev))
	if (asus->kbd_led.dev)

	should be sufficient, I don't see the dev pointer being stored as an
	errno.

	Corentin?

led_classdev_register
led_classdev_next_name

    device_create_with_groups
      device_create_groups_vargs
        retval = -ENODEV;
        retval = -ENOMEM;
        return ERR_PTR(retval);

if (IS_ERR(led_cdev->dev))

Quoted 4 lines
Quoted 1 line

this is how dev pointer is stored as errno.

Ah! Thank you for the correction. Noted.

No problem :)
probably it can be optimised in separate patch.

Signature · 2 lines
Regards,
Oleksij
#7 lore raw
Quoted 10 lines · Oleksij Rempel

Am 21.09.2015 um 19:12 schrieb Darren Hart:

Quoted 9 lines · Oleksij Rempel
Quoted 8 lines

Hi,

Am 19.09.2015 um 00:31 schrieb Darren Hart:

Quoted 5 lines · Oleksij Rempel
Quoted 4 lines

Afters suspend/resume cycle with closed lid the kbd backlight level is lost. This patch will will restore this value to last known level.

Queued to testing, will be in -next next week unless Corentin raises an objection.

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center