From bad5aebc7dc1dcedecd3cc6999f94014604a73aa Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Fri, 18 Mar 2022 06:56:57 +0900 Subject: [PATCH] kboot: Forward kblang code to asahi,kblang-code Signed-off-by: Hector Martin --- src/kboot.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/kboot.c b/src/kboot.c index 3f678792..ba335987 100644 --- a/src/kboot.c +++ b/src/kboot.c @@ -208,6 +208,20 @@ static int dt_set_chosen(void) printf("ADT: no random-seed available!\n"); } + int ipd = adt_path_offset(adt, "/arm-io/spi3/ipd"); + if (ipd < 0) { + printf("ADT: /arm-io/spi3/ipd not found, no keyboard\n"); + } else { + u32 len; + const u8 *kblang = adt_getprop(adt, ipd, "kblang-calibration", &len); + if (kblang && len >= 2) { + if (fdt_setprop_u32(dt, node, "asahi,kblang-code", kblang[1])) + bail("FDT: couldn't set asahi,kblang-code"); + } else { + printf("ADT: kblang-calibration not found, no keyboard layout\n"); + } + } + return 0; }