* [PATCH v4] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
[not found] <CAMF+KeaTRH2JGs53VSJ_WMFJQMBW4wDbCkW6u3=ySxkPknDvpQ@mail.gmail.com>
@ 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; 6+ 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 [flat|nested] 6+ messages in thread
* Re: [PATCH v4] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
2026-04-03 15:56 ` [PATCH v4] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications Joshua Grisham
@ 2026-04-03 16:06 ` Joshua Grisham
2026-04-07 6:39 ` Ilpo Järvinen
1 sibling, 0 replies; 6+ 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] 6+ messages in thread
* Re: [PATCH v4] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
2026-04-03 15:56 ` [PATCH v4] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications 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; 6+ 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] 6+ 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; 6+ 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 [flat|nested] 6+ 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; 6+ 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 [flat|nested] 6+ 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; 6+ 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] 6+ messages in thread
end of thread, other threads:[~2026-05-07 14:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CAMF+KeaTRH2JGs53VSJ_WMFJQMBW4wDbCkW6u3=ySxkPknDvpQ@mail.gmail.com>
2026-04-03 15:56 ` [PATCH v4] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®