mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH v7 2/2] drm/tiny: add driver for Apple Touch Bars in x86 Macs
@ 2025-03-03 16:18 Aditya Garg
  0 siblings, 0 replies; 5+ messages in thread
From: Aditya Garg @ 2025-03-03 16:18 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: maarten.lankhorst, mripard, airlied, simona, andriy.shevchenko,
	Kerem Karabay, Atharva Tiwari, Aun-Ali Zaidi,
	Linux Kernel Mailing List, dri-devel



> On 3 Mar 2025, at 9:15 PM, Thomas Zimmermann <tzimmermann@suse.de> wrote:
> 
> Hi
> 
>> Am 27.02.25 um 10:42 schrieb Aditya Garg:
>>>> On 27 Feb 2025, at 3:04 PM, Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>> Hi
>>>> Am 26.02.25 um 17:04 schrieb Aditya Garg:
>>>> From: Kerem Karabay <kekrby@gmail.com>
>>>> 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>
>>> Thanks for the effort. As far as I'm concerned, this driver looks good. If no further comments come in, I can add it to the DRM tree in a few days.
>> Thanks a lot Thomas, as well as Andy for reviewing the driver and making it better!
> 
> I've merged the driver into the DRM misc tree and it should be available in v6.15.

Thanks Thomas!

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH v7 0/2] Touch Bar DRM driver for x86 Macs
@ 2025-02-26 16:03 Aditya Garg
  2025-02-26 16:04 ` [PATCH v7 2/2] drm/tiny: add driver for Apple Touch Bars in " Aditya Garg
  0 siblings, 1 reply; 5+ messages in thread
From: Aditya Garg @ 2025-02-26 16:03 UTC (permalink / raw)
  To: Thomas Zimmermann, maarten.lankhorst, mripard, airlied, simona,
	andriy.shevchenko
  Cc: Kerem Karabay, Atharva Tiwari, Aun-Ali Zaidi,
	Linux Kernel Mailing List, dri-devel

Hi all!

This patch series aims to improve the Touch Bar support for x86 Macs.

Recently, the hid-appletb-kbd and hid-appletb-bl drivers were upstreamed
into the Linux kernel [1]. They enabled the Touch Bar to display a
predefined set of media and function keys, exactly the same it does on
Windows Bootcamp.

Now, we are adding support for the DRM mode of the Touch Bar via these
patches. The DRM mode enables the Touch Bar to act as a second display,
just like macOS. So now you can add a widget, put a clock or anything
else on the Touch Bar as long as you can develop a daemon.

Credits for this driver should goto Ben (Bingxing) Wang on GitHub [2],
who reverse engineered the protocol and made a Windows driver for the
same. Credits also goto Kerem Karabay, the author of this patch series,
who ported this Windows driver to Linux.

The first patch adds emulation helper from XRGB8888 to BGR888 which is
needed by this device and the driver.

The second patch is the main DRM driver, required for the DRM mode.
Currently, only T2 Macs are supported.

Currently, a daemon named tiny-dfr [3] by Asahi Linux supports the
Touch Bar in this mode by displaying the Function and Media keys.
More such daemons can be made with more customisation in the future.

For the case of T2 Macs, apple-bce [4], the driver for the T2 Security
Chip is also needed for all the peripherals, including the Touch Bar
to work. It is still WIP, and will be subsequently sent later to the
appropriate tree. Till then, I'll suggest for get the driver from [4],
or more preferably, get Linux support from https://t2linux.org/.

Cheers
Aditya

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git/log/?h=for-6.15/apple
[2]: https://github.com/imbushuo/DFRDisplayKm
[3]: https://github.com/AsahiLinux/tiny-dfr
[4]: https://github.com/t2linux/apple-bce-drv

Kerem Karabay (2):
  drm/format-helper: Add conversion from XRGB8888 to BGR888
  drm/tiny: add driver for Apple Touch Bars in x86 Macs

 MAINTAINERS                                   |   8 +
 drivers/gpu/drm/drm_format_helper.c           |  54 ++
 .../gpu/drm/tests/drm_format_helper_test.c    |  81 ++
 drivers/gpu/drm/tiny/Kconfig                  |  12 +
 drivers/gpu/drm/tiny/Makefile                 |   1 +
 drivers/gpu/drm/tiny/appletbdrm.c             | 841 ++++++++++++++++++
 include/drm/drm_format_helper.h               |   3 +
 7 files changed, 1000 insertions(+)
 create mode 100644 drivers/gpu/drm/tiny/appletbdrm.c

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-03-03 16:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-03 16:18 [PATCH v7 2/2] drm/tiny: add driver for Apple Touch Bars in x86 Macs Aditya Garg
  -- strict thread matches above, loose matches on Subject: below --
2025-02-26 16:03 [PATCH v7 0/2] Touch Bar DRM driver for " Aditya Garg
2025-02-26 16:04 ` [PATCH v7 2/2] drm/tiny: add driver for Apple Touch Bars in " Aditya Garg
2025-02-27  9:34   ` Thomas Zimmermann
2025-02-27  9:42     ` Aditya Garg
2025-03-03 15:45       ` Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®