From patchwork Thu Aug 8 12:01:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 13757308 X-Patchwork-Delegate: jikos@jikos.cz Received: from IND01-BMX-obe.outbound.protection.outlook.com (mail-bmxind01olkn2060.outbound.protection.outlook.com [40.92.103.60]) (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 99BD7126F1E; Thu, 8 Aug 2024 12:01:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.103.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723118490; cv=fail; b=IpINjAH+kyurh9R5BtBxhhtKrjC6BJSjHOuD9IgCXGQeuQKYj+PqLxwCheSGISz+QxB2G9U5P5YJbcMx0ZnnwN8CWH4EqQ5OHvh4khrS1dIRd1yW4n2fw2QrHubZp25BX+HAN1oSUmCnyPWGdm0oEb9LZ+TUJT8PN7rN92Doqig= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723118490; c=relaxed/simple; bh=Epig5QAHDBVwrNvDZkDXr7kWymX9dQP5FAfFEisSWhU=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=BpEhJ1Fi4Rtmsxtu1C0n7ZZdkm7hkftKWpAG4dyUZfkEfmFVpCXw+O9gW0+ibBIml8PxjFV3HsQCa29eMw6LTTsr/t2pqzb3ac62Y/PFvDfWrVR6GezOVmAKVkiEuubY9LWfSpFOg+NYvRTX1VWZ6Lx3FvHCa9lZoKT+2WX5vRk= 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=prBxQf+E; arc=fail smtp.client-ip=40.92.103.60 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="prBxQf+E" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eXYvwCX86pkoFz4bY1LvYkwclunn84+yLwMWtvIG74pYKuL9CDRA52evxAeFEvlEDj+V3vSE6ojShcOEDIKNQ3awUhmS6cAMsklQTIfujWdl1L0zwexS44YDBl5Z0KQkkPqT/OjpiWsPbXlPGg7DwCfMvyCOumR4xCdrQ4yq90Lwal5zuKWzwRQR0FtDTdNEeLmZYS6KNcnZFBee2i74KLtcXUdHxSbS979vcFb5QcLgdQkBk2GRWWvFnOeDM9nHw2opzZE0uDp2xlCqMEGYWF7eRgkO/zr2ljbA/vTVrh9g4uLO4SmBBKrzerWGx7YTkpscUIrwKstZmWCUr0PkFA== 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=iRg9eJxDc4ARlekO+g7uV6lPG0TkCEJFMy6dAol1E7M=; b=ehR6lkiQ4oykOwGz6gGKZKr8f3exF3faceqQnMfCSHQ7PmB8z5dYkHZGFY/BZGosSqFvVB5VwcdU37tJnkR8qEpp+u27VFL0NTHMUq1lQtFN+bDhG8vIuuv7ypOQmtejvzpyJxwmGF7JymXepEUJ5Gz/oBZfd2TZRDdlidATue99eAF7Ltx4VuC//UU5EvUQ8zB7VF7S60ilsC/3krglZBY0WKgi7Qp6Yn1/x4d9iREgFSAhXf6hSZRLoFuXi7smh+7byupDN158BWPEgjS00RI7hdFxz2bAv/5usyBTwrQZJ5v6XSFM/yzYIg9F0PizEBGSGGwKzwYoZxozTmEfkQ== 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=iRg9eJxDc4ARlekO+g7uV6lPG0TkCEJFMy6dAol1E7M=; b=prBxQf+Ee/7Cg8EORrhO9E108okFu8dOhJNLuwCj1zFvZecZgKACTTl6lXaBmxpmB1IrtQIc0YPQr94kj8Pugb4hwgyl2sGsZt7NP1oI6S94OiqAXUrQNKjJ9sZ2gRYJK9HVYXwZKzpBDUP1Fk9b+QQzA4+34qQjDSXZdymr4kpnKdleUf/XQRpuyUwPxt+GQm7dpATKynQzffqbs6vGycgOM90jEuROxL3lu7xwkpnXBmbwVLP7SCD4T3CxwsrCv1M9u8v40yUjHpqBpgywkyfLfTTbU7JJWVjhwuXJiAd8hNOEZ9beG3IePpo8zhklZ1w7LXLpKIahhj203TVHMw== Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:b3::9) by PN3P287MB0339.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:d0::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.14; Thu, 8 Aug 2024 12:01:22 +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 12:01:22 +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: Kerem Karabay , Linux Kernel Mailing List , "dri-devel@lists.freedesktop.org" , "linux-input@vger.kernel.org" , Orlando Chamberlain Subject: [PATCH v2 7/9] HID: multitouch: add device ID for Apple Touch Bars Thread-Topic: [PATCH v2 7/9] HID: multitouch: add device ID for Apple Touch Bars Thread-Index: AQHa6YqvzOez1ap2/U+g7ZZ+h/G4ow== Date: Thu, 8 Aug 2024 12:01:22 +0000 Message-ID: <6AB25F04-EA02-4737-B5FD-77BAAEFA9DC7@live.com> References: <9550ADFD-0534-471D-94B4-EF370943CF80@live.com> In-Reply-To: <9550ADFD-0534-471D-94B4-EF370943CF80@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: [TE0ZrEGgc/1+pS77m/Wjrt74y0yWy2FUAeTYdjUY9yu5UE/ij0wPUXUaM+8Mn4LDaE798j6EIVU=] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MA0P287MB0217:EE_|PN3P287MB0339:EE_ x-ms-office365-filtering-correlation-id: 3f263054-759b-4420-894e-08dcb7a1d214 x-microsoft-antispam: BCL:0;ARA:14566002|19110799003|461199028|8060799006|15080799003|440099028|3412199025|102099032; x-microsoft-antispam-message-info: mUfGQz7HYqFw2nSy/OVvOzWJEPoYbi9OaSo1Kf+yNcDeFitTwAeZkPMSbXqKexwNCJMzsKqJtlmzzJds5/70lPuo7Yamqbqq5ktu10i4U3F4Yp3iixn0OZ7h47m1EjxPsW2I131wYjL5V7B0T6DCKUw0KCF8w/qBX1lQkQppXttjB3FC08pPgIsgy9694wlWX0voDPgVeHOTuNnfF2qCwWzX3TyzkCi1yACcI5TzKi+FQpDPVSR6Jpk0m3qqzZSxJYAAV78s0OUnypUNA+O+liw3JsFBrTGUU0PsN1g36OZrYi2EtmNXVCZ1Q6GYF7xkHXjXhBXSnsmNKLdHXtISuGDrQ5iQtZU5bmfaDeV+8ELjvVdvschssgCohRC+N3y28C5eyZ6HpwxA5S39gNa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OODqciCazkl7kkBD98gIVsvn/lKtrbB+xdlj8W5VgcJwwuom8bSGAdKN6nnf19ek9S8Ea5kzBygmx8RM7UGO1IB7+wVFymW8zacZFDWUjbuDND2cdYU+V1hTx0W9n1LzvrbpqjCcufQdZAa3JYNA/OXsDeQ88j5KLPiDVGiX+b8irvKY6N9x+wjREohaohK1NtD+T4xeZj+rm96gQCBLx4V7hMM4XWI9YBUO7Yxk31Au3rxTzwM9GK1aWH6pdzs/wM/PCGkmTNzKDqGwb94c9bAYbFFnJ3F8DWEvZJnv6PzFp8X5XYk/uoLU7qyPeYSNcdkqmUOypLkoIS0QCByav4QC06j4PDQdCy9s5PNposrS20GzYMnhR4R3yMvpdA5v7AEtLtvrJTISa+48ODN4LitjKBqkpzZgM57CQYErCJKjD/G3MwJrmq9gmftianTOANaO5shTMpEa4DAqbHbKz9K7XcpOhoXl/qQeWaK0BR/UgvBfbyc7ZWoaaedOXIUJw81JKuB47bE6UdJVvIDHy06eM26xr7NE5/SOuWnhR92vU+1eL6tqe1NXZLZlhoMWJXdM/yHKVu4pC/Q2qDrrTnrwN2Md+k3ZwLFtOdAMBp Content-ID: <83B75ECA2854B541BA20B45AF5B694BF@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: 3f263054-759b-4420-894e-08dcb7a1d214 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Aug 2024 12:01:22.1641 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN3P287MB0339 From: Kerem Karabay Note that this is device ID is for T2 Macs. Testing on T1 Macs would be appreciated. Signed-off-by: Kerem Karabay Signed-off-by: Aditya Garg --- drivers/hid/Kconfig | 1 + drivers/hid/hid-multitouch.c | 26 ++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 72b665eda..35ef5d4ef 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -744,6 +744,7 @@ config HID_MULTITOUCH Say Y here if you have one of the following devices: - 3M PCT touch screens - ActionStar dual touch panels + - Touch Bars on x86 MacBook Pros - Atmel panels - Cando dual touch panels - Chunghwa panels diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 2948fbcbc..0fed95536 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -214,6 +214,7 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app); #define MT_CLS_GOOGLE 0x0111 #define MT_CLS_RAZER_BLADE_STEALTH 0x0112 #define MT_CLS_SMART_TECH 0x0113 +#define MT_CLS_APPLE_TOUCHBAR 0x0114 #define MT_DEFAULT_MAXCONTACT 10 #define MT_MAX_MAXCONTACT 250 @@ -398,6 +399,13 @@ static const struct mt_class mt_classes[] = { MT_QUIRK_CONTACT_CNT_ACCURATE | MT_QUIRK_SEPARATE_APP_REPORT, }, + { .name = MT_CLS_APPLE_TOUCHBAR, + .quirks = MT_QUIRK_HOVERING | + MT_QUIRK_TOUCH_IS_TIPSTATE | + MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE, + .is_direct = true, + .maxcontacts = 11, + }, { } }; @@ -1747,6 +1755,15 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) } } + ret = hid_parse(hdev); + if (ret != 0) + return ret; + + if (mtclass->name == MT_CLS_APPLE_TOUCHBAR && + !hid_find_field(hdev, HID_INPUT_REPORT, + HID_DG_TOUCHPAD, HID_DG_TRANSDUCER_INDEX)) + return -ENODEV; + td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL); if (!td) { dev_err(&hdev->dev, "cannot allocate multitouch data\n"); @@ -1794,10 +1811,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) timer_setup(&td->release_timer, mt_expired_timeout, 0); - ret = hid_parse(hdev); - if (ret != 0) - return ret; - if (mtclass->quirks & MT_QUIRK_FIX_CONST_CONTACT_ID) mt_fix_const_fields(hdev, HID_DG_CONTACTID); @@ -2249,6 +2262,11 @@ static const struct hid_device_id mt_devices[] = { MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR2) }, + /* Apple Touch Bars */ + { .driver_data = MT_CLS_APPLE_TOUCHBAR, + HID_USB_DEVICE(USB_VENDOR_ID_APPLE, + USB_DEVICE_ID_APPLE_TOUCHBAR_DISPLAY) }, + /* Google MT devices */ { .driver_data = MT_CLS_GOOGLE, HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE,