All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
@ 2026-03-16 19:33 Ayaan Mirza Baig
  2026-03-17 12:36 ` Ilpo Järvinen
  0 siblings, 1 reply; 13+ messages in thread
From: Ayaan Mirza Baig @ 2026-03-16 19:33 UTC (permalink / raw)
  To: platform-driver-x86; +Cc: josh, ayaanmirza788, Ayaan Mirza Baig

On Samsung Galaxy Book 5 (SAM0430), the keyboard backlight, microphone
mute, and camera block hotkeys do not generate i8042 scancodes.
Instead they arrive as ACPI notifications 0x7d, 0x63, and 0x6f
respectively, all of which previously fell through to the deafult
"unknown" warning in galaxybook_acpi_notify().

Add handling for these three events:

- 0x7d (Fn+F9, keyboard backlight): schedule the existing
  kbd_backlight_hotkey_work which cycles brightness.

- 0x6e (Fn+F10, microphone mute): register a new hotkey input device
  and emit KEY_MICMUTE.

- 0x6f (Fn+F11, camera block): if block_recording is active use the
  existing block_recording_hotkey_work; otherwise emit KEY_CAMERA via the
  hotkey input device on models where the block_recording ACPI feature is
  not supported

Tested on Samsung Galaxy Book 5 (SAM0430).

Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
---
 drivers/platform/x86/samsung-galaxybook.c | 596 +++++++++++++---------
 1 file changed, 359 insertions(+), 237 deletions(-)

diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
index 755cb82bdb60..d0d614166a4a 100644
--- a/drivers/platform/x86/samsung-galaxybook.c
+++ b/drivers/platform/x86/samsung-galaxybook.c
@@ -16,6 +16,7 @@
 #include <linux/err.h>
 #include <linux/i8042.h>
 #include <linux/init.h>
+#include <linux/input-event-codes.h>
 #include <linux/input.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
@@ -54,6 +55,7 @@ struct samsung_galaxybook {
 
 	struct work_struct block_recording_hotkey_work;
 	struct input_dev *camera_lens_cover_switch;
+	struct input_dev *hotkey_dev;
 
 	struct acpi_battery_hook battery_hook;
 
@@ -66,16 +68,16 @@ enum galaxybook_fw_attr_id {
 	GB_ATTR_BLOCK_RECORDING,
 };
 
-static const char * const galaxybook_fw_attr_name[] = {
+static const char *const galaxybook_fw_attr_name[] = {
 	[GB_ATTR_POWER_ON_LID_OPEN] = "power_on_lid_open",
-	[GB_ATTR_USB_CHARGING]      = "usb_charging",
-	[GB_ATTR_BLOCK_RECORDING]   = "block_recording",
+	[GB_ATTR_USB_CHARGING] = "usb_charging",
+	[GB_ATTR_BLOCK_RECORDING] = "block_recording",
 };
 
-static const char * const galaxybook_fw_attr_desc[] = {
+static const char *const galaxybook_fw_attr_desc[] = {
 	[GB_ATTR_POWER_ON_LID_OPEN] = "Power On Lid Open",
-	[GB_ATTR_USB_CHARGING]      = "USB Charging",
-	[GB_ATTR_BLOCK_RECORDING]   = "Block Recording",
+	[GB_ATTR_USB_CHARGING] = "USB Charging",
+	[GB_ATTR_BLOCK_RECORDING] = "Block Recording",
 };
 
 #define GB_ATTR_LANGUAGE_CODE "en_US.UTF-8"
@@ -87,7 +89,8 @@ struct galaxybook_fw_attr {
 	struct kobj_attribute display_name;
 	struct kobj_attribute current_value;
 	int (*get_value)(struct samsung_galaxybook *galaxybook, bool *value);
-	int (*set_value)(struct samsung_galaxybook *galaxybook, const bool value);
+	int (*set_value)(struct samsung_galaxybook *galaxybook,
+			 const bool value);
 };
 
 struct sawb {
@@ -121,89 +124,93 @@ struct sawb {
 	} __packed;
 } __packed;
 
-#define GB_SAWB_LEN_SETTINGS          0x15
-#define GB_SAWB_LEN_PERFORMANCE_MODE  0x100
+#define GB_SAWB_LEN_SETTINGS 0x15
+#define GB_SAWB_LEN_PERFORMANCE_MODE 0x100
 
-#define GB_SAFN  0x5843
+#define GB_SAFN 0x5843
 
-#define GB_SASB_KBD_BACKLIGHT     0x78
-#define GB_SASB_POWER_MANAGEMENT  0x7a
-#define GB_SASB_USB_CHARGING_GET  0x67
-#define GB_SASB_USB_CHARGING_SET  0x68
-#define GB_SASB_NOTIFICATIONS     0x86
-#define GB_SASB_BLOCK_RECORDING   0x8a
-#define GB_SASB_PERFORMANCE_MODE  0x91
+#define GB_SASB_KBD_BACKLIGHT 0x78
+#define GB_SASB_POWER_MANAGEMENT 0x7a
+#define GB_SASB_USB_CHARGING_GET 0x67
+#define GB_SASB_USB_CHARGING_SET 0x68
+#define GB_SASB_NOTIFICATIONS 0x86
+#define GB_SASB_BLOCK_RECORDING 0x8a
+#define GB_SASB_PERFORMANCE_MODE 0x91
 
-#define GB_SAWB_RFLG_POS     4
-#define GB_SAWB_GB_GUNM_POS  5
+#define GB_SAWB_RFLG_POS 4
+#define GB_SAWB_GB_GUNM_POS 5
 
-#define GB_RFLG_SUCCESS  0xaa
-#define GB_GUNM_FAIL     0xff
+#define GB_RFLG_SUCCESS 0xaa
+#define GB_GUNM_FAIL 0xff
 
-#define GB_GUNM_FEATURE_ENABLE          0xbb
-#define GB_GUNM_FEATURE_ENABLE_SUCCESS  0xdd
-#define GB_GUDS_FEATURE_ENABLE          0xaa
-#define GB_GUDS_FEATURE_ENABLE_SUCCESS  0xcc
+#define GB_GUNM_FEATURE_ENABLE 0xbb
+#define GB_GUNM_FEATURE_ENABLE_SUCCESS 0xdd
+#define GB_GUDS_FEATURE_ENABLE 0xaa
+#define GB_GUDS_FEATURE_ENABLE_SUCCESS 0xcc
 
-#define GB_GUNM_GET  0x81
-#define GB_GUNM_SET  0x82
+#define GB_GUNM_GET 0x81
+#define GB_GUNM_SET 0x82
 
-#define GB_GUNM_POWER_MANAGEMENT  0x82
+#define GB_GUNM_POWER_MANAGEMENT 0x82
 
-#define GB_GUNM_USB_CHARGING_GET            0x80
-#define GB_GUNM_USB_CHARGING_ON             0x81
-#define GB_GUNM_USB_CHARGING_OFF            0x80
-#define GB_GUDS_POWER_ON_LID_OPEN           0xa3
-#define GB_GUDS_POWER_ON_LID_OPEN_GET       0x81
-#define GB_GUDS_POWER_ON_LID_OPEN_SET       0x80
-#define GB_GUDS_BATTERY_CHARGE_CONTROL      0xe9
-#define GB_GUDS_BATTERY_CHARGE_CONTROL_GET  0x91
-#define GB_GUDS_BATTERY_CHARGE_CONTROL_SET  0x90
-#define GB_GUNM_ACPI_NOTIFY_ENABLE          0x80
-#define GB_GUDS_ACPI_NOTIFY_ENABLE          0x02
+#define GB_GUNM_USB_CHARGING_GET 0x80
+#define GB_GUNM_USB_CHARGING_ON 0x81
+#define GB_GUNM_USB_CHARGING_OFF 0x80
+#define GB_GUDS_POWER_ON_LID_OPEN 0xa3
+#define GB_GUDS_POWER_ON_LID_OPEN_GET 0x81
+#define GB_GUDS_POWER_ON_LID_OPEN_SET 0x80
+#define GB_GUDS_BATTERY_CHARGE_CONTROL 0xe9
+#define GB_GUDS_BATTERY_CHARGE_CONTROL_GET 0x91
+#define GB_GUDS_BATTERY_CHARGE_CONTROL_SET 0x90
+#define GB_GUNM_ACPI_NOTIFY_ENABLE 0x80
+#define GB_GUDS_ACPI_NOTIFY_ENABLE 0x02
 
-#define GB_BLOCK_RECORDING_ON   0x0
-#define GB_BLOCK_RECORDING_OFF  0x1
+#define GB_BLOCK_RECORDING_ON 0x0
+#define GB_BLOCK_RECORDING_OFF 0x1
 
-#define GB_FNCN_PERFORMANCE_MODE       0x51
-#define GB_SUBN_PERFORMANCE_MODE_LIST  0x01
-#define GB_SUBN_PERFORMANCE_MODE_GET   0x02
-#define GB_SUBN_PERFORMANCE_MODE_SET   0x03
+#define GB_FNCN_PERFORMANCE_MODE 0x51
+#define GB_SUBN_PERFORMANCE_MODE_LIST 0x01
+#define GB_SUBN_PERFORMANCE_MODE_GET 0x02
+#define GB_SUBN_PERFORMANCE_MODE_SET 0x03
 
 /* guid 8246028d-8bca-4a55-ba0f-6f1e6b921b8f */
 static const guid_t performance_mode_guid =
-	GUID_INIT(0x8246028d, 0x8bca, 0x4a55, 0xba, 0x0f, 0x6f, 0x1e, 0x6b, 0x92, 0x1b, 0x8f);
+	GUID_INIT(0x8246028d, 0x8bca, 0x4a55, 0xba, 0x0f, 0x6f, 0x1e, 0x6b,
+		  0x92, 0x1b, 0x8f);
 #define GB_PERFORMANCE_MODE_GUID performance_mode_guid
 
-#define GB_PERFORMANCE_MODE_FANOFF          0xb
-#define GB_PERFORMANCE_MODE_LOWNOISE        0xa
-#define GB_PERFORMANCE_MODE_OPTIMIZED       0x0
-#define GB_PERFORMANCE_MODE_OPTIMIZED_V2    0x2
-#define GB_PERFORMANCE_MODE_PERFORMANCE     0x1
-#define GB_PERFORMANCE_MODE_PERFORMANCE_V2  0x15
-#define GB_PERFORMANCE_MODE_ULTRA           0x16
-#define GB_PERFORMANCE_MODE_IGNORE1         0x14
-#define GB_PERFORMANCE_MODE_IGNORE2         0xc
-
-#define GB_ACPI_METHOD_ENABLE            "SDLS"
-#define GB_ACPI_METHOD_ENABLE_ON         1
-#define GB_ACPI_METHOD_ENABLE_OFF        0
-#define GB_ACPI_METHOD_SETTINGS          "CSFI"
-#define GB_ACPI_METHOD_PERFORMANCE_MODE  "CSXI"
-
-#define GB_KBD_BACKLIGHT_MAX_BRIGHTNESS  3
-
-#define GB_ACPI_NOTIFY_BATTERY_STATE_CHANGED    0x61
-#define GB_ACPI_NOTIFY_DEVICE_ON_TABLE          0x6c
-#define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE         0x6d
-#define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE  0x70
-
-#define GB_KEY_KBD_BACKLIGHT_KEYDOWN    0x2c
-#define GB_KEY_KBD_BACKLIGHT_KEYUP      0xac
-#define GB_KEY_BLOCK_RECORDING_KEYDOWN  0x1f
-#define GB_KEY_BLOCK_RECORDING_KEYUP    0x9f
-#define GB_KEY_BATTERY_NOTIFY_KEYUP     0xf
-#define GB_KEY_BATTERY_NOTIFY_KEYDOWN   0x8f
+#define GB_PERFORMANCE_MODE_FANOFF 0xb
+#define GB_PERFORMANCE_MODE_LOWNOISE 0xa
+#define GB_PERFORMANCE_MODE_OPTIMIZED 0x0
+#define GB_PERFORMANCE_MODE_OPTIMIZED_V2 0x2
+#define GB_PERFORMANCE_MODE_PERFORMANCE 0x1
+#define GB_PERFORMANCE_MODE_PERFORMANCE_V2 0x15
+#define GB_PERFORMANCE_MODE_ULTRA 0x16
+#define GB_PERFORMANCE_MODE_IGNORE1 0x14
+#define GB_PERFORMANCE_MODE_IGNORE2 0xc
+
+#define GB_ACPI_METHOD_ENABLE "SDLS"
+#define GB_ACPI_METHOD_ENABLE_ON 1
+#define GB_ACPI_METHOD_ENABLE_OFF 0
+#define GB_ACPI_METHOD_SETTINGS "CSFI"
+#define GB_ACPI_METHOD_PERFORMANCE_MODE "CSXI"
+
+#define GB_KBD_BACKLIGHT_MAX_BRIGHTNESS 3
+
+#define GB_ACPI_NOTIFY_BATTERY_STATE_CHANGED 0x61
+#define GB_ACPI_NOTIFY_DEVICE_ON_TABLE 0x6c
+#define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE 0x6d
+#define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE 0x70
+#define GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT 0x7d
+#define GB_ACPI_NOTIFY_HOTKEY_CAMERA 0x6f
+#define GB_ACPI_NOTIFY_HOTKEY_MICMUTE 0x6e
+
+#define GB_KEY_KBD_BACKLIGHT_KEYDOWN 0x2c
+#define GB_KEY_KBD_BACKLIGHT_KEYUP 0xac
+#define GB_KEY_BLOCK_RECORDING_KEYDOWN 0x1f
+#define GB_KEY_BLOCK_RECORDING_KEYUP 0x9f
+#define GB_KEY_BATTERY_NOTIFY_KEYUP 0xf
+#define GB_KEY_BATTERY_NOTIFY_KEYDOWN 0x8f
 
 /*
  * Optional features which have been determined as not supported on a particular
@@ -217,10 +224,11 @@ static const guid_t performance_mode_guid =
  * ACPI method handling
  */
 
-static int galaxybook_acpi_method(struct samsung_galaxybook *galaxybook, acpi_string method,
-				  struct sawb *buf, size_t len)
+static int galaxybook_acpi_method(struct samsung_galaxybook *galaxybook,
+				  acpi_string method, struct sawb *buf,
+				  size_t len)
 {
-	struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
+	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
 	union acpi_object in_obj, *out_obj;
 	struct acpi_object_list input;
 	acpi_status status;
@@ -233,18 +241,20 @@ static int galaxybook_acpi_method(struct samsung_galaxybook *galaxybook, acpi_st
 	input.count = 1;
 	input.pointer = &in_obj;
 
-	status = acpi_evaluate_object_typed(galaxybook->acpi->handle, method, &input, &output,
-					    ACPI_TYPE_BUFFER);
+	status = acpi_evaluate_object_typed(galaxybook->acpi->handle, method,
+					    &input, &output, ACPI_TYPE_BUFFER);
 
 	if (ACPI_FAILURE(status)) {
-		dev_err(&galaxybook->acpi->dev, "failed to execute method %s; got %s\n",
-			method, acpi_format_exception(status));
+		dev_err(&galaxybook->acpi->dev,
+			"failed to execute method %s; got %s\n", method,
+			acpi_format_exception(status));
 		return -EIO;
 	}
 
 	out_obj = output.pointer;
 
-	if (out_obj->buffer.length != len || out_obj->buffer.length < GB_SAWB_GB_GUNM_POS + 1) {
+	if (out_obj->buffer.length != len ||
+	    out_obj->buffer.length < GB_SAWB_GB_GUNM_POS + 1) {
 		dev_err(&galaxybook->acpi->dev,
 			"failed to execute %s; response length mismatch\n",
 			method);
@@ -274,7 +284,8 @@ static int galaxybook_acpi_method(struct samsung_galaxybook *galaxybook, acpi_st
 	return err;
 }
 
-static int galaxybook_enable_acpi_feature(struct samsung_galaxybook *galaxybook, const u16 sasb)
+static int galaxybook_enable_acpi_feature(struct samsung_galaxybook *galaxybook,
+					  const u16 sasb)
 {
 	struct sawb buf = {};
 	int err;
@@ -284,8 +295,8 @@ static int galaxybook_enable_acpi_feature(struct samsung_galaxybook *galaxybook,
 	buf.gunm = GB_GUNM_FEATURE_ENABLE;
 	buf.guds[0] = GB_GUDS_FEATURE_ENABLE;
 
-	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				     &buf, GB_SAWB_LEN_SETTINGS);
+	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				     GB_SAWB_LEN_SETTINGS);
 	if (err)
 		return err;
 
@@ -310,8 +321,8 @@ static int kbd_backlight_acpi_get(struct samsung_galaxybook *galaxybook,
 	buf.sasb = GB_SASB_KBD_BACKLIGHT;
 	buf.gunm = GB_GUNM_GET;
 
-	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				     &buf, GB_SAWB_LEN_SETTINGS);
+	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				     GB_SAWB_LEN_SETTINGS);
 	if (err)
 		return err;
 
@@ -331,8 +342,8 @@ static int kbd_backlight_acpi_set(struct samsung_galaxybook *galaxybook,
 
 	buf.guds[0] = brightness;
 
-	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				      &buf, GB_SAWB_LEN_SETTINGS);
+	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				      GB_SAWB_LEN_SETTINGS);
 }
 
 static enum led_brightness kbd_backlight_show(struct led_classdev *led)
@@ -352,8 +363,8 @@ static enum led_brightness kbd_backlight_show(struct led_classdev *led)
 static int kbd_backlight_store(struct led_classdev *led,
 			       const enum led_brightness brightness)
 {
-	struct samsung_galaxybook *galaxybook =
-		container_of_const(led, struct samsung_galaxybook, kbd_backlight);
+	struct samsung_galaxybook *galaxybook = container_of_const(
+		led, struct samsung_galaxybook, kbd_backlight);
 
 	return kbd_backlight_acpi_set(galaxybook, brightness);
 }
@@ -364,21 +375,24 @@ static int galaxybook_kbd_backlight_init(struct samsung_galaxybook *galaxybook)
 	enum led_brightness brightness;
 	int err;
 
-	err = devm_mutex_init(&galaxybook->platform->dev, &galaxybook->kbd_backlight_lock);
+	err = devm_mutex_init(&galaxybook->platform->dev,
+			      &galaxybook->kbd_backlight_lock);
 	if (err)
 		return err;
 
 	err = galaxybook_enable_acpi_feature(galaxybook, GB_SASB_KBD_BACKLIGHT);
 	if (err) {
 		dev_dbg(&galaxybook->platform->dev,
-			"failed to enable kbd_backlight feature, error %d\n", err);
+			"failed to enable kbd_backlight feature, error %d\n",
+			err);
 		return GB_NOT_SUPPORTED;
 	}
 
 	err = kbd_backlight_acpi_get(galaxybook, &brightness);
 	if (err) {
 		dev_dbg(&galaxybook->platform->dev,
-			"failed to get initial kbd_backlight brightness, error %d\n", err);
+			"failed to get initial kbd_backlight brightness, error %d\n",
+			err);
 		return GB_NOT_SUPPORTED;
 	}
 
@@ -389,17 +403,21 @@ static int galaxybook_kbd_backlight_init(struct samsung_galaxybook *galaxybook)
 	galaxybook->kbd_backlight.brightness_get = kbd_backlight_show;
 	galaxybook->kbd_backlight.brightness_set_blocking = kbd_backlight_store;
 	galaxybook->kbd_backlight.flags = LED_BRIGHT_HW_CHANGED;
-	galaxybook->kbd_backlight.max_brightness = GB_KBD_BACKLIGHT_MAX_BRIGHTNESS;
+	galaxybook->kbd_backlight.max_brightness =
+		GB_KBD_BACKLIGHT_MAX_BRIGHTNESS;
 
 	return devm_led_classdev_register_ext(&galaxybook->platform->dev,
-					      &galaxybook->kbd_backlight, &init_data);
+					      &galaxybook->kbd_backlight,
+					      &init_data);
 }
 
 /*
  * Battery Extension (adds charge_control_end_threshold to the battery device)
  */
 
-static int charge_control_end_threshold_acpi_get(struct samsung_galaxybook *galaxybook, u8 *value)
+static int
+charge_control_end_threshold_acpi_get(struct samsung_galaxybook *galaxybook,
+				      u8 *value)
 {
 	struct sawb buf = {};
 	int err;
@@ -410,8 +428,8 @@ static int charge_control_end_threshold_acpi_get(struct samsung_galaxybook *gala
 	buf.guds[0] = GB_GUDS_BATTERY_CHARGE_CONTROL;
 	buf.guds[1] = GB_GUDS_BATTERY_CHARGE_CONTROL_GET;
 
-	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				     &buf, GB_SAWB_LEN_SETTINGS);
+	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				     GB_SAWB_LEN_SETTINGS);
 	if (err)
 		return err;
 
@@ -420,7 +438,9 @@ static int charge_control_end_threshold_acpi_get(struct samsung_galaxybook *gala
 	return 0;
 }
 
-static int charge_control_end_threshold_acpi_set(struct samsung_galaxybook *galaxybook, u8 value)
+static int
+charge_control_end_threshold_acpi_set(struct samsung_galaxybook *galaxybook,
+				      u8 value)
 {
 	struct sawb buf = {};
 
@@ -431,15 +451,14 @@ static int charge_control_end_threshold_acpi_set(struct samsung_galaxybook *gala
 	buf.guds[1] = GB_GUDS_BATTERY_CHARGE_CONTROL_SET;
 	buf.guds[2] = value;
 
-	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				      &buf, GB_SAWB_LEN_SETTINGS);
+	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				      GB_SAWB_LEN_SETTINGS);
 }
 
-static int galaxybook_battery_ext_property_get(struct power_supply *psy,
-					       const struct power_supply_ext *ext,
-					       void *ext_data,
-					       enum power_supply_property psp,
-					       union power_supply_propval *val)
+static int galaxybook_battery_ext_property_get(
+	struct power_supply *psy, const struct power_supply_ext *ext,
+	void *ext_data, enum power_supply_property psp,
+	union power_supply_propval *val)
 {
 	struct samsung_galaxybook *galaxybook = ext_data;
 	u8 value;
@@ -464,11 +483,10 @@ static int galaxybook_battery_ext_property_get(struct power_supply *psy,
 	return 0;
 }
 
-static int galaxybook_battery_ext_property_set(struct power_supply *psy,
-					       const struct power_supply_ext *ext,
-					       void *ext_data,
-					       enum power_supply_property psp,
-					       const union power_supply_propval *val)
+static int galaxybook_battery_ext_property_set(
+	struct power_supply *psy, const struct power_supply_ext *ext,
+	void *ext_data, enum power_supply_property psp,
+	const union power_supply_propval *val)
 {
 	struct samsung_galaxybook *galaxybook = ext_data;
 	u8 value;
@@ -491,10 +509,9 @@ static int galaxybook_battery_ext_property_set(struct power_supply *psy,
 	return charge_control_end_threshold_acpi_set(galaxybook, value);
 }
 
-static int galaxybook_battery_ext_property_is_writeable(struct power_supply *psy,
-							const struct power_supply_ext *ext,
-							void *ext_data,
-							enum power_supply_property psp)
+static int galaxybook_battery_ext_property_is_writeable(
+	struct power_supply *psy, const struct power_supply_ext *ext,
+	void *ext_data, enum power_supply_property psp)
 {
 	if (psp == POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD)
 		return true;
@@ -507,15 +524,16 @@ static const enum power_supply_property galaxybook_battery_properties[] = {
 };
 
 static const struct power_supply_ext galaxybook_battery_ext = {
-	.name			= DRIVER_NAME,
-	.properties		= galaxybook_battery_properties,
-	.num_properties		= ARRAY_SIZE(galaxybook_battery_properties),
-	.get_property		= galaxybook_battery_ext_property_get,
-	.set_property		= galaxybook_battery_ext_property_set,
-	.property_is_writeable	= galaxybook_battery_ext_property_is_writeable,
+	.name = DRIVER_NAME,
+	.properties = galaxybook_battery_properties,
+	.num_properties = ARRAY_SIZE(galaxybook_battery_properties),
+	.get_property = galaxybook_battery_ext_property_get,
+	.set_property = galaxybook_battery_ext_property_set,
+	.property_is_writeable = galaxybook_battery_ext_property_is_writeable,
 };
 
-static int galaxybook_battery_add(struct power_supply *battery, struct acpi_battery_hook *hook)
+static int galaxybook_battery_add(struct power_supply *battery,
+				  struct acpi_battery_hook *hook)
 {
 	struct samsung_galaxybook *galaxybook =
 		container_of(hook, struct samsung_galaxybook, battery_hook);
@@ -524,13 +542,15 @@ static int galaxybook_battery_add(struct power_supply *battery, struct acpi_batt
 					       &battery->dev, galaxybook);
 }
 
-static int galaxybook_battery_remove(struct power_supply *battery, struct acpi_battery_hook *hook)
+static int galaxybook_battery_remove(struct power_supply *battery,
+				     struct acpi_battery_hook *hook)
 {
 	power_supply_unregister_extension(battery, &galaxybook_battery_ext);
 	return 0;
 }
 
-static int galaxybook_battery_threshold_init(struct samsung_galaxybook *galaxybook)
+static int
+galaxybook_battery_threshold_init(struct samsung_galaxybook *galaxybook)
 {
 	u8 value;
 	int err;
@@ -538,7 +558,8 @@ static int galaxybook_battery_threshold_init(struct samsung_galaxybook *galaxybo
 	err = charge_control_end_threshold_acpi_get(galaxybook, &value);
 	if (err) {
 		dev_dbg(&galaxybook->platform->dev,
-			"failed to get initial battery charge end threshold, error %d\n", err);
+			"failed to get initial battery charge end threshold, error %d\n",
+			err);
 		return 0;
 	}
 
@@ -546,14 +567,16 @@ static int galaxybook_battery_threshold_init(struct samsung_galaxybook *galaxybo
 	galaxybook->battery_hook.remove_battery = galaxybook_battery_remove;
 	galaxybook->battery_hook.name = "Samsung Galaxy Book Battery Extension";
 
-	return devm_battery_hook_register(&galaxybook->platform->dev, &galaxybook->battery_hook);
+	return devm_battery_hook_register(&galaxybook->platform->dev,
+					  &galaxybook->battery_hook);
 }
 
 /*
  * Platform Profile / Performance mode
  */
 
-static int performance_mode_acpi_get(struct samsung_galaxybook *galaxybook, u8 *performance_mode)
+static int performance_mode_acpi_get(struct samsung_galaxybook *galaxybook,
+				     u8 *performance_mode)
 {
 	struct sawb buf = {};
 	int err;
@@ -564,8 +587,9 @@ static int performance_mode_acpi_get(struct samsung_galaxybook *galaxybook, u8 *
 	buf.fncn = GB_FNCN_PERFORMANCE_MODE;
 	buf.subn = GB_SUBN_PERFORMANCE_MODE_GET;
 
-	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_PERFORMANCE_MODE,
-				     &buf, GB_SAWB_LEN_PERFORMANCE_MODE);
+	err = galaxybook_acpi_method(galaxybook,
+				     GB_ACPI_METHOD_PERFORMANCE_MODE, &buf,
+				     GB_SAWB_LEN_PERFORMANCE_MODE);
 	if (err)
 		return err;
 
@@ -586,8 +610,9 @@ static int performance_mode_acpi_set(struct samsung_galaxybook *galaxybook,
 	buf.subn = GB_SUBN_PERFORMANCE_MODE_SET;
 	buf.iob0 = performance_mode;
 
-	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_PERFORMANCE_MODE,
-				      &buf, GB_SAWB_LEN_PERFORMANCE_MODE);
+	return galaxybook_acpi_method(galaxybook,
+				      GB_ACPI_METHOD_PERFORMANCE_MODE, &buf,
+				      GB_SAWB_LEN_PERFORMANCE_MODE);
 }
 
 static int get_performance_mode_profile(struct samsung_galaxybook *galaxybook,
@@ -615,15 +640,17 @@ static int get_performance_mode_profile(struct samsung_galaxybook *galaxybook,
 		return -EOPNOTSUPP;
 	default:
 		dev_warn(&galaxybook->platform->dev,
-			 "unrecognized performance mode 0x%x\n", performance_mode);
+			 "unrecognized performance mode 0x%x\n",
+			 performance_mode);
 		return -EOPNOTSUPP;
 	}
 
 	return 0;
 }
 
-static int galaxybook_platform_profile_get(struct device *dev,
-					   enum platform_profile_option *profile)
+static int
+galaxybook_platform_profile_get(struct device *dev,
+				enum platform_profile_option *profile)
 {
 	struct samsung_galaxybook *galaxybook = dev_get_drvdata(dev);
 	u8 performance_mode;
@@ -633,7 +660,8 @@ static int galaxybook_platform_profile_get(struct device *dev,
 	if (err)
 		return err;
 
-	return get_performance_mode_profile(galaxybook, performance_mode, profile);
+	return get_performance_mode_profile(galaxybook, performance_mode,
+					    profile);
 }
 
 static int galaxybook_platform_profile_set(struct device *dev,
@@ -641,11 +669,12 @@ static int galaxybook_platform_profile_set(struct device *dev,
 {
 	struct samsung_galaxybook *galaxybook = dev_get_drvdata(dev);
 
-	return performance_mode_acpi_set(galaxybook,
-					 galaxybook->profile_performance_modes[profile]);
+	return performance_mode_acpi_set(
+		galaxybook, galaxybook->profile_performance_modes[profile]);
 }
 
-static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choices)
+static int galaxybook_platform_profile_probe(void *drvdata,
+					     unsigned long *choices)
 {
 	struct samsung_galaxybook *galaxybook = drvdata;
 	u8 *perfmodes = galaxybook->profile_performance_modes;
@@ -660,11 +689,13 @@ static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choic
 	buf.fncn = GB_FNCN_PERFORMANCE_MODE;
 	buf.subn = GB_SUBN_PERFORMANCE_MODE_LIST;
 
-	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_PERFORMANCE_MODE,
-				     &buf, GB_SAWB_LEN_PERFORMANCE_MODE);
+	err = galaxybook_acpi_method(galaxybook,
+				     GB_ACPI_METHOD_PERFORMANCE_MODE, &buf,
+				     GB_SAWB_LEN_PERFORMANCE_MODE);
 	if (err) {
 		dev_dbg(&galaxybook->platform->dev,
-			"failed to get supported performance modes, error %d\n", err);
+			"failed to get supported performance modes, error %d\n",
+			err);
 		return err;
 	}
 
@@ -672,7 +703,8 @@ static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choic
 	perfmodes[PLATFORM_PROFILE_LOW_POWER] = GB_PERFORMANCE_MODE_FANOFF;
 	perfmodes[PLATFORM_PROFILE_QUIET] = GB_PERFORMANCE_MODE_LOWNOISE;
 	perfmodes[PLATFORM_PROFILE_BALANCED] = GB_PERFORMANCE_MODE_OPTIMIZED;
-	perfmodes[PLATFORM_PROFILE_PERFORMANCE] = GB_PERFORMANCE_MODE_PERFORMANCE;
+	perfmodes[PLATFORM_PROFILE_PERFORMANCE] =
+		GB_PERFORMANCE_MODE_PERFORMANCE;
 
 	/*
 	 * Value returned in iob0 will have the number of supported performance
@@ -682,10 +714,12 @@ static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choic
 	 * values along the way if a non-legacy value exists.
 	 */
 	for (i = 1; i <= buf.iob0; i++) {
-		err = get_performance_mode_profile(galaxybook, buf.iobs[i], &profile);
+		err = get_performance_mode_profile(galaxybook, buf.iobs[i],
+						   &profile);
 		if (err) {
 			dev_dbg(&galaxybook->platform->dev,
-				"ignoring unmapped performance mode 0x%x\n", buf.iobs[i]);
+				"ignoring unmapped performance mode 0x%x\n",
+				buf.iobs[i]);
 			continue;
 		}
 		switch (buf.iobs[i]) {
@@ -695,7 +729,8 @@ static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choic
 		case GB_PERFORMANCE_MODE_PERFORMANCE_V2:
 			/* only update if not already overwritten by Ultra */
 			if (perfmodes[profile] != GB_PERFORMANCE_MODE_ULTRA)
-				perfmodes[profile] = GB_PERFORMANCE_MODE_PERFORMANCE_V2;
+				perfmodes[profile] =
+					GB_PERFORMANCE_MODE_PERFORMANCE_V2;
 			break;
 		case GB_PERFORMANCE_MODE_ULTRA:
 			perfmodes[profile] = GB_PERFORMANCE_MODE_ULTRA;
@@ -711,7 +746,8 @@ static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choic
 
 	/* initialize performance_mode using balanced's mapped value */
 	if (test_bit(PLATFORM_PROFILE_BALANCED, choices))
-		return performance_mode_acpi_set(galaxybook, perfmodes[PLATFORM_PROFILE_BALANCED]);
+		return performance_mode_acpi_set(
+			galaxybook, perfmodes[PLATFORM_PROFILE_BALANCED]);
 
 	return 0;
 }
@@ -722,7 +758,8 @@ static const struct platform_profile_ops galaxybook_platform_profile_ops = {
 	.profile_set = galaxybook_platform_profile_set,
 };
 
-static int galaxybook_platform_profile_init(struct samsung_galaxybook *galaxybook)
+static int
+galaxybook_platform_profile_init(struct samsung_galaxybook *galaxybook)
 {
 	struct device *platform_profile_dev;
 	u8 performance_mode;
@@ -731,13 +768,14 @@ static int galaxybook_platform_profile_init(struct samsung_galaxybook *galaxyboo
 	err = performance_mode_acpi_get(galaxybook, &performance_mode);
 	if (err) {
 		dev_dbg(&galaxybook->platform->dev,
-			"failed to get initial performance mode, error %d\n", err);
+			"failed to get initial performance mode, error %d\n",
+			err);
 		return GB_NOT_SUPPORTED;
 	}
 
-	platform_profile_dev = devm_platform_profile_register(&galaxybook->platform->dev,
-							      DRIVER_NAME, galaxybook,
-							      &galaxybook_platform_profile_ops);
+	platform_profile_dev = devm_platform_profile_register(
+		&galaxybook->platform->dev, DRIVER_NAME, galaxybook,
+		&galaxybook_platform_profile_ops);
 
 	return PTR_ERR_OR_ZERO(platform_profile_dev);
 }
@@ -748,7 +786,8 @@ static int galaxybook_platform_profile_init(struct samsung_galaxybook *galaxyboo
 
 /* Power on lid open (device should power on when lid is opened) */
 
-static int power_on_lid_open_acpi_get(struct samsung_galaxybook *galaxybook, bool *value)
+static int power_on_lid_open_acpi_get(struct samsung_galaxybook *galaxybook,
+				      bool *value)
 {
 	struct sawb buf = {};
 	int err;
@@ -759,8 +798,8 @@ static int power_on_lid_open_acpi_get(struct samsung_galaxybook *galaxybook, boo
 	buf.guds[0] = GB_GUDS_POWER_ON_LID_OPEN;
 	buf.guds[1] = GB_GUDS_POWER_ON_LID_OPEN_GET;
 
-	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				     &buf, GB_SAWB_LEN_SETTINGS);
+	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				     GB_SAWB_LEN_SETTINGS);
 	if (err)
 		return err;
 
@@ -769,7 +808,8 @@ static int power_on_lid_open_acpi_get(struct samsung_galaxybook *galaxybook, boo
 	return 0;
 }
 
-static int power_on_lid_open_acpi_set(struct samsung_galaxybook *galaxybook, const bool value)
+static int power_on_lid_open_acpi_set(struct samsung_galaxybook *galaxybook,
+				      const bool value)
 {
 	struct sawb buf = {};
 
@@ -782,13 +822,14 @@ static int power_on_lid_open_acpi_set(struct samsung_galaxybook *galaxybook, con
 	buf.guds[1] = GB_GUDS_POWER_ON_LID_OPEN_SET;
 	buf.guds[2] = value ? 1 : 0;
 
-	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				      &buf, GB_SAWB_LEN_SETTINGS);
+	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				      GB_SAWB_LEN_SETTINGS);
 }
 
 /* USB Charging (USB ports can provide power when device is powered off) */
 
-static int usb_charging_acpi_get(struct samsung_galaxybook *galaxybook, bool *value)
+static int usb_charging_acpi_get(struct samsung_galaxybook *galaxybook,
+				 bool *value)
 {
 	struct sawb buf = {};
 	int err;
@@ -797,8 +838,8 @@ static int usb_charging_acpi_get(struct samsung_galaxybook *galaxybook, bool *va
 	buf.sasb = GB_SASB_USB_CHARGING_GET;
 	buf.gunm = GB_GUNM_USB_CHARGING_GET;
 
-	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				     &buf, GB_SAWB_LEN_SETTINGS);
+	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				     GB_SAWB_LEN_SETTINGS);
 	if (err)
 		return err;
 
@@ -807,7 +848,8 @@ static int usb_charging_acpi_get(struct samsung_galaxybook *galaxybook, bool *va
 	return 0;
 }
 
-static int usb_charging_acpi_set(struct samsung_galaxybook *galaxybook, const bool value)
+static int usb_charging_acpi_set(struct samsung_galaxybook *galaxybook,
+				 const bool value)
 {
 	struct sawb buf = {};
 
@@ -817,13 +859,14 @@ static int usb_charging_acpi_set(struct samsung_galaxybook *galaxybook, const bo
 	buf.sasb = GB_SASB_USB_CHARGING_SET;
 	buf.gunm = value ? GB_GUNM_USB_CHARGING_ON : GB_GUNM_USB_CHARGING_OFF;
 
-	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				      &buf, GB_SAWB_LEN_SETTINGS);
+	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				      GB_SAWB_LEN_SETTINGS);
 }
 
 /* Block recording (blocks access to camera and microphone) */
 
-static int block_recording_acpi_get(struct samsung_galaxybook *galaxybook, bool *value)
+static int block_recording_acpi_get(struct samsung_galaxybook *galaxybook,
+				    bool *value)
 {
 	struct sawb buf = {};
 	int err;
@@ -832,8 +875,8 @@ static int block_recording_acpi_get(struct samsung_galaxybook *galaxybook, bool
 	buf.sasb = GB_SASB_BLOCK_RECORDING;
 	buf.gunm = GB_GUNM_GET;
 
-	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				     &buf, GB_SAWB_LEN_SETTINGS);
+	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				     GB_SAWB_LEN_SETTINGS);
 	if (err)
 		return err;
 
@@ -842,7 +885,8 @@ static int block_recording_acpi_get(struct samsung_galaxybook *galaxybook, bool
 	return 0;
 }
 
-static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook, const bool value)
+static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook,
+				    const bool value)
 {
 	struct sawb buf = {};
 	int err;
@@ -854,8 +898,8 @@ static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook, const
 	buf.gunm = GB_GUNM_SET;
 	buf.guds[0] = value ? GB_BLOCK_RECORDING_ON : GB_BLOCK_RECORDING_OFF;
 
-	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				     &buf, GB_SAWB_LEN_SETTINGS);
+	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				     GB_SAWB_LEN_SETTINGS);
 	if (err)
 		return err;
 
@@ -866,15 +910,18 @@ static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook, const
 	return 0;
 }
 
-static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook)
+static int
+galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook)
 {
 	bool value;
 	int err;
 
-	err = galaxybook_enable_acpi_feature(galaxybook, GB_SASB_BLOCK_RECORDING);
+	err = galaxybook_enable_acpi_feature(galaxybook,
+					     GB_SASB_BLOCK_RECORDING);
 	if (err) {
 		dev_dbg(&galaxybook->platform->dev,
-			"failed to initialize block_recording, error %d\n", err);
+			"failed to initialize block_recording, error %d\n",
+			err);
 		return GB_NOT_SUPPORTED;
 	}
 
@@ -883,7 +930,8 @@ static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook
 	err = block_recording_acpi_get(galaxybook, &value);
 	if (err) {
 		dev_dbg(&galaxybook->platform->dev,
-			"failed to get initial block_recording state, error %d\n", err);
+			"failed to get initial block_recording state, error %d\n",
+			err);
 		return GB_NOT_SUPPORTED;
 	}
 
@@ -892,11 +940,13 @@ static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook
 	if (!galaxybook->camera_lens_cover_switch)
 		return -ENOMEM;
 
-	galaxybook->camera_lens_cover_switch->name = "Samsung Galaxy Book Camera Lens Cover";
+	galaxybook->camera_lens_cover_switch->name =
+		"Samsung Galaxy Book Camera Lens Cover";
 	galaxybook->camera_lens_cover_switch->phys = DRIVER_NAME "/input0";
 	galaxybook->camera_lens_cover_switch->id.bustype = BUS_HOST;
 
-	input_set_capability(galaxybook->camera_lens_cover_switch, EV_SW, SW_CAMERA_LENS_COVER);
+	input_set_capability(galaxybook->camera_lens_cover_switch, EV_SW,
+			     SW_CAMERA_LENS_COVER);
 
 	err = input_register_device(galaxybook->camera_lens_cover_switch);
 	if (err)
@@ -911,28 +961,33 @@ static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook
 
 /* Firmware Attributes setup */
 
-static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
+static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr,
+			 char *buf)
 {
 	return sysfs_emit(buf, "enumeration\n");
 }
 
 static struct kobj_attribute fw_attr_type = __ATTR_RO(type);
 
-static ssize_t default_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
+static ssize_t default_value_show(struct kobject *kobj,
+				  struct kobj_attribute *attr, char *buf)
 {
 	return sysfs_emit(buf, "0\n");
 }
 
 static struct kobj_attribute fw_attr_default_value = __ATTR_RO(default_value);
 
-static ssize_t possible_values_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
+static ssize_t possible_values_show(struct kobject *kobj,
+				    struct kobj_attribute *attr, char *buf)
 {
 	return sysfs_emit(buf, "0;1\n");
 }
 
-static struct kobj_attribute fw_attr_possible_values = __ATTR_RO(possible_values);
+static struct kobj_attribute fw_attr_possible_values =
+	__ATTR_RO(possible_values);
 
-static ssize_t display_name_language_code_show(struct kobject *kobj, struct kobj_attribute *attr,
+static ssize_t display_name_language_code_show(struct kobject *kobj,
+					       struct kobj_attribute *attr,
 					       char *buf)
 {
 	return sysfs_emit(buf, "%s\n", GB_ATTR_LANGUAGE_CODE);
@@ -941,15 +996,18 @@ static ssize_t display_name_language_code_show(struct kobject *kobj, struct kobj
 static struct kobj_attribute fw_attr_display_name_language_code =
 	__ATTR_RO(display_name_language_code);
 
-static ssize_t display_name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
+static ssize_t display_name_show(struct kobject *kobj,
+				 struct kobj_attribute *attr, char *buf)
 {
 	struct galaxybook_fw_attr *fw_attr =
 		container_of(attr, struct galaxybook_fw_attr, display_name);
 
-	return sysfs_emit(buf, "%s\n", galaxybook_fw_attr_desc[fw_attr->fw_attr_id]);
+	return sysfs_emit(buf, "%s\n",
+			  galaxybook_fw_attr_desc[fw_attr->fw_attr_id]);
 }
 
-static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
+static ssize_t current_value_show(struct kobject *kobj,
+				  struct kobj_attribute *attr, char *buf)
 {
 	struct galaxybook_fw_attr *fw_attr =
 		container_of(attr, struct galaxybook_fw_attr, current_value);
@@ -963,8 +1021,9 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
 	return sysfs_emit(buf, "%u\n", value);
 }
 
-static ssize_t current_value_store(struct kobject *kobj, struct kobj_attribute *attr,
-				   const char *buf, size_t count)
+static ssize_t current_value_store(struct kobject *kobj,
+				   struct kobj_attribute *attr, const char *buf,
+				   size_t count)
 {
 	struct galaxybook_fw_attr *fw_attr =
 		container_of(attr, struct galaxybook_fw_attr, current_value);
@@ -988,24 +1047,26 @@ static ssize_t current_value_store(struct kobject *kobj, struct kobj_attribute *
 	return count;
 }
 
-#define NUM_FW_ATTR_ENUM_ATTRS  6
+#define NUM_FW_ATTR_ENUM_ATTRS 6
 
-static int galaxybook_fw_attr_init(struct samsung_galaxybook *galaxybook,
-				   const enum galaxybook_fw_attr_id fw_attr_id,
-				   int (*get_value)(struct samsung_galaxybook *galaxybook,
-						    bool *value),
-				   int (*set_value)(struct samsung_galaxybook *galaxybook,
-						    const bool value))
+static int galaxybook_fw_attr_init(
+	struct samsung_galaxybook *galaxybook,
+	const enum galaxybook_fw_attr_id fw_attr_id,
+	int (*get_value)(struct samsung_galaxybook *galaxybook, bool *value),
+	int (*set_value)(struct samsung_galaxybook *galaxybook,
+			 const bool value))
 {
 	struct galaxybook_fw_attr *fw_attr;
 	struct attribute **attrs;
 
-	fw_attr = devm_kzalloc(&galaxybook->platform->dev, sizeof(*fw_attr), GFP_KERNEL);
+	fw_attr = devm_kzalloc(&galaxybook->platform->dev, sizeof(*fw_attr),
+			       GFP_KERNEL);
 	if (!fw_attr)
 		return -ENOMEM;
 
-	attrs = devm_kcalloc(&galaxybook->platform->dev, NUM_FW_ATTR_ENUM_ATTRS + 1,
-			     sizeof(*attrs), GFP_KERNEL);
+	attrs = devm_kcalloc(&galaxybook->platform->dev,
+			     NUM_FW_ATTR_ENUM_ATTRS + 1, sizeof(*attrs),
+			     GFP_KERNEL);
 	if (!attrs)
 		return -ENOMEM;
 
@@ -1036,7 +1097,8 @@ static int galaxybook_fw_attr_init(struct samsung_galaxybook *galaxybook,
 	fw_attr->get_value = get_value;
 	fw_attr->set_value = set_value;
 
-	return sysfs_create_group(&galaxybook->fw_attrs_kset->kobj, &fw_attr->attr_group);
+	return sysfs_create_group(&galaxybook->fw_attrs_kset->kobj,
+				  &fw_attr->attr_group);
 }
 
 static void galaxybook_kset_unregister(void *data)
@@ -1058,12 +1120,14 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
 	bool value;
 	int err;
 
-	err = devm_mutex_init(&galaxybook->platform->dev, &galaxybook->fw_attr_lock);
+	err = devm_mutex_init(&galaxybook->platform->dev,
+			      &galaxybook->fw_attr_lock);
 	if (err)
 		return err;
 
-	galaxybook->fw_attrs_dev = device_create(&firmware_attributes_class, NULL, MKDEV(0, 0),
-						 NULL, "%s", DRIVER_NAME);
+	galaxybook->fw_attrs_dev = device_create(&firmware_attributes_class,
+						 NULL, MKDEV(0, 0), NULL, "%s",
+						 DRIVER_NAME);
 	if (IS_ERR(galaxybook->fw_attrs_dev))
 		return PTR_ERR(galaxybook->fw_attrs_dev);
 
@@ -1073,12 +1137,13 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
 	if (err)
 		return err;
 
-	galaxybook->fw_attrs_kset = kset_create_and_add("attributes", NULL,
-							&galaxybook->fw_attrs_dev->kobj);
+	galaxybook->fw_attrs_kset = kset_create_and_add(
+		"attributes", NULL, &galaxybook->fw_attrs_dev->kobj);
 	if (!galaxybook->fw_attrs_kset)
 		return -ENOMEM;
 	err = devm_add_action_or_reset(&galaxybook->platform->dev,
-				       galaxybook_kset_unregister, galaxybook->fw_attrs_kset);
+				       galaxybook_kset_unregister,
+				       galaxybook->fw_attrs_kset);
 	if (err)
 		return err;
 
@@ -1094,8 +1159,7 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
 
 	err = usb_charging_acpi_get(galaxybook, &value);
 	if (!err) {
-		err = galaxybook_fw_attr_init(galaxybook,
-					      GB_ATTR_USB_CHARGING,
+		err = galaxybook_fw_attr_init(galaxybook, GB_ATTR_USB_CHARGING,
 					      &usb_charging_acpi_get,
 					      &usb_charging_acpi_set);
 		if (err)
@@ -1110,8 +1174,7 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
 
 	galaxybook->has_block_recording = true;
 
-	return galaxybook_fw_attr_init(galaxybook,
-				       GB_ATTR_BLOCK_RECORDING,
+	return galaxybook_fw_attr_init(galaxybook, GB_ATTR_BLOCK_RECORDING,
 				       &block_recording_acpi_get,
 				       &block_recording_acpi_set);
 }
@@ -1138,11 +1201,13 @@ static void galaxybook_kbd_backlight_hotkey_work(struct work_struct *work)
 	err = led_set_brightness_sync(&galaxybook->kbd_backlight, brightness);
 	if (err) {
 		dev_err(&galaxybook->platform->dev,
-			"failed to set kbd_backlight brightness, error %d\n", err);
+			"failed to set kbd_backlight brightness, error %d\n",
+			err);
 		return;
 	}
 
-	led_classdev_notify_brightness_hw_changed(&galaxybook->kbd_backlight, brightness);
+	led_classdev_notify_brightness_hw_changed(&galaxybook->kbd_backlight,
+						  brightness);
 }
 
 static void galaxybook_block_recording_hotkey_work(struct work_struct *work)
@@ -1167,8 +1232,8 @@ static void galaxybook_block_recording_hotkey_work(struct work_struct *work)
 			"failed to set block_recording, error %d\n", err);
 }
 
-static bool galaxybook_i8042_filter(unsigned char data, unsigned char str, struct serio *port,
-				    void *context)
+static bool galaxybook_i8042_filter(unsigned char data, unsigned char str,
+				    struct serio *port, void *context)
 {
 	struct samsung_galaxybook *galaxybook = context;
 	static bool extended;
@@ -1186,14 +1251,17 @@ static bool galaxybook_i8042_filter(unsigned char data, unsigned char str, struc
 			return true;
 		case GB_KEY_KBD_BACKLIGHT_KEYUP:
 			if (galaxybook->has_kbd_backlight)
-				schedule_work(&galaxybook->kbd_backlight_hotkey_work);
+				schedule_work(
+					&galaxybook->kbd_backlight_hotkey_work);
 			return true;
 
 		case GB_KEY_BLOCK_RECORDING_KEYDOWN:
 			return true;
 		case GB_KEY_BLOCK_RECORDING_KEYUP:
 			if (galaxybook->has_block_recording)
-				schedule_work(&galaxybook->block_recording_hotkey_work);
+				schedule_work(
+					&galaxybook
+						 ->block_recording_hotkey_work);
 			return true;
 
 		/* battery notification already sent to battery + SCAI device */
@@ -1223,7 +1291,8 @@ static void galaxybook_i8042_filter_remove(void *data)
 	cancel_work_sync(&galaxybook->block_recording_hotkey_work);
 }
 
-static int galaxybook_i8042_filter_install(struct samsung_galaxybook *galaxybook)
+static int
+galaxybook_i8042_filter_install(struct samsung_galaxybook *galaxybook)
 {
 	int err;
 
@@ -1240,7 +1309,25 @@ static int galaxybook_i8042_filter_install(struct samsung_galaxybook *galaxybook
 		return err;
 
 	return devm_add_action_or_reset(&galaxybook->platform->dev,
-					galaxybook_i8042_filter_remove, galaxybook);
+					galaxybook_i8042_filter_remove,
+					galaxybook);
+}
+
+static int galaxybook_hotkey_init(struct samsung_galaxybook *galaxybook)
+{
+	galaxybook->hotkey_dev =
+		devm_input_allocate_device(&galaxybook->platform->dev);
+	if (!galaxybook->hotkey_dev)
+		return -ENOMEM;
+
+	galaxybook->hotkey_dev->name = "Samsung Galaxy Book hotkeys";
+	galaxybook->hotkey_dev->phys = DRIVER_NAME "/input1";
+	galaxybook->hotkey_dev->id.bustype = BUS_HOST;
+
+	input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_MICMUTE);
+	input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_CAMERA);
+
+	return input_register_device(galaxybook->hotkey_dev);
 }
 
 /*
@@ -1260,13 +1347,37 @@ static void galaxybook_acpi_notify(acpi_handle handle, u32 event, void *data)
 		if (galaxybook->has_performance_mode)
 			platform_profile_cycle();
 		break;
+	case GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT:
+		if (galaxybook->has_kbd_backlight)
+			schedule_work(&galaxybook->kbd_backlight_hotkey_work);
+		break;
+	case GB_ACPI_NOTIFY_HOTKEY_MICMUTE:
+		if (galaxybook->hotkey_dev) {
+			input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE,
+					 1);
+			input_sync(galaxybook->hotkey_dev);
+			input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE,
+					 0);
+			input_sync(galaxybook->hotkey_dev);
+		}
+		break;
+	case GB_ACPI_NOTIFY_HOTKEY_CAMERA:
+		if (galaxybook->has_block_recording)
+			schedule_work(&galaxybook->block_recording_hotkey_work);
+		else if (galaxybook->hotkey_dev) {
+			input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 1);
+			input_sync(galaxybook->hotkey_dev);
+			input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 0);
+			input_sync(galaxybook->hotkey_dev);
+		}
+		break;
 	default:
 		dev_warn(&galaxybook->platform->dev,
 			 "unknown ACPI notification event: 0x%x\n", event);
 	}
 
-	acpi_bus_generate_netlink_event(DRIVER_NAME, dev_name(&galaxybook->platform->dev),
-					event, 1);
+	acpi_bus_generate_netlink_event(
+		DRIVER_NAME, dev_name(&galaxybook->platform->dev), event, 1);
 }
 
 static int galaxybook_enable_acpi_notify(struct samsung_galaxybook *galaxybook)
@@ -1283,8 +1394,8 @@ static int galaxybook_enable_acpi_notify(struct samsung_galaxybook *galaxybook)
 	buf.gunm = GB_GUNM_ACPI_NOTIFY_ENABLE;
 	buf.guds[0] = GB_GUDS_ACPI_NOTIFY_ENABLE;
 
-	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
-				      &buf, GB_SAWB_LEN_SETTINGS);
+	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
+				      GB_SAWB_LEN_SETTINGS);
 }
 
 static void galaxybook_acpi_remove_notify_handler(void *data)
@@ -1300,7 +1411,8 @@ static void galaxybook_acpi_disable(void *data)
 	struct samsung_galaxybook *galaxybook = data;
 
 	acpi_execute_simple_method(galaxybook->acpi->handle,
-				   GB_ACPI_METHOD_ENABLE, GB_ACPI_METHOD_ENABLE_OFF);
+				   GB_ACPI_METHOD_ENABLE,
+				   GB_ACPI_METHOD_ENABLE_OFF);
 }
 
 static int galaxybook_acpi_init(struct samsung_galaxybook *galaxybook)
@@ -1308,7 +1420,8 @@ static int galaxybook_acpi_init(struct samsung_galaxybook *galaxybook)
 	acpi_status status;
 	int err;
 
-	status = acpi_execute_simple_method(galaxybook->acpi->handle, GB_ACPI_METHOD_ENABLE,
+	status = acpi_execute_simple_method(galaxybook->acpi->handle,
+					    GB_ACPI_METHOD_ENABLE,
 					    GB_ACPI_METHOD_ENABLE_ON);
 	if (ACPI_FAILURE(status))
 		return -EIO;
@@ -1317,21 +1430,26 @@ static int galaxybook_acpi_init(struct samsung_galaxybook *galaxybook)
 	if (err)
 		return err;
 
-	status = acpi_install_notify_handler(galaxybook->acpi->handle, ACPI_ALL_NOTIFY,
-					     galaxybook_acpi_notify, galaxybook);
+	status = acpi_install_notify_handler(galaxybook->acpi->handle,
+					     ACPI_ALL_NOTIFY,
+					     galaxybook_acpi_notify,
+					     galaxybook);
 	if (ACPI_FAILURE(status))
 		return -EIO;
 	err = devm_add_action_or_reset(&galaxybook->platform->dev,
-				       galaxybook_acpi_remove_notify_handler, galaxybook);
+				       galaxybook_acpi_remove_notify_handler,
+				       galaxybook);
 	if (err)
 		return err;
 
 	err = galaxybook_enable_acpi_notify(galaxybook);
 	if (err)
-		dev_dbg(&galaxybook->platform->dev, "failed to enable ACPI notifications; "
+		dev_dbg(&galaxybook->platform->dev,
+			"failed to enable ACPI notifications; "
 			"some hotkeys will not be supported\n");
 
-	err = galaxybook_enable_acpi_feature(galaxybook, GB_SASB_POWER_MANAGEMENT);
+	err = galaxybook_enable_acpi_feature(galaxybook,
+					     GB_SASB_POWER_MANAGEMENT);
 	if (err)
 		dev_dbg(&galaxybook->platform->dev,
 			"failed to initialize ACPI power management features; "
@@ -1382,8 +1500,9 @@ static int galaxybook_probe(struct platform_device *pdev)
 
 	err = galaxybook_battery_threshold_init(galaxybook);
 	if (err)
-		return dev_err_probe(&galaxybook->platform->dev, err,
-				     "failed to initialize battery threshold\n");
+		return dev_err_probe(
+			&galaxybook->platform->dev, err,
+			"failed to initialize battery threshold\n");
 
 	err = galaxybook_kbd_backlight_init(galaxybook);
 	if (!err)
@@ -1394,8 +1513,15 @@ static int galaxybook_probe(struct platform_device *pdev)
 
 	err = galaxybook_fw_attrs_init(galaxybook);
 	if (err)
-		return dev_err_probe(&galaxybook->platform->dev, err,
-				     "failed to initialize firmware-attributes\n");
+		return dev_err_probe(
+			&galaxybook->platform->dev, err,
+			"failed to initialize firmware-attributes\n");
+
+	err = galaxybook_hotkey_init(galaxybook);
+	if (err)
+		return dev_err_probe(
+			&galaxybook->platform->dev, err,
+			"failed to initialize hotkey input device\n");
 
 	err = galaxybook_i8042_filter_install(galaxybook);
 	if (err)
@@ -1406,12 +1532,8 @@ static int galaxybook_probe(struct platform_device *pdev)
 }
 
 static const struct acpi_device_id galaxybook_device_ids[] = {
-	{ "SAM0426" },
-	{ "SAM0427" },
-	{ "SAM0428" },
-	{ "SAM0429" },
-	{ "SAM0430" },
-	{}
+	{ "SAM0426" }, { "SAM0427" }, { "SAM0428" },
+	{ "SAM0429" }, { "SAM0430" }, {}
 };
 MODULE_DEVICE_TABLE(acpi, galaxybook_device_ids);
 
-- 
2.53.0


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

* Re: [PATCH] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
  2026-03-16 19:33 [PATCH] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications Ayaan Mirza Baig
@ 2026-03-17 12:36 ` Ilpo Järvinen
  2026-03-18  5:42   ` [PATCH v2] " Ayaan Mirza Baig
  0 siblings, 1 reply; 13+ messages in thread
From: Ilpo Järvinen @ 2026-03-17 12:36 UTC (permalink / raw)
  To: Ayaan Mirza Baig; +Cc: platform-driver-x86, josh, ayaanmirza788

On Mon, 16 Mar 2026, Ayaan Mirza Baig wrote:

> On Samsung Galaxy Book 5 (SAM0430), the keyboard backlight, microphone
> mute, and camera block hotkeys do not generate i8042 scancodes.
> Instead they arrive as ACPI notifications 0x7d, 0x63, and 0x6f
> respectively, all of which previously fell through to the deafult
> "unknown" warning in galaxybook_acpi_notify().
> 
> Add handling for these three events:
> 
> - 0x7d (Fn+F9, keyboard backlight): schedule the existing
>   kbd_backlight_hotkey_work which cycles brightness.
> 
> - 0x6e (Fn+F10, microphone mute): register a new hotkey input device
>   and emit KEY_MICMUTE.
> 
> - 0x6f (Fn+F11, camera block): if block_recording is active use the
>   existing block_recording_hotkey_work; otherwise emit KEY_CAMERA via the
>   hotkey input device on models where the block_recording ACPI feature is
>   not supported
> 
> Tested on Samsung Galaxy Book 5 (SAM0430).
> 
> Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
> ---
>  drivers/platform/x86/samsung-galaxybook.c | 596 +++++++++++++---------
>  1 file changed, 359 insertions(+), 237 deletions(-)
> 
> diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
> index 755cb82bdb60..d0d614166a4a 100644
> --- a/drivers/platform/x86/samsung-galaxybook.c
> +++ b/drivers/platform/x86/samsung-galaxybook.c
> @@ -16,6 +16,7 @@
>  #include <linux/err.h>
>  #include <linux/i8042.h>
>  #include <linux/init.h>
> +#include <linux/input-event-codes.h>
>  #include <linux/input.h>
>  #include <linux/kernel.h>
>  #include <linux/leds.h>
> @@ -54,6 +55,7 @@ struct samsung_galaxybook {
>  
>  	struct work_struct block_recording_hotkey_work;
>  	struct input_dev *camera_lens_cover_switch;
> +	struct input_dev *hotkey_dev;
>  
>  	struct acpi_battery_hook battery_hook;
>  
> @@ -66,16 +68,16 @@ enum galaxybook_fw_attr_id {
>  	GB_ATTR_BLOCK_RECORDING,
>  };
>  
> -static const char * const galaxybook_fw_attr_name[] = {
> +static const char *const galaxybook_fw_attr_name[] = {
>  	[GB_ATTR_POWER_ON_LID_OPEN] = "power_on_lid_open",
> -	[GB_ATTR_USB_CHARGING]      = "usb_charging",
> -	[GB_ATTR_BLOCK_RECORDING]   = "block_recording",
> +	[GB_ATTR_USB_CHARGING] = "usb_charging",
> +	[GB_ATTR_BLOCK_RECORDING] = "block_recording",

Please make sure your patch does not do any unrelated changes such as 
these and then submit v2.

--
 i.

>  };
>  
> -static const char * const galaxybook_fw_attr_desc[] = {
> +static const char *const galaxybook_fw_attr_desc[] = {
>  	[GB_ATTR_POWER_ON_LID_OPEN] = "Power On Lid Open",
> -	[GB_ATTR_USB_CHARGING]      = "USB Charging",
> -	[GB_ATTR_BLOCK_RECORDING]   = "Block Recording",
> +	[GB_ATTR_USB_CHARGING] = "USB Charging",
> +	[GB_ATTR_BLOCK_RECORDING] = "Block Recording",
>  };
>  
>  #define GB_ATTR_LANGUAGE_CODE "en_US.UTF-8"
> @@ -87,7 +89,8 @@ struct galaxybook_fw_attr {
>  	struct kobj_attribute display_name;
>  	struct kobj_attribute current_value;
>  	int (*get_value)(struct samsung_galaxybook *galaxybook, bool *value);
> -	int (*set_value)(struct samsung_galaxybook *galaxybook, const bool value);
> +	int (*set_value)(struct samsung_galaxybook *galaxybook,
> +			 const bool value);
>  };
>  
>  struct sawb {
> @@ -121,89 +124,93 @@ struct sawb {
>  	} __packed;
>  } __packed;
>  
> -#define GB_SAWB_LEN_SETTINGS          0x15
> -#define GB_SAWB_LEN_PERFORMANCE_MODE  0x100
> +#define GB_SAWB_LEN_SETTINGS 0x15
> +#define GB_SAWB_LEN_PERFORMANCE_MODE 0x100
>  
> -#define GB_SAFN  0x5843
> +#define GB_SAFN 0x5843
>  
> -#define GB_SASB_KBD_BACKLIGHT     0x78
> -#define GB_SASB_POWER_MANAGEMENT  0x7a
> -#define GB_SASB_USB_CHARGING_GET  0x67
> -#define GB_SASB_USB_CHARGING_SET  0x68
> -#define GB_SASB_NOTIFICATIONS     0x86
> -#define GB_SASB_BLOCK_RECORDING   0x8a
> -#define GB_SASB_PERFORMANCE_MODE  0x91
> +#define GB_SASB_KBD_BACKLIGHT 0x78
> +#define GB_SASB_POWER_MANAGEMENT 0x7a
> +#define GB_SASB_USB_CHARGING_GET 0x67
> +#define GB_SASB_USB_CHARGING_SET 0x68
> +#define GB_SASB_NOTIFICATIONS 0x86
> +#define GB_SASB_BLOCK_RECORDING 0x8a
> +#define GB_SASB_PERFORMANCE_MODE 0x91
>  
> -#define GB_SAWB_RFLG_POS     4
> -#define GB_SAWB_GB_GUNM_POS  5
> +#define GB_SAWB_RFLG_POS 4
> +#define GB_SAWB_GB_GUNM_POS 5
>  
> -#define GB_RFLG_SUCCESS  0xaa
> -#define GB_GUNM_FAIL     0xff
> +#define GB_RFLG_SUCCESS 0xaa
> +#define GB_GUNM_FAIL 0xff
>  
> -#define GB_GUNM_FEATURE_ENABLE          0xbb
> -#define GB_GUNM_FEATURE_ENABLE_SUCCESS  0xdd
> -#define GB_GUDS_FEATURE_ENABLE          0xaa
> -#define GB_GUDS_FEATURE_ENABLE_SUCCESS  0xcc
> +#define GB_GUNM_FEATURE_ENABLE 0xbb
> +#define GB_GUNM_FEATURE_ENABLE_SUCCESS 0xdd
> +#define GB_GUDS_FEATURE_ENABLE 0xaa
> +#define GB_GUDS_FEATURE_ENABLE_SUCCESS 0xcc
>  
> -#define GB_GUNM_GET  0x81
> -#define GB_GUNM_SET  0x82
> +#define GB_GUNM_GET 0x81
> +#define GB_GUNM_SET 0x82
>  
> -#define GB_GUNM_POWER_MANAGEMENT  0x82
> +#define GB_GUNM_POWER_MANAGEMENT 0x82
>  
> -#define GB_GUNM_USB_CHARGING_GET            0x80
> -#define GB_GUNM_USB_CHARGING_ON             0x81
> -#define GB_GUNM_USB_CHARGING_OFF            0x80
> -#define GB_GUDS_POWER_ON_LID_OPEN           0xa3
> -#define GB_GUDS_POWER_ON_LID_OPEN_GET       0x81
> -#define GB_GUDS_POWER_ON_LID_OPEN_SET       0x80
> -#define GB_GUDS_BATTERY_CHARGE_CONTROL      0xe9
> -#define GB_GUDS_BATTERY_CHARGE_CONTROL_GET  0x91
> -#define GB_GUDS_BATTERY_CHARGE_CONTROL_SET  0x90
> -#define GB_GUNM_ACPI_NOTIFY_ENABLE          0x80
> -#define GB_GUDS_ACPI_NOTIFY_ENABLE          0x02
> +#define GB_GUNM_USB_CHARGING_GET 0x80
> +#define GB_GUNM_USB_CHARGING_ON 0x81
> +#define GB_GUNM_USB_CHARGING_OFF 0x80
> +#define GB_GUDS_POWER_ON_LID_OPEN 0xa3
> +#define GB_GUDS_POWER_ON_LID_OPEN_GET 0x81
> +#define GB_GUDS_POWER_ON_LID_OPEN_SET 0x80
> +#define GB_GUDS_BATTERY_CHARGE_CONTROL 0xe9
> +#define GB_GUDS_BATTERY_CHARGE_CONTROL_GET 0x91
> +#define GB_GUDS_BATTERY_CHARGE_CONTROL_SET 0x90
> +#define GB_GUNM_ACPI_NOTIFY_ENABLE 0x80
> +#define GB_GUDS_ACPI_NOTIFY_ENABLE 0x02
>  
> -#define GB_BLOCK_RECORDING_ON   0x0
> -#define GB_BLOCK_RECORDING_OFF  0x1
> +#define GB_BLOCK_RECORDING_ON 0x0
> +#define GB_BLOCK_RECORDING_OFF 0x1
>  
> -#define GB_FNCN_PERFORMANCE_MODE       0x51
> -#define GB_SUBN_PERFORMANCE_MODE_LIST  0x01
> -#define GB_SUBN_PERFORMANCE_MODE_GET   0x02
> -#define GB_SUBN_PERFORMANCE_MODE_SET   0x03
> +#define GB_FNCN_PERFORMANCE_MODE 0x51
> +#define GB_SUBN_PERFORMANCE_MODE_LIST 0x01
> +#define GB_SUBN_PERFORMANCE_MODE_GET 0x02
> +#define GB_SUBN_PERFORMANCE_MODE_SET 0x03
>  
>  /* guid 8246028d-8bca-4a55-ba0f-6f1e6b921b8f */
>  static const guid_t performance_mode_guid =
> -	GUID_INIT(0x8246028d, 0x8bca, 0x4a55, 0xba, 0x0f, 0x6f, 0x1e, 0x6b, 0x92, 0x1b, 0x8f);
> +	GUID_INIT(0x8246028d, 0x8bca, 0x4a55, 0xba, 0x0f, 0x6f, 0x1e, 0x6b,
> +		  0x92, 0x1b, 0x8f);
>  #define GB_PERFORMANCE_MODE_GUID performance_mode_guid
>  
> -#define GB_PERFORMANCE_MODE_FANOFF          0xb
> -#define GB_PERFORMANCE_MODE_LOWNOISE        0xa
> -#define GB_PERFORMANCE_MODE_OPTIMIZED       0x0
> -#define GB_PERFORMANCE_MODE_OPTIMIZED_V2    0x2
> -#define GB_PERFORMANCE_MODE_PERFORMANCE     0x1
> -#define GB_PERFORMANCE_MODE_PERFORMANCE_V2  0x15
> -#define GB_PERFORMANCE_MODE_ULTRA           0x16
> -#define GB_PERFORMANCE_MODE_IGNORE1         0x14
> -#define GB_PERFORMANCE_MODE_IGNORE2         0xc
> -
> -#define GB_ACPI_METHOD_ENABLE            "SDLS"
> -#define GB_ACPI_METHOD_ENABLE_ON         1
> -#define GB_ACPI_METHOD_ENABLE_OFF        0
> -#define GB_ACPI_METHOD_SETTINGS          "CSFI"
> -#define GB_ACPI_METHOD_PERFORMANCE_MODE  "CSXI"
> -
> -#define GB_KBD_BACKLIGHT_MAX_BRIGHTNESS  3
> -
> -#define GB_ACPI_NOTIFY_BATTERY_STATE_CHANGED    0x61
> -#define GB_ACPI_NOTIFY_DEVICE_ON_TABLE          0x6c
> -#define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE         0x6d
> -#define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE  0x70
> -
> -#define GB_KEY_KBD_BACKLIGHT_KEYDOWN    0x2c
> -#define GB_KEY_KBD_BACKLIGHT_KEYUP      0xac
> -#define GB_KEY_BLOCK_RECORDING_KEYDOWN  0x1f
> -#define GB_KEY_BLOCK_RECORDING_KEYUP    0x9f
> -#define GB_KEY_BATTERY_NOTIFY_KEYUP     0xf
> -#define GB_KEY_BATTERY_NOTIFY_KEYDOWN   0x8f
> +#define GB_PERFORMANCE_MODE_FANOFF 0xb
> +#define GB_PERFORMANCE_MODE_LOWNOISE 0xa
> +#define GB_PERFORMANCE_MODE_OPTIMIZED 0x0
> +#define GB_PERFORMANCE_MODE_OPTIMIZED_V2 0x2
> +#define GB_PERFORMANCE_MODE_PERFORMANCE 0x1
> +#define GB_PERFORMANCE_MODE_PERFORMANCE_V2 0x15
> +#define GB_PERFORMANCE_MODE_ULTRA 0x16
> +#define GB_PERFORMANCE_MODE_IGNORE1 0x14
> +#define GB_PERFORMANCE_MODE_IGNORE2 0xc
> +
> +#define GB_ACPI_METHOD_ENABLE "SDLS"
> +#define GB_ACPI_METHOD_ENABLE_ON 1
> +#define GB_ACPI_METHOD_ENABLE_OFF 0
> +#define GB_ACPI_METHOD_SETTINGS "CSFI"
> +#define GB_ACPI_METHOD_PERFORMANCE_MODE "CSXI"
> +
> +#define GB_KBD_BACKLIGHT_MAX_BRIGHTNESS 3
> +
> +#define GB_ACPI_NOTIFY_BATTERY_STATE_CHANGED 0x61
> +#define GB_ACPI_NOTIFY_DEVICE_ON_TABLE 0x6c
> +#define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE 0x6d
> +#define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE 0x70
> +#define GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT 0x7d
> +#define GB_ACPI_NOTIFY_HOTKEY_CAMERA 0x6f
> +#define GB_ACPI_NOTIFY_HOTKEY_MICMUTE 0x6e
> +
> +#define GB_KEY_KBD_BACKLIGHT_KEYDOWN 0x2c
> +#define GB_KEY_KBD_BACKLIGHT_KEYUP 0xac
> +#define GB_KEY_BLOCK_RECORDING_KEYDOWN 0x1f
> +#define GB_KEY_BLOCK_RECORDING_KEYUP 0x9f
> +#define GB_KEY_BATTERY_NOTIFY_KEYUP 0xf
> +#define GB_KEY_BATTERY_NOTIFY_KEYDOWN 0x8f
>  
>  /*
>   * Optional features which have been determined as not supported on a particular
> @@ -217,10 +224,11 @@ static const guid_t performance_mode_guid =
>   * ACPI method handling
>   */
>  
> -static int galaxybook_acpi_method(struct samsung_galaxybook *galaxybook, acpi_string method,
> -				  struct sawb *buf, size_t len)
> +static int galaxybook_acpi_method(struct samsung_galaxybook *galaxybook,
> +				  acpi_string method, struct sawb *buf,
> +				  size_t len)
>  {
> -	struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
> +	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
>  	union acpi_object in_obj, *out_obj;
>  	struct acpi_object_list input;
>  	acpi_status status;
> @@ -233,18 +241,20 @@ static int galaxybook_acpi_method(struct samsung_galaxybook *galaxybook, acpi_st
>  	input.count = 1;
>  	input.pointer = &in_obj;
>  
> -	status = acpi_evaluate_object_typed(galaxybook->acpi->handle, method, &input, &output,
> -					    ACPI_TYPE_BUFFER);
> +	status = acpi_evaluate_object_typed(galaxybook->acpi->handle, method,
> +					    &input, &output, ACPI_TYPE_BUFFER);
>  
>  	if (ACPI_FAILURE(status)) {
> -		dev_err(&galaxybook->acpi->dev, "failed to execute method %s; got %s\n",
> -			method, acpi_format_exception(status));
> +		dev_err(&galaxybook->acpi->dev,
> +			"failed to execute method %s; got %s\n", method,
> +			acpi_format_exception(status));
>  		return -EIO;
>  	}
>  
>  	out_obj = output.pointer;
>  
> -	if (out_obj->buffer.length != len || out_obj->buffer.length < GB_SAWB_GB_GUNM_POS + 1) {
> +	if (out_obj->buffer.length != len ||
> +	    out_obj->buffer.length < GB_SAWB_GB_GUNM_POS + 1) {
>  		dev_err(&galaxybook->acpi->dev,
>  			"failed to execute %s; response length mismatch\n",
>  			method);
> @@ -274,7 +284,8 @@ static int galaxybook_acpi_method(struct samsung_galaxybook *galaxybook, acpi_st
>  	return err;
>  }
>  
> -static int galaxybook_enable_acpi_feature(struct samsung_galaxybook *galaxybook, const u16 sasb)
> +static int galaxybook_enable_acpi_feature(struct samsung_galaxybook *galaxybook,
> +					  const u16 sasb)
>  {
>  	struct sawb buf = {};
>  	int err;
> @@ -284,8 +295,8 @@ static int galaxybook_enable_acpi_feature(struct samsung_galaxybook *galaxybook,
>  	buf.gunm = GB_GUNM_FEATURE_ENABLE;
>  	buf.guds[0] = GB_GUDS_FEATURE_ENABLE;
>  
> -	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				     &buf, GB_SAWB_LEN_SETTINGS);
> +	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				     GB_SAWB_LEN_SETTINGS);
>  	if (err)
>  		return err;
>  
> @@ -310,8 +321,8 @@ static int kbd_backlight_acpi_get(struct samsung_galaxybook *galaxybook,
>  	buf.sasb = GB_SASB_KBD_BACKLIGHT;
>  	buf.gunm = GB_GUNM_GET;
>  
> -	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				     &buf, GB_SAWB_LEN_SETTINGS);
> +	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				     GB_SAWB_LEN_SETTINGS);
>  	if (err)
>  		return err;
>  
> @@ -331,8 +342,8 @@ static int kbd_backlight_acpi_set(struct samsung_galaxybook *galaxybook,
>  
>  	buf.guds[0] = brightness;
>  
> -	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				      &buf, GB_SAWB_LEN_SETTINGS);
> +	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				      GB_SAWB_LEN_SETTINGS);
>  }
>  
>  static enum led_brightness kbd_backlight_show(struct led_classdev *led)
> @@ -352,8 +363,8 @@ static enum led_brightness kbd_backlight_show(struct led_classdev *led)
>  static int kbd_backlight_store(struct led_classdev *led,
>  			       const enum led_brightness brightness)
>  {
> -	struct samsung_galaxybook *galaxybook =
> -		container_of_const(led, struct samsung_galaxybook, kbd_backlight);
> +	struct samsung_galaxybook *galaxybook = container_of_const(
> +		led, struct samsung_galaxybook, kbd_backlight);
>  
>  	return kbd_backlight_acpi_set(galaxybook, brightness);
>  }
> @@ -364,21 +375,24 @@ static int galaxybook_kbd_backlight_init(struct samsung_galaxybook *galaxybook)
>  	enum led_brightness brightness;
>  	int err;
>  
> -	err = devm_mutex_init(&galaxybook->platform->dev, &galaxybook->kbd_backlight_lock);
> +	err = devm_mutex_init(&galaxybook->platform->dev,
> +			      &galaxybook->kbd_backlight_lock);
>  	if (err)
>  		return err;
>  
>  	err = galaxybook_enable_acpi_feature(galaxybook, GB_SASB_KBD_BACKLIGHT);
>  	if (err) {
>  		dev_dbg(&galaxybook->platform->dev,
> -			"failed to enable kbd_backlight feature, error %d\n", err);
> +			"failed to enable kbd_backlight feature, error %d\n",
> +			err);
>  		return GB_NOT_SUPPORTED;
>  	}
>  
>  	err = kbd_backlight_acpi_get(galaxybook, &brightness);
>  	if (err) {
>  		dev_dbg(&galaxybook->platform->dev,
> -			"failed to get initial kbd_backlight brightness, error %d\n", err);
> +			"failed to get initial kbd_backlight brightness, error %d\n",
> +			err);
>  		return GB_NOT_SUPPORTED;
>  	}
>  
> @@ -389,17 +403,21 @@ static int galaxybook_kbd_backlight_init(struct samsung_galaxybook *galaxybook)
>  	galaxybook->kbd_backlight.brightness_get = kbd_backlight_show;
>  	galaxybook->kbd_backlight.brightness_set_blocking = kbd_backlight_store;
>  	galaxybook->kbd_backlight.flags = LED_BRIGHT_HW_CHANGED;
> -	galaxybook->kbd_backlight.max_brightness = GB_KBD_BACKLIGHT_MAX_BRIGHTNESS;
> +	galaxybook->kbd_backlight.max_brightness =
> +		GB_KBD_BACKLIGHT_MAX_BRIGHTNESS;
>  
>  	return devm_led_classdev_register_ext(&galaxybook->platform->dev,
> -					      &galaxybook->kbd_backlight, &init_data);
> +					      &galaxybook->kbd_backlight,
> +					      &init_data);
>  }
>  
>  /*
>   * Battery Extension (adds charge_control_end_threshold to the battery device)
>   */
>  
> -static int charge_control_end_threshold_acpi_get(struct samsung_galaxybook *galaxybook, u8 *value)
> +static int
> +charge_control_end_threshold_acpi_get(struct samsung_galaxybook *galaxybook,
> +				      u8 *value)
>  {
>  	struct sawb buf = {};
>  	int err;
> @@ -410,8 +428,8 @@ static int charge_control_end_threshold_acpi_get(struct samsung_galaxybook *gala
>  	buf.guds[0] = GB_GUDS_BATTERY_CHARGE_CONTROL;
>  	buf.guds[1] = GB_GUDS_BATTERY_CHARGE_CONTROL_GET;
>  
> -	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				     &buf, GB_SAWB_LEN_SETTINGS);
> +	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				     GB_SAWB_LEN_SETTINGS);
>  	if (err)
>  		return err;
>  
> @@ -420,7 +438,9 @@ static int charge_control_end_threshold_acpi_get(struct samsung_galaxybook *gala
>  	return 0;
>  }
>  
> -static int charge_control_end_threshold_acpi_set(struct samsung_galaxybook *galaxybook, u8 value)
> +static int
> +charge_control_end_threshold_acpi_set(struct samsung_galaxybook *galaxybook,
> +				      u8 value)
>  {
>  	struct sawb buf = {};
>  
> @@ -431,15 +451,14 @@ static int charge_control_end_threshold_acpi_set(struct samsung_galaxybook *gala
>  	buf.guds[1] = GB_GUDS_BATTERY_CHARGE_CONTROL_SET;
>  	buf.guds[2] = value;
>  
> -	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				      &buf, GB_SAWB_LEN_SETTINGS);
> +	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				      GB_SAWB_LEN_SETTINGS);
>  }
>  
> -static int galaxybook_battery_ext_property_get(struct power_supply *psy,
> -					       const struct power_supply_ext *ext,
> -					       void *ext_data,
> -					       enum power_supply_property psp,
> -					       union power_supply_propval *val)
> +static int galaxybook_battery_ext_property_get(
> +	struct power_supply *psy, const struct power_supply_ext *ext,
> +	void *ext_data, enum power_supply_property psp,
> +	union power_supply_propval *val)
>  {
>  	struct samsung_galaxybook *galaxybook = ext_data;
>  	u8 value;
> @@ -464,11 +483,10 @@ static int galaxybook_battery_ext_property_get(struct power_supply *psy,
>  	return 0;
>  }
>  
> -static int galaxybook_battery_ext_property_set(struct power_supply *psy,
> -					       const struct power_supply_ext *ext,
> -					       void *ext_data,
> -					       enum power_supply_property psp,
> -					       const union power_supply_propval *val)
> +static int galaxybook_battery_ext_property_set(
> +	struct power_supply *psy, const struct power_supply_ext *ext,
> +	void *ext_data, enum power_supply_property psp,
> +	const union power_supply_propval *val)
>  {
>  	struct samsung_galaxybook *galaxybook = ext_data;
>  	u8 value;
> @@ -491,10 +509,9 @@ static int galaxybook_battery_ext_property_set(struct power_supply *psy,
>  	return charge_control_end_threshold_acpi_set(galaxybook, value);
>  }
>  
> -static int galaxybook_battery_ext_property_is_writeable(struct power_supply *psy,
> -							const struct power_supply_ext *ext,
> -							void *ext_data,
> -							enum power_supply_property psp)
> +static int galaxybook_battery_ext_property_is_writeable(
> +	struct power_supply *psy, const struct power_supply_ext *ext,
> +	void *ext_data, enum power_supply_property psp)
>  {
>  	if (psp == POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD)
>  		return true;
> @@ -507,15 +524,16 @@ static const enum power_supply_property galaxybook_battery_properties[] = {
>  };
>  
>  static const struct power_supply_ext galaxybook_battery_ext = {
> -	.name			= DRIVER_NAME,
> -	.properties		= galaxybook_battery_properties,
> -	.num_properties		= ARRAY_SIZE(galaxybook_battery_properties),
> -	.get_property		= galaxybook_battery_ext_property_get,
> -	.set_property		= galaxybook_battery_ext_property_set,
> -	.property_is_writeable	= galaxybook_battery_ext_property_is_writeable,
> +	.name = DRIVER_NAME,
> +	.properties = galaxybook_battery_properties,
> +	.num_properties = ARRAY_SIZE(galaxybook_battery_properties),
> +	.get_property = galaxybook_battery_ext_property_get,
> +	.set_property = galaxybook_battery_ext_property_set,
> +	.property_is_writeable = galaxybook_battery_ext_property_is_writeable,
>  };
>  
> -static int galaxybook_battery_add(struct power_supply *battery, struct acpi_battery_hook *hook)
> +static int galaxybook_battery_add(struct power_supply *battery,
> +				  struct acpi_battery_hook *hook)
>  {
>  	struct samsung_galaxybook *galaxybook =
>  		container_of(hook, struct samsung_galaxybook, battery_hook);
> @@ -524,13 +542,15 @@ static int galaxybook_battery_add(struct power_supply *battery, struct acpi_batt
>  					       &battery->dev, galaxybook);
>  }
>  
> -static int galaxybook_battery_remove(struct power_supply *battery, struct acpi_battery_hook *hook)
> +static int galaxybook_battery_remove(struct power_supply *battery,
> +				     struct acpi_battery_hook *hook)
>  {
>  	power_supply_unregister_extension(battery, &galaxybook_battery_ext);
>  	return 0;
>  }
>  
> -static int galaxybook_battery_threshold_init(struct samsung_galaxybook *galaxybook)
> +static int
> +galaxybook_battery_threshold_init(struct samsung_galaxybook *galaxybook)
>  {
>  	u8 value;
>  	int err;
> @@ -538,7 +558,8 @@ static int galaxybook_battery_threshold_init(struct samsung_galaxybook *galaxybo
>  	err = charge_control_end_threshold_acpi_get(galaxybook, &value);
>  	if (err) {
>  		dev_dbg(&galaxybook->platform->dev,
> -			"failed to get initial battery charge end threshold, error %d\n", err);
> +			"failed to get initial battery charge end threshold, error %d\n",
> +			err);
>  		return 0;
>  	}
>  
> @@ -546,14 +567,16 @@ static int galaxybook_battery_threshold_init(struct samsung_galaxybook *galaxybo
>  	galaxybook->battery_hook.remove_battery = galaxybook_battery_remove;
>  	galaxybook->battery_hook.name = "Samsung Galaxy Book Battery Extension";
>  
> -	return devm_battery_hook_register(&galaxybook->platform->dev, &galaxybook->battery_hook);
> +	return devm_battery_hook_register(&galaxybook->platform->dev,
> +					  &galaxybook->battery_hook);
>  }
>  
>  /*
>   * Platform Profile / Performance mode
>   */
>  
> -static int performance_mode_acpi_get(struct samsung_galaxybook *galaxybook, u8 *performance_mode)
> +static int performance_mode_acpi_get(struct samsung_galaxybook *galaxybook,
> +				     u8 *performance_mode)
>  {
>  	struct sawb buf = {};
>  	int err;
> @@ -564,8 +587,9 @@ static int performance_mode_acpi_get(struct samsung_galaxybook *galaxybook, u8 *
>  	buf.fncn = GB_FNCN_PERFORMANCE_MODE;
>  	buf.subn = GB_SUBN_PERFORMANCE_MODE_GET;
>  
> -	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_PERFORMANCE_MODE,
> -				     &buf, GB_SAWB_LEN_PERFORMANCE_MODE);
> +	err = galaxybook_acpi_method(galaxybook,
> +				     GB_ACPI_METHOD_PERFORMANCE_MODE, &buf,
> +				     GB_SAWB_LEN_PERFORMANCE_MODE);
>  	if (err)
>  		return err;
>  
> @@ -586,8 +610,9 @@ static int performance_mode_acpi_set(struct samsung_galaxybook *galaxybook,
>  	buf.subn = GB_SUBN_PERFORMANCE_MODE_SET;
>  	buf.iob0 = performance_mode;
>  
> -	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_PERFORMANCE_MODE,
> -				      &buf, GB_SAWB_LEN_PERFORMANCE_MODE);
> +	return galaxybook_acpi_method(galaxybook,
> +				      GB_ACPI_METHOD_PERFORMANCE_MODE, &buf,
> +				      GB_SAWB_LEN_PERFORMANCE_MODE);
>  }
>  
>  static int get_performance_mode_profile(struct samsung_galaxybook *galaxybook,
> @@ -615,15 +640,17 @@ static int get_performance_mode_profile(struct samsung_galaxybook *galaxybook,
>  		return -EOPNOTSUPP;
>  	default:
>  		dev_warn(&galaxybook->platform->dev,
> -			 "unrecognized performance mode 0x%x\n", performance_mode);
> +			 "unrecognized performance mode 0x%x\n",
> +			 performance_mode);
>  		return -EOPNOTSUPP;
>  	}
>  
>  	return 0;
>  }
>  
> -static int galaxybook_platform_profile_get(struct device *dev,
> -					   enum platform_profile_option *profile)
> +static int
> +galaxybook_platform_profile_get(struct device *dev,
> +				enum platform_profile_option *profile)
>  {
>  	struct samsung_galaxybook *galaxybook = dev_get_drvdata(dev);
>  	u8 performance_mode;
> @@ -633,7 +660,8 @@ static int galaxybook_platform_profile_get(struct device *dev,
>  	if (err)
>  		return err;
>  
> -	return get_performance_mode_profile(galaxybook, performance_mode, profile);
> +	return get_performance_mode_profile(galaxybook, performance_mode,
> +					    profile);
>  }
>  
>  static int galaxybook_platform_profile_set(struct device *dev,
> @@ -641,11 +669,12 @@ static int galaxybook_platform_profile_set(struct device *dev,
>  {
>  	struct samsung_galaxybook *galaxybook = dev_get_drvdata(dev);
>  
> -	return performance_mode_acpi_set(galaxybook,
> -					 galaxybook->profile_performance_modes[profile]);
> +	return performance_mode_acpi_set(
> +		galaxybook, galaxybook->profile_performance_modes[profile]);
>  }
>  
> -static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choices)
> +static int galaxybook_platform_profile_probe(void *drvdata,
> +					     unsigned long *choices)
>  {
>  	struct samsung_galaxybook *galaxybook = drvdata;
>  	u8 *perfmodes = galaxybook->profile_performance_modes;
> @@ -660,11 +689,13 @@ static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choic
>  	buf.fncn = GB_FNCN_PERFORMANCE_MODE;
>  	buf.subn = GB_SUBN_PERFORMANCE_MODE_LIST;
>  
> -	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_PERFORMANCE_MODE,
> -				     &buf, GB_SAWB_LEN_PERFORMANCE_MODE);
> +	err = galaxybook_acpi_method(galaxybook,
> +				     GB_ACPI_METHOD_PERFORMANCE_MODE, &buf,
> +				     GB_SAWB_LEN_PERFORMANCE_MODE);
>  	if (err) {
>  		dev_dbg(&galaxybook->platform->dev,
> -			"failed to get supported performance modes, error %d\n", err);
> +			"failed to get supported performance modes, error %d\n",
> +			err);
>  		return err;
>  	}
>  
> @@ -672,7 +703,8 @@ static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choic
>  	perfmodes[PLATFORM_PROFILE_LOW_POWER] = GB_PERFORMANCE_MODE_FANOFF;
>  	perfmodes[PLATFORM_PROFILE_QUIET] = GB_PERFORMANCE_MODE_LOWNOISE;
>  	perfmodes[PLATFORM_PROFILE_BALANCED] = GB_PERFORMANCE_MODE_OPTIMIZED;
> -	perfmodes[PLATFORM_PROFILE_PERFORMANCE] = GB_PERFORMANCE_MODE_PERFORMANCE;
> +	perfmodes[PLATFORM_PROFILE_PERFORMANCE] =
> +		GB_PERFORMANCE_MODE_PERFORMANCE;
>  
>  	/*
>  	 * Value returned in iob0 will have the number of supported performance
> @@ -682,10 +714,12 @@ static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choic
>  	 * values along the way if a non-legacy value exists.
>  	 */
>  	for (i = 1; i <= buf.iob0; i++) {
> -		err = get_performance_mode_profile(galaxybook, buf.iobs[i], &profile);
> +		err = get_performance_mode_profile(galaxybook, buf.iobs[i],
> +						   &profile);
>  		if (err) {
>  			dev_dbg(&galaxybook->platform->dev,
> -				"ignoring unmapped performance mode 0x%x\n", buf.iobs[i]);
> +				"ignoring unmapped performance mode 0x%x\n",
> +				buf.iobs[i]);
>  			continue;
>  		}
>  		switch (buf.iobs[i]) {
> @@ -695,7 +729,8 @@ static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choic
>  		case GB_PERFORMANCE_MODE_PERFORMANCE_V2:
>  			/* only update if not already overwritten by Ultra */
>  			if (perfmodes[profile] != GB_PERFORMANCE_MODE_ULTRA)
> -				perfmodes[profile] = GB_PERFORMANCE_MODE_PERFORMANCE_V2;
> +				perfmodes[profile] =
> +					GB_PERFORMANCE_MODE_PERFORMANCE_V2;
>  			break;
>  		case GB_PERFORMANCE_MODE_ULTRA:
>  			perfmodes[profile] = GB_PERFORMANCE_MODE_ULTRA;
> @@ -711,7 +746,8 @@ static int galaxybook_platform_profile_probe(void *drvdata, unsigned long *choic
>  
>  	/* initialize performance_mode using balanced's mapped value */
>  	if (test_bit(PLATFORM_PROFILE_BALANCED, choices))
> -		return performance_mode_acpi_set(galaxybook, perfmodes[PLATFORM_PROFILE_BALANCED]);
> +		return performance_mode_acpi_set(
> +			galaxybook, perfmodes[PLATFORM_PROFILE_BALANCED]);
>  
>  	return 0;
>  }
> @@ -722,7 +758,8 @@ static const struct platform_profile_ops galaxybook_platform_profile_ops = {
>  	.profile_set = galaxybook_platform_profile_set,
>  };
>  
> -static int galaxybook_platform_profile_init(struct samsung_galaxybook *galaxybook)
> +static int
> +galaxybook_platform_profile_init(struct samsung_galaxybook *galaxybook)
>  {
>  	struct device *platform_profile_dev;
>  	u8 performance_mode;
> @@ -731,13 +768,14 @@ static int galaxybook_platform_profile_init(struct samsung_galaxybook *galaxyboo
>  	err = performance_mode_acpi_get(galaxybook, &performance_mode);
>  	if (err) {
>  		dev_dbg(&galaxybook->platform->dev,
> -			"failed to get initial performance mode, error %d\n", err);
> +			"failed to get initial performance mode, error %d\n",
> +			err);
>  		return GB_NOT_SUPPORTED;
>  	}
>  
> -	platform_profile_dev = devm_platform_profile_register(&galaxybook->platform->dev,
> -							      DRIVER_NAME, galaxybook,
> -							      &galaxybook_platform_profile_ops);
> +	platform_profile_dev = devm_platform_profile_register(
> +		&galaxybook->platform->dev, DRIVER_NAME, galaxybook,
> +		&galaxybook_platform_profile_ops);
>  
>  	return PTR_ERR_OR_ZERO(platform_profile_dev);
>  }
> @@ -748,7 +786,8 @@ static int galaxybook_platform_profile_init(struct samsung_galaxybook *galaxyboo
>  
>  /* Power on lid open (device should power on when lid is opened) */
>  
> -static int power_on_lid_open_acpi_get(struct samsung_galaxybook *galaxybook, bool *value)
> +static int power_on_lid_open_acpi_get(struct samsung_galaxybook *galaxybook,
> +				      bool *value)
>  {
>  	struct sawb buf = {};
>  	int err;
> @@ -759,8 +798,8 @@ static int power_on_lid_open_acpi_get(struct samsung_galaxybook *galaxybook, boo
>  	buf.guds[0] = GB_GUDS_POWER_ON_LID_OPEN;
>  	buf.guds[1] = GB_GUDS_POWER_ON_LID_OPEN_GET;
>  
> -	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				     &buf, GB_SAWB_LEN_SETTINGS);
> +	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				     GB_SAWB_LEN_SETTINGS);
>  	if (err)
>  		return err;
>  
> @@ -769,7 +808,8 @@ static int power_on_lid_open_acpi_get(struct samsung_galaxybook *galaxybook, boo
>  	return 0;
>  }
>  
> -static int power_on_lid_open_acpi_set(struct samsung_galaxybook *galaxybook, const bool value)
> +static int power_on_lid_open_acpi_set(struct samsung_galaxybook *galaxybook,
> +				      const bool value)
>  {
>  	struct sawb buf = {};
>  
> @@ -782,13 +822,14 @@ static int power_on_lid_open_acpi_set(struct samsung_galaxybook *galaxybook, con
>  	buf.guds[1] = GB_GUDS_POWER_ON_LID_OPEN_SET;
>  	buf.guds[2] = value ? 1 : 0;
>  
> -	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				      &buf, GB_SAWB_LEN_SETTINGS);
> +	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				      GB_SAWB_LEN_SETTINGS);
>  }
>  
>  /* USB Charging (USB ports can provide power when device is powered off) */
>  
> -static int usb_charging_acpi_get(struct samsung_galaxybook *galaxybook, bool *value)
> +static int usb_charging_acpi_get(struct samsung_galaxybook *galaxybook,
> +				 bool *value)
>  {
>  	struct sawb buf = {};
>  	int err;
> @@ -797,8 +838,8 @@ static int usb_charging_acpi_get(struct samsung_galaxybook *galaxybook, bool *va
>  	buf.sasb = GB_SASB_USB_CHARGING_GET;
>  	buf.gunm = GB_GUNM_USB_CHARGING_GET;
>  
> -	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				     &buf, GB_SAWB_LEN_SETTINGS);
> +	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				     GB_SAWB_LEN_SETTINGS);
>  	if (err)
>  		return err;
>  
> @@ -807,7 +848,8 @@ static int usb_charging_acpi_get(struct samsung_galaxybook *galaxybook, bool *va
>  	return 0;
>  }
>  
> -static int usb_charging_acpi_set(struct samsung_galaxybook *galaxybook, const bool value)
> +static int usb_charging_acpi_set(struct samsung_galaxybook *galaxybook,
> +				 const bool value)
>  {
>  	struct sawb buf = {};
>  
> @@ -817,13 +859,14 @@ static int usb_charging_acpi_set(struct samsung_galaxybook *galaxybook, const bo
>  	buf.sasb = GB_SASB_USB_CHARGING_SET;
>  	buf.gunm = value ? GB_GUNM_USB_CHARGING_ON : GB_GUNM_USB_CHARGING_OFF;
>  
> -	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				      &buf, GB_SAWB_LEN_SETTINGS);
> +	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				      GB_SAWB_LEN_SETTINGS);
>  }
>  
>  /* Block recording (blocks access to camera and microphone) */
>  
> -static int block_recording_acpi_get(struct samsung_galaxybook *galaxybook, bool *value)
> +static int block_recording_acpi_get(struct samsung_galaxybook *galaxybook,
> +				    bool *value)
>  {
>  	struct sawb buf = {};
>  	int err;
> @@ -832,8 +875,8 @@ static int block_recording_acpi_get(struct samsung_galaxybook *galaxybook, bool
>  	buf.sasb = GB_SASB_BLOCK_RECORDING;
>  	buf.gunm = GB_GUNM_GET;
>  
> -	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				     &buf, GB_SAWB_LEN_SETTINGS);
> +	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				     GB_SAWB_LEN_SETTINGS);
>  	if (err)
>  		return err;
>  
> @@ -842,7 +885,8 @@ static int block_recording_acpi_get(struct samsung_galaxybook *galaxybook, bool
>  	return 0;
>  }
>  
> -static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook, const bool value)
> +static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook,
> +				    const bool value)
>  {
>  	struct sawb buf = {};
>  	int err;
> @@ -854,8 +898,8 @@ static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook, const
>  	buf.gunm = GB_GUNM_SET;
>  	buf.guds[0] = value ? GB_BLOCK_RECORDING_ON : GB_BLOCK_RECORDING_OFF;
>  
> -	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				     &buf, GB_SAWB_LEN_SETTINGS);
> +	err = galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				     GB_SAWB_LEN_SETTINGS);
>  	if (err)
>  		return err;
>  
> @@ -866,15 +910,18 @@ static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook, const
>  	return 0;
>  }
>  
> -static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook)
> +static int
> +galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook)
>  {
>  	bool value;
>  	int err;
>  
> -	err = galaxybook_enable_acpi_feature(galaxybook, GB_SASB_BLOCK_RECORDING);
> +	err = galaxybook_enable_acpi_feature(galaxybook,
> +					     GB_SASB_BLOCK_RECORDING);
>  	if (err) {
>  		dev_dbg(&galaxybook->platform->dev,
> -			"failed to initialize block_recording, error %d\n", err);
> +			"failed to initialize block_recording, error %d\n",
> +			err);
>  		return GB_NOT_SUPPORTED;
>  	}
>  
> @@ -883,7 +930,8 @@ static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook
>  	err = block_recording_acpi_get(galaxybook, &value);
>  	if (err) {
>  		dev_dbg(&galaxybook->platform->dev,
> -			"failed to get initial block_recording state, error %d\n", err);
> +			"failed to get initial block_recording state, error %d\n",
> +			err);
>  		return GB_NOT_SUPPORTED;
>  	}
>  
> @@ -892,11 +940,13 @@ static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook
>  	if (!galaxybook->camera_lens_cover_switch)
>  		return -ENOMEM;
>  
> -	galaxybook->camera_lens_cover_switch->name = "Samsung Galaxy Book Camera Lens Cover";
> +	galaxybook->camera_lens_cover_switch->name =
> +		"Samsung Galaxy Book Camera Lens Cover";
>  	galaxybook->camera_lens_cover_switch->phys = DRIVER_NAME "/input0";
>  	galaxybook->camera_lens_cover_switch->id.bustype = BUS_HOST;
>  
> -	input_set_capability(galaxybook->camera_lens_cover_switch, EV_SW, SW_CAMERA_LENS_COVER);
> +	input_set_capability(galaxybook->camera_lens_cover_switch, EV_SW,
> +			     SW_CAMERA_LENS_COVER);
>  
>  	err = input_register_device(galaxybook->camera_lens_cover_switch);
>  	if (err)
> @@ -911,28 +961,33 @@ static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook
>  
>  /* Firmware Attributes setup */
>  
> -static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
> +static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr,
> +			 char *buf)
>  {
>  	return sysfs_emit(buf, "enumeration\n");
>  }
>  
>  static struct kobj_attribute fw_attr_type = __ATTR_RO(type);
>  
> -static ssize_t default_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
> +static ssize_t default_value_show(struct kobject *kobj,
> +				  struct kobj_attribute *attr, char *buf)
>  {
>  	return sysfs_emit(buf, "0\n");
>  }
>  
>  static struct kobj_attribute fw_attr_default_value = __ATTR_RO(default_value);
>  
> -static ssize_t possible_values_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
> +static ssize_t possible_values_show(struct kobject *kobj,
> +				    struct kobj_attribute *attr, char *buf)
>  {
>  	return sysfs_emit(buf, "0;1\n");
>  }
>  
> -static struct kobj_attribute fw_attr_possible_values = __ATTR_RO(possible_values);
> +static struct kobj_attribute fw_attr_possible_values =
> +	__ATTR_RO(possible_values);
>  
> -static ssize_t display_name_language_code_show(struct kobject *kobj, struct kobj_attribute *attr,
> +static ssize_t display_name_language_code_show(struct kobject *kobj,
> +					       struct kobj_attribute *attr,
>  					       char *buf)
>  {
>  	return sysfs_emit(buf, "%s\n", GB_ATTR_LANGUAGE_CODE);
> @@ -941,15 +996,18 @@ static ssize_t display_name_language_code_show(struct kobject *kobj, struct kobj
>  static struct kobj_attribute fw_attr_display_name_language_code =
>  	__ATTR_RO(display_name_language_code);
>  
> -static ssize_t display_name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
> +static ssize_t display_name_show(struct kobject *kobj,
> +				 struct kobj_attribute *attr, char *buf)
>  {
>  	struct galaxybook_fw_attr *fw_attr =
>  		container_of(attr, struct galaxybook_fw_attr, display_name);
>  
> -	return sysfs_emit(buf, "%s\n", galaxybook_fw_attr_desc[fw_attr->fw_attr_id]);
> +	return sysfs_emit(buf, "%s\n",
> +			  galaxybook_fw_attr_desc[fw_attr->fw_attr_id]);
>  }
>  
> -static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
> +static ssize_t current_value_show(struct kobject *kobj,
> +				  struct kobj_attribute *attr, char *buf)
>  {
>  	struct galaxybook_fw_attr *fw_attr =
>  		container_of(attr, struct galaxybook_fw_attr, current_value);
> @@ -963,8 +1021,9 @@ static ssize_t current_value_show(struct kobject *kobj, struct kobj_attribute *a
>  	return sysfs_emit(buf, "%u\n", value);
>  }
>  
> -static ssize_t current_value_store(struct kobject *kobj, struct kobj_attribute *attr,
> -				   const char *buf, size_t count)
> +static ssize_t current_value_store(struct kobject *kobj,
> +				   struct kobj_attribute *attr, const char *buf,
> +				   size_t count)
>  {
>  	struct galaxybook_fw_attr *fw_attr =
>  		container_of(attr, struct galaxybook_fw_attr, current_value);
> @@ -988,24 +1047,26 @@ static ssize_t current_value_store(struct kobject *kobj, struct kobj_attribute *
>  	return count;
>  }
>  
> -#define NUM_FW_ATTR_ENUM_ATTRS  6
> +#define NUM_FW_ATTR_ENUM_ATTRS 6
>  
> -static int galaxybook_fw_attr_init(struct samsung_galaxybook *galaxybook,
> -				   const enum galaxybook_fw_attr_id fw_attr_id,
> -				   int (*get_value)(struct samsung_galaxybook *galaxybook,
> -						    bool *value),
> -				   int (*set_value)(struct samsung_galaxybook *galaxybook,
> -						    const bool value))
> +static int galaxybook_fw_attr_init(
> +	struct samsung_galaxybook *galaxybook,
> +	const enum galaxybook_fw_attr_id fw_attr_id,
> +	int (*get_value)(struct samsung_galaxybook *galaxybook, bool *value),
> +	int (*set_value)(struct samsung_galaxybook *galaxybook,
> +			 const bool value))
>  {
>  	struct galaxybook_fw_attr *fw_attr;
>  	struct attribute **attrs;
>  
> -	fw_attr = devm_kzalloc(&galaxybook->platform->dev, sizeof(*fw_attr), GFP_KERNEL);
> +	fw_attr = devm_kzalloc(&galaxybook->platform->dev, sizeof(*fw_attr),
> +			       GFP_KERNEL);
>  	if (!fw_attr)
>  		return -ENOMEM;
>  
> -	attrs = devm_kcalloc(&galaxybook->platform->dev, NUM_FW_ATTR_ENUM_ATTRS + 1,
> -			     sizeof(*attrs), GFP_KERNEL);
> +	attrs = devm_kcalloc(&galaxybook->platform->dev,
> +			     NUM_FW_ATTR_ENUM_ATTRS + 1, sizeof(*attrs),
> +			     GFP_KERNEL);
>  	if (!attrs)
>  		return -ENOMEM;
>  
> @@ -1036,7 +1097,8 @@ static int galaxybook_fw_attr_init(struct samsung_galaxybook *galaxybook,
>  	fw_attr->get_value = get_value;
>  	fw_attr->set_value = set_value;
>  
> -	return sysfs_create_group(&galaxybook->fw_attrs_kset->kobj, &fw_attr->attr_group);
> +	return sysfs_create_group(&galaxybook->fw_attrs_kset->kobj,
> +				  &fw_attr->attr_group);
>  }
>  
>  static void galaxybook_kset_unregister(void *data)
> @@ -1058,12 +1120,14 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
>  	bool value;
>  	int err;
>  
> -	err = devm_mutex_init(&galaxybook->platform->dev, &galaxybook->fw_attr_lock);
> +	err = devm_mutex_init(&galaxybook->platform->dev,
> +			      &galaxybook->fw_attr_lock);
>  	if (err)
>  		return err;
>  
> -	galaxybook->fw_attrs_dev = device_create(&firmware_attributes_class, NULL, MKDEV(0, 0),
> -						 NULL, "%s", DRIVER_NAME);
> +	galaxybook->fw_attrs_dev = device_create(&firmware_attributes_class,
> +						 NULL, MKDEV(0, 0), NULL, "%s",
> +						 DRIVER_NAME);
>  	if (IS_ERR(galaxybook->fw_attrs_dev))
>  		return PTR_ERR(galaxybook->fw_attrs_dev);
>  
> @@ -1073,12 +1137,13 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
>  	if (err)
>  		return err;
>  
> -	galaxybook->fw_attrs_kset = kset_create_and_add("attributes", NULL,
> -							&galaxybook->fw_attrs_dev->kobj);
> +	galaxybook->fw_attrs_kset = kset_create_and_add(
> +		"attributes", NULL, &galaxybook->fw_attrs_dev->kobj);
>  	if (!galaxybook->fw_attrs_kset)
>  		return -ENOMEM;
>  	err = devm_add_action_or_reset(&galaxybook->platform->dev,
> -				       galaxybook_kset_unregister, galaxybook->fw_attrs_kset);
> +				       galaxybook_kset_unregister,
> +				       galaxybook->fw_attrs_kset);
>  	if (err)
>  		return err;
>  
> @@ -1094,8 +1159,7 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
>  
>  	err = usb_charging_acpi_get(galaxybook, &value);
>  	if (!err) {
> -		err = galaxybook_fw_attr_init(galaxybook,
> -					      GB_ATTR_USB_CHARGING,
> +		err = galaxybook_fw_attr_init(galaxybook, GB_ATTR_USB_CHARGING,
>  					      &usb_charging_acpi_get,
>  					      &usb_charging_acpi_set);
>  		if (err)
> @@ -1110,8 +1174,7 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
>  
>  	galaxybook->has_block_recording = true;
>  
> -	return galaxybook_fw_attr_init(galaxybook,
> -				       GB_ATTR_BLOCK_RECORDING,
> +	return galaxybook_fw_attr_init(galaxybook, GB_ATTR_BLOCK_RECORDING,
>  				       &block_recording_acpi_get,
>  				       &block_recording_acpi_set);
>  }
> @@ -1138,11 +1201,13 @@ static void galaxybook_kbd_backlight_hotkey_work(struct work_struct *work)
>  	err = led_set_brightness_sync(&galaxybook->kbd_backlight, brightness);
>  	if (err) {
>  		dev_err(&galaxybook->platform->dev,
> -			"failed to set kbd_backlight brightness, error %d\n", err);
> +			"failed to set kbd_backlight brightness, error %d\n",
> +			err);
>  		return;
>  	}
>  
> -	led_classdev_notify_brightness_hw_changed(&galaxybook->kbd_backlight, brightness);
> +	led_classdev_notify_brightness_hw_changed(&galaxybook->kbd_backlight,
> +						  brightness);
>  }
>  
>  static void galaxybook_block_recording_hotkey_work(struct work_struct *work)
> @@ -1167,8 +1232,8 @@ static void galaxybook_block_recording_hotkey_work(struct work_struct *work)
>  			"failed to set block_recording, error %d\n", err);
>  }
>  
> -static bool galaxybook_i8042_filter(unsigned char data, unsigned char str, struct serio *port,
> -				    void *context)
> +static bool galaxybook_i8042_filter(unsigned char data, unsigned char str,
> +				    struct serio *port, void *context)
>  {
>  	struct samsung_galaxybook *galaxybook = context;
>  	static bool extended;
> @@ -1186,14 +1251,17 @@ static bool galaxybook_i8042_filter(unsigned char data, unsigned char str, struc
>  			return true;
>  		case GB_KEY_KBD_BACKLIGHT_KEYUP:
>  			if (galaxybook->has_kbd_backlight)
> -				schedule_work(&galaxybook->kbd_backlight_hotkey_work);
> +				schedule_work(
> +					&galaxybook->kbd_backlight_hotkey_work);
>  			return true;
>  
>  		case GB_KEY_BLOCK_RECORDING_KEYDOWN:
>  			return true;
>  		case GB_KEY_BLOCK_RECORDING_KEYUP:
>  			if (galaxybook->has_block_recording)
> -				schedule_work(&galaxybook->block_recording_hotkey_work);
> +				schedule_work(
> +					&galaxybook
> +						 ->block_recording_hotkey_work);
>  			return true;
>  
>  		/* battery notification already sent to battery + SCAI device */
> @@ -1223,7 +1291,8 @@ static void galaxybook_i8042_filter_remove(void *data)
>  	cancel_work_sync(&galaxybook->block_recording_hotkey_work);
>  }
>  
> -static int galaxybook_i8042_filter_install(struct samsung_galaxybook *galaxybook)
> +static int
> +galaxybook_i8042_filter_install(struct samsung_galaxybook *galaxybook)
>  {
>  	int err;
>  
> @@ -1240,7 +1309,25 @@ static int galaxybook_i8042_filter_install(struct samsung_galaxybook *galaxybook
>  		return err;
>  
>  	return devm_add_action_or_reset(&galaxybook->platform->dev,
> -					galaxybook_i8042_filter_remove, galaxybook);
> +					galaxybook_i8042_filter_remove,
> +					galaxybook);
> +}
> +
> +static int galaxybook_hotkey_init(struct samsung_galaxybook *galaxybook)
> +{
> +	galaxybook->hotkey_dev =
> +		devm_input_allocate_device(&galaxybook->platform->dev);
> +	if (!galaxybook->hotkey_dev)
> +		return -ENOMEM;
> +
> +	galaxybook->hotkey_dev->name = "Samsung Galaxy Book hotkeys";
> +	galaxybook->hotkey_dev->phys = DRIVER_NAME "/input1";
> +	galaxybook->hotkey_dev->id.bustype = BUS_HOST;
> +
> +	input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_MICMUTE);
> +	input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_CAMERA);
> +
> +	return input_register_device(galaxybook->hotkey_dev);
>  }
>  
>  /*
> @@ -1260,13 +1347,37 @@ static void galaxybook_acpi_notify(acpi_handle handle, u32 event, void *data)
>  		if (galaxybook->has_performance_mode)
>  			platform_profile_cycle();
>  		break;
> +	case GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT:
> +		if (galaxybook->has_kbd_backlight)
> +			schedule_work(&galaxybook->kbd_backlight_hotkey_work);
> +		break;
> +	case GB_ACPI_NOTIFY_HOTKEY_MICMUTE:
> +		if (galaxybook->hotkey_dev) {
> +			input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE,
> +					 1);
> +			input_sync(galaxybook->hotkey_dev);
> +			input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE,
> +					 0);
> +			input_sync(galaxybook->hotkey_dev);
> +		}
> +		break;
> +	case GB_ACPI_NOTIFY_HOTKEY_CAMERA:
> +		if (galaxybook->has_block_recording)
> +			schedule_work(&galaxybook->block_recording_hotkey_work);
> +		else if (galaxybook->hotkey_dev) {
> +			input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 1);
> +			input_sync(galaxybook->hotkey_dev);
> +			input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 0);
> +			input_sync(galaxybook->hotkey_dev);
> +		}
> +		break;
>  	default:
>  		dev_warn(&galaxybook->platform->dev,
>  			 "unknown ACPI notification event: 0x%x\n", event);
>  	}
>  
> -	acpi_bus_generate_netlink_event(DRIVER_NAME, dev_name(&galaxybook->platform->dev),
> -					event, 1);
> +	acpi_bus_generate_netlink_event(
> +		DRIVER_NAME, dev_name(&galaxybook->platform->dev), event, 1);
>  }
>  
>  static int galaxybook_enable_acpi_notify(struct samsung_galaxybook *galaxybook)
> @@ -1283,8 +1394,8 @@ static int galaxybook_enable_acpi_notify(struct samsung_galaxybook *galaxybook)
>  	buf.gunm = GB_GUNM_ACPI_NOTIFY_ENABLE;
>  	buf.guds[0] = GB_GUDS_ACPI_NOTIFY_ENABLE;
>  
> -	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS,
> -				      &buf, GB_SAWB_LEN_SETTINGS);
> +	return galaxybook_acpi_method(galaxybook, GB_ACPI_METHOD_SETTINGS, &buf,
> +				      GB_SAWB_LEN_SETTINGS);
>  }
>  
>  static void galaxybook_acpi_remove_notify_handler(void *data)
> @@ -1300,7 +1411,8 @@ static void galaxybook_acpi_disable(void *data)
>  	struct samsung_galaxybook *galaxybook = data;
>  
>  	acpi_execute_simple_method(galaxybook->acpi->handle,
> -				   GB_ACPI_METHOD_ENABLE, GB_ACPI_METHOD_ENABLE_OFF);
> +				   GB_ACPI_METHOD_ENABLE,
> +				   GB_ACPI_METHOD_ENABLE_OFF);
>  }
>  
>  static int galaxybook_acpi_init(struct samsung_galaxybook *galaxybook)
> @@ -1308,7 +1420,8 @@ static int galaxybook_acpi_init(struct samsung_galaxybook *galaxybook)
>  	acpi_status status;
>  	int err;
>  
> -	status = acpi_execute_simple_method(galaxybook->acpi->handle, GB_ACPI_METHOD_ENABLE,
> +	status = acpi_execute_simple_method(galaxybook->acpi->handle,
> +					    GB_ACPI_METHOD_ENABLE,
>  					    GB_ACPI_METHOD_ENABLE_ON);
>  	if (ACPI_FAILURE(status))
>  		return -EIO;
> @@ -1317,21 +1430,26 @@ static int galaxybook_acpi_init(struct samsung_galaxybook *galaxybook)
>  	if (err)
>  		return err;
>  
> -	status = acpi_install_notify_handler(galaxybook->acpi->handle, ACPI_ALL_NOTIFY,
> -					     galaxybook_acpi_notify, galaxybook);
> +	status = acpi_install_notify_handler(galaxybook->acpi->handle,
> +					     ACPI_ALL_NOTIFY,
> +					     galaxybook_acpi_notify,
> +					     galaxybook);
>  	if (ACPI_FAILURE(status))
>  		return -EIO;
>  	err = devm_add_action_or_reset(&galaxybook->platform->dev,
> -				       galaxybook_acpi_remove_notify_handler, galaxybook);
> +				       galaxybook_acpi_remove_notify_handler,
> +				       galaxybook);
>  	if (err)
>  		return err;
>  
>  	err = galaxybook_enable_acpi_notify(galaxybook);
>  	if (err)
> -		dev_dbg(&galaxybook->platform->dev, "failed to enable ACPI notifications; "
> +		dev_dbg(&galaxybook->platform->dev,
> +			"failed to enable ACPI notifications; "
>  			"some hotkeys will not be supported\n");
>  
> -	err = galaxybook_enable_acpi_feature(galaxybook, GB_SASB_POWER_MANAGEMENT);
> +	err = galaxybook_enable_acpi_feature(galaxybook,
> +					     GB_SASB_POWER_MANAGEMENT);
>  	if (err)
>  		dev_dbg(&galaxybook->platform->dev,
>  			"failed to initialize ACPI power management features; "
> @@ -1382,8 +1500,9 @@ static int galaxybook_probe(struct platform_device *pdev)
>  
>  	err = galaxybook_battery_threshold_init(galaxybook);
>  	if (err)
> -		return dev_err_probe(&galaxybook->platform->dev, err,
> -				     "failed to initialize battery threshold\n");
> +		return dev_err_probe(
> +			&galaxybook->platform->dev, err,
> +			"failed to initialize battery threshold\n");
>  
>  	err = galaxybook_kbd_backlight_init(galaxybook);
>  	if (!err)
> @@ -1394,8 +1513,15 @@ static int galaxybook_probe(struct platform_device *pdev)
>  
>  	err = galaxybook_fw_attrs_init(galaxybook);
>  	if (err)
> -		return dev_err_probe(&galaxybook->platform->dev, err,
> -				     "failed to initialize firmware-attributes\n");
> +		return dev_err_probe(
> +			&galaxybook->platform->dev, err,
> +			"failed to initialize firmware-attributes\n");
> +
> +	err = galaxybook_hotkey_init(galaxybook);
> +	if (err)
> +		return dev_err_probe(
> +			&galaxybook->platform->dev, err,
> +			"failed to initialize hotkey input device\n");
>  
>  	err = galaxybook_i8042_filter_install(galaxybook);
>  	if (err)
> @@ -1406,12 +1532,8 @@ static int galaxybook_probe(struct platform_device *pdev)
>  }
>  
>  static const struct acpi_device_id galaxybook_device_ids[] = {
> -	{ "SAM0426" },
> -	{ "SAM0427" },
> -	{ "SAM0428" },
> -	{ "SAM0429" },
> -	{ "SAM0430" },
> -	{}
> +	{ "SAM0426" }, { "SAM0427" }, { "SAM0428" },
> +	{ "SAM0429" }, { "SAM0430" }, {}
>  };
>  MODULE_DEVICE_TABLE(acpi, galaxybook_device_ids);
>  
> 

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

* [PATCH v2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
  2026-03-17 12:36 ` Ilpo Järvinen
