From patchwork Tue Aug 6 13:52:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Garg X-Patchwork-Id: 817804 Received: from IND01-MAX-obe.outbound.protection.outlook.com (mail-maxind01olkn2065.outbound.protection.outlook.com [40.92.102.65]) (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 7EA131C579D; Tue, 6 Aug 2024 13:52:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.102.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722952335; cv=fail; b=Q1v/UdB21G2DDIDzfR1DpO8BUqGyUhNJd2L/bFR6iYN+4EYtgbGgrk1KQlqgzJ8FG/NZHCCFiUcwRW0Kg6IAg1XU68QXbihaadza3vLk7CDwQnsv8GsWxo16G6R6QqKQqa8id6BmRgso2S/XMLjsJ2BP+/1U6bc3J9K234zVT9c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722952335; c=relaxed/simple; bh=jCr6GauCRcC/9iluikBIxt/ItT4hMTWA3erT2d8Q39Q=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=XpU1B83KKJoVUT6gFS9xrzAdcyRU2D5VdAygwOS0fjqMtQAwC545QzpexiRkxDeyoDE5AXWfGUufhkIqV6CsKn7UxzgWQ5dJJLlUgU1HjjIDzVm9xgU+5Awj7O7XJW/ZOfGqck8xmrVIKT6hk/zNX++irIbLiJp+hfpGrpIzsWI= 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=MIaZ8EJB; arc=fail smtp.client-ip=40.92.102.65 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="MIaZ8EJB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Nww0OtRcTbev+JQoG9qsmSyKaklPeQ72le/+FJ5nqlq3PjWe56QhbW+LBgLFaHfTUbYWsbFEvX8V+901JSr+mcXR05BZt4wsbQEaHosMyH6SxtWoqRZ9LkJ8N8WLicpqM0ZSAp8+okilFzbC/7deEemb5tQ1wGPJEfMOiTJRCYsA9Np8MJzm6LhmymGmVXtl7ZZk1qCooLE/7ua7gVeuoHXmRzQVUvDAp8VpKPwNSYC6dJp08yNSiCr6TTFZ0evzzvHuKh3gpcGvmbuXUTQ6ZAOzDtN7oj+RQ2PqRyIepZ1Gzc6oEhED5Uc0A0MvtVP84KE3u1Nq30w7YXzHdmRMvA== 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=X4RWWXNgsK5hQ61rrNCEW+nC3YUPauLl/W5tzO5gUb7Aw2YM3sM0s6pUpsqHlrKoWOJ9/wFUIiZLmQ2rK68PmlQyxLDw8gL3RvsOYiEmXFkh0wx0xZpyDP/6U2IplVrEItVRVbwaGJINl35NMbVaW4h3u3MxZlDyu16p9e9rxZcIVRKxdHbdbmQIyTnmtzjvDAleUehZOXMiBU9MVT7+Qw+czZx+xU0cdVJkQMWjgm2ATJVPuNXJiNU/5FYd7EuUowM1x02hkhRoDM1mC1F5OTAo9KjJUTBsCC1e1x7DEqFgOQcHEJwvJzmsM3Hh2ue7gBta8ZPYE43+MeX20ZR++A== 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=MIaZ8EJB1sUKqhEjG+rvtN5FTkeWaIzbs6RjkOI/ccSnhlfW4IU5fpUTxX9sCfx10DNuM/n19JMiWMERPojMMA77L69KfYfddYRoMM1SrO6Auq+sh6nPjFmWQuyYN1IVkShX7tGsWiMmwhQwnGIjvjCoj2q14QNNQZVZcPecrZ8AyjQX1asS1NCbGuZC8nsUTBbyuYw2JdQOUV7Wy89PoNq61D9mdlFaSb/cLP/bpZCgMWaKOE5le8IXhrQ63ScSJmkgEoFcaF7EFzJNEFcFM+km+F73JAikKvrnWb1/jSqA+hoEURtZ3UdAr7o/CiL+/AE71gpgm5k8kZgbxqaUmg== Received: from MA0P287MB0217.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:b3::9) by PN0P287MB1046.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:139::12) 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:52:07 +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:52:07 +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 6/9] HID: multitouch: allow specifying if a device is direct in a class Thread-Topic: [PATCH 6/9] HID: multitouch: allow specifying if a device is direct in a class Thread-Index: AQHa6AfTXzzJ/JF6skiWN3sUlqa+rA== Date: Tue, 6 Aug 2024 13:52:07 +0000 Message-ID: <708F206D-3571-42E2-BA6B-5AD9EEF66073@live.com> References: <021EE0BF-93CA-4A37-863F-851078A0EFB7@live.com> <9223E804-286F-4692-9726-2306361F1909@live.com> 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: [1rXyefyAd4du6axD4T4TI6TaWAibKUOqrTVFNx349dzHl1wc/h/ohhBxEwOZTVwfZ7MYF4DUgM4=] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MA0P287MB0217:EE_|PN0P287MB1046:EE_ x-ms-office365-filtering-correlation-id: 0e9829c1-55ad-455b-bb9b-08dcb61ef61b x-microsoft-antispam: BCL:0; ARA:14566002|19110799003|461199028|8060799006|102099032|3412199025|440099028|1710799026; x-microsoft-antispam-message-info: afzkGsFwFavMgQjrTREFy/7q0uj/qpJvL2Q5dFvlE9DtLgnIl5c3BLm/oF7i/8KRwHe+Zlr0b4z46hDmxDwPMYkca8y6x2Er0KH/KPzyYQdOLTCiGV5iyMIkuvuV3x55ELqyHV+7uMvv/4eMqOTK9MLk6CoexKVKhA5p0OraQWObv9vnimK6j3gkoeHPz4twjdEnSOaro0rpkd00GuMLKnOgKmOe/271WE0MAukjF4vJ9V8OfpV3qQ0hlOAP5r2qa7eaccFOGc0kQZa6euamGmYyNFgYBa7uBjMHeAHFjoqkrgZNSbapZiDDh9of+umnWJFEFFSoUqZWg3T9hW6LAFKJ0NAfpnmQqm2l2pTuZMYxuRanqdXNNRyLj/UzpiA4ANsJC9CyaNgXaVah4zLXmS96xCbk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GV6no2mN9noKrr6CdwjBAkSwICNMnXtbmY82qVKtGOTCUlP4+Evc4Zwcz1Pyl+T+2lbVDDkbmZ356Fw+N4qT0ceB72uQxtDaBjjD5Nf6aSRet7YdHO+2OkiJVByD2+b05zcFlsLH6glk+YgKjvQbLBxZ9JVrZQmnJoQG9krqwSCq+YT/N3WqypNSQkRmNDLKywjj1ZkXVmKBmoqie+gfWiJ0V9XMND6i8lJIV3vc11MJhTci0CLOcYJx3XYyInWqrHprmpes7MA2ZGqXBqjQlqG01fkfZyvmvPiEgEoprqV3Pg4LATOyTe2v9pQ2xRuTE2kAGlYQmUQcZ7XF3a9meplC+y2qrt3nyiCnCRGAJcCZ62bVqlydE7Xd6w/wkrgGzxUx5jcjoWoJOPHM9A39s7eUcRCxc+ohdwPd3WG4bzjoRNLNMBY5xp2DOR4HvJeCLN0QAFUBNZJQ1rdWT7tXiJzUYVerixf8vhCfMtXQZsGUDgmnTSST7P524osd8vxuZJ0BEPGIIVahwdswcvBkAOWl44LJPYDBu/yFF1igSMM2BMDhmTwMsdUaSDkwDAlEf95lVRp6O1JCaD5ZY3ZriOUxoZJiz/1C Content-ID: <9DFCC3DA2F08DD44B5BE816CAB7EDC9D@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-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: 0e9829c1-55ad-455b-bb9b-08dcb61ef61b X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Aug 2024 13:52:07.3500 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN0P287MB1046 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;