All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold
@ 2020-08-21 18:14 Kenneth Chan
  2020-08-21 18:14 ` [PATCH 1/9] add support for optical driver power in Y and W series Kenneth Chan
                   ` (9 more replies)
  0 siblings, 10 replies; 36+ messages in thread
From: Kenneth Chan @ 2020-08-21 18:14 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: laforge, Kenneth Chan


This patch series is to follow up https://lkml.org/lkml/2020/8/19/186

Martin Lucina <mato@kotelna.sk> added a platform device to power on/off the
optical drive. The patch somehow never made its way to upstream.
This patch merges his work.

The Panasonic Let's Note series have firmware registers that store the
state of mute, AC/DC brightness, current brightness and battery charging
threshold (ECO mode). This patch series also add support to them. 


Kenneth Chan (9):
  add support for optical driver power in Y and W series
  replace ACPI prints with pr_*() macros
  split MODULE_AUTHOR() by one author per macro call
  fix naming of platform files for consistency with other modules
  fix sticky key init bug
  add write support to mute
  resolve hotkey double trigger bug
  add support for battery charging threshold (eco mode)
  add platform devices for firmware brightness registers

 drivers/platform/x86/panasonic-laptop.c | 509 +++++++++++++++++++++---
 1 file changed, 454 insertions(+), 55 deletions(-)


base-commit: 06a4ec1d9dc652e17ee3ac2ceb6c7cf6c2b75cdd
-- 
2.17.5


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 1/9] add support for optical driver power in Y and W series
  2020-08-21 18:14 [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Kenneth Chan
@ 2020-08-21 18:14 ` Kenneth Chan
  2020-11-10 14:00   ` Hans de Goede
  2020-08-21 18:14 ` [PATCH 2/9] replace ACPI prints with pr_*() macros Kenneth Chan
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 36+ messages in thread
From: Kenneth Chan @ 2020-08-21 18:14 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: laforge, Kenneth Chan

The physical optical drive switch is present in Y and W series that switches
on the drive but fails to turn it off. The idea is to be able to toggle the
drive power by software and/or hardware. This patch merges Martin Lucina
<mato@kotelna.sk>'s work that took care of the software part.

Code is also added for the physical switch to power off the drive.


Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
---
 drivers/platform/x86/panasonic-laptop.c | 190 ++++++++++++++++++++++++
 1 file changed, 190 insertions(+)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 59e38a1d2830..21cdc2149a10 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -12,6 +12,13 @@
  *---------------------------------------------------------------------------
  *
  * ChangeLog:
+ *	Aug.18, 2020	Kenneth Chan <kenneth.t.chan@gmail.com>
+ *		-v0.97	add support for cdpower hardware switch
+ *		-v0.96	merge Lucina's enhancement
+ *			Jan.13, 2009 Martin Lucina <mato@kotelna.sk>
+ *				- add support for optical driver power in
+ *				  Y and W series
+ *
  *	Sep.23, 2008	Harald Welte <laforge@gnumonks.org>
  *		-v0.95	rename driver from drivers/acpi/pcc_acpi.c to
  *			drivers/misc/panasonic-laptop.c
@@ -115,6 +122,7 @@
 #include <linux/acpi.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
+#include <linux/platform_device.h>
 
 #ifndef ACPI_HOTKEY_COMPONENT
 #define ACPI_HOTKEY_COMPONENT	0x10000000
@@ -213,6 +221,7 @@ struct pcc_acpi {
 	struct acpi_device	*device;
 	struct input_dev	*input_dev;
 	struct backlight_device	*backlight;
+	struct platform_device	*platform;
 };
 
 /* method access functions */
@@ -345,6 +354,98 @@ static const struct backlight_ops pcc_backlight_ops = {
 };
 
 
+/* returns ACPI_SUCCESS if methods to control optical drive are present */
+
+static acpi_status check_optd_present(void)
+{
+	acpi_status status = AE_OK;
+	acpi_handle handle;
+
+	status = acpi_get_handle(NULL, "\\_SB.STAT", &handle);
+	if (ACPI_FAILURE(status))
+		goto out;
+	status = acpi_get_handle(NULL, "\\_SB.FBAY", &handle);
+	if (ACPI_FAILURE(status))
+		goto out;
+	status = acpi_get_handle(NULL, "\\_SB.CDDI", &handle);
+	if (ACPI_FAILURE(status))
+		goto out;
+
+out:
+	return status;
+}
+
+/* get optical driver power state */
+
+static int get_optd_power_state(void)
+{
+	acpi_status status;
+	unsigned long long state;
+	int result;
+
+	status = acpi_evaluate_integer(NULL, "\\_SB.STAT", NULL, &state);
+	if (ACPI_FAILURE(status)) {
+		pr_err("evaluation error _SB.STAT\n");
+		result = -EIO;
+		goto out;
+	}
+	switch (state) {
+	case 0: /* power off */
+		result = 0;
+		break;
+	case 0x0f: /* power on */
+		result = 1;
+		break;
+	default:
+		result = -EIO;
+		break;
+	}
+
+out:
+	return result;
+}
+
+/* set optical drive power state */
+
+static int set_optd_power_state(int new_state)
+{
+	int result;
+	acpi_status status;
+
+	result = get_optd_power_state();
+	if (result < 0)
+		goto out;
+	if (new_state == result)
+		goto out;
+
+	switch (new_state) {
+	case 0: /* power off */
+		/* Call CDDR instead, since they both call the same method
+		 * while CDDI takes 1 arg and we are not quite sure what it is.
+		 */
+		status = acpi_evaluate_object(NULL, "\\_SB.CDDR", NULL, NULL);
+		if (ACPI_FAILURE(status)) {
+			pr_err("evaluation error _SB.CDDR\n");
+			result = -EIO;
+		}
+		break;
+	case 1: /* power on */
+		status = acpi_evaluate_object(NULL, "\\_SB.FBAY", NULL, NULL);
+		if (ACPI_FAILURE(status)) {
+			pr_err("evaluation error _SB.FBAY\n");
+			result = -EIO;
+		}
+		break;
+	default:
+		result = -EINVAL;
+		break;
+	}
+
+out:
+	return result;
+}
+
+
 /* sysfs user interface functions */
 
 static ssize_t show_numbatt(struct device *dev, struct device_attribute *attr,
@@ -411,16 +512,36 @@ static ssize_t set_sticky(struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
+static ssize_t cdpower_show(struct device *dev, struct device_attribute *attr,
+			    char *buf)
+{
+	return snprintf(buf, PAGE_SIZE, "%d\n", get_optd_power_state());
+}
+
+static ssize_t cdpower_store(struct device *dev, struct device_attribute *attr,
+			   const char *buf, size_t count)
+{
+	int err, val;
+
+	err = kstrtoint(buf, 10, &val);
+	if (err)
+		return err;
+	set_optd_power_state(val);
+	return count;
+}
+
 static DEVICE_ATTR(numbatt, S_IRUGO, show_numbatt, NULL);
 static DEVICE_ATTR(lcdtype, S_IRUGO, show_lcdtype, NULL);
 static DEVICE_ATTR(mute, S_IRUGO, show_mute, NULL);
 static DEVICE_ATTR(sticky_key, S_IRUGO | S_IWUSR, show_sticky, set_sticky);
+static DEVICE_ATTR_RW(cdpower);
 
 static struct attribute *pcc_sysfs_entries[] = {
 	&dev_attr_numbatt.attr,
 	&dev_attr_lcdtype.attr,
 	&dev_attr_mute.attr,
 	&dev_attr_sticky_key.attr,
+	&dev_attr_cdpower.attr,
 	NULL,
 };
 
@@ -476,6 +597,50 @@ static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event)
 	}
 }
 
+static void pcc_optd_notify(acpi_handle handle, u32 event, void *data)
+{
+	if (event != ACPI_NOTIFY_EJECT_REQUEST)
+		return;
+
+	set_optd_power_state(0);
+}
+
+static int pcc_register_optd_notifier(struct pcc_acpi *pcc, char *node)
+{
+	acpi_status status;
+	acpi_handle handle;
+
+	status = acpi_get_handle(NULL, node, &handle);
+
+	if (ACPI_SUCCESS(status)) {
+		status = acpi_install_notify_handler(handle,
+				ACPI_SYSTEM_NOTIFY,
+				pcc_optd_notify, pcc);
+		if (ACPI_FAILURE(status))
+			pr_err("Failed to register notify on %s\n", node);
+	} else
+		return -ENODEV;
+
+	return 0;
+}
+
+static void pcc_unregister_optd_notifier(struct pcc_acpi *pcc, char *node)
+{
+	acpi_status status = AE_OK;
+	acpi_handle handle;
+
+	status = acpi_get_handle(NULL, node, &handle);
+
+	if (ACPI_SUCCESS(status)) {
+		status = acpi_remove_notify_handler(handle,
+				ACPI_SYSTEM_NOTIFY,
+				pcc_optd_notify);
+		if (ACPI_FAILURE(status))
+			pr_err("Error removing optd notify handler %s\n",
+					node);
+	}
+}
+
 static int acpi_pcc_init_input(struct pcc_acpi *pcc)
 {
 	struct input_dev *input_dev;
@@ -606,8 +771,27 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 	if (result)
 		goto out_backlight;
 
+	/* optical drive initialization */
+	if (ACPI_SUCCESS(check_optd_present())) {
+		pcc->platform = platform_device_register_simple("panasonic",
+			-1, NULL, 0);
+		if (IS_ERR(pcc->platform)) {
+			result = PTR_ERR(pcc->platform);
+			goto out_backlight;
+		}
+		result = device_create_file(&pcc->platform->dev,
+			&dev_attr_cdpower);
+		pcc_register_optd_notifier(pcc, "\\_SB.PCI0.EHCI.ERHB.OPTD");
+		if (result)
+			goto out_platform;
+	} else {
+		pcc->platform = NULL;
+	}
+
 	return 0;
 
+out_platform:
+	platform_device_unregister(pcc->platform);
 out_backlight:
 	backlight_device_unregister(pcc->backlight);
 out_input:
@@ -627,6 +811,12 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device)
 	if (!device || !pcc)
 		return -EINVAL;
 
+	if (pcc->platform) {
+		device_remove_file(&pcc->platform->dev, &dev_attr_cdpower);
+		platform_device_unregister(pcc->platform);
+	}
+	pcc_unregister_optd_notifier(pcc, "\\_SB.PCI0.EHCI.ERHB.OPTD");
+
 	sysfs_remove_group(&device->dev.kobj, &pcc_attr_group);
 
 	backlight_device_unregister(pcc->backlight);
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 2/9] replace ACPI prints with pr_*() macros
  2020-08-21 18:14 [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Kenneth Chan
  2020-08-21 18:14 ` [PATCH 1/9] add support for optical driver power in Y and W series Kenneth Chan
@ 2020-08-21 18:14 ` Kenneth Chan
  2020-08-21 18:14 ` [PATCH 3/9] split MODULE_AUTHOR() by one author per macro call Kenneth Chan
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 36+ messages in thread
From: Kenneth Chan @ 2020-08-21 18:14 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: laforge, Kenneth Chan

Replace ACPI prints with pr_*() macros for consistency with other platform
devices.

Clean up obsolete ACPI_HOTKEY_COMPONENT code.


Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
---
 drivers/platform/x86/panasonic-laptop.c | 47 ++++++++-----------------
 1 file changed, 14 insertions(+), 33 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 21cdc2149a10..7170c36577bf 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -13,6 +13,7 @@
  *
  * ChangeLog:
  *	Aug.18, 2020	Kenneth Chan <kenneth.t.chan@gmail.com>
+ *			replace ACPI prints with pr_*() macros
  *		-v0.97	add support for cdpower hardware switch
  *		-v0.96	merge Lucina's enhancement
  *			Jan.13, 2009 Martin Lucina <mato@kotelna.sk>
@@ -124,12 +125,6 @@
 #include <linux/input/sparse-keymap.h>
 #include <linux/platform_device.h>
 
-#ifndef ACPI_HOTKEY_COMPONENT
-#define ACPI_HOTKEY_COMPONENT	0x10000000
-#endif
-
-#define _COMPONENT		ACPI_HOTKEY_COMPONENT
-
 MODULE_AUTHOR("Hiroshi Miura, David Bronaugh and Harald Welte");
 MODULE_DESCRIPTION("ACPI HotKey driver for Panasonic Let's Note laptops");
 MODULE_LICENSE("GPL");
@@ -255,8 +250,7 @@ static inline int acpi_pcc_get_sqty(struct acpi_device *device)
 	if (ACPI_SUCCESS(status))
 		return s;
 	else {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				  "evaluation error HKEY.SQTY\n"));
+		pr_err("evaluation error HKEY.SQTY\n");
 		return -EINVAL;
 	}
 }
@@ -271,21 +265,19 @@ static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc)
 	status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, NULL,
 				      &buffer);
 	if (ACPI_FAILURE(status)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				  "evaluation error HKEY.SINF\n"));
+		pr_err("evaluation error HKEY.SINF\n");
 		return 0;
 	}
 
 	hkey = buffer.pointer;
 	if (!hkey || (hkey->type != ACPI_TYPE_PACKAGE)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid HKEY.SINF\n"));
+		pr_err("Invalid HKEY.SINF\n");
 		status = AE_ERROR;
 		goto end;
 	}
 
 	if (pcc->num_sifr < hkey->package.count) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				 "SQTY reports bad SINF length\n"));
+		pr_err("SQTY reports bad SINF length\n");
 		status = AE_ERROR;
 		goto end;
 	}
@@ -295,8 +287,7 @@ static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc)
 		if (likely(element->type == ACPI_TYPE_INTEGER)) {
 			pcc->sinf[i] = element->integer.value;
 		} else
-			ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-					 "Invalid HKEY.SINF data\n"));
+			pr_err("Invalid HKEY.SINF data\n");
 	}
 	pcc->sinf[hkey->package.count] = -1;
 
@@ -563,8 +554,7 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 	rc = acpi_evaluate_integer(pcc->handle, METHOD_HKEY_QUERY,
 				   NULL, &result);
 	if (ACPI_FAILURE(rc)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				 "error getting hotkey status\n"));
+		pr_err("error getting hotkey status\n");
 		return;
 	}
 
@@ -579,8 +569,7 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 
 	if (!sparse_keymap_report_event(hotk_input_dev,
 					result & 0xf, result & 0x80, false))
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				  "Unknown hotkey event: %d\n", result));
+		pr_err("Unknown hotkey event: 0x%04llx\n", result);
 }
 
 static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event)
@@ -659,15 +648,13 @@ static int acpi_pcc_init_input(struct pcc_acpi *pcc)
 
 	error = sparse_keymap_setup(input_dev, panasonic_keymap, NULL);
 	if (error) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				  "Unable to setup input device keymap\n"));
+		pr_err("Unable to setup input device keymap\n");
 		goto err_free_dev;
 	}
 
 	error = input_register_device(input_dev);
 	if (error) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				  "Unable to register input device\n"));
+		pr_err("Unable to register input device\n");
 		goto err_free_dev;
 	}
 
@@ -693,9 +680,6 @@ static int acpi_pcc_hotkey_resume(struct device *dev)
 	if (!pcc)
 		return -EINVAL;
 
-	ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Sticky mode restore: %d\n",
-			  pcc->sticky_mode));
-
 	return acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_mode);
 }
 #endif
@@ -712,14 +696,13 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 	num_sifr = acpi_pcc_get_sqty(device);
 
 	if (num_sifr < 0 || num_sifr > 255) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "num_sifr out of range"));
+		pr_err("num_sifr out of range");
 		return -ENODEV;
 	}
 
 	pcc = kzalloc(sizeof(struct pcc_acpi), GFP_KERNEL);
 	if (!pcc) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				  "Couldn't allocate mem for pcc"));
+		pr_err("Couldn't allocate mem for pcc");
 		return -ENOMEM;
 	}
 
@@ -738,15 +721,13 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 
 	result = acpi_pcc_init_input(pcc);
 	if (result) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				  "Error installing keyinput handler\n"));
+		pr_err("Error installing keyinput handler\n");
 		goto out_sinf;
 	}
 
 	if (!acpi_pcc_retrieve_biosdata(pcc)) {
-		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-				 "Couldn't retrieve BIOS data\n"));
 		result = -EIO;
