v5.16.5-1: Touchbar less angry

Telling hid to not touch the Touchbar Display makes it not kill half
of the touchbar display when an external mouse/keyboard etc is
plugged in.

Link: https://github.com/t2linux/T2-Ubuntu-Kernel/blob/bd939c2fcdb65c72adb8f48ace6ccfe153a4325b/patches/0001-Fix-for-touchbar.patch
This commit is contained in:
Redecorating
2022-02-02 19:06:47 +11:00
parent 12a97a78d4
commit 422c4854ac
3 changed files with 43 additions and 65 deletions
@@ -1,59 +0,0 @@
From b6740001d1adbfe84768b859bee038ceeccdc50c Mon Sep 17 00:00:00 2001
From: "Ard Biesheuvel" <ardb@kernel.org>
Subject: [PATCH] efi: runtime: avoid EFIv2 runtime services on Apple x86 machines
Date: Wed, 12 Jan 2022 21:14:13 +1100
Aditya reports [0] that his recent MacbookPro crashes in the firmware
when using the variable services at runtime. The culprit appears to be a
call to QueryVariableInfo(), which we did not use to call on Apple x86
machines in the past as they only upgraded from EFI v1.10 to EFI v2.40
firmware fairly recently, and QueryVariableInfo() (along with
UpdateCapsule() et al) was added in EFI v2.00.
The only runtime service introduced in EFI v2.00 that we actually use in
Linux is QueryVariableInfo(), as the capsule based ones are optional,
generally not used at runtime (all the LVFS/fwupd firmware update
infrastructure uses helper EFI programs that invoke capsule update at
boot time, not runtime), and not implemented by Apple machines in the
first place. QueryVariableInfo() is used to 'safely' set variables,
i.e., only when there is enough space. This prevents machines with buggy
firmwares from corrupting their NVRAMs when they run out of space.
Given that Apple machines have been using EFI v1.10 services only for
the longest time (the EFI v2.0 spec was released in 2006, and Linux
support for the newly introduced runtime services was added in 2011, but
the MacbookPro12,1 released in 2015 still claims to be EFI v1.10 only),
let's avoid the EFI v2.0 ones on all Apple x86 machines.
[0] https://lore.kernel.org/all/6D757C75-65B1-468B-842D-10410081A8E4@live.com/
Cc: <stable@vger.kernel.org>
Cc: Jeremy Kerr <jk@ozlabs.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Reported-by: Aditya Garg <gargaditya08@live.com>
Tested-by: Orlando Chamberlain <redecorating@protonmail.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/efi.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index ae79c3300129..7de3f5b6e8d0 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -722,6 +722,13 @@ void __init efi_systab_report_header(const efi_table_hdr_t *systab_hdr,
systab_hdr->revision >> 16,
systab_hdr->revision & 0xffff,
vendor);
+
+ if (IS_ENABLED(CONFIG_X86_64) &&
+ systab_hdr->revision > EFI_1_10_SYSTEM_TABLE_REVISION &&
+ !strcmp(vendor, "Apple")) {
+ pr_info("Apple Mac detected, using EFI v1.10 runtime services only\n");
+ efi.runtime_version = EFI_1_10_SYSTEM_TABLE_REVISION;
+ }
}
static __initdata char memory_type_name[][13] = {
--
2.30.2
+37
View File
@@ -0,0 +1,37 @@
From 75e93e9689b4e0b24ddd4367d241cfd90183f7d7 Mon Sep 17 00:00:00 2001
From: Aditya Garg <gargaditya08@live.com>
Date: Mon, 31 Jan 2022 19:10:18 +0530
Subject: [PATCH] Fix for touchbar
---
drivers/hid/hid-ids.h | 2 ++
drivers/hid/hid-quirks.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 859750313..94aaf8777 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -177,6 +177,7 @@
#define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
#define USB_DEVICE_ID_APPLE_IRCONTROL5 0x8243
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 0x029c
+#define USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY 0x8302
#define USB_VENDOR_ID_ASUS 0x0486
#define USB_DEVICE_ID_ASUS_T91MT 0x0185
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 9af1dc8ae..2f5c54edc 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -305,6 +305,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY) },
#endif
#if IS_ENABLED(CONFIG_HID_APPLEIR)
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL) },
--
2.25.1
+6 -6
View File
@@ -4,7 +4,7 @@
# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
pkgbase=linux-t2
pkgver=5.16.4
pkgver=5.16.5
_srcname=linux-${pkgver}
pkgrel=1
pkgdesc='Linux kernel for T2 Macs'
@@ -28,9 +28,6 @@ source=(
0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
0002-HID-quirks-Add-Apple-Magic-Trackpad-2-to-hid_have_sp.patch
# Nvram Write without panic
0101-efi-runtime-avoid-EFIv2-runtime-services-on-Apple-x8.patch
# apple-bce, apple-ibridge
apple-bce::git+https://github.com/t2linux/apple-bce-drv#commit=f93c6566f98b3c95677de8010f7445fa19f75091
# Redecorating fork has kbd bl working on mbp16,*. Code quality of those changes could be better.
@@ -61,6 +58,9 @@ source=(
4008-HID-apple-Add-support-for-MacBookAir9-1-keyboard-tra.patch
4009-HID-apple-Add-support-for-MacBookPro16-1-keyboard-tr.patch
4010-HID-apple-Add-ability-to-use-numbers-as-function-key.patch
# make hid not touch tb to avoid `vhci: [00] URB failed: 3`
5001-Fix-for-touchbar.patch
# UVC Camera support
6001-media-uvcvideo-Add-support-for-Apple-T2-attached-iSi.patch
@@ -290,12 +290,11 @@ for _p in "${pkgname[@]}"; do
}"
done
sha256sums=('2be32a40b9be35a914166ab1de096ffdb50872366219e17471789a59e43b50bf'
sha256sums=('ecaeedd9d289934f97c572aa965b6959d4d47f9789220e4fc3fbb525d8f1c7ab'
'SKIP'
'7cbba374356a189faac71001c5344ce8f02434684b1ce1accefc0cc4bd6718e5'
'6b4da532421cac5600d09c0c52742aa52d848af098f7853abe60c02e9d0a3752'
'2184069ab00ef43d9674756e9b7a56d15188bc4494d34425f04ddc779c52acd8'
'f34b14ea53d216cc5cfe63c2a97b6922845c7f40ea6b05145504711c382ec6ee'
'SKIP'
'SKIP'
'b7c987889d92a48d638d5258842b10f6c856e57f29ad23475aa507c7b4ad5710'
@@ -318,6 +317,7 @@ sha256sums=('2be32a40b9be35a914166ab1de096ffdb50872366219e17471789a59e43b50bf'
'cac035fe07663a319185c644c5b39b34bef89ada348881fa4a02d15290260445'
'9dfa9f02d17c5cd9620fa2c1d43ca967b81b6a56d33c2bafae14e0c64e498baa'
'2cfc28a394117184c4fd4c14fd8d1cbf2ed6d2c5ddba93f077cbbc621d73ca81'
'bfc4fb37d7bc9744d6fe060c8f846d13b95a94bc5354ccce024d058451f6add1'
'31e65ffa0ec2a998de6a806f931a9ca684a9be5933918a94b0e79ef6456e0821'
'9ede98eceb69e9c93e25fdb2c567466963bdd2f81c0ecb9fb9e5107f6142ff26'
'862f631ef9f25453ce38d9ed0197e62d85f9f5a0625ed77237e643297fb42f75'