summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--0001-atkbd-Support-LED-triggers-for-keyboard-LEDs.patch88
-rw-r--r--0002-thinkpad_acpi-Support-micmute-LED.patch41
-rw-r--r--0003-thinkpad_acpi-Wire-unused-micmute-LED-to-capslock.patch33
-rw-r--r--bind-micmute-led-to-capslock-led.patch37
-rw-r--r--enable-micmute-led.patch23
5 files changed, 162 insertions, 60 deletions
diff --git a/0001-atkbd-Support-LED-triggers-for-keyboard-LEDs.patch b/0001-atkbd-Support-LED-triggers-for-keyboard-LEDs.patch
new file mode 100644
index 0000000..d37d2f2
--- /dev/null
+++ b/0001-atkbd-Support-LED-triggers-for-keyboard-LEDs.patch
@@ -0,0 +1,88 @@
+From 4e6da3bb9c071b18f3d2c344685b0c4bd30822ad Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Thu, 22 Aug 2013 15:35:51 +0200
+Subject: [PATCH 1/3] atkbd: Support LED triggers for keyboard LEDs
+
+Many new laptop keyboards aren't shipping with LEDs in the keys for
+caps lock, num lock, and scroll lock. They do, however, ship with many LEDs
+for specialized functions that mostly go non-utilized by any current
+Linux drivers. Having a caps lock LED is very helpful in early boot full
+disk encryption, where a fancy GUI is not available to show that caps
+lock is activated.
+
+This patch wires in the caps, num, and scroll lock states of the
+keyboard into the generic LED trigger subsystem, so that integrators can
+have different LEDs activated on caps/num/scroll lock state changes.
+
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+---
+ drivers/input/keyboard/atkbd.c | 26 ++++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
+index 2626773..15061bf 100644
+--- a/drivers/input/keyboard/atkbd.c
++++ b/drivers/input/keyboard/atkbd.c
+@@ -28,6 +28,7 @@
+ #include <linux/libps2.h>
+ #include <linux/mutex.h>
+ #include <linux/dmi.h>
++#include <linux/leds.h>
+
+ #define DRIVER_DESC "AT and PS/2 keyboard driver"
+
+@@ -302,6 +303,12 @@ static const unsigned int xl_table[] = {
+ ATKBD_RET_NAK, ATKBD_RET_HANJA, ATKBD_RET_HANGEUL,
+ };
+
++#ifdef CONFIG_LEDS_TRIGGERS
++struct led_trigger *capsl_led_trigger = 0;
++struct led_trigger *numl_led_trigger = 0;
++struct led_trigger *scrolll_led_trigger = 0;
++#endif
++
+ /*
+ * Checks if we should mangle the scancode to extract 'release' bit
+ * in translated mode.
+@@ -559,6 +566,12 @@ static int atkbd_set_leds(struct atkbd *atkbd)
+ if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS))
+ return -1;
+
++#ifdef CONFIG_LEDS_TRIGGERS
++ led_trigger_event(capsl_led_trigger, test_bit(LED_CAPSL, dev->led) ? LED_FULL : LED_OFF);
++ led_trigger_event(numl_led_trigger, test_bit(LED_NUML, dev->led) ? LED_FULL : LED_OFF);
++ led_trigger_event(scrolll_led_trigger, test_bit(LED_SCROLLL, dev->led) ? LED_FULL : LED_OFF);
++#endif
++
+ if (atkbd->extra) {
+ param[0] = 0;
+ param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0)
+@@ -1781,12 +1794,25 @@ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = {
+ static int __init atkbd_init(void)
+ {
+ dmi_check_system(atkbd_dmi_quirk_table);
++#ifdef CONFIG_LEDS_TRIGGERS
++ led_trigger_register_simple("caps-lock", &capsl_led_trigger);
++ led_trigger_register_simple("num-lock", &numl_led_trigger);
++ led_trigger_register_simple("scroll-lock", &scrolll_led_trigger);
++#endif
+
+ return serio_register_driver(&atkbd_drv);
+ }
+
+ static void __exit atkbd_exit(void)
+ {
++#ifdef CONFIG_LEDS_TRIGGERS
++ led_trigger_unregister_simple(capsl_led_trigger);
++ capsl_led_trigger = 0;
++ led_trigger_unregister_simple(numl_led_trigger);
++ numl_led_trigger = 0;
++ led_trigger_unregister_simple(scrolll_led_trigger);
++ scrolll_led_trigger = 0;
++#endif
+ serio_unregister_driver(&atkbd_drv);
+ }
+
+--
+1.8.3.2
+
diff --git a/0002-thinkpad_acpi-Support-micmute-LED.patch b/0002-thinkpad_acpi-Support-micmute-LED.patch
new file mode 100644
index 0000000..462dbab
--- /dev/null
+++ b/0002-thinkpad_acpi-Support-micmute-LED.patch
@@ -0,0 +1,41 @@
+From f35169d9071766afaf7192801978fcc0ab82ee08 Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Thu, 22 Aug 2013 15:43:15 +0200
+Subject: [PATCH 2/3] thinkpad_acpi: Support micmute LED
+
+The micmute LED is currently unused. This patch allows it to be hooked
+up to various LED triggers.
+
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+---
+ drivers/platform/x86/thinkpad_acpi.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
+index 54d31c0..33b23cb 100644
+--- a/drivers/platform/x86/thinkpad_acpi.c
++++ b/drivers/platform/x86/thinkpad_acpi.c
+@@ -5050,8 +5050,10 @@ static const char * const tpacpi_led_names[TPACPI_LED_NUMLEDS] = {
+ "tpacpi::unknown_led2",
+ "tpacpi::unknown_led3",
+ "tpacpi::thinkvantage",
++ "tpacpi::unknown_led4",
++ "tpacpi::micmute"
+ };
+-#define TPACPI_SAFE_LEDS 0x1081U
++#define TPACPI_SAFE_LEDS 0x5081U
+
+ static inline bool tpacpi_is_led_restricted(const unsigned int led)
+ {
+@@ -5274,7 +5276,7 @@ static const struct tpacpi_quirk led_useful_qtable[] __initconst = {
+ { /* Lenovo */
+ .vendor = PCI_VENDOR_ID_LENOVO,
+ .bios = TPACPI_MATCH_ANY, .ec = TPACPI_MATCH_ANY,
+- .quirks = 0x1fffU,
++ .quirks = 0x5fffU,
+ },
+ { /* IBM ThinkPads with no EC version string */
+ .vendor = PCI_VENDOR_ID_IBM,
+--
+1.8.3.2
+
diff --git a/0003-thinkpad_acpi-Wire-unused-micmute-LED-to-capslock.patch b/0003-thinkpad_acpi-Wire-unused-micmute-LED-to-capslock.patch
new file mode 100644
index 0000000..cd4f26a
--- /dev/null
+++ b/0003-thinkpad_acpi-Wire-unused-micmute-LED-to-capslock.patch
@@ -0,0 +1,33 @@
+From 8f45637d7c37087325f27b2c1a676befc24746eb Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Thu, 22 Aug 2013 15:47:35 +0200
+Subject: [PATCH 3/3] thinkpad_acpi: Wire unused micmute LED to capslock
+
+Thinkpads with a micmute LED do not have a capslock LED. The micmute LED
+is currently not used by any piece of Linux kernel land or user land. It
+seems reasonable to hook it up to caps lock, at least by default, so
+users can have some degree of functionality.
+
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+---
+ drivers/platform/x86/thinkpad_acpi.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
+index 33b23cb..708fdb8 100644
+--- a/drivers/platform/x86/thinkpad_acpi.c
++++ b/drivers/platform/x86/thinkpad_acpi.c
+@@ -5235,6 +5235,10 @@ static int __init tpacpi_init_led(unsigned int led)
+
+ tpacpi_leds[led].led_classdev.name = tpacpi_led_names[led];
+
++ /* Special case wiring micmute to caps-lock by default. */
++ if (led == 14)
++ tpacpi_leds[led].led_classdev.default_trigger = "caps-lock";
++
+ INIT_WORK(&tpacpi_leds[led].work, led_set_status_worker);
+
+ rc = led_classdev_register(&tpacpi_pdev->dev,
+--
+1.8.3.2
+
diff --git a/bind-micmute-led-to-capslock-led.patch b/bind-micmute-led-to-capslock-led.patch
deleted file mode 100644
index 36aca2c..0000000
--- a/bind-micmute-led-to-capslock-led.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-diff -ru linux-3.7/drivers/input/keyboard/atkbd.c linux-3.7-mod/drivers/input/keyboard/atkbd.c
---- linux-3.7/drivers/input/keyboard/atkbd.c 2012-12-11 04:30:57.000000000 +0100
-+++ linux-3.7-mod/drivers/input/keyboard/atkbd.c 2013-02-10 18:29:48.582114753 +0100
-@@ -548,6 +548,24 @@
- return ps2_command(&atkbd->ps2dev, &param, ATKBD_CMD_SETREP);
- }
-
-+/* Using the filesystem like this is almost 100% the wrong way to do things. */
-+static void set_mic_mute_led(int on)
-+{
-+ struct file *filp;
-+ loff_t offset;
-+
-+ filp = filp_open("/sys/devices/platform/thinkpad_acpi/leds/tpacpi::micmute/brightness", O_RDWR, 0);
-+ if (IS_ERR(filp))
-+ return;
-+ offset = 0;
-+ if (on)
-+ vfs_write(filp, "255\n", 4, &offset);
-+ else
-+ vfs_write(filp, "0\n", 2, &offset);
-+ generic_file_fsync(filp, 0, offset, 0);
-+ filp_close(filp, NULL);
-+}
-+
- static int atkbd_set_leds(struct atkbd *atkbd)
- {
- struct input_dev *dev = atkbd->dev;
-@@ -558,6 +576,8 @@
- | (test_bit(LED_CAPSL, dev->led) ? 4 : 0);
- if (ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS))
- return -1;
-+
-+ set_mic_mute_led(test_bit(LED_CAPSL, dev->led));
-
- if (atkbd->extra) {
- param[0] = 0;
diff --git a/enable-micmute-led.patch b/enable-micmute-led.patch
deleted file mode 100644
index b5190fe..0000000
--- a/enable-micmute-led.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/drivers/platform/x86/thinkpad_acpi.c 2013-07-03 16:12:50.866635663 +0200
-+++ b/drivers/platform/x86/thinkpad_acpi.c 2013-07-03 16:13:56.458632739 +0200
-@@ -5050,8 +5050,10 @@
- "tpacpi::unknown_led2",
- "tpacpi::unknown_led3",
- "tpacpi::thinkvantage",
-+ "tpacpi::unknown_led4",
-+ "tpacpi::micmute"
- };
--#define TPACPI_SAFE_LEDS 0x1081U
-+#define TPACPI_SAFE_LEDS 0x5081U
-
- static inline bool tpacpi_is_led_restricted(const unsigned int led)
- {
-@@ -5274,7 +5276,7 @@
- { /* Lenovo */
- .vendor = PCI_VENDOR_ID_LENOVO,
- .bios = TPACPI_MATCH_ANY, .ec = TPACPI_MATCH_ANY,
-- .quirks = 0x1fffU,
-+ .quirks = 0x5fffU,
- },
- { /* IBM ThinkPads with no EC version string */
- .vendor = PCI_VENDOR_ID_IBM,