From patchwork Thu Aug 8 13:54: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: 818326 Received: from IND01-BMX-obe.outbound.protection.outlook.com (mail-bmxind01olkn2066.outbound.protection.outlook.com [40.92.103.66]) (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 1EF9618E023; Thu, 8 Aug 2024 13:55:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.103.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723125307; cv=fail; b=j9pzRwnLq86HjySE/coImzwh6gERqQBIB2nmVtwg6cCC3UyEV716O+FOPdZ/Rhn0m1MAdWCtTOI+PTN4e0mKZ+Ri2W/RYCdqUhhoc47x8P/ckCH+j7N7DhaB/jUYq/3eIv6jsi6qHB7qgp4RVyPggQUAYmLg5sd9fQd91x1fHaQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723125307; c=relaxed/simple; bh=jCr6GauCRcC/9iluikBIxt/ItT4hMTWA3erT2d8Q39Q=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=qiOtesvSGxqP82p/mDTx/rfswGcb0wqbSPioDgrTXPFChH2IIQiYvLwMrnpFUq9aFi5N76ZSCZ7duASN9zJ9occE5j7TiWhA2SSrptlXvPMz14mDt3MirhQ+Tj/K0bT7275m0b5gW8VQKLAOmyPb9UjuSoLGyjuPUIHsEzSGEmw= 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=URiY47KC; arc=fail smtp.client-ip=40.92.103.66 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="URiY47KC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kb/+04GPFMvMFB/VNyTCVHuLjSe3uOFiXt7SJkyKKEWAeStjmFLrbPQG5/B71gnGYlwOTLo2AEXrTxekS48/0gbTdFGPLcLosxaCnzPp1x2K0/3a6nTJcCao7lCEK07mFcFIiVuFDv/QNSZofhH7bYqnNsZSg4iS7EPtSw2IGK+XwsJ41DE2JuGLlMy4lP4T/Q/TZNJXjQVZRJftVvEVILB5on1SRB6JZ0iZ6TG5+Fks2ekjfJieTzCIIB2eW1/oHKGndetKk4KwHwyLjWZv7VBn51LE9aXnEGfsw0cG+q3ZN7ca7wEW+0/5BCJt364lTcOz4rHKDErJf1ZPjWsMrw== 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=4bYZgdqTMzmRFsyXfpaWbc4sii2G3oKwpGMkDDNkMys=; b=YzvPyf3acn3ToxTvwlo7uv4aQFx2i6qytYiDZzYO9S1d8OoxiEZABY1SmjXVwNEPu6K+iua/bqNCoYzCVNSH0cJpXvyiMdRXOTHLk1Rhau5a+OhKVCZwzqUgciFMedqqCuE/kOFF9f8nDl3Z2se1AZMkiLBJXD/gJV++4qo6alWNF/wJzRdXCalqg+IzE6FOvFgYxrbcEyFwfpSK6Eqx7lPunWt8PJ2eZHxR8NoYXsvwcdrcMAbOZJVvP/v91t9xpNiWe7+cm2p+9ULYcYkLMbcTtSGsk9x0dNqMgnhWVW875ANxeTDTjeM/idIL0BjN/8KUswsM7LEJ2KX/vZ8s7A== 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=4bYZgdqTMzmRFsyXfpaWbc4sii2G3oKwpGMkDDNkMys=; b=URiY47KCB0u6jM9Ol74gNqQxFFISSwnulZ4/djCgbWksXhZX8E7tzDxawT3vRnIuBhjy93GTEA5pnhmyDYh8aPI3OEK1E+JXRC9SJCIkwtLthWj/iJkY1LnRCxyTTSBn97+DPVMsqTTFrsvXRyg15VzPvS3oiFNs+CTZ0Ji3XIhAh63UaeF+ywfxpeBy8AzfE1mJduGRvrYPTSzUiZXSGV6BjqdwQG24YGlm3G6/ojHSjTq9xZiqUqI/lwhxT1UukUWUx8BekElxG8LvEf8ifdzrdluh/pHf5Y4phIcvxNhb424HTTjvfbIJe5GBDa7X3RnUuTwYqNGB5ewyE3BIxg== Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:b3::9) by PN2P287MB2013.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:1c6::12) 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 13:54:55 +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:54: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" CC: Orlando Chamberlain , Kerem Karabay , Linux Kernel Mailing List , "linux-input@vger.kernel.org" , "dri-devel@lists.freedesktop.org" Subject: [PATCH v3 6/9] HID: multitouch: allow specifying if a device is direct in a class Thread-Topic: [PATCH v3 6/9] HID: multitouch: allow specifying if a device is direct in a class Thread-Index: AQHa6ZqMeCTzUt83jEWlknyG6D0ACg== Date: Thu, 8 Aug 2024 13:54:55 +0000 Message-ID: References: <1368FEE8-58BB-41C9-B9AD-7F2F68FF1D53@live.com> In-Reply-To: <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: [8hwJzuxZ51yB2GXKxFDo/UrgEegkZVJ9BEs6Ml1Uev0evDfvbdqh8FCJiJ/9tOrpVSE62X8aBig=] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MA0P287MB0217:EE_|PN2P287MB2013:EE_ x-ms-office365-filtering-correlation-id: 1eb8c401-8dfc-4fc4-e546-08dcb7b1aef7 x-microsoft-antispam: BCL:0; ARA:14566002|15080799003|461199028|8060799006|19110799003|3412199025|440099028|102099032; x-microsoft-antispam-message-info: BudKZYsaJTagZyLvbaTZ8ofW/g7pmhS+P1JG2fRT0LZFGEC4s2Ef75IR2bzDNf1MREor4/wFK1a6q4kC5w3SCDX7twrzIyY+xezE6tRZQMd1YRUgm9hLDDdK9M5KKjOyPUi9IygcXVx4LdFDgRwSF9+CpB7H6AjWtXmwSOAmtsgw7X1W9ApOWj9YY9tDV81V0p2qe3TRQfXUeFptvvKGpiwpO7KW7OhS0ddVdz0gZz1g+YAGdALujIi1vX1ds3k6xflfqX74Nzo0dnuOJSUCnhUD5gjfQMSIaehz8FwKqpYP2F03H4cHWc8gZwYGfrCxKkxp42At/20JIsGPDsPaPAB0POhGWXnoe+gbNROQ7TXiSR3BtPh0E3S/OanWN17i96P3DG0odWP8lSz+SBpmil4wYt4SvSiK4zaL0tsZEdpSn9z9ZpnqzlpSr3Nxf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7g1iiQaA68agloJO5c/puiKazbszjBqmHQPlO8hgYSYkxDVNvHOnSBa0SKNPMJjrKKjA0BIPT+zOY8iKiD57ynfHF4HwnkQCxuWwpZwkE+vk8tSB5tbzxuZ6EBJSNQu7kzZvDk6mabTuU3EkbUCQIdGiotwVO78wWSD0loXAuSfxon1DE0cvrnNvjo3JCCEuAvvnfEm62LJDmqjKs7vm0LQlDz/5E1BzadiJZirVL5Z8MjoHDiA+yeSA35N9FabWCeeiVUqvcKMosfzWPm26CprhPJ3nNWKiLLQ8nco1U9+nL/lhuVAknbrZkPwi5PjYSdbqeX0xMx9SFb+vUFKqwUPed2dmCePGRyO/Q/aGm5NNJIV3RipUAADLkZHeWSgmvumUs3rvyLlczr18WkTvMOTpCkEjqW8KPdLWGvPaM9a8tmxc+R7YctAvwPwH88GtTACRsUTOoJAXpOTeM5uyAZ7+yIqPVVkYk6FbV6aS+y7Y2f0xWrUv4zAuJ6UqOQjfVT1pD++/9flU2oT20iRBbCCjSg1JwrBqcPNz6QA5e/SzaB1nJAOcFbQeLLv2 Content-ID: <1917D30B77C1804EB98DA9A500D26A51@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: 1eb8c401-8dfc-4fc4-e546-08dcb7b1aef7 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Aug 2024 13:54:55.1794 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN2P287MB2013 From: Kerem Karabay Currently the driver determines the device type based on the application, but this value is not reliable on Apple Touch Bars, where the application is HID_DG_TOUCHPAD even though the devices are direct, so allow setting it in classes. Signed-off-by: Kerem Karabay Signed-off-by: Aditya Garg --- drivers/hid/hid-multitouch.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 60b675cd1..2948fbcbc 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -146,6 +146,7 @@ struct mt_class { __s32 sn_height; /* Signal/noise ratio for height events */ __s32 sn_pressure; /* Signal/noise ratio for pressure events */ __u8 maxcontacts; + bool is_direct; /* true for touchscreens */ bool is_indirect; /* true for touchpads */ bool export_all_inputs; /* do not ignore mouse, keyboards, etc... */ }; @@ -563,13 +564,13 @@ static struct mt_application *mt_allocate_application(struct mt_device *td, mt_application->application = application; INIT_LIST_HEAD(&mt_application->mt_usages); - if (application == HID_DG_TOUCHSCREEN) + if (application == HID_DG_TOUCHSCREEN && !td->mtclass.is_indirect) mt_application->mt_flags |= INPUT_MT_DIRECT; /* * Model touchscreens providing buttons as touchpads. */ - if (application == HID_DG_TOUCHPAD) { + if (application == HID_DG_TOUCHPAD && !td->mtclass.is_direct) { mt_application->mt_flags |= INPUT_MT_POINTER; td->inputmode_value = MT_INPUTMODE_TOUCHPAD; } @@ -1317,6 +1318,9 @@ static int mt_touch_input_configured(struct hid_device *hdev, if (td->serial_maybe) mt_post_parse_default_settings(td, app); + if (cls->is_direct) + app->mt_flags |= INPUT_MT_DIRECT; + if (cls->is_indirect) app->mt_flags |= INPUT_MT_POINTER;