Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1298024 > unrolled thread

[PATCH] thinkpad_acpi: Add support for keyboard backlight

Started byPali Rohár <pali.rohar@gmail.com>
First post2015-12-24 19:50 +0100
Last post2016-01-12 19:00 +0100
Articles 20 on this page of 38 — 7 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] thinkpad_acpi: Add support for keyboard backlight Pali Rohár <pali.rohar@gmail.com> - 2015-12-24 19:50 +0100
    Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2015-12-28 03:50 +0100
      Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Pali Rohár <pali.rohar@gmail.com> - 2015-12-28 15:50 +0100
        Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Pali Rohár <pali.rohar@gmail.com> - 2015-12-30 23:30 +0100
          Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Pali Rohár <pali.rohar@gmail.com> - 2016-01-06 09:50 +0100
            Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-01-09 18:40 +0100
    [PATCH v2] thinkpad_acpi: Add support for keyboard backlight Pali Rohár <pali.rohar@gmail.com> - 2015-12-30 23:30 +0100
      Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight Darren Hart <dvhart@infradead.org> - 2016-01-04 21:10 +0100
        Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight Pali Rohár <pali.rohar@gmail.com> - 2016-01-04 21:30 +0100
          Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight Darren Hart <dvhart@infradead.org> - 2016-01-04 21:50 +0100
            Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight Pali Rohár <pali.rohar@gmail.com> - 2016-01-04 22:00 +0100
              Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight Darren Hart <dvhart@infradead.org> - 2016-01-04 22:50 +0100
            Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-01-09 18:40 +0100
    Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Pavel Machek <pavel@ucw.cz> - 2016-01-04 21:20 +0100
      Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Pali Rohár <pali.rohar@gmail.com> - 2016-01-04 21:30 +0100
        Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Pali Rohár <pali.rohar@gmail.com> - 2016-01-04 21:50 +0100
      Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-01-09 18:40 +0100
        Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-01-09 18:50 +0100
          Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Darren Hart <dvhart@infradead.org> - 2016-01-11 20:10 +0100
            Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-01-11 20:30 +0100
              Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Pali Rohár <pali.rohar@gmail.com> - 2016-01-11 21:10 +0100
                Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Johannes Stezenbach <js@sig21.net> - 2016-01-11 22:20 +0100
                  Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-01-12 17:10 +0100
                    Re: [ibm-acpi-devel] [PATCH] thinkpad_acpi: Add support for  keyboard backlight Yves-Alexis Perez <corsac@debian.org> - 2016-01-12 17:30 +0100
                    Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Johannes Stezenbach <js@sig21.net> - 2016-01-12 17:40 +0100
                      Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-01-12 19:00 +0100
                        Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Johannes Stezenbach <js@sig21.net> - 2016-01-12 23:10 +0100
                    Re: [ibm-acpi-devel] [PATCH] thinkpad_acpi: Add support for keyboard  backlight Kevin Locke <kevin@kevinlocke.name> - 2016-01-12 19:20 +0100
                      Re: [ibm-acpi-devel] [PATCH] thinkpad_acpi: Add support for keyboard  backlight Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-01-12 19:30 +0100
                        Re: [ibm-acpi-devel] [PATCH] thinkpad_acpi: Add support for keyboard  backlight Kevin Locke <kevin@kevinlocke.name> - 2016-01-12 19:40 +0100
                Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-01-12 17:10 +0100
                Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Pavel Machek <pavel@ucw.cz> - 2016-01-12 23:00 +0100
                  Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Pali Rohár <pali.rohar@gmail.com> - 2016-01-13 10:00 +0100
                    Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Pavel Machek <pavel@ucw.cz> - 2016-01-13 20:10 +0100
                      Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Pavel Machek <pavel@ucw.cz> - 2016-01-13 20:20 +0100
              Re: [ibm-acpi-devel] [PATCH] thinkpad_acpi: Add support for  keyboard backlight Yves-Alexis Perez <corsac@debian.org> - 2016-01-11 23:50 +0100
              Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Darren Hart <dvhart@infradead.org> - 2016-01-12 18:00 +0100
                Re: [PATCH] thinkpad_acpi: Add support for keyboard backlight Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-01-12 19:00 +0100

Page 1 of 2  [1] 2  Next page →


#1298024 — [PATCH] thinkpad_acpi: Add support for keyboard backlight

