X86 platform drivers
 help / color / mirror / Atom feed
From: "Mark Pearson" <mpearson-lenovo@squebb.ca>
To: "Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Henrique de Moraes Holschuh" <hmh@hmh.eng.br>
Cc: "Vishnu Sankar" <vishnuocv@gmail.com>,
	"Nitin Joshi1" <njoshi1@lenovo.com>,
	ibm-acpi-devel@lists.sourceforge.net,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>
Subject: Re: [PATCH v2 16/24] platform/x86: thinkpad_acpi: Change hotkey_reserved_mask initialization
Date: Wed, 24 Apr 2024 11:11:34 -0400	[thread overview]
Message-ID: <30bc231b-4893-40d2-bfae-250a4ddb0c8f@app.fastmail.com> (raw)
In-Reply-To: <77524ca0-89bb-4223-bd42-532f34fdd055@redhat.com>



On Wed, Apr 24, 2024, at 10:47 AM, Hans de Goede wrote:
> Hi Mark,
>
> On 4/24/24 4:17 PM, Mark Pearson wrote:
>> Hi Hans,
>> 
>> On Wed, Apr 24, 2024, at 8:28 AM, Hans de Goede wrote:
>>> Change the hotkey_reserved_mask initialization to hardcode the list
>>> of reserved keys. There are only a few reserved keys and the code to
>>> iterate over the keymap will be removed when moving to sparse-keymaps.
>>>
>>> Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>> ---
>>>  drivers/platform/x86/thinkpad_acpi.c | 21 +++++++++++++++------
>>>  1 file changed, 15 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/platform/x86/thinkpad_acpi.c 
>>> b/drivers/platform/x86/thinkpad_acpi.c
>>> index 952bac635a18..cf5c741d1343 100644
>>> --- a/drivers/platform/x86/thinkpad_acpi.c
>>> +++ b/drivers/platform/x86/thinkpad_acpi.c
>>> @@ -3545,6 +3545,19 @@ static int __init hotkey_init(struct 
>>> ibm_init_struct *iibm)
>>>  	dbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_HKEY,
>>>  		   "using keymap number %lu\n", keymap_id);
>>>
>>> +	/* Keys which should be reserved on both IBM and Lenovo models */
>>> +	hotkey_reserved_mask = TP_ACPI_HKEY_KBD_LIGHT_MASK |
>>> +			       TP_ACPI_HKEY_VOLUP_MASK |
>>> +			       TP_ACPI_HKEY_VOLDWN_MASK |
>>> +			       TP_ACPI_HKEY_MUTE_MASK;
>>> +	/*
>>> +	 * Reserve brightness up/down unconditionally on IBM models, on Lenovo
>>> +	 * models these are disabled based on acpi_video_get_backlight_type().
>>> +	 */
>>> +	if (keymap_id == TPACPI_KEYMAP_IBM_GENERIC)
>>> +		hotkey_reserved_mask |= TP_ACPI_HKEY_BRGHTUP_MASK |
>>> +					TP_ACPI_HKEY_BRGHTDWN_MASK;
>>> +
>>>  	hotkey_keycode_map = kmemdup(&tpacpi_keymaps[keymap_id],
>>>  			TPACPI_HOTKEY_MAP_SIZE,	GFP_KERNEL);
>>>  	if (!hotkey_keycode_map) {
>>> @@ -3560,9 +3573,6 @@ static int __init hotkey_init(struct 
>>> ibm_init_struct *iibm)
>>>  		if (hotkey_keycode_map[i] != KEY_RESERVED) {
>>>  			input_set_capability(tpacpi_inputdev, EV_KEY,
>>>  						hotkey_keycode_map[i]);
>>> -		} else {
>>> -			if (i < sizeof(hotkey_reserved_mask)*8)
>>> -				hotkey_reserved_mask |= 1 << i;
>> 
>> Just to check my understanding here - does this change mean that the keys marked as KEY_RESERVED in the lenovo map won't make it into the mask?
>> 
>> e.g the ones in this block:
>>                 KEY_RESERVED,        /* Mute held, 0x103 */
>>                 KEY_BRIGHTNESS_MIN,  /* Backlight off */
>>                 KEY_RESERVED,        /* Clipping tool */
>>                 KEY_RESERVED,        /* Cloud */
>>                 KEY_RESERVED,
>>                 KEY_VOICECOMMAND,    /* Voice */
>>                 KEY_RESERVED,
>>                 KEY_RESERVED,        /* Gestures */
>>                 KEY_RESERVED,
>>                 KEY_RESERVED,
>>                 KEY_RESERVED,
>>                 KEY_CONFIG,          /* Settings */
>>                 KEY_RESERVED,        /* New tab */
>>                 KEY_REFRESH,         /* Reload */
>>                 KEY_BACK,            /* Back */
>>                 KEY_RESERVED,        /* Microphone down */
>>                 KEY_RESERVED,        /* Microphone up */
>>                 KEY_RESERVED,        /* Microphone cancellation */
>>                 KEY_RESERVED,        /* Camera mode */
>>                 KEY_RESERVED,        /* Rotate display, 0x116 */
>> 
>> I'm not sure what the effect will be and I don't have the 2014 X1 Carbon (I assume it's the G1) available to test with unfortunately.
>
> Only the 32 original hotkeys are affected by any of the hotkey_*_mask
> values, note:
>
> 			if (i < sizeof(hotkey_reserved_mask)*8)
> 				hotkey_reserved_mask |= 1 << i;
>
> The (i < sizeof(hotkey_reserved_mask)*8) condition translates to
> (i < 32) so this code only ever set bits in hotkey_reserved_mask
> for the 32 original hotkeys.
>
Ah - excellent. I had missed that.
Thanks!

Reviewed-by Mark Pearson <mpearson-lenovo@squebb.ca>
(and that applies for all patches in the series up to this one...getting through them slowly)

Mark

  reply	other threads:[~2024-04-24 15:10 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-24 12:28 [PATCH v2 00/24] platform/x86: thinkpad_acpi: Refactor hotkey handling and add support for some new hotkeys Hans de Goede
2024-04-24 12:28 ` [PATCH v2 01/24] platform/x86: thinkpad_acpi: Take hotkey_mutex during hotkey_exit() Hans de Goede
2024-04-24 12:28 ` [PATCH v2 02/24] platform/x86: thinkpad_acpi: Provide hotkey_poll_stop_sync() dummy Hans de Goede
2024-04-24 12:28 ` [PATCH v2 03/24] platform/x86: thinkpad_acpi: Drop setting send_/ignore_acpi_ev defaults twice Hans de Goede
2024-04-24 12:28 ` [PATCH v2 04/24] platform/x86: thinkpad_acpi: Drop ignore_acpi_ev Hans de Goede
2024-04-25  7:13   ` Ilpo Järvinen
2024-04-29  9:34     ` Hans de Goede
2024-04-24 12:28 ` [PATCH v2 05/24] platform/x86: thinkpad_acpi: Use tpacpi_input_send_key() in adaptive kbd code Hans de Goede
2024-04-24 12:28 ` [PATCH v2 06/24] platform/x86: thinkpad_acpi: Do hkey to scancode translation later Hans de Goede
2024-04-24 12:28 ` [PATCH v2 07/24] platform/x86: thinkpad_acpi: Make tpacpi_driver_event() return if it handled the event Hans de Goede
2024-04-24 12:28 ` [PATCH v2 08/24] platform/x86: thinkpad_acpi: Move adaptive kbd event handling to tpacpi_driver_event() Hans de Goede
2024-04-24 12:28 ` [PATCH v2 09/24] platform/x86: thinkpad_acpi: Move special original hotkeys handling out of switch-case Hans de Goede
2024-04-24 12:28 ` [PATCH v2 10/24] platform/x86: thinkpad_acpi: Move hotkey_user_mask check to tpacpi_input_send_key() Hans de Goede
2024-04-24 12:28 ` [PATCH v2 11/24] platform/x86: thinkpad_acpi: Always call tpacpi_driver_event() for hotkeys Hans de Goede
2024-04-24 12:28 ` [PATCH v2 12/24] platform/x86: thinkpad_acpi: Drop tpacpi_input_send_key_masked() and hotkey_driver_event() Hans de Goede
2024-04-24 12:28 ` [PATCH v2 13/24] platform/x86: thinkpad_acpi: Move hkey > scancode mapping to tpacpi_input_send_key() Hans de Goede
2024-04-24 12:28 ` [PATCH v2 14/24] platform/x86: thinkpad_acpi: Move tpacpi_driver_event() call " Hans de Goede
2024-04-24 12:28 ` [PATCH v2 15/24] platform/x86: thinkpad_acpi: Do not send ACPI netlink events for unknown hotkeys Hans de Goede
2024-04-25  8:51   ` Ilpo Järvinen
2024-04-24 12:28 ` [PATCH v2 16/24] platform/x86: thinkpad_acpi: Change hotkey_reserved_mask initialization Hans de Goede
2024-04-24 14:17   ` Mark Pearson
2024-04-24 14:47     ` Hans de Goede
2024-04-24 15:11       ` Mark Pearson [this message]
2024-04-25  9:14   ` Ilpo Järvinen
2024-04-29  9:52     ` Hans de Goede
2024-04-29 10:06       ` Ilpo Järvinen
2024-04-24 12:28 ` [PATCH v2 17/24] platform/x86: thinkpad_acpi: Use correct keycodes for volume and brightness keys Hans de Goede
2024-04-24 12:28 ` [PATCH v2 18/24] platform/x86: thinkpad_acpi: Drop KEY_RESERVED special handling Hans de Goede
2024-04-24 12:28 ` [PATCH v2 19/24] platform/x86: thinkpad_acpi: Switch to using sparse-keymap helpers Hans de Goede
2024-05-22 11:50   ` Vlastimil Babka
2024-05-22 13:30     ` Hans de Goede
2024-04-24 12:28 ` [PATCH v2 20/24] platform/x86: thinkpad_acpi: Add mappings for adaptive kbd clipping-tool and cloud keys Hans de Goede
2024-04-24 12:28 ` [PATCH v2 21/24] platform/x86: thinkpad_acpi: Simplify known_ev handling Hans de Goede
2024-04-24 12:28 ` [PATCH v2 22/24] platform/x86: thinkpad_acpi: Support for trackpoint doubletap Hans de Goede
2024-04-24 18:19   ` Mark Pearson
2024-04-29  9:57     ` Hans de Goede
2024-04-29 12:40       ` Mark Pearson
2024-04-24 12:28 ` [PATCH v2 23/24] platform/x86: thinkpad_acpi: Support for system debug info hotkey Hans de Goede
2024-04-24 12:28 ` [PATCH v2 24/24] platform/x86: thinkpad_acpi: Support hotkey to disable trackpoint doubletap Hans de Goede
2024-04-24 18:28 ` [PATCH v2 00/24] platform/x86: thinkpad_acpi: Refactor hotkey handling and add support for some new hotkeys Mark Pearson
2024-04-25  9:31 ` Ilpo Järvinen
2024-04-29 10:03 ` Hans de Goede

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=30bc231b-4893-40d2-bfae-250a4ddb0c8f@app.fastmail.com \
    --to=mpearson-lenovo@squebb.ca \
    --cc=andy@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=hmh@hmh.eng.br \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=njoshi1@lenovo.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=vishnuocv@gmail.com \
    /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