acpi/acpigen_ps2_keybd: Reduce minimum keys, optional alpha/num/punct

Librem 11's volume keys act as a PS/2 keyboard with only those two
keys.  Reduce the minimum number of top-row keys to 2.  Make the
"rest of keys" (alphanumerics, punctuation, etc.) optional.

Change-Id: Idf80b184ec816043138750ee0a869b23f1e6dcf2
Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78095
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <inforichland@gmail.com>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
This commit is contained in:
Jonathon Hall 2023-07-13 16:54:41 -04:00 committed by Felix Held
parent 1af3e3c5f8
commit b63017fb71
3 changed files with 18 additions and 10 deletions

View File

@ -209,7 +209,8 @@ static void ssdt_generate_keymap(struct acpi_dp *dp, uint8_t num_top_row_keys,
enum ps2_action_key action_keys[], enum ps2_action_key action_keys[],
bool can_send_function_keys, bool can_send_function_keys,
bool has_numeric_keypad, bool has_numeric_keypad,
bool has_scrnlock_key) bool has_scrnlock_key,
bool has_alpha_num_punct_keys)
{ {
struct acpi_dp *dp_array; struct acpi_dp *dp_array;
enum ps2_action_key key; enum ps2_action_key key;
@ -261,11 +262,15 @@ static void ssdt_generate_keymap(struct acpi_dp *dp, uint8_t num_top_row_keys,
total++; total++;
} }
/* Write out keymap for rest of keys */ /* Provide alphanumeric and punctuation keys (rest of the keyboard) if
* present
*/
if (has_alpha_num_punct_keys) {
for (i = 0; i < ARRAY_SIZE(rest_of_keymaps); i++) { for (i = 0; i < ARRAY_SIZE(rest_of_keymaps); i++) {
keymap = rest_of_keymaps[i]; keymap = rest_of_keymaps[i];
acpi_dp_add_integer(dp_array, NULL, keymap); acpi_dp_add_integer(dp_array, NULL, keymap);
} }
}
total += ARRAY_SIZE(rest_of_keymaps); total += ARRAY_SIZE(rest_of_keymaps);
printk(BIOS_INFO, "PS2K: Passing %u keymaps to kernel\n", total); printk(BIOS_INFO, "PS2K: Passing %u keymaps to kernel\n", total);
@ -277,7 +282,8 @@ void acpigen_ps2_keyboard_dsd(const char *scope, uint8_t num_top_row_keys,
enum ps2_action_key action_keys[], enum ps2_action_key action_keys[],
bool can_send_function_keys, bool can_send_function_keys,
bool has_numeric_keypad, bool has_numeric_keypad,
bool has_scrnlock_key) bool has_scrnlock_key,
bool has_alpha_num_punct_keys)
{ {
struct acpi_dp *dsd; struct acpi_dp *dsd;
@ -298,7 +304,7 @@ void acpigen_ps2_keyboard_dsd(const char *scope, uint8_t num_top_row_keys,
ssdt_generate_physmap(dsd, num_top_row_keys, action_keys); ssdt_generate_physmap(dsd, num_top_row_keys, action_keys);
ssdt_generate_keymap(dsd, num_top_row_keys, action_keys, ssdt_generate_keymap(dsd, num_top_row_keys, action_keys,
can_send_function_keys, has_numeric_keypad, can_send_function_keys, has_numeric_keypad,
has_scrnlock_key); has_scrnlock_key, has_alpha_num_punct_keys);
acpi_dp_write(dsd); acpi_dp_write(dsd);
acpigen_pop_len(); /* Scope */ acpigen_pop_len(); /* Scope */
} }

View File

@ -251,7 +251,8 @@ static void fill_ssdt_ps2_keyboard(const struct device *dev)
ps2_action_keys, ps2_action_keys,
!!(keybd.capabilities & KEYBD_CAP_FUNCTION_KEYS), !!(keybd.capabilities & KEYBD_CAP_FUNCTION_KEYS),
!!(keybd.capabilities & KEYBD_CAP_NUMERIC_KEYPAD), !!(keybd.capabilities & KEYBD_CAP_NUMERIC_KEYPAD),
!!(keybd.capabilities & KEYBD_CAP_SCRNLOCK_KEY)); !!(keybd.capabilities & KEYBD_CAP_SCRNLOCK_KEY),
true);
} }
static const char *ec_acpi_name(const struct device *dev) static const char *ec_acpi_name(const struct device *dev)

View File

@ -29,12 +29,13 @@ enum ps2_action_key {
PS2_KEY_MENU, PS2_KEY_MENU,
}; };
#define PS2_MIN_TOP_ROW_KEYS 10 #define PS2_MIN_TOP_ROW_KEYS 2
#define PS2_MAX_TOP_ROW_KEYS 15 #define PS2_MAX_TOP_ROW_KEYS 15
void acpigen_ps2_keyboard_dsd(const char *scope, uint8_t num_top_row_keys, void acpigen_ps2_keyboard_dsd(const char *scope, uint8_t num_top_row_keys,
enum ps2_action_key action_keys[], enum ps2_action_key action_keys[],
bool can_send_function_keys, bool can_send_function_keys,
bool has_numeric_keypad, bool has_scrnlock_key); bool has_numeric_keypad, bool has_scrnlock_key,
bool has_alpha_num_punct_keys);
#endif /* __ACPI_ACPIGEN_PS2_KEYBD_H__ */ #endif /* __ACPI_ACPIGEN_PS2_KEYBD_H__ */