+		pr_err("Couldn't retrieve BIOS data\n");
 		goto out_input;
 	}
 	/* initialize backlight */
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 3/9] split MODULE_AUTHOR() by one author per macro call
  2020-08-21 18:14 [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Kenneth Chan
  2020-08-21 18:14 ` [PATCH 1/9] add support for optical driver power in Y and W series Kenneth Chan
  2020-08-21 18:14 ` [PATCH 2/9] replace ACPI prints with pr_*() macros Kenneth Chan
@ 2020-08-21 18:14 ` Kenneth Chan
  2020-08-21 18:14 ` [PATCH 4/9] fix naming of platform files for consistency with other modules Kenneth Chan
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 36+ messages in thread
From: Kenneth Chan @ 2020-08-21 18:14 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: laforge, Kenneth Chan

In reply to https://lkml.org/lkml/2020/8/19/186 to split MODULE_AUTHOR()
per macro call.


Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
---
 drivers/platform/x86/panasonic-laptop.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 7170c36577bf..162b6c560af1 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -13,6 +13,7 @@
  *
  * ChangeLog:
  *	Aug.18, 2020	Kenneth Chan <kenneth.t.chan@gmail.com>
+ *			split MODULE_AUTHOR() by one author per macro call
  *			replace ACPI prints with pr_*() macros
  *		-v0.97	add support for cdpower hardware switch
  *		-v0.96	merge Lucina's enhancement
@@ -125,7 +126,11 @@
 #include <linux/input/sparse-keymap.h>
 #include <linux/platform_device.h>
 
-MODULE_AUTHOR("Hiroshi Miura, David Bronaugh and Harald Welte");
+MODULE_AUTHOR("Hiroshi Miura <miura@da-cha.org>");
+MODULE_AUTHOR("David Bronaugh <dbronaugh@linuxboxen.org>");
+MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
+MODULE_AUTHOR("Martin Lucina <mato@kotelna.sk>");
+MODULE_AUTHOR("Kenneth Chan <kenneth.t.chan@gmail.com>");
 MODULE_DESCRIPTION("ACPI HotKey driver for Panasonic Let's Note laptops");
 MODULE_LICENSE("GPL");
 
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 4/9] fix naming of platform files for consistency with other modules
  2020-08-21 18:14 [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Kenneth Chan
                   ` (2 preceding siblings ...)
  2020-08-21 18:14 ` [PATCH 3/9] split MODULE_AUTHOR() by one author per macro call Kenneth Chan
@ 2020-08-21 18:14 ` Kenneth Chan
  2020-08-21 18:14 ` [PATCH 5/9] fix sticky key init bug Kenneth Chan
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 36+ messages in thread
From: Kenneth Chan @ 2020-08-21 18:14 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: laforge, Kenneth Chan

Change platform device function names for consistency with other modules

Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
---
 drivers/platform/x86/panasonic-laptop.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 162b6c560af1..abf70e6e6578 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -13,6 +13,8 @@
  *
  * ChangeLog:
  *	Aug.18, 2020	Kenneth Chan <kenneth.t.chan@gmail.com>
+ *			fix naming of platform files for consistency with other
+ *			modules
  *			split MODULE_AUTHOR() by one author per macro call
  *			replace ACPI prints with pr_*() macros
  *		-v0.97	add support for cdpower hardware switch
@@ -444,7 +446,7 @@ static int set_optd_power_state(int new_state)
 
 /* sysfs user interface functions */
 
-static ssize_t show_numbatt(struct device *dev, struct device_attribute *attr,
+static ssize_t numbatt_show(struct device *dev, struct device_attribute *attr,
 			    char *buf)
 {
 	struct acpi_device *acpi = to_acpi_device(dev);
@@ -456,7 +458,7 @@ static ssize_t show_numbatt(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_NUM_BATTERIES]);
 }
 
-static ssize_t show_lcdtype(struct device *dev, struct device_attribute *attr,
+static ssize_t lcdtype_show(struct device *dev, struct device_attribute *attr,
 			    char *buf)
 {
 	struct acpi_device *acpi = to_acpi_device(dev);
@@ -468,7 +470,7 @@ static ssize_t show_lcdtype(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_LCD_TYPE]);
 }
 
-static ssize_t show_mute(struct device *dev, struct device_attribute *attr,
+static ssize_t mute_show(struct device *dev, struct device_attribute *attr,
 			 char *buf)
 {
 	struct acpi_device *acpi = to_acpi_device(dev);
@@ -480,7 +482,7 @@ static ssize_t show_mute(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_MUTE]);
 }
 
-static ssize_t show_sticky(struct device *dev, struct device_attribute *attr,
+static ssize_t sticky_key_show(struct device *dev, struct device_attribute *attr,
 			   char *buf)
 {
 	struct acpi_device *acpi = to_acpi_device(dev);
@@ -492,7 +494,7 @@ static ssize_t show_sticky(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_STICKY_KEY]);
 }
 
-static ssize_t set_sticky(struct device *dev, struct device_attribute *attr,
+static ssize_t sticky_key_store(struct device *dev, struct device_attribute *attr,
 			  const char *buf, size_t count)
 {
 	struct acpi_device *acpi = to_acpi_device(dev);
@@ -526,10 +528,10 @@ static ssize_t cdpower_store(struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(numbatt, S_IRUGO, show_numbatt, NULL);
-static DEVICE_ATTR(lcdtype, S_IRUGO, show_lcdtype, NULL);
-static DEVICE_ATTR(mute, S_IRUGO, show_mute, NULL);
-static DEVICE_ATTR(sticky_key, S_IRUGO | S_IWUSR, show_sticky, set_sticky);
+static DEVICE_ATTR_RO(numbatt);
+static DEVICE_ATTR_RO(lcdtype);
+static DEVICE_ATTR_RO(mute);
+static DEVICE_ATTR_RW(sticky_key);
 static DEVICE_ATTR_RW(cdpower);
 
 static struct attribute *pcc_sysfs_entries[] = {
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 5/9] fix sticky key init bug
  2020-08-21 18:14 [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Kenneth Chan
                   ` (3 preceding siblings ...)
  2020-08-21 18:14 ` [PATCH 4/9] fix naming of platform files for consistency with other modules Kenneth Chan
@ 2020-08-21 18:14 ` Kenneth Chan
  2020-08-21 18:14 ` [PATCH 6/9] add write support to mute Kenneth Chan
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 36+ messages in thread
From: Kenneth Chan @ 2020-08-21 18:14 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: laforge, Kenneth Chan

The return value of the sticky key on some models (e.g. CF-W5) do not reflect its
state. How to retrieve its state from firmware is unkown. The safest bet is to reset
it at module init and store its state in pcc struct.


Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
---
 drivers/platform/x86/panasonic-laptop.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index abf70e6e6578..c77292588a8a 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -13,6 +13,7 @@
  *
  * ChangeLog:
  *	Aug.18, 2020	Kenneth Chan <kenneth.t.chan@gmail.com>
+ *			fix sticky_key init bug
  *			fix naming of platform files for consistency with other
  *			modules
  *			split MODULE_AUTHOR() by one author per macro call
@@ -218,7 +219,7 @@ static const struct key_entry panasonic_keymap[] = {
 struct pcc_acpi {
 	acpi_handle		handle;
 	unsigned long		num_sifr;
-	int			sticky_mode;
+	int			sticky_key;
 	u32			*sinf;
 	struct acpi_device	*device;
 	struct input_dev	*input_dev;
@@ -491,7 +492,7 @@ static ssize_t sticky_key_show(struct device *dev, struct device_attribute *attr
 	if (!acpi_pcc_retrieve_biosdata(pcc))
 		return -EIO;
 
-	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_STICKY_KEY]);
+	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sticky_key);
 }
 
 static ssize_t sticky_key_store(struct device *dev, struct device_attribute *attr,
@@ -499,12 +500,14 @@ static ssize_t sticky_key_store(struct device *dev, struct device_attribute *att
 {
 	struct acpi_device *acpi = to_acpi_device(dev);
 	struct pcc_acpi *pcc = acpi_driver_data(acpi);
-	int val;
+	int err, val;
 
-	if (count && sscanf(buf, "%i", &val) == 1 &&
-	    (val == 0 || val == 1)) {
+	err = kstrtoint(buf, 0, &val);
+	if (err)
+		return err;
+	if (val == 0 || val == 1) {
 		acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, val);
-		pcc->sticky_mode = val;
+		pcc->sticky_key = val;
 	}
 
 	return count;
@@ -687,7 +690,9 @@ static int acpi_pcc_hotkey_resume(struct device *dev)
 	if (!pcc)
 		return -EINVAL;
 
-	return acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_mode);
+	acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_key);
+
+	return 0;
 }
 #endif
 
@@ -751,8 +756,9 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 	/* read the initial brightness setting from the hardware */
 	pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT];
 
-	/* read the initial sticky key mode from the hardware */
-	pcc->sticky_mode = pcc->sinf[SINF_STICKY_KEY];
+	/* Reset initial sticky key mode since the hardware register state is not consistent */
+	acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, 0);
+	pcc->sticky_key = 0;
 
 	/* add sysfs attributes */
 	result = sysfs_create_group(&device->dev.kobj, &pcc_attr_group);
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 6/9] add write support to mute
  2020-08-21 18:14 [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Kenneth Chan
                   ` (4 preceding siblings ...)
  2020-08-21 18:14 ` [PATCH 5/9] fix sticky key init bug Kenneth Chan
@ 2020-08-21 18:14 ` Kenneth Chan
  2020-08-21 18:14 ` [PATCH 7/9] resolve hotkey double trigger bug Kenneth Chan
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 36+ messages in thread
From: Kenneth Chan @ 2020-08-21 18:14 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: laforge, Kenneth Chan

Add write support to the mute platform device


Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
---
 drivers/platform/x86/panasonic-laptop.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index c77292588a8a..3b0294ee9d3e 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -13,6 +13,7 @@
  *
  * ChangeLog:
  *	Aug.18, 2020	Kenneth Chan <kenneth.t.chan@gmail.com>
+ *			add write support to mute
  *			fix sticky_key init bug
  *			fix naming of platform files for consistency with other
  *			modules
@@ -220,6 +221,7 @@ struct pcc_acpi {
 	acpi_handle		handle;
 	unsigned long		num_sifr;
 	int			sticky_key;
+	int			mute;
 	u32			*sinf;
 	struct acpi_device	*device;
 	struct input_dev	*input_dev;
@@ -483,6 +485,24 @@ static ssize_t mute_show(struct device *dev, struct device_attribute *attr,
 	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_MUTE]);
 }
 
+static ssize_t mute_store(struct device *dev, struct device_attribute *attr,
+			  const char *buf, size_t count)
+{
+	struct acpi_device *acpi = to_acpi_device(dev);
+	struct pcc_acpi *pcc = acpi_driver_data(acpi);
+	int err, val;
+
+	err = kstrtoint(buf, 0, &val);
+	if (err)
+		return err;
+	if (val == 0 || val == 1) {
+		acpi_pcc_write_sset(pcc, SINF_MUTE, val);
+		pcc->mute = val;
+	}
+
+	return count;
+}
+
 static ssize_t sticky_key_show(struct device *dev, struct device_attribute *attr,
 			   char *buf)
 {
@@ -533,7 +553,7 @@ static ssize_t cdpower_store(struct device *dev, struct device_attribute *attr,
 
 static DEVICE_ATTR_RO(numbatt);
 static DEVICE_ATTR_RO(lcdtype);
-static DEVICE_ATTR_RO(mute);
+static DEVICE_ATTR_RW(mute);
 static DEVICE_ATTR_RW(sticky_key);
 static DEVICE_ATTR_RW(cdpower);
 
@@ -690,6 +710,7 @@ static int acpi_pcc_hotkey_resume(struct device *dev)
 	if (!pcc)
 		return -EINVAL;
 
+	acpi_pcc_write_sset(pcc, SINF_MUTE, pcc->mute);
 	acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_key);
 
 	return 0;
@@ -760,6 +781,8 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 	acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, 0);
 	pcc->sticky_key = 0;
 
+	pcc->mute = pcc->sinf[SINF_MUTE];
+
 	/* add sysfs attributes */
 	result = sysfs_create_group(&device->dev.kobj, &pcc_attr_group);
 	if (result)
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 7/9] resolve hotkey double trigger bug
  2020-08-21 18:14 [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Kenneth Chan
                   ` (5 preceding siblings ...)
  2020-08-21 18:14 ` [PATCH 6/9] add write support to mute Kenneth Chan
@ 2020-08-21 18:14 ` Kenneth Chan
  2022-06-12  9:05   ` [PATCH 0/2] fix panasonic-laptop hotkey regression stefan.seyfried
  2020-08-21 18:14 ` [PATCH 8/9] add support for battery charging threshold (eco mode) Kenneth Chan
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 36+ messages in thread
From: Kenneth Chan @ 2020-08-21 18:14 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: laforge, Kenneth Chan

Sometimes double ACPI events are triggered for brightness, vol and mute hotkeys. This
patch fixes it.


Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
---
 drivers/platform/x86/panasonic-laptop.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 3b0294ee9d3e..6779099a3ec9 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -13,6 +13,7 @@
  *
  * ChangeLog:
  *	Aug.18, 2020	Kenneth Chan <kenneth.t.chan@gmail.com>
+ *			resolve hotkey double trigger
  *			add write support to mute
  *			fix sticky_key init bug
  *			fix naming of platform files for consistency with other
@@ -597,9 +598,11 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 					result & 0xf, 0x80, false);
 	}
 
-	if (!sparse_keymap_report_event(hotk_input_dev,
-					result & 0xf, result & 0x80, false))
-		pr_err("Unknown hotkey event: 0x%04llx\n", result);
+	if ((result & 0xf) == 0x7 || (result & 0xf) == 0x9 || (result & 0xf) == 0xa) {
+		if (!sparse_keymap_report_event(hotk_input_dev,
+						result & 0xf, result & 0x80, false))
+			pr_err("Unknown hotkey event: 0x%04llx\n", result);
+	}
 }
 
 static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event)
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 8/9] add support for battery charging threshold (eco mode)
  2020-08-21 18:14 [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Kenneth Chan
                   ` (6 preceding siblings ...)
  2020-08-21 18:14 ` [PATCH 7/9] resolve hotkey double trigger bug Kenneth Chan
@ 2020-08-21 18:14 ` Kenneth Chan
  2020-08-21 18:14 ` [PATCH 9/9] add platform devices for firmware brightness registers Kenneth Chan
  2020-08-22  7:29 ` [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Harald Welte
  9 siblings, 0 replies; 36+ messages in thread
From: Kenneth Chan @ 2020-08-21 18:14 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: laforge, Kenneth Chan

Add battery charging threshold (aka ECO mode) support.

NOTE: The state of ECO mode is persistent until the next POST cycle which reset
it to previous state.


Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
---
 drivers/platform/x86/panasonic-laptop.c | 86 ++++++++++++++++++++++++-
 1 file changed, 83 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 6779099a3ec9..6355d60dc3eb 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -13,6 +13,7 @@
  *
  * ChangeLog:
  *	Aug.18, 2020	Kenneth Chan <kenneth.t.chan@gmail.com>
+ *			add support for battery charging threshold (eco mode)
  *			resolve hotkey double trigger
  *			add write support to mute
  *			fix sticky_key init bug
@@ -147,7 +148,10 @@ MODULE_LICENSE("GPL");
 #define METHOD_HKEY_SQTY	"SQTY"
 #define METHOD_HKEY_SINF	"SINF"
 #define METHOD_HKEY_SSET	"SSET"
-#define HKEY_NOTIFY		 0x80
+#define METHOD_ECWR		"\\_SB.ECWR"
+#define HKEY_NOTIFY		0x80
+#define ECO_MODE_OFF		0x00
+#define ECO_MODE_ON		0x80
 
 #define ACPI_PCC_DRIVER_NAME	"Panasonic Laptop Support"
 #define ACPI_PCC_DEVICE_NAME	"Hotkey"
@@ -156,7 +160,7 @@ MODULE_LICENSE("GPL");
 #define ACPI_PCC_INPUT_PHYS	"panasonic/hkey0"
 
 /* LCD_TYPEs: 0 = Normal, 1 = Semi-transparent
-   ENV_STATEs: Normal temp=0x01, High temp=0x81, N/A=0x00
+   ECO_MODEs: 0x03 = off, 0x83 = on
 */
 enum SINF_BITS { SINF_NUM_BATTERIES = 0,
 		 SINF_LCD_TYPE,
@@ -168,7 +172,7 @@ enum SINF_BITS { SINF_NUM_BATTERIES = 0,
 		 SINF_DC_CUR_BRIGHT,
 		 SINF_MUTE,
 		 SINF_RESERVED,
-		 SINF_ENV_STATE,
+		 SINF_ECO_MODE = 0x0A,
 		 SINF_STICKY_KEY = 0x80,
 	};
 /* R1 handles SINF_AC_CUR_BRIGHT as SINF_CUR_BRIGHT, doesn't know AC state */
@@ -222,6 +226,7 @@ struct pcc_acpi {
 	acpi_handle		handle;
 	unsigned long		num_sifr;
 	int			sticky_key;
+	int			eco_mode;
 	int			mute;
 	u32			*sinf;
 	struct acpi_device	*device;
@@ -534,6 +539,77 @@ static ssize_t sticky_key_store(struct device *dev, struct device_attribute *att
 	return count;
 }
 
+static ssize_t eco_mode_show(struct device *dev, struct device_attribute *attr,
+				char *buf)
+{
+	struct acpi_device *acpi = to_acpi_device(dev);
+	struct pcc_acpi *pcc = acpi_driver_data(acpi);
+	int result;
+
+	if (!acpi_pcc_retrieve_biosdata(pcc))
+		return -EIO;
+
+	switch (pcc->sinf[SINF_ECO_MODE]) {
+	case (ECO_MODE_OFF + 3):
+		result = 0;
+		break;
+	case (ECO_MODE_ON + 3):
+		result = 1;
+		break;
+	default:
+		result = -EIO;
+		break;
+	}
+	return snprintf(buf, PAGE_SIZE, "%u\n", result);
+}
+
+static ssize_t eco_mode_store(struct device *dev, struct device_attribute *attr,
+			  const char *buf, size_t count)
+{
+	struct acpi_device *acpi = to_acpi_device(dev);
+	struct pcc_acpi *pcc = acpi_driver_data(acpi);
+	int err, state;
+
+	union acpi_object param[2];
+	struct acpi_object_list input;
+	acpi_status status;
+
+	param[0].type = ACPI_TYPE_INTEGER;
+	param[0].integer.value = 0x15;
+	param[1].type = ACPI_TYPE_INTEGER;
+	input.count = 2;
+	input.pointer = param;
+
+	err = kstrtoint(buf, 0, &state);
+	if (err)
+		return err;
+
+	switch (state) {
+	case 0:
+		param[1].integer.value = ECO_MODE_OFF;
+		pcc->sinf[SINF_ECO_MODE] = 0;
+		pcc->eco_mode = 0;
+		break;
+	case 1:
+		param[1].integer.value = ECO_MODE_ON;
+		pcc->sinf[SINF_ECO_MODE] = 1;
+		pcc->eco_mode = 1;
+		break;
+	default:
+		/* nothing to do */
+		return count;
+	}
+
+	status = acpi_evaluate_object(NULL, METHOD_ECWR,
+				       &input, NULL);
+	if (ACPI_FAILURE(status)) {
+		pr_err("%s evaluation failed\n", METHOD_ECWR);
+		return -EINVAL;
+	}
+
+	return count;
+}
+
 static ssize_t cdpower_show(struct device *dev, struct device_attribute *attr,
 			    char *buf)
 {
@@ -556,6 +632,7 @@ static DEVICE_ATTR_RO(numbatt);
 static DEVICE_ATTR_RO(lcdtype);
 static DEVICE_ATTR_RW(mute);
 static DEVICE_ATTR_RW(sticky_key);
+static DEVICE_ATTR_RW(eco_mode);
 static DEVICE_ATTR_RW(cdpower);
 
 static struct attribute *pcc_sysfs_entries[] = {
@@ -563,6 +640,7 @@ static struct attribute *pcc_sysfs_entries[] = {
 	&dev_attr_lcdtype.attr,
 	&dev_attr_mute.attr,
 	&dev_attr_sticky_key.attr,
+	&dev_attr_eco_mode.attr,
 	&dev_attr_cdpower.attr,
 	NULL,
 };
@@ -714,6 +792,7 @@ static int acpi_pcc_hotkey_resume(struct device *dev)
 		return -EINVAL;
 
 	acpi_pcc_write_sset(pcc, SINF_MUTE, pcc->mute);
+	acpi_pcc_write_sset(pcc, SINF_ECO_MODE, pcc->eco_mode);
 	acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_key);
 
 	return 0;
@@ -784,6 +863,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 	acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, 0);
 	pcc->sticky_key = 0;
 
+	pcc->eco_mode = pcc->sinf[SINF_ECO_MODE];
 	pcc->mute = pcc->sinf[SINF_MUTE];
 
 	/* add sysfs attributes */
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 9/9] add platform devices for firmware brightness registers
  2020-08-21 18:14 [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Kenneth Chan
                   ` (7 preceding siblings ...)
  2020-08-21 18:14 ` [PATCH 8/9] add support for battery charging threshold (eco mode) Kenneth Chan
@ 2020-08-21 18:14 ` Kenneth Chan
  2020-08-22  7:29 ` [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Harald Welte
  9 siblings, 0 replies; 36+ messages in thread
From: Kenneth Chan @ 2020-08-21 18:14 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: laforge, Kenneth Chan

Panasonic laptops (at least from CF-W4 onwards) have dedicated firmware
registers for saving ac/dc and current brightness. They are a bit confusing
so here's some explanations:

AC_MIN_BRIGHT, AC_MAX_BRIGHT, DC_MIN_BRIGHT, DC_MAX_BRIGHT:
Read-only. Values: 0x01 and 0x15 respectively.

AC_CUR_BRIGHT, DC_CUR_BRIGHT:
Read-Write. 0x00-0xFF. Store user-defined AC/DC brightness. However, they do
not represent current brightness so they should be named AC_BRIGHT and
DC_BRIGHT instead.

CUR_BRIGHT (present since CF-W4):
Read-Write. 0x00-0xFF. It sets the current brightness. It won't update itself
if brightness is changed via other means, e.g. acpi_video0.

Another CUR_BRIGHT (added since CF-W5):
Read-Write. 0x01-0x15. Its value always synchronizes with current brightness.
Not implemented in this version.

Currently the backlight API interacts with AC_CUR_BRIGHT (probably because
it's the only bl register available in earlier models?). This patch adds
platform devices for AC_CUR_BRIGHT, DC_CUR_BRIGHT and CUR_BRIGHT.

It also fixes the error of https://lkml.org/lkml/2020/8/19/1264.


PS: I think the backlight API should interact with CUR_BRIGHT instead of
AC_CUR_BRIGHT. But it involves complications like mapping between 0x01-0x15
or 0x00-0x14 (the backlight API) and 0x00-0xFF (CUR_BRIGHT). I'll leave the
discussion for a later version.


Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
---
 drivers/platform/x86/panasonic-laptop.c | 109 ++++++++++++++++++++++++
 1 file changed, 109 insertions(+)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 6355d60dc3eb..6388c3c705a6 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -13,6 +13,7 @@
  *
  * ChangeLog:
  *	Aug.18, 2020	Kenneth Chan <kenneth.t.chan@gmail.com>
+ *		-v0.98	add platform devices for firmware brightness registers
  *			add support for battery charging threshold (eco mode)
  *			resolve hotkey double trigger
  *			add write support to mute
@@ -132,6 +133,7 @@
 #include <linux/input/sparse-keymap.h>
 #include <linux/platform_device.h>
 
+
 MODULE_AUTHOR("Hiroshi Miura <miura@da-cha.org>");
 MODULE_AUTHOR("David Bronaugh <dbronaugh@linuxboxen.org>");
 MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
@@ -173,6 +175,7 @@ enum SINF_BITS { SINF_NUM_BATTERIES = 0,
 		 SINF_MUTE,
 		 SINF_RESERVED,
 		 SINF_ECO_MODE = 0x0A,
+		 SINF_CUR_BRIGHT = 0x0D,
 		 SINF_STICKY_KEY = 0x80,
 	};
 /* R1 handles SINF_AC_CUR_BRIGHT as SINF_CUR_BRIGHT, doesn't know AC state */
@@ -228,6 +231,9 @@ struct pcc_acpi {
 	int			sticky_key;
 	int			eco_mode;
 	int			mute;
+	int			ac_brightness;
+	int			dc_brightness;
+	int			current_brightness;
 	u32			*sinf;
 	struct acpi_device	*device;
 	struct input_dev	*input_dev;
@@ -610,6 +616,97 @@ static ssize_t eco_mode_store(struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
+static ssize_t ac_brightness_show(struct device *dev, struct device_attribute *attr,
+				  char *buf)
+{
+	struct acpi_device *acpi = to_acpi_device(dev);
+	struct pcc_acpi *pcc = acpi_driver_data(acpi);
+
+	if (!acpi_pcc_retrieve_biosdata(pcc))
+		return -EIO;
+
+	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_AC_CUR_BRIGHT]);
+}
+
+static ssize_t ac_brightness_store(struct device *dev, struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	struct acpi_device *acpi = to_acpi_device(dev);
+	struct pcc_acpi *pcc = acpi_driver_data(acpi);
+	int err, val;
+
+	err = kstrtoint(buf, 0, &val);
+	if (err)
+		return err;
+	if (val >= 0 && val <= 255) {
+		acpi_pcc_write_sset(pcc, SINF_AC_CUR_BRIGHT, val);
+		pcc->ac_brightness = val;
+	}
+
+	return count;
+}
+
+static ssize_t dc_brightness_show(struct device *dev, struct device_attribute *attr,
+				  char *buf)
+{
+	struct acpi_device *acpi = to_acpi_device(dev);
+	struct pcc_acpi *pcc = acpi_driver_data(acpi);
+
+	if (!acpi_pcc_retrieve_biosdata(pcc))
+		return -EIO;
+
+	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_DC_CUR_BRIGHT]);
+}
+
+static ssize_t dc_brightness_store(struct device *dev, struct device_attribute *attr,
+				   const char *buf, size_t count)
+{
+	struct acpi_device *acpi = to_acpi_device(dev);
+	struct pcc_acpi *pcc = acpi_driver_data(acpi);
+	int err, val;
+
+	err = kstrtoint(buf, 0, &val);
+	if (err)
+		return err;
+	if (val >= 0 && val <= 255) {
+		acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, val);
+		pcc->dc_brightness = val;
+	}
+
+	return count;
+}
+
+static ssize_t current_brightness_show(struct device *dev, struct device_attribute *attr,
+				       char *buf)
+{
+	struct acpi_device *acpi = to_acpi_device(dev);
+	struct pcc_acpi *pcc = acpi_driver_data(acpi);
+
+	if (!acpi_pcc_retrieve_biosdata(pcc))
+		return -EIO;
+
+	return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_CUR_BRIGHT]);
+}
+
+static ssize_t current_brightness_store(struct device *dev, struct device_attribute *attr,
+					const char *buf, size_t count)
+{
+	struct acpi_device *acpi = to_acpi_device(dev);
+	struct pcc_acpi *pcc = acpi_driver_data(acpi);
+	int err, val;
+
+	err = kstrtoint(buf, 0, &val);
+	if (err)
+		return err;
+
+	if (val >= 0 && val <= 255) {
+		err = acpi_pcc_write_sset(pcc, SINF_CUR_BRIGHT, val);
+		pcc->current_brightness = val;
+	}
+
+	return count;
+}
+
 static ssize_t cdpower_show(struct device *dev, struct device_attribute *attr,
 			    char *buf)
 {
@@ -633,6 +730,9 @@ static DEVICE_ATTR_RO(lcdtype);
 static DEVICE_ATTR_RW(mute);
 static DEVICE_ATTR_RW(sticky_key);
 static DEVICE_ATTR_RW(eco_mode);
+static DEVICE_ATTR_RW(ac_brightness);
+static DEVICE_ATTR_RW(dc_brightness);
+static DEVICE_ATTR_RW(current_brightness);
 static DEVICE_ATTR_RW(cdpower);
 
 static struct attribute *pcc_sysfs_entries[] = {
@@ -641,6 +741,9 @@ static struct attribute *pcc_sysfs_entries[] = {
 	&dev_attr_mute.attr,
 	&dev_attr_sticky_key.attr,
 	&dev_attr_eco_mode.attr,
+	&dev_attr_ac_brightness.attr,
+	&dev_attr_dc_brightness.attr,
+	&dev_attr_current_brightness.attr,
 	&dev_attr_cdpower.attr,
 	NULL,
 };
@@ -794,6 +897,9 @@ static int acpi_pcc_hotkey_resume(struct device *dev)
 	acpi_pcc_write_sset(pcc, SINF_MUTE, pcc->mute);
 	acpi_pcc_write_sset(pcc, SINF_ECO_MODE, pcc->eco_mode);
 	acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_key);
+	acpi_pcc_write_sset(pcc, SINF_AC_CUR_BRIGHT, pcc->ac_brightness);
+	acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, pcc->dc_brightness);
+	acpi_pcc_write_sset(pcc, SINF_CUR_BRIGHT, pcc->current_brightness);
 
 	return 0;
 }
@@ -865,6 +971,9 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 
 	pcc->eco_mode = pcc->sinf[SINF_ECO_MODE];
 	pcc->mute = pcc->sinf[SINF_MUTE];
+	pcc->ac_brightness = pcc->sinf[SINF_AC_CUR_BRIGHT];
+	pcc->dc_brightness = pcc->sinf[SINF_DC_CUR_BRIGHT];
+	result = pcc->current_brightness = pcc->sinf[SINF_CUR_BRIGHT];
 
 	/* add sysfs attributes */
 	result = sysfs_create_group(&device->dev.kobj, &pcc_attr_group);
-- 
2.17.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold
  2020-08-21 18:14 [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Kenneth Chan
                   ` (8 preceding siblings ...)
  2020-08-21 18:14 ` [PATCH 9/9] add platform devices for firmware brightness registers Kenneth Chan
@ 2020-08-22  7:29 ` Harald Welte
  2020-08-22  8:20   ` Andy Shevchenko
  9 siblings, 1 reply; 36+ messages in thread
From: Harald Welte @ 2020-08-22  7:29 UTC (permalink / raw)
  To: Kenneth Chan; +Cc: platform-driver-x86, linux-kernel

Dear Keneth and Linux kernel developers,

as I have discontinued maintenance of the panasonic-laptop driver (and
recently sent a related MAINTAINERS update to that fact), I would like
to suggest Kenneth as the new maintainer for this driver.

Regards,
	Harald
-- 
- Harald Welte <laforge@gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold
  2020-08-22  7:29 ` [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Harald Welte
@ 2020-08-22  8:20   ` Andy Shevchenko
  0 siblings, 0 replies; 36+ messages in thread
From: Andy Shevchenko @ 2020-08-22  8:20 UTC (permalink / raw)
  To: Harald Welte; +Cc: Kenneth Chan, Platform Driver, Linux Kernel Mailing List

On Sat, Aug 22, 2020 at 10:53 AM Harald Welte <laforge@gnumonks.org> wrote:
>
> Dear Keneth and Linux kernel developers,
>
> as I have discontinued maintenance of the panasonic-laptop driver (and
> recently sent a related MAINTAINERS update to that fact), I would like
> to suggest Kenneth as the new maintainer for this driver.

Kenneth may send a corresponding MAINTAINERS update which you may Acknowledge.


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/9] add support for optical driver power in Y and W series
  2020-08-21 18:14 ` [PATCH 1/9] add support for optical driver power in Y and W series Kenneth Chan
@ 2020-11-10 14:00   ` Hans de Goede
  0 siblings, 0 replies; 36+ messages in thread
From: Hans de Goede @ 2020-11-10 14:00 UTC (permalink / raw)
  To: Kenneth Chan, platform-driver-x86, linux-kernel; +Cc: laforge

Hi All,

Quick self intro: I have take over drivers/platform/x86
maintainership from Andy; and I'm working my way through
the backlog of old patches in patchwork:
https://patchwork.kernel.org/project/platform-driver-x86/list/

On 8/21/20 8:14 PM, Kenneth Chan wrote:
> The physical optical drive switch is present in Y and W series that switches
> on the drive but fails to turn it off. The idea is to be able to toggle the
> drive power by software and/or hardware. This patch merges Martin Lucina
> <mato@kotelna.sk>'s work that took care of the software part.
> 
> Code is also added for the physical switch to power off the drive.

Thank you for your patch-series, I've applied the series to my
review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Kenneth, I think that it is great that you are willing to maintain
this driver going forward. I will also go ahead and merge your
patch updating the MAINTAINERS file for this.

I have changed the commit messages for this series a bit while merging this:

1. I added a "platform/x86: panasonic-laptop: " prefix to all
the Subject lines.
2. I re-wordwrapped some paragraphs because there were lines which
were longer then 75 chars.

Please keep this in mind for future patches.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans



> 
> 
> Signed-off-by: Kenneth Chan <kenneth.t.chan@gmail.com>
> ---
>  drivers/platform/x86/panasonic-laptop.c | 190 ++++++++++++++++++++++++
>  1 file changed, 190 insertions(+)
> 
> diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
> index 59e38a1d2830..21cdc2149a10 100644
> --- a/drivers/platform/x86/panasonic-laptop.c
> +++ b/drivers/platform/x86/panasonic-laptop.c
> @@ -12,6 +12,13 @@
>   *---------------------------------------------------------------------------
>   *
>   * ChangeLog:
> + *	Aug.18, 2020	Kenneth Chan <kenneth.t.chan@gmail.com>
> + *		-v0.97	add support for cdpower hardware switch
> + *		-v0.96	merge Lucina's enhancement
> + *			Jan.13, 2009 Martin Lucina <mato@kotelna.sk>
> + *				- add support for optical driver power in
> + *				  Y and W series
> + *
>   *	Sep.23, 2008	Harald Welte <laforge@gnumonks.org>
>   *		-v0.95	rename driver from drivers/acpi/pcc_acpi.c to
>   *			drivers/misc/panasonic-laptop.c
> @@ -115,6 +122,7 @@
>  #include <linux/acpi.h>
>  #include <linux/input.h>
>  #include <linux/input/sparse-keymap.h>
> +#include <linux/platform_device.h>
>  
>  #ifndef ACPI_HOTKEY_COMPONENT
>  #define ACPI_HOTKEY_COMPONENT	0x10000000
> @@ -213,6 +221,7 @@ struct pcc_acpi {
>  	struct acpi_device	*device;
>  	struct input_dev	*input_dev;
>  	struct backlight_device	*backlight;
> +	struct platform_device	*platform;
>  };
>  
>  /* method access functions */
> @@ -345,6 +354,98 @@ static const struct backlight_ops pcc_backlight_ops = {
>  };
>  
>  
> +/* returns ACPI_SUCCESS if methods to control optical drive are present */
> +
> +static acpi_status check_optd_present(void)
> +{
> +	acpi_status status = AE_OK;
> +	acpi_handle handle;
> +
> +	status = acpi_get_handle(NULL, "\\_SB.STAT", &handle);
> +	if (ACPI_FAILURE(status))
> +		goto out;
> +	status = acpi_get_handle(NULL, "\\_SB.FBAY", &handle);
> +	if (ACPI_FAILURE(status))
> +		goto out;
> +	status = acpi_get_handle(NULL, "\\_SB.CDDI", &handle);
> +	if (ACPI_FAILURE(status))
> +		goto out;
> +
> +out:
> +	return status;
> +}
> +
> +/* get optical driver power state */
> +
> +static int get_optd_power_state(void)
> +{
> +	acpi_status status;
> +	unsigned long long state;
> +	int result;
> +
> +	status = acpi_evaluate_integer(NULL, "\\_SB.STAT", NULL, &state);
> +	if (ACPI_FAILURE(status)) {
> +		pr_err("evaluation error _SB.STAT\n");
> +		result = -EIO;
> +		goto out;
> +	}
> +	switch (state) {
> +	case 0: /* power off */
> +		result = 0;
> +		break;
> +	case 0x0f: /* power on */
> +		result = 1;
> +		break;
> +	default:
> +		result = -EIO;
> +		break;
> +	}
> +
> +out:
> +	return result;
> +}
> +
> +/* set optical drive power state */
> +
> +static int set_optd_power_state(int new_state)
> +{
> +	int result;
> +	acpi_status status;
> +
> +	result = get_optd_power_state();
> +	if (result < 0)
> +		goto out;
> +	if (new_state == result)
> +		goto out;
> +
> +	switch (new_state) {
> +	case 0: /* power off */
> +		/* Call CDDR instead, since they both call the same method
> +		 * while CDDI takes 1 arg and we are not quite sure what it is.
> +		 */
> +		status = acpi_evaluate_object(NULL, "\\_SB.CDDR", NULL, NULL);
> +		if (ACPI_FAILURE(status)) {
> +			pr_err("evaluation error _SB.CDDR\n");
> +			result = -EIO;
> +		}
> +		break;
> +	case 1: /* power on */
> +		status = acpi_evaluate_object(NULL, "\\_SB.FBAY", NULL, NULL);
> +		if (ACPI_FAILURE(status)) {
> +			pr_err("evaluation error _SB.FBAY\n");
> +			result = -EIO;
> +		}
> +		break;
> +	default:
> +		result = -EINVAL;
> +		break;
> +	}
> +
> +out:
> +	return result;
> +}
> +
> +
>  /* sysfs user interface functions */
>  
>  static ssize_t show_numbatt(struct device *dev, struct device_attribute *attr,
> @@ -411,16 +512,36 @@ static ssize_t set_sticky(struct device *dev, struct device_attribute *attr,
>  	return count;
>  }
>  
> +static ssize_t cdpower_show(struct device *dev, struct device_attribute *attr,
> +			    char *buf)
> +{
> +	return snprintf(buf, PAGE_SIZE, "%d\n", get_optd_power_state());
> +}
> +
> +static ssize_t cdpower_store(struct device *dev, struct device_attribute *attr,
> +			   const char *buf, size_t count)
> +{
> +	int err, val;
> +
> +	err = kstrtoint(buf, 10, &val);
> +	if (err)
> +		return err;
> +	set_optd_power_state(val);
> +	return count;
> +}
> +
>  static DEVICE_ATTR(numbatt, S_IRUGO, show_numbatt, NULL);
>  static DEVICE_ATTR(lcdtype, S_IRUGO, show_lcdtype, NULL);
>  static DEVICE_ATTR(mute, S_IRUGO, show_mute, NULL);
>  static DEVICE_ATTR(sticky_key, S_IRUGO | S_IWUSR, show_sticky, set_sticky);
> +static DEVICE_ATTR_RW(cdpower);
>  
>  static struct attribute *pcc_sysfs_entries[] = {
>  	&dev_attr_numbatt.attr,
>  	&dev_attr_lcdtype.attr,
>  	&dev_attr_mute.attr,
>  	&dev_attr_sticky_key.attr,
> +	&dev_attr_cdpower.attr,
>  	NULL,
>  };
>  
> @@ -476,6 +597,50 @@ static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event)
>  	}
>  }
>  
> +static void pcc_optd_notify(acpi_handle handle, u32 event, void *data)
> +{
> +	if (event != ACPI_NOTIFY_EJECT_REQUEST)
> +		return;
> +
> +	set_optd_power_state(0);
> +}
> +
> +static int pcc_register_optd_notifier(struct pcc_acpi *pcc, char *node)
> +{
> +	acpi_status status;
> +	acpi_handle handle;
> +
> +	status = acpi_get_handle(NULL, node, &handle);
> +
> +	if (ACPI_SUCCESS(status)) {
> +		status = acpi_install_notify_handler(handle,
> +				ACPI_SYSTEM_NOTIFY,
> +				pcc_optd_notify, pcc);
> +		if (ACPI_FAILURE(status))
> +			pr_err("Failed to register notify on %s\n", node);
> +	} else
> +		return -ENODEV;
> +
> +	return 0;
> +}
> +
> +static void pcc_unregister_optd_notifier(struct pcc_acpi *pcc, char *node)
> +{
> +	acpi_status status = AE_OK;
> +	acpi_handle handle;
> +
> +	status = acpi_get_handle(NULL, node, &handle);
> +
> +	if (ACPI_SUCCESS(status)) {
> +		status = acpi_remove_notify_handler(handle,
> +				ACPI_SYSTEM_NOTIFY,
> +				pcc_optd_notify);
> +		if (ACPI_FAILURE(status))
> +			pr_err("Error removing optd notify handler %s\n",
> +					node);
> +	}
> +}
> +
>  static int acpi_pcc_init_input(struct pcc_acpi *pcc)
>  {
>  	struct input_dev *input_dev;
> @@ -606,8 +771,27 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
>  	if (result)
>  		goto out_backlight;
>  
> +	/* optical drive initialization */
> +	if (ACPI_SUCCESS(check_optd_present())) {
> +		pcc->platform = platform_device_register_simple("panasonic",
> +			-1, NULL, 0);
> +		if (IS_ERR(pcc->platform)) {
> +			result = PTR_ERR(pcc->platform);
> +			goto out_backlight;
> +		}
> +		result = device_create_file(&pcc->platform->dev,
> +			&dev_attr_cdpower);
> +		pcc_register_optd_notifier(pcc, "\\_SB.PCI0.EHCI.ERHB.OPTD");
> +		if (result)
> +			goto out_platform;
> +	} else {
> +		pcc->platform = NULL;
> +	}
> +
>  	return 0;
>  
> +out_platform:
> +	platform_device_unregister(pcc->platform);
>  out_backlight:
>  	backlight_device_unregister(pcc->backlight);
>  out_input:
> @@ -627,6 +811,12 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device)
>  	if (!device || !pcc)
>  		return -EINVAL;
>  
> +	if (pcc->platform) {
> +		device_remove_file(&pcc->platform->dev, &dev_attr_cdpower);
> +		platform_device_unregister(pcc->platform);
> +	}
> +	pcc_unregister_optd_notifier(pcc, "\\_SB.PCI0.EHCI.ERHB.OPTD");
> +
>  	sysfs_remove_group(&device->dev.kobj, &pcc_attr_group);
>  
>  	backlight_device_unregister(pcc->backlight);
> 


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 0/2] fix panasonic-laptop hotkey regression
  2020-08-21 18:14 ` [PATCH 7/9] resolve hotkey double trigger bug Kenneth Chan
@ 2022-06-12  9:05   ` stefan.seyfried
  2022-06-12  9:05     ` [PATCH 1/2] platform/x86: panasonic-laptop: de-obfuscate button codes stefan.seyfried
  2022-06-12  9:05     ` [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys stefan.seyfried
  0 siblings, 2 replies; 36+ messages in thread
From: stefan.seyfried @ 2022-06-12  9:05 UTC (permalink / raw)
  To: kenneth.t.chan; +Cc: platform-driver-x86, linux-kernel

Hi Kenneth,

commit ed83c9171829 broke the hotkeys on my Toughbook CF-51, this adds a
module option to make them work again.
The first patch in the series is a small cleanup to allow the actual fix
to be much more obvious.

 drivers/platform/x86/panasonic-laptop.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)



^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 1/2] platform/x86: panasonic-laptop: de-obfuscate button codes
  2022-06-12  9:05   ` [PATCH 0/2] fix panasonic-laptop hotkey regression stefan.seyfried
@ 2022-06-12  9:05     ` stefan.seyfried
  2022-06-12  9:05     ` [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys stefan.seyfried
  1 sibling, 0 replies; 36+ messages in thread
From: stefan.seyfried @ 2022-06-12  9:05 UTC (permalink / raw)
  To: kenneth.t.chan; +Cc: platform-driver-x86, linux-kernel, Stefan Seyfried

From: Stefan Seyfried <seife+kernel@b1-systems.com>

In the definition of panasonic_keymap[] the key codes are given in
decimal, later checks are done with hexadecimal values, which does
not help in understanding the code.
Additionally use two helper variables to shorten the code and make
the logic more obvious.

Signed-off-by: Stefan Seyfried <seife+kernel@b1-systems.com>
---
 drivers/platform/x86/panasonic-laptop.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 37850d07987d..ca6137f4000f 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -762,6 +762,8 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 	struct input_dev *hotk_input_dev = pcc->input_dev;
 	int rc;
 	unsigned long long result;
+	unsigned int key;
+	unsigned int updown;
 
 	rc = acpi_evaluate_integer(pcc->handle, METHOD_HKEY_QUERY,
 				   NULL, &result);
@@ -770,18 +772,22 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 		return;
 	}
 
+	key = result & 0xf;
+	updown = result & 0x80; /* 0x80 == key down; 0x00 = key up */
+
 	/* hack: some firmware sends no key down for sleep / hibernate */
-	if ((result & 0xf) == 0x7 || (result & 0xf) == 0xa) {
-		if (result & 0x80)
+	if (key == 7 || key == 10) {
+		if (updown)
 			sleep_keydown_seen = 1;
 		if (!sleep_keydown_seen)
 			sparse_keymap_report_event(hotk_input_dev,
-					result & 0xf, 0x80, false);
+					key, 0x80, false);
 	}
 
-	if ((result & 0xf) == 0x7 || (result & 0xf) == 0x9 || (result & 0xf) == 0xa) {
+	/* for the magic values, see panasonic_keymap[] above */
+	if (key == 7 || key == 9 || key == 10) {
 		if (!sparse_keymap_report_event(hotk_input_dev,
-						result & 0xf, result & 0x80, false))
+						key, updown, false))
 			pr_err("Unknown hotkey event: 0x%04llx\n", result);
 	}
 }
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-12  9:05   ` [PATCH 0/2] fix panasonic-laptop hotkey regression stefan.seyfried
  2022-06-12  9:05     ` [PATCH 1/2] platform/x86: panasonic-laptop: de-obfuscate button codes stefan.seyfried
@ 2022-06-12  9:05     ` stefan.seyfried
  2022-06-15 10:53       ` Kenneth Chan
  2022-06-15 11:21       ` Andy Shevchenko
  1 sibling, 2 replies; 36+ messages in thread
From: stefan.seyfried @ 2022-06-12  9:05 UTC (permalink / raw)
  To: kenneth.t.chan; +Cc: platform-driver-x86, linux-kernel, Stefan Seyfried

From: Stefan Seyfried <seife+kernel@b1-systems.com>

commit ed83c9171829 broke the hotkeys on my Toughbook CF-51.
I'm questioning the general validity of that commit, but as I only
have a single machine to test, add a module parameter to allow making
it work at runtime.

Fixes: ed83c9171829 platform/x86: panasonic-laptop: Resolve hotkey double trigger bug
Signed-off-by: Stefan Seyfried <seife+kernel@b1-systems.com>
---
 drivers/platform/x86/panasonic-laptop.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index ca6137f4000f..83acae75aee2 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -141,6 +141,9 @@ MODULE_AUTHOR("Martin Lucina <mato@kotelna.sk>");
 MODULE_AUTHOR("Kenneth Chan <kenneth.t.chan@gmail.com>");
 MODULE_DESCRIPTION("ACPI HotKey driver for Panasonic Let's Note laptops");
 MODULE_LICENSE("GPL");
+static bool hotkey_input;
+module_param(hotkey_input, bool, 0644);
+MODULE_PARM_DESC(hotkey_input, "Send all hotkeys to the input subsystem");
 
 #define LOGPREFIX "pcc_acpi: "
 
@@ -785,7 +788,7 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 	}
 
 	/* for the magic values, see panasonic_keymap[] above */
