From patchwork Sat Aug 17 11:44:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 820221 Received: from IND01-MAX-obe.outbound.protection.outlook.com (mail-maxind01olkn2096.outbound.protection.outlook.com [40.92.102.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3725256E; Sat, 17 Aug 2024 11:44:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.102.96 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723895102; cv=fail; b=achnInttJ64GVhgVeoWTWeTXF51MyB/JGoHPgzDfDr0TrckTo8vpms2PdpF6c0PaTQKn4d1qq0T41G9pBXJI+JIkzdwjkgDoP7rKI/PZpu3skJJlu/YPUnFxRhCLnMt7K8dfX3MpKDkrfheQ1KiwaKQP9BGK5NNBdXeqL6YALoE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723895102; c=relaxed/simple; bh=CI22STvmXFuwSQGwbIA1OfBSW50hK5eJ+m8Zx5rSmNs=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=Z1L0eKqbveA20Db2+zdPFsXb8kgF9sm0eFjbFx0gdTQgKnXBE4pl80mQv+4qNm9NA1bWhB3JDJqfqKJ0E11g8Y0BjImDGRDQ+MGuwKgF92cywmtDSL+cjsONgdLbNA5zB0Xu4+2pC6B1LGCORpPpYib2J+shDLF2pLK9ZLmHQc4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=live.com; spf=pass smtp.mailfrom=live.com; dkim=pass (2048-bit key) header.d=live.com header.i=@live.com header.b=Ob3IOl6o; arc=fail smtp.client-ip=40.92.102.96 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=live.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=live.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=live.com header.i=@live.com header.b="Ob3IOl6o" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MXaHCtF9ywsYy9g8rJc+4tsp2mGBVzMrfzFRa1Lbcmk9u16OW2qvTz4Ng/2202EY8UWBJIvGo/3fbp7d+LorIqW4jjXQYkgWFrnR3bR2UA8lh3PVpFMSTLLTG8vo9IRRUVqEU9GhgldYbPYjrhvlnipbcb7fNnT25hX18rqS9dq/f3tnd2PCKNdynIUCXN1CNUAiMxbwbp05ggnb6o1fHmN4Bu8nFj4HkiSPquKZaPu7ioAjcwSH9TsSrHYOkSIviZQfjbvSkaZv44BE+ZEB9o0/QjYpzPO2acbuOnGzl5KfmozLhp1NRxc7hXMAaWriw5wtVxFO1T3XoTEK4QNxiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZhZrkGA9yqBj03qmGTdQPxYaTe/9Oi9decRyNaof5a0=; b=cpINYWI7vgOj93qlUxLhz/KC5sp8/J0AUGevd1lKFKNi2ityMYL2emIvH5x56Tru28C0yUxRwD6mRtJEvFJNiMgWF8a+X1TLx9PXZvrTjPn0C3qc4rfUwRtJnU4m/R6mwvv5YrbemgIbmlFyv5rdPNIVyRNfB92UoTkQsJRTvXJQxM1R9M897QisjHD0gbOl/Qtpu3SPGa7IrOMeZs/CkmcWz4w9GCFmXDJMByMYeCRAE4W9KuiGEYzISNeQ7DYX96n4dF7imOO1ta89QPVSEJ0yMNVwtV5IN55V7ASKS5MBSpoVF6XLMndW04MH2qAYTfPIoKMwbWVTX1oaZUOPAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZhZrkGA9yqBj03qmGTdQPxYaTe/9Oi9decRyNaof5a0=; b=Ob3IOl6o0ljAf0IFODOG0ZEbb8+S8FQwqxwHXfP4eQC83NsJtRSZljichrAxQRczVCeN5zTDPmFzPOj9rsyQpE6IMCu+6bI/HwBkiIEiq/hD4MAvCMCy9EvgOWPPfGqrvpK6Y4AHzMuVdWzOIKoFq6Oru9ZxGffNi+zN/K1eWhG2m3yfGrIA5LCXUlVh1I9BVFE8+PPkhJJnxgLuU7GDpVjaDa3akzLxUrNZBQK+reV2XH8cfSh8fc6q2lp7mE+YL4wEpMpCbdQI4G0s6ZCS975KruVD0zub3YQ5TWZ4FQ5hlv9Zg+HUaZOM5jUAzNmpg9Gfk3rIFV+hd4uK8qDKqA== Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:b3::9) by PN2P287MB0673.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:15b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.20; Sat, 17 Aug 2024 11:44:53 +0000 Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a]) by MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a%6]) with mapi id 15.20.7875.016; Sat, 17 Aug 2024 11:44:53 +0000 From: Aditya Garg To: "tzimmermann@suse.de" , "maarten.lankhorst@linux.intel.com" , "mripard@kernel.org" , "airlied@gmail.com" , "daniel@ffwll.ch" , Jiri Kosina , "bentiss@kernel.org" , =?iso-8859-1?q?Thomas_Wei=DFschuh?= CC: Orlando Chamberlain , Kerem Karabay , Linux Kernel Mailing List , "linux-input@vger.kernel.org" , "dri-devel@lists.freedesktop.org" Subject: [PATCH v5 0/10] Touch Bar support for T2 Macs Thread-Topic: [PATCH v5 0/10] Touch Bar support for T2 Macs Thread-Index: AQHa8JrfIb1jtHKrZ0idpFPXYn5yiw== Date: Sat, 17 Aug 2024 11:44:53 +0000 Message-ID: Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [u8veQd/j0oZnldflgVZL/JKNrUkaqy9+eUWAqRBIu0VFu1zdj3ariVvPH0VteAJF] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MA0P287MB0217:EE_|PN2P287MB0673:EE_ x-ms-office365-filtering-correlation-id: d5507e3f-2ab7-4f40-f368-08dcbeb20264 x-microsoft-antispam: BCL:0; ARA:14566002|461199028|15080799003|8060799006|19110799003|440099028|3412199025|4302099013|102099032|1602099012; x-microsoft-antispam-message-info: XQfvK9RhhnNuKyFmuAnOHPghmhglH8mtEKqRZC7f97ShkTYy2uf/7I6Cspr+oxp7bvXUtDJgGVYFqXQaYcU38mwgyBJr0X/5kkSjxWyM6o3CfCtYrgZWHhPm1uaNNQwUmJd6j9A7KsFQnH24OiztrdIilBo5/0cJ3OYgA/4vslve9trh1NYszGnq9vSatZQkqfvFxh5HTUW1QK3RKyRJHphg5/df+qHykvU2yaDYsb0uLhDgt4kNMnb0dhziBcA38wAQTm9/f7zWJCV1EWwv/lnDANH6wOJtGXmZrYXNbmji4AajIM8wBrWyZeqkQ31C/nKQ5wOzTmjjJ7VJNNV+Nrx94/lL6Q3+/vKyjJ6KhurrZ2PpQgPrU2En5Uo5H+fio3/WYXvp+eg0w55VwfeRQ0tsW6hKFFlB5exlY/FOPW5LXPCikvYT9HsYEWwmgUNcd4xGofh9XfO+Gtl3yDfBMmV1ZSN3L6qMkq0QLDrcN0855E/jkOgFit0OSMX9RgR5rhrAr2DuO9h+H+NdCR4Bh3WneSJHWGmyEo6pipkB1SH4H6Ze/E1EJqdE6IMT2w89no1oi44iLoDlOjaVQcRN6lPAzSIdE5gijwegtcAvolUDgHt/danHPQaxX4/TxN9CSL5g+nW1M7PTrmAIG3JnkUAP5CfomaQEKz7RJ/OEni9Yi0mztKosiiHhM1QBmnqrr7RoVgBpfZdGii0Ci2n8WSqURF6SF2I8VW/v4UIWn/i6kcYXQgPf9t0GVtfLPUgI6OE6UX4sgqNWR02uy0Wk6meNopsj+ruWq7MCdqJrhqs= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?wEVZrMjhQIu9gvLjzDLFeh3?= =?iso-8859-1?q?KHZe3vSZcSWVl3X32dg66w3/R9Ws0LMoy3eZe7g4uoqyQGy8GXNO494mRe1j?= =?iso-8859-1?q?mUn1W0hzzckic6edbcFfB8FDgXLhGznrFNZNuInZXWJZU934mFPrHrh1+gm0?= =?iso-8859-1?q?kpsiMaZpR87Fmqv+JgqyRw/d3DooYrDRCScUgsLKe0BaJvJbsxfTIx+tLYFX?= =?iso-8859-1?q?XIlxXsGl+MT7v2v0FCYD1A6kfe6Cj8fqvoyt3RAcsE/PqbeZrJIFXO6LIutP?= =?iso-8859-1?q?UWEDsOuubG5xlVY/Vb3Nk2YbU7VzXhgLH2hIeUeXuAsB6/uqBNP3jwpsxHdv?= =?iso-8859-1?q?ETXBp23k8nSATL20YNcc/ro6K0n8XvS1OrdFZSL2m1p+2p2uH/cMTgtRAPrj?= =?iso-8859-1?q?ziNS2kcMYlmcSbTyp9piWy+rE4hM3QOzuT7RGyQbZbniu7Y61h2XcedkexGO?= =?iso-8859-1?q?Km0uTtoP41xN2bu+YfUwWuQTSEOeuzknm+sGlgtzHYJhTmDFxnTdZ+hEz+iP?= =?iso-8859-1?q?mGedNqSvEKjAG9n/kR0U8jdJOelDYYEdhl+urjaCPq9CO4niyc1P5vEym5qr?= =?iso-8859-1?q?i+9Niafl1AEQQPZRsvmRE5e41lIvASKaOgGYhbYBZ7sQc2vSU2OcVYJxNX8Q?= =?iso-8859-1?q?JL/z9JFL6p9ZOJEv4R99DL3vhl/0gg7UAYdGUYkaNoZxICRcp7EbYIzy7bBI?= =?iso-8859-1?q?DeHHloh/MnVgQMwl8d0c+n8q/kUcq2Rdc97cbLxnpk+3GyXq6UgJkhlsMMg6?= =?iso-8859-1?q?uhLz1TBW1UvWEOEH43fRIVATQs26vlFLbRlEsN+hTMtIjiHk8KjDo7Hhk5RU?= =?iso-8859-1?q?ZwOqBq9HAOhpdI8O8J3cW3JHhQxQicUGPsbS1xmRk9es7nb0z+q+tCPhH3I/?= =?iso-8859-1?q?i8acAwlTxlKacb9H41eLX5wndlbTlSpNONRTPNRu7RVjIl5t4J9OmkNnzj7N?= =?iso-8859-1?q?JgA6o28do144W3eTeJ5Q6kbj/MZOZwYJLhfDqO4GLyjWHvN4EoMBTrd5+I9K?= =?iso-8859-1?q?qtIJ7ym0fmZS6pkKNtkwpM7A9k7F85HEhqss0Sz5PV2AToP+3d/HBknvgAKS?= =?iso-8859-1?q?OTOPcX/YJJx+Kg4xWnayKm+N7ZGNzF1GRbuk33GQwzXWL9sOraGYjyV56YWe?= =?iso-8859-1?q?GrePFyOgczQ6f+BkTF1DvptEHqibUss5wtv2E5GtIqM59j7mS7tRohQq7s2I?= =?iso-8859-1?q?J1c+y/8TgPolrU36reFOaFmMxdiq3iBIzJ1dgzY3qmxX+ECD7g9bIKO1VSRc?= =?iso-8859-1?q?m1pQwZI64shJjW/cOqT+ayydvD0T/SNWD7/QQDzEMhhvZ5bC++8uQOM1sf8l?= =?iso-8859-1?q?LK8251ywqgcxjH9/gbfrWV4ll71dxlWF3qHLFPoX04fMaMyu5D2eWxYmkkEj?= =?iso-8859-1?q?I?= Content-ID: <2F8AADA89FEEBE458DC7A62DE6496453@INDP287.PROD.OUTLOOK.COM> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-7719-20-msonline-outlook-24072.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MA0P287MB0217.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: d5507e3f-2ab7-4f40-f368-08dcbeb20264 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2024 11:44:53.3302 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN2P287MB0673 Hi Maintainers 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 patch series adds support for both the configurations. The hid-appletb-bl driver adds support for the backlight of the Touch Bar. This enables the user to control the brightness of the Touch Bar from userspace. The Touch Bar supports 3 modes here: Max brightness, Dim and Off. So, daemons, used to manage Touch Bar can easily manage these modes by writing to /sys/class/backlight/appletb_backlight/brightness. It is needed by both the configurations of the Touch Bar. The hid-appletb-kbd adds support for the first (predefined keys) configuration. There are 4 modes here: Esc key only, Fn mode, Media keys and No keys. Mode can be changed by writing to /sys/bus/hid/drivers/hid-appletb-kbd//mode This configuration is what Windows uses with the official Apple Bootcamp drivers. Rest patches support the second configuration, where the OS has full control on what's displayed on the Touch Bar. It is achieved by the patching the hid-multitouch driver to add support for touch feedback from the Touch Bar and the appletbdrm driver, that displays what we want to on the Touch Bar. This configuration is what macOS uses. The appletbdrm driver is based on the similar driver made for Windows by imbushuo [1]. Currently, a daemon named tiny-dfr [2] is being used to display function keys and media controls using the second configuration for both Apple Silicon and T2 Macs. A daemon for the first configuration is being developed, but that's a userspace thing. [1]: https://github.com/imbushuo/DFRDisplayKm [2]: https://github.com/WhatAmISupposedToPutHere/tiny-dfr v2: 1. Cleaned up some code in the hid-appletb-kbd driver. 2. Fixed wrong subject in drm/format-helper patch. 3. Fixed Co-developed-by wrongly added to hid-multitouch patch. v3: 1. Fixed key mapping for Function keys in hid-appletb-kbd driver. v4: 1. Added support for fn key toggle in the hid-appletb-kbd driver. v5: 1. Do required changes to hid-appletb-bl as requested by upstream. Aditya Garg (1): HID: hid-appletb-kbd: add support for fn toggle between media and function mode Kerem Karabay (9): HID: hid-appletb-bl: add driver for the backlight of Apple Touch Bars HID: hid-appletb-kbd: add driver for the keyboard mode of Apple Touch Bars HID: multitouch: support getting the contact ID from HID_DG_TRANSDUCER_INDEX fields HID: multitouch: support getting the tip state from HID_DG_TOUCH fields HID: multitouch: take cls->maxcontacts into account for devices without a HID_DG_CONTACTMAX field too HID: multitouch: allow specifying if a device is direct in a class HID: multitouch: add device ID for Apple Touch Bars drm/format-helper: Add conversion from XRGB8888 to BGR888 conversion drm/tiny: add driver for Apple Touch Bars in x86 Macs .../ABI/testing/sysfs-driver-hid-appletb-kbd | 13 + MAINTAINERS | 6 + 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 | 624 ++++++++++++++++++ drivers/hid/Kconfig | 22 + drivers/hid/Makefile | 2 + drivers/hid/hid-appletb-bl.c | 207 ++++++ drivers/hid/hid-appletb-kbd.c | 432 ++++++++++++ drivers/hid/hid-multitouch.c | 60 +- drivers/hid/hid-quirks.c | 8 +- include/drm/drm_format_helper.h | 3 + 14 files changed, 1509 insertions(+), 16 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-hid-appletb-kbd create mode 100644 drivers/gpu/drm/tiny/appletbdrm.c create mode 100644 drivers/hid/hid-appletb-bl.c create mode 100644 drivers/hid/hid-appletb-kbd.c