From patchwork Tue Aug 6 13:50:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 13755171 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 99D0EC52D70 for ; Tue, 6 Aug 2024 17:01:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3BCB810E02A; Tue, 6 Aug 2024 17:01:44 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=live.com header.i=@live.com header.b="aAwZHa9r"; dkim-atps=neutral Received: from IND01-MAX-obe.outbound.protection.outlook.com (mail-maxind01olkn2083.outbound.protection.outlook.com [40.92.102.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8209310E36C for ; Tue, 6 Aug 2024 13:50:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pq+DobrnypoU1Vm3TtAq5RxG4gzboeGyJNTcdxXZXB5KahsmWNLsEOsmJrS203ZG15xooSOxXmHlOZSD+gmonpNV4TLg+70OXy7JrV/CSYohrP85cRjRYL29be2YrGtUYJGLp5nml66LTk9RMqFWDEMcKirAncflnqlWSg+283scM3w9OIQhvKelO9AojsDJb3iUyMtXuIpVk+l1IiHYNPAHaulcByaJ459E1SQhIiBuZjlLtKm62skyb/kEQbc0Yd0M+Gue5b5ROd3vQ2ZEboCCQBRVhe/dFZNX/PiM9zlpYxzxCpFpZhJ54BFB+jOYd2M1zH1U47GA/xQg4PdA+w== 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=RoSZyiqImFZSicR28oGP/RkEpGdNrnqOstKFEqFyhjY=; b=HcOxzZNMjDTq850ysVToAjfbnz4Q+AWhznO8SXtQaO0DfmTKOFntkALJX/ch4qNsHWKnYsQAdqPcfJSrnL+kG2HZurWAfhniY1gx/Tm5V6caweSwY/+PPAFbkYq1n06H23x14RgLc197WcM6bVYoNk2Yp+SXu4EFMmz4kvNO0/dZV+zoyVsXokDj9EjZewS7yFD7M7gxUZQ3xDsrHzG+A9OOCVrCBOn4KzdPuTnk/pR7kN6n1TquJmtEn04t02iYtzqkj5XMwzCDGD+Erit3s4o2Z6CixnfdWjKadpJuvpidpAKdTf+IT2qjecDqDSHTImEgSynWbhZcF8KWdSZ7rw== 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=RoSZyiqImFZSicR28oGP/RkEpGdNrnqOstKFEqFyhjY=; b=aAwZHa9ri5yjwbIN0QN57nJX6tGycmOqlXvXcxR3RtODt931l1NtiJo6v79TtVlYOnFSmnwKvKBGz+8sWFNhqWXVCcedItnJKsGAJntnmGMGbmhkbNQGbkl44A4ztzn9qOzeeaxztvS2DZ2I34Ys35xyTazV0NZUcHgVCE1fH/streCWbxW0v/CTuGuxS2qiG4PA0/79Kfxj1Pu60DdCQRUF9PX2Att/20S254fLOI+dCSQ71fRJbYLbCRYadfOjSGHu5LK1sh1FaEFTHG9m34fpDkSAMJc1OEApPBqM2QeLyGXVFHbsZ9nY/jraTSMrU7xy3f1XiOqJd11lPT8q5w== Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:b3::9) by MA0P287MB1708.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:fe::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.26; Tue, 6 Aug 2024 13:50:39 +0000 Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a]) by MA0P287MB0217.INDP287.PROD.OUTLOOK.COM ([fe80::98d2:3610:b33c:435a%4]) with mapi id 15.20.7828.023; Tue, 6 Aug 2024 13:50:38 +0000 From: Aditya Garg To: Aditya Garg CC: "tzimmermann@suse.de" , "maarten.lankhorst@linux.intel.com" , "mripard@kernel.org" , "airlied@gmail.com" , "daniel@ffwll.ch" , Jiri Kosina , "bentiss@kernel.org" , Kerem Karabay , Linux Kernel Mailing List , "dri-devel@lists.freedesktop.org" , "linux-input@vger.kernel.org" , Orlando Chamberlain Subject: [PATCH 4/9] HID: multitouch: support getting the tip state from HID_DG_TOUCH fields Thread-Topic: [PATCH 4/9] HID: multitouch: support getting the tip state from HID_DG_TOUCH fields Thread-Index: AQHa6AeeXBJahpnuhEq1a4HCAw3vOQ== Date: Tue, 6 Aug 2024 13:50:38 +0000 Message-ID: References: <021EE0BF-93CA-4A37-863F-851078A0EFB7@live.com> <9223E804-286F-4692-9726-2306361F1909@live.com> In-Reply-To: <9223E804-286F-4692-9726-2306361F1909@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: [qBoi9aXREk8BqN3mMR8yQAuXg6RcGVtmUftgrMebj8ejW3s2q5732i5P+hSox22rDrvg2eywggo=] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MA0P287MB0217:EE_|MA0P287MB1708:EE_ x-ms-office365-filtering-correlation-id: 8523e7e6-eacc-49dd-3a87-08dcb61ec154 x-microsoft-antispam: BCL:0; ARA:14566002|8060799006|461199028|19110799003|3412199025|440099028|102099032|1710799026; x-microsoft-antispam-message-info: IXBBw4NinoBT8kVU50EdQVQebVTHP7ircpVolXnjT0orzeTWKiKCQo1ratFDUiVNdizOnNNYnvK8X94ExooNG8tZsW/C8WJHoTf3sDbnLfSkV2hJPk/npa0i+frnitS3OOcGSYpWhVstbSLTGUeNHLJry8wwxXwQTwaBKKwuSnluG8jVwctqZoKgkFeW5ZgvEjNHbB56dY2+dxCyK6bKBnsqqRQLnC72mzZLC9/AUAKGVHtkBX9GEX4qqleo8zp0rpkFetokjBT8lYdNS8HWIrkG6JSwyskJx9ilps4K2OC4p1n6E2blQNKNG9leqmhVXjSbCtXKaiMsh+uyIMpMsSavzbIhQFzaV30+HVH55P3vCplt4vpbv+5wfGLbMGaDMSJnn6HowWrzeQk/hsdoJI9gUaIM5SrZTrXJ+Ufa0xZamxPJ+2aVeDt4z6k4ObbL05uK6iFljj21XkBgBrAP3giojVxG+M+B7Z13O9GTkuoipGHkI54PGN8ZC2YRb3q2uL1tCRwPUFLQ3cUyQygKEhU4X6Gvqu/pzf++EHKxY14NGFFD4eqFn6Xh/33qAyVuKktDAsdjYKA1T1Yt2VDRHP68CSKALIH2UtQx2WKfjzBIhSdEdckEW+EDK/aGphgmTGZlJeUNJh8xhsI70JrFPDDl/CoTBWQLLrd/LXX0VshComYZY/rCLZ/fnouu0oJ8 x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: 60E6KDhPygqBGbIfckeL2cmCCYBkDY7pQPvsOQ5AzjU8bp1V1ZXngklfQjjfXrgsE0YdlQt2tRVnJs93hQPMPm89c4MhfUl7LRmHJmESzvM0JIjnAEg8RDy75DoXLI5xKTnON+bBwQf7VDZspILljxeg/zaeXmllD8areVVo7L5RoEef55xcpijbkqihhxEQ6KW7ld06biygCddEulJp4unrFCRiNPZ18VQrioxsLEN5+sOsYPwyRKXg9+1JH7/aQRTbbxEZxyV+rZOwT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 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-bafef.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: 8523e7e6-eacc-49dd-3a87-08dcb61ec154 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Aug 2024 13:50:38.8527 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: MA0P287MB1708 X-Mailman-Approved-At: Tue, 06 Aug 2024 17:01:42 +0000 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 This is necessary on Apple Touch Bars, where the tip state is contained in fields with the HID_DG_TOUCH usage. This feature is gated by a quirk in order to prevent breaking other devices, see commit c2ef8f21ea8f ("HID: multitouch: add support for trackpads"). Signed-off-by: Kerem Karabay Signed-off-by: Aditya Garg --- drivers/hid/hid-multitouch.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 3e92789ed..571435da5 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -72,6 +72,7 @@ MODULE_LICENSE("GPL"); #define MT_QUIRK_FORCE_MULTI_INPUT BIT(20) #define MT_QUIRK_DISABLE_WAKEUP BIT(21) #define MT_QUIRK_ORIENTATION_INVERT BIT(22) +#define MT_QUIRK_TOUCH_IS_TIPSTATE BIT(23) #define MT_INPUTMODE_TOUCHSCREEN 0x02 #define MT_INPUTMODE_TOUCHPAD 0x03 @@ -809,6 +810,15 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, MT_STORE_FIELD(confidence_state); return 1; + case HID_DG_TOUCH: + /* + * Legacy devices use TIPSWITCH and not TOUCH. + * Let's just ignore this field unless the quirk is set. + */ + if (!(cls->quirks & MT_QUIRK_TOUCH_IS_TIPSTATE)) + return -1; + + fallthrough; case HID_DG_TIPSWITCH: if (field->application != HID_GD_SYSTEM_MULTIAXIS) input_set_capability(hi->input, @@ -872,10 +882,6 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, case HID_DG_CONTACTMAX: /* contact max are global to the report */ return -1; - case HID_DG_TOUCH: - /* Legacy devices use TIPSWITCH and not TOUCH. - * Let's just ignore this field. */ - return -1; } /* let hid-input decide for the others */ return 0;