From patchwork Sun Oct 23 00:57:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 617690 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 0CB60C04A95 for ; Sun, 23 Oct 2022 00:57:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbiJWA5b (ORCPT ); Sat, 22 Oct 2022 20:57:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbiJWA5a (ORCPT ); Sat, 22 Oct 2022 20:57:30 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2070.outbound.protection.outlook.com [40.107.101.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 685AD6F243; Sat, 22 Oct 2022 17:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FPopNnPnlEDLLjKKAaSWWWm2WlAuuEOBgeS4KsT0U2TRm/WPxrz7Ki+B4u1PPMUkfwMaHEW9gp97tKXUwt0Rm0AjX7iNtAoh6JxgIXQwa2qJWDD6LHCw1kZK2e17T59f6OpCkU+0VL7cVKy7JhvpdzKKl6Y6dZTf3PtUfByMFo4K996Kv+Js/jRaFzFvZvtzaYUpvYveas1lVTRt17TFW11PLK3pJ53W9/KuPR+aNuZKelr4QYt2Qjlh/G6FqTenyEKjdgaSq796orwPMAmZGbo6kCUl8tOO58jvkPeqO7mgvB1bIZYffjIXFSwjnwgMwK6AIb8rF2kDP/WYXwREFg== 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=EugJVYl9cHPXUVkxCMrGBYskUwVPTui/O5WBYvRVJn4=; b=lj8hHKv5DZrbFnV/l3B8mCUYFuuhruCpLphS434OBnwjmmMjiHe2Pd1d4bHk0ICFIZ5qsLMk8onQ+v+TPatQi8zTrUrYXWpOvcy6LMAeII6rX4aCWQnMi4fr/tisB7ptvHlndpWRgJD73oVGRjPAwsWeA5YqoJ54hfjUs3F499XpN+u6o9jIoSy965D2J1qMTJhIfmYWhs6Zw9R3MBKwcfT0tT8JRG2uony/UMWzo562kJ03GBCyylnir8xsKUzIJywnrtDNj04dAqh1BcmeO0LrW6iNwfEY2gR2awLyDtb8pP0XbVdJav0hb1SVIyX0a2xP7PiPMEuzSLahclYXdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=labundy.com; dmarc=pass action=none header.from=labundy.com; dkim=pass header.d=labundy.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NETORG5796793.onmicrosoft.com; s=selector1-NETORG5796793-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EugJVYl9cHPXUVkxCMrGBYskUwVPTui/O5WBYvRVJn4=; b=C2f3tgJt5FqTkni1LCrX+au16nY4f1BD19hkVbZ7uVP3F+p1aXE9tC46DOdxvXuJ2+xww23Qt79TJLIXzjB5AqlIseJDrGYk6erN81twVmrVDw6P5ZXzSSwGoFLSZZ+qakuUuKusQzL7KJKwT1MlGKXpj2pLyYGEKTqDPp1quWQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=labundy.com; Received: from SN4PR0801MB3774.namprd08.prod.outlook.com (2603:10b6:803:43::21) by SN6PR08MB4896.namprd08.prod.outlook.com (2603:10b6:805:69::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Sun, 23 Oct 2022 00:57:27 +0000 Received: from SN4PR0801MB3774.namprd08.prod.outlook.com ([fe80::afa7:70e3:c2c9:b680]) by SN4PR0801MB3774.namprd08.prod.outlook.com ([fe80::afa7:70e3:c2c9:b680%7]) with mapi id 15.20.5723.034; Sun, 23 Oct 2022 00:57:27 +0000 Date: Sat, 22 Oct 2022 19:57:25 -0500 From: Jeff LaBundy To: dmitry.torokhov@gmail.com, robh+dt@kernel.org Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, jeff@labundy.com Subject: [PATCH v3 7/7] Input: iqs7222 - add support for IQS7222A v1.13+ Message-ID: Content-Disposition: inline In-Reply-To: Y1SQ2t6yUvdaIQPG@nixie71 References: Y1SQ2t6yUvdaIQPG@nixie71 X-ClientProxiedBy: DS7PR03CA0118.namprd03.prod.outlook.com (2603:10b6:5:3b7::33) To SN4PR0801MB3774.namprd08.prod.outlook.com (2603:10b6:803:43::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN4PR0801MB3774:EE_|SN6PR08MB4896:EE_ X-MS-Office365-Filtering-Correlation-Id: 71ace626-fe60-4b49-1afe-08dab4918df9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZuuJuhbtBBbmd2lXg6YIUzPs42gjwHvazqiVuNTNyDaOLiLLIBeGG40iA9Nc5On8KTD6IFDajnvrSolwwNUDR/xyrK8QgOyPjABH9jJp1NPQkxnI2DfWIc7/79ote7GrqRzDSyTjHZdqJgSnqh6oiN7ZGYZAEuUVPRwjs3VttxZmKb+CsxVwSvAP6PTppz/U3IEgkN5DvlVEDk9ej3xu227i6YVYm5NpJrmT7Y8GxOy5SVUq957r/87PS+//TswjPj/rO4ygXIkHNU9u1I6PWdVvwri+DHvUnjYB5xerpKMVQ6TAuPw5olGU1qLkblZhPbnOy8SAjCdBLoS+Z4hQhURAiKJXk3S8LV7ZEreXLuyq5n/ZNhr1U7qMJOEGkj4KYXJxL+NgJotvabvW/oASFKjpX8Pl5LYxsY+f3v7CuF333o9MSuHhHbGRBd5aqiNbwSeIxzM2YitBG1aro74mcThVjG2jlJq0RKHxApBUBck0H1sz8KOBalTrRdSL6lpQLHSy/yCKHDkRGBd25qZ5nkKRpLxgpJtddWX66auT1Rh0e5cMXiEWGzOlw0Utim0AgFzhuldjvxCYjct/z/2R7ZDNBHpgIyuFsS9hscgweVfKZeN8oLPPw1gdMrRCArvl3+eqAvvvpir4YHYRDBKWIhzHxDavvpzWQ6j7g80kJGfTI1+FgXmFUIW8/XcZnZ34fMRZmfUz/0PeQ+uDeKVBFw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN4PR0801MB3774.namprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(7916004)(376002)(396003)(136003)(346002)(39830400003)(366004)(451199015)(8936002)(2906002)(38100700002)(186003)(6506007)(6512007)(9686003)(26005)(5660300002)(41300700001)(86362001)(33716001)(83380400001)(478600001)(66899015)(316002)(6486002)(107886003)(4326008)(8676002)(66556008)(66476007)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xBbjv6g3Ndte2F4KikAQTCguwwU57DVEwwaPNe27BtVzz9Huz4oa7GKxzOJgTD5DBeF1gCjYqdPZ/rQL9tWsRlmaZsa8oWkkwSIphw1QDjddCLg5JFM/cdpfGZotVDeJP9GzssvVcJ6nHGdd2KBK4DZ2epuzEIcFl4P9NdWIZaAPOSBUlqWlxdatEdr4bS2VaMwzJfhtIqiQKdofVo3/rBh/oxSO7GGgDil55eQXz+5UmNr90+k2H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kajnrqG7P8/Tmz6Gq+vngak36oREFjnM32StzDhwM2B2CEuo3iDpj2yDlJoLRvoHgSwA2tWx9UKTpf8i4bpXrEJVDXr8kWTwIcmYTaDGZcCHn+dhE58iH6X62ajR4d0JJYRuFYDomWQA3PGknwxXidpmZ6uAgrsAvBFztSyzsOGfPXx63oPiF5rywoz66RV8y4SyGdLztznKZ5+re6RVV6dVzbE5YMjUa6BrvYUJYZZbWtkAohuaPvJB15rlX6qvDJGE1iWldc2nPppRdl X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71ace626-fe60-4b49-1afe-08dab4918df9 X-MS-Exchange-CrossTenant-AuthSource: SN4PR0801MB3774.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2022 00:57:27.2610 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 00b69d09-acab-4585-aca7-8fb7c6323e6f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eXWve4UeG3y+Oh89VQyK2TuEr7dIqIkLgAAF2Fr2PC48yf7mpQXmIhoGBVPT8PUV7Pm0B5Vlzm5Trxbf9ekd1A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR08MB4896 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org IQS7222A revisions 1.13 and later widen the gesture multiplier from x4 ms to x16 ms. Add a means to scale the gesture timings specified in the device tree based on the revision of the device. Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Reviewed-by: Mattijs Korpershoek --- Changes in v3: - Added Reviewed-by Changes in v2: - Rebased to account for changes earlier in series drivers/input/misc/iqs7222.c | 111 +++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index 6af25dfd1d2a..e47ab6c1177f 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -86,7 +86,9 @@ enum iqs7222_reg_key_id { IQS7222_REG_KEY_TOUCH, IQS7222_REG_KEY_DEBOUNCE, IQS7222_REG_KEY_TAP, + IQS7222_REG_KEY_TAP_LEGACY, IQS7222_REG_KEY_AXIAL, + IQS7222_REG_KEY_AXIAL_LEGACY, IQS7222_REG_KEY_WHEEL, IQS7222_REG_KEY_NO_WHEEL, IQS7222_REG_KEY_RESERVED @@ -202,10 +204,68 @@ struct iqs7222_dev_desc { int allow_offset; int event_offset; int comms_offset; + bool legacy_gesture; struct iqs7222_reg_grp_desc reg_grps[IQS7222_NUM_REG_GRPS]; }; static const struct iqs7222_dev_desc iqs7222_devs[] = { + { + .prod_num = IQS7222_PROD_NUM_A, + .fw_major = 1, + .fw_minor = 13, + .sldr_res = U8_MAX * 16, + .touch_link = 1768, + .allow_offset = 9, + .event_offset = 10, + .comms_offset = 12, + .reg_grps = { + [IQS7222_REG_GRP_STAT] = { + .base = IQS7222_SYS_STATUS, + .num_row = 1, + .num_col = 8, + }, + [IQS7222_REG_GRP_CYCLE] = { + .base = 0x8000, + .num_row = 7, + .num_col = 3, + }, + [IQS7222_REG_GRP_GLBL] = { + .base = 0x8700, + .num_row = 1, + .num_col = 3, + }, + [IQS7222_REG_GRP_BTN] = { + .base = 0x9000, + .num_row = 12, + .num_col = 3, + }, + [IQS7222_REG_GRP_CHAN] = { + .base = 0xA000, + .num_row = 12, + .num_col = 6, + }, + [IQS7222_REG_GRP_FILT] = { + .base = 0xAC00, + .num_row = 1, + .num_col = 2, + }, + [IQS7222_REG_GRP_SLDR] = { + .base = 0xB000, + .num_row = 2, + .num_col = 11, + }, + [IQS7222_REG_GRP_GPIO] = { + .base = 0xC000, + .num_row = 1, + .num_col = 3, + }, + [IQS7222_REG_GRP_SYS] = { + .base = IQS7222_SYS_SETUP, + .num_row = 1, + .num_col = 13, + }, + }, + }, { .prod_num = IQS7222_PROD_NUM_A, .fw_major = 1, @@ -215,6 +275,7 @@ static const struct iqs7222_dev_desc iqs7222_devs[] = { .allow_offset = 9, .event_offset = 10, .comms_offset = 12, + .legacy_gesture = true, .reg_grps = { [IQS7222_REG_GRP_STAT] = { .base = IQS7222_SYS_STATUS, @@ -874,6 +935,16 @@ static const struct iqs7222_prop_desc iqs7222_props[] = { .reg_offset = 9, .reg_shift = 8, .reg_width = 8, + .val_pitch = 16, + .label = "maximum gesture time", + }, + { + .name = "azoteq,gesture-max-ms", + .reg_grp = IQS7222_REG_GRP_SLDR, + .reg_key = IQS7222_REG_KEY_TAP_LEGACY, + .reg_offset = 9, + .reg_shift = 8, + .reg_width = 8, .val_pitch = 4, .label = "maximum gesture time", }, @@ -884,6 +955,16 @@ static const struct iqs7222_prop_desc iqs7222_props[] = { .reg_offset = 9, .reg_shift = 3, .reg_width = 5, + .val_pitch = 16, + .label = "minimum gesture time", + }, + { + .name = "azoteq,gesture-min-ms", + .reg_grp = IQS7222_REG_GRP_SLDR, + .reg_key = IQS7222_REG_KEY_TAP_LEGACY, + .reg_offset = 9, + .reg_shift = 3, + .reg_width = 5, .val_pitch = 4, .label = "minimum gesture time", }, @@ -897,6 +978,16 @@ static const struct iqs7222_prop_desc iqs7222_props[] = { .val_pitch = 16, .label = "gesture distance", }, + { + .name = "azoteq,gesture-dist", + .reg_grp = IQS7222_REG_GRP_SLDR, + .reg_key = IQS7222_REG_KEY_AXIAL_LEGACY, + .reg_offset = 10, + .reg_shift = 8, + .reg_width = 8, + .val_pitch = 16, + .label = "gesture distance", + }, { .name = "azoteq,gesture-max-ms", .reg_grp = IQS7222_REG_GRP_SLDR, @@ -904,6 +995,16 @@ static const struct iqs7222_prop_desc iqs7222_props[] = { .reg_offset = 10, .reg_shift = 0, .reg_width = 8, + .val_pitch = 16, + .label = "maximum gesture time", + }, + { + .name = "azoteq,gesture-max-ms", + .reg_grp = IQS7222_REG_GRP_SLDR, + .reg_key = IQS7222_REG_KEY_AXIAL_LEGACY, + .reg_offset = 10, + .reg_shift = 0, + .reg_width = 8, .val_pitch = 4, .label = "maximum gesture time", }, @@ -2115,8 +2216,18 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, if (!event_node) continue; + /* + * Depending on the device, gestures are either offered using + * one of two timing resolutions, or are not supported at all. + */ if (reg_offset) reg_key = IQS7222_REG_KEY_RESERVED; + else if (dev_desc->legacy_gesture && + iqs7222_sl_events[i].reg_key == IQS7222_REG_KEY_TAP) + reg_key = IQS7222_REG_KEY_TAP_LEGACY; + else if (dev_desc->legacy_gesture && + iqs7222_sl_events[i].reg_key == IQS7222_REG_KEY_AXIAL) + reg_key = IQS7222_REG_KEY_AXIAL_LEGACY; else reg_key = iqs7222_sl_events[i].reg_key;