@ 2026-03-18  5:42   ` Ayaan Mirza Baig
  2026-03-24 13:19     ` Ilpo Järvinen
  2026-03-24 13:36     ` [PATCH v2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications Ayaan Mirza Baig
  0 siblings, 2 replies; 13+ messages in thread
From: Ayaan Mirza Baig @ 2026-03-18  5:42 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: ayaanmirza788, ayaanmirzabaig85, josh, platform-driver-x86

On Samsung Galaxy Book 5 (SAM0430), the keyboard backlight, microphone
mute, and camera block hotkeys do not generate i8042 scancodes.
Instead they arrive as ACPI notifications 0x7d, 0x63, and 0x6f
respectively, all of which previously fell through to the deafult
"unknown" warning in galaxybook_acpi_notify().

Add handling for these three events:

- 0x7d (Fn+F9, keyboard backlight): schedule the existing
  kbd_backlight_hotkey_work which cycles brightness.

- 0x6e (Fn+F10, microphone mute): register a new hotkey input device
  and emit KEY_MICMUTE.

- 0x6f (Fn+F11, camera block): if block_recording is active use the
  existing block_recording_hotkey_work; otherwise emit KEY_CAMERA via the
  hotkey input device on models where the block_recording ACPI feature is
  not supported

Tested on Samsung Galaxy Book 5 (SAM0430).

Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
---
 drivers/platform/x86/samsung-galaxybook.c | 47 +++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
index 755cb82bdb60..f6770ede62d2 100644
--- a/drivers/platform/x86/samsung-galaxybook.c
+++ b/drivers/platform/x86/samsung-galaxybook.c
@@ -54,6 +54,7 @@ struct samsung_galaxybook {
 
 	struct work_struct block_recording_hotkey_work;
 	struct input_dev *camera_lens_cover_switch;
+	struct input_dev *hotkey_dev;
 
 	struct acpi_battery_hook battery_hook;
 
@@ -197,6 +198,9 @@ static const guid_t performance_mode_guid =
 #define GB_ACPI_NOTIFY_DEVICE_ON_TABLE          0x6c
 #define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE         0x6d
 #define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE  0x70
+#define GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT  	0x7d
+#define GB_ACPI_NOTIFY_HOTKEY_CAMERA         	0x6f
+#define GB_ACPI_NOTIFY_HOTKEY_MICMUTE        	0x6e
 
 #define GB_KEY_KBD_BACKLIGHT_KEYDOWN    0x2c
 #define GB_KEY_KBD_BACKLIGHT_KEYUP      0xac
@@ -1223,6 +1227,22 @@ static void galaxybook_i8042_filter_remove(void *data)
 	cancel_work_sync(&galaxybook->block_recording_hotkey_work);
 }
 
+static int galaxybook_hotkey_init(struct samsung_galaxybook *galaxybook)
+{
+	galaxybook->hotkey_dev = devm_input_allocate_device(&galaxybook->platform->dev);
+	if (!galaxybook->hotkey_dev)
+		return -ENOMEM;
+
+	galaxybook->hotkey_dev->name = "Samsung Galaxy Book hotkeys";
+	galaxybook->hotkey_dev->phys = DRIVER_NAME "/input1";
+	galaxybook->hotkey_dev->id.bustype = BUS_HOST;
+
+	input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_MICMUTE);
+	input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_CAMERA);
+
+	return input_register_device(galaxybook->hotkey_dev);
+}
+
 static int galaxybook_i8042_filter_install(struct samsung_galaxybook *galaxybook)
 {
 	int err;
@@ -1260,6 +1280,28 @@ static void galaxybook_acpi_notify(acpi_handle handle, u32 event, void *data)
 		if (galaxybook->has_performance_mode)
 			platform_profile_cycle();
 		break;
+	case GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT:
+		if (galaxybook->has_kbd_backlight)
+			schedule_work(&galaxybook->kbd_backlight_hotkey_work);
+		break;
+	case GB_ACPI_NOTIFY_HOTKEY_MICMUTE:
+		if (galaxybook->hotkey_dev) {
+			input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE, 1);
+			input_sync(galaxybook->hotkey_dev);
+			input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE, 0);
+			input_sync(galaxybook->hotkey_dev);
+		}
+		break;
+	case GB_ACPI_NOTIFY_HOTKEY_CAMERA:
+		if (galaxybook->has_block_recording)
+			schedule_work(&galaxybook->block_recording_hotkey_work);
+		else if (galaxybook->hotkey_dev) {
+			input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 1);
+			input_sync(galaxybook->hotkey_dev);
+			input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 0);
+			input_sync(galaxybook->hotkey_dev);
+		}
+		break;
 	default:
 		dev_warn(&galaxybook->platform->dev,
 			 "unknown ACPI notification event: 0x%x\n", event);
@@ -1397,6 +1439,11 @@ static int galaxybook_probe(struct platform_device *pdev)
 		return dev_err_probe(&galaxybook->platform->dev, err,
 				     "failed to initialize firmware-attributes\n");
 
+	err = galaxybook_hotkey_init(galaxybook);
+	if (err)
+		return dev_err_probe(&galaxybook->platform->dev, err,
+					 "failed to initialize hotkey input device\n");
+
 	err = galaxybook_i8042_filter_install(galaxybook);
 	if (err)
 		return dev_err_probe(&galaxybook->platform->dev, err,
-- 
2.53.0


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

* Re: [PATCH v2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
  2026-03-18  5:42   ` [PATCH v2] " Ayaan Mirza Baig
