Skip to content
Snippets Groups Projects
Commit 00f1099e authored by Simon Glass's avatar Simon Glass Committed by Tom Rini
Browse files

input: Correct key_matrix fdt decoding


Some issues with this were not addressed in the previous series. Fix up
the binding decoding to deal with what is actually expected in the fdt.

This corrects the broken keyboard on seaboard.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
parent 92eee7cd
Branches
Tags
No related merge requests found
...@@ -153,6 +153,8 @@ int key_matrix_decode_fdt(struct key_matrix *config, const void *blob, ...@@ -153,6 +153,8 @@ int key_matrix_decode_fdt(struct key_matrix *config, const void *blob,
int node) int node)
{ {
const struct fdt_property *prop; const struct fdt_property *prop;
const char prefix[] = "linux,";
int plen = sizeof(prefix) - 1;
int offset; int offset;
/* Check each property name for ones that we understand */ /* Check each property name for ones that we understand */
...@@ -168,16 +170,17 @@ int key_matrix_decode_fdt(struct key_matrix *config, const void *blob, ...@@ -168,16 +170,17 @@ int key_matrix_decode_fdt(struct key_matrix *config, const void *blob,
/* Name needs to match "1,<type>keymap" */ /* Name needs to match "1,<type>keymap" */
debug("%s: property '%s'\n", __func__, name); debug("%s: property '%s'\n", __func__, name);
if (strncmp(name, "1,", 2) || len < 8 || if (strncmp(name, prefix, plen) ||
len < plen + 6 ||
strcmp(name + len - 6, "keymap")) strcmp(name + len - 6, "keymap"))
continue; continue;
len -= 8; len -= plen + 6;
if (len == 0) { if (len == 0) {
config->plain_keycode = create_keymap(config, config->plain_keycode = create_keymap(config,
(u32 *)prop->data, fdt32_to_cpu(prop->len), (u32 *)prop->data, fdt32_to_cpu(prop->len),
KEY_FN, &config->fn_pos); KEY_FN, &config->fn_pos);
} else if (0 == strncmp(name + 2, "fn-", len)) { } else if (0 == strncmp(name + plen, "fn-", len)) {
config->fn_keycode = create_keymap(config, config->fn_keycode = create_keymap(config,
(u32 *)prop->data, fdt32_to_cpu(prop->len), (u32 *)prop->data, fdt32_to_cpu(prop->len),
-1, NULL); -1, NULL);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment