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>
diff --git a/src/acpi/acpigen_ps2_keybd.c b/src/acpi/acpigen_ps2_keybd.c
index 7928dad..67e92a9 100644
--- a/src/acpi/acpigen_ps2_keybd.c
+++ b/src/acpi/acpigen_ps2_keybd.c
@@ -209,7 +209,8 @@
 				 enum ps2_action_key action_keys[],
 				 bool can_send_function_keys,
 				 bool has_numeric_keypad,
-				 bool has_scrnlock_key)
+				 bool has_scrnlock_key,
+				 bool has_alpha_num_punct_keys)
 {
 	struct acpi_dp *dp_array;
 	enum ps2_action_key key;
@@ -261,10 +262,14 @@
 		total++;
 	}
 
-	/* Write out keymap for rest of keys */
-	for (i = 0; i < ARRAY_SIZE(rest_of_keymaps); i++) {
-		keymap = rest_of_keymaps[i];
-		acpi_dp_add_integer(dp_array, NULL, keymap);
+	/* 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++) {
+			keymap = rest_of_keymaps[i];
+			acpi_dp_add_integer(dp_array, NULL, keymap);
+		}
 	}
 
 	total += ARRAY_SIZE(rest_of_keymaps);
@@ -277,7 +282,8 @@
 			      enum ps2_action_key action_keys[],
 			      bool can_send_function_keys,
 			      bool has_numeric_keypad,
-			      bool has_scrnlock_key)
+			      bool has_scrnlock_key,
+			      bool has_alpha_num_punct_keys)
 {
 	struct acpi_dp *dsd;
 
@@ -298,7 +304,7 @@
 	ssdt_generate_physmap(dsd, num_top_row_keys, action_keys);
 	ssdt_generate_keymap(dsd, num_top_row_keys, action_keys,
 			     can_send_function_keys, has_numeric_keypad,
-			     has_scrnlock_key);
+			     has_scrnlock_key, has_alpha_num_punct_keys);
 	acpi_dp_write(dsd);
 	acpigen_pop_len(); /* Scope */
 }