@ 2026-03-24 13:19     ` Ilpo Järvinen
  2026-03-26  3:15       ` [PATCH v3] " Ayaan Mirza Baig
  2026-03-24 13:36     ` [PATCH v2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications Ayaan Mirza Baig
  1 sibling, 1 reply; 13+ messages in thread
From: Ilpo Järvinen @ 2026-03-24 13:19 UTC (permalink / raw)
  To: Ayaan Mirza Baig; +Cc: ayaanmirza788, josh, platform-driver-x86

On Wed, 18 Mar 2026, Ayaan Mirza Baig wrote:

> On Samsung Galaxy Book 5 (SAM0430), the keyboard backlight, microphone
> mute, and camera block hotkeys do not generate i8042 scancodes.
> Instead they arrive as ACPI notifications 0x7d, 0x63, and 0x6f
> respectively, all of which previously fell through to the deafult
> "unknown" warning in galaxybook_acpi_notify().
> 
> Add handling for these three events:
> 
> - 0x7d (Fn+F9, keyboard backlight): schedule the existing
>   kbd_backlight_hotkey_work which cycles brightness.
> 
> - 0x6e (Fn+F10, microphone mute): register a new hotkey input device
>   and emit KEY_MICMUTE.
> 
> - 0x6f (Fn+F11, camera block): if block_recording is active use the
>   existing block_recording_hotkey_work; otherwise emit KEY_CAMERA via the
>   hotkey input device on models where the block_recording ACPI feature is
>   not supported
> 
> Tested on Samsung Galaxy Book 5 (SAM0430).
> 
> Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
> ---
>  drivers/platform/x86/samsung-galaxybook.c | 47 +++++++++++++++++++++++
>  1 file changed, 47 insertions(+)
> 
> diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
> index 755cb82bdb60..f6770ede62d2 100644
> --- a/drivers/platform/x86/samsung-galaxybook.c
> +++ b/drivers/platform/x86/samsung-galaxybook.c
> @@ -54,6 +54,7 @@ struct samsung_galaxybook {
>  
>  	struct work_struct block_recording_hotkey_work;
>  	struct input_dev *camera_lens_cover_switch;
> +	struct input_dev *hotkey_dev;
>  
>  	struct acpi_battery_hook battery_hook;
>  
> @@ -197,6 +198,9 @@ static const guid_t performance_mode_guid =
>  #define GB_ACPI_NOTIFY_DEVICE_ON_TABLE          0x6c
>  #define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE         0x6d
>  #define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE  0x70
> +#define GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT  	0x7d
> +#define GB_ACPI_NOTIFY_HOTKEY_CAMERA         	0x6f
> +#define GB_ACPI_NOTIFY_HOTKEY_MICMUTE        	0x6e

These are using tabs after space for alignment which is not allowed.

>  #define GB_KEY_KBD_BACKLIGHT_KEYDOWN    0x2c
>  #define GB_KEY_KBD_BACKLIGHT_KEYUP      0xac
> @@ -1223,6 +1227,22 @@ static void galaxybook_i8042_filter_remove(void *data)
>  	cancel_work_sync(&galaxybook->block_recording_hotkey_work);
>  }
>  
> +static int galaxybook_hotkey_init(struct samsung_galaxybook *galaxybook)
> +{
> +	galaxybook->hotkey_dev = devm_input_allocate_device(&galaxybook->platform->dev);
> +	if (!galaxybook->hotkey_dev)
> +		return -ENOMEM;
> +
> +	galaxybook->hotkey_dev->name = "Samsung Galaxy Book hotkeys";
> +	galaxybook->hotkey_dev->phys = DRIVER_NAME "/input1";
> +	galaxybook->hotkey_dev->id.bustype = BUS_HOST;
> +
> +	input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_MICMUTE);
> +	input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_CAMERA);
> +
> +	return input_register_device(galaxybook->hotkey_dev);
> +}
> +
>  static int galaxybook_i8042_filter_install(struct samsung_galaxybook *galaxybook)
>  {
>  	int err;
> @@ -1260,6 +1280,28 @@ static void galaxybook_acpi_notify(acpi_handle handle, u32 event, void *data)
>  		if (galaxybook->has_performance_mode)
>  			platform_profile_cycle();
>  		break;
> +	case GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT:
> +		if (galaxybook->has_kbd_backlight)
> +			schedule_work(&galaxybook->kbd_backlight_hotkey_work);
> +		break;
> +	case GB_ACPI_NOTIFY_HOTKEY_MICMUTE:
> +		if (galaxybook->hotkey_dev) {
> +			input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE, 1);
> +			input_sync(galaxybook->hotkey_dev);
> +			input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE, 0);
> +			input_sync(galaxybook->hotkey_dev);
> +		}
> +		break;
> +	case GB_ACPI_NOTIFY_HOTKEY_CAMERA:
> +		if (galaxybook->has_block_recording)
> +			schedule_work(&galaxybook->block_recording_hotkey_work);
> +		else if (galaxybook->hotkey_dev) {

Please always use balanced braces with "else" constructs so with a 
multiline block, both need to be using braces.

> +			input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 1);
> +			input_sync(galaxybook->hotkey_dev);
> +			input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 0);
> +			input_sync(galaxybook->hotkey_dev);
> +		}
> +		break;
>  	default:
>  		dev_warn(&galaxybook->platform->dev,
>  			 "unknown ACPI notification event: 0x%x\n", event);
> @@ -1397,6 +1439,11 @@ static int galaxybook_probe(struct platform_device *pdev)
>  		return dev_err_probe(&galaxybook->platform->dev, err,
>  				     "failed to initialize firmware-attributes\n");
>  
> +	err = galaxybook_hotkey_init(galaxybook);
> +	if (err)
> +		return dev_err_probe(&galaxybook->platform->dev, err,
> +					 "failed to initialize hotkey input device\n");
> +
>  	err = galaxybook_i8042_filter_install(galaxybook);
>  	if (err)
>  		return dev_err_probe(&galaxybook->platform->dev, err,
> 

-- 
 i.


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

* Re: [PATCH v2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
  2026-03-18  5:42   ` [PATCH v2] " Ayaan Mirza Baig
  2026-03-24 13:19     ` Ilpo Järvinen
@ 2026-03-24 13:36     ` Ayaan Mirza Baig
  1 sibling, 0 replies; 13+ messages in thread
