From patchwork Thu Aug 8 13:49:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 13757488 Received: from IND01-BMX-obe.outbound.protection.outlook.com (mail-bmxind01olkn2027.outbound.protection.outlook.com [40.92.103.27]) (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 5C43018E03F; Thu, 8 Aug 2024 13:49:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.103.27 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723124978; cv=fail; b=RnSHDiG+7CBisgtPYfHSsqxiYpw7knK/4amqgnPuuyxffgYdHE78esOx2SejDS1sRSeU5cH9X01SvXc5vCOwvuFdJFWjDhYxQCW8tEncQtZmBcIRwCroNFUbx+RCt1Ij3Iv5YVwqciy4gLPJEnjTcXRSx27denV4ck8/hUuIb8Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723124978; c=relaxed/simple; bh=v5b0AfKZy+LVcQjjaiBnPa4rwdGFt8wfHub5Cw2Bd4c=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=lRPE5KICa6/h2I0lBtXWeszDkcXdjGzDfotAMp65GkawtZ+vgXqkFv+klFuPra28ttBR4kht1UE4Is+GZAr1oVLMSYhjpNyzWnJffoYuAQq+sNv+FwhuSpWgwGIt1UlnKPcc0UdE3/7sQgsx1WQMYwgp2WwP/3kCwlisL8i/Ukc= 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=pmkiImQq; arc=fail smtp.client-ip=40.92.103.27 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="pmkiImQq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wTResfPG9FU80HDw2VevsOhHTREq5RZZpFmJFK8hicz48QcEcYdSR41xtjMJAQobsI3rGePiPqhw9/SzoBeHHaPomRU61eiIsBuLXwdEfH1Jq3bzDDaIYcbVELG+F1Z0C31PUsDncrTI+ccUFXpHnsDf677PpGADcH1wGv87a9/OnXVTf0K6+4478QOvoKl4jfIsqepq/d4aHZqjbcO523WWRxFiPYEboAG/2SYTrmsOqA33Jv4nzWkCdrpPe1A0myRFkFqJUaYoeQc2AI9y9JyBvK8W+fYGv0LE5Nuy7tszkPEZ1VR9Rn0MWnrSQHq1dX1oZ+OSaupBc0lZUtIzig== 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=YS99RU97RhcjFMoR07SwFd+TcQZhf83d3HAXg0N8tF8=; b=CnhI597kSkeuR2/plxEcSuXy7pi7fCmUpKtSqT/nJxR5gs+hN4PiaObDcSJCAvUc9HUE/CGvCrJ3zGvOSYDJlMn36V46U6NUNvQ4/2wAcER0hTHNblRD3GxOnV20TrZqGovGfhUohT1eYVxc12H/oqAXyZRGON5yv8aLo3aWHS1bB0V7aHOOseJmwIUgq7hQTXJJrZNXfi0sHFCNkeYTnqFNJ2e3sVXexz4qKsZ1tmp7OjzYUHlcA4pUqUfttejS5XMjsIO8HZQ6pC15nVbUMAcEicN0mCjKaTeEHEdgQWAFZ5bPxOapVvQDIzeB4CPb06pSlnOlr1zIWbhyasolyA== 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=YS99RU97RhcjFMoR07SwFd+TcQZhf83d3HAXg0N8tF8=; b=pmkiImQqoj064dzTGBcBQvjzoSUf9eIwiu5UAC9SdcX2LlvhIT3GzKgaalbC7KtapxiyI5pMQVu+MEcfmZ6dh/wUA6Mbi1ImEH5K55AhUjFr5EVGKWGfxKUQSKjZG0f63rBne0yVIKEq1XKlbt7Taqssc2PNtBIxu2QeuC9WQkWCgddONPtcBrTQFFXmroCWlSF0xtxIfg8ezmd4gXNXblQbSNZ2D6zfFKvMao4jXaJMgMnEZ8owdzLghQTG9d5Gj8eP2x0LtdDDpc3UGw2hnahNjfollW39OljLxMvsMvJeEyCQuLL/DjNbY8DypYh7QKvO7rJ3jfa7nKVbV7Fc0g== Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:b3::9) by MA0P287MB1976.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:11f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.13; Thu, 8 Aug 2024 13:49:27 +0000 Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a]) by MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a%5]) with mapi id 15.20.7849.013; Thu, 8 Aug 2024 13:49:27 +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" CC: Orlando Chamberlain , Kerem Karabay , Linux Kernel Mailing List , "linux-input@vger.kernel.org" , "dri-devel@lists.freedesktop.org" Subject: [PATCH v3 0/9] Touch Bar support for T2 Macs Thread-Topic: [PATCH v3 0/9] Touch Bar support for T2 Macs Thread-Index: AQHa6ZnJ5S1PtCl9AEC7pS90dp+vTQ== Date: Thu, 8 Aug 2024 13:49:27 +0000 Message-ID: <1368FEE8-58BB-41C9-B9AD-7F2F68FF1D53@live.com> 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: [V2lnGgel1H7iyyD2cC99WsxSmnDSpyK05xdDhpOCrqO+IGQ0Bq6s7SM3iKUCHYO6rB+eZKExDUw=] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MA0P287MB0217:EE_|MA0P287MB1976:EE_ x-ms-office365-filtering-correlation-id: 442b4050-e362-464c-bd31-08dcb7b0eb84 x-microsoft-antispam: BCL:0;ARA:14566002|461199028|15080799003|8060799006|19110799003|102099032|4302099013|3412199025|440099028|1602099012; x-microsoft-antispam-message-info: GnzAPRVSJ8UCi3fW5IoZ/GDP4KMX4VV4xHl81hNKj7aQMQt6a6Vw6dj2nUQtR3KXz5l0LB4ggQjs05Z9cvq2J3oY4YCUjtvB8BM4ESgn3XRrMsdZBhp+0TVb3E04/NpudfZtwtCpi7BESGgF9U/CLsYqb9y8sIRj+Rc107h32dZbDEVylvfA6zU3FvC6LVnF+Ys41SAK3GFWjWxcm6BAwpQW4JZtb33VfmJfe3o8mOq5DLkEsm3a0cX5pEyc1QqI/E06yrP766iJ9sbHTQHoKv5US95jhUkZ33NR0K0mhEAZsrIoIZyYGFnfwTFKPRIyZPBw+JEk9uReclGBpFBkBF5LjsVCUhHtiK+ypOixmVlz7da9UaRkaDHZVdF9HhcrZ7fBoPCim5zCepXdP2YGYRz1JSNx3LLDk5/+1bCF7ODs/Q3XBol9x5PXWEcz+UHBm7m6W4ZEjx7OPMAmb9K68Y6/Kf8jwzNBnxg2NMIHYzOC3slkb+THKKUdTSpP4rzoiBrvVADU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riNiecgfYQ6vBlUZ7+OMLFME/ZBajR8VV9hQds+yt2i743fYrNJE4IpTjdVDhTEnCgHoWReagq9Xlk+M/Yrcue7DUz40/8N7I9DtDqo1WSU7YRXYsZWSJTopT6iU0NbN+BNpnpBRED93F2dqNDKCQGLypIKRuHvkYYJvF1ZE9Rx7MPec+uLno4waMsxFtYNTNAyP10ueaKjJz7q2HRDii569YZ1EC1HRXvP9Q/N3mfjkUMwO+UJWnTopRcgc3j6sGqz/V9phSUwlcAf5dv1pHMX7+mQ78tIsZNE3E7UbPGA+NYFMjc5vTWsWJvzwtrcm1F+etn7hOqov7g7tJjEP29ECEWzbh2mk7AGY/r5L642IoIIhvGiMGJMVLXbHOJEG+kXxI7EJ6fC7m1uLkuRuM5HQVApz68MvPojVMGzVgMw5dqLrpEvbyLuabgOI8NDHEZXBm8hjFzlGbldJdovmb7CO2KxWFugYjgUA1Ut7quY6KuNsir00vh1ZnD4KBsaeg11GXBrXpaopdaoubZYIt6sbkhNo56YXqEYNlHEffRWBJSLRr3wtPDA/hVGXmKkmhIwAxoeBTkuspHhLTjgdh1hcgI7TJ Content-ID: <71EA9C36F916B14C9AF0CED28F541476@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: 442b4050-e362-464c-bd31-08dcb7b0eb84 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Aug 2024 13:49:27.3180 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: MA0P287MB1976 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. 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 drm/tiny: add driver for Apple Touch Bars in x86 Macs .../ABI/testing/sysfs-driver-hid-appletb-kbd | 13 + MAINTAINERS | 12 + 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 | 206 ++++++ drivers/hid/hid-appletb-kbd.c | 304 +++++++++ drivers/hid/hid-multitouch.c | 60 +- drivers/hid/hid-quirks.c | 8 +- include/drm/drm_format_helper.h | 3 + 14 files changed, 1386 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