X86 platform drivers
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
Cc: ayaanmirza788@gmail.com, josh@joshuagrisham.com,
	 platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v2] platform/x86: samsung-galaxybook: Handle ACPI hotkey notifications
Date: Tue, 24 Mar 2026 15:19:48 +0200 (EET)	[thread overview]
Message-ID: <8e55cf70-5147-849a-ad5c-24a32727e620@linux.intel.com> (raw)
In-Reply-To: <20260318054242.24747-1-ayaanmirzabaig85@gmail.com>

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.


  reply	other threads:[~2026-03-24 13:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=8e55cf70-5147-849a-ad5c-24a32727e620@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=ayaanmirza788@gmail.com \
    --cc=ayaanmirzabaig85@gmail.com \
    --cc=josh@joshuagrisham.com \
    --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