Skip to contentSkip to conversation

thinkpad_acpi: Fix inconsistent mute LED after resume

PATCH In review Takashi Iwai 4 participants 7 messages Feb 12, 2014 – Feb 14, 2014 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thinkpad_acpi: Fix inconsistent mute LED after resume

The mute LED states have to be restored after resume.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=70351

---
 drivers/platform/x86/thinkpad_acpi.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/platform/x86/thinkpad_acpi.c +12 -0
index defb6afc1409..e2a91c845ac9 100644
@@ -8447,9 +8447,21 @@ static void mute_led_exit(void)
 		tpacpi_led_set(i, false);
 }
 
+static void mute_led_resume(void)
+{
+	int i;
+
+	for (i = 0; i < TPACPI_LED_MAX; i++) {
+		struct tp_led_table *t = &led_tables[i];
+		if (t->state >= 0)
+			mute_led_on_off(t, t->state);
+	}
+}
+
 static struct ibm_struct mute_led_driver_data = {
 	.name = "mute_led",
 	.exit = mute_led_exit,
+	.resume = mute_led_resume,
 };
 
 /****************************************************************************
Signature · 1 line
1.8.5.2
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Takashi Iwai

The mute LED states have to be restored after resume.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=70351

Signature · 4 lines
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
#4 lore raw

At Wed, 12 Feb 2014 20:37:36 +0000,

Quoted 5 lines · Matthew Garrett
Quoted 1 line · Takashi Iwai

The mute LED states have to be restored after resume.

Oh, never mind, we're not doing this through the LED class, are we?

Good point. It seems that leds_class has pm_ops but it's enabled only when a flag is set.

I added the original bug reporter to Cc. (Don't know the name, Bugzilla shows only the email address.)
Could you check the patch below works instead of the previous fix?

Takashi

---

drivers/platform/x86/thinkpad_acpi.c +1 -0
index defb6afc1409..16edf75d9c00 100644
@@ -4796,6 +4796,7 @@ static struct tpacpi_led_classdev tpacpi_led_thinklight = {
 		.name		= "tpacpi::thinklight",
 		.brightness_set	= &light_sysfs_set,
 		.brightness_get	= &light_sysfs_get,
+		.flags		= LED_CORE_SUSPENDRESUME,
 	}
 };
 
#5 lore raw

Hi,

this patch doesn't work. The sound is now muted after the resume (light is on). But the userspace knows nothing about it. (kmix shows the volume as umuted)

Peter

Quoted 31 lines · On Thu, 13 Feb 2014 09:35:30 +0100 Takashi Iwai <[email protected]> wrote:

At Wed, 12 Feb 2014 20:37:36 +0000,

Quoted 5 lines · Matthew Garrett
Quoted 1 line · Takashi Iwai

The mute LED states have to be restored after resume.

Oh, never mind, we're not doing this through the LED class, are we?

Good point. It seems that leds_class has pm_ops but it's enabled only when a flag is set.

I added the original bug reporter to Cc. (Don't know the name, Bugzilla shows only the email address.)
Could you check the patch below works instead of the previous fix?

Takashi

---

drivers/platform/x86/thinkpad_acpi.c +1 -0
index defb6afc1409..16edf75d9c00 100644
@@ -4796,6 +4796,7 @@ static struct tpacpi_led_classdev tpacpi_led_thinklight = {
 		.name		= "tpacpi::thinklight",
 		.brightness_set	= &light_sysfs_set,
 		.brightness_get	= &light_sysfs_get,
+		.flags		= LED_CORE_SUSPENDRESUME,
 	}
 };
 
#6 lore raw

At Thu, 13 Feb 2014 19:02:46 +0100,

Quoted 5 lines · [email protected] wrote:

Hi,

this patch doesn't work. The sound is now muted after the resume (light is on). But the userspace knows nothing about it. (kmix shows the volume as umuted)

OK, scratch the last patch. I thought the mute LED is also a part of thinkpad_acpi's leds_class, but it's not. So, my initial patch is a correct fix in the end.

Matthew, could you take it please?

thanks,

Takashi

Quoted 39 lines

Peter

Quoted 31 lines · On Thu, 13 Feb 2014 09:35:30 +0100 Takashi Iwai <[email protected]> wrote:

At Wed, 12 Feb 2014 20:37:36 +0000,

Quoted 5 lines · Matthew Garrett
Quoted 1 line · Takashi Iwai

The mute LED states have to be restored after resume.

Oh, never mind, we're not doing this through the LED class, are we?

Good point. It seems that leds_class has pm_ops but it's enabled only when a flag is set.

I added the original bug reporter to Cc. (Don't know the name, Bugzilla shows only the email address.)
Could you check the patch below works instead of the previous fix?

Takashi

---

drivers/platform/x86/thinkpad_acpi.c +1 -0
index defb6afc1409..16edf75d9c00 100644
@@ -4796,6 +4796,7 @@ static struct tpacpi_led_classdev tpacpi_led_thinklight = {
 		.name		= "tpacpi::thinklight",
 		.brightness_set	= &light_sysfs_set,
 		.brightness_get	= &light_sysfs_get,
+		.flags		= LED_CORE_SUSPENDRESUME,
 	}
 };