From: Ayaan Mirza Baig @ 2026-03-24 13:36 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: ayaanmirza788, josh, platform-driver-x86

On Wed, Mar 18, 2026 at 05:42:42AM +0000, Ayaan Mirza Baig wrote:
> On Samsung Galaxy Book 5 (SAM0430), the keyboard backlight, microphone
> mute, and camera block hotkeys do not generate i8042 scancodes.
> Instead they arrive as ACPI notifications 0x7d, 0x63, and 0x6f
> respectively, all of which previously fell through to the deafult
> "unknown" warning in galaxybook_acpi_notify().

Hi Ilpo,

Just following up on this patch - I wanted to check if you had any
feedback on v2 or if there's anything I should revise further.

Happy to send a v3 if needed.

Thanks,
Ayaan

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

* [PATCH v3] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
  2026-03-24 13:19     ` Ilpo Järvinen
@ 2026-03-26  3:15       ` Ayaan Mirza Baig
  2026-04-03 13:04         ` Joshua Grisham
  0 siblings, 1 reply; 13+ messages in thread
From: Ayaan Mirza Baig @ 2026-03-26  3:15 UTC (permalink / raw)
  To: ilpo.jarvinen; +Cc: ayaanmirza788, ayaanmirzabaig85, josh, platform-driver-x86

On Samsung Galaxy Book 5 (SAM0430), the keyboard backlight, microphone
mute, and camera block hotkeys do not generate i8042 scancodes.
Instead they arrive as ACPI notifications 0x7d, 0x63, and 0x6f
respectively, all of which previously fell through to the default
"unknown" warning in galaxybook_acpi_notify().

Add handling for these three events:

- 0x7d (Fn+F9, keyboard backlight): schedule the existing
  kbd_backlight_hotkey_work which cycles brightness.

- 0x6e (Fn+F10, microphone mute): register a new hotkey input device
  and emit KEY_MICMUTE.

- 0x6f (Fn+F11, camera block): if block_recording is active use the
  existing block_recording_hotkey_work; otherwise emit KEY_CAMERA via the
  hotkey input device on models where the block_recording ACPI feature is
  not supported

Tested on Samsung Galaxy Book 5 (SAM0430).

Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
---
 drivers/platform/x86/samsung-galaxybook.c | 47 +++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
index 755cb82bdb60..fe549e224c17 100644
--- a/drivers/platform/x86/samsung-galaxybook.c
+++ b/drivers/platform/x86/samsung-galaxybook.c
@@ -54,6 +54,7 @@ struct samsung_galaxybook {
 
 	struct work_struct block_recording_hotkey_work;
 	struct input_dev *camera_lens_cover_switch;
+	struct input_dev *hotkey_dev;
 
 	struct acpi_battery_hook battery_hook;
 
@@ -197,6 +198,9 @@ static const guid_t performance_mode_guid =
 #define GB_ACPI_NOTIFY_DEVICE_ON_TABLE          0x6c
 #define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE         0x6d
 #define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE  0x70
+#define GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT  0x7d
+#define GB_ACPI_NOTIFY_HOTKEY_CAMERA         0x6f
+#define GB_ACPI_NOTIFY_HOTKEY_MICMUTE        0x6e
 
 #define GB_KEY_KBD_BACKLIGHT_KEYDOWN    0x2c
 #define GB_KEY_KBD_BACKLIGHT_KEYUP      0xac
@@ -1223,6 +1227,22 @@ static void galaxybook_i8042_filter_remove(void *data)
 	cancel_work_sync(&galaxybook->block_recording_hotkey_work);
 }
 
+static int galaxybook_hotkey_init(struct samsung_galaxybook *galaxybook)
+{
+	galaxybook->hotkey_dev = devm_input_allocate_device(&galaxybook->platform->dev);
+	if (!galaxybook->hotkey_dev)
+		return -ENOMEM;
+
+	galaxybook->hotkey_dev->name = "Samsung Galaxy Book hotkeys";
+	galaxybook->hotkey_dev->phys = DRIVER_NAME "/input1";
+	galaxybook->hotkey_dev->id.bustype = BUS_HOST;
+
+	input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_MICMUTE);
+	input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_CAMERA);
+
+	return input_register_device(galaxybook->hotkey_dev);
+}
+
 static int galaxybook_i8042_filter_install(struct samsung_galaxybook *galaxybook)
 {
 	int err;
@@ -1260,6 +1280,28 @@ static void galaxybook_acpi_notify(acpi_handle handle, u32 event, void *data)
 		if (galaxybook->has_performance_mode)
 			platform_profile_cycle();
 		break;
+	case GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT:
+		if (galaxybook->has_kbd_backlight)
+			schedule_work(&galaxybook->kbd_backlight_hotkey_work);
+		break;
+	case GB_ACPI_NOTIFY_HOTKEY_MICMUTE:
+		if (galaxybook->hotkey_dev) {
+			input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE, 1);
+			input_sync(galaxybook->hotkey_dev);
+			input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE, 0);
+			input_sync(galaxybook->hotkey_dev);
+		}
+		break;
+	case GB_ACPI_NOTIFY_HOTKEY_CAMERA:
+		if (galaxybook->has_block_recording) {
+			schedule_work(&galaxybook->block_recording_hotkey_work);
+		} else if (galaxybook->hotkey_dev) {
+			input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 1);
+			input_sync(galaxybook->hotkey_dev);
+			input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 0);
+			input_sync(galaxybook->hotkey_dev);
+		}
+		break;
 	default:
 		dev_warn(&galaxybook->platform->dev,
 			 "unknown ACPI notification event: 0x%x\n", event);
@@ -1397,6 +1439,11 @@ static int galaxybook_probe(struct platform_device *pdev)
 		return dev_err_probe(&galaxybook->platform->dev, err,
 				     "failed to initialize firmware-attributes\n");
 
+	err = galaxybook_hotkey_init(galaxybook);
+	if (err)
+		return dev_err_probe(&galaxybook->platform->dev, err,
+					 "failed to initialize hotkey input device\n");
+
 	err = galaxybook_i8042_filter_install(galaxybook);
 	if (err)
 		return dev_err_probe(&galaxybook->platform->dev, err,
-- 
2.53.0


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

* Re: [PATCH v3] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
  2026-03-26  3:15       ` [PATCH v3] " Ayaan Mirza Baig