FromPali Rohár <pali.rohar@gmail.com>
Date2015-12-24 19:50 +0100
Subject[PATCH] thinkpad_acpi: Add support for keyboard backlight
Message-ID<qJj7z-1O0-1@gated-at.bofh.it>
This patch adds support for controlling keyboard backlight via standard
linux led class interface (::kbd_backlight). It uses ACPI HKEY device with
MLCG and MLCS methods.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Tested-by: Fabio D'Urso <fabiodurso@hotmail.it>
---
 drivers/platform/x86/thinkpad_acpi.c |  205 ++++++++++++++++++++++++++++++++++
 1 file changed, 205 insertions(+)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 0bed473..477afa1 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -303,6 +303,7 @@ static struct {
 	u32 hotkey_mask:1;
 	u32 hotkey_wlsw:1;
 	u32 hotkey_tablet:1;
+	u32 kbdlight:1;
 	u32 light:1;
 	u32 light_status:1;
 	u32 bright_acpimode:1;
@@ -4986,6 +4987,206 @@ static struct ibm_struct video_driver_data = {
 #endif /* CONFIG_THINKPAD_ACPI_VIDEO */
 
 /*************************************************************************
+ * Keyboard backlight subdriver
+ */
+
+static int kbdlight_set_level(int level)
+{
+	if (!hkey_handle)
+		return -ENXIO;
+
+	if (!acpi_evalf(hkey_handle, NULL, "MLCS", "dd", level))
+		return -EIO;
+
+	return 0;
+}
+
+static int kbdlight_get_level(void)
+{
+	int status = 0;
+
+	if (!hkey_handle)
+		return -ENXIO;
+
+	if (!acpi_evalf(hkey_handle, &status, "MLCG", "dd", 0))
+		return -EIO;
+
+	if (status < 0)
+		return status;
+
+	return status & 0x3;
+}
+
+static bool kbdlight_is_supported(void)
+{
+	int status = 0;
+
+	if (!hkey_handle)
+		return false;
+
+	if (!acpi_has_method(hkey_handle, "MLCG")) {
+		vdbg_printk(TPACPI_DBG_INIT, "kbdlight MLCG is unavailable\n");
+		return false;
+	}
+
+	if (!acpi_evalf(hkey_handle, &status, "MLCG", "qdd", 0)) {
+		vdbg_printk(TPACPI_DBG_INIT, "kbdlight MLCG failed\n");
+		return false;
+	}
+
+	if (status < 0) {
+		vdbg_printk(TPACPI_DBG_INIT, "kbdlight MLCG err: %d\n", status);
+		return false;
+	}
+
+	vdbg_printk(TPACPI_DBG_INIT, "kbdlight MLCG returned 0x%x\n", status);
+	/*
+	 * Guessed test for keyboard backlight:
+	 *
+	 * Machines with backlight keyboard return:
+	 *   b010100000010000000XX - ThinkPad X1 Carbon 3rd
+	 *   b110100010010000000XX - ThinkPad x230
+	 *   b010100000010000000XX - ThinkPad x240
+	 *   b010100000010000000XX - ThinkPad W541
+	 * (XX is current backlight level)
+	 *
+	 * Machines without backlight keyboard return:
+	 *   b10100001000000000000 - ThinkPad x230
+	 *   b10110001000000000000 - ThinkPad E430
+	 *   b00000000000000000000 - ThinkPad E450
+	 *
+	 * Candidate BITs for detection test (XOR):
+	 *   b01000000001000000000
+	 *              ^
+	 */
+	return status & BIT(9);
+}
+
+static void kbdlight_set_worker(struct work_struct *work)
+{
+	struct tpacpi_led_classdev *data =
+			container_of(work, struct tpacpi_led_classdev, work);
+
+	if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING))
+		kbdlight_set_level(data->new_state);
+}
+
+static void kbdlight_sysfs_set(struct led_classdev *led_cdev,
+			enum led_brightness brightness)
+{
+	struct tpacpi_led_classdev *data =
+			container_of(led_cdev,
+				     struct tpacpi_led_classdev,
+				     led_classdev);
+	data->new_state = brightness;
+	queue_work(tpacpi_wq, &data->work);
+}
+
+static enum led_brightness kbdlight_sysfs_get(struct led_classdev *led_cdev)
+{
+	int level;
+
+	level = kbdlight_get_level();
+	if (level < 0)
+		return 0;
+
+	return level;
+}
+
+static struct tpacpi_led_classdev tpacpi_led_kbdlight = {
+	.led_classdev = {
+		.name		= "tpacpi::kbd_backlight",
+		.max_brightness	= 2,
+		.brightness_set	= &kbdlight_sysfs_set,
+		.brightness_get	= &kbdlight_sysfs_get,
+	}
+};
+
+static int __init kbdlight_init(struct ibm_init_struct *iibm)
+{
+	int rc;
+
+	vdbg_printk(TPACPI_DBG_INIT, "initializing kbdlight subdriver\n");
+
+	TPACPI_ACPIHANDLE_INIT(hkey);
+	INIT_WORK(&tpacpi_led_kbdlight.work, kbdlight_set_worker);
+
+	if (!kbdlight_is_supported()) {
+		tp_features.kbdlight = 0;
+		vdbg_printk(TPACPI_DBG_INIT, "kbdlight is unsupported\n");
+		return 1;
+	}
+
+	tp_features.kbdlight = 1;
+
+	rc = led_classdev_register(&tpacpi_pdev->dev,
+				   &tpacpi_led_kbdlight.led_classdev);
+	if (rc < 0) {
+		tp_features.kbdlight = 0;
+		return rc;
+	}
+
+	return 0;
+}
+
+static void kbdlight_exit(void)
+{
+	if (tp_features.kbdlight)
+		led_classdev_unregister(&tpacpi_led_kbdlight.led_classdev);
+	flush_workqueue(tpacpi_wq);
+}
+
+static int kbdlight_read(struct seq_file *m)
+{
+	int level;
+
+	if (!tp_features.kbdlight) {
+		seq_printf(m, "status:\t\tnot supported\n");
+	} else {
+		level = kbdlight_get_level();
+		if (level < 0)
+			seq_printf(m, "status:\t\terror %d\n", level);
+		else
+			seq_printf(m, "status:\t\t%d\n", level);
+		seq_printf(m, "commands:\t0, 1, 2\n");
+	}
+
+	return 0;
+}
+
+static int kbdlight_write(char *buf)
+{
+	char *cmd;
+	int level = -1;
+
+	if (!tp_features.kbdlight)
+		return -ENODEV;
+
+	while ((cmd = next_cmd(&buf))) {
+		if (strlencmp(cmd, "0") == 0)
+			level = 0;
+		else if (strlencmp(cmd, "1") == 0)
+			level = 1;
+		else if (strlencmp(cmd, "2") == 0)
+			level = 2;
+		else
+			return -EINVAL;
+	}
+
+	if (level == -1)
+		return -EINVAL;
+
+	return kbdlight_set_level(level);
+}
+
+static struct ibm_struct kbdlight_driver_data = {
+	.name = "kbdlight",
+	.read = kbdlight_read,
+	.write = kbdlight_write,
+	.exit = kbdlight_exit,
+};
+
+/*************************************************************************
  * Light (thinklight) subdriver
  */
 
