From patchwork Sat Aug 17 11:50:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 13767174 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D09C6C52D7F for ; Sat, 17 Aug 2024 11:51:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 51E1C10E099; Sat, 17 Aug 2024 11:51:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=live.com header.i=@live.com header.b="XDrJiYFP"; dkim-atps=neutral Received: from IND01-MAX-obe.outbound.protection.outlook.com (mail-maxind01olkn2047.outbound.protection.outlook.com [40.92.102.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id B79E910E099 for ; Sat, 17 Aug 2024 11:51:01 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=j3EG4y+e+FGhckBiUbEfozDQLNRDGonZJdCEsHn8hYs3Q7vkCymnH3vu75t7l8I3On5IwbSA6uOM+b3/yyv76hWdcgfFvAn98wXv1C6wzAtF7gwxDPOd/uBeuiuWofENGACKuEC8AX/xFntXz46f383tEwsxSyK8T4dQBey/1DP387WM2V4+K4TvpfI+e2j/Mlktnq+tetHjKlX28Z2KvBO2TJ0I/OK90v4TPEY6fJhRBl8LkQalndNm36ZkVyoVCT7M8XmxbwJL4KutlLEI46kirkPD95nVUZLOyOLfKQUvKoxHqZR29h+Fc1u4ZyJTFMP2c6dsF/RCfx3uvKGPfw== 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=WFlmNon3cxCsrA/dn65ztpfF+V3XRcHR23mKlXxL7g4=; b=KpnxmkDFZReHk/EYKcUyhClrfpY6nwYmOTM+KiZdYARyUDvMqsdKBe7e9DGir2CccvXKsoJa6CEIKctgriRrbtwFHqkpXn+U+qSiC0UaiWAUJQQrPFbg6r4PZd1/mj9jUGn92sd6iphE7ieLpFw1WXyfqP2no8GiS6h+48aLqDu8n6hVkqg5HZ151mp7wwhgJdQvIvR98j/iO3X/lIBWXUT6Um9rMWxcHiWrtpFzieNmnT1l/GTv+ZLSKDxtYtj4PrhLYCTorHARKHPX90MQrF6O9KxFMMIWgHeXWNAfI+UxpsbvQ+M9e9KI/5iw9F/vZ0ZeVJqRV0Jqf1hCmvGqcQ== 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=WFlmNon3cxCsrA/dn65ztpfF+V3XRcHR23mKlXxL7g4=; b=XDrJiYFPMcVWMpmo/xfhDEBVCcRZKakKGkzkk647RVoTVH5UbVYun7qNV5mKRnEkIhARJXGCXAudWT/9lffFPm24u+jYiJ7uFz+wRV1YhS0GW42Eeah7jH44VoI87YaCJGbAzEqQsCe4TBgfgyiVDOwKhK3Xrz7mxKLMuE0NrIM4ILMkPDsalZ6om383uKw4/sbHDF6DU+zuMD5NcZm0cBxdVOBZpFtflxht6RypYI3U1aD/wp25PdnGpY/fMoNoXbdzfXtkKwNlFDJT50n7kLpwYc+NR5Y5XJQQhyCH24wp4q0hum+LKLhzfe3ZEI+qGorSuJFFgC1mJS4YrrHlzg== Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:b3::9) by PN0P287MB0120.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:e3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.18; Sat, 17 Aug 2024 11:50:56 +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:50:55 +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 8/10] HID: multitouch: add device ID for Apple Touch Bars Thread-Topic: [PATCH v5 8/10] HID: multitouch: add device ID for Apple Touch Bars Thread-Index: AQHa8Ju4vlKyi/mj+Eq7W+97O1SRyA== Date: Sat, 17 Aug 2024 11:50:55 +0000 Message-ID: <924E0120-8BCF-4BB9-AB51-77729F02D11B@live.com> References: In-Reply-To: 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: [Dk0/R9Q5zbH+VETMD4hIwIIKB8Jb4xmsAzLvI0N+QQQzqLhGYBjk7MrDH5VBm1BD3kZeHi88l94=] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MA0P287MB0217:EE_|PN0P287MB0120:EE_ x-ms-office365-filtering-correlation-id: 06b81f95-9dfc-4042-7d07-08dcbeb2da85 x-microsoft-antispam: BCL:0; ARA:14566002|19110799003|8060799006|15080799003|461199028|102099032|3412199025|440099028; x-microsoft-antispam-message-info: nUVSd72i0frY02FMUjffA7Bmp6lNxQaajPEGSqCjVdVPZlqrJ7kFzCU7se758boiDVojvinylnAyi7NEcmCBaF4w1aaYwxPP9vpZNgW2FKRxXD7JXEZvr5HNd9Nntay+e1Ul5wQq2+/oPOaqIt5RDSrQbMC6QGdNVNayctWECgl4LsTMYed+7qAK4SKwCq3fxaUKDliGDZWlIRN9FwfzIfYTfAyzjus7mG8GDynmIlk9mQ3xeCBP6p8kJc+sZ1Y1jhvatjqlvZI9yZzlv0HdGsDbH3D7qZyWARUZAR1ZNy+9UUR/1Rse3v3PwyxTOl9du2jN6vCINj2mKY434VF89Q5EiUKB18gxPuOSfg2PVOkVH8jMBsuRPZoJ/afm1b0qtySCxSeDRMfixUv1Wx9GBiDrSlEyGsVp4/kSIGNTfAekQa6MqB5E2LC1fUEUzJbvy+4CisowAbB4V6HN1vvE0K+LRz5FJnwkTO570i0mo2ad4az6AJprWPu6InpgtNi2qPameakzOFGWanRXsEXFhIbmFE6yfIqiCkYRFVZM+4TpNvaP27n9d09aL5gvWYteNXyEWlwSEwkhg2OyagcF67D/W1BKH5X7SVDI8xO+NtRwh35h/YWQh8QK/PlnuwCvpyK9nVgt7+1MRQ0YRsPuZfmr6vx/nQ6wQsPBWxuqMr7CrHjhPFegUa5JMBXDTsq1 x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?Rv84q0dNfoj0fQiR00dclqE?= =?iso-8859-1?q?Vung8qjXjx4Ao8asPhMUxjLQeUrnswcjybb9i/tDuNrtx8vDqFSkqY9u8gxt?= =?iso-8859-1?q?gGpXdeMdOeyGz7swiH+uLJg8ft+oVuYaIJy949mRjEJ9j3pPftVxxveg35Fu?= =?iso-8859-1?q?BMDFUkIPNOocS9XINx5nnsoe7ZLM9mcAzGAiDKqYs7GtLxs2wpsWfodqGeCY?= =?iso-8859-1?q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54WxH8dGHgCgOq/V/7sX0hpjlDYS7g5cK+PyRd?= =?iso-8859-1?q?ZTnvDDWWSl00G2IWO9Pvtf8uRaIiDN2yJEMiOxoa/g7ti+3xlW69juFPcGSW?= =?iso-8859-1?q?NEsO84mFKYd2R23Z+Zc+9Zz1OC9s/xdjOyhe6D/smC7lZbCv0+m0TZL+5NHQ?= =?iso-8859-1?q?j9j6UuHCflYEQQ2z104kWTsUxh7ZwD0HdcPClAKDPLyxkzoLtESUgQlK91OD?= =?iso-8859-1?q?DAhwddUWkHwfhaTs9ZM8WyVw4q6RnGmS/8aLMdyhuuCkHBDVa+xVmMVWOUQj?= =?iso-8859-1?q?5?= Content-ID: 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: 06b81f95-9dfc-4042-7d07-08dcbeb2da85 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2024 11:50:55.8850 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN0P287MB0120 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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,