@ 2026-04-03 13:04         ` Joshua Grisham
  2026-04-03 15:56           ` [PATCH v4] " Joshua Grisham
  0 siblings, 1 reply; 13+ messages in thread
From: Joshua Grisham @ 2026-04-03 13:04 UTC (permalink / raw)
  To: Ayaan Mirza Baig; +Cc: ilpo.jarvinen, ayaanmirza788, josh, platform-driver-x86

Hi Ayaan, first of all thank you for taking the time to figure this
out and send in the patch!! Few notes from my side inline below :)

Den ons 25 mars 2026 kl 22:45 skrev Ayaan Mirza Baig
<ayaanmirzabaig85@gmail.com>:
>
> On Samsung Galaxy Book 5 (SAM0430), the keyboard backlight, microphone
> mute, and camera block hotkeys do not generate i8042 scancodes.
> Instead they arrive as ACPI notifications 0x7d, 0x63, and 0x6f
> respectively, all of which previously fell through to the default
> "unknown" warning in galaxybook_acpi_notify().
>
> Add handling for these three events:
>
> - 0x7d (Fn+F9, keyboard backlight): schedule the existing
>   kbd_backlight_hotkey_work which cycles brightness.
>
> - 0x6e (Fn+F10, microphone mute): register a new hotkey input device
>   and emit KEY_MICMUTE.
>
> - 0x6f (Fn+F11, camera block): if block_recording is active use the
>   existing block_recording_hotkey_work; otherwise emit KEY_CAMERA via the
>   hotkey input device on models where the block_recording ACPI feature is
>   not supported

