From nobody Tue Apr 7 12:22:05 2026 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF8B23C5540 for ; Fri, 3 Apr 2026 15:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775231817; cv=none; b=fuUQVJ36FA7MA421QNtK2+1WJD1sPCu5JUMPad4XqK7qQACc5cj4XQRzLzM90csXu2OQ4VI2XeBY8y9H9Dw4kvwTE9QbiiEmBd9aWiE0B8GpDJBHYO0VKAB4zIYuWcC+HwMMzy39ZxE7tx6RmQxKxDtPlPErb5adPsjZJju/s4I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775231817; c=relaxed/simple; bh=VHsJNyEFwIH8XfOekA32ValOXFyXwoT1K4MWfyyd9BA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h/lGMzzYJ1V8Hd1o5yqzDqkk50Fld5BdzbOoQdSPVKzzlegnzDV44SgGb+FkDYGrlqqlXhSSlHyA+tK5R5v3bsZgS7MczWb+ijmlOpZ4SbfAhufDoAoqBsq1Flz7uEHQzuEBoFB+n4vO0Ly9Zf74Zl40XJD4SOSs69b8Eis/hkg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joshuagrisham.com; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=joshuagrisham.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-38ce0ab821cso11793661fa.0 for ; Fri, 03 Apr 2026 08:56:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775231814; x=1775836614; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=G4+y8ZDf16bPcmZBwQVrQJZZDmLHCg7+9AfKHFcD4T0=; b=PF2jflrG5Qf7xfn/QWRwat1SZO6ogSvktRP1i9EIAfxc42sSCivsUg+s1f2ubJ8iBw ZG6MeqKouBGZ6+QFXnGhoMi1E1D9KPqdX0AxVlmmn+s1bj8EX8eUvTq+bNW8lPLv+0bn ZIZjt/Q81k8aHBeHrI1elknujJimyA0o8qMQWSN1al2AwakmfZjLQ76OMeyKCpTU/pvy Lb84iQnMib5SqUNtWGKMeWS1bu5XUEtKHlAAOU2EZ+2Gy3Mzz/x/XzdMzk/h+bNjilCI TsRn83W8R4Zes+YYetOivKVJKxj4Mz/5kleRkze5toalEYyJdOCMZQVr8yLLael4AXo6 3VKg== X-Forwarded-Encrypted: i=1; AJvYcCV6q32KYmQJM088qWd0HLtvFA7Bab4oOej0powABoid2vcFapTS4neZOneVb6xrOlPmWiZJJTOHHYQVdNQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yzi0YdbwNfikH6BpSFjGP4eBTtK1PxNqoiOMnJRNykv9tQ58pfx cKns9ESbj/HMHGMeC++mwhFgapJManAeA3/EAX2KEeb8ffAWFbtfUkzK X-Gm-Gg: AeBDietAO9Svo6X106bdTI4DdB0m3xaf+3D2FSeRcAZ+Nq1GevjSAOiFvIXEtym4/hP 5SesJlGPtdzkoU5kKSpmpv2i+guyHuivuBlEpAMpJBTyCuhJYlJ76EPbIHaKRDonuC0hHUmAxl+ cULhpG7avOU9yaZdVsB4wNdXUESc/IfW1hWHUCvllzWZbLMgVem5XNfhvtkPAkOYU2N1dvaZmSM zedBEiwYtxkxCGNrndhQ5MykeoCdH3CTylm5Xu8DtJeo/ZKBa0e0bVWPbttBcaAHFn6IStCMbtN rJE5g1JDRzlxulSfi5oPmkQGxtz6LeFQIXvvaFhYEQz+MkfWao9/ARfnbae1GIdrRy+C/C10JQC sjoTKHjJ+RsP2Ss0akDS584dsFzuszl4QIz7Fbw2Of1Gllgk38ieZpGF8VM7F3VQfSH0V51myFi 7HbiEHhJBZag5QlJzFHf8SXvtKrKE+tKmL5xM2/MIVszj3lLUGRGo= X-Received: by 2002:a05:6512:a88:b0:5a1:1496:922 with SMTP id 2adb3069b0e04-5a3375852aemr1050922e87.33.1775231813616; Fri, 03 Apr 2026 08:56:53 -0700 (PDT) Received: from fedora (82-183-24-76.customers.ownit.se. [82.183.24.76]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5a2c6ccc888sm1522324e87.56.2026.04.03.08.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 08:56:53 -0700 (PDT) From: Joshua Grisham To: ayaanmirzabaig85@gmail.com, ilpo.jarvinen@linux.intel.com Cc: josh@joshuagrisham.com, ayaanmirza788@gmail.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications Date: Fri, 3 Apr 2026 17:56:20 +0200 Message-ID: <20260403155620.14276-1-josh@joshuagrisham.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: 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 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 Co-developed-by: Joshua Grisham Signed-off-by: Joshua Grisham --- 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/x= 86/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; =20 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; =20 - void *i8042_filter_ptr; - struct work_struct block_recording_hotkey_work; - struct input_dev *camera_lens_cover_switch; + + void *i8042_filter_ptr; =20 struct acpi_battery_hook battery_hook; =20 @@ -198,12 +198,19 @@ static const guid_t performance_mode_guid =3D #define GB_ACPI_NOTIFY_DEVICE_OFF_TABLE 0x6d #define GB_ACPI_NOTIFY_HOTKEY_PERFORMANCE_MODE 0x70 =20 +/* 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 =20 /* * Optional features which have been determined as not supported on a part= icular @@ -859,9 +866,9 @@ static int block_recording_acpi_set(struct samsung_gala= xybook *galaxybook, const if (err) return err; =20 - 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); =20 return 0; } @@ -887,24 +894,9 @@ static int galaxybook_block_recording_init(struct sams= ung_galaxybook *galaxybook return GB_NOT_SUPPORTED; } =20 - galaxybook->camera_lens_cover_switch =3D - devm_input_allocate_device(&galaxybook->platform->dev); - if (!galaxybook->camera_lens_cover_switch) - return -ENOMEM; - - galaxybook->camera_lens_cover_switch->name =3D "Samsung Galaxy Book Camer= a Lens Cover"; - galaxybook->camera_lens_cover_switch->phys =3D DRIVER_NAME "/input0"; - galaxybook->camera_lens_cover_switch->id.bustype =3D BUS_HOST; - - input_set_capability(galaxybook->camera_lens_cover_switch, EV_SW, SW_CAME= RA_LENS_COVER); - - err =3D 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); =20 return 0; } @@ -1120,6 +1112,23 @@ static int galaxybook_fw_attrs_init(struct samsung_g= alaxybook *galaxybook) * Hotkeys and notifications */ =20 +static int galaxybook_input_init(struct samsung_galaxybook *galaxybook) +{ + galaxybook->input =3D + devm_input_allocate_device(&galaxybook->platform->dev); + if (!galaxybook->input) + return -ENOMEM; + + galaxybook->input->name =3D "Samsung Galaxy Book Extra Inputs"; + galaxybook->input->phys =3D DRIVER_NAME "/input0"; + galaxybook->input->id.bustype =3D 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 =3D @@ -1260,6 +1269,29 @@ static void galaxybook_acpi_notify(acpi_handle handl= e, 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 =3D pdev; galaxybook->acpi =3D adev; =20 + err =3D 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: --=20 2.53.0