From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Joshua Grisham <josh@joshuagrisham.com>
Cc: ayaanmirzabaig85@gmail.com, ayaanmirza788@gmail.com,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
Date: Tue, 7 Apr 2026 09:39:37 +0300 (EEST) [thread overview]
Message-ID: <c46938e0-02f0-22b1-1730-4ce87603667c@linux.intel.com> (raw)
In-Reply-To: <20260403155620.14276-1-josh@joshuagrisham.com>
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:
>
next prev parent reply other threads:[~2026-04-07 6:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c46938e0-02f0-22b1-1730-4ce87603667c@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=ayaanmirza788@gmail.com \
--cc=ayaanmirzabaig85@gmail.com \
--cc=josh@joshuagrisham.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®