-	if (key == 7 || key == 9 || key == 10) {
+	if (hotkey_input || key == 7 || key == 9 || key == 10) {
 		if (!sparse_keymap_report_event(hotk_input_dev,
 						key, updown, false))
 			pr_err("Unknown hotkey event: 0x%04llx\n", result);
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-12  9:05     ` [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys stefan.seyfried
@ 2022-06-15 10:53       ` Kenneth Chan
  2022-06-15 11:21       ` Andy Shevchenko
  1 sibling, 0 replies; 36+ messages in thread
From: Kenneth Chan @ 2022-06-15 10:53 UTC (permalink / raw)
  To: stefan.seyfried; +Cc: platform-driver-x86, linux-kernel, Stefan Seyfried

I'm resending it due to reported spam. I forgot to turn off HTML
formatting. My bad.

Thanks for the patches.

> From: Stefan Seyfried <seife+kernel@b1-systems.com>
>
> commit ed83c9171829 broke the hotkeys on my Toughbook CF-51.
> I'm questioning the general validity of that commit, but as I only
> have a single machine to test, add a module parameter to allow making
> it work at runtime.

I can confirm that as soon as the hotkey_input option is enabled (at
least on my aged CF-W5) it reports the ACPI event twice. Unfortunately
it's the only machine I have for testing. Unless we have a bigger
sample base, making it a module_param is a safe choice.

Otherwise the patches look good to me.

Reviewed-by: Kenneth Chan <kenneth.t.chan@gmail.com>

--
Kenneth

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-12  9:05     ` [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys stefan.seyfried
  2022-06-15 10:53       ` Kenneth Chan
@ 2022-06-15 11:21       ` Andy Shevchenko
  2022-06-15 11:24         ` Andy Shevchenko
  1 sibling, 1 reply; 36+ messages in thread
From: Andy Shevchenko @ 2022-06-15 11:21 UTC (permalink / raw)
  To: stefan.seyfried
  Cc: Kenneth Chan, Platform Driver, Linux Kernel Mailing List,
	Stefan Seyfried

On Sun, Jun 12, 2022 at 3:54 PM <stefan.seyfried@googlemail.com> wrote:
>
> From: Stefan Seyfried <seife+kernel@b1-systems.com>
>
> commit ed83c9171829 broke the hotkeys on my Toughbook CF-51.

The commit

> I'm questioning the general validity of that commit, but as I only
> have a single machine to test, add a module parameter to allow making
> it work at runtime.

Thanks for the report and the fix, my comments below.

> +static bool hotkey_input;
> +module_param(hotkey_input, bool, 0644);
> +MODULE_PARM_DESC(hotkey_input, "Send all hotkeys to the input subsystem");

We usually add module options in very bad cases where it's very useful
for debugging or when some devices require the opposite settings while
can't be distinguished automatically. Here I do not see either of such
cases. Hence, I would prefer to see a DMI based quirk as it's done a
lot in the PDx86 drivers. Can you do that?

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-15 11:21       ` Andy Shevchenko
@ 2022-06-15 11:24         ` Andy Shevchenko
  2022-06-15 17:10           ` Stefan Seyfried
  0 siblings, 1 reply; 36+ messages in thread
From: Andy Shevchenko @ 2022-06-15 11:24 UTC (permalink / raw)
  To: stefan.seyfried
  Cc: Kenneth Chan, Platform Driver, Linux Kernel Mailing List,
	Stefan Seyfried

On Wed, Jun 15, 2022 at 1:21 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Sun, Jun 12, 2022 at 3:54 PM <stefan.seyfried@googlemail.com> wrote:

> We usually add module options in very bad cases where it's very useful
> for debugging or when some devices require the opposite settings while
> can't be distinguished automatically. Here I do not see either of such
> cases. Hence, I would prefer to see a DMI based quirk as it's done a
> lot in the PDx86 drivers. Can you do that?

Looking into the code of the culprit patch, have you tried to add a
debug pr_info() and see what value is in the result? Perhaps you may
just sort out by correcting that.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-15 11:24         ` Andy Shevchenko
@ 2022-06-15 17:10           ` Stefan Seyfried
  2022-06-15 19:28             ` Hans de Goede
  0 siblings, 1 reply; 36+ messages in thread
From: Stefan Seyfried @ 2022-06-15 17:10 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Kenneth Chan, Platform Driver, Linux Kernel Mailing List,
	Stefan Seyfried

Hi Andy,

On 15.06.22 13:24, Andy Shevchenko wrote:
> On Wed, Jun 15, 2022 at 1:21 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
>> On Sun, Jun 12, 2022 at 3:54 PM <stefan.seyfried@googlemail.com> wrote:
> 
>> We usually add module options in very bad cases where it's very useful
>> for debugging or when some devices require the opposite settings while
>> can't be distinguished automatically. Here I do not see either of such
>> cases. Hence, I would prefer to see a DMI based quirk as it's done a
>> lot in the PDx86 drivers. Can you do that?

I can do that, but... below ;-)

> Looking into the code of the culprit patch, have you tried to add a
> debug pr_info() and see what value is in the result? Perhaps you may
> just sort out by correcting that.

The driver is working fine, it's just that Kenneth's machine is getting 
most of the hotkey events (I'd guess all but sleep, hibernate, battery) 
twice. That's why he disabled the key generation from the panasonic_acpi 
driver for them. (My guess is that on his CF-W5, they are also coming in 
via normal keyboard input path). My CF-51 does only generate them via 
acpi, so if they are not generated, I get nothing.
Hence the module parameter so that the two known users of this module 
(Kenneth and me) can adjust this to their needs.

Now about the DMI match: I can do that.
But let's face it: the panasonic laptops are pretty rare in the wild, so 
even if I'm "whitelisting" the CF-51, then probably other models will 
need the same treatment and we have no real way of finding out which 
ones, unless people complain. (For example my CF-51 is about 17 years 
old now and I just pulled it out and updated it to the latest and 
greatest "because I can". That's also why it has taken me so long to 
even notice the driver was broken for me. So people not complaining will 
not mean "nothing is broken" but rather "this code has not many users").
So even if I add the DMI match (which is a good idea anyhow because then 
"my" model will work out of the box, while right now I need to add a 
module parameter or switch it on later), I'd still vote for having a 
possibility for overriding the DMI results.
Would that be OK?

Best regards,

	Stefan
-- 
Stefan Seyfried

"For a successful technology, reality must take precedence over
  public relations, for nature cannot be fooled." -- Richard Feynman

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-15 17:10           ` Stefan Seyfried
@ 2022-06-15 19:28             ` Hans de Goede
  2022-06-16 18:38               ` Kenneth Chan
                                 ` (2 more replies)
  0 siblings, 3 replies; 36+ messages in thread
From: Hans de Goede @ 2022-06-15 19:28 UTC (permalink / raw)
  To: Stefan Seyfried, Andy Shevchenko
  Cc: Kenneth Chan, Platform Driver, Linux Kernel Mailing List,
	Stefan Seyfried

Hi Stefan,

On 6/15/22 19:10, Stefan Seyfried wrote:
> Hi Andy,
> 
> On 15.06.22 13:24, Andy Shevchenko wrote:
>> On Wed, Jun 15, 2022 at 1:21 PM Andy Shevchenko
>> <andy.shevchenko@gmail.com> wrote:
>>> On Sun, Jun 12, 2022 at 3:54 PM <stefan.seyfried@googlemail.com> wrote:
>>
>>> We usually add module options in very bad cases where it's very useful
>>> for debugging or when some devices require the opposite settings while
>>> can't be distinguished automatically. Here I do not see either of such
>>> cases. Hence, I would prefer to see a DMI based quirk as it's done a
>>> lot in the PDx86 drivers. Can you do that?
> 
> I can do that, but... below ;-)
> 
>> Looking into the code of the culprit patch, have you tried to add a
>> debug pr_info() and see what value is in the result? Perhaps you may
>> just sort out by correcting that.
> 
> The driver is working fine, it's just that Kenneth's machine is getting most of the hotkey events (I'd guess all but sleep, hibernate, battery) twice. That's why he disabled the key generation from the panasonic_acpi driver for them. (My guess is that on his CF-W5, they are also coming in via normal keyboard input path). My CF-51 does only generate them via acpi, so if they are not generated, I get nothing.
> Hence the module parameter so that the two known users of this module (Kenneth and me) can adjust this to their needs.
> 
> Now about the DMI match: I can do that.
> But let's face it: the panasonic laptops are pretty rare in the wild, so even if I'm "whitelisting" the CF-51, then probably other models will need the same treatment and we have no real way of finding out which ones, unless people complain. (For example my CF-51 is about 17 years old now and I just pulled it out and updated it to the latest and greatest "because I can". That's also why it has taken me so long to even notice the driver was broken for me. So people not complaining will not mean "nothing is broken" but rather "this code has not many users").
> So even if I add the DMI match (which is a good idea anyhow because then "my" model will work out of the box, while right now I need to add a module parameter or switch it on later), I'd still vote for having a possibility for overriding the DMI results.
> Would that be OK?

Actually I agree with your original assessment that Kenneth's patch
(ed83c9171829) which broke things on your laptop is wrong.

Back then I did not properly realize that it is effectively
disabling event generation for most of the reported event codes.

If anything there should be a DMI match for Kenneth's model and
reporting the events normally should be the default.

Kenneth, can you check with e.g. evemu-record or evtest
where the double events are coming from ?  Obviously one of
the events is coming from the panasonic-laptop driver, but
where is the other event coming from. Is it coming from the
atkbd driver; or ... ?   Maybe from the acpi-video driver
for the brightness keys ?

Regards,

Hans



^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-15 19:28             ` Hans de Goede
@ 2022-06-16 18:38               ` Kenneth Chan
  2022-06-16 19:03               ` Andy Shevchenko
  2022-06-17  7:51               ` Kenneth Chan
  2 siblings, 0 replies; 36+ messages in thread
From: Kenneth Chan @ 2022-06-16 18:38 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Stefan Seyfried, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Stefan Seyfried

On Thu, 16 Jun 2022 at 03:28, Hans de Goede <hdegoede@redhat.com> wrote:
>
> Kenneth, can you check with e.g. evemu-record or evtest
> where the double events are coming from ?  Obviously one of
> the events is coming from the panasonic-laptop driver, but
> where is the other event coming from. Is it coming from the
> atkbd driver; or ... ?   Maybe from the acpi-video driver
> for the brightness keys ?
>

Certainly. I'm happy to dig deeper and see what it's up to.

-- 
Kenneth

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-15 19:28             ` Hans de Goede
  2022-06-16 18:38               ` Kenneth Chan
@ 2022-06-16 19:03               ` Andy Shevchenko
  2022-06-17  7:51               ` Kenneth Chan
  2 siblings, 0 replies; 36+ messages in thread
From: Andy Shevchenko @ 2022-06-16 19:03 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Stefan Seyfried, Kenneth Chan, Platform Driver,
	Linux Kernel Mailing List, Stefan Seyfried

On Wed, Jun 15, 2022 at 9:28 PM Hans de Goede <hdegoede@redhat.com> wrote:
> On 6/15/22 19:10, Stefan Seyfried wrote:

...

> If anything there should be a DMI match for Kenneth's model and
> reporting the events normally should be the default.

You beat me up to this comment. I was about to answer something similar.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-15 19:28             ` Hans de Goede
  2022-06-16 18:38               ` Kenneth Chan
  2022-06-16 19:03               ` Andy Shevchenko
@ 2022-06-17  7:51               ` Kenneth Chan
  2022-06-17 11:07                 ` Hans de Goede
  2 siblings, 1 reply; 36+ messages in thread
From: Kenneth Chan @ 2022-06-17  7:51 UTC (permalink / raw)
  To: Hans de Goede, Stefan Seyfried, Andy Shevchenko
  Cc: Platform Driver, Linux Kernel Mailing List, Stefan Seyfried

[-- Attachment #1: Type: text/plain, Size: 2079 bytes --]

On Thu, 16 Jun 2022 at 03:28, Hans de Goede <hdegoede@redhat.com> wrote:
>
> Kenneth, can you check with e.g. evemu-record or evtest
> where the double events are coming from ?  Obviously one of
> the events is coming from the panasonic-laptop driver, but
> where is the other event coming from. Is it coming from the
> atkbd driver; or ... ?   Maybe from the acpi-video driver
> for the brightness keys ?
>

Here's the evtest results:

acpi-video driver generates KEY_BRIGHTNESSDOWN, KEY_BRIGHTNESSUP
atkbd generates KEY_MUTE, KEY_VOLUMEUP, KEY_VOLUMEDOWN

Hotkey_input=Y (i.e. before patch ed83c9171829)
panasonic-laptop driver generates all keys, i.e. KEY_SLEEP,
KEY_BATTERY, KEY_SUSPEND plus all the above keys

hotkey_input=N
panasonic-laptop driver generates KEY_SLEEP, KEY_BATTERY and KEY_SUSPEND

So the duplicated brightness and volume key events come from the atkbd
and acpi-video drivers on my CF-W5. I haven't looked at the other
platform drivers. I'm wondering if they honour atkbd and acpi-driver
events in a case like this, or just report everything.

Attached is the dmidecode of my CF-W5, just to be verbose.

> Hence the module parameter so that the two known users of this module (Kenneth and me) can adjust this to their needs.
>
> Now about the DMI match: I can do that.
> But let's face it: the panasonic laptops are pretty rare in the wild, so even if I'm "whitelisting" the CF-51, then probably other models will need the same treatment and we have no real way of finding out which ones, unless people complain.
> So even if I add the DMI match (which is a good idea anyhow because then "my" model will work out of the box, while right now I need to add a module parameter or switch it on later), I'd still vote for having a possibility for overriding the DMI results.

In an ideal world, more panasonic-laptop users will send us their
DSDT. I think the most uptodate model has a MAT0035 device_id (it
increments for each generation) while our driver is at the very
outdated MAT0021. But before it happens, I agree with Stefan on that
point.

-- 
Kenneth

[-- Attachment #2: cfw5-4.dmidecode --]
[-- Type: application/octet-stream, Size: 10989 bytes --]

# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 2.4 present.
37 structures occupying 1311 bytes.
Table at 0x000E80E0.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
	Vendor: Phoenix Technologies Ltd.
	Version: V4.00L10
	Release Date: 04/06/2007
	Address: 0xE0900
	Runtime Size: 128768 bytes
	ROM Size: 1 MB
	Characteristics:
		PCI is supported
		PC Card (PCMCIA) is supported
		PNP is supported
		BIOS is upgradeable
		BIOS shadowing is allowed
		ESCD support is available
		Boot from CD is supported
		Selectable boot is supported
		EDD is supported
		3.5"/720 kB floppy services are supported (int 13h)
		Print screen service is supported (int 5h)
		8042 keyboard services are supported (int 9h)
		CGA/mono video services are supported (int 10h)
		ACPI is supported
		USB legacy is supported
		BIOS boot specification is supported
		Function key-initiated network boot is supported
		Targeted content distribution is supported
	BIOS Revision: 4.0
	Firmware Revision: 4.0

Handle 0x0001, DMI type 1, 27 bytes
System Information
	Manufacturer: Matsushita Electric Industrial Co.,Ltd.
	Product Name: CF-W5AWDBJR
	Version: 004
	Serial Number: 7HKSA88816
	UUID: dbb1f61e-0d03-53ba-8076-25631bb5fe39
	Wake-up Type: Power Switch
	SKU Number: CF-W5AWDBJR
	Family: CFW5-4

Handle 0x0002, DMI type 2, 8 bytes
Base Board Information
	Manufacturer: Matsushita Electric Industrial Co.,Ltd.
	Product Name: CFW5-4
	Version: 001
	Serial Number: None

Handle 0x0003, DMI type 3, 13 bytes
Chassis Information
	Manufacturer: Matsushita Electric Industrial Co.,Ltd.
	Type: Notebook
	Lock: Not Present
	Version: 001
	Serial Number: None
	Asset Tag: No Asset Tag
	Boot-up State: Unknown
	Power Supply State: Safe
	Thermal State: Safe
	Security Status: Unknown

Handle 0x0004, DMI type 4, 35 bytes
Processor Information
	Socket Designation: IC1
	Type: Central Processor
	Family: Core 2
	Manufacturer: GenuineIntel
	ID: F2 06 00 00 FF FB EB BF
	Signature: Type 0, Family 6, Model 15, Stepping 2
	Flags:
		FPU (Floating-point unit on-chip)
		VME (Virtual mode extension)
		DE (Debugging extension)
		PSE (Page size extension)
		TSC (Time stamp counter)
		MSR (Model specific registers)
		PAE (Physical address extension)
		MCE (Machine check exception)
		CX8 (CMPXCHG8 instruction supported)
		APIC (On-chip APIC hardware supported)
		SEP (Fast system call)
		MTRR (Memory type range registers)
		PGE (Page global enable)
		MCA (Machine check architecture)
		CMOV (Conditional move instruction supported)
		PAT (Page attribute table)
		PSE-36 (36-bit page size extension)
		CLFSH (CLFLUSH instruction supported)
		DS (Debug store)
		ACPI (ACPI supported)
		MMX (MMX technology supported)
		FXSR (FXSAVE and FXSTOR instructions supported)
		SSE (Streaming SIMD extensions)
		SSE2 (Streaming SIMD extensions 2)
		SS (Self-snoop)
		HTT (Multi-threading)
		TM (Thermal monitor supported)
		PBE (Pending break enabled)
	Version: Intel(R) Core(TM)2 CPU         U7500  @ 1.06GHz
	Voltage: 0.9 V
	External Clock: 133 MHz
	Max Speed: 1060 MHz
	Current Speed: 1060 MHz
	Status: Populated, Enabled
	Upgrade: None
	L1 Cache Handle: 0x0005
	L2 Cache Handle: 0x0006
	L3 Cache Handle: Not Provided
	Serial Number: Not Specified
	Asset Tag: Not Specified
	Part Number: Not Specified

Handle 0x0005, DMI type 7, 19 bytes
Cache Information
	Socket Designation: L1 Cache
	Configuration: Enabled, Not Socketed, Level 1
	Operational Mode: Write Back
	Location: Internal
	Installed Size: 64 kB
	Maximum Size: 64 kB
	Supported SRAM Types:
		Other
	Installed SRAM Type: Other
	Speed: Unknown
	Error Correction Type: Single-bit ECC
	System Type: Data
	Associativity: 8-way Set-associative

Handle 0x0006, DMI type 7, 19 bytes
Cache Information
	Socket Designation: L2 Cache
	Configuration: Enabled, Not Socketed, Level 2
	Operational Mode: Write Back
	Location: Internal
	Installed Size: 2 MB
	Maximum Size: 2 MB
	Supported SRAM Types:
		Other
	Installed SRAM Type: Other
	Speed: Unknown
	Error Correction Type: Single-bit ECC
	System Type: Unified
	Associativity: 8-way Set-associative

Handle 0x0007, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CN902
	Internal Connector Type: None
	External Reference Designator: USB 0
	External Connector Type: Access Bus (USB)
	Port Type: USB

Handle 0x0008, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CN903
	Internal Connector Type: None
	External Reference Designator: USB 1
	External Connector Type: Access Bus (USB)
	Port Type: USB

Handle 0x0009, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CN14
	Internal Connector Type: None
	External Reference Designator: PC Card
	External Connector Type: 68 Pin Dual Inline
	Port Type: Cardbus

Handle 0x000A, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: JK2
	Internal Connector Type: None
	External Reference Designator: MIC
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port

Handle 0x000B, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: JK1
	Internal Connector Type: None
	External Reference Designator: Headphone
	External Connector Type: Mini Jack (headphones)
	Port Type: Audio Port

Handle 0x000C, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CN12
	Internal Connector Type: None
	External Reference Designator: EXT.DISPLAY
	External Connector Type: DB-15 female
	Port Type: Video Port

Handle 0x000D, DMI type 126, 9 bytes
Inactive

Handle 0x000E, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CN16
	Internal Connector Type: None
	External Reference Designator: LAN
	External Connector Type: RJ-45
	Port Type: Network Port

Handle 0x000F, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CN18
	Internal Connector Type: None
	External Reference Designator: Modem
	External Connector Type: RJ-11
	Port Type: Modem Port

Handle 0x0010, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CN13
	Internal Connector Type: None
	External Reference Designator: SD Card
	External Connector Type: Proprietary
	Port Type: Other

Handle 0x0011, DMI type 8, 9 bytes
Port Connector Information
	Internal Reference Designator: CN19
	Internal Connector Type: None
	External Reference Designator: Wireless LAN
	External Connector Type: None
	Port Type: Network Port

Handle 0x0012, DMI type 9, 13 bytes
System Slot Information
	Designation: PC Card
	Type: 32-bit PC Card (PCMCIA)
	Current Usage: Unknown
	Length: Other
	ID: Adapter 0, Socket 0
	Characteristics:
		5.0 V is provided
		3.3 V is provided
		PC Card-16 is supported
		Cardbus is supported
		PME signal is supported
		Hot-plug devices are supported

Handle 0x0013, DMI type 10, 10 bytes
On Board Device 1 Information
	Type: Video
	Status: Enabled
	Description: Intel 945GMS
On Board Device 2 Information
	Type: Sound
	Status: Enabled
	Description: Sigmatel 9200
On Board Device 3 Information
	Type: Ethernet
	Status: Enabled
	Description: Realtek 8101L Fast Ethernet

Handle 0x0014, DMI type 13, 22 bytes
BIOS Language Information
	Language Description Format: Long
	Installable Languages: 2
		en|US|iso8859-1
		ja|JP|unicode-1
	Currently Installed Language: en|US|iso8859-1

Handle 0x0015, DMI type 16, 15 bytes
Physical Memory Array
	Location: System Board Or Motherboard
	Use: System Memory
	Error Correction Type: None
	Maximum Capacity: 2 GB
	Error Information Handle: Not Provided
	Number Of Devices: 2

Handle 0x0016, DMI type 16, 15 bytes
Physical Memory Array
	Location: System Board Or Motherboard
	Use: Flash Memory
	Error Correction Type: None
	Maximum Capacity: 1 MB
	Error Information Handle: Not Provided
	Number Of Devices: 1

Handle 0x0017, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x0015
	Error Information Handle: No Error
	Total Width: 64 bits
	Data Width: 64 bits
	Size: 512 MB
	Form Factor: TSOP
	Set: None
	Locator: Onboard
	Bank Locator: Onboard
	Type: DDR2
	Type Detail: Synchronous
	Speed: Unknown
	Manufacturer: Not Specified
	Serial Number: 00000000
	Asset Tag: Not Specified
	Part Number: 000000000000000000

Handle 0x0018, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x0015
	Error Information Handle: No Error
	Total Width: 64 bits
	Data Width: 64 bits
	Size: 1 GB
	Form Factor: DIMM
	Set: None
	Locator: DIMM
	Bank Locator: DIMM
	Type: DDR2
	Type Detail: Synchronous
	Speed: Unknown
	Manufacturer: Not Specified
	Serial Number: 00000000
	Asset Tag: Not Specified
	Part Number: 000000000000000000

Handle 0x0019, DMI type 17, 27 bytes
Memory Device
	Array Handle: 0x0016
	Error Information Handle: No Error
	Total Width: 8 bits
	Data Width: 8 bits
	Size: 1 MB
	Form Factor: TSOP
	Set: None
	Locator: Flash ROM
	Bank Locator: Flash ROM
	Type: Flash
	Type Detail: Non-Volatile
	Speed: Unknown
	Manufacturer: Not Specified
	Serial Number: Not Specified
	Asset Tag: Not Specified
	Part Number: Not Specified

Handle 0x001A, DMI type 19, 15 bytes
Memory Array Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x0005FFFFFFF
	Range Size: 1536 MB
	Physical Array Handle: 0x0015
	Partition Width: 2

Handle 0x001B, DMI type 19, 15 bytes
Memory Array Mapped Address
	Starting Address: 0x000FFF00000
	Ending Address: 0x000FFFFFFFF
	Range Size: 1 MB
	Physical Array Handle: 0x0016
	Partition Width: 1

Handle 0x001C, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00000000000
	Ending Address: 0x0001FFFFFFF
	Range Size: 512 MB
	Physical Device Handle: 0x0017
	Memory Array Mapped Address Handle: 0x001A
	Partition Row Position: 1

Handle 0x001D, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x00020000000
	Ending Address: 0x0005FFFFFFF
	Range Size: 1 GB
	Physical Device Handle: 0x0018
	Memory Array Mapped Address Handle: 0x001A
	Partition Row Position: 1

Handle 0x001E, DMI type 20, 19 bytes
Memory Device Mapped Address
	Starting Address: 0x000FFF00000
	Ending Address: 0x000FFFFFFFF
	Range Size: 1 MB
	Physical Device Handle: 0x0019
	Memory Array Mapped Address Handle: 0x001B
	Partition Row Position: 1

Handle 0x001F, DMI type 21, 7 bytes
Built-in Pointing Device
	Type: Touch Pad
	Interface: PS/2
	Buttons: 2

Handle 0x0020, DMI type 126, 7 bytes
Inactive

Handle 0x0021, DMI type 22, 26 bytes
Portable Battery
	Location: in the back
	Manufacturer: Panasonic
	Name: CF-VZSU47     
	Chemistry: Lithium Ion
	Design Capacity: 60700 mWh
	Design Voltage: 10650 mV
	SBDS Version: Not Specified
	Maximum Error: 0%
	SBDS Serial Number: 02BB
	SBDS Manufacture Date: 2007-07-10
	OEM-specific Information: 0x00000000

Handle 0x0022, DMI type 24, 5 bytes
Hardware Security
	Power-On Password Status: Disabled
	Keyboard Password Status: Not Implemented
	Administrator Password Status: Enabled
	Front Panel Reset Status: Not Implemented

Handle 0x0023, DMI type 32, 11 bytes
System Boot Information
	Status: No errors detected

Handle 0x0024, DMI type 127, 4 bytes
End Of Table


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-17  7:51               ` Kenneth Chan
@ 2022-06-17 11:07                 ` Hans de Goede
  2022-06-17 13:07                   ` Stefan Seyfried
  2022-06-20 15:21                   ` Kenneth Chan
  0 siblings, 2 replies; 36+ messages in thread
From: Hans de Goede @ 2022-06-17 11:07 UTC (permalink / raw)
  To: Kenneth Chan, Stefan Seyfried, Andy Shevchenko
  Cc: Platform Driver, Linux Kernel Mailing List, Stefan Seyfried

[-- Attachment #1: Type: text/plain, Size: 3495 bytes --]

Hi,

On 6/17/22 09:51, Kenneth Chan wrote:
> On Thu, 16 Jun 2022 at 03:28, Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Kenneth, can you check with e.g. evemu-record or evtest
>> where the double events are coming from ?  Obviously one of
>> the events is coming from the panasonic-laptop driver, but
>> where is the other event coming from. Is it coming from the
>> atkbd driver; or ... ?   Maybe from the acpi-video driver
>> for the brightness keys ?
>>
> 
> Here's the evtest results:
> 
> acpi-video driver generates KEY_BRIGHTNESSDOWN, KEY_BRIGHTNESSUP
> atkbd generates KEY_MUTE, KEY_VOLUMEUP, KEY_VOLUMEDOWN
> 
> Hotkey_input=Y (i.e. before patch ed83c9171829)
> panasonic-laptop driver generates all keys, i.e. KEY_SLEEP,
> KEY_BATTERY, KEY_SUSPEND plus all the above keys
> 
> hotkey_input=N
> panasonic-laptop driver generates KEY_SLEEP, KEY_BATTERY and KEY_SUSPEND
> 
> So the duplicated brightness and volume key events come from the atkbd
> and acpi-video drivers on my CF-W5. I haven't looked at the other
> platform drivers. I'm wondering if they honour atkbd and acpi-driver
> events in a case like this, or just report everything.

Thank you for providing this info. Can you please give
the attached patch series a try, this includes Stefan's 1/2 patch
and replaces Stefan's 2/2 patch.

This will hopefully fix the double key-presses for you, while
also keeping everything working for Stefan without requiring
a module option or DMI quirks.

Stefan can you also give this series a try please?

###

Looking at this has also brought up an unrelated backlight question:

Kenneth, since you have acpi-video reporting keypresses you will
likely also have an acpi_video (or perhaps a native intel) backlight
under /sys/class/backlight and I noticed that panasonic-laptop
uncondirionally registers its backlight so you may very well end
up with 2 backlight controls under /sys/class/backlight, which
we generally try to avoid (so that userspace does not have to
guess which one to use).

Can you do:
ls /sys/class/backlight

and let me know the output?

Also if there are 2 backlights there then please do:
cat /sys/class/backlight/<name>/max_brightness
to find out the range (0-value)

and then try if they both work by doing:

echo $number > /sys/class/backlight/<name>/brightness

with different $number values in the range and see
if this actually changes the brightness.

While we are at it, Stefan can you do the same please?

Regards,

Hans






> 
> Attached is the dmidecode of my CF-W5, just to be verbose.
> 
>> Hence the module parameter so that the two known users of this module (Kenneth and me) can adjust this to their needs.
>>
>> Now about the DMI match: I can do that.
>> But let's face it: the panasonic laptops are pretty rare in the wild, so even if I'm "whitelisting" the CF-51, then probably other models will need the same treatment and we have no real way of finding out which ones, unless people complain.
>> So even if I add the DMI match (which is a good idea anyhow because then "my" model will work out of the box, while right now I need to add a module parameter or switch it on later), I'd still vote for having a possibility for overriding the DMI results.
> 
> In an ideal world, more panasonic-laptop users will send us their
> DSDT. I think the most uptodate model has a MAT0035 device_id (it
> increments for each generation) while our driver is at the very
> outdated MAT0021. But before it happens, I agree with Stefan on that
> point.
> 

[-- Attachment #2: 0001-platform-x86-panasonic-laptop-de-obfuscate-button-co.patch --]
[-- Type: text/x-patch, Size: 2327 bytes --]

From 64fc644ca7c7e8830b0a86f9cfa39069c59eeeca Mon Sep 17 00:00:00 2001
From: Stefan Seyfried <seife+kernel@b1-systems.com>
Date: Sun, 12 Jun 2022 11:05:06 +0200
Subject: [PATCH 1/5] platform/x86: panasonic-laptop: de-obfuscate button codes

In the definition of panasonic_keymap[] the key codes are given in
decimal, later checks are done with hexadecimal values, which does
not help in understanding the code.
Additionally use two helper variables to shorten the code and make
the logic more obvious.

Signed-off-by: Stefan Seyfried <seife+kernel@b1-systems.com>
Link: https://lore.kernel.org/r/20220612090507.20648-2-stefan.seyfried@googlemail.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/panasonic-laptop.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 37850d07987d..ca6137f4000f 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -762,6 +762,8 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 	struct input_dev *hotk_input_dev = pcc->input_dev;
 	int rc;
 	unsigned long long result;
+	unsigned int key;
+	unsigned int updown;
 
 	rc = acpi_evaluate_integer(pcc->handle, METHOD_HKEY_QUERY,
 				   NULL, &result);
@@ -770,18 +772,22 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 		return;
 	}
 
+	key = result & 0xf;
+	updown = result & 0x80; /* 0x80 == key down; 0x00 = key up */
+
 	/* hack: some firmware sends no key down for sleep / hibernate */
-	if ((result & 0xf) == 0x7 || (result & 0xf) == 0xa) {
-		if (result & 0x80)
+	if (key == 7 || key == 10) {
+		if (updown)
 			sleep_keydown_seen = 1;
 		if (!sleep_keydown_seen)
 			sparse_keymap_report_event(hotk_input_dev,
-					result & 0xf, 0x80, false);
+					key, 0x80, false);
 	}
 
-	if ((result & 0xf) == 0x7 || (result & 0xf) == 0x9 || (result & 0xf) == 0xa) {
+	/* for the magic values, see panasonic_keymap[] above */
+	if (key == 7 || key == 9 || key == 10) {
 		if (!sparse_keymap_report_event(hotk_input_dev,
-						result & 0xf, result & 0x80, false))
+						key, updown, false))
 			pr_err("Unknown hotkey event: 0x%04llx\n", result);
 	}
 }
-- 
2.36.0


[-- Attachment #3: 0002-platform-x86-panasonic-laptop-Sort-includes-alphabet.patch --]
[-- Type: text/x-patch, Size: 1526 bytes --]

From 029166f13632f4774eafb09596fc87d2a29a7429 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Fri, 17 Jun 2022 12:39:51 +0200
Subject: [PATCH 2/5] platform/x86: panasonic-laptop: Sort includes
 alphabetically

Sort includes alphabetically, small cleanup patch in preparation of
further changes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/panasonic-laptop.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index ca6137f4000f..26e31ac09dc6 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -119,20 +119,19 @@
  *		- v0.1  start from toshiba_acpi driver written by John Belmonte
  */
 
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/types.h>
+#include <linux/acpi.h>
 #include <linux/backlight.h>
 #include <linux/ctype.h>
-#include <linux/seq_file.h>
-#include <linux/uaccess.h>
-#include <linux/slab.h>
-#include <linux/acpi.h>
+#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
-
+#include <linux/seq_file.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <linux/uaccess.h>
 
 MODULE_AUTHOR("Hiroshi Miura <miura@da-cha.org>");
 MODULE_AUTHOR("David Bronaugh <dbronaugh@linuxboxen.org>");
-- 
2.36.0


[-- Attachment #4: 0003-platform-x86-panasonic-laptop-revert-Resolve-hotkey-.patch --]
[-- Type: text/x-patch, Size: 1542 bytes --]

From dc7e2e718871715e3359af9e3b6e794b83c4b383 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Fri, 17 Jun 2022 11:36:43 +0200
Subject: [PATCH 3/5] platform/x86: panasonic-laptop: revert "Resolve hotkey
 double trigger bug"

In hindsight blindly throwing away most of the key-press events is not
a good idea. So revert commit ed83c9171829 ("platform/x86:
panasonic-laptop: Resolve hotkey double trigger bug").

Fixes: ed83c9171829 ("platform/x86: panasonic-laptop: Resolve hotkey double trigger bug")
Reported-by: Stefan Seyfried <seife+kernel@b1-systems.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/panasonic-laptop.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 26e31ac09dc6..2e6531dd15f9 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -783,12 +783,8 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 					key, 0x80, false);
 	}
 
-	/* for the magic values, see panasonic_keymap[] above */
-	if (key == 7 || key == 9 || key == 10) {
-		if (!sparse_keymap_report_event(hotk_input_dev,
-						key, updown, false))
-			pr_err("Unknown hotkey event: 0x%04llx\n", result);
-	}
+	if (!sparse_keymap_report_event(hotk_input_dev, key, updown, false))
+		pr_err("Unknown hotkey event: 0x%04llx\n", result);
 }
 
 static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event)
-- 
2.36.0


[-- Attachment #5: 0004-platform-x86-panasonic-laptop-Don-t-report-duplicate.patch --]
[-- Type: text/x-patch, Size: 2160 bytes --]

From eba597920c5b64a616358526bbcf2d389f8cef9c Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Fri, 17 Jun 2022 11:49:58 +0200
Subject: [PATCH 4/5] platform/x86: panasonic-laptop: Don't report duplicate
 brightness key-presses

The brightness key-presses might also get reported by the ACPI video bus,
check for this and in this case don't report the presses to avoid reporting
2 presses for a single key-press.

Fixes: ed83c9171829 ("platform/x86: panasonic-laptop: Resolve hotkey double trigger bug")
Reported-by: Kenneth Chan <kenneth.t.chan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/Kconfig            | 1 +
 drivers/platform/x86/panasonic-laptop.c | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 0ac77d0553da..a6de14c3aca1 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -942,6 +942,7 @@ config PANASONIC_LAPTOP
 	tristate "Panasonic Laptop Extras"
 	depends on INPUT && ACPI
 	depends on BACKLIGHT_CLASS_DEVICE
+	depends on ACPI_VIDEO=n || ACPI_VIDEO
 	select INPUT_SPARSEKMAP
 	help
 	  This driver adds support for access to backlight control and hotkeys
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 2e6531dd15f9..d65e6c2372ca 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -132,6 +132,7 @@
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <linux/uaccess.h>
+#include <acpi/video.h>
 
 MODULE_AUTHOR("Hiroshi Miura <miura@da-cha.org>");
 MODULE_AUTHOR("David Bronaugh <dbronaugh@linuxboxen.org>");
@@ -783,6 +784,13 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 					key, 0x80, false);
 	}
 
+	/*
+	 * Don't report brightness key-presses if they are also reported
+	 * by the ACPI video bus.
+	 */
+	if ((key == 1 || key == 2) && acpi_video_handles_brightness_key_presses())
+		return;
+
 	if (!sparse_keymap_report_event(hotk_input_dev, key, updown, false))
 		pr_err("Unknown hotkey event: 0x%04llx\n", result);
 }
-- 
2.36.0


[-- Attachment #6: 0005-platform-x86-panasonic-laptop-filter-out-duplicate-v.patch --]
[-- Type: text/x-patch, Size: 3864 bytes --]

From d057b76da8193c8410284100f9efc32e0006ad09 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Fri, 17 Jun 2022 12:35:24 +0200
Subject: [PATCH 5/5] platform/x86: panasonic-laptop: filter out duplicate
 volume up/down/mute keypresses

On some Panasonic models the volume up/down/mute keypresses get
reported both through the Panasonic ACPI HKEY interface as well as
through the atkbd device.

Filter out the atkbd scan-codes for these to avoid reporting presses
twice.

Note normally we would leave the filtering of these to userspace by mapping
the scan-codes to KEY_UNKNOWN through /lib/udev/hwdb.d/60-keyboard.hwdb.
However in this case that would cause regressions since we were filtering
the Panasonic ACPI HKEY events before, so filter these in the kernel.

Fixes: ed83c9171829 ("platform/x86: panasonic-laptop: Resolve hotkey double trigger bug")
Reported-by: Kenneth Chan <kenneth.t.chan@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/Kconfig            |  1 +
 drivers/platform/x86/panasonic-laptop.c | 41 +++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index a6de14c3aca1..0f723c34a637 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -943,6 +943,7 @@ config PANASONIC_LAPTOP
 	depends on INPUT && ACPI
 	depends on BACKLIGHT_CLASS_DEVICE
 	depends on ACPI_VIDEO=n || ACPI_VIDEO
+	depends on SERIO_I8042 || SERIO_I8042 = n
 	select INPUT_SPARSEKMAP
 	help
 	  This driver adds support for access to backlight control and hotkeys
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index d65e6c2372ca..a4c82b3a81cf 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -122,6 +122,7 @@
 #include <linux/acpi.h>
 #include <linux/backlight.h>
 #include <linux/ctype.h>
+#include <linux/i8042.h>
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
@@ -129,6 +130,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/seq_file.h>
+#include <linux/serio.h>
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <linux/uaccess.h>
@@ -241,6 +243,42 @@ struct pcc_acpi {
 	struct platform_device	*platform;
 };
 
+/*
+ * On some Panasonic models the volume up / down / mute keys send duplicate
+ * keypress events over the PS/2 kbd interface, filter these out.
+ */
+static bool panasonic_i8042_filter(unsigned char data, unsigned char str,
+				   struct serio *port)
+{
+	static bool extended;
+
+	if (str & I8042_STR_AUXDATA)
+		return false;
+
+	if (data == 0xe0) {
+		extended = true;
+		return true;
+	} else if (extended) {
+		extended = false;
+
+		switch (data & 0x7f) {
+		case 0x21: /* e0 21 / e0 a1, Volume Down press / release */
+		case 0x23: /* e0 23 / e0 a3, Volume Mute press / release */
+		case 0x32: /* e0 32 / e0 b2, Volume Up press / release */
+			return true;
+		default:
+			/*
+			 * Report the previously filtered e0 before continuing
+			 * with the next non-filtered byte.
+			 */
+			serio_interrupt(port, 0xe0, 0);
+			return false;
+		}
+	}
+
+	return false;
+}
+
 /* method access functions */
 static int acpi_pcc_write_sset(struct pcc_acpi *pcc, int func, int val)
 {
@@ -1006,6 +1044,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 		pcc->platform = NULL;
 	}
 
+	i8042_install_filter(panasonic_i8042_filter);
 	return 0;
 
 out_platform:
@@ -1029,6 +1068,8 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device)
 	if (!device || !pcc)
 		return -EINVAL;
 
+	i8042_remove_filter(panasonic_i8042_filter);
+
 	if (pcc->platform) {
 		device_remove_file(&pcc->platform->dev, &dev_attr_cdpower);
 		platform_device_unregister(pcc->platform);
-- 
2.36.0


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-17 11:07                 ` Hans de Goede
@ 2022-06-17 13:07                   ` Stefan Seyfried
  2022-06-20 15:08                     ` Hans de Goede
  2022-06-20 15:21                   ` Kenneth Chan
  1 sibling, 1 reply; 36+ messages in thread
From: Stefan Seyfried @ 2022-06-17 13:07 UTC (permalink / raw)
  To: Hans de Goede, Kenneth Chan, Andy Shevchenko
  Cc: Platform Driver, Linux Kernel Mailing List, Stefan Seyfried

Hi Hans,

On 17.06.22 13:07, Hans de Goede wrote:

> Thank you for providing this info. Can you please give
> the attached patch series a try, this includes Stefan's 1/2 patch
> and replaces Stefan's 2/2 patch.
> 
> This will hopefully fix the double key-presses for you, while
> also keeping everything working for Stefan without requiring
> a module option or DMI quirks.
> 
> Stefan can you also give this series a try please?

Works for me, almost out of the box.
I need to enable "report_key_events=1" in the video module, then the 
panasonic-acpi module starts reporting brightness up/down keys.

Volume and mute keys work without manual changes.

(I tested against 5.18.2 because that's what was already prepared. That 
old machine takes quite some time, even to just compile the platform/x86 
subdirectory ;-) but I don't think this is relevant. If you think it is, 
I can also test against latest 5.19-rc code)

> Looking at this has also brought up an unrelated backlight question:
> 
> Kenneth, since you have acpi-video reporting keypresses you will
> likely also have an acpi_video (or perhaps a native intel) backlight
> under /sys/class/backlight and I noticed that panasonic-laptop
> uncondirionally registers its backlight so you may very well end
> up with 2 backlight controls under /sys/class/backlight, which
> we generally try to avoid (so that userspace does not have to
> guess which one to use).
> 
> Can you do:
> ls /sys/class/backlight

toughbook:~ # ls -l /sys/class/backlight/
total 0
lrwxrwxrwx 1 root root 0 Jun 17 14:45 intel_backlight -> 
../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight
lrwxrwxrwx 1 root root 0 Jun 17 14:49 panasonic -> 
../../devices/virtual/backlight/panasonic

> and let me know the output?
> 
> Also if there are 2 backlights there then please do:
> cat /sys/class/backlight/<name>/max_brightness
> to find out the range (0-value)

toughbook:/sys/class/backlight # grep . */max_brightness
intel_backlight/max_brightness:19531
panasonic/max_brightness:255

> and then try if they both work by doing:
> 
> echo $number > /sys/class/backlight/<name>/brightness
> 
> with different $number values in the range and see
> if this actually changes the brightness.

intel_backlight: does not work
panasonic: does work

> While we are at it, Stefan can you do the same please?

See above.
But hey, this is an i855GM graphics chip, I'm happy if it is still 
working *at all* (for example I need to avoid the xf86-intel driver and 
use the modesetting driver instead to get a usable sytstem)

And I'm totally happy if all I have to do in the future is a

option video report_key_events=1

modprobe.conf file ;-)