Just out of curiosity, are you sure KEY_CAMERA is the right key that
should be sent here? I think this is typically interpreted as a
"camera shutter" kind of event, and in some desktop environments or
apps it will actually cause a picture to be captured from the webcam.
I think better would be to toggle the camera shutter switch
(camera_lens_cover_switch) I already created in this driver
specifically to indicate this? You can see how this works in
block_recording_acpi_set() -- basically there it is both sending the
ACPI command (for models that support this) to actually disable the
camera, but also setting the value of the switch input
(input_report_switch + input_sync), so I guess you could always just
update the switch value without sending the ACPI command?

But, alas, just setting the status of a switch does not actually "do"
anything, but instead more correctly tries to report the status to the
right interface. Out of curiosity, do you know if there are any of the
Galaxy Book devices which report this camera switch hotkey over ACPI
and do not also support the Samsung ACPI sub function (sasb) to
enable/disable the camera (GB_SASB_BLOCK_RECORDING) ? It would be
interesting to see how they behaved and if it were possible to cover
that case in a clear way so that everything works right for them.

>
> Tested on Samsung Galaxy Book 5 (SAM0430).
>

I will try to build and load this on my Galaxy Book2 Pro and 3 Pro as
well just to rule out any potential regressions but from a quick
glance it looks like it should be fine :)

> Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
> ---
>  drivers/platform/x86/samsung-galaxybook.c | 47 +++++++++++++++++++++++
>  1 file changed, 47 insertions(+)
>
> diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
> index 755cb82bdb60..fe549e224c17 100644
> --- a/drivers/platform/x86/samsung-galaxybook.c
> +++ b/drivers/platform/x86/samsung-galaxybook.c
> @@ -54,6 +54,7 @@ struct samsung_galaxybook {
>
>         struct work_struct block_recording_hotkey_work;
>         struct input_dev *camera_lens_cover_switch;
> +       struct input_dev *hotkey_dev;
>
>         struct acpi_battery_hook battery_hook;
>
> @@ -197,6 +198,9 @@ static const guid_t performance_mode_guid =
>  #define GB_ACPI_NOTIFY_DEVICE_ON_TABLE          0x6c
>  #define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE         0x6d
>  #define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE  0x70
> +#define GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT  0x7d
> +#define GB_ACPI_NOTIFY_HOTKEY_CAMERA         0x6f
> +#define GB_ACPI_NOTIFY_HOTKEY_MICMUTE        0x6e
>

Just a minor nit but the spacing for the values on these last 3 new
lines is not aligned with the existing lines above it (it might fail
checkpatch? have not tried myself...).

>  #define GB_KEY_KBD_BACKLIGHT_KEYDOWN    0x2c
>  #define GB_KEY_KBD_BACKLIGHT_KEYUP      0xac
> @@ -1223,6 +1227,22 @@ static void galaxybook_i8042_filter_remove(void *data)
>         cancel_work_sync(&galaxybook->block_recording_hotkey_work);
>  }
>
> +static int galaxybook_hotkey_init(struct samsung_galaxybook *galaxybook)
> +{
> +       galaxybook->hotkey_dev = devm_input_allocate_device(&galaxybook->platform->dev);
> +       if (!galaxybook->hotkey_dev)
> +               return -ENOMEM;
> +
> +       galaxybook->hotkey_dev->name = "Samsung Galaxy Book hotkeys";
> +       galaxybook->hotkey_dev->phys = DRIVER_NAME "/input1";
> +       galaxybook->hotkey_dev->id.bustype = BUS_HOST;
> +
> +       input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_MICMUTE);
> +       input_set_capability(galaxybook->hotkey_dev, EV_KEY, KEY_CAMERA);
> +
> +       return input_register_device(galaxybook->hotkey_dev);
> +}
> +
>  static int galaxybook_i8042_filter_install(struct samsung_galaxybook *galaxybook)
>  {
>         int err;
> @@ -1260,6 +1280,28 @@ static void galaxybook_acpi_notify(acpi_handle handle, u32 event, void *data)
>                 if (galaxybook->has_performance_mode)
>                         platform_profile_cycle();
>                 break;
> +       case GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT:
> +               if (galaxybook->has_kbd_backlight)
> +                       schedule_work(&galaxybook->kbd_backlight_hotkey_work);
> +               break;
> +       case GB_ACPI_NOTIFY_HOTKEY_MICMUTE:
> +               if (galaxybook->hotkey_dev) {
> +                       input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE, 1);
> +                       input_sync(galaxybook->hotkey_dev);
> +                       input_report_key(galaxybook->hotkey_dev, KEY_MICMUTE, 0);
> +                       input_sync(galaxybook->hotkey_dev);
> +               }
> +               break;
> +       case GB_ACPI_NOTIFY_HOTKEY_CAMERA:
> +               if (galaxybook->has_block_recording) {
> +                       schedule_work(&galaxybook->block_recording_hotkey_work);
> +               } else if (galaxybook->hotkey_dev) {
> +                       input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 1);
> +                       input_sync(galaxybook->hotkey_dev);
> +                       input_report_key(galaxybook->hotkey_dev, KEY_CAMERA, 0);
> +                       input_sync(galaxybook->hotkey_dev);

Here is where I was talking about from above. Maybe this should
instead be something more like (with correct spacing etc):

input_report_switch(galaxybook->camera_lens_cover_switch, 1);
input_sync(galaxybook->camera_lens_cover_switch);

Also I guess it would need to keep track somehow if the lens is
"covered" / blocked (value = 1) vs not (value = 0) and toggle between
those values each time the key is pressed?

> +               }
> +               break;
>         default:
>                 dev_warn(&galaxybook->platform->dev,
>                          "unknown ACPI notification event: 0x%x\n", event);
> @@ -1397,6 +1439,11 @@ static int galaxybook_probe(struct platform_device *pdev)
>                 return dev_err_probe(&galaxybook->platform->dev, err,
>                                      "failed to initialize firmware-attributes\n");
>
> +       err = galaxybook_hotkey_init(galaxybook);
> +       if (err)
> +               return dev_err_probe(&galaxybook->platform->dev, err,
> +                                        "failed to initialize hotkey input device\n");
> +
>         err = galaxybook_i8042_filter_install(galaxybook);
>         if (err)
>                 return dev_err_probe(&galaxybook->platform->dev, err,
> --
> 2.53.0
>

Otherwise for me everything else seems pretty reasonable. Nice finds!
The only other thing I am thinking about is if someone comes and looks
at this with fresh eyes, it might be confusing why there are multiple
different hotkeys that seem to do the same thing (why they are there
and what is the difference between them). My gut reaction is this
should be written down somewhere, but I'm not sure if the preference
would be to update the docs vs some comments in the code -- any
feedback from maintainers on preference for that? :)

And of course any other input from maintainers is also welcome!

Thanks again and best regards,
Joshua

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

* [PATCH v4] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
  2026-04-03 13:04         ` Joshua Grisham
@ 2026-04-03 15:56           ` Joshua Grisham
  2026-04-03 16:06             ` Joshua Grisham
  2026-04-07  6:39             ` Ilpo Järvinen
  0 siblings, 2 replies; 13+ messages in thread
From: Joshua Grisham @ 2026-04-03 15:56 UTC (permalink / raw)
  To: ayaanmirzabaig85, ilpo.jarvinen
  Cc: josh, ayaanmirza788, platform-driver-x86, linux-kernel

From: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>

On Samsung Galaxy Book 5 (SAM0430), the keyboard backlight, microphone
mute, and camera block hotkeys do not generate i8042 scancodes.
Instead they arrive as ACPI notifications 0x7d, 0x63, and 0x6f
respectively, all of which previously fell through to the default
"unknown" warning in galaxybook_acpi_notify().

This patch refactors the existing camera lens cover input device to a
generic input device and adds handling for these three ACPI events:

- 0x7d (Fn+F9, keyboard backlight): schedule the existing
  kbd_backlight_hotkey_work which cycles brightness.

- 0x6e (Fn+F10, microphone mute): emit KEY_MICMUTE to the driver's
  input device.

- 0x6f (Fn+F11, camera block): if block_recording is active use the
  existing block_recording_hotkey_work; otherwise emit a toggle of the
  SW_CAMERA_LENS_COVER switch event to the driver's input device.

Tested on Samsung Galaxy Book 5 (SAM0430) and Samsung Galaxy Book2 Pro
(SAM0429).

Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
Co-developed-by: Joshua Grisham <josh@joshuagrisham.com>
Signed-off-by: Joshua Grisham <josh@joshuagrisham.com>

---

v3->v4: Joshua's update to Ayaan's patch with the following changes:
- refactor the camera lens cover input device to a generic input device
- use this input device for both existing camera lens cover switch and
  the new KEY_MICMUTE event
- toggle SW_CAMERA_LENS_COVER instead of emitting KEY_CAMERA event in
  case device does not support block_recording
- small comments and spacing tweaks
---
 drivers/platform/x86/samsung-galaxybook.c | 89 ++++++++++++++++-------
 1 file changed, 63 insertions(+), 26 deletions(-)

diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
index 755cb82bdb60..360bfc1e52a9 100644
--- a/drivers/platform/x86/samsung-galaxybook.c
+++ b/drivers/platform/x86/samsung-galaxybook.c
@@ -35,6 +35,7 @@
 struct samsung_galaxybook {
 	struct platform_device *platform;
 	struct acpi_device *acpi;
+	struct input_dev *input;
 
 	struct device *fw_attrs_dev;
 	struct kset *fw_attrs_kset;
@@ -50,10 +51,9 @@ struct samsung_galaxybook {
 	/* block in case brightness updated using hotkey and another thread */
 	struct mutex kbd_backlight_lock;
 
-	void *i8042_filter_ptr;
-
 	struct work_struct block_recording_hotkey_work;
-	struct input_dev *camera_lens_cover_switch;
+
+	void *i8042_filter_ptr;
 
 	struct acpi_battery_hook battery_hook;
 
@@ -198,12 +198,19 @@ static const guid_t performance_mode_guid =
 #define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE         0x6d
 #define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE  0x70
 
+/* ACPI hotkey notifications for devices with SAM0430 or higher */
+#define GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT  0x7d
+#define GB_ACPI_NOTIFY_HOTKEY_CAMERA         0x6f
+#define GB_ACPI_NOTIFY_HOTKEY_MICMUTE        0x6e
+
+/* Keyboard hotkey notifications for devices prior to SAM0430 */
 #define GB_KEY_KBD_BACKLIGHT_KEYDOWN    0x2c
 #define GB_KEY_KBD_BACKLIGHT_KEYUP      0xac
 #define GB_KEY_BLOCK_RECORDING_KEYDOWN  0x1f
 #define GB_KEY_BLOCK_RECORDING_KEYUP    0x9f
-#define GB_KEY_BATTERY_NOTIFY_KEYUP     0xf
-#define GB_KEY_BATTERY_NOTIFY_KEYDOWN   0x8f
+
+#define GB_KEY_BATTERY_NOTIFY_KEYUP    0xf
+#define GB_KEY_BATTERY_NOTIFY_KEYDOWN  0x8f
 
 /*
  * Optional features which have been determined as not supported on a particular
@@ -859,9 +866,9 @@ static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook, const
 	if (err)
 		return err;
 
-	input_report_switch(galaxybook->camera_lens_cover_switch,
-			    SW_CAMERA_LENS_COVER, value ? 1 : 0);
-	input_sync(galaxybook->camera_lens_cover_switch);
+	input_report_switch(galaxybook->input, SW_CAMERA_LENS_COVER,
+			    value ? 1 : 0);
+	input_sync(galaxybook->input);
 
 	return 0;
 }
@@ -887,24 +894,9 @@ static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook
 		return GB_NOT_SUPPORTED;
 	}
 
-	galaxybook->camera_lens_cover_switch =
-		devm_input_allocate_device(&galaxybook->platform->dev);
-	if (!galaxybook->camera_lens_cover_switch)
-		return -ENOMEM;
-
-	galaxybook->camera_lens_cover_switch->name = "Samsung Galaxy Book Camera Lens Cover";
-	galaxybook->camera_lens_cover_switch->phys = DRIVER_NAME "/input0";
-	galaxybook->camera_lens_cover_switch->id.bustype = BUS_HOST;
-
-	input_set_capability(galaxybook->camera_lens_cover_switch, EV_SW, SW_CAMERA_LENS_COVER);
-
-	err = input_register_device(galaxybook->camera_lens_cover_switch);
-	if (err)
-		return err;
-
-	input_report_switch(galaxybook->camera_lens_cover_switch,
-			    SW_CAMERA_LENS_COVER, value ? 1 : 0);
-	input_sync(galaxybook->camera_lens_cover_switch);
+	input_report_switch(galaxybook->input, SW_CAMERA_LENS_COVER,
+			    value ? 1 : 0);
+	input_sync(galaxybook->input);
 
 	return 0;
 }
@@ -1120,6 +1112,23 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
  * Hotkeys and notifications
  */
 
+static int galaxybook_input_init(struct samsung_galaxybook *galaxybook)
+{
+	galaxybook->input =
+		devm_input_allocate_device(&galaxybook->platform->dev);
+	if (!galaxybook->input)
+		return -ENOMEM;
+
+	galaxybook->input->name = "Samsung Galaxy Book Extra Inputs";
+	galaxybook->input->phys = DRIVER_NAME "/input0";
+	galaxybook->input->id.bustype = BUS_HOST;
+
+	input_set_capability(galaxybook->input, EV_KEY, KEY_MICMUTE);
+	input_set_capability(galaxybook->input, EV_SW, SW_CAMERA_LENS_COVER);
+
+	return input_register_device(galaxybook->input);
+}
+
 static void galaxybook_kbd_backlight_hotkey_work(struct work_struct *work)
 {
 	struct samsung_galaxybook *galaxybook =
@@ -1260,6 +1269,29 @@ static void galaxybook_acpi_notify(acpi_handle handle, u32 event, void *data)
 		if (galaxybook->has_performance_mode)
 			platform_profile_cycle();
 		break;
+	case GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT:
+		if (galaxybook->has_kbd_backlight)
+			schedule_work(&galaxybook->kbd_backlight_hotkey_work);
+		break;
+	case GB_ACPI_NOTIFY_HOTKEY_MICMUTE:
+		input_report_key(galaxybook->input, KEY_MICMUTE, 1);
+		input_sync(galaxybook->input);
+		input_report_key(galaxybook->input, KEY_MICMUTE, 0);
+		input_sync(galaxybook->input);
+		break;
+	case GB_ACPI_NOTIFY_HOTKEY_CAMERA:
+		if (galaxybook->has_block_recording) {
+			schedule_work(&galaxybook->block_recording_hotkey_work);
+		} else {
+			/* toggle switch on+off; actual state is unknown */
+			input_report_switch(galaxybook->input,
+					    SW_CAMERA_LENS_COVER, 1);
+			input_sync(galaxybook->input);
+			input_report_switch(galaxybook->input,
+					    SW_CAMERA_LENS_COVER, 0);
+			input_sync(galaxybook->input);
+		}
+		break;
 	default:
 		dev_warn(&galaxybook->platform->dev,
 			 "unknown ACPI notification event: 0x%x\n", event);
@@ -1360,6 +1392,11 @@ static int galaxybook_probe(struct platform_device *pdev)
 	galaxybook->platform = pdev;
 	galaxybook->acpi = adev;
 
+	err = galaxybook_input_init(galaxybook);
+	if (err)
+		return dev_err_probe(&galaxybook->platform->dev, err,
+				     "failed to initialize input device\n");
+
 	/*
 	 * Features must be enabled and initialized in the following order to
 	 * avoid failures seen on certain devices:
-- 
2.53.0


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

* Re: [PATCH v4] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
  2026-04-03 15:56           ` [PATCH v4] " Joshua Grisham
@ 2026-04-03 16:06             ` Joshua Grisham
  2026-04-07  6:39             ` Ilpo Järvinen
  1 sibling, 0 replies; 13+ messages in thread
From: Joshua Grisham @ 2026-04-03 16:06 UTC (permalink / raw)
  To: ayaanmirzabaig85
  Cc: ilpo.jarvinen, josh, ayaanmirza788, platform-driver-x86,
	linux-kernel

Hi again Ayaan,

I went ahead and made the updates to your patch like I wrote above,
but also included to just refactor the existing "camera lens cover
switch" input device to a generic one that we can use for anything (so
both this switch and the new keyboard key events). Also I switched
from using KEY_CAMERA key event to using SW_CAMERA_LENS_COVER switch
event -- hope that is all ok with you and I just went ahead and took
it upon myself to update and send as a new version of your patch!!

I have been testing as well on my GB2Pro and so far so good but can
report back in case I see any issues.

Thanks again!
Joshua

Den fre 3 apr. 2026 kl 17:56 skrev Joshua Grisham <josh@joshuagrisham.com>:
>
> From: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
>
> On Samsung Galaxy Book 5 (SAM0430), the keyboard backlight, microphone
> mute, and camera block hotkeys do not generate i8042 scancodes.
> Instead they arrive as ACPI notifications 0x7d, 0x63, and 0x6f
> respectively, all of which previously fell through to the default
> "unknown" warning in galaxybook_acpi_notify().
>
> This patch refactors the existing camera lens cover input device to a
> generic input device and adds handling for these three ACPI events:
>
> - 0x7d (Fn+F9, keyboard backlight): schedule the existing
>   kbd_backlight_hotkey_work which cycles brightness.
>
> - 0x6e (Fn+F10, microphone mute): emit KEY_MICMUTE to the driver's
>   input device.
>
> - 0x6f (Fn+F11, camera block): if block_recording is active use the
>   existing block_recording_hotkey_work; otherwise emit a toggle of the
>   SW_CAMERA_LENS_COVER switch event to the driver's input device.
>
> Tested on Samsung Galaxy Book 5 (SAM0430) and Samsung Galaxy Book2 Pro
> (SAM0429).
>
> Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
> Co-developed-by: Joshua Grisham <josh@joshuagrisham.com>
> Signed-off-by: Joshua Grisham <josh@joshuagrisham.com>
>
> ---
>
> v3->v4: Joshua's update to Ayaan's patch with the following changes:
> - refactor the camera lens cover input device to a generic input device
> - use this input device for both existing camera lens cover switch and
>   the new KEY_MICMUTE event
> - toggle SW_CAMERA_LENS_COVER instead of emitting KEY_CAMERA event in
>   case device does not support block_recording
> - small comments and spacing tweaks
> ---
>  drivers/platform/x86/samsung-galaxybook.c | 89 ++++++++++++++++-------
>  1 file changed, 63 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
> index 755cb82bdb60..360bfc1e52a9 100644
> --- a/drivers/platform/x86/samsung-galaxybook.c
> +++ b/drivers/platform/x86/samsung-galaxybook.c
> @@ -35,6 +35,7 @@
>  struct samsung_galaxybook {
>         struct platform_device *platform;
>         struct acpi_device *acpi;
> +       struct input_dev *input;
>
>         struct device *fw_attrs_dev;
>         struct kset *fw_attrs_kset;
> @@ -50,10 +51,9 @@ struct samsung_galaxybook {
>         /* block in case brightness updated using hotkey and another thread */
>         struct mutex kbd_backlight_lock;
>
> -       void *i8042_filter_ptr;
> -
>         struct work_struct block_recording_hotkey_work;
> -       struct input_dev *camera_lens_cover_switch;
> +
> +       void *i8042_filter_ptr;
>
>         struct acpi_battery_hook battery_hook;
>
> @@ -198,12 +198,19 @@ static const guid_t performance_mode_guid =
>  #define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE         0x6d
>  #define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE  0x70
>
> +/* ACPI hotkey notifications for devices with SAM0430 or higher */
> +#define GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT  0x7d
> +#define GB_ACPI_NOTIFY_HOTKEY_CAMERA         0x6f
> +#define GB_ACPI_NOTIFY_HOTKEY_MICMUTE        0x6e
> +
> +/* Keyboard hotkey notifications for devices prior to SAM0430 */
>  #define GB_KEY_KBD_BACKLIGHT_KEYDOWN    0x2c
>  #define GB_KEY_KBD_BACKLIGHT_KEYUP      0xac
>  #define GB_KEY_BLOCK_RECORDING_KEYDOWN  0x1f
>  #define GB_KEY_BLOCK_RECORDING_KEYUP    0x9f
> -#define GB_KEY_BATTERY_NOTIFY_KEYUP     0xf
> -#define GB_KEY_BATTERY_NOTIFY_KEYDOWN   0x8f
> +
> +#define GB_KEY_BATTERY_NOTIFY_KEYUP    0xf
> +#define GB_KEY_BATTERY_NOTIFY_KEYDOWN  0x8f
>
>  /*
>   * Optional features which have been determined as not supported on a particular
> @@ -859,9 +866,9 @@ static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook, const
>         if (err)
>                 return err;
>
> -       input_report_switch(galaxybook->camera_lens_cover_switch,
> -                           SW_CAMERA_LENS_COVER, value ? 1 : 0);
> -       input_sync(galaxybook->camera_lens_cover_switch);
> +       input_report_switch(galaxybook->input, SW_CAMERA_LENS_COVER,
> +                           value ? 1 : 0);
> +       input_sync(galaxybook->input);
>
>         return 0;
>  }
> @@ -887,24 +894,9 @@ static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook
>                 return GB_NOT_SUPPORTED;
>         }
>
> -       galaxybook->camera_lens_cover_switch =
> -               devm_input_allocate_device(&galaxybook->platform->dev);
> -       if (!galaxybook->camera_lens_cover_switch)
> -               return -ENOMEM;
> -
> -       galaxybook->camera_lens_cover_switch->name = "Samsung Galaxy Book Camera Lens Cover";
> -       galaxybook->camera_lens_cover_switch->phys = DRIVER_NAME "/input0";
> -       galaxybook->camera_lens_cover_switch->id.bustype = BUS_HOST;
> -
> -       input_set_capability(galaxybook->camera_lens_cover_switch, EV_SW, SW_CAMERA_LENS_COVER);
> -
> -       err = input_register_device(galaxybook->camera_lens_cover_switch);
> -       if (err)
> -               return err;
> -
> -       input_report_switch(galaxybook->camera_lens_cover_switch,
> -                           SW_CAMERA_LENS_COVER, value ? 1 : 0);
> -       input_sync(galaxybook->camera_lens_cover_switch);
> +       input_report_switch(galaxybook->input, SW_CAMERA_LENS_COVER,
> +                           value ? 1 : 0);
> +       input_sync(galaxybook->input);
>
>         return 0;
>  }
> @@ -1120,6 +1112,23 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
>   * Hotkeys and notifications
>   */
>
> +static int galaxybook_input_init(struct samsung_galaxybook *galaxybook)
> +{
> +       galaxybook->input =
> +               devm_input_allocate_device(&galaxybook->platform->dev);
> +       if (!galaxybook->input)
> +               return -ENOMEM;
> +
> +       galaxybook->input->name = "Samsung Galaxy Book Extra Inputs";
> +       galaxybook->input->phys = DRIVER_NAME "/input0";
> +       galaxybook->input->id.bustype = BUS_HOST;
> +
> +       input_set_capability(galaxybook->input, EV_KEY, KEY_MICMUTE);
> +       input_set_capability(galaxybook->input, EV_SW, SW_CAMERA_LENS_COVER);
> +
> +       return input_register_device(galaxybook->input);
> +}
> +
>  static void galaxybook_kbd_backlight_hotkey_work(struct work_struct *work)
>  {
>         struct samsung_galaxybook *galaxybook =
> @@ -1260,6 +1269,29 @@ static void galaxybook_acpi_notify(acpi_handle handle, u32 event, void *data)
>                 if (galaxybook->has_performance_mode)
>                         platform_profile_cycle();
>                 break;
> +       case GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT:
> +               if (galaxybook->has_kbd_backlight)
> +                       schedule_work(&galaxybook->kbd_backlight_hotkey_work);
> +               break;
> +       case GB_ACPI_NOTIFY_HOTKEY_MICMUTE:
> +               input_report_key(galaxybook->input, KEY_MICMUTE, 1);
> +               input_sync(galaxybook->input);
> +               input_report_key(galaxybook->input, KEY_MICMUTE, 0);
> +               input_sync(galaxybook->input);
> +               break;
> +       case GB_ACPI_NOTIFY_HOTKEY_CAMERA:
> +               if (galaxybook->has_block_recording) {
> +                       schedule_work(&galaxybook->block_recording_hotkey_work);
> +               } else {
> +                       /* toggle switch on+off; actual state is unknown */
> +                       input_report_switch(galaxybook->input,
> +                                           SW_CAMERA_LENS_COVER, 1);
> +                       input_sync(galaxybook->input);
> +                       input_report_switch(galaxybook->input,
> +                                           SW_CAMERA_LENS_COVER, 0);
> +                       input_sync(galaxybook->input);
> +               }
> +               break;
>         default:
>                 dev_warn(&galaxybook->platform->dev,
>                          "unknown ACPI notification event: 0x%x\n", event);
> @@ -1360,6 +1392,11 @@ static int galaxybook_probe(struct platform_device *pdev)
>         galaxybook->platform = pdev;
>         galaxybook->acpi = adev;
>
> +       err = galaxybook_input_init(galaxybook);
> +       if (err)
> +               return dev_err_probe(&galaxybook->platform->dev, err,
> +                                    "failed to initialize input device\n");
> +
>         /*
>          * Features must be enabled and initialized in the following order to
>          * avoid failures seen on certain devices:
> --
> 2.53.0
>

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

* Re: [PATCH v4] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
  2026-04-03 15:56           ` [PATCH v4] " Joshua Grisham
  2026-04-03 16:06             ` Joshua Grisham
@ 2026-04-07  6:39             ` Ilpo Järvinen
  2026-04-18  0:46               ` [PATCH v5 1/2] platform/x86: samsung-galaxybook: Refactor camera lens cover input device Ayaan Mirza Baig
  1 sibling, 1 reply; 13+ messages in thread
From: Ilpo Järvinen @ 2026-04-07  6:39 UTC (permalink / raw)
  To: Joshua Grisham; +Cc: ayaanmirzabaig85, ayaanmirza788, platform-driver-x86, LKML

On Fri, 3 Apr 2026, Joshua Grisham wrote:

> From: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
> 
> On Samsung Galaxy Book 5 (SAM0430), the keyboard backlight, microphone
> mute, and camera block hotkeys do not generate i8042 scancodes.
> Instead they arrive as ACPI notifications 0x7d, 0x63, and 0x6f
> respectively, all of which previously fell through to the default
> "unknown" warning in galaxybook_acpi_notify().
> 
> This patch refactors the existing camera lens cover input device to a
> generic input device and adds handling for these three ACPI events:
> 
> - 0x7d (Fn+F9, keyboard backlight): schedule the existing
>   kbd_backlight_hotkey_work which cycles brightness.
> 
> - 0x6e (Fn+F10, microphone mute): emit KEY_MICMUTE to the driver's
>   input device.
> 
> - 0x6f (Fn+F11, camera block): if block_recording is active use the
>   existing block_recording_hotkey_work; otherwise emit a toggle of the
>   SW_CAMERA_LENS_COVER switch event to the driver's input device.
> 
> Tested on Samsung Galaxy Book 5 (SAM0430) and Samsung Galaxy Book2 Pro
> (SAM0429).
> 
> Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
> Co-developed-by: Joshua Grisham <josh@joshuagrisham.com>
> Signed-off-by: Joshua Grisham <josh@joshuagrisham.com>
> 
> ---
> 
> v3->v4: Joshua's update to Ayaan's patch with the following changes:
> - refactor the camera lens cover input device to a generic input device

Hi,

Could you please do this in a two step series where you refactor the 
existing code first and add new stuff in a second patch on top of that.

-- 
 i.

> - use this input device for both existing camera lens cover switch and
>   the new KEY_MICMUTE event
> - toggle SW_CAMERA_LENS_COVER instead of emitting KEY_CAMERA event in
>   case device does not support block_recording
> - small comments and spacing tweaks
> ---
>  drivers/platform/x86/samsung-galaxybook.c | 89 ++++++++++++++++-------
>  1 file changed, 63 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
> index 755cb82bdb60..360bfc1e52a9 100644
> --- a/drivers/platform/x86/samsung-galaxybook.c
> +++ b/drivers/platform/x86/samsung-galaxybook.c
> @@ -35,6 +35,7 @@
>  struct samsung_galaxybook {
>  	struct platform_device *platform;
>  	struct acpi_device *acpi;
> +	struct input_dev *input;
>  
>  	struct device *fw_attrs_dev;
>  	struct kset *fw_attrs_kset;
> @@ -50,10 +51,9 @@ struct samsung_galaxybook {
>  	/* block in case brightness updated using hotkey and another thread */
>  	struct mutex kbd_backlight_lock;
>  
> -	void *i8042_filter_ptr;
> -
>  	struct work_struct block_recording_hotkey_work;
> -	struct input_dev *camera_lens_cover_switch;
> +
> +	void *i8042_filter_ptr;
>  
>  	struct acpi_battery_hook battery_hook;
>  
> @@ -198,12 +198,19 @@ static const guid_t performance_mode_guid =
>  #define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE         0x6d
>  #define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE  0x70
>  
> +/* ACPI hotkey notifications for devices with SAM0430 or higher */
> +#define GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT  0x7d
> +#define GB_ACPI_NOTIFY_HOTKEY_CAMERA         0x6f
> +#define GB_ACPI_NOTIFY_HOTKEY_MICMUTE        0x6e
> +
> +/* Keyboard hotkey notifications for devices prior to SAM0430 */
>  #define GB_KEY_KBD_BACKLIGHT_KEYDOWN    0x2c
>  #define GB_KEY_KBD_BACKLIGHT_KEYUP      0xac
>  #define GB_KEY_BLOCK_RECORDING_KEYDOWN  0x1f
>  #define GB_KEY_BLOCK_RECORDING_KEYUP    0x9f
> -#define GB_KEY_BATTERY_NOTIFY_KEYUP     0xf
> -#define GB_KEY_BATTERY_NOTIFY_KEYDOWN   0x8f
> +
> +#define GB_KEY_BATTERY_NOTIFY_KEYUP    0xf
> +#define GB_KEY_BATTERY_NOTIFY_KEYDOWN  0x8f
>  
>  /*
>   * Optional features which have been determined as not supported on a particular
> @@ -859,9 +866,9 @@ static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook, const
>  	if (err)
>  		return err;
>  
> -	input_report_switch(galaxybook->camera_lens_cover_switch,
> -			    SW_CAMERA_LENS_COVER, value ? 1 : 0);
> -	input_sync(galaxybook->camera_lens_cover_switch);
> +	input_report_switch(galaxybook->input, SW_CAMERA_LENS_COVER,
> +			    value ? 1 : 0);
> +	input_sync(galaxybook->input);
>  
>  	return 0;
>  }
> @@ -887,24 +894,9 @@ static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook
>  		return GB_NOT_SUPPORTED;
>  	}
>  
> -	galaxybook->camera_lens_cover_switch =
> -		devm_input_allocate_device(&galaxybook->platform->dev);
> -	if (!galaxybook->camera_lens_cover_switch)
> -		return -ENOMEM;
> -
> -	galaxybook->camera_lens_cover_switch->name = "Samsung Galaxy Book Camera Lens Cover";
> -	galaxybook->camera_lens_cover_switch->phys = DRIVER_NAME "/input0";
> -	galaxybook->camera_lens_cover_switch->id.bustype = BUS_HOST;
> -
> -	input_set_capability(galaxybook->camera_lens_cover_switch, EV_SW, SW_CAMERA_LENS_COVER);
> -
> -	err = input_register_device(galaxybook->camera_lens_cover_switch);
> -	if (err)
> -		return err;
> -
> -	input_report_switch(galaxybook->camera_lens_cover_switch,
> -			    SW_CAMERA_LENS_COVER, value ? 1 : 0);
> -	input_sync(galaxybook->camera_lens_cover_switch);
> +	input_report_switch(galaxybook->input, SW_CAMERA_LENS_COVER,
> +			    value ? 1 : 0);
> +	input_sync(galaxybook->input);
>  
>  	return 0;
>  }
> @@ -1120,6 +1112,23 @@ static int galaxybook_fw_attrs_init(struct samsung_galaxybook *galaxybook)
>   * Hotkeys and notifications
>   */
>  
> +static int galaxybook_input_init(struct samsung_galaxybook *galaxybook)
> +{
> +	galaxybook->input =
> +		devm_input_allocate_device(&galaxybook->platform->dev);
> +	if (!galaxybook->input)
> +		return -ENOMEM;
> +
> +	galaxybook->input->name = "Samsung Galaxy Book Extra Inputs";
> +	galaxybook->input->phys = DRIVER_NAME "/input0";
> +	galaxybook->input->id.bustype = BUS_HOST;
> +
> +	input_set_capability(galaxybook->input, EV_KEY, KEY_MICMUTE);
> +	input_set_capability(galaxybook->input, EV_SW, SW_CAMERA_LENS_COVER);
> +
> +	return input_register_device(galaxybook->input);
> +}
> +
>  static void galaxybook_kbd_backlight_hotkey_work(struct work_struct *work)
>  {
>  	struct samsung_galaxybook *galaxybook =
> @@ -1260,6 +1269,29 @@ static void galaxybook_acpi_notify(acpi_handle handle, u32 event, void *data)
>  		if (galaxybook->has_performance_mode)
>  			platform_profile_cycle();
>  		break;
> +	case GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT:
> +		if (galaxybook->has_kbd_backlight)
> +			schedule_work(&galaxybook->kbd_backlight_hotkey_work);
> +		break;
> +	case GB_ACPI_NOTIFY_HOTKEY_MICMUTE:
> +		input_report_key(galaxybook->input, KEY_MICMUTE, 1);
> +		input_sync(galaxybook->input);
> +		input_report_key(galaxybook->input, KEY_MICMUTE, 0);
> +		input_sync(galaxybook->input);
> +		break;
> +	case GB_ACPI_NOTIFY_HOTKEY_CAMERA:
> +		if (galaxybook->has_block_recording) {
> +			schedule_work(&galaxybook->block_recording_hotkey_work);
> +		} else {
> +			/* toggle switch on+off; actual state is unknown */
> +			input_report_switch(galaxybook->input,
> +					    SW_CAMERA_LENS_COVER, 1);
> +			input_sync(galaxybook->input);
> +			input_report_switch(galaxybook->input,
> +					    SW_CAMERA_LENS_COVER, 0);
> +			input_sync(galaxybook->input);
> +		}
> +		break;
>  	default:
>  		dev_warn(&galaxybook->platform->dev,
>  			 "unknown ACPI notification event: 0x%x\n", event);
> @@ -1360,6 +1392,11 @@ static int galaxybook_probe(struct platform_device *pdev)
>  	galaxybook->platform = pdev;
>  	galaxybook->acpi = adev;
>  
> +	err = galaxybook_input_init(galaxybook);
> +	if (err)
> +		return dev_err_probe(&galaxybook->platform->dev, err,
> +				     "failed to initialize input device\n");
> +
>  	/*
>  	 * Features must be enabled and initialized in the following order to
>  	 * avoid failures seen on certain devices:
> 

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

* [PATCH v5 1/2] platform/x86: samsung-galaxybook: Refactor camera lens cover input device
  2026-04-07  6:39             ` Ilpo Järvinen
@ 2026-04-18  0:46               ` Ayaan Mirza Baig
  2026-04-18  0:46                 ` [PATCH v5 2/2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications Ayaan Mirza Baig
  2026-05-07 14:25                 ` [PATCH v5 1/2] platform/x86: samsung-galaxybook: Refactor camera lens cover input device Ilpo Järvinen
  0 siblings, 2 replies; 13+ messages in thread
From: Ayaan Mirza Baig @ 2026-04-18  0:46 UTC (permalink / raw)
  To: ilpo.jarvinen
  Cc: ayaanmirza788, ayaanmirzabaig85, josh, linux-kernel,
	platform-driver-x86

Rename the camera_lens_cover_switch input device to a generic input
device which can be used for multiple input events. Move input device
allocation and registration into a dedicated galaxybook_input_init()
helper which is called early in probe so that the device is available
to all features.

No functional change.

Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
---
 drivers/platform/x86/samsung-galaxybook.c | 46 ++++++++++++-----------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
index 755cb82bdb60..a51ad6b03164 100644
--- a/drivers/platform/x86/samsung-galaxybook.c
+++ b/drivers/platform/x86/samsung-galaxybook.c
@@ -53,7 +53,7 @@ struct samsung_galaxybook {
 	void *i8042_filter_ptr;
 
 	struct work_struct block_recording_hotkey_work;
-	struct input_dev *camera_lens_cover_switch;
+	struct input_dev *input;
 
 	struct acpi_battery_hook battery_hook;
 
@@ -859,13 +859,28 @@ static int block_recording_acpi_set(struct samsung_galaxybook *galaxybook, const
 	if (err)
 		return err;
 
-	input_report_switch(galaxybook->camera_lens_cover_switch,
+	input_report_switch(galaxybook->input,
 			    SW_CAMERA_LENS_COVER, value ? 1 : 0);
-	input_sync(galaxybook->camera_lens_cover_switch);
+	input_sync(galaxybook->input);
 
 	return 0;
 }
 
+static int galaxybook_input_init(struct samsung_galaxybook *galaxybook)
+{
+	galaxybook->input = devm_input_allocate_device(&galaxybook->platform->dev);
+	if (!galaxybook->input)
+		return -ENOMEM;
+
+	galaxybook->input->name = "Samsung Galaxy Book Camera Lens Cover";
+	galaxybook->input->phys = DRIVER_NAME "/input0";
+	galaxybook->input->id.bustype = BUS_HOST;
+
+	input_set_capability(galaxybook->input, EV_SW, SW_CAMERA_LENS_COVER);
+
+	return input_register_device(galaxybook->input);
+}
+
 static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook)
 {
 	bool value;
@@ -887,24 +902,8 @@ static int galaxybook_block_recording_init(struct samsung_galaxybook *galaxybook
 		return GB_NOT_SUPPORTED;
 	}
 
-	galaxybook->camera_lens_cover_switch =
-		devm_input_allocate_device(&galaxybook->platform->dev);
-	if (!galaxybook->camera_lens_cover_switch)
-		return -ENOMEM;
-
-	galaxybook->camera_lens_cover_switch->name = "Samsung Galaxy Book Camera Lens Cover";
-	galaxybook->camera_lens_cover_switch->phys = DRIVER_NAME "/input0";
-	galaxybook->camera_lens_cover_switch->id.bustype = BUS_HOST;
-
-	input_set_capability(galaxybook->camera_lens_cover_switch, EV_SW, SW_CAMERA_LENS_COVER);
-
-	err = input_register_device(galaxybook->camera_lens_cover_switch);
-	if (err)
-		return err;
-
-	input_report_switch(galaxybook->camera_lens_cover_switch,
-			    SW_CAMERA_LENS_COVER, value ? 1 : 0);
-	input_sync(galaxybook->camera_lens_cover_switch);
+	input_report_switch(galaxybook->input, SW_CAMERA_LENS_COVER, value ? 1 : 0);
+	input_sync(galaxybook->input);
 
 	return 0;
 }
@@ -1392,6 +1391,11 @@ static int galaxybook_probe(struct platform_device *pdev)
 		return dev_err_probe(&galaxybook->platform->dev, err,
 				     "failed to initialize kbd_backlight\n");
 
+	err = galaxybook_input_init(galaxybook);
+	if (err)
+		return dev_err_probe(&galaxybook->platform->dev, err,
+				     "failed to initialize input device\n");
+
 	err = galaxybook_fw_attrs_init(galaxybook);
 	if (err)
 		return dev_err_probe(&galaxybook->platform->dev, err,
-- 
2.53.0


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

* [PATCH v5 2/2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
  2026-04-18  0:46               ` [PATCH v5 1/2] platform/x86: samsung-galaxybook: Refactor camera lens cover input device Ayaan Mirza Baig
@ 2026-04-18  0:46                 ` Ayaan Mirza Baig
  2026-05-07 14:25                 ` [PATCH v5 1/2] platform/x86: samsung-galaxybook: Refactor camera lens cover input device Ilpo Järvinen
  1 sibling, 0 replies; 13+ messages in thread
From: Ayaan Mirza Baig @ 2026-04-18  0:46 UTC (permalink / raw)
  To: ilpo.jarvinen
  Cc: ayaanmirza788, ayaanmirzabaig85, josh, linux-kernel,
	platform-driver-x86

On Samsung Galaxy Book 5 (SAM0430), the keyboard backlight, microphone
mute, and camera block hotkeys do not generate i8042 scancodes.
Instead they arrive as ACPI notifications 0x7d, 0x6e, and 0x6f
respectively, all of which previously fell through to the default
"unknown" warning in galaxybook_acpi_notify().

Add handling for these three events:

 - 0x7d (Fn+F9, keyboard backlight): schedule the existing
   kbd_backlight_hotkey_work which cycles brightness.

 - 0x6e (Fn+F10, microphone mute): emit KEY_MICMUTE via the driver's
   input device.

 - 0x6f (Fn+F11, camera block): if block_recording is active use the
   existing block_recording_hotkey_work; otherwise emit a toggle of
   SW_CAMERA_LENS_COVER via the driver's input device on models where
   the block_recording ACPI feature is not supported.

Tested on Samsung Galaxy Book 5 (SAM0430) and Samsung Galaxy Book2 Pro
(SAM0429).

Signed-off-by: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
Co-developed-by: Joshua Grisham <josh@joshuagrisham.com>
Signed-off-by: Joshua Grisham <josh@joshuagrisham.com>
---
 drivers/platform/x86/samsung-galaxybook.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/platform/x86/samsung-galaxybook.c b/drivers/platform/x86/samsung-galaxybook.c
index a51ad6b03164..6382af0b106c 100644
--- a/drivers/platform/x86/samsung-galaxybook.c
+++ b/drivers/platform/x86/samsung-galaxybook.c
@@ -197,6 +197,9 @@ static const guid_t performance_mode_guid =
 #define GB_ACPI_NOTIFY_DEVICE_ON_TABLE          0x6c
 #define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE         0x6d
 #define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE  0x70
+#define GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT     0x7d
+#define GB_ACPI_NOTIFY_HOTKEY_MICMUTE           0x6e
+#define GB_ACPI_NOTIFY_HOTKEY_CAMERA            0x6f
 
 #define GB_KEY_KBD_BACKLIGHT_KEYDOWN    0x2c
 #define GB_KEY_KBD_BACKLIGHT_KEYUP      0xac
@@ -876,6 +879,7 @@ static int galaxybook_input_init(struct samsung_galaxybook *galaxybook)
 	galaxybook->input->phys = DRIVER_NAME "/input0";
 	galaxybook->input->id.bustype = BUS_HOST;
 
+	input_set_capability(galaxybook->input, EV_KEY, KEY_MICMUTE);
 	input_set_capability(galaxybook->input, EV_SW, SW_CAMERA_LENS_COVER);
 
 	return input_register_device(galaxybook->input);
@@ -1259,6 +1263,25 @@ static void galaxybook_acpi_notify(acpi_handle handle, u32 event, void *data)
 		if (galaxybook->has_performance_mode)
 			platform_profile_cycle();
 		break;
+	case GB_ACPI_NOTIFY_HOTKEY_KBD_BACKLIGHT:
+		if (galaxybook->has_kbd_backlight)
+			schedule_work(&galaxybook->kbd_backlight_hotkey_work);
+		break;
+	case GB_ACPI_NOTIFY_HOTKEY_MICMUTE:
+		input_report_key(galaxybook->input, KEY_MICMUTE, 1);
+		input_sync(galaxybook->input);
+		input_report_key(galaxybook->input, KEY_MICMUTE, 0);
+		input_sync(galaxybook->input);
+		break;
+	case GB_ACPI_NOTIFY_HOTKEY_CAMERA:
+		if (galaxybook->has_block_recording) {
+			schedule_work(&galaxybook->block_recording_hotkey_work);
+		} else {
+			input_report_switch(galaxybook->input, SW_CAMERA_LENS_COVER,
+					    !test_bit(SW_CAMERA_LENS_COVER, galaxybook->input->sw));
+			input_sync(galaxybook->input);
+		}
+		break;
 	default:
 		dev_warn(&galaxybook->platform->dev,
 			 "unknown ACPI notification event: 0x%x\n", event);
-- 
2.53.0


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

* Re: [PATCH v5 1/2] platform/x86: samsung-galaxybook: Refactor camera lens cover input device
  2026-04-18  0:46               ` [PATCH v5 1/2] platform/x86: samsung-galaxybook: Refactor camera lens cover input device Ayaan Mirza Baig
  2026-04-18  0:46                 ` [PATCH v5 2/2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications Ayaan Mirza Baig
@ 2026-05-07 14:25                 ` Ilpo Järvinen
  1 sibling, 0 replies; 13+ messages in thread
From: Ilpo Järvinen @ 2026-05-07 14:25 UTC (permalink / raw)
  To: Ayaan Mirza Baig; +Cc: ayaanmirza788, josh, linux-kernel, platform-driver-x86

On Sat, 18 Apr 2026 00:46:13 +0000, Ayaan Mirza Baig wrote:

> Rename the camera_lens_cover_switch input device to a generic input
> device which can be used for multiple input events. Move input device
> allocation and registration into a dedicated galaxybook_input_init()
> helper which is called early in probe so that the device is available
> to all features.
> 
> No functional change.
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-fixes branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/2] platform/x86: samsung-galaxybook: Refactor camera lens cover input device
      commit: 72d52bac023b376b73277804b24315ea2a49ad1e
[2/2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
      commit: 90dc96c61be35a1f81b56dfc5dcb80d50debbf89

--
 i.


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

end of thread, other threads:[~2026-05-07 14:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16 19:33 [PATCH] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications Ayaan Mirza Baig
2026-03-17 12:36 ` Ilpo Järvinen
2026-03-18  5:42   ` [PATCH v2] " Ayaan Mirza Baig
2026-03-24 13:19     ` Ilpo Järvinen
2026-03-26  3:15       ` [PATCH v3] " Ayaan Mirza Baig
2026-04-03 13:04         ` Joshua Grisham
2026-04-03 15:56           ` [PATCH v4] " Joshua Grisham
2026-04-03 16:06             ` Joshua Grisham
2026-04-07  6:39             ` Ilpo Järvinen
2026-04-18  0:46               ` [PATCH v5 1/2] platform/x86: samsung-galaxybook: Refactor camera lens cover input device Ayaan Mirza Baig
2026-04-18  0:46                 ` [PATCH v5 2/2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications Ayaan Mirza Baig
2026-05-07 14:25                 ` [PATCH v5 1/2] platform/x86: samsung-galaxybook: Refactor camera lens cover input device Ilpo Järvinen
2026-03-24 13:36     ` [PATCH v2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications Ayaan Mirza Baig

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.