drm/tiny: add driver for Apple Touch Bars in x86 Macs
authorKerem Karabay <kekrby@gmail.com>
Wed, 26 Feb 2025 16:04:36 +0000 (16:04 +0000)
committerThomas Zimmermann <tzimmermann@suse.de>
Mon, 3 Mar 2025 15:13:33 +0000 (16:13 +0100)
commit0670c2f56e45b3f4541985a9ebe06d04308e43b0
treec03bd81669c2dbb729f1735e90176712d1c63512
parentc9043706cb11b8005e145debe0a3211acd08e2c1
drm/tiny: add driver for Apple Touch Bars in x86 Macs

The Touch Bars found on x86 Macs support two USB configurations: one
where the device presents itself as a HID keyboard and can display
predefined sets of keys, and one where the operating system has full
control over what is displayed.

This commit adds support for the display functionality of the second
configuration. Functionality for the first configuration has been
merged in the HID tree.

Note that this driver has only been tested on T2 Macs, and only includes
the USB device ID for these devices. Testing on T1 Macs would be
appreciated.

Credit goes to Ben (Bingxing) Wang on GitHub for reverse engineering
most of the protocol.

Also, as requested by Andy, I would like to clarify the use of __packed
structs in this driver:

- All the packed structs are aligned except for appletbdrm_msg_information.
- We have to pack appletbdrm_msg_information since it is requirement of
  the protocol.
- We compared binaries compiled by keeping the rest structs __packed and
  not __packed using bloat-o-meter, and __packed was not affecting code
  generation.
- To maintain consistency, rest structs have been kept __packed.

I would also like to point out that since the driver was reverse-engineered
the actual data types of the protocol might be different, including, but
not limited to, endianness.

Link: https://github.com/imbushuo/DFRDisplayKm
Signed-off-by: Kerem Karabay <kekrby@gmail.com>
Co-developed-by: Atharva Tiwari <evepolonium@gmail.com>
Signed-off-by: Atharva Tiwari <evepolonium@gmail.com>
Co-developed-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Aun-Ali Zaidi <admin@kodeit.net>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/FCAC702C-F84A-47F9-8C78-BBBB34D08500@live.com
MAINTAINERS
drivers/gpu/drm/tiny/Kconfig
drivers/gpu/drm/tiny/Makefile
drivers/gpu/drm/tiny/appletbdrm.c [new file with mode: 0644]