Best regards,

	Stefan
-- 
Stefan Seyfried

"For a successful technology, reality must take precedence over
  public relations, for nature cannot be fooled." -- Richard Feynman

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-17 13:07                   ` Stefan Seyfried
@ 2022-06-20 15:08                     ` Hans de Goede
  2022-06-20 18:10                       ` Stefan Seyfried
  0 siblings, 1 reply; 36+ messages in thread
From: Hans de Goede @ 2022-06-20 15:08 UTC (permalink / raw)
  To: Stefan Seyfried, Kenneth Chan, Andy Shevchenko
  Cc: Platform Driver, Linux Kernel Mailing List, Stefan Seyfried

Hi,

Thank you for the quick testing.

On 6/17/22 15:07, Stefan Seyfried wrote:
> Hi Hans,
> 
> On 17.06.22 13:07, Hans de Goede wrote:
> 
>> Thank you for providing this info. Can you please give
>> the attached patch series a try, this includes Stefan's 1/2 patch
>> and replaces Stefan's 2/2 patch.
>>
>> This will hopefully fix the double key-presses for you, while
>> also keeping everything working for Stefan without requiring
>> a module option or DMI quirks.
>>
>> Stefan can you also give this series a try please?
> 
> Works for me, almost out of the box.
> I need to enable "report_key_events=1" in the video module, then the panasonic-acpi module starts reporting brightness up/down keys.

Ok, so you need another module option that is not really helpful.

The idea behind the acpi_video_handles_brightness_key_presses() check
is that if the ACPI video bus device is present it is expected to
already report brightness up/down keypresses and we want to avoid
duplicates.

Can you check with evtest or evemu-record that the brightness
events are not already being delivered by the "Video Bus"
input device ?

> Volume and mute keys work without manual changes.

Good.
 
> (I tested against 5.18.2 because that's what was already prepared. That old machine takes quite some time, even to just compile the platform/x86 subdirectory ;-) but I don't think this is relevant. If you think it is, I can also test against latest 5.19-rc code)

Testing against 5.18 is fine .

>> Looking at this has also brought up an unrelated backlight question:
>>
>> Kenneth, since you have acpi-video reporting keypresses you will
>> likely also have an acpi_video (or perhaps a native intel) backlight
>> under /sys/class/backlight and I noticed that panasonic-laptop
>> uncondirionally registers its backlight so you may very well end
>> up with 2 backlight controls under /sys/class/backlight, which
>> we generally try to avoid (so that userspace does not have to
>> guess which one to use).
>>
>> Can you do:
>> ls /sys/class/backlight
> 
> toughbook:~ # ls -l /sys/class/backlight/
> total 0
> lrwxrwxrwx 1 root root 0 Jun 17 14:45 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight
> lrwxrwxrwx 1 root root 0 Jun 17 14:49 panasonic -> ../../devices/virtual/backlight/panasonic
> 
>> and let me know the output?
>>
>> Also if there are 2 backlights there then please do:
>> cat /sys/class/backlight/<name>/max_brightness
>> to find out the range (0-value)
> 
> toughbook:/sys/class/backlight # grep . */max_brightness
> intel_backlight/max_brightness:19531
> panasonic/max_brightness:255
> 
>> and then try if they both work by doing:
>>
>> echo $number > /sys/class/backlight/<name>/brightness
>>
>> with different $number values in the range and see
>> if this actually changes the brightness.
> 
> intel_backlight: does not work
> panasonic: does work

Ok, so that suggests that the ACPI video bus on your
device is defunct, so I guess it also does not report
key-presses (see above) ?

This will also need some work then because we want to move
to there only being 1 (actually working) backlight-class
device. Rather then having multiple and let userspace
guess which one it needs to use.

>> While we are at it, Stefan can you do the same please?
> 
> See above.
> But hey, this is an i855GM graphics chip, I'm happy if it is still working *at all* (for example I need to avoid the xf86-intel driver and use the modesetting driver instead to get a usable sytstem)
> 
> And I'm totally happy if all I have to do in the future is a
> 
> option video report_key_events=1
> 
> modprobe.conf file ;-)

We really don't want people to have to specify module-options just
to have things working.

Stefam, at least for the backlight class-device issue we will need a DMI
quirk, so can you run:

sudo dmidecode > dmidecode.txt

and then attach the output to your next email, or send me a copy
privately ?

Regards,

Hans



^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-17 11:07                 ` Hans de Goede
  2022-06-17 13:07                   ` Stefan Seyfried
@ 2022-06-20 15:21                   ` Kenneth Chan
  2022-06-21  9:34                     ` Hans de Goede
  1 sibling, 1 reply; 36+ messages in thread
From: Kenneth Chan @ 2022-06-20 15:21 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Stefan Seyfried, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Stefan Seyfried

It took quite a while to do a full compile, just to be safe.

On Fri, 17 Jun 2022 at 19:07, Hans de Goede <hdegoede@redhat.com> wrote:
>
>
> Looking at this has also brought up an unrelated backlight question:
>
> Kenneth, since you have acpi-video reporting keypresses you will
> likely also have an acpi_video (or perhaps a native intel) backlight
> under /sys/class/backlight and I noticed that panasonic-laptop
> uncondirionally registers its backlight so you may very well end
> up with 2 backlight controls under /sys/class/backlight, which
> we generally try to avoid (so that userspace does not have to
> guess which one to use).
>
> Can you do:
> ls /sys/class/backlight

root@jaguar:~# ls -l /sys/class/backlight/
total 0
lrwxrwxrwx 1 root root 0 Jun 19 17:26 acpi_video0 ->
../../devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/
lrwxrwxrwx 1 root root 0 Jun 19 17:26 intel_backlight ->
../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight/
lrwxrwxrwx 1 root root 0 Jun 19 18:48 panasonic ->
../../devices/virtual/backlight/panasonic/

>
> and let me know the output?
>
> Also if there are 2 backlights there then please do:
> cat /sys/class/backlight/<name>/max_brightness
> to find out the range (0-value)

root@jaguar:~# cat /sys/class/backlight/acpi_video0/max_brightness
20
root@jaguar:~# cat /sys/class/backlight/intel_backlight/max_brightness
6375000
root@jaguar:~# cat /sys/class/backlight/panasonic/max_brightness
21

>
> and then try if they both work by doing:
>
> echo $number > /sys/class/backlight/<name>/brightness
>
> with different $number values in the range and see
> if this actually changes the brightness.

/sys/class/backlight/acpi_video0/brightness: works
/sys/class/backlight/intel_backlight/brightness: works
/sys/class/backlight/panasonic/brightness: does not work

The mute, volume up/down keys are still duplicated by atkbd after
applying 0005-platform-x86-panasonic-laptop-filter-out-duplicate-v.patch.

--
Kenneth

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-20 15:08                     ` Hans de Goede
@ 2022-06-20 18:10                       ` Stefan Seyfried
  2022-06-21  9:26                         ` Hans de Goede
  0 siblings, 1 reply; 36+ messages in thread
From: Stefan Seyfried @ 2022-06-20 18:10 UTC (permalink / raw)
  To: Hans de Goede, Kenneth Chan, Andy Shevchenko
  Cc: Platform Driver, Linux Kernel Mailing List, Stefan Seyfried,
	Stefan Seyfried

Hi Hans,

On 20.06.22 17:08, Hans de Goede wrote:
> Hi,
> 
> Thank you for the quick testing.
> 
> On 6/17/22 15:07, Stefan Seyfried wrote:
>> Hi Hans,
>>
>> On 17.06.22 13:07, Hans de Goede wrote:
>>
>>> Thank you for providing this info. Can you please give
>>> the attached patch series a try, this includes Stefan's 1/2 patch
>>> and replaces Stefan's 2/2 patch.
>>>
>>> This will hopefully fix the double key-presses for you, while
>>> also keeping everything working for Stefan without requiring
>>> a module option or DMI quirks.
>>>
>>> Stefan can you also give this series a try please?
>>
>> Works for me, almost out of the box.
>> I need to enable "report_key_events=1" in the video module, then the panasonic-acpi module starts reporting brightness up/down keys.
> 
> Ok, so you need another module option that is not really helpful.

Well, I looked into the acpi_video.c module and that one is to blame.
By default, it assumes that both "OUTPUT_KEY_EVENTS" and 
"BRIGHTNESS_KEY_EVENTS" should be handled by this module.
But on the CF-51, this does not happen. "Video Bus" does not generate 
any key events (I'm not sure about output, but plugging in a VGA monitor 
and enabling/disabling it with xrandr or tapping the "display" fn-f3 
hotkey does not get anything from "Video Bus" input device.

> The idea behind the acpi_video_handles_brightness_key_presses() check
> is that if the ACPI video bus device is present it is expected to
> already report brightness up/down keypresses and we want to avoid
> duplicates.

Yes, but the check apparently returns true in my case, because:

         return have_video_busses &&
                (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS);

apparently i have a video_bus ;-) and report_key_events (== -1) & 2 is true.

This check is totally fine, it's just that *the acpi_video.c* code is 
missing a DMI match for my machine telling it that it handles nothing at 
all.

> Can you check with evtest or evemu-record that the brightness
> events are not already being delivered by the "Video Bus"
> input device ?

I did, nothing at all gets delivered by Video Bus.

>> Volume and mute keys work without manual changes.
> 
> Good.
>   
>> (I tested against 5.18.2 because that's what was already prepared. That old machine takes quite some time, even to just compile the platform/x86 subdirectory ;-) but I don't think this is relevant. If you think it is, I can also test against latest 5.19-rc code)
> 
> Testing against 5.18 is fine .
> 
>>> Looking at this has also brought up an unrelated backlight question:
>>>
>>> Kenneth, since you have acpi-video reporting keypresses you will
>>> likely also have an acpi_video (or perhaps a native intel) backlight
>>> under /sys/class/backlight and I noticed that panasonic-laptop
>>> uncondirionally registers its backlight so you may very well end
>>> up with 2 backlight controls under /sys/class/backlight, which
>>> we generally try to avoid (so that userspace does not have to
>>> guess which one to use).
>>>
>>> Can you do:
>>> ls /sys/class/backlight
>>
>> toughbook:~ # ls -l /sys/class/backlight/
>> total 0
>> lrwxrwxrwx 1 root root 0 Jun 17 14:45 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight
>> lrwxrwxrwx 1 root root 0 Jun 17 14:49 panasonic -> ../../devices/virtual/backlight/panasonic
>>
>>> and let me know the output?
>>>
>>> Also if there are 2 backlights there then please do:
>>> cat /sys/class/backlight/<name>/max_brightness
>>> to find out the range (0-value)
>>
>> toughbook:/sys/class/backlight # grep . */max_brightness
>> intel_backlight/max_brightness:19531
>> panasonic/max_brightness:255
>>
>>> and then try if they both work by doing:
>>>
>>> echo $number > /sys/class/backlight/<name>/brightness
>>>
>>> with different $number values in the range and see
>>> if this actually changes the brightness.
>>
>> intel_backlight: does not work
>> panasonic: does work
> 
> Ok, so that suggests that the ACPI video bus on your
> device is defunct, so I guess it also does not report
> key-presses (see above) ?

Yes, it looks like ACPI video driver is totally useless on that machine.

> This will also need some work then because we want to move
> to there only being 1 (actually working) backlight-class
> device. Rather then having multiple and let userspace
> guess which one it needs to use.

Well, the non-working backlight is coming from the i915 driver, but as 
this is a very old Chipset (i855 GM) I'd rather be happy it works at all 
instead of complaining ;-)
(I have another machine of similar age, hp nc6000 with ati graphics, and 
there is no way getting it to work somewhat reliably at all)

>>> While we are at it, Stefan can you do the same please?
>>
>> See above.
>> But hey, this is an i855GM graphics chip, I'm happy if it is still working *at all* (for example I need to avoid the xf86-intel driver and use the modesetting driver instead to get a usable sytstem)
>>
>> And I'm totally happy if all I have to do in the future is a
>>
>> option video report_key_events=1
>>
>> modprobe.conf file ;-)
> 
> We really don't want people to have to specify module-options just
> to have things working.

I understand, but then it's my job to get that DMI match to set this 
parameter into acpi_video.c ;-)

> Stefam, at least for the backlight class-device issue we will need a DMI
> quirk, so can you run:
> 
> sudo dmidecode > dmidecode.txt
> 
> and then attach the output to your next email, or send me a copy
> privately ?

I'll send it privately as it is pretty big, but I think

DMI_BOARD_VENDOR, "Matsushita Electric Industrial Co.,Ltd."
DMI_BOARD_NAME, "CF51-1L"

(Similar to the CF51-2L in acpi/sleep.c) will do.

Best regards,

	Stefan
-- 
Stefan Seyfried

"For a successful technology, reality must take precedence over
  public relations, for nature cannot be fooled." -- Richard Feynman

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-20 18:10                       ` Stefan Seyfried
@ 2022-06-21  9:26                         ` Hans de Goede
  2022-06-21 10:23                           ` Stefan Seyfried
  0 siblings, 1 reply; 36+ messages in thread
From: Hans de Goede @ 2022-06-21  9:26 UTC (permalink / raw)
  To: Stefan Seyfried, Kenneth Chan, Andy Shevchenko
  Cc: Platform Driver, Linux Kernel Mailing List, Stefan Seyfried

[-- Attachment #1: Type: text/plain, Size: 7130 bytes --]

Hi,

On 6/20/22 20:10, Stefan Seyfried wrote:
> Hi Hans,
> 
> On 20.06.22 17:08, Hans de Goede wrote:
>> Hi,
>>
>> Thank you for the quick testing.
>>
>> On 6/17/22 15:07, Stefan Seyfried wrote:
>>> Hi Hans,
>>>
>>> On 17.06.22 13:07, Hans de Goede wrote:
>>>
>>>> Thank you for providing this info. Can you please give
>>>> the attached patch series a try, this includes Stefan's 1/2 patch
>>>> and replaces Stefan's 2/2 patch.
>>>>
>>>> This will hopefully fix the double key-presses for you, while
>>>> also keeping everything working for Stefan without requiring
>>>> a module option or DMI quirks.
>>>>
>>>> Stefan can you also give this series a try please?
>>>
>>> Works for me, almost out of the box.
>>> I need to enable "report_key_events=1" in the video module, then the panasonic-acpi module starts reporting brightness up/down keys.
>>
>> Ok, so you need another module option that is not really helpful.
> 
> Well, I looked into the acpi_video.c module and that one is to blame.
> By default, it assumes that both "OUTPUT_KEY_EVENTS" and "BRIGHTNESS_KEY_EVENTS" should be handled by this module.
> But on the CF-51, this does not happen. "Video Bus" does not generate any key events (I'm not sure about output, but plugging in a VGA monitor and enabling/disabling it with xrandr or tapping the "display" fn-f3 hotkey does not get anything from "Video Bus" input device.
> 
>> The idea behind the acpi_video_handles_brightness_key_presses() check
>> is that if the ACPI video bus device is present it is expected to
>> already report brightness up/down keypresses and we want to avoid
>> duplicates.
> 
> Yes, but the check apparently returns true in my case, because:
> 
>         return have_video_busses &&
>                (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS);
> 
> apparently i have a video_bus ;-) and report_key_events (== -1) & 2 is true.
> 
> This check is totally fine, it's just that *the acpi_video.c* code is missing a DMI match for my machine telling it that it handles nothing at all.
> 
>> Can you check with evtest or evemu-record that the brightness
>> events are not already being delivered by the "Video Bus"
>> input device ?
> 
> I did, nothing at all gets delivered by Video Bus.
> 
>>> Volume and mute keys work without manual changes.
>>
>> Good.
>>  
>>> (I tested against 5.18.2 because that's what was already prepared. That old machine takes quite some time, even to just compile the platform/x86 subdirectory ;-) but I don't think this is relevant. If you think it is, I can also test against latest 5.19-rc code)
>>
>> Testing against 5.18 is fine .
>>
>>>> Looking at this has also brought up an unrelated backlight question:
>>>>
>>>> Kenneth, since you have acpi-video reporting keypresses you will
>>>> likely also have an acpi_video (or perhaps a native intel) backlight
>>>> under /sys/class/backlight and I noticed that panasonic-laptop
>>>> uncondirionally registers its backlight so you may very well end
>>>> up with 2 backlight controls under /sys/class/backlight, which
>>>> we generally try to avoid (so that userspace does not have to
>>>> guess which one to use).
>>>>
>>>> Can you do:
>>>> ls /sys/class/backlight
>>>
>>> toughbook:~ # ls -l /sys/class/backlight/
>>> total 0
>>> lrwxrwxrwx 1 root root 0 Jun 17 14:45 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight
>>> lrwxrwxrwx 1 root root 0 Jun 17 14:49 panasonic -> ../../devices/virtual/backlight/panasonic
>>>
>>>> and let me know the output?
>>>>
>>>> Also if there are 2 backlights there then please do:
>>>> cat /sys/class/backlight/<name>/max_brightness
>>>> to find out the range (0-value)
>>>
>>> toughbook:/sys/class/backlight # grep . */max_brightness
>>> intel_backlight/max_brightness:19531
>>> panasonic/max_brightness:255
>>>
>>>> and then try if they both work by doing:
>>>>
>>>> echo $number > /sys/class/backlight/<name>/brightness
>>>>
>>>> with different $number values in the range and see
>>>> if this actually changes the brightness.
>>>
>>> intel_backlight: does not work
>>> panasonic: does work
>>
>> Ok, so that suggests that the ACPI video bus on your
>> device is defunct, so I guess it also does not report
>> key-presses (see above) ?
> 
> Yes, it looks like ACPI video driver is totally useless on that machine.
> 
>> This will also need some work then because we want to move
>> to there only being 1 (actually working) backlight-class
>> device. Rather then having multiple and let userspace
>> guess which one it needs to use.
> 
> Well, the non-working backlight is coming from the i915 driver, but as this is a very old Chipset (i855 GM) I'd rather be happy it works at all instead of complaining ;-)
> (I have another machine of similar age, hp nc6000 with ati graphics, and there is no way getting it to work somewhat reliably at all)

Ah right, you've got a panasonic + a native intel backlight device.

We are going to need a quirk to (eventually also depending on other changes)
disable the broken intel backlight device.

But that won't fix the keys issue, at least not without an extra
quirk just for that.

I wonder if your machine supports the backlight control part of
the ACPI video bus at all. If not that would explain why it is
not reporting brightness keys and that would also give us a way
to solve this without an extra quirk.

And that would actually also avoid the need for a backlight
quirk too.

Can you pass "acpi_backlight=video" on the kernel commandline
and see if a /sys/class/backlight/acpi_video0 device then
shows up. If it does _not_ show up then indeed there is no
ACPI backlight control at all.

In that case please give the attached patches a try on top
of my last series.

The acpi_video patch should fix your brightness keys then and
the extra panasonic-laptop patch should not make any difference
for the available /sys/class/backlight devices on your laptop,
while filtering out the broken panasonic backlight on Kenneth's
device.

Regards,

Hans



> 
>>>> While we are at it, Stefan can you do the same please?
>>>
>>> See above.
>>> But hey, this is an i855GM graphics chip, I'm happy if it is still working *at all* (for example I need to avoid the xf86-intel driver and use the modesetting driver instead to get a usable sytstem)
>>>
>>> And I'm totally happy if all I have to do in the future is a
>>>
>>> option video report_key_events=1
>>>
>>> modprobe.conf file ;-)
>>
>> We really don't want people to have to specify module-options just
>> to have things working.
> 
> I understand, but then it's my job to get that DMI match to set this parameter into acpi_video.c ;-)
> 
>> Stefam, at least for the backlight class-device issue we will need a DMI
>> quirk, so can you run:
>>
>> sudo dmidecode > dmidecode.txt
>>
>> and then attach the output to your next email, or send me a copy
>> privately ?
> 
> I'll send it privately as it is pretty big, but I think
> 
> DMI_BOARD_VENDOR, "Matsushita Electric Industrial Co.,Ltd."
> DMI_BOARD_NAME, "CF51-1L"
> 
> (Similar to the CF51-2L in acpi/sleep.c) will do.
> 
> Best regards,
> 
>     Stefan

[-- Attachment #2: 0001-platform-x86-panasonic-laptop-Use-acpi_video_get_bac.patch --]
[-- Type: text/x-patch, Size: 1938 bytes --]

From f9afd65564e1f4e8e41b0cdbc754b11fc0e2edf6 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 21 Jun 2022 11:20:42 +0200
Subject: [PATCH 1/2] platform/x86: panasonic-laptop: Use
 acpi_video_get_backlight_type()

Use acpi_video_get_backlight_type() to determine if we should register
the panasonic specific backlight interface. To avoid registering this
on systems where the ACPI or GPU native backlight control methods
should be used instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/panasonic-laptop.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index a4c82b3a81cf..0fa7695089e2 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -998,15 +998,19 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 		pr_err("Couldn't retrieve BIOS data\n");
 		goto out_input;
 	}
-	/* initialize backlight */
-	memset(&props, 0, sizeof(struct backlight_properties));
-	props.type = BACKLIGHT_PLATFORM;
-	props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT];
-	pcc->backlight = backlight_device_register("panasonic", NULL, pcc,
-						   &pcc_backlight_ops, &props);
-	if (IS_ERR(pcc->backlight)) {
-		result = PTR_ERR(pcc->backlight);
-		goto out_input;
+
+	if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
+		/* initialize backlight */
+		memset(&props, 0, sizeof(struct backlight_properties));
+		props.type = BACKLIGHT_PLATFORM;
+		props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT];
+		
+		pcc->backlight = backlight_device_register("panasonic", NULL, pcc,
+							   &pcc_backlight_ops, &props);
+		if (IS_ERR(pcc->backlight)) {
+			result = PTR_ERR(pcc->backlight);
+			goto out_input;
+		}
 	}
 
 	/* read the initial brightness setting from the hardware */
-- 
2.36.0


[-- Attachment #3: 0002-ACPI-video-Change-how-we-determine-if-brightness-key.patch --]
[-- Type: text/x-patch, Size: 2465 bytes --]

From 70d07e9157bb2813726986d068fb0c99e1a619d9 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 21 Jun 2022 11:12:51 +0200
Subject: [PATCH 2/2] ACPI: video: Change how we determine if brightness
 key-presses are handled

Some systems have an ACPI video bus but not ACPI video devices with
backlight capability. On these devices brightness key-presses are
(logically) not reported through the ACPI video bus.

Change how acpi_video_handles_brightness_key_presses() determines if
brightness key-presses are handled by the ACPI video driver to avoid
vendor specific drivers/platform/x86 drivers filtering out their
brightness key-presses even though they are the only ones reporting
these presses.

Reported-by: Stefan Seyfried <seife+kernel@b1-systems.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/acpi_video.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 01c3f62295c3..be7f4d1912de 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -79,6 +79,7 @@ module_param(device_id_scheme, bool, 0444);
 static int only_lcd = -1;
 module_param(only_lcd, int, 0444);
 
+static bool has_backlight;
 static int register_count;
 static DEFINE_MUTEX(register_count_mutex);
 static DEFINE_MUTEX(video_list_lock);
@@ -1230,6 +1231,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
 	acpi_video_device_bind(video, data);
 	acpi_video_device_find_cap(data);
 
+	if (data->cap._BCM && data->cap._BCL)
+		has_backlight = true;
+
 	mutex_lock(&video->device_list_lock);
 	list_add_tail(&data->entry, &video->video_device_list);
 	mutex_unlock(&video->device_list_lock);
@@ -2276,6 +2280,7 @@ void acpi_video_unregister(void)
 		cancel_delayed_work_sync(&video_bus_register_backlight_work);
 		acpi_bus_unregister_driver(&acpi_video_bus);
 		register_count = 0;
+		has_backlight = false;
 	}
 	mutex_unlock(&register_count_mutex);
 }
@@ -2294,13 +2299,7 @@ EXPORT_SYMBOL(acpi_video_register_backlight);
 
 bool acpi_video_handles_brightness_key_presses(void)
 {
-	bool have_video_busses;
-
-	mutex_lock(&video_list_lock);
-	have_video_busses = !list_empty(&video_bus_head);
-	mutex_unlock(&video_list_lock);
-
-	return have_video_busses &&
+	return has_backlight &&
 	       (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS);
 }
 EXPORT_SYMBOL(acpi_video_handles_brightness_key_presses);
-- 
2.36.0


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-20 15:21                   ` Kenneth Chan
@ 2022-06-21  9:34                     ` Hans de Goede
  2022-06-24  5:14                       ` Kenneth Chan
  0 siblings, 1 reply; 36+ messages in thread