@@ -9207,6 +9408,10 @@ static struct ibm_init_struct ibms_init[] __initdata = {
 	},
 #endif
 	{
+		.init = kbdlight_init,
+		.data = &kbdlight_driver_data,
+	},
+	{
 		.init = light_init,
 		.data = &light_driver_data,
 	},
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1298455

FromHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Date2015-12-28 03:50 +0100
Message-ID<qKw3b-3Io-609@gated-at.bofh.it>
In reply to#1298024
On Thu, 24 Dec 2015, Pali Rohár wrote:
> This patch adds support for controlling keyboard backlight via standard
> linux led class interface (::kbd_backlight). It uses ACPI HKEY device with
> MLCG and MLCS methods.
> 
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> Tested-by: Fabio D'Urso <fabiodurso@hotmail.it>

It looks good at a first glance.  But at init you might need to take steps
so that the current state is not changed.  Did you test this?

Also, is it working properly across suspend+resume?

-- 
  "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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1298662

FromPali Rohár <pali.rohar@gmail.com>
Date2015-12-28 15:50 +0100
Message-ID<qKHhv-3pQ-3@gated-at.bofh.it>
In reply to#1298455

[Multipart message — attachments visible in raw view] — view raw

On Monday 28 December 2015 00:14:17 Henrique de Moraes Holschuh wrote:
> On Thu, 24 Dec 2015, Pali Rohár wrote:
> > This patch adds support for controlling keyboard backlight via
> > standard linux led class interface (::kbd_backlight). It uses ACPI
> > HKEY device with MLCG and MLCS methods.
> > 
> > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > Tested-by: Fabio D'Urso <fabiodurso@hotmail.it>
> 
> It looks good at a first glance.  But at init you might need to take
> steps so that the current state is not changed.  Did you test this?

Tested. Modprobing driver does not change keyboard backlight level.

> Also, is it working properly across suspend+resume?

When doing resume from suspend or hibernate BIOS turning keyboard 
backlight automatically off.

But driver at any time report correct backlight level from sysfs node.

-- 
Pali Rohár
pali.rohar@gmail.com

[toc] | [prev] | [next] | [standalone]


#1299523

FromPali Rohár <pali.rohar@gmail.com>
Date2015-12-30 23:30 +0100
Message-ID<qLxpM-45O-7@gated-at.bofh.it>
In reply to#1298662

[Multipart message — attachments visible in raw view] — view raw

On Monday 28 December 2015 15:48:14 Pali Rohár wrote:
> > Also, is it working properly across suspend+resume?
> 
> When doing resume from suspend or hibernate BIOS turning keyboard
> backlight automatically off.

Fixed in v2.

-- 
Pali Rohár
pali.rohar@gmail.com

[toc] | [prev] | [next] | [standalone]


#1302476

FromPali Rohár <pali.rohar@gmail.com>
Date2016-01-06 09:50 +0100
Message-ID<qNRX5-7a9-15@gated-at.bofh.it>
In reply to#1299523
On Wednesday 30 December 2015 23:28:48 Pali Rohár wrote:
> On Monday 28 December 2015 15:48:14 Pali Rohár wrote:
> > > Also, is it working properly across suspend+resume?
> > 
> > When doing resume from suspend or hibernate BIOS turning keyboard
> > backlight automatically off.
> 
> Fixed in v2.
> 

Now I see that BIOS try to be too intelligent and automatically turn of
keyboard backlight when LID is closed. When LID is open again then
keyboard backlight stay turned off. Sysfs show correct state (brightness
is zero).

Should thinkpad acpi driver do something? Or let BIOS do that job?

-- 
Pali Rohár
pali.rohar@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1305334

FromHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Date2016-01-09 18:40 +0100
Message-ID<qP5EC-k4-23@gated-at.bofh.it>
In reply to#1302476
On Wed, Jan 6, 2016, at 06:45, Pali Rohár wrote:
> On Wednesday 30 December 2015 23:28:48 Pali Rohár wrote:
> > On Monday 28 December 2015 15:48:14 Pali Rohár wrote:
> > > > Also, is it working properly across suspend+resume?
> > > 
> > > When doing resume from suspend or hibernate BIOS turning keyboard
> > > backlight automatically off.
> > 
> > Fixed in v2.
> > 
> 
> Now I see that BIOS try to be too intelligent and automatically turn of
> keyboard backlight when LID is closed. When LID is open again then
> keyboard backlight stay turned off. Sysfs show correct state (brightness
> is zero).
> 
> Should thinkpad acpi driver do something? Or let BIOS do that job?

Either is fine, as long as you ensure the driver knows the BIOS turned
off the backlight, which you did.

So, really, I don't mind if we follow the BIOS.

-- 
  "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

[toc] | [prev] | [next] | [standalone]


#1299524 — [PATCH v2] thinkpad_acpi: Add support for keyboard backlight

FromPali Rohár <pali.rohar@gmail.com>
Date2015-12-30 23:30 +0100
Subject[PATCH v2] thinkpad_acpi: Add support for keyboard backlight
Message-ID<qLxpM-45O-17@gated-at.bofh.it>
In reply to#1298024
This patch adds support for controlling keyboard backlight via standard
linux led class interface (::kbd_backlight). It uses ACPI HKEY device with
MLCG and MLCS methods.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Tested-by: Fabio D'Urso <fabiodurso@hotmail.it>
---
Changes since v1:
* Added LED_CORE_SUSPENDRESUME to preserve led state across suspend/hibernate
---
 drivers/platform/x86/thinkpad_acpi.c |  206 ++++++++++++++++++++++++++++++++++
 1 file changed, 206 insertions(+)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 0bed473..a268a7a 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -303,6 +303,7 @@ static struct {
 	u32 hotkey_mask:1;
 	u32 hotkey_wlsw:1;
 	u32 hotkey_tablet:1;
+	u32 kbdlight:1;
 	u32 light:1;
 	u32 light_status:1;
 	u32 bright_acpimode:1;
@@ -4986,6 +4987,207 @@ static struct ibm_struct video_driver_data = {
 #endif /* CONFIG_THINKPAD_ACPI_VIDEO */
 
 /*************************************************************************
+ * Keyboard backlight subdriver
+ */
+
+static int kbdlight_set_level(int level)
+{
+	if (!hkey_handle)
+		return -ENXIO;
+
+	if (!acpi_evalf(hkey_handle, NULL, "MLCS", "dd", level))
+		return -EIO;
+
+	return 0;
+}
+
+static int kbdlight_get_level(void)
+{
+	int status = 0;
+
+	if (!hkey_handle)
+		return -ENXIO;
+
+	if (!acpi_evalf(hkey_handle, &status, "MLCG", "dd", 0))
+		return -EIO;
+
+	if (status < 0)
+		return status;
+
+	return status & 0x3;
+}
+
+static bool kbdlight_is_supported(void)
+{
+	int status = 0;
+
+	if (!hkey_handle)
+		return false;
+
+	if (!acpi_has_method(hkey_handle, "MLCG")) {
+		vdbg_printk(TPACPI_DBG_INIT, "kbdlight MLCG is unavailable\n");
+		return false;
+	}
+
+	if (!acpi_evalf(hkey_handle, &status, "MLCG", "qdd", 0)) {
+		vdbg_printk(TPACPI_DBG_INIT, "kbdlight MLCG failed\n");
+		return false;
+	}
+
+	if (status < 0) {
+		vdbg_printk(TPACPI_DBG_INIT, "kbdlight MLCG err: %d\n", status);
+		return false;
+	}
+
+	vdbg_printk(TPACPI_DBG_INIT, "kbdlight MLCG returned 0x%x\n", status);
+	/*
+	 * Guessed test for keyboard backlight:
+	 *
+	 * Machines with backlight keyboard return:
+	 *   b010100000010000000XX - ThinkPad X1 Carbon 3rd
+	 *   b110100010010000000XX - ThinkPad x230
+	 *   b010100000010000000XX - ThinkPad x240
+	 *   b010100000010000000XX - ThinkPad W541
+	 * (XX is current backlight level)
+	 *
+	 * Machines without backlight keyboard return:
+	 *   b10100001000000000000 - ThinkPad x230
+	 *   b10110001000000000000 - ThinkPad E430
+	 *   b00000000000000000000 - ThinkPad E450
+	 *
+	 * Candidate BITs for detection test (XOR):
+	 *   b01000000001000000000
+	 *              ^
+	 */
+	return status & BIT(9);
+}
+
+static void kbdlight_set_worker(struct work_struct *work)
+{
+	struct tpacpi_led_classdev *data =
+			container_of(work, struct tpacpi_led_classdev, work);
+
+	if (likely(tpacpi_lifecycle == TPACPI_LIFE_RUNNING))
+		kbdlight_set_level(data->new_state);
+}
+
+static void kbdlight_sysfs_set(struct led_classdev *led_cdev,
+			enum led_brightness brightness)
+{
+	struct tpacpi_led_classdev *data =
+			container_of(led_cdev,
+				     struct tpacpi_led_classdev,
+				     led_classdev);
+	data->new_state = brightness;
+	queue_work(tpacpi_wq, &data->work);
+}
+
+static enum led_brightness kbdlight_sysfs_get(struct led_classdev *led_cdev)
+{
+	int level;
+
+	level = kbdlight_get_level();
+	if (level < 0)
+		return 0;
+
+	return level;
+}
+
+static struct tpacpi_led_classdev tpacpi_led_kbdlight = {
+	.led_classdev = {
+		.name		= "tpacpi::kbd_backlight",
+		.max_brightness	= 2,
+		.brightness_set	= &kbdlight_sysfs_set,
+		.brightness_get	= &kbdlight_sysfs_get,
+		.flags		= LED_CORE_SUSPENDRESUME,
+	}
+};
+
+static int __init kbdlight_init(struct ibm_init_struct *iibm)
+{
+	int rc;
+
+	vdbg_printk(TPACPI_DBG_INIT, "initializing kbdlight subdriver\n");
+
+	TPACPI_ACPIHANDLE_INIT(hkey);
+	INIT_WORK(&tpacpi_led_kbdlight.work, kbdlight_set_worker);
+
+	if (!kbdlight_is_supported()) {
+		tp_features.kbdlight = 0;
+		vdbg_printk(TPACPI_DBG_INIT, "kbdlight is unsupported\n");
+		return 1;
+	}
+
+	tp_features.kbdlight = 1;
+
+	rc = led_classdev_register(&tpacpi_pdev->dev,
+				   &tpacpi_led_kbdlight.led_classdev);
+	if (rc < 0) {
+		tp_features.kbdlight = 0;
+		return rc;
+	}
+
+	return 0;
+}
+
+static void kbdlight_exit(void)
+{
+	if (tp_features.kbdlight)
+		led_classdev_unregister(&tpacpi_led_kbdlight.led_classdev);
+	flush_workqueue(tpacpi_wq);
+}
+
+static int kbdlight_read(struct seq_file *m)
+{
+	int level;
+
+	if (!tp_features.kbdlight) {
+		seq_printf(m, "status:\t\tnot supported\n");
+	} else {
+		level = kbdlight_get_level();
+		if (level < 0)
+			seq_printf(m, "status:\t\terror %d\n", level);
+		else
+			seq_printf(m, "status:\t\t%d\n", level);
+		seq_printf(m, "commands:\t0, 1, 2\n");
+	}
+
+	return 0;
+}
+
+static int kbdlight_write(char *buf)
+{
+	char *cmd;
+	int level = -1;
+
+	if (!tp_features.kbdlight)
+		return -ENODEV;
+
+	while ((cmd = next_cmd(&buf))) {
+		if (strlencmp(cmd, "0") == 0)
+			level = 0;
+		else if (strlencmp(cmd, "1") == 0)
+			level = 1;
+		else if (strlencmp(cmd, "2") == 0)
+			level = 2;
+		else
+			return -EINVAL;
+	}
+
+	if (level == -1)
+		return -EINVAL;
+
+	return kbdlight_set_level(level);
+}
+
+static struct ibm_struct kbdlight_driver_data = {
+	.name = "kbdlight",
+	.read = kbdlight_read,
+	.write = kbdlight_write,
+	.exit = kbdlight_exit,
+};
+
+/*************************************************************************
  * Light (thinklight) subdriver
  */
 
@@ -9207,6 +9409,10 @@ static struct ibm_init_struct ibms_init[] __initdata = {
 	},
 #endif
 	{
+		.init = kbdlight_init,
+		.data = &kbdlight_driver_data,
+	},
+	{
 		.init = light_init,
 		.data = &light_driver_data,
 	},
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1301021 — Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight

FromDarren Hart <dvhart@infradead.org>
Date2016-01-04 21:10 +0100
SubjectRe: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight
Message-ID<qNjC4-8eg-43@gated-at.bofh.it>
In reply to#1299524
On Wed, Dec 30, 2015 at 11:27:41PM +0100, Pali Rohár wrote:
> This patch adds support for controlling keyboard backlight via standard
> linux led class interface (::kbd_backlight). It uses ACPI HKEY device with
> MLCG and MLCS methods.
> 

Which laptops is this intended to support?

Henrique, I'm holding off a bit more to give you time to respond given the
holiday season.

Thanks,

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1301050 — Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight

FromPali Rohár <pali.rohar@gmail.com>
Date2016-01-04 21:30 +0100
SubjectRe: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight
Message-ID<qNjVo-8lm-9@gated-at.bofh.it>
In reply to#1301021

[Multipart message — attachments visible in raw view] — view raw

On Monday 04 January 2016 21:04:25 Darren Hart wrote:
> On Wed, Dec 30, 2015 at 11:27:41PM +0100, Pali Rohár wrote:
> > This patch adds support for controlling keyboard backlight via
> > standard linux led class interface (::kbd_backlight). It uses ACPI
> > HKEY device with MLCG and MLCS methods.
> 
> Which laptops is this intended to support?

Thinkpad ??30 series and new which have backlight keyboard.

-- 
Pali Rohár
pali.rohar@gmail.com

[toc] | [prev] | [next] | [standalone]


#1301078 — Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight

FromDarren Hart <dvhart@infradead.org>
Date2016-01-04 21:50 +0100
SubjectRe: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight
Message-ID<qNkeL-8sV-31@gated-at.bofh.it>
In reply to#1301050
On Mon, Jan 04, 2016 at 09:26:19PM +0100, Pali Rohár wrote:
> On Monday 04 January 2016 21:04:25 Darren Hart wrote:
> > On Wed, Dec 30, 2015 at 11:27:41PM +0100, Pali Rohár wrote:
> > > This patch adds support for controlling keyboard backlight via
> > > standard linux led class interface (::kbd_backlight). It uses ACPI
> > > HKEY device with MLCG and MLCS methods.
> > 
> > Which laptops is this intended to support?
> 
> Thinkpad ??30 series and new which have backlight keyboard.

Thanks, we should include that in the commit message as well as the comments
surrounding the driver section.

Henrique, are your concerns surrounding suspend/resume resolved?

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1301088 — Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight

FromPali Rohár <pali.rohar@gmail.com>
Date2016-01-04 22:00 +0100
SubjectRe: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight
Message-ID<qNkoq-6b-15@gated-at.bofh.it>
In reply to#1301078

[Multipart message — attachments visible in raw view] — view raw

On Monday 04 January 2016 21:40:20 Darren Hart wrote:
> On Mon, Jan 04, 2016 at 09:26:19PM +0100, Pali Rohár wrote:
> > On Monday 04 January 2016 21:04:25 Darren Hart wrote:
> > > On Wed, Dec 30, 2015 at 11:27:41PM +0100, Pali Rohár wrote:
> > > > This patch adds support for controlling keyboard backlight via
> > > > standard linux led class interface (::kbd_backlight). It uses
> > > > ACPI HKEY device with MLCG and MLCS methods.
> > > 
> > > Which laptops is this intended to support?
> > 
> > Thinkpad ??30 series and new which have backlight keyboard.
> 
> Thanks, we should include that in the commit message as well as the
> comments surrounding the driver section.

??30 is probably not good characteristic, but I mean all those Thinkpad 
laptops like T430, x230, E430, X1 (1st) and their successors (T440, 
T450, X1 3rd, ...) All those which are from Ivy Bridge processor 
generation (and new).

But basically it cover all Thinkpad laptops which have backlight 
keyboard. Older Thinkpad laptops had only light in bezel.

So if you have better idea for commit message, feel free to change it.

-- 
Pali Rohár
pali.rohar@gmail.com

[toc] | [prev] | [next] | [standalone]


#1301128 — Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight

FromDarren Hart <dvhart@infradead.org>
Date2016-01-04 22:50 +0100
SubjectRe: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight
Message-ID<qNlaQ-Er-45@gated-at.bofh.it>
In reply to#1301088
On Mon, Jan 04, 2016 at 09:51:23PM +0100, Pali Rohár wrote:
> On Monday 04 January 2016 21:40:20 Darren Hart wrote:
> > On Mon, Jan 04, 2016 at 09:26:19PM +0100, Pali Rohár wrote:
> > > On Monday 04 January 2016 21:04:25 Darren Hart wrote:
> > > > On Wed, Dec 30, 2015 at 11:27:41PM +0100, Pali Rohár wrote:
> > > > > This patch adds support for controlling keyboard backlight via
> > > > > standard linux led class interface (::kbd_backlight). It uses
> > > > > ACPI HKEY device with MLCG and MLCS methods.
> > > > 
> > > > Which laptops is this intended to support?
> > > 
> > > Thinkpad ??30 series and new which have backlight keyboard.
> > 
> > Thanks, we should include that in the commit message as well as the
> > comments surrounding the driver section.
> 
> ??30 is probably not good characteristic, but I mean all those Thinkpad 
> laptops like T430, x230, E430, X1 (1st) and their successors (T440, 
> T450, X1 3rd, ...) All those which are from Ivy Bridge processor 
> generation (and new).
> 
> But basically it cover all Thinkpad laptops which have backlight 
> keyboard. Older Thinkpad laptops had only light in bezel.
> 
> So if you have better idea for commit message, feel free to change it.

Ah, I see. New feature that didn't exist previously. OK, no need for changes on
that score then.



-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1305331 — Re: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight

FromHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Date2016-01-09 18:40 +0100
SubjectRe: [PATCH v2] thinkpad_acpi: Add support for keyboard backlight
Message-ID<qP5EB-k4-3@gated-at.bofh.it>
In reply to#1301078
On Mon, Jan 4, 2016, at 18:40, Darren Hart wrote:
> On Mon, Jan 04, 2016 at 09:26:19PM +0100, Pali Rohár wrote:
> > On Monday 04 January 2016 21:04:25 Darren Hart wrote:
> > > On Wed, Dec 30, 2015 at 11:27:41PM +0100, Pali Rohár wrote:
> > > > This patch adds support for controlling keyboard backlight via
> > > > standard linux led class interface (::kbd_backlight). It uses ACPI
> > > > HKEY device with MLCG and MLCS methods.
> > > 
> > > Which laptops is this intended to support?
> > 
> > Thinkpad ??30 series and new which have backlight keyboard.
> 
> Thanks, we should include that in the commit message as well as the
> comments
> surrounding the driver section.
> 
> Henrique, are your concerns surrounding suspend/resume resolved?

Yes.

Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>

-- 
  "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

[toc] | [prev] | [next] | [standalone]


#1301041

FromPavel Machek <pavel@ucw.cz>
Date2016-01-04 21:20 +0100
Message-ID<qNjLK-8i4-41@gated-at.bofh.it>
In reply to#1298024
Hi1

> This patch adds support for controlling keyboard backlight via standard
> linux led class interface (::kbd_backlight). It uses ACPI HKEY device with
> MLCG and MLCS methods.
> 
> Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> Tested-by: Fabio D'Urso <fabiodurso@hotmail.it>

On my thinkpad, keyboard light is controlled by

/sys/class/leds/tpacpi\:\:thinklight/brightness

(that's a bad name).

On n900, it is .../leds/kb0..kb6. Now we'd have kbd_backlight. I guess
we should standartize on one name for this light, so that userspace
has the chance to handle it automatically...

Also, neccessity of workqueues for LED setting is slowly being removed
from the kernel, see LED mailing list for details.

Thanks,
									Pavel
									
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1301048

FromPali Rohár <pali.rohar@gmail.com>
Date2016-01-04 21:30 +0100
Message-ID<qNjVo-8lm-1@gated-at.bofh.it>
In reply to#1301041

[Multipart message — attachments visible in raw view] — view raw

On Monday 04 January 2016 21:12:31 Pavel Machek wrote:
> Hi1
> 
> > This patch adds support for controlling keyboard backlight via
> > standard linux led class interface (::kbd_backlight). It uses ACPI
> > HKEY device with MLCG and MLCS methods.
> > 
> > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > Tested-by: Fabio D'Urso <fabiodurso@hotmail.it>
> 
> On my thinkpad, keyboard light is controlled by
> 
> /sys/class/leds/tpacpi\:\:thinklight/brightness
> 
> (that's a bad name).

Hi!

That is light in upper case of bezel/display, right? Thinklight is 
probably official marketing name for that by IBM/Lenovo.

My patch adds support for keyboard backlight (light under the keyboard).

> On n900, it is .../leds/kb0..kb6. Now we'd have kbd_backlight. I
> guess we should standartize on one name for this light, so that
> userspace has the chance to handle it automatically...

Looks like userspace already uses /sys/class/leds/*::kbd_backlight for 
keyboard backlight (light under the keyboard). At least other drivers 
uses this name and my KDE desktop recognized "dell::kbd_backlight" (from 
dell-laptop.ko) and "tpacpi::kbd_backlight" too.

So really for keyboard backlight use *::kbd_backlight it is already 
handled by existing userspace applications.

> Also, neccessity of workqueues for LED setting is slowly being
> removed from the kernel, see LED mailing list for details.

My patch uses kbd_backlight LED in same as as other LEDs in thinkpad 
acpi driver.

-- 
Pali Rohár
pali.rohar@gmail.com

[toc] | [prev] | [next] | [standalone]


#1301069

FromPali Rohár <pali.rohar@gmail.com>
Date2016-01-04 21:50 +0100
Message-ID<qNkeK-8sV-7@gated-at.bofh.it>
In reply to#1301048

[Multipart message — attachments visible in raw view] — view raw

On Monday 04 January 2016 21:23:52 Pali Rohár wrote:
> Looks like userspace already uses /sys/class/leds/*::kbd_backlight
> for keyboard backlight (light under the keyboard). At least other
> drivers uses this name and my KDE desktop recognized
> "dell::kbd_backlight" (from dell-laptop.ko) and
> "tpacpi::kbd_backlight" too.
> 
> So really for keyboard backlight use *::kbd_backlight it is already
> handled by existing userspace applications.

upower is one of tool used on linux desktops. See this source code:

http://cgit.freedesktop.org/upower/tree/src/up-kbd-backlight.c

It has function up_kbd_backlight_find() which do:

	/* find a led device that is a keyboard device */
	while ((filename = g_dir_read_name (dir)) != NULL) {
		if (g_strstr_len (filename, -1, "kbd_backlight") != NULL) {
			dir_path = g_build_filename ("/sys/class/leds",
						    filename, NULL);
			break;
		}
	}

-- 
Pali Rohár
pali.rohar@gmail.com

[toc] | [prev] | [next] | [standalone]


#1305332

FromHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Date2016-01-09 18:40 +0100
Message-ID<qP5EC-k4-17@gated-at.bofh.it>
In reply to#1301041
On Mon, Jan 4, 2016, at 18:12, Pavel Machek wrote:
> > This patch adds support for controlling keyboard backlight via standard
> > linux led class interface (::kbd_backlight). It uses ACPI HKEY device with
> > MLCG and MLCS methods.
> > 
> > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > Tested-by: Fabio D'Urso <fabiodurso@hotmail.it>
> 
> On my thinkpad, keyboard light is controlled by
> 
> /sys/class/leds/tpacpi\:\:thinklight/brightness
> 
> (that's a bad name).

That's because the driver was not updated to support your laptop, AND I
don't recall if someone mapped the full behavior of the ACPI thinklight
interface in your thinkpad :-(

-- 
  "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

[toc] | [prev] | [next] | [standalone]


#1305337

FromHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Date2016-01-09 18:50 +0100
Message-ID<qP5Oi-od-9@gated-at.bofh.it>
In reply to#1305332
On Sat, Jan 9, 2016, at 15:39, Henrique de Moraes Holschuh wrote:
> On Mon, Jan 4, 2016, at 18:12, Pavel Machek wrote:
> > > This patch adds support for controlling keyboard backlight via standard
> > > linux led class interface (::kbd_backlight). It uses ACPI HKEY device with
> > > MLCG and MLCS methods.
> > > 
> > > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > > Tested-by: Fabio D'Urso <fabiodurso@hotmail.it>
> > 
> > On my thinkpad, keyboard light is controlled by
> > 
> > /sys/class/leds/tpacpi\:\:thinklight/brightness
> > 
> > (that's a bad name).
> 
> That's because the driver was not updated to support your laptop, AND I
> don't recall if someone mapped the full behavior of the ACPI thinklight
> interface in your thinkpad :-(

Argh.  If by "keyboard light" you mean the LED above the *screen* that
shines down on the whole keyboard, please disregard my previous reply...

As for the naming, the idea of a LED up there shining in the keyboard
is:
 1. patented by IBM
 2. named "ThinkLight" by IBM, one of the "Think Technologies" in the
 "ThinkPad" (add TM after everything :p)  and every
     old-timer thinkpad user knew it by that name.
 4. called "thinklight" by the driver since before the LED sysfs class
 even existed :p

ibm-acpi, since then renamed thinkpad-acpi *predates* most generic
interfaces.  Heck, it predates sysfs.

So, this is ABI set in stone.  If there is a way to add an "alias" of
kbd_backlight that won't drive userspace crazy, we might do that though.
 But it looks quite risky to me...

-- 
  "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

[toc] | [prev] | [next] | [standalone]


#1306604

FromDarren Hart <dvhart@infradead.org>
Date2016-01-11 20:10 +0100
Message-ID<qPQ0O-6AV-9@gated-at.bofh.it>
In reply to#1305337
On Sat, Jan 09, 2016 at 03:46:41PM -0200, Henrique de Moraes Holschuh wrote:
> On Sat, Jan 9, 2016, at 15:39, Henrique de Moraes Holschuh wrote:
> > On Mon, Jan 4, 2016, at 18:12, Pavel Machek wrote:
> > > > This patch adds support for controlling keyboard backlight via standard
> > > > linux led class interface (::kbd_backlight). It uses ACPI HKEY device with
> > > > MLCG and MLCS methods.
> > > > 
> > > > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > > > Tested-by: Fabio D'Urso <fabiodurso@hotmail.it>
> > > 
> > > On my thinkpad, keyboard light is controlled by
> > > 
> > > /sys/class/leds/tpacpi\:\:thinklight/brightness
> > > 
> > > (that's a bad name).
> > 
> > That's because the driver was not updated to support your laptop, AND I
> > don't recall if someone mapped the full behavior of the ACPI thinklight
> > interface in your thinkpad :-(
> 
> Argh.  If by "keyboard light" you mean the LED above the *screen* that
> shines down on the whole keyboard, please disregard my previous reply...
> 
> As for the naming, the idea of a LED up there shining in the keyboard
> is:
>  1. patented by IBM
>  2. named "ThinkLight" by IBM, one of the "Think Technologies" in the
>  "ThinkPad" (add TM after everything :p)  and every
>      old-timer thinkpad user knew it by that name.
>  4. called "thinklight" by the driver since before the LED sysfs class
>  even existed :p
> 
> ibm-acpi, since then renamed thinkpad-acpi *predates* most generic
> interfaces.  Heck, it predates sysfs.
> 
> So, this is ABI set in stone.  If there is a way to add an "alias" of
> kbd_backlight that won't drive userspace crazy, we might do that though.
>  But it looks quite risky to me...

Henrique, so are you taking back your Ack from 10 minutes prior?

I've dropped this patch. Please let me know if I should pick it back up.

-- 
Darren Hart
Intel Open Source Technology Center

[toc] | [prev] | [next] | [standalone]


#1306615

FromHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Date2016-01-11 20:30 +0100
Message-ID<qPQk9-6HH-1@gated-at.bofh.it>
In reply to#1306604
On Mon, Jan 11, 2016, at 17:04, Darren Hart wrote:
> On Sat, Jan 09, 2016 at 03:46:41PM -0200, Henrique de Moraes Holschuh
> wrote:
> > On Sat, Jan 9, 2016, at 15:39, Henrique de Moraes Holschuh wrote:
> > > On Mon, Jan 4, 2016, at 18:12, Pavel Machek wrote:
> > > > > This patch adds support for controlling keyboard backlight via standard
> > > > > linux led class interface (::kbd_backlight). It uses ACPI HKEY device with
> > > > > MLCG and MLCS methods.
> > > > > 
> > > > > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > > > > Tested-by: Fabio D'Urso <fabiodurso@hotmail.it>
> > > > 
> > > > On my thinkpad, keyboard light is controlled by
> > > > 
> > > > /sys/class/leds/tpacpi\:\:thinklight/brightness
> > > > 
> > > > (that's a bad name).
> > > 
> > > That's because the driver was not updated to support your laptop, AND I
> > > don't recall if someone mapped the full behavior of the ACPI thinklight
> > > interface in your thinkpad :-(
> > 
> > Argh.  If by "keyboard light" you mean the LED above the *screen* that
> > shines down on the whole keyboard, please disregard my previous reply...
> > 
> > As for the naming, the idea of a LED up there shining in the keyboard
> > is:
> >  1. patented by IBM
> >  2. named "ThinkLight" by IBM, one of the "Think Technologies" in the
> >  "ThinkPad" (add TM after everything :p)  and every
> >      old-timer thinkpad user knew it by that name.
> >  4. called "thinklight" by the driver since before the LED sysfs class
> >  even existed :p
> > 
> > ibm-acpi, since then renamed thinkpad-acpi *predates* most generic
> > interfaces.  Heck, it predates sysfs.
> > 
> > So, this is ABI set in stone.  If there is a way to add an "alias" of
> > kbd_backlight that won't drive userspace crazy, we might do that though.
> >  But it looks quite risky to me...
> 
> Henrique, so are you taking back your Ack from 10 minutes prior?

Hmm? No, the ACK stands.

Pavel was talking about another feature altogether, apparently: older
thinkpads did not have "keyboard backlight" (as in light from below the
keys).  They had a "ThinkLight", which is an overhead light that shines
down on the keyboard.

The two features are not the same (and are handled differently by the
firmware, for whatever reason), although they do serve the same purpose.
 I don't think a thinkpad will ever have both features at the same time,
so I have no idea why they changed the firmware interface.

The patch adds support to the "keyboard backlight" feature, which was
previously NOT supported.

> I've dropped this patch. Please let me know if I should pick it back up.

Please pick it back up.

-- 
  "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

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | linux.kernel


csiph-web