From patchwork Mon Apr 18 03:18:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao J X-Patchwork-Id: 12816235 X-Patchwork-Delegate: jikos@jikos.cz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B750C433EF for ; Mon, 18 Apr 2022 03:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235981AbiDRDVX (ORCPT ); Sun, 17 Apr 2022 23:21:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235974AbiDRDVW (ORCPT ); Sun, 17 Apr 2022 23:21:22 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12olkn2103.outbound.protection.outlook.com [40.92.21.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5149216582; Sun, 17 Apr 2022 20:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YrLsN3MWOZr5/vLDEIVwP4EIuVaNR3M8gTdHVPuXajam1jqT277D849vegg3OS5XX2ZnCIlZN4KAohm1oG18PY2yTH8+HDoY6zRIW+UH+F+aVG1gr8dQ5Tg3FK5YAoloHhyF5sZ69NIQai4UCEGq/gCv+Nt8QlSxAJtdyoae7Fuiqsz4Iig+3VXE4zSry1ZnvUFuWf0rW8/x4BOq0tuqBqCHc+g7lxpN5kMS1s00OdO2n4ynsxYUNUf/n2++2HP4Hf6LTk2frd+8sCLd+avrX6oYka/pUgpQvMu2ZbAAamtPhA3KnggI0du7U7iqr3BJYbuysMXrrCF2FxZVe8WRTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=n8WCTicGLayYERIxGpDQeZrTPt8Gw748nN3kbAp3l54=; b=Wofg8JVWqy0QJM/ky4jFzersQpYGVcLo4vazbk2gfbVMQTkrYXG9cAr1VKJbF/2PlQD5WSu7ZFwUSWL3GWmuFl9KJDIxa1/XtR0vgTmJMwGkBe9WvZOGr9bwtdrg2F2xO0R5oMj+3xW6afNwjpUhnGApd1GBZ03pNuo9aMhSk1fo0eOCr/3HR6Pll5OmImO2/Dul2S+AG8NhE+CiUzAb+7OLCqhvGqPwbPynNyWE31tRtHlfnGAC6AMl1xutrWLt3YhGnFLK/1CdD/Ho8ggtcoL29LDjcjLjDscIYjfdDoIGsljuv+0X5v2/Q3VUGKdVdv+UnDPqXgE7ZgWHvq/6bw== 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=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n8WCTicGLayYERIxGpDQeZrTPt8Gw748nN3kbAp3l54=; b=ZN0ive7J/1J2noa9bjDOpsNkB3kb+ue3JYXtrUmfwSJliq76INHjNJDSLKfrJGE0YQi9dRcw/Fg2WSa4PNixVy46Y6E2DTQF0vO1YGlTKiP1IswJcgrkAx/FJOKv+lxP2DWBvqsPjW5NJnDLgiLvaqdoBmsQGLV7VhqHSl7imk455ToJU4tBh4vk8y0qJBLjEeT6Oh/GocAiVgoonpb891QC8PtOfU8EvG2npSl5EqnwA0pYBavkvwzExuUkzOhihpyesewOTxwx7uTPIYNcL8GdJ8ey1PCUJnvSy/5WH7hFANKiHCXmCBW134Jh5/IJjSj3LH44sggGriOvp3Ge/w== Received: from CO6PR03MB6241.namprd03.prod.outlook.com (2603:10b6:303:13b::6) by BN6PR03MB2803.namprd03.prod.outlook.com (2603:10b6:404:111::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18; Mon, 18 Apr 2022 03:18:43 +0000 Received: from CO6PR03MB6241.namprd03.prod.outlook.com ([fe80::98cd:da57:6117:c992]) by CO6PR03MB6241.namprd03.prod.outlook.com ([fe80::98cd:da57:6117:c992%5]) with mapi id 15.20.5164.025; Mon, 18 Apr 2022 03:18:43 +0000 From: Tao Jin To: Benjamin Tissoires , linux-input@vger.kernel.org Cc: Jiri Kosina , linux-kernel@vger.kernel.org, Tao Jin , Bingchen Gong Subject: [PATCH 1/2] hid: multitouch: add module paramter to override quirks Date: Sun, 17 Apr 2022 23:18:26 -0400 Message-ID: X-Mailer: git-send-email 2.35.1 X-TMN: [XfL+OE5JIM+plyKNcGUvsa4uZFHvBEGO] X-ClientProxiedBy: MN2PR13CA0022.namprd13.prod.outlook.com (2603:10b6:208:160::35) To CO6PR03MB6241.namprd03.prod.outlook.com (2603:10b6:303:13b::6) X-Microsoft-Original-Message-ID: <20220418031827.37423-1-tao-j@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 517ae5d8-bc90-4a42-cd8d-08da20ea246e X-MS-Exchange-SLBlob-MailProps: CaK+F7me6Ck/FTX4x064BW1Pg6/6QSqD5HgsgrGrHJUBI60lcMGiC+cNFOVSecvhWrLYCK4a2xDubAdUNzEijFHeH2uhumAkojUErgA5va2jwFv+2zsVMiKkI8pQ6FuOmvG4YVEMywbEDtuIyZBR0hxIqMc1XvsmJCwPV6vXUkY6aReB6koaoWOAvr52kG92o/3W6GM3v9BrZLryM/fv2aLOxNeQ0ayJ3bxowP25im9ViKEq+/GjLUVEDjpb0PCbAAtBli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7UIO/s2acRpjw99somn6y0Nb+8IysA8wRsDW4ta24x9RoKzS7YhiIf6fPEUPhP21fuLX1AhMsxxlSY40SoOY0pR5N0iBrCmWJqFJHBSYzLH9xwRaAiAF3MfbkOfW2yD0AMLr0ZbxLxaZ62+m5rodBIV3sFumEHIhhGxa8JEE5kCbdMU7TNiyT3PtP5kf7ifvg2uZPSKWLQmwmlpi3VVNy4isrOfERNgurj7k2uNBIcqcVKdbM3d/TU1C6jwi0nvIL1XqxpSMcgCAEgP/uUgHU0sH6RzaupCVrDBwuvCkcXG97OoJvv0ndWHOTx2aNduY2dvTOU8Z0LhP3CK+4ydICx+uYzca1tJxs6W0qdfP28LmJFE8tSVrxEf7p5WKhb3RUwtV5KsonACtt1lAMNRclDWQP8eZXGD2ariiRdG86/C94Cr7v/YXogbDCOZltSt25rX3pXgffGTYtMDeNvRLIiICI3+8C5/4Y/bex0ior//GZwphpLyaVEJrxzIqFQTAw9hRdzoDgY= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 517ae5d8-bc90-4a42-cd8d-08da20ea246e X-MS-Exchange-CrossTenant-AuthSource: CO6PR03MB6241.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2022 03:18:43.4367 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2803 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org There is a sysfs interface to specify the quirks. However, some quirk bits such as HID_QUIRK_MULTI_INPUT are only read once during init/probe. Setting the quirks in sysfs does not make any change to the behaviors related to those bits. Also, it is hard to wait for udev to modify the quirks in case there is a rule given the current init and state machine structure. A simple kernel paramter is provided so that any time a custom quirk needs to be tested can be easily applied. This enables the users to test out which bits are indeed necessary with just a rmmod then insmod/modprobe cycle. Thus, new hardware support can be added very soon and unneccsary mildly costly quirks using mutex and timer can also be removed based on user's self-test. Co-Developed-by: Bingchen Gong Signed-off-by: Bingchen Gong Signed-off-by: Tao Jin --- drivers/hid/hid-multitouch.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 3ea57f3..c6d64f8 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -398,6 +398,10 @@ static const struct mt_class mt_classes[] = { { } }; +static int override_quirks = -1; +module_param(override_quirks, int, 0444); +MODULE_PARM_DESC(override_quirks, "Signed integer to override quirks in mtclass, must >= 0 to enable override."); + static ssize_t mt_show_quirks(struct device *dev, struct device_attribute *attr, char *buf) @@ -1749,7 +1753,12 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) if (id->group != HID_GROUP_MULTITOUCH_WIN_8) hdev->quirks |= HID_QUIRK_MULTI_INPUT; - if (mtclass->quirks & MT_QUIRK_FORCE_MULTI_INPUT) { + if (override_quirks >= 0) { + hid_info(hdev, "overriding quirks with: %d(0x%x)", override_quirks, override_quirks); + td->mtclass.quirks = override_quirks; + } + + if (td->mtclass.quirks & MT_QUIRK_FORCE_MULTI_INPUT) { hdev->quirks &= ~HID_QUIRK_INPUT_PER_APP; hdev->quirks |= HID_QUIRK_MULTI_INPUT; } @@ -1760,7 +1769,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) if (ret != 0) return ret; - if (mtclass->quirks & MT_QUIRK_FIX_CONST_CONTACT_ID) + if (td->mtclass.quirks & MT_QUIRK_FIX_CONST_CONTACT_ID) mt_fix_const_fields(hdev, HID_DG_CONTACTID); ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);