From: Hans de Goede @ 2022-06-21  9:34 UTC (permalink / raw)
  To: Kenneth Chan
  Cc: Stefan Seyfried, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Stefan Seyfried

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

Hi,

On 6/20/22 17:21, Kenneth Chan wrote:
> It took quite a while to do a full compile, just to be safe.

<snip backlight stuff, which looks as expected>

> The mute, volume up/down keys are still duplicated by atkbd after
> applying 0005-platform-x86-panasonic-laptop-filter-out-duplicate-v.patch.

Hmm, can you add a couple of:

 pr_info("data 0x%02x\n", data);

at the top of the new panasonic_i8042_filter() function
and then check in dmesg what is output for the volume keys.

The patch should filter out those duplicate keys, unless
I got the codes wrong somehow.

Also can you please try the attached 2 patches on top of my
last series, this should hide the broken panasonic backlight
device and otherwise it should make no difference (but maybe
double check the duplicate brightness keys are not back.

Regards,

Hans

[-- Attachment #2: 0001-platform-x86-panasonic-laptop-Use-acpi_video_get_bac.patch --]
[-- Type: text/x-patch, Size: 1938 bytes --]

From f9afd65564e1f4e8e41b0cdbc754b11fc0e2edf6 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 21 Jun 2022 11:20:42 +0200
Subject: [PATCH 1/2] platform/x86: panasonic-laptop: Use
 acpi_video_get_backlight_type()

Use acpi_video_get_backlight_type() to determine if we should register
the panasonic specific backlight interface. To avoid registering this
on systems where the ACPI or GPU native backlight control methods
should be used instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/panasonic-laptop.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index a4c82b3a81cf..0fa7695089e2 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -998,15 +998,19 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 		pr_err("Couldn't retrieve BIOS data\n");
 		goto out_input;
 	}
-	/* initialize backlight */
-	memset(&props, 0, sizeof(struct backlight_properties));
-	props.type = BACKLIGHT_PLATFORM;
-	props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT];
-	pcc->backlight = backlight_device_register("panasonic", NULL, pcc,
-						   &pcc_backlight_ops, &props);
-	if (IS_ERR(pcc->backlight)) {
-		result = PTR_ERR(pcc->backlight);
-		goto out_input;
+
+	if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
+		/* initialize backlight */
+		memset(&props, 0, sizeof(struct backlight_properties));
+		props.type = BACKLIGHT_PLATFORM;
+		props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT];
+		
+		pcc->backlight = backlight_device_register("panasonic", NULL, pcc,
+							   &pcc_backlight_ops, &props);
+		if (IS_ERR(pcc->backlight)) {
+			result = PTR_ERR(pcc->backlight);
+			goto out_input;
+		}
 	}
 
 	/* read the initial brightness setting from the hardware */
-- 
2.36.0


[-- Attachment #3: 0002-ACPI-video-Change-how-we-determine-if-brightness-key.patch --]
[-- Type: text/x-patch, Size: 2465 bytes --]

From 70d07e9157bb2813726986d068fb0c99e1a619d9 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 21 Jun 2022 11:12:51 +0200
Subject: [PATCH 2/2] ACPI: video: Change how we determine if brightness
 key-presses are handled

Some systems have an ACPI video bus but not ACPI video devices with
backlight capability. On these devices brightness key-presses are
(logically) not reported through the ACPI video bus.

Change how acpi_video_handles_brightness_key_presses() determines if
brightness key-presses are handled by the ACPI video driver to avoid
vendor specific drivers/platform/x86 drivers filtering out their
brightness key-presses even though they are the only ones reporting
these presses.

Reported-by: Stefan Seyfried <seife+kernel@b1-systems.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/acpi_video.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 01c3f62295c3..be7f4d1912de 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -79,6 +79,7 @@ module_param(device_id_scheme, bool, 0444);
 static int only_lcd = -1;
 module_param(only_lcd, int, 0444);
 
+static bool has_backlight;
 static int register_count;
 static DEFINE_MUTEX(register_count_mutex);
 static DEFINE_MUTEX(video_list_lock);
@@ -1230,6 +1231,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
 	acpi_video_device_bind(video, data);
 	acpi_video_device_find_cap(data);
 
+	if (data->cap._BCM && data->cap._BCL)
+		has_backlight = true;
+
 	mutex_lock(&video->device_list_lock);
 	list_add_tail(&data->entry, &video->video_device_list);
 	mutex_unlock(&video->device_list_lock);
@@ -2276,6 +2280,7 @@ void acpi_video_unregister(void)
 		cancel_delayed_work_sync(&video_bus_register_backlight_work);
 		acpi_bus_unregister_driver(&acpi_video_bus);
 		register_count = 0;
+		has_backlight = false;
 	}
 	mutex_unlock(&register_count_mutex);
 }
@@ -2294,13 +2299,7 @@ EXPORT_SYMBOL(acpi_video_register_backlight);
 
 bool acpi_video_handles_brightness_key_presses(void)
 {
-	bool have_video_busses;
-
-	mutex_lock(&video_list_lock);
-	have_video_busses = !list_empty(&video_bus_head);
-	mutex_unlock(&video_list_lock);
-
-	return have_video_busses &&
+	return has_backlight &&
 	       (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS);
 }
 EXPORT_SYMBOL(acpi_video_handles_brightness_key_presses);
-- 
2.36.0


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-21  9:26                         ` Hans de Goede
@ 2022-06-21 10:23                           ` Stefan Seyfried
  2022-06-21 17:54                             ` Stefan Seyfried
  0 siblings, 1 reply; 36+ messages in thread
From: Stefan Seyfried @ 2022-06-21 10:23 UTC (permalink / raw)
  To: Hans de Goede, Kenneth Chan, Andy Shevchenko
  Cc: Platform Driver, Linux Kernel Mailing List, Stefan Seyfried

Hi Hans,

On 21.06.22 11:26, Hans de Goede wrote:
> Hi,
> 
> On 6/20/22 20:10, Stefan Seyfried wrote:
>> Well, the non-working backlight is coming from the i915 driver, but as this is a very old Chipset (i855 GM) I'd rather be happy it works at all instead of complaining ;-)
>> (I have another machine of similar age, hp nc6000 with ati graphics, and there is no way getting it to work somewhat reliably at all)
> 
> Ah right, you've got a panasonic + a native intel backlight device.
> 
> We are going to need a quirk to (eventually also depending on other changes)
> disable the broken intel backlight device.
> 
> But that won't fix the keys issue, at least not without an extra
> quirk just for that.
> 
> I wonder if your machine supports the backlight control part of
> the ACPI video bus at all. If not that would explain why it is
> not reporting brightness keys and that would also give us a way
> to solve this without an extra quirk.
> 
> And that would actually also avoid the need for a backlight
> quirk too.
> 
> Can you pass "acpi_backlight=video" on the kernel commandline
> and see if a /sys/class/backlight/acpi_video0 device then
> shows up. If it does _not_ show up then indeed there is no
> ACPI backlight control at all.

Nothing new shows up, just panasonic and intel_backlight as before.

> In that case please give the attached patches a try on top
> of my last series.

they do not fix the brightness keys for me.
I did not have time to put in some debugging and will be traveling for 
the rest of the week, but I'll take the toughbook with me and will try 
to debug this later ;-)

> The acpi_video patch should fix your brightness keys then and

apparently it does not :-(

> the extra panasonic-laptop patch should not make any difference
> for the available /sys/class/backlight devices on your laptop,
> while filtering out the broken panasonic backlight on Kenneth's
> device.

Yes, the panasonic backlight does still work on my machine.

Best regards,

	Stefan
-- 
Stefan Seyfried

"For a successful technology, reality must take precedence over
  public relations, for nature cannot be fooled." -- Richard Feynman

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-21 10:23                           ` Stefan Seyfried
@ 2022-06-21 17:54                             ` Stefan Seyfried
  2022-06-22 10:57                               ` Hans de Goede
  0 siblings, 1 reply; 36+ messages in thread
From: Stefan Seyfried @ 2022-06-21 17:54 UTC (permalink / raw)
  To: Hans de Goede, Kenneth Chan, Andy Shevchenko
  Cc: Platform Driver, Linux Kernel Mailing List, Stefan Seyfried

Hi Hans,

the patched ACPI video module DOES WORK.

I just managed to actually compile the unmodified source code m(
After patching acpi_video.c, compiling and installing it so that it 
actually gets used, everything works fine now.

On 21.06.22 12:23, Stefan Seyfried wrote:
> Hi Hans,
> 
> On 21.06.22 11:26, Hans de Goede wrote:
>> Hi,
>>
>> On 6/20/22 20:10, Stefan Seyfried wrote:
>>> Well, the non-working backlight is coming from the i915 driver, but 
>>> as this is a very old Chipset (i855 GM) I'd rather be happy it works 
>>> at all instead of complaining ;-)
>>> (I have another machine of similar age, hp nc6000 with ati graphics, 
>>> and there is no way getting it to work somewhat reliably at all)
>>
>> Ah right, you've got a panasonic + a native intel backlight device.
>>
>> We are going to need a quirk to (eventually also depending on other 
>> changes)
>> disable the broken intel backlight device.
>>
>> But that won't fix the keys issue, at least not without an extra
>> quirk just for that.
>>
>> I wonder if your machine supports the backlight control part of
>> the ACPI video bus at all. If not that would explain why it is
>> not reporting brightness keys and that would also give us a way
>> to solve this without an extra quirk.
>>
>> And that would actually also avoid the need for a backlight
>> quirk too.
>>
>> Can you pass "acpi_backlight=video" on the kernel commandline
>> and see if a /sys/class/backlight/acpi_video0 device then
>> shows up. If it does _not_ show up then indeed there is no
>> ACPI backlight control at all.
> 
> Nothing new shows up, just panasonic and intel_backlight as before.
> 
>> In that case please give the attached patches a try on top
>> of my last series.
> 
> they do not fix the brightness keys for me.

YES they do fix it. I just need to actually use the patched module :-)

> I did not have time to put in some debugging and will be traveling for 
> the rest of the week, but I'll take the toughbook with me and will try 
> to debug this later ;-)
> 
>> The acpi_video patch should fix your brightness keys then and
> 
> apparently it does not :-(
It does.

Thanks
	Stefan
-- 
Stefan Seyfried

"For a successful technology, reality must take precedence over
  public relations, for nature cannot be fooled." -- Richard Feynman

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-21 17:54                             ` Stefan Seyfried
@ 2022-06-22 10:57                               ` Hans de Goede
  0 siblings, 0 replies; 36+ messages in thread
From: Hans de Goede @ 2022-06-22 10:57 UTC (permalink / raw)
  To: Stefan Seyfried, Kenneth Chan, Andy Shevchenko
  Cc: Platform Driver, Linux Kernel Mailing List, Stefan Seyfried

Hi,

On 6/21/22 19:54, Stefan Seyfried wrote:
> Hi Hans,
> 
> the patched ACPI video module DOES WORK.
> 
> I just managed to actually compile the unmodified source code m(
> After patching acpi_video.c, compiling and installing it so that it actually gets used, everything works fine now.

Great, that is good news. Thank you.

So if Kenneth can figure out why the i8042 filter is not working,
then we can hopefully fix this with my original series + the 2 extra
patches. And then this will be fixed without needing any DMI matches
and generic fixes are always better :)

Regards,

Hans




> 
> On 21.06.22 12:23, Stefan Seyfried wrote:
>> Hi Hans,
>>
>> On 21.06.22 11:26, Hans de Goede wrote:
>>> Hi,
>>>
>>> On 6/20/22 20:10, Stefan Seyfried wrote:
>>>> Well, the non-working backlight is coming from the i915 driver, but as this is a very old Chipset (i855 GM) I'd rather be happy it works at all instead of complaining ;-)
>>>> (I have another machine of similar age, hp nc6000 with ati graphics, and there is no way getting it to work somewhat reliably at all)
>>>
>>> Ah right, you've got a panasonic + a native intel backlight device.
>>>
>>> We are going to need a quirk to (eventually also depending on other changes)
>>> disable the broken intel backlight device.
>>>
>>> But that won't fix the keys issue, at least not without an extra
>>> quirk just for that.
>>>
>>> I wonder if your machine supports the backlight control part of
>>> the ACPI video bus at all. If not that would explain why it is
>>> not reporting brightness keys and that would also give us a way
>>> to solve this without an extra quirk.
>>>
>>> And that would actually also avoid the need for a backlight
>>> quirk too.
>>>
>>> Can you pass "acpi_backlight=video" on the kernel commandline
>>> and see if a /sys/class/backlight/acpi_video0 device then
>>> shows up. If it does _not_ show up then indeed there is no
>>> ACPI backlight control at all.
>>
>> Nothing new shows up, just panasonic and intel_backlight as before.
>>
>>> In that case please give the attached patches a try on top
>>> of my last series.
>>
>> they do not fix the brightness keys for me.
> 
> YES they do fix it. I just need to actually use the patched module :-)
> 
>> I did not have time to put in some debugging and will be traveling for the rest of the week, but I'll take the toughbook with me and will try to debug this later ;-)
>>
>>> The acpi_video patch should fix your brightness keys then and
>>
>> apparently it does not :-(
> It does.
> 
> Thanks
>     Stefan


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-21  9:34                     ` Hans de Goede
@ 2022-06-24  5:14                       ` Kenneth Chan
  2022-06-24  9:24                         ` Hans de Goede
  0 siblings, 1 reply; 36+ messages in thread
From: Kenneth Chan @ 2022-06-24  5:14 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Stefan Seyfried, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Stefan Seyfried

[-- Attachment #1: Type: text/plain, Size: 1171 bytes --]

Hi Hans,


On Tue, 21 Jun 2022 at 17:34, Hans de Goede <hdegoede@redhat.com> wrote:
>
>
> > The mute, volume up/down keys are still duplicated by atkbd after
> > applying 0005-platform-x86-panasonic-laptop-filter-out-duplicate-v.patch.
>
> Hmm, can you add a couple of:
>
>  pr_info("data 0x%02x\n", data);
>
> at the top of the new panasonic_i8042_filter() function
> and then check in dmesg what is output for the volume keys.
>

Volume Down 0xe0 0x2e / 0xe0 0xae
Mute 0xe0 0x20 / 0xe0 0xa0
Volume Up 0xe0 0x30 / 0xe0 0xb0

I replaced those values with these and it filters out the duplicate keys. Yay!!!

>
> The patch should filter out those duplicate keys, unless
> I got the codes wrong somehow.
>
> Also can you please try the attached 2 patches on top of my
> last series, this should hide the broken panasonic backlight
> device and otherwise it should make no difference (but maybe
> double check the duplicate brightness keys are not back.
>

The last 2 patches crash as soon as the panasonic-laptop module is
loaded. It's compiled against kernel v5.18.5. Please see the
attachment. I'm going to compile it against the latest and see if it
works.

-- 
Kenneth

[-- Attachment #2: DMESG.txt --]
[-- Type: text/plain, Size: 51489 bytes --]

[    0.000000] Linux version 5.18.5-pcc (chantk@gluon64.thds.mooo.com) (gcc (GCC) 12.1.0, GNU ld version 2.38-slack151) #1 SMP PREEMPT_DYNAMIC Wed Jun 22 18:27:17 HKT 2022
[    0.000000] Command line: BOOT_IMAGE=pcc ro root=fd00 resume=/dev/panavg/swap vt.default_utf8=0 log_buf_len=16M
[    0.000000] x86/fpu: x87 FPU will use FXSAVE
[    0.000000] signal: max sigframe size: 1440
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009f7ff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009f800-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000dc000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000005f66ffff] usable
[    0.000000] BIOS-e820: [mem 0x000000005f670000-0x000000005f6fffff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x000000005f700000-0x000000005fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000e0000000-0x00000000efffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec0ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed00000-0x00000000fed003ff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed14000-0x00000000fed19fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed8ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] SMBIOS 2.4 present.
[    0.000000] DMI: Matsushita Electric Industrial Co.,Ltd. CF-W5AWDBJR/CFW5-4, BIOS V4.00L10 04/06/2007
[    0.000000] tsc: Fast TSC calibration failed
[    0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[    0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable
[    0.000000] last_pfn = 0x5f670 max_arch_pfn = 0x400000000
[    0.000000] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WP  UC- WT  
[    0.000000] found SMP MP-table at [mem 0x000f8200-0x000f820f]
[    0.000000] printk: log_buf_len: 16777216 bytes
[    0.000000] printk: early log buf free: 260264(99%)
[    0.000000] RAMDISK: [mem 0x5e611000-0x5f66ffff]
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x00000000000F81D0 000014 (v00 MATBIO)
[    0.000000] ACPI: RSDT 0x000000005F67EBA5 00004C (v01 MATBIO CFW5-4   06040000 MEI  00000000)
[    0.000000] ACPI: FACP 0x000000005F686CD0 000084 (v02 MATBIO CFW5-4   06040000 MEI  0000005A)
[    0.000000] ACPI: DSDT 0x000000005F67FBBC 007114 (v01 MATBIO CFW5-4   06040000 MSFT 03000000)
[    0.000000] ACPI: FACS 0x000000005F687FC0 000040
[    0.000000] ACPI: HPET 0x000000005F686D54 000038 (v01 MATBIO CFW5-4   06040000 MEI  0000005A)
[    0.000000] ACPI: SLIC 0x000000005F686D8C 000176 (v01 MATBIO CFW5-4   06040000 MEI  00000000)
[    0.000000] ACPI: APIC 0x000000005F686F02 000068 (v01 MATBIO CFW5-4   06040000 MEI  00000000)
[    0.000000] ACPI: MCFG 0x000000005F686F6A 00003C (v01 MATBIO CFW5-4   06040000 MEI  00000000)
[    0.000000] ACPI: BOOT 0x000000005F686FA6 000028 (v01 MATBIO CFW5-4   06040000 MEI  00000001)
[    0.000000] ACPI: TCPA 0x000000005F686FCE 000032 (v01 MATBIO CFW5-4   06040000 MEI  00000001)
[    0.000000] ACPI: SSDT 0x000000005F67F17D 00025F (v01 MATBIO CFW5-4   00003000 MEI  20050624)
[    0.000000] ACPI: SSDT 0x000000005F67F0D7 0000A6 (v01 MATBIO CFW5-4   00003000 MEI  20050624)
[    0.000000] ACPI: SSDT 0x000000005F67EBF1 0004E6 (v01 MATBIO CFW5-4   00003000 MEI  20050624)
[    0.000000] ACPI: Reserving FACP table memory at [mem 0x5f686cd0-0x5f686d53]
[    0.000000] ACPI: Reserving DSDT table memory at [mem 0x5f67fbbc-0x5f686ccf]
[    0.000000] ACPI: Reserving FACS table memory at [mem 0x5f687fc0-0x5f687fff]
[    0.000000] ACPI: Reserving HPET table memory at [mem 0x5f686d54-0x5f686d8b]
[    0.000000] ACPI: Reserving SLIC table memory at [mem 0x5f686d8c-0x5f686f01]
[    0.000000] ACPI: Reserving APIC table memory at [mem 0x5f686f02-0x5f686f69]
[    0.000000] ACPI: Reserving MCFG table memory at [mem 0x5f686f6a-0x5f686fa5]
[    0.000000] ACPI: Reserving BOOT table memory at [mem 0x5f686fa6-0x5f686fcd]
[    0.000000] ACPI: Reserving TCPA table memory at [mem 0x5f686fce-0x5f686fff]
[    0.000000] ACPI: Reserving SSDT table memory at [mem 0x5f67f17d-0x5f67f3db]
[    0.000000] ACPI: Reserving SSDT table memory at [mem 0x5f67f0d7-0x5f67f17c]
[    0.000000] ACPI: Reserving SSDT table memory at [mem 0x5f67ebf1-0x5f67f0d6]
[    0.000000] No NUMA configuration found
[    0.000000] Faking a node at [mem 0x0000000000000000-0x000000005f66ffff]
[    0.000000] NODE_DATA(0) allocated [mem 0x59e0c000-0x59e10fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
[    0.000000]   DMA32    [mem 0x0000000001000000-0x000000005f66ffff]
[    0.000000]   Normal   empty
[    0.000000]   Device   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000001000-0x000000000009efff]
[    0.000000]   node   0: [mem 0x0000000000100000-0x000000005f66ffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x000000005f66ffff]
[    0.000000] On node 0, zone DMA: 1 pages in unavailable ranges
[    0.000000] On node 0, zone DMA: 97 pages in unavailable ranges
[    0.000000] On node 0, zone DMA32: 2448 pages in unavailable ranges
[    0.000000] Reserving Intel graphics memory at [mem 0x5f800000-0x5fffffff]
[    0.000000] ACPI: PM-Timer IO Port: 0x1008
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
[    0.000000] IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 high edge)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] smpboot: Allowing 2 CPUs, 0 hotplug CPUs
[    0.000000] PM: hibernation: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.000000] PM: hibernation: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[    0.000000] PM: hibernation: Registered nosave memory: [mem 0x000a0000-0x000dbfff]
[    0.000000] PM: hibernation: Registered nosave memory: [mem 0x000dc000-0x000fffff]
[    0.000000] [mem 0x60000000-0xdfffffff] available for PCI devices
[    0.000000] Booting paravirtualized kernel on bare hardware
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
[    0.000000] setup_percpu: NR_CPUS:256 nr_cpumask_bits:256 nr_cpu_ids:2 nr_node_ids:1
[    0.000000] percpu: Embedded 59 pages/cpu s204800 r8192 d28672 u1048576
[    0.000000] pcpu-alloc: s204800 r8192 d28672 u1048576 alloc=1*2097152
[    0.000000] pcpu-alloc: [0] 0 1 
[    0.000000] Fallback order for Node 0: 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 384406
[    0.000000] Policy zone: DMA32
[    0.000000] Kernel command line: BOOT_IMAGE=pcc ro root=fd00 resume=/dev/panavg/swap vt.default_utf8=0 log_buf_len=16M
[    0.000000] Unknown kernel command line parameters "BOOT_IMAGE=pcc", will be passed to user space.
[    0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 1408240K/1562680K available (14344K kernel code, 2606K rwdata, 4680K rodata, 1652K init, 3196K bss, 154180K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] Kernel/User page tables isolation: enabled
[    0.000000] ftrace: allocating 43580 entries in 171 pages
[    0.000000] ftrace: allocated 171 pages with 5 groups
[    0.000000] Dynamic Preempt: full
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	CONFIG_RCU_FANOUT set to non-default value of 32.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=2.
[    0.000000] 	Trampoline variant of Tasks RCU enabled.
[    0.000000] 	Rude variant of Tasks RCU enabled.
[    0.000000] 	Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 100 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS: 16640, nr_irqs: 440, preallocated irqs: 16
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] printk: console [tty0] enabled
[    0.000000] ACPI: Core revision 20211217
[    0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 133484882848 ns
[    0.000000] APIC: Switch to symmetric I/O mode setup
[    0.000000] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.006000] tsc: PIT calibration matches HPET. 1 loops
[    0.006000] tsc: Detected 1064.011 MHz processor
[    0.000012] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0xf564bf0043, max_idle_ns: 440795240044 ns
[    0.000132] Calibrating delay loop (skipped), value calculated using timer frequency.. 2128.02 BogoMIPS (lpj=1064011)
[    0.000249] pid_max: default: 32768 minimum: 301
[    0.000510] LSM: Security Framework initializing
[    0.000742] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.001152] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.002090] process: using mwait in idle threads
[    0.002221] Last level iTLB entries: 4KB 128, 2MB 4, 4MB 4
[    0.002304] Last level dTLB entries: 4KB 256, 2MB 0, 4MB 32, 1GB 0
[    0.002394] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
[    0.002503] Spectre V2 : Mitigation: Retpolines
[    0.002581] Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch
[    0.002687] Speculative Store Bypass: Vulnerable
[    0.002770] MDS: Vulnerable: Clear CPU buffers attempted, no microcode
[    0.005918] Freeing SMP alternatives memory: 40K
[    0.108770] smpboot: CPU0: Intel(R) Core(TM)2 CPU         U7500  @ 1.06GHz (family: 0x6, model: 0xf, stepping: 0x2)
[    0.109127] cblist_init_generic: Setting adjustable number of callback queues.
[    0.109127] cblist_init_generic: Setting shift to 1 and lim to 1.
[    0.109127] cblist_init_generic: Setting shift to 1 and lim to 1.
[    0.109179] cblist_init_generic: Setting shift to 1 and lim to 1.
[    0.109319] Performance Events: PEBS fmt0-, Core2 events, 4-deep LBR, Intel PMU driver.
[    0.109466] core: PEBS disabled due to CPU errata
[    0.109547] ... version:                2
[    0.110131] ... bit width:              40
[    0.110209] ... generic registers:      2
[    0.110287] ... value mask:             000000ffffffffff
[    0.110368] ... max period:             000000007fffffff
[    0.110449] ... fixed-purpose events:   3
[    0.110527] ... event mask:             0000000700000003
[    0.111412] rcu: Hierarchical SRCU implementation.
[    0.111797] smp: Bringing up secondary CPUs ...
[    0.112254] x86: Booting SMP configuration:
[    0.112336] .... node  #0, CPUs:      #1
[    0.113192] smp: Brought up 1 node, 2 CPUs
[    0.114215] smpboot: Max logical packages: 1
[    0.114295] smpboot: Total of 2 processors activated (4256.04 BogoMIPS)
[    0.115556] devtmpfs: initialized
[    0.115556] x86/mm: Memory block size: 128MB
[    0.117206] ACPI: PM: Registering ACPI NVS region [mem 0x5f670000-0x5f6fffff] (589824 bytes)
[    0.117501] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
[    0.117621] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.118159] pinctrl core: initialized pinctrl subsystem
[    0.119425] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.119813] DMA: preallocated 256 KiB GFP_KERNEL pool for atomic allocations
[    0.119923] DMA: preallocated 256 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.120036] DMA: preallocated 256 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.120176] audit: initializing netlink subsys (disabled)
[    0.120281] audit: type=2000 audit(1655988847.126:1): state=initialized audit_enabled=0 res=1
[    0.120533] thermal_sys: Registered thermal governor 'fair_share'
[    0.120539] thermal_sys: Registered thermal governor 'bang_bang'
[    0.120625] thermal_sys: Registered thermal governor 'step_wise'
[    0.120625] thermal_sys: Registered thermal governor 'user_space'
[    0.121140] cpuidle: using governor ladder
[    0.121323] cpuidle: using governor menu
[    0.121323] Simple Boot Flag at 0x46 set to 0x1
[    0.121426] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[    0.121426] PCI: MMCONFIG for domain 0000 [bus 00-ff] at [mem 0xe0000000-0xefffffff] (base 0xe0000000)
[    0.121426] PCI: MMCONFIG at [mem 0xe0000000-0xefffffff] reserved in E820
[    0.121493] PCI: Using configuration type 1 for base access
[    0.128219] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.128282] cryptd: max_cpu_qlen set to 1000
[    0.129281] raid6: skipped pq benchmark and selected sse2x4
[    0.129369] raid6: using ssse3x2 recovery algorithm
[    0.130272] ACPI: Added _OSI(Module Device)
[    0.130353] ACPI: Added _OSI(Processor Device)
[    0.130434] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.130514] ACPI: Added _OSI(Processor Aggregator Device)
[    0.130609] ACPI: Added _OSI(Linux-Dell-Video)
[    0.130689] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    0.130771] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[    0.134052] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
[    0.137132] ACPI: 4 ACPI AML tables successfully acquired and loaded
[    0.146808] ACPI: Dynamic OEM Table Load:
[    0.146904] ACPI: SSDT 0xFFFF8CD241960000 0001B9 (v01 PmRef  Cpu0Ist  00003000 INTL 20050624)
[    0.148209] ACPI: Dynamic OEM Table Load:
[    0.148303] ACPI: SSDT 0xFFFF8CD2412AC000 0004DA (v01 PmRef  Cpu0Cst  00003001 INTL 20050624)
[    0.149752] ACPI: Dynamic OEM Table Load:
[    0.149846] ACPI: SSDT 0xFFFF8CD2413BE600 0000C8 (v01 PmRef  Cpu1Ist  00003000 INTL 20050624)
[    0.150772] ACPI: Dynamic OEM Table Load:
[    0.150863] ACPI: SSDT 0xFFFF8CD24185AA80 000085 (v01 PmRef  Cpu1Cst  00003000 INTL 20050624)
[    0.152258] ACPI: EC: EC started
[    0.152337] ACPI: EC: interrupt blocked
[    0.258241] ACPI: EC: EC_CMD/EC_SC=0x66, EC_DATA=0x62
[    0.258329] ACPI: \_SB_.PCI0.LPCB.EC0_: Boot DSDT EC used to handle transactions
[    0.258434] ACPI: Interpreter enabled
[    0.258560] ACPI: PM: (supports S0 S3 S4 S5)
[    0.258643] ACPI: Using IOAPIC for interrupt routing
[    0.258778] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.259364] ACPI: Enabled 10 GPEs in block 00 to 1F
[    0.301185] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.301286] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI EDR HPX-Type3]
[    0.301410] acpi PNP0A08:00: _OSC: OS requested [PCIeHotplug PME AER PCIeCapability LTR DPC]
[    0.301520] acpi PNP0A08:00: _OSC: platform willing to grant [PCIeHotplug PME AER PCIeCapability LTR DPC]
[    0.301630] acpi PNP0A08:00: _OSC: platform retains control of PCIe features (AE_NOT_FOUND)
[    0.302694] PCI host bridge to bus 0000:00
[    0.302777] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7 window]
[    0.302866] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff window]
[    0.302953] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
[    0.303058] pci_bus 0000:00: root bus resource [mem 0x000d0000-0x000dbfff window]
[    0.303132] pci_bus 0000:00: root bus resource [mem 0x60000000-0xfebfffff window]
[    0.303238] pci_bus 0000:00: root bus resource [mem 0xfed40000-0xfed44fff window]
[    0.303343] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.303456] pci 0000:00:00.0: [8086:27a0] type 00 class 0x060000
[    0.303809] pci 0000:00:02.0: [8086:27a2] type 00 class 0x030000
[    0.303912] pci 0000:00:02.0: reg 0x10: [mem 0xd0200000-0xd027ffff]
[    0.304006] pci 0000:00:02.0: reg 0x14: [io  0x1800-0x1807]
[    0.304139] pci 0000:00:02.0: reg 0x18: [mem 0xc0000000-0xcfffffff pref]
[    0.304233] pci 0000:00:02.0: reg 0x1c: [mem 0xd0300000-0xd033ffff]
[    0.304353] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
[    0.304672] pci 0000:00:02.1: [8086:27a6] type 00 class 0x038000
[    0.304772] pci 0000:00:02.1: reg 0x10: [mem 0xd0280000-0xd02fffff]
[    0.305109] pci 0000:00:1b.0: [8086:27d8] type 00 class 0x040300
[    0.305165] pci 0000:00:1b.0: reg 0x10: [mem 0xd0340000-0xd0343fff 64bit]
[    0.305417] pci 0000:00:1b.0: PME# supported from D0 D3hot D3cold
[    0.305750] pci 0000:00:1c.0: [8086:27d0] type 01 class 0x060400
[    0.306017] pci 0000:00:1c.0: PME# supported from D0 D3hot D3cold
[    0.306387] pci 0000:00:1c.2: [8086:27d4] type 01 class 0x060400
[    0.306653] pci 0000:00:1c.2: PME# supported from D0 D3hot D3cold
[    0.306991] pci 0000:00:1d.0: [8086:27c8] type 00 class 0x0c0300
[    0.307211] pci 0000:00:1d.0: reg 0x20: [io  0x1820-0x183f]
[    0.307537] pci 0000:00:1d.1: [8086:27c9] type 00 class 0x0c0300
[    0.307704] pci 0000:00:1d.1: reg 0x20: [io  0x1840-0x185f]
[    0.308018] pci 0000:00:1d.2: [8086:27ca] type 00 class 0x0c0300
[    0.308197] pci 0000:00:1d.2: reg 0x20: [io  0x1860-0x187f]
[    0.308535] pci 0000:00:1d.7: [8086:27cc] type 00 class 0x0c0320
[    0.308648] pci 0000:00:1d.7: reg 0x10: [mem 0xd0544000-0xd05443ff]
[    0.308877] pci 0000:00:1d.7: PME# supported from D0 D3hot D3cold
[    0.309181] pci 0000:00:1e.0: [8086:2448] type 01 class 0x060401
[    0.309576] pci 0000:00:1f.0: [8086:27b9] type 00 class 0x060100
[    0.309795] pci 0000:00:1f.0: quirk: [io  0x1000-0x107f] claimed by ICH6 ACPI/GPIO/TCO
[    0.309908] pci 0000:00:1f.0: quirk: [io  0x1180-0x11bf] claimed by ICH6 GPIO
[    0.309998] pci 0000:00:1f.0: ICH7 LPC Generic IO decode 1 PIO at 0900 (mask 007f)
[    0.310352] pci 0000:00:1f.1: [8086:27df] type 00 class 0x01018a
[    0.310466] pci 0000:00:1f.1: reg 0x10: [io  0x0000-0x0007]
[    0.310565] pci 0000:00:1f.1: reg 0x14: [io  0x0000-0x0003]
[    0.310662] pci 0000:00:1f.1: reg 0x18: [io  0x0000-0x0007]
[    0.310759] pci 0000:00:1f.1: reg 0x1c: [io  0x0000-0x0003]
[    0.310856] pci 0000:00:1f.1: reg 0x20: [io  0x1810-0x181f]
[    0.310972] pci 0000:00:1f.1: legacy IDE quirk: reg 0x10: [io  0x01f0-0x01f7]
[    0.311059] pci 0000:00:1f.1: legacy IDE quirk: reg 0x14: [io  0x03f6]
[    0.311132] pci 0000:00:1f.1: legacy IDE quirk: reg 0x18: [io  0x0170-0x0177]
[    0.311219] pci 0000:00:1f.1: legacy IDE quirk: reg 0x1c: [io  0x0376]
[    0.311502] pci 0000:00:1f.3: [8086:27da] type 00 class 0x0c0500
[    0.311676] pci 0000:00:1f.3: reg 0x20: [io  0x18a0-0x18bf]
[    0.312102] pci 0000:00:1c.0: PCI bridge to [bus 02]
[    0.312478] pci 0000:03:00.0: [8086:4222] type 00 class 0x028000
[    0.312681] pci 0000:03:00.0: reg 0x10: [mem 0xd0000000-0xd0000fff]
[    0.313322] pci 0000:03:00.0: PME# supported from D0 D3hot D3cold
[    0.313861] pci 0000:03:00.0: disabling ASPM on pre-1.1 PCIe device.  You can enable it with 'pcie_aspm=force'
[    0.314063] pci 0000:00:1c.2: PCI bridge to [bus 03]
[    0.314140] pci 0000:00:1c.2:   bridge window [mem 0xd0000000-0xd00fffff]
[    0.314272] pci_bus 0000:04: extended config space not accessible
[    0.314457] pci 0000:04:01.0: [10ec:8139] type 00 class 0x020000
[    0.314575] pci 0000:04:01.0: reg 0x10: [io  0x2000-0x20ff]
[    0.314676] pci 0000:04:01.0: reg 0x14: [mem 0xd0100000-0xd01000ff]
[    0.314903] pci 0000:04:01.0: supports D1 D2
[    0.314984] pci 0000:04:01.0: PME# supported from D1 D2 D3hot D3cold
[    0.315316] pci 0000:04:05.0: [1180:0476] type 02 class 0x060700
[    0.315431] pci 0000:04:05.0: reg 0x10: [mem 0xd0101000-0xd0101fff]
[    0.315579] pci 0000:04:05.0: supports D1 D2
[    0.315659] pci 0000:04:05.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.315952] pci 0000:04:05.1: [1180:0822] type 00 class 0x080500
[    0.316068] pci 0000:04:05.1: reg 0x10: [mem 0xd0100400-0xd01004ff]
[    0.316277] pci 0000:04:05.1: supports D1 D2
[    0.316358] pci 0000:04:05.1: PME# supported from D0 D1 D2 D3hot D3cold
[    0.316640] pci 0000:00:1e.0: PCI bridge to [bus 04-05] (subtractive decode)
[    0.316733] pci 0000:00:1e.0:   bridge window [io  0x2000-0x2fff]
[    0.316823] pci 0000:00:1e.0:   bridge window [mem 0xd0100000-0xd01fffff]
[    0.316918] pci 0000:00:1e.0:   bridge window [io  0x0000-0x0cf7 window] (subtractive decode)
[    0.317026] pci 0000:00:1e.0:   bridge window [io  0x0d00-0xffff window] (subtractive decode)
[    0.317132] pci 0000:00:1e.0:   bridge window [mem 0x000a0000-0x000bffff window] (subtractive decode)
[    0.317242] pci 0000:00:1e.0:   bridge window [mem 0x000d0000-0x000dbfff window] (subtractive decode)
[    0.317353] pci 0000:00:1e.0:   bridge window [mem 0x60000000-0xfebfffff window] (subtractive decode)
[    0.317462] pci 0000:00:1e.0:   bridge window [mem 0xfed40000-0xfed44fff window] (subtractive decode)
[    0.318183] pci_bus 0000:05: extended config space not accessible
[    0.318318] pci_bus 0000:05: busn_res: [bus 05] end can not be updated to 08
[    0.318414] pci 0000:00:1e.0: bridge has subordinate 05 but max busn 08
[    0.322713] ACPI: PCI: Interrupt link LNKA configured for IRQ 5
[    0.322931] ACPI: PCI: Interrupt link LNKB configured for IRQ 11
[    0.323172] ACPI: PCI: Interrupt link LNKC configured for IRQ 7
[    0.323389] ACPI: PCI: Interrupt link LNKD configured for IRQ 11
[    0.323596] ACPI: PCI: Interrupt link LNKE configured for IRQ 11
[    0.323803] ACPI: PCI: Interrupt link LNKF configured for IRQ 0
[    0.323888] ACPI: PCI: Interrupt link LNKF disabled
[    0.324089] ACPI: PCI: Interrupt link LNKG configured for IRQ 11
[    0.324256] ACPI: PCI: Interrupt link LNKH configured for IRQ 10
[    0.325153] ACPI: EC: interrupt unblocked
[    0.325234] ACPI: EC: event unblocked
[    0.325317] ACPI: EC: EC_CMD/EC_SC=0x66, EC_DATA=0x62
[    0.325398] ACPI: EC: GPE=0x1d
[    0.325476] ACPI: \_SB_.PCI0.LPCB.EC0_: Boot DSDT EC initialization complete
[    0.325565] ACPI: \_SB_.PCI0.LPCB.EC0_: EC: Used to handle transactions and events
[    0.325874] iommu: Default domain type: Translated 
[    0.325874] iommu: DMA domain TLB invalidation policy: lazy mode 
[    0.325874] SCSI subsystem initialized
[    0.326192] libata version 3.00 loaded.
[    0.326203] ACPI: bus type USB registered
[    0.326337] usbcore: registered new interface driver usbfs
[    0.326443] usbcore: registered new interface driver hub
[    0.327172] usbcore: registered new device driver usb
[    0.327295] pps_core: LinuxPPS API ver. 1 registered
[    0.327376] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.327490] PTP clock support registered
[    0.327616] EDAC MC: Ver: 3.0.0
[    0.328653] PCI: Using ACPI for IRQ routing
[    0.342278] PCI: pci_cache_line_size set to 64 bytes
[    0.342382] e820: reserve RAM buffer [mem 0x0009f800-0x0009ffff]
[    0.342388] e820: reserve RAM buffer [mem 0x5f670000-0x5fffffff]
[    0.343163] pci 0000:00:02.0: vgaarb: setting as boot VGA device
[    0.343234] pci 0000:00:02.0: vgaarb: bridge control possible
[    0.343317] pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
[    0.343435] vgaarb: loaded
[    0.343520] hpet: 3 channels of 0 reserved for per-cpu timers
[    0.343520] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[    0.343520] hpet0: 3 comparators, 64-bit 14.318180 MHz counter
[    0.345199] clocksource: Switched to clocksource tsc-early
[    0.367478] VFS: Disk quotas dquot_6.6.0
[    0.367616] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.367884] pnp: PnP ACPI init
[    0.372622] pnp 00:00: disabling [mem 0x000ce600-0x000ce7ff] because it overlaps 0000:00:02.0 BAR 6 [mem 0x000c0000-0x000dffff]
[    0.372748] pnp 00:00: disabling [mem 0x000cf800-0x000cffff] because it overlaps 0000:00:02.0 BAR 6 [mem 0x000c0000-0x000dffff]
[    0.373411] system 00:01: [io  0x0900-0x091f] has been reserved
[    0.373501] system 00:01: [io  0x092c-0x097f] has been reserved
[    0.373587] system 00:01: [io  0xfe00-0xfe01] has been reserved
[    0.373672] system 00:01: [mem 0xff000000-0xffffffff] has been reserved
[    0.374152] system 00:02: [io  0x0800-0x080f] has been reserved
[    0.374241] system 00:02: [io  0x1000-0x107f] has been reserved
[    0.374327] system 00:02: [io  0x1180-0x11bf] has been reserved
[    0.374413] system 00:02: [mem 0xe0000000-0xefffffff] has been reserved
[    0.374500] system 00:02: [mem 0xfed14000-0xfed17fff] has been reserved
[    0.374587] system 00:02: [mem 0xfed18000-0xfed18fff] has been reserved
[    0.374674] system 00:02: [mem 0xfed19000-0xfed19fff] has been reserved
[    0.374761] system 00:02: [mem 0xfed1c000-0xfed1ffff] has been reserved
[    0.374863] system 00:02: [mem 0xfed20000-0xfed3ffff] has been reserved
[    0.374951] system 00:02: [mem 0xfed45000-0xfed8ffff] has been reserved
[    0.375038] system 00:02: [mem 0xfef00000-0xfef03fff] has been reserved
[    0.378451] pnp: PnP ACPI: found 7 devices
[    0.387559] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
[    0.387910] NET: Registered PF_INET protocol family
[    0.388218] IP idents hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.390804] tcp_listen_portaddr_hash hash table entries: 1024 (order: 2, 16384 bytes, linear)
[    0.390956] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.391104] TCP established hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.391354] TCP bind hash table entries: 16384 (order: 6, 262144 bytes, linear)
[    0.391701] TCP: Hash tables configured (established 16384 bind 16384)
[    0.392027] MPTCP token hash table entries: 2048 (order: 3, 49152 bytes, linear)
[    0.392192] UDP hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.392313] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes, linear)
[    0.392539] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.393131] RPC: Registered named UNIX socket transport module.
[    0.393218] RPC: Registered udp transport module.
[    0.393298] RPC: Registered tcp transport module.
[    0.393378] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.393463] NET: Registered PF_XDP protocol family
[    0.393564] pci 0000:00:1c.0: bridge window [io  0x1000-0x0fff] to [bus 02] add_size 1000
[    0.393681] pci 0000:00:1c.0: bridge window [mem 0x00100000-0x000fffff 64bit pref] to [bus 02] add_size 200000 add_align 100000
[    0.393802] pci 0000:00:1c.0: bridge window [mem 0x00100000-0x000fffff] to [bus 02] add_size 200000 add_align 100000
[    0.393921] pci 0000:00:1c.2: bridge window [io  0x1000-0x0fff] to [bus 03] add_size 1000
[    0.394030] pci 0000:00:1c.2: bridge window [mem 0x00100000-0x000fffff 64bit pref] to [bus 03] add_size 200000 add_align 100000
[    0.394209] pci 0000:00:1c.0: BAR 14: assigned [mem 0x60000000-0x601fffff]
[    0.394307] pci 0000:00:1c.0: BAR 15: assigned [mem 0x60200000-0x603fffff 64bit pref]
[    0.394423] pci 0000:00:1c.2: BAR 15: assigned [mem 0x60400000-0x605fffff 64bit pref]
[    0.394534] pci 0000:00:1c.0: BAR 13: assigned [io  0x3000-0x3fff]
[    0.394622] pci 0000:00:1c.2: BAR 13: assigned [io  0x4000-0x4fff]
[    0.394713] pci 0000:00:1c.0: PCI bridge to [bus 02]
[    0.394798] pci 0000:00:1c.0:   bridge window [io  0x3000-0x3fff]
[    0.394888] pci 0000:00:1c.0:   bridge window [mem 0x60000000-0x601fffff]
[    0.394980] pci 0000:00:1c.0:   bridge window [mem 0x60200000-0x603fffff 64bit pref]
[    0.395100] pci 0000:00:1c.2: PCI bridge to [bus 03]
[    0.395185] pci 0000:00:1c.2:   bridge window [io  0x4000-0x4fff]
[    0.395276] pci 0000:00:1c.2:   bridge window [mem 0xd0000000-0xd00fffff]
[    0.395366] pci 0000:00:1c.2:   bridge window [mem 0x60400000-0x605fffff 64bit pref]
[    0.395488] pci 0000:04:05.0: BAR 15: assigned [mem 0x64000000-0x67ffffff pref]
[    0.395597] pci 0000:04:05.0: BAR 16: assigned [mem 0x68000000-0x6bffffff]
[    0.395685] pci 0000:04:05.0: BAR 13: assigned [io  0x2400-0x24ff]
[    0.395771] pci 0000:04:05.0: BAR 14: assigned [io  0x2800-0x28ff]
[    0.395858] pci 0000:04:05.0: CardBus bridge to [bus 05]
[    0.395940] pci 0000:04:05.0:   bridge window [io  0x2400-0x24ff]
[    0.396028] pci 0000:04:05.0:   bridge window [io  0x2800-0x28ff]
[    0.396122] pci 0000:04:05.0:   bridge window [mem 0x64000000-0x67ffffff pref]
[    0.396232] pci 0000:04:05.0:   bridge window [mem 0x68000000-0x6bffffff]
[    0.396323] pci 0000:00:1e.0: PCI bridge to [bus 04-05]
[    0.396407] pci 0000:00:1e.0:   bridge window [io  0x2000-0x2fff]
[    0.396498] pci 0000:00:1e.0:   bridge window [mem 0xd0100000-0xd01fffff]
[    0.396597] pci_bus 0000:00: resource 4 [io  0x0000-0x0cf7 window]
[    0.396682] pci_bus 0000:00: resource 5 [io  0x0d00-0xffff window]
[    0.396767] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff window]
[    0.396855] pci_bus 0000:00: resource 7 [mem 0x000d0000-0x000dbfff window]
[    0.396942] pci_bus 0000:00: resource 8 [mem 0x60000000-0xfebfffff window]
[    0.397029] pci_bus 0000:00: resource 9 [mem 0xfed40000-0xfed44fff window]
[    0.397136] pci_bus 0000:02: resource 0 [io  0x3000-0x3fff]
[    0.397221] pci_bus 0000:02: resource 1 [mem 0x60000000-0x601fffff]
[    0.397306] pci_bus 0000:02: resource 2 [mem 0x60200000-0x603fffff 64bit pref]
[    0.397412] pci_bus 0000:03: resource 0 [io  0x4000-0x4fff]
[    0.397495] pci_bus 0000:03: resource 1 [mem 0xd0000000-0xd00fffff]
[    0.397580] pci_bus 0000:03: resource 2 [mem 0x60400000-0x605fffff 64bit pref]
[    0.397686] pci_bus 0000:04: resource 0 [io  0x2000-0x2fff]
[    0.397769] pci_bus 0000:04: resource 1 [mem 0xd0100000-0xd01fffff]
[    0.397855] pci_bus 0000:04: resource 4 [io  0x0000-0x0cf7 window]
[    0.397940] pci_bus 0000:04: resource 5 [io  0x0d00-0xffff window]
[    0.398025] pci_bus 0000:04: resource 6 [mem 0x000a0000-0x000bffff window]
[    0.398118] pci_bus 0000:04: resource 7 [mem 0x000d0000-0x000dbfff window]
[    0.398205] pci_bus 0000:04: resource 8 [mem 0x60000000-0xfebfffff window]
[    0.398292] pci_bus 0000:04: resource 9 [mem 0xfed40000-0xfed44fff window]
[    0.398379] pci_bus 0000:05: resource 0 [io  0x2400-0x24ff]
[    0.398462] pci_bus 0000:05: resource 1 [io  0x2800-0x28ff]
[    0.398546] pci_bus 0000:05: resource 2 [mem 0x64000000-0x67ffffff pref]
[    0.398633] pci_bus 0000:05: resource 3 [mem 0x68000000-0x6bffffff]
[    0.400036] PCI: CLS 64 bytes, default 64
[    0.400731] Trying to unpack rootfs image as initramfs...
[    0.417812] Initialise system trusted keyrings
[    0.417945] Key type blacklist registered
[    0.423889] workingset: timestamp_bits=40 max_order=19 bucket_order=0
[    0.429543] zbud: loaded
[    0.435390] NFS: Registering the id_resolver key type
[    0.435493] Key type id_resolver registered
[    0.435573] Key type id_legacy registered
[    0.435711] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.435803] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.435919] romfs: ROMFS MTD (C) 2007 Red Hat, Inc.
[    0.480045] xor: measuring software checksum speed
[    0.488829]    prefetch64-sse  :  5778 MB/sec
[    0.492077]    generic_sse     :  4922 MB/sec
[    0.492160] xor: using function: prefetch64-sse (5778 MB/sec)
[    0.492247] async_tx: api initialized (async)
[    0.492330] Key type asymmetric registered
[    0.492409] Asymmetric key parser 'x509' registered
[    1.170103] Freeing initrd memory: 16764K
[    1.177991] alg: self-tests for CTR-KDF (hmac(sha256)) passed
[    1.178154] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[    1.179353] io scheduler mq-deadline registered
[    1.179892] atomic64_test: passed for x86-64 platform with CX8 and with SSE
[    1.181199] Monitor-Mwait will be used to enter C-1 state
[    1.181231] Monitor-Mwait will be used to enter C-2 state
[    1.181254] Monitor-Mwait will be used to enter C-3 state
[    1.181269] ACPI: \_PR_.CPU0: Found 3 idle states
[    1.188573] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    1.197165] brd: module loaded
[    1.198525] ata_piix 0000:00:1f.1: version 2.13
[    1.200119] scsi host0: ata_piix
[    1.200646] scsi host1: ata_piix
[    1.200821] ata1: PATA max UDMA/100 cmd 0x1f0 ctl 0x3f6 bmdma 0x1810 irq 14
[    1.200910] ata2: PATA max UDMA/100 cmd 0x170 ctl 0x376 bmdma 0x1818 irq 15
[    1.203004] i8042: PNP: PS/2 Controller [PNP0303:K106,PNP0f13:MOU3] at 0x60,0x64 irq 1,12
[    1.205309] i8042: Detected active multiplexing controller, rev 1.1
[    1.207267] serio: i8042 KBD port at 0x60,0x64 irq 1
[    1.207445] serio: i8042 AUX0 port at 0x60,0x64 irq 12
[    1.207602] serio: i8042 AUX1 port at 0x60,0x64 irq 12
[    1.207755] serio: i8042 AUX2 port at 0x60,0x64 irq 12
[    1.207909] serio: i8042 AUX3 port at 0x60,0x64 irq 12
[    1.208263] mousedev: PS/2 mouse device common for all mice
[    1.208466] rtc_cmos 00:03: RTC can wake from S4
[    1.209037] rtc_cmos 00:03: registered as rtc0
[    1.209180] rtc_cmos 00:03: alarms up to one month, y3k, 242 bytes nvram, hpet irqs
[    1.209541] device-mapper: uevent: version 1.0.3
[    1.209808] device-mapper: ioctl: 4.46.0-ioctl (2022-02-22) initialised: dm-devel@redhat.com
[    1.209925] intel_pstate: CPU model not supported
[    1.210475] Initializing XFRM netlink socket
[    1.210566] NET: Registered PF_PACKET protocol family
[    1.210804] Key type dns_resolver registered
[    1.211400] microcode: sig=0x6f2, pf=0x20, revision=0x57
[    1.211562] microcode: Microcode Update Driver: v2.2.
[    1.211573] IPI shorthand broadcast: enabled
[    1.211757] sched_clock: Marking stable (1217420869, -5872009)->(1271923813, -60374953)
[    1.212225] registered taskstats version 1
[    1.212312] Loading compiled-in X.509 certificates
[    1.212633] zswap: loaded using pool lzo/zbud
[    1.213049] Key type ._fscrypt registered
[    1.213141] Key type .fscrypt registered
[    1.213222] Key type fscrypt-provisioning registered
[    1.220728] Key type encrypted registered
[    1.228532] RAS: Correctable Errors collector initialized.
[    1.239699] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0
[    1.357128] ata1.00: ATA-6: TOSHIBA MK8032GAX, AD002F, max UDMA/100
[    1.357234] ata1.00: 156301488 sectors, multi 16: LBA48 
[    1.434179] tsc: Refined TSC clocksource calibration: 1063.999 MHz
[    1.434271] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0xf5640911f0, max_idle_ns: 440795216274 ns
[    1.434414] clocksource: Switched to clocksource tsc
[    4.250213] floppy0: no floppy controllers found
[    4.250759] scsi 0:0:0:0: Direct-Access     ATA      TOSHIBA MK8032GA 2F   PQ: 0 ANSI: 5
[    4.251615] sd 0:0:0:0: [sda] 156301488 512-byte logical blocks: (80.0 GB/74.5 GiB)
[    4.251762] sd 0:0:0:0: [sda] Write Protect is off
[    4.251851] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    4.251923] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    4.300997]  sda: sda1 sda2 sda4 < sda5 >
[    4.307343] sd 0:0:0:0: [sda] Attached SCSI disk
[    4.312211] Freeing unused decrypted memory: 2036K
[    4.313872] Freeing unused kernel image (initmem) memory: 1652K
[    4.314047] Write protecting the kernel read-only data: 22528k
[    4.316477] Freeing unused kernel image (text/rodata gap) memory: 2036K
[    4.318061] Freeing unused kernel image (rodata/data gap) memory: 1464K
[    4.318258] rodata_test: all tests were successful
[    4.318377] Run /init as init process
[    4.318454]   with arguments:
[    4.318457]     /init
[    4.318459]   with environment:
[    4.318462]     HOME=/
[    4.318464]     TERM=linux
[    4.318467]     BOOT_IMAGE=pcc
[    4.798147] random: crng init done
[    4.826567] udevd[176]: starting eudev-3.2.11
[    8.147103] EXT4-fs (dm-0): mounted filesystem with ordered data mode. Quota mode: none.
[   10.208339] loop: module loaded
[   12.828732] udevd[643]: starting eudev-3.2.11
[   13.706738] input: Lid Switch as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input5
[   13.710210] ACPI: button: Lid Switch [LID]
[   13.710416] input: Power Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input6
[   13.710590] ACPI: button: Power Button [PWRB]
[   13.710848] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input7
[   13.718312] ACPI: button: Power Button [PWRF]
[   13.907480] Linux agpgart interface v0.103
[   13.917414] ACPI: AC: AC Adapter [AC] (on-line)
[   14.266117] ACPI: video: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
[   14.269116] acpi device:02: registered as cooling_device2
[   14.269966] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input8
[   14.354625] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   14.659096] ehci-pci: EHCI PCI platform driver
[   14.659648] ehci-pci 0000:00:1d.7: EHCI Host Controller
[   14.659963] ehci-pci 0000:00:1d.7: new USB bus registered, assigned bus number 1
[   14.660108] ehci-pci 0000:00:1d.7: debug port 1
[   14.664202] ehci-pci 0000:00:1d.7: irq 23, io mem 0xd0544000
[   14.671181] ehci-pci 0000:00:1d.7: USB 2.0 started, EHCI 1.00
[   14.671423] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.18
[   14.671543] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   14.671654] usb usb1: Product: EHCI Host Controller
[   14.671741] usb usb1: Manufacturer: Linux 5.18.5-pcc ehci_hcd
[   14.671830] usb usb1: SerialNumber: 0000:00:1d.7
[   14.672333] hub 1-0:1.0: USB hub found
[   14.672444] hub 1-0:1.0: 6 ports detected
[   15.017355] input: Panasonic Laptop Support as /devices/virtual/input/input9
[   15.021476] BUG: kernel NULL pointer dereference, address: 0000000000000000
[   15.021580] #PF: supervisor write access in kernel mode
[   15.021669] #PF: error_code(0x0002) - not-present page
[   15.021757] PGD 80000000070cd067 P4D 80000000070cd067 PUD 70ce067 PMD 0 
[   15.021860] Oops: 0002 [#1] PREEMPT SMP PTI
[   15.021950] CPU: 1 PID: 646 Comm: udevd Not tainted 5.18.5-pcc #1
[   15.022043] Hardware name: Matsushita Electric Industrial Co.,Ltd. CF-W5AWDBJR/CFW5-4, BIOS V4.00L10 04/06/2007
[   15.022159] RIP: 0010:acpi_pcc_hotkey_add+0x16a/0x380 [panasonic_laptop]
[   15.022264] Code: bc f7 ff ff 85 c0 0f 84 22 02 00 00 e8 df 75 fa ff 83 f8 02 0f 84 e8 00 00 00 48 8b 43 40 48 8b 53 28 be 80 00 00 00 8b 52 10 <89> 10 48 8b 3b 31 d2 e8 ea fd ff ff 48 8b 43 28 c7 43 10 00 00 00
[   15.022424] RSP: 0000:ffffa95b806dfc68 EFLAGS: 00010297
[   15.022516] RAX: 0000000000000000 RBX: ffff8cd245d5ab40 RCX: 0000000000035701
[   15.022609] RDX: 0000000000000015 RSI: 0000000000000080 RDI: ffffffffc03bf1e0
[   15.022701] RBP: 0000000000000000 R08: 0000000000000001 R09: ffffffff86649f01
[   15.022792] R10: 0000000000000000 R11: 000000000000005f R12: ffff8cd24182c800
[   15.022884] R13: ffff8cd243f6d800 R14: ffff8cd2427707e8 R15: 0000000000000000
[   15.022977] FS:  00007fe042c3abc0(0000) GS:ffff8cd298500000(0000) knlGS:0000000000000000
[   15.023090] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   15.023180] CR2: 0000000000000000 CR3: 0000000005d2e000 CR4: 00000000000006e0
[   15.023272] Call Trace:
[   15.023354]  <TASK>
[   15.023435]  acpi_device_probe+0x46/0x100
[   15.023530]  really_probe.part.0+0xb4/0x230
[   15.023620]  __driver_probe_device+0x8e/0x110
[   15.023708]  driver_probe_device+0x1f/0xe0
[   15.023795]  __driver_attach+0xaa/0x160
[   15.023881]  ? __device_attach_driver+0xe0/0xe0
[   15.023969]  bus_for_each_dev+0x72/0xb0
[   15.024055]  bus_add_driver+0x183/0x1d0
[   15.024141]  driver_register+0x89/0xd0
[   15.024228]  ? 0xffffffffc0416000
[   15.024311]  do_one_initcall+0x44/0x200
[   15.024399]  ? do_init_module+0x22/0x250
[   15.024489]  ? kmem_cache_alloc_trace+0x160/0x290
[   15.024580]  do_init_module+0x4a/0x250
[   15.024668]  __do_sys_finit_module+0x9e/0xf0
[   15.024761]  do_syscall_64+0x3a/0x80
[   15.024848]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[   15.024941] RIP: 0033:0x7fe042b15d49
[   15.025026] Code: 08 44 89 e0 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d b7 50 0f 00 f7 d8 64 89 01 48
[   15.025183] RSP: 002b:00007ffcb65443e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[   15.025298] RAX: ffffffffffffffda RBX: 00000000017ac870 RCX: 00007fe042b15d49
[   15.025390] RDX: 0000000000000000 RSI: 00007fe042c98a9d RDI: 0000000000000008
[   15.025483] RBP: 0000000000020000 R08: 0000000000000000 R09: 00000000004312bc
[   15.025575] R10: 0000000000000008 R11: 0000000000000246 R12: 00007fe042c98a9d
[   15.025667] R13: 0000000000000000 R14: 00000000017939b0 R15: 00000000017ac870
[   15.025762]  </TASK>
[   15.025840] Modules linked in: panasonic_laptop(+) acpi_thermal_rel sysimgblt i2c_core ehci_pci int340x_thermal_zone sparse_keymap intel_agp ehci_hcd intel_gtt video ac agpgart button acpi_cpufreq loop dm_snapshot dm_bufio ext4 mbcache jbd2
[   15.026078] CR2: 0000000000000000
[   15.026175] ---[ end trace 0000000000000000 ]---
[   15.026262] RIP: 0010:acpi_pcc_hotkey_add+0x16a/0x380 [panasonic_laptop]
[   15.027380] Code: bc f7 ff ff 85 c0 0f 84 22 02 00 00 e8 df 75 fa ff 83 f8 02 0f 84 e8 00 00 00 48 8b 43 40 48 8b 53 28 be 80 00 00 00 8b 52 10 <89> 10 48 8b 3b 31 d2 e8 ea fd ff ff 48 8b 43 28 c7 43 10 00 00 00
[   15.027536] RSP: 0000:ffffa95b806dfc68 EFLAGS: 00010297
[   15.027627] RAX: 0000000000000000 RBX: ffff8cd245d5ab40 RCX: 0000000000035701
[   15.027719] RDX: 0000000000000015 RSI: 0000000000000080 RDI: ffffffffc03bf1e0
[   15.027811] RBP: 0000000000000000 R08: 0000000000000001 R09: ffffffff86649f01
[   15.027903] R10: 0000000000000000 R11: 000000000000005f R12: ffff8cd24182c800
[   15.027994] R13: ffff8cd243f6d800 R14: ffff8cd2427707e8 R15: 0000000000000000
[   15.028086] FS:  00007fe042c3abc0(0000) GS:ffff8cd298500000(0000) knlGS:0000000000000000
[   15.028209] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   15.028298] CR2: 0000000000000000 CR3: 0000000005d2e000 CR4: 00000000000006e0
[   15.034239] Consider using thermal netlink events interface
[   15.037213] udevd[643]: worker [646] failed while handling '/devices/LNXSYSTM:00/LNXSYBUS:00/MAT0019:00'
[   15.120297] intel_rapl_common: driver does not support CPU family 6 model 15
[   15.204295] uhci_hcd: USB Universal Host Controller Interface driver
[   15.204659] uhci_hcd 0000:00:1d.0: UHCI Host Controller
[   15.204927] uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 2
[   15.205111] uhci_hcd 0000:00:1d.0: irq 23, io port 0x00001820
[   15.205358] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.18
[   15.205471] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   15.205578] usb usb2: Product: UHCI Host Controller
[   15.205661] usb usb2: Manufacturer: Linux 5.18.5-pcc uhci_hcd
[   15.205745] usb usb2: SerialNumber: 0000:00:1d.0
[   15.206110] hub 2-0:1.0: USB hub found
[   15.206219] hub 2-0:1.0: 2 ports detected
[   15.206889] uhci_hcd 0000:00:1d.1: UHCI Host Controller
[   15.207072] uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 3
[   15.207289] uhci_hcd 0000:00:1d.1: irq 19, io port 0x00001840
[   15.207491] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.18
[   15.207603] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   15.207709] usb usb3: Product: UHCI Host Controller
[   15.207790] usb usb3: Manufacturer: Linux 5.18.5-pcc uhci_hcd
[   15.207874] usb usb3: SerialNumber: 0000:00:1d.1
[   15.208207] hub 3-0:1.0: USB hub found
[   15.208305] hub 3-0:1.0: 2 ports detected
[   15.208875] uhci_hcd 0000:00:1d.2: UHCI Host Controller
[   15.209057] uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 4
[   15.209332] uhci_hcd 0000:00:1d.2: irq 18, io port 0x00001860
[   15.209534] usb usb4: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 5.18
[   15.209647] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[   15.209752] usb usb4: Product: UHCI Host Controller
[   15.209834] usb usb4: Manufacturer: Linux 5.18.5-pcc uhci_hcd
[   15.209917] usb usb4: SerialNumber: 0000:00:1d.2
[   15.210272] hub 4-0:1.0: USB hub found
[   15.210370] hub 4-0:1.0: 2 ports detected
[   15.448624] tpm_tis 00:04: 1.2 TPM (device-id 0xB, rev-id 16)
[   15.452837] tpm tpm0: [Hardware Error]: Adjusting reported timeouts: A 750->750000us B 2000->2000000us C 750->750000us D 750->750000us
[   15.460150] tpm tpm0: Operation Timed out
[   15.465271] tpm tpm0: Operation Timed out
[   15.465357] tpm tpm0: Adjusting TPM timeout parameters.
[   15.549326] intel_rng: FWH not detected
[   15.549655] ACPI: battery: Slot [BATA] (battery present)
[   15.623473] thermal LNXTHERM:00: registered as thermal_zone4
[   15.623574] ACPI: thermal: Thermal Zone [TZ00] (59 C)
[   15.625583] thermal LNXTHERM:01: registered as thermal_zone5
[   15.625671] ACPI: thermal: Thermal Zone [TZ01] (66 C)
[   15.668160] intel_rapl_common: driver does not support CPU family 6 model 15
[   17.148976] i801_smbus 0000:00:1f.3: SMBus using PCI interrupt
[   17.150929] i2c i2c-0: Different memory types mixed, not instantiating SPD
[   17.440812] yenta_cardbus 0000:04:05.0: CardBus bridge found [10f7:8338]
[   17.572026] yenta_cardbus 0000:04:05.0: ISA IRQ mask 0x0cb8, PCI irq 22
[   17.572156] yenta_cardbus 0000:04:05.0: Socket status: 30000006
[   17.572261] yenta_cardbus 0000:04:05.0: pcmcia: parent PCI bridge window: [io  0x2000-0x2fff]
[   17.572380] yenta_cardbus 0000:04:05.0: pcmcia: parent PCI bridge window: [mem 0xd0100000-0xd01fffff]
[   17.572498] pcmcia_socket pcmcia_socket0: cs: memory probe 0xd0100000-0xd01fffff:
[   17.572634]  excluding 0xd0100000-0xd010ffff
[   17.629069] ACPI Warning: SystemIO range 0x0000000000001028-0x000000000000102F conflicts with OpRegion 0x0000000000001000-0x000000000000107F (\PMIO) (20211217/utaddress-204)
[   17.629271] ACPI: OSL: Resource conflict; ACPI support missing from driver?
[   17.629446] lpc_ich: Resource conflict(s) found affecting gpio_ich
[   18.093023] 8139too: 8139too Fast Ethernet driver 0.9.28
[   18.094620] 8139too 0000:04:01.0 eth0: RealTek RTL8139 at 0x0000000024d3f29a, 00:0b:97:da:b6:26, IRQ 19
[   18.753111] psmouse serio4: synaptics: Touchpad model: 1, fw: 6.2, id: 0x39a0b2, caps: 0xa04753/0x200000/0x0/0x0, board id: 0, fw id: 177011
[   18.790693] input: SynPS/2 Synaptics TouchPad as /devices/platform/i8042/serio4/input/input13
[   19.589984] leds_ss4200: no LED devices found
[   21.241821] ACPI: bus type drm_connector registered
[   23.445436] sdhci: Secure Digital Host Controller Interface driver
[   23.445548] sdhci: Copyright(c) Pierre Ossman
[   23.756146] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[   23.767664] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[   24.226617] snd_hda_codec_idt hdaudioC0D0: autoconfig for STAC9200: line_outs=1 (0xe/0x0/0x0/0x0/0x0) type:speaker
[   24.226758] snd_hda_codec_idt hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[   24.226872] snd_hda_codec_idt hdaudioC0D0:    hp_outs=1 (0xd/0x0/0x0/0x0/0x0)
[   24.226966] snd_hda_codec_idt hdaudioC0D0:    mono: mono_out=0x0
[   24.227055] snd_hda_codec_idt hdaudioC0D0:    inputs:
[   24.227158] snd_hda_codec_idt hdaudioC0D0:      Mic=0x10
[   24.227248] snd_hda_codec_idt hdaudioC0D0:      CD=0x12
[   24.237839] input: HDA Intel Mic as /devices/pci0000:00/0000:00:1b.0/sound/card0/input14
[   24.238215] input: HDA Intel Front Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card0/input15
[   25.244874] sdhci-pci 0000:04:05.1: SDHCI controller found [1180:0822] (rev 13)
[   25.245393] sdhci-pci 0000:04:05.1: Will use DMA mode even though HW doesn't fully claim to support it.
[   25.245536] mmc0 bounce up to 128 segments into one, max segment size 65536 bytes
[   25.245790] sdhci-pci 0000:04:05.1: Will use DMA mode even though HW doesn't fully claim to support it.
[   25.246256] mmc0: SDHCI controller on PCI [0000:04:05.1] using DMA
[   25.246922] sdhci-pci 0000:04:05.1: Will use DMA mode even though HW doesn't fully claim to support it.
[   25.782753] coretemp coretemp.0: Using relative temperature scale!
[   25.782924] coretemp coretemp.0: Using relative temperature scale!
[   26.062675] intel_powerclamp: No package C-state available
[   26.075206] intel_powerclamp: No package C-state available
[   30.715892] iwl3945: Intel(R) PRO/Wireless 3945ABG/BG Network Connection driver for Linux, in-tree:s
[   30.716024] iwl3945: Copyright(c) 2003-2011 Intel Corporation
[   30.716111] iwl3945: hw_scan is disabled
[   30.716344] iwl3945 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
[   30.778195] iwl3945 0000:03:00.0: Tunable channels: 13 802.11bg, 12 802.11a channels
[   30.778328] iwl3945 0000:03:00.0: Detected Intel Wireless WiFi Link 3945ABG
[   30.785450] ieee80211 phy0: Selected rate control algorithm 'iwl-3945-rs'
[   36.436615] pcmcia_socket pcmcia_socket0: cs: memory probe 0x0c0000-0x0fffff:
[   36.436740]  excluding 0xc0000-0xcffff 0xdc000-0xfffff
[   36.436973] pcmcia_socket pcmcia_socket0: cs: memory probe 0x60000000-0x60ffffff:
[   36.437099]  excluding 0x60000000-0x605fffff
[   36.437384] pcmcia_socket pcmcia_socket0: cs: memory probe 0xa0000000-0xa0ffffff:
[   36.437528]  clean
[   36.504906] gpio_ich gpio_ich.2.auto: GPIO from 974 to 1023
[   44.115647] pci 0000:00:00.0: Intel 945GM Chipset
[   44.115776] pci 0000:00:00.0: detected gtt size: 262144K total, 262144K mappable
[   44.116519] pci 0000:00:00.0: detected 8192K stolen memory
[   44.116678] i915 0000:00:02.0: vgaarb: deactivate vga console
[   44.117721] Console: switching to colour dummy device 80x25
[   44.118182] resource sanity check: requesting [mem 0x000c0000-0x000dffff], which spans more than PCI Bus 0000:00 [mem 0x000d0000-0x000dbfff window]
[   44.118204] caller pci_map_rom+0x79/0x1d0 mapping multiple BARs
[   44.118753] i915 0000:00:02.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=io+mem
[   44.137634] i915 0000:00:02.0: [drm] Initialized overlay support.
[   44.138805] [drm] Initialized i915 1.6.0 20201103 for 0000:00:02.0 on minor 0
[   44.228086] fbcon: i915drmfb (fb0) is primary device
[   45.066359] Console: switching to colour frame buffer device 128x48
[   45.086437] i915 0000:00:02.0: [drm] fb0: i915drmfb frame buffer device
[  134.007476] Adding 1589244k swap on /dev/mapper/panavg-swap.  Priority:-2 extents:1 across:1589244k FS
[  134.740007] EXT4-fs (dm-0): re-mounted. Quota mode: none.
[  136.062699] EXT4-fs (dm-1): mounted filesystem with ordered data mode. Quota mode: none.
[  143.451433] NET: Registered PF_INET6 protocol family
[  143.462823] Segment Routing with IPv6
[  143.462832] RPL Segment Routing with IPv6
[  143.462868] In-situ OAM (IOAM) with IPv6
[  270.283617] iwl3945 0000:03:00.0: loaded firmware version 15.32.2.9

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys
  2022-06-24  5:14                       ` Kenneth Chan
@ 2022-06-24  9:24                         ` Hans de Goede
  0 siblings, 0 replies; 36+ messages in thread
From: Hans de Goede @ 2022-06-24  9:24 UTC (permalink / raw)
  To: Kenneth Chan
  Cc: Stefan Seyfried, Andy Shevchenko, Platform Driver,
	Linux Kernel Mailing List, Stefan Seyfried

Hi,

On 6/24/22 07:14, Kenneth Chan wrote:
> Hi Hans,
> 
> 
> On Tue, 21 Jun 2022 at 17:34, Hans de Goede <hdegoede@redhat.com> wrote:
>>
>>
>>> The mute, volume up/down keys are still duplicated by atkbd after
>>> applying 0005-platform-x86-panasonic-laptop-filter-out-duplicate-v.patch.
>>
>> Hmm, can you add a couple of:
>>
>>  pr_info("data 0x%02x\n", data);
>>
>> at the top of the new panasonic_i8042_filter() function
>> and then check in dmesg what is output for the volume keys.
>>
> 
> Volume Down 0xe0 0x2e / 0xe0 0xae
> Mute 0xe0 0x20 / 0xe0 0xa0
> Volume Up 0xe0 0x30 / 0xe0 0xb0
> 
> I replaced those values with these and it filters out the duplicate keys. Yay!!!

That is great.

>> The patch should filter out those duplicate keys, unless
>> I got the codes wrong somehow.
>>
>> Also can you please try the attached 2 patches on top of my
>> last series, this should hide the broken panasonic backlight
>> device and otherwise it should make no difference (but maybe
>> double check the duplicate brightness keys are not back.
>>
> 
> The last 2 patches crash as soon as the panasonic-laptop module is
> loaded. It's compiled against kernel v5.18.5. Please see the
> attachment. I'm going to compile it against the latest and see if it
> works.

No need to compile against the latest, I messed things up, sorry.

To fix the crash the following diff is necessary:

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 0fa7695089e2..b8fa0a64698b 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -1011,10 +1011,10 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
 			result = PTR_ERR(pcc->backlight);
 			goto out_input;
 		}
-	}
 
-	/* read the initial brightness setting from the hardware */
-	pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT];
+		/* read the initial brightness setting from the hardware */
+		pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT];
+	}
 
 	/* Reset initial sticky key mode since the hardware register state is not consistent */
 	acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, 0);

I'm going to send out a whole new version of my entire series, including
an updated i8042 filter. Please drop all my previous patches and try
the new version (I'll put on you in the Cc of the upstream submission of
the series).

Regards,

Hans




^ permalink raw reply related	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2022-06-24  9:25 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-21 18:14 [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Kenneth Chan
2020-08-21 18:14 ` [PATCH 1/9] add support for optical driver power in Y and W series Kenneth Chan
2020-11-10 14:00   ` Hans de Goede
2020-08-21 18:14 ` [PATCH 2/9] replace ACPI prints with pr_*() macros Kenneth Chan
2020-08-21 18:14 ` [PATCH 3/9] split MODULE_AUTHOR() by one author per macro call Kenneth Chan
2020-08-21 18:14 ` [PATCH 4/9] fix naming of platform files for consistency with other modules Kenneth Chan
2020-08-21 18:14 ` [PATCH 5/9] fix sticky key init bug Kenneth Chan
2020-08-21 18:14 ` [PATCH 6/9] add write support to mute Kenneth Chan
2020-08-21 18:14 ` [PATCH 7/9] resolve hotkey double trigger bug Kenneth Chan
2022-06-12  9:05   ` [PATCH 0/2] fix panasonic-laptop hotkey regression stefan.seyfried
2022-06-12  9:05     ` [PATCH 1/2] platform/x86: panasonic-laptop: de-obfuscate button codes stefan.seyfried
2022-06-12  9:05     ` [PATCH 2/2] platform/x86: panasonic-laptop: allow to use all hotkeys stefan.seyfried
2022-06-15 10:53       ` Kenneth Chan
2022-06-15 11:21       ` Andy Shevchenko
2022-06-15 11:24         ` Andy Shevchenko
2022-06-15 17:10           ` Stefan Seyfried
2022-06-15 19:28             ` Hans de Goede
2022-06-16 18:38               ` Kenneth Chan
2022-06-16 19:03               ` Andy Shevchenko
2022-06-17  7:51               ` Kenneth Chan
2022-06-17 11:07                 ` Hans de Goede
2022-06-17 13:07                   ` Stefan Seyfried
2022-06-20 15:08                     ` Hans de Goede
2022-06-20 18:10                       ` Stefan Seyfried
2022-06-21  9:26                         ` Hans de Goede
2022-06-21 10:23                           ` Stefan Seyfried
2022-06-21 17:54                             ` Stefan Seyfried
2022-06-22 10:57                               ` Hans de Goede
2022-06-20 15:21                   ` Kenneth Chan
2022-06-21  9:34                     ` Hans de Goede
2022-06-24  5:14                       ` Kenneth Chan
2022-06-24  9:24                         ` Hans de Goede
2020-08-21 18:14 ` [PATCH 8/9] add support for battery charging threshold (eco mode) Kenneth Chan
2020-08-21 18:14 ` [PATCH 9/9] add platform devices for firmware brightness registers Kenneth Chan
2020-08-22  7:29 ` [PATCH 0/9] platform/x86: panasonic-laptop: add optical drive, brightness and battery charging threshold Harald Welte
2020-08-22  8:20   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.