From patchwork Sun Oct 23 00:56:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 617700 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 5FE83C04A95 for ; Sun, 23 Oct 2022 00:56:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229948AbiJWA4P (ORCPT ); Sat, 22 Oct 2022 20:56:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbiJWA4O (ORCPT ); Sat, 22 Oct 2022 20:56:14 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2054.outbound.protection.outlook.com [40.107.101.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 125C46F243; Sat, 22 Oct 2022 17:56:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M/iBnZMFipcirZ2OvFd5iXc8M82DC10xVYodJycBwZcCAu/y4rA5/pMfXdmcFdawIV/s46WHV6rIJCtJwzz42qUMEcDM5p0bON5XRUg8P7RUnXbZd7wWxIbQQ6AXvsWR6BR+6juFkcbhszRY+T/qVWhxMWcpOijpBGb3elBq5tv1enZGMfct9eSfEepaEH0vWFa1tKpMu02F4JV4tB3OWPYgYKOsYUxfVRrw61EFUNfulGr4kDqMJZGjFdtEqOYsR42UPC6oWIBokGkXAZpaAr4pcJ+ThtDccY9lf6xMDk11Cs9GmulGr9hLeGcDWeOCYAQnCRH/xYAH+LjOoXrdvA== 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=PzzUxqBotv3/7ilpQJuurRQf66qgv2QqEUYPIyZ+LQE=; b=ieZwwu8amJBnnG/QNZlgZ5LxHjOnFaVrhthT4wXJYAxN7LdrFoMnGzDgwzGP4JeaJdFZdaH7FHZoWMCB2D9v/A+rp1wHAwYOe46ifyu9447BNf+nfQyTDRknl5+XL8TL9aURfSl0uEmGnHtOd9EWTKo2sjdibmTuYjUSEUhcztN/hhPcm4duMd4olf7AC3B8W1n4GdOCjqehQN/7fq/jkVJ3dO/phvnlgckjjPwn4bDYWGHuIhq/MYlYJ8LIntAnYYvcV4LLTx5S4GOKJGQgL1YgY7oe+e4lsx1qb+vGwzockjwrSMn9NaNhXNqc+cjTtedhO2yf6cppGLYCEn0k0Q== 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=PzzUxqBotv3/7ilpQJuurRQf66qgv2QqEUYPIyZ+LQE=; b=sYpMe05WJE4ABDmAh+IkBLHEPRc8atyWShhuoT3/2GIe3TrmChbliM3/kQuDs23rhJoPZI5+wsJsk195m5cVrnLONco+9jHbRJJS+fc6Jzu+aCVPqv5dUk90dzZZh6P4R0rNIJXpq6QUjVknELeF/0l1pb09TX3kx8bJh5WUkwk= 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:56:11 +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:56:05 +0000 Date: Sat, 22 Oct 2022 19:56:04 -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 1/7] Input: iqs7222 - drop unused device node references Message-ID: Content-Disposition: inline In-Reply-To: Y1SQ2t6yUvdaIQPG@nixie71 References: Y1SQ2t6yUvdaIQPG@nixie71 X-ClientProxiedBy: SN7PR04CA0095.namprd04.prod.outlook.com (2603:10b6:806:122::10) 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: 927dff5e-6a1a-4641-df2b-08dab4915d38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M1u0zW+Rl9zweKI3snIQK9EmwfZx7ALh22Jx4p36EO9uvo+rkJU5ssJvSzGKnVZwEh4CNYQ1ipGqvrfrCAer/TAx1A035T0btJQMlgmgvg+AUwhdREWPefikJFOlCA85/5+1YPns1bPeoF2OyOGXuBZwPaGCK9VmB1iodGDna4QEd8bsnP3pujSttRyYZa/FbgpXrO0iTVXWubYBYTnMZmOhnfbkp8TVAvmPnc6JxJDN9nzLr1ibw4CtJJTCuo1TdY7aZf/CqCyblWP9W0yEriU8fpNHtl2fPMCQlqfOMkiv1iozASWLKyTYil0SZq/K4aXldBGhBmCQVeSNFu0GZy16r01d0LM5oaGHdiuUcO6F93avNfZa7yqWi3E4QXGKgWUvxd8w0OVXLQV/mq4K0jhhnrZAtNwOOz4fXzEC6HZdY7xj/q68qP8jbMTcp3tShWoDf9Txp8cJ5O647wOzNEqA7nNH1wiOo5ZNcTekhHhejLh+wBIaUArOuGHUYR1+JpR38+zz71qIkORIEs3GAzcQ075WaEwdFRgmCjW+zrQA0JqekWhKkjVpVgBOYtbIx+aVO5yqaiaJAk4Hv5wo2jyY3cGtDqsjGZaJVSadkWczuyuzECw1TG8unuMiLxrXPT0su4l5uHwdyg2976EkFDGOICstldJmxl2Ujf5h8z6mWUZSh9Epw6dxYcZT7qV1Iq10wSjAG5LGHVrqRWZrYQ== 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)(30864003)(2906002)(38100700002)(186003)(6506007)(6512007)(9686003)(26005)(5660300002)(41300700001)(86362001)(33716001)(83380400001)(478600001)(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: keP2Zxi1Y5ezuH/5BJxdJGOZE69bwAieIj0YYwvj1tzOni83CIkMTIALXVpveQbs4EpR8D1qcMvknmmpMrdtmc1kmT2vbR/wfqRjTpD711QEqRoTDVM3nLWii5nE194HjpD3V3I5OAcyT5b2DRR5Y170w1RlfWqOrlRw2mfY8SvaYXz+PkHtlUld573fq6IcFLpKFxMtlA8UtV5MFOCuJ4yzkeDFb+109JvLrI1GRkFnBqHc19RBoKnkaQkbdGQP+9dttG7qUucz8LSCb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ImLzPTXPsmzKq/DRfYcTxxN5PUybdR9A8umWIKFec8l+k/OLuGdx7cLnuuzU2HwWonLfy6Z2yku/5fNb0Ih/ITr6O0qDA6fYJLlGCJt+FJsxmXz3jzJakwDwkjAvPp+rxt5E9jiXrfNr1LK1xl1QbxZ4k5o8dm1No8H3tbITKus2Cv0YdAdy5rTXRjKG//qSB2t0O18f5xQ8pZiaPp0ymITNEFs4jHXf5IU7TnSAAOW1fS1in X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 927dff5e-6a1a-4641-df2b-08dab4915d38 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:56:05.5018 (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: JSOlHFOUk/l9UU8HplkzvgH8xnCGWZirdz5bvniZ4aB/J4n1gTdKfFL6PzJohkOkKgVt1aewDQG8AhD3aI/sWg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR08MB4896 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Each call to device/fwnode_get_named_child_node() must be matched with a call to fwnode_handle_put() once the corresponding node is no longer in use. This ensures a reference count remains balanced in the case of dynamic device tree support. Currently, the driver never calls fwnode_handle_put(). Solve this problem by moving the node handling from iqs7222_parse_props() to the new iqs7222_parse_reg_grp(), leaving the former to do nothing but parse properties. The latter then manages the reference count in a single location and consistent fashion. This change drastically simplifies iqs7222_parse_all(), which can then call iqs7222_parse_reg_grp() on every register group without having to treat each register group differently. For nested event nodes, common parsing code has been factored out to the new iqs7222_parse_event() so as to allow the event node to be dropped from as few locations as possible. As part of this refactor, the 'linux,code' property has been made optional. This enables applications that define an event with the sole purpose of enabling a GPIO. Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Reviewed-by: Mattijs Korpershoek --- Changes in v3: - Updated iqs7222_parse_reg_grp() to call iqs7222_parse_props() for all register groups in order to drop the same call from every instance of iqs7222_parse_extra() - Out of an abundance of caution, opted to drop previous Reviewed-by as the change was non-trivial Changes in v2: - Created new iqs7222_parse_reg_grp() and iqs7222_parse_event() helpers to prevent multiple goto statements and calls to fwnode_handle_put() - Updated commit message drivers/input/misc/iqs7222.c | 340 +++++++++++++++-------------------- 1 file changed, 146 insertions(+), 194 deletions(-) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index ddb863bf63ee..ca02fea9be59 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -105,14 +105,14 @@ enum iqs7222_reg_grp_id { IQS7222_NUM_REG_GRPS }; -static const char * const iqs7222_reg_grp_names[] = { +static const char * const iqs7222_reg_grp_names[IQS7222_NUM_REG_GRPS] = { [IQS7222_REG_GRP_CYCLE] = "cycle", [IQS7222_REG_GRP_CHAN] = "channel", [IQS7222_REG_GRP_SLDR] = "slider", [IQS7222_REG_GRP_GPIO] = "gpio", }; -static const unsigned int iqs7222_max_cols[] = { +static const unsigned int iqs7222_max_cols[IQS7222_NUM_REG_GRPS] = { [IQS7222_REG_GRP_STAT] = IQS7222_MAX_COLS_STAT, [IQS7222_REG_GRP_CYCLE] = IQS7222_MAX_COLS_CYCLE, [IQS7222_REG_GRP_GLBL] = IQS7222_MAX_COLS_GLBL, @@ -1567,56 +1567,17 @@ static int iqs7222_gpio_select(struct iqs7222_private *iqs7222, } static int iqs7222_parse_props(struct iqs7222_private *iqs7222, - struct fwnode_handle **child_node, - int child_index, + struct fwnode_handle *reg_grp_node, + int reg_grp_index, enum iqs7222_reg_grp_id reg_grp, enum iqs7222_reg_key_id reg_key) { - u16 *setup = iqs7222_setup(iqs7222, reg_grp, child_index); + u16 *setup = iqs7222_setup(iqs7222, reg_grp, reg_grp_index); struct i2c_client *client = iqs7222->client; - struct fwnode_handle *reg_grp_node; - char reg_grp_name[16]; int i; - switch (reg_grp) { - case IQS7222_REG_GRP_CYCLE: - case IQS7222_REG_GRP_CHAN: - case IQS7222_REG_GRP_SLDR: - case IQS7222_REG_GRP_GPIO: - case IQS7222_REG_GRP_BTN: - /* - * These groups derive a child node and return it to the caller - * for additional group-specific processing. In some cases, the - * child node may have already been derived. - */ - reg_grp_node = *child_node; - if (reg_grp_node) - break; - - snprintf(reg_grp_name, sizeof(reg_grp_name), "%s-%d", - iqs7222_reg_grp_names[reg_grp], child_index); - - reg_grp_node = device_get_named_child_node(&client->dev, - reg_grp_name); - if (!reg_grp_node) - return 0; - - *child_node = reg_grp_node; - break; - - case IQS7222_REG_GRP_GLBL: - case IQS7222_REG_GRP_FILT: - case IQS7222_REG_GRP_SYS: - /* - * These groups are not organized beneath a child node, nor are - * they subject to any additional processing by the caller. - */ - reg_grp_node = dev_fwnode(&client->dev); - break; - - default: - return -EINVAL; - } + if (!setup) + return 0; for (i = 0; i < ARRAY_SIZE(iqs7222_props); i++) { const char *name = iqs7222_props[i].name; @@ -1686,11 +1647,66 @@ static int iqs7222_parse_props(struct iqs7222_private *iqs7222, return 0; } -static int iqs7222_parse_cycle(struct iqs7222_private *iqs7222, int cycle_index) +static int iqs7222_parse_event(struct iqs7222_private *iqs7222, + struct fwnode_handle *event_node, + int reg_grp_index, + enum iqs7222_reg_grp_id reg_grp, + enum iqs7222_reg_key_id reg_key, + u16 event_enable, u16 event_link, + unsigned int *event_type, + unsigned int *event_code) +{ + struct i2c_client *client = iqs7222->client; + int error; + + error = iqs7222_parse_props(iqs7222, event_node, reg_grp_index, + reg_grp, reg_key); + if (error) + return error; + + error = iqs7222_gpio_select(iqs7222, event_node, event_enable, + event_link); + if (error) + return error; + + error = fwnode_property_read_u32(event_node, "linux,code", event_code); + if (error == -EINVAL) { + return 0; + } else if (error) { + dev_err(&client->dev, "Failed to read %s code: %d\n", + fwnode_get_name(event_node), error); + return error; + } + + if (!event_type) { + input_set_capability(iqs7222->keypad, EV_KEY, *event_code); + return 0; + } + + error = fwnode_property_read_u32(event_node, "linux,input-type", + event_type); + if (error == -EINVAL) { + *event_type = EV_KEY; + } else if (error) { + dev_err(&client->dev, "Failed to read %s input type: %d\n", + fwnode_get_name(event_node), error); + return error; + } else if (*event_type != EV_KEY && *event_type != EV_SW) { + dev_err(&client->dev, "Invalid %s input type: %d\n", + fwnode_get_name(event_node), *event_type); + return -EINVAL; + } + + input_set_capability(iqs7222->keypad, *event_type, *event_code); + + return 0; +} + +static int iqs7222_parse_cycle(struct iqs7222_private *iqs7222, + struct fwnode_handle *cycle_node, int cycle_index) { u16 *cycle_setup = iqs7222->cycle_setup[cycle_index]; struct i2c_client *client = iqs7222->client; - struct fwnode_handle *cycle_node = NULL; unsigned int pins[9]; int error, count, i; @@ -1698,17 +1714,7 @@ static int iqs7222_parse_cycle(struct iqs7222_private *iqs7222, int cycle_index) * Each channel shares a cycle with one other channel; the mapping of * channels to cycles is fixed. Properties defined for a cycle impact * both channels tied to the cycle. - */ - error = iqs7222_parse_props(iqs7222, &cycle_node, cycle_index, - IQS7222_REG_GRP_CYCLE, - IQS7222_REG_KEY_NONE); - if (error) - return error; - - if (!cycle_node) - return 0; - - /* + * * Unlike channels which are restricted to a select range of CRx pins * based on channel number, any cycle can claim any of the device's 9 * CTx pins (CTx0-8). @@ -1750,11 +1756,11 @@ static int iqs7222_parse_cycle(struct iqs7222_private *iqs7222, int cycle_index) return 0; } -static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, int chan_index) +static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, + struct fwnode_handle *chan_node, int chan_index) { const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; struct i2c_client *client = iqs7222->client; - struct fwnode_handle *chan_node = NULL; int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; int ext_chan = rounddown(num_chan, 10); int error, i; @@ -1762,15 +1768,6 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, int chan_index) u16 *sys_setup = iqs7222->sys_setup; unsigned int val; - error = iqs7222_parse_props(iqs7222, &chan_node, chan_index, - IQS7222_REG_GRP_CHAN, - IQS7222_REG_KEY_NONE); - if (error) - return error; - - if (!chan_node) - return 0; - if (dev_desc->allow_offset && fwnode_property_present(chan_node, "azoteq,ulp-allow")) sys_setup[dev_desc->allow_offset] &= ~BIT(chan_index); @@ -1892,18 +1889,6 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, int chan_index) if (!event_node) continue; - error = iqs7222_parse_props(iqs7222, &event_node, chan_index, - IQS7222_REG_GRP_BTN, - iqs7222_kp_events[i].reg_key); - if (error) - return error; - - error = iqs7222_gpio_select(iqs7222, event_node, - BIT(chan_index), - dev_desc->touch_link - (i ? 0 : 2)); - if (error) - return error; - if (!fwnode_property_read_u32(event_node, "azoteq,timeout-press-ms", &val)) { @@ -1919,7 +1904,8 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, int chan_index) if (val > U8_MAX * 500) { dev_err(&client->dev, "Invalid %s press timeout: %u\n", - fwnode_get_name(chan_node), val); + fwnode_get_name(event_node), val); + fwnode_handle_put(event_node); return -EINVAL; } @@ -1927,49 +1913,16 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, int chan_index) *setup |= (val / 500 << i * 8); } - error = fwnode_property_read_u32(event_node, "linux,code", - &val); - if (error) { - dev_err(&client->dev, "Failed to read %s code: %d\n", - fwnode_get_name(chan_node), error); + error = iqs7222_parse_event(iqs7222, event_node, chan_index, + IQS7222_REG_GRP_BTN, + iqs7222_kp_events[i].reg_key, + BIT(chan_index), + dev_desc->touch_link - (i ? 0 : 2), + &iqs7222->kp_type[chan_index][i], + &iqs7222->kp_code[chan_index][i]); + fwnode_handle_put(event_node); + if (error) return error; - } - - iqs7222->kp_code[chan_index][i] = val; - iqs7222->kp_type[chan_index][i] = EV_KEY; - - if (fwnode_property_present(event_node, "linux,input-type")) { - error = fwnode_property_read_u32(event_node, - "linux,input-type", - &val); - if (error) { - dev_err(&client->dev, - "Failed to read %s input type: %d\n", - fwnode_get_name(chan_node), error); - return error; - } - - if (val != EV_KEY && val != EV_SW) { - dev_err(&client->dev, - "Invalid %s input type: %u\n", - fwnode_get_name(chan_node), val); - return -EINVAL; - } - - iqs7222->kp_type[chan_index][i] = val; - } - - /* - * Reference channels can opt out of event reporting by using - * KEY_RESERVED in place of a true key or switch code. - */ - if (iqs7222->kp_type[chan_index][i] == EV_KEY && - iqs7222->kp_code[chan_index][i] == KEY_RESERVED) - continue; - - input_set_capability(iqs7222->keypad, - iqs7222->kp_type[chan_index][i], - iqs7222->kp_code[chan_index][i]); if (!dev_desc->event_offset) continue; @@ -1981,16 +1934,16 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, int chan_index) * The following call handles a special pair of properties that apply * to a channel node, but reside within the button (event) group. */ - return iqs7222_parse_props(iqs7222, &chan_node, chan_index, + return iqs7222_parse_props(iqs7222, chan_node, chan_index, IQS7222_REG_GRP_BTN, IQS7222_REG_KEY_DEBOUNCE); } -static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, int sldr_index) +static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, + struct fwnode_handle *sldr_node, int sldr_index) { const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; struct i2c_client *client = iqs7222->client; - struct fwnode_handle *sldr_node = NULL; int num_chan = dev_desc->reg_grps[IQS7222_REG_GRP_CHAN].num_row; int ext_chan = rounddown(num_chan, 10); int count, error, reg_offset, i; @@ -1998,15 +1951,6 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, int sldr_index) u16 *sldr_setup = iqs7222->sldr_setup[sldr_index]; unsigned int chan_sel[4], val; - error = iqs7222_parse_props(iqs7222, &sldr_node, sldr_index, - IQS7222_REG_GRP_SLDR, - IQS7222_REG_KEY_NONE); - if (error) - return error; - - if (!sldr_node) - return 0; - /* * Each slider can be spread across 3 to 4 channels. It is possible to * select only 2 channels, but doing so prevents the slider from using @@ -2130,46 +2074,37 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, int sldr_index) for (i = 0; i < ARRAY_SIZE(iqs7222_sl_events); i++) { const char *event_name = iqs7222_sl_events[i].name; struct fwnode_handle *event_node; + enum iqs7222_reg_key_id reg_key; event_node = fwnode_get_named_child_node(sldr_node, event_name); if (!event_node) continue; - error = iqs7222_parse_props(iqs7222, &event_node, sldr_index, - IQS7222_REG_GRP_SLDR, - reg_offset ? - IQS7222_REG_KEY_RESERVED : - iqs7222_sl_events[i].reg_key); - if (error) - return error; + if (reg_offset) + reg_key = IQS7222_REG_KEY_RESERVED; + else + reg_key = iqs7222_sl_events[i].reg_key; /* * The press/release event does not expose a direct GPIO link, * but one can be emulated by tying each of the participating * channels to the same GPIO. */ - error = iqs7222_gpio_select(iqs7222, event_node, + error = iqs7222_parse_event(iqs7222, event_node, sldr_index, + IQS7222_REG_GRP_SLDR, reg_key, i ? iqs7222_sl_events[i].enable : sldr_setup[3 + reg_offset], i ? 1568 + sldr_index * 30 - : sldr_setup[4 + reg_offset]); + : sldr_setup[4 + reg_offset], + NULL, + &iqs7222->sl_code[sldr_index][i]); + fwnode_handle_put(event_node); if (error) return error; if (!reg_offset) sldr_setup[9] |= iqs7222_sl_events[i].enable; - error = fwnode_property_read_u32(event_node, "linux,code", - &val); - if (error) { - dev_err(&client->dev, "Failed to read %s code: %d\n", - fwnode_get_name(sldr_node), error); - return error; - } - - iqs7222->sl_code[sldr_index][i] = val; - input_set_capability(iqs7222->keypad, EV_KEY, val); - if (!dev_desc->event_offset) continue; @@ -2190,19 +2125,63 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, int sldr_index) * The following call handles a special pair of properties that shift * to make room for a wheel enable control in the case of IQS7222C. */ - return iqs7222_parse_props(iqs7222, &sldr_node, sldr_index, + return iqs7222_parse_props(iqs7222, sldr_node, sldr_index, IQS7222_REG_GRP_SLDR, dev_desc->wheel_enable ? IQS7222_REG_KEY_WHEEL : IQS7222_REG_KEY_NO_WHEEL); } +static int (*iqs7222_parse_extra[IQS7222_NUM_REG_GRPS]) + (struct iqs7222_private *iqs7222, + struct fwnode_handle *reg_grp_node, + int reg_grp_index) = { + [IQS7222_REG_GRP_CYCLE] = iqs7222_parse_cycle, + [IQS7222_REG_GRP_CHAN] = iqs7222_parse_chan, + [IQS7222_REG_GRP_SLDR] = iqs7222_parse_sldr, +}; + +static int iqs7222_parse_reg_grp(struct iqs7222_private *iqs7222, + enum iqs7222_reg_grp_id reg_grp, + int reg_grp_index) +{ + struct i2c_client *client = iqs7222->client; + struct fwnode_handle *reg_grp_node; + int error; + + if (iqs7222_reg_grp_names[reg_grp]) { + char reg_grp_name[16]; + + snprintf(reg_grp_name, sizeof(reg_grp_name), "%s-%d", + iqs7222_reg_grp_names[reg_grp], reg_grp_index); + + reg_grp_node = device_get_named_child_node(&client->dev, + reg_grp_name); + } else { + reg_grp_node = fwnode_handle_get(dev_fwnode(&client->dev)); + } + + if (!reg_grp_node) + return 0; + + error = iqs7222_parse_props(iqs7222, reg_grp_node, reg_grp_index, + reg_grp, IQS7222_REG_KEY_NONE); + + if (!error && iqs7222_parse_extra[reg_grp]) + error = iqs7222_parse_extra[reg_grp](iqs7222, reg_grp_node, + reg_grp_index); + + fwnode_handle_put(reg_grp_node); + + return error; +} + static int iqs7222_parse_all(struct iqs7222_private *iqs7222) { const struct iqs7222_dev_desc *dev_desc = iqs7222->dev_desc; const struct iqs7222_reg_grp_desc *reg_grps = dev_desc->reg_grps; u16 *sys_setup = iqs7222->sys_setup; - int error, i; + int error, i, j; if (dev_desc->allow_offset) sys_setup[dev_desc->allow_offset] = U16_MAX; @@ -2210,32 +2189,13 @@ static int iqs7222_parse_all(struct iqs7222_private *iqs7222) if (dev_desc->event_offset) sys_setup[dev_desc->event_offset] = IQS7222_EVENT_MASK_ATI; - for (i = 0; i < reg_grps[IQS7222_REG_GRP_CYCLE].num_row; i++) { - error = iqs7222_parse_cycle(iqs7222, i); - if (error) - return error; - } - - error = iqs7222_parse_props(iqs7222, NULL, 0, IQS7222_REG_GRP_GLBL, - IQS7222_REG_KEY_NONE); - if (error) - return error; - for (i = 0; i < reg_grps[IQS7222_REG_GRP_GPIO].num_row; i++) { - struct fwnode_handle *gpio_node = NULL; u16 *gpio_setup = iqs7222->gpio_setup[i]; - int j; gpio_setup[0] &= ~IQS7222_GPIO_SETUP_0_GPIO_EN; gpio_setup[1] = 0; gpio_setup[2] = 0; - error = iqs7222_parse_props(iqs7222, &gpio_node, i, - IQS7222_REG_GRP_GPIO, - IQS7222_REG_KEY_NONE); - if (error) - return error; - if (reg_grps[IQS7222_REG_GRP_GPIO].num_row == 1) continue; @@ -2258,29 +2218,21 @@ static int iqs7222_parse_all(struct iqs7222_private *iqs7222) chan_setup[5] = 0; } - for (i = 0; i < reg_grps[IQS7222_REG_GRP_CHAN].num_row; i++) { - error = iqs7222_parse_chan(iqs7222, i); - if (error) - return error; - } - - error = iqs7222_parse_props(iqs7222, NULL, 0, IQS7222_REG_GRP_FILT, - IQS7222_REG_KEY_NONE); - if (error) - return error; - for (i = 0; i < reg_grps[IQS7222_REG_GRP_SLDR].num_row; i++) { u16 *sldr_setup = iqs7222->sldr_setup[i]; sldr_setup[0] &= ~IQS7222_SLDR_SETUP_0_CHAN_CNT_MASK; + } - error = iqs7222_parse_sldr(iqs7222, i); - if (error) - return error; + for (i = 0; i < IQS7222_NUM_REG_GRPS; i++) { + for (j = 0; j < reg_grps[i].num_row; j++) { + error = iqs7222_parse_reg_grp(iqs7222, i, j); + if (error) + return error; + } } - return iqs7222_parse_props(iqs7222, NULL, 0, IQS7222_REG_GRP_SYS, - IQS7222_REG_KEY_NONE); + return 0; } static int iqs7222_report(struct iqs7222_private *iqs7222) From patchwork Sun Oct 23 00:56:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 618482 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 2AB12C04A95 for ; Sun, 23 Oct 2022 00:56:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229956AbiJWA43 (ORCPT ); Sat, 22 Oct 2022 20:56:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbiJWA42 (ORCPT ); Sat, 22 Oct 2022 20:56:28 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2072.outbound.protection.outlook.com [40.107.101.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30B416F243; Sat, 22 Oct 2022 17:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gmZwvesRQNrol+PdKnFxENMQ2zdP+e03HSgZK/Fdi70OBsw44z0iQs4GwX5412+IvHumNzS24aqVaom8esx5QFb+mN3Q+ds2UMqZUg1/fkuZFgKzxBYrOVM3SiMqgI3MTmOCIlmhQ9P/PCzyt+uDQlgi3kU1ypFdja3PPMv2+wwfNLU9+9cQQAz0DDow189asnJ0jWi8F/PMC6BAZZncukmnUOsCFUCt1ndFwW8P+w5aYGfWDd7jXcT20jUy8TsyU0YL/yrQ+ZQpi2tkGdU2Qb9C90NqEFy8X+GGDnOHH/fuNdGxCWJKGlfKxtYNTUOB0kuLCe/wr9QTOUfyyilp2Q== 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=M0ZocgFFw2B2Fw/swof05fVIq40q/ekasECq3+VYjiQ=; b=cxq0thyH85VxUJNF4L6iTEsMT92nIhY9h051pDfSpsVJhmC38fwcE2gmjLvbKCXiTMYZcwqNRIKPt71+qfuPMgbQqYaHddIgMggQimhJSDBrjK9lTG7TAdhdmtDekbdCksvKNe+5hAqiq5oLD/qn9BXS4yyh9297Hj8GrPjIZ3hdUAtOddps6GJVnStONNhaeGuZX4qwgagPSGyaVqhidxhAN1ovy2dFtM0L46kGHq4lsPnf5BOGif9kn/mT0GhQyLNFYKm68ezAY0Q9/Uhc1GyzDDkUi3MQrKYc92BiuWa8DuQnp2o5e4sdn3jCCm1xsuE3D7vujAX/7d4HGJpbKA== 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=M0ZocgFFw2B2Fw/swof05fVIq40q/ekasECq3+VYjiQ=; b=ZhmqrrsnWj8klzxv7e+1LRi8snP89/fuZ+OqO/HtU4a4yYXWqfZcHVSHeU1rDEucXb5Su9JWzM+cAQHiRpdR44aXyqqkxQYpZrWhCPNlnrEpzf7inY/HbTwhtg7Ra+2CPQPjpuAZR3O4cN0otXzeITvi7unrV5ms9IYwdIAIDGE= 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:56:26 +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:56:26 +0000 Date: Sat, 22 Oct 2022 19:56:24 -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 2/7] dt-bindings: input: iqs7222: Reduce 'linux,code' to optional Message-ID: Content-Disposition: inline In-Reply-To: Y1SQ2t6yUvdaIQPG@nixie71 References: Y1SQ2t6yUvdaIQPG@nixie71 X-ClientProxiedBy: DM6PR02CA0046.namprd02.prod.outlook.com (2603:10b6:5:177::23) 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: 25b723ec-55a8-4ddb-5de2-08dab4916981 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HWjSINy5nZH2981XP4D/yy10VWYm2QMx+w1XHJAl72dfj4kZAAq+/vS6P9vwfnhCq6K+Chi012VBJLicpkAIs2hTCxclj1cfFq16ObSeGtbCuE7DSB8s3BJ9rHhU3IyduKGx+93gNDwV26je7HxMnQFPhfVG8OxHypHIRu3oxsb55lMMigDyOEUKCBr+ACZy9h5d2H1xtT31gbuitXPUmBhFGmHcCIaHO7dFNzgMl+QjjPLrdmNiWWpKB0URvjxVXcK/9r1XEPzCRSFX8Ot9fkHkg6WGiZy7Ic1jY427Fkg0wAdg4vlhxfGJhUpQOmNGzSuZ2vdGSuv11bL0B7QsS3LHqg4CwyEvRdJwTcYrGaIWofayEbEGE06SI82NQfwjSwKLVVHiL7LNriMzCrkTuCX5esnXiQvUIdXVjH76lxD8DArXeY947CndND05eTaw2d7eJ6+uOUAe+qT/2tmzAVgjFOkCHwBF5OnJq+wMEE9bxxZAgIwUHP1gtEBPBjQqE0MknnmUsY0zxWexY+D9lmlTjGvnmHnOeSP6gQOTXYhYzC7rSSreQYf5yLN3Y14g1Vw6iV2VuOSJ+Qnojo4bgUezAxBGo2SKityRFUUsM1fyUdC01R8UK++tjQaAtZD/UoFmXUdUYK/1H4ZiYwVwxmemZNx5BUdpt6WwoeIcZLuXq4oB66vwpTdx8Mkja+BlEZ6MA1zSSYtEcaD1eYj4Lg== 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)(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: veGZPDkhQI1OSHjgUpiI9A19l8bNsI9GpzfOry2nCzS7U6C5VmNc6VWV9o64eyn9ghO1Wjvwks5qmrQOfglZdZy14Dng8uxSymdxiH7+ne+EV8PfDL5yms2EidIZNws/JOmxsJKstIAHQjYtsZ48sQJrjVYRfd5KofbG8fvGCqBW+fVKlw/Ld0hg/rj+lBu3a1DWAKGW4l4tAplBvNW3p600UcywhnnaLHJRXfS6tAldYSxEKb1l4DirVl5NZ/Y+fF2QPsm2mA38mBvx8rDuBNWIv1SFYjZ1FsXaRcYnQBI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lmTKkRPovEcpcTS54ODf3ktUoVUfBBl3GlU1wrzNxzJabhL49EohKcNFaEA9irqFcQgi3orQgJqcTUubmYNIoWu9R7YRmGADTKnOdaCqNpWVsrlpfS1XGad5bA9hUbRIQNa3iaDjO3APIbocamTCS92SsFUzQG+5+fk5aPSR+PmCtctLAloZ4p772U7ICJICQqd1vHI87B40iRxplCltfmrIbPS1hdZP03HmG0ElbgGlLA++ X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 25b723ec-55a8-4ddb-5de2-08dab4916981 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:56:26.0783 (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: gGGUw753FH/d8JU2gIL/mU0a74BgLT5VqDt0JefWANnRLardaoL97obTVoS7CEskTXpksHbVYSphLsSOuu4YdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR08MB4896 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Following a recent refactor of the driver to properly drop unused device nodes, the 'linux,code' property is now optional. This can be useful for applications that define GPIO-mapped events that do not correspond to any keycode. Fixes: 44dc42d254bf ("dt-bindings: input: Add bindings for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Reviewed-by: Rob Herring --- Changes in v3: - Added Reviewed-by Changes in v2: - Updated commit message Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml b/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml index 02e605fac408..b4eb650dbcb8 100644 --- a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +++ b/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml @@ -473,9 +473,6 @@ patternProperties: Specifies whether the event is to be interpreted as a key (1) or a switch (5). - required: - - linux,code - additionalProperties: false dependencies: @@ -620,9 +617,6 @@ patternProperties: GPIO, they must all be of the same type (proximity, touch or slider gesture). - required: - - linux,code - additionalProperties: false required: From patchwork Sun Oct 23 00:56:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 617699 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 7EAD1C04A95 for ; Sun, 23 Oct 2022 00:56:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229967AbiJWA4m (ORCPT ); Sat, 22 Oct 2022 20:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbiJWA4m (ORCPT ); Sat, 22 Oct 2022 20:56:42 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2055.outbound.protection.outlook.com [40.107.101.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5AE56FC48; Sat, 22 Oct 2022 17:56:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=asDnbDMxVf3yEp59TALqztvGuoDQF6yMeFdJzcBtautpYW6obQ+hPshUHOUCoP5sCdMlFSu0cWt7cHHiA2vbbcyVAqRgXej5TLI3wvJr/oW85hJsduWzc1jf+0f+4JKSTG6eRVAf5UpXuAFWqbRBZti8I+wYbUY0fWHBPrj5v/l2wjvbVQlxysMfcAfXC7zHlEVHJ52BZ+7eNxhcg/yDm/mCH8jvANFiyT0Qtqs5XRBwcwqjoSLMxXJhfo25m6qTavSr0JaHXDc17G/Z6gBhaAW3OzJpMSnMgoIuNosx5Tx2NSdfsUmM2g1bLCkevABgUJaRfC1C7+VK/3rA/G9U3Q== 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=OlqgKOB8aNVo5fNMNN74kblYaAtlgWRCsTRYWo6EN6A=; b=MsfHrzhOBZwgCKQFzVMYaihq+gyH4wATvvU19RnxImJbaDuDtpUm1y++yIzaTA7lL1VFP9qeNfTmacjNbnklnovTmZ9MQjYCFQgvj6QMO3Px1I+VKVrG696nLa/gUuDGGVrzDyuuZp+ds3MXCQRWHFQk6CxiPvEFO+JHT3d93GJIq39ovp03Dd/6Sq0I4/ftvPomcLdRXKRsaCTX+OAL9QxKGpH8Mfu44k1HY4lNJrf+Mpvr+dRdP+GT1l3RMFEeAZYNVs66XL/tXFLq+9gzXGminix7HTRWTuhnth2aGbOODRxBG+h590GqRsBRgtPpdV33xMTx+QtLrhLccPDQ0g== 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=OlqgKOB8aNVo5fNMNN74kblYaAtlgWRCsTRYWo6EN6A=; b=r7+rE9fE+9J1EHsO8zoj7GDBJZ2yvT4xNaeLYRZn7X4SmUjusl5FSwoEZF+iQKcgjPpBIgwxsLchJiZcj7ai9uanEO/m8yUZPMRH+59Qc3euCNS80e+FDU3csEgn+/kH80yT4mXOtfcvFVzuf9d8K+rLTytKIHd9Bjq2fx3Cuo0= 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:56:39 +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:56:39 +0000 Date: Sat, 22 Oct 2022 19:56:38 -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 3/7] Input: iqs7222 - report malformed properties Message-ID: Content-Disposition: inline In-Reply-To: Y1SQ2t6yUvdaIQPG@nixie71 References: Y1SQ2t6yUvdaIQPG@nixie71 X-ClientProxiedBy: SN7PR04CA0101.namprd04.prod.outlook.com (2603:10b6:806:122::16) 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: 91fb898f-0e37-43a9-4d4a-08dab4917175 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LhlWnLHnE5qYlW0RcHbsxsqr89aZc+RvO+ncPy7JAEEv5J8YRtgIyskxJvi/NnkQcAMDW7mt9b4z8O/xyZphd3srrZJFhc7+i+qzURoncTsAmNsHR0hRmkYoIxZ+FyYYcPydqxqetAbD/oNyWaqCLdN2rHTKCpp5KGqlhQdAesr9DAQX81UH8g/TCX0JgeykL/g54i77k3I4igEycxgBdruXs1VQ726W+H7vpPFw9q1rEGBvzLy1Sf16YOPTjXvQq5W5elaKmk4ai7L6tFORFjjEOaeWww+s2ydCYhujkmcIqznTqL8HtwnL4XwgVk97IhlGE6+uHTyhhY19gX69tBLunheIo31t26tkn96lznLNau92PMkD5AItNPQ9+kbEIbVNdIRPsKg/Fo469poRCDK9iHvlK0AHj5+Eo9P71ypz8d45+Ecwv3DoseznK9KyiT6H6+GIFFmhHCq55ipw7kv/tIGwaVHYPjGOm+6+yNgrkOP3yHvcYpZIKHmrijNtdkktkL165HRfy7pwLB0v1nNNi4VM7zTJi9TlXUjTN3HTpBpA0nvthX1svoXR6x7WYOHpEGjPdY8Zq3NpRIIkauwX+Hdyo8LV2Q6UVCvmhjkD6dE6JvAkGW8K4X5wrL9p9D7z1a9SBz0P/bTsBs0ZMf+jo2DIAXxkk0mZmB+kpK+q9erTBrlO1bmaXHbnP0u3VBgvh4CIu1XZedYFXe1kGA== 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)(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: GPan9Ks/H2L7F224EFU5+pAI4eCz50Kzvrkxuhfr9Pc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yA4Avpb0PwgtWOcMyIyhHaRVggt7Z58WM14TQnKIqJwAUT1OyMtMM7dUbRHYVOF5Kyl+90PgDUWBev2eX7jR9wzZgTuJfHGvL5aKh/53Qyx0Shq1kcqXAAJLH3PRAjpdUkhJpeppd7zHQUyO5AJhtBFmIWv7fj/b0yLAjZTP8EJad09TEeyOoaCW2r5yh/AbteiMvtwSI9aM+OG3JAHSANpx2tD1EW8pYikA9kjFEES90+c13suMulDus+qkwiWGtB09W1pzQESSx4k87kCvj5kFmk48VdRKrOtqm0cbtKST1wOfzBt9oLLTdRZErjx4IPEhz9TN4CCVGcWiBJDJVRC6Xbrtp2zSMiTec4UlfEi0FgrjpvKYSsN8/xOZm2fgByA86jLmRMhkEU18raFGYTbR2wCJQtqXUBpCeqnOaRj8VVSs00MCwaKyCcpq7XXwV5RTB6HoXv7tZWN03Yz9eo2lHgWbH1+wkEN X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91fb898f-0e37-43a9-4d4a-08dab4917175 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:56:39.4054 (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: CoJelbemc1gnKpHiPTF4WYtqDdNHzbMkG5rVHdMEaXFs1vrTqnIrqTi+9ZBlBVyBK93422xP2BxKTMkP2L2gog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR08MB4896 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Nonzero return values of several calls to fwnode_property_read_u32() are silently ignored, leaving no way to know the properties were not applied in the event of an error. Solve this problem by evaluating fwnode_property_read_u32()'s return value, and reporting an error for any nonzero return value not equal to -EINVAL which indicates the property was absent altogether. Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Reviewed-by: Mattijs Korpershoek --- Changes in v3: - Added missing call to fwnode_handle_put() - Added Reviewed-by Changes in v2: - Used -EINVAL returned by fwnode_property_read_u32() to indicate an absent optional property as opposed to calling fwnode_property_present() - Updated commit message drivers/input/misc/iqs7222.c | 44 +++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index ca02fea9be59..a5c08b1d9c9b 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -1807,8 +1807,9 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, chan_setup[0] |= IQS7222_CHAN_SETUP_0_REF_MODE_FOLLOW; chan_setup[4] = val * 42 + 1048; - if (!fwnode_property_read_u32(chan_node, "azoteq,ref-weight", - &val)) { + error = fwnode_property_read_u32(chan_node, "azoteq,ref-weight", + &val); + if (!error) { if (val > U16_MAX) { dev_err(&client->dev, "Invalid %s reference weight: %u\n", @@ -1817,6 +1818,11 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, } chan_setup[5] = val; + } else if (error != -EINVAL) { + dev_err(&client->dev, + "Failed to read %s reference weight: %d\n", + fwnode_get_name(chan_node), error); + return error; } /* @@ -1889,9 +1895,10 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, if (!event_node) continue; - if (!fwnode_property_read_u32(event_node, - "azoteq,timeout-press-ms", - &val)) { + error = fwnode_property_read_u32(event_node, + "azoteq,timeout-press-ms", + &val); + if (!error) { /* * The IQS7222B employs a global pair of press timeout * registers as opposed to channel-specific registers. @@ -1911,6 +1918,12 @@ static int iqs7222_parse_chan(struct iqs7222_private *iqs7222, *setup &= ~(U8_MAX << i * 8); *setup |= (val / 500 << i * 8); + } else if (error != -EINVAL) { + dev_err(&client->dev, + "Failed to read %s press timeout: %d\n", + fwnode_get_name(event_node), error); + fwnode_handle_put(event_node); + return error; } error = iqs7222_parse_event(iqs7222, event_node, chan_index, @@ -2009,7 +2022,8 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, if (fwnode_property_present(sldr_node, "azoteq,use-prox")) sldr_setup[4 + reg_offset] -= 2; - if (!fwnode_property_read_u32(sldr_node, "azoteq,slider-size", &val)) { + error = fwnode_property_read_u32(sldr_node, "azoteq,slider-size", &val); + if (!error) { if (!val || val > dev_desc->sldr_res) { dev_err(&client->dev, "Invalid %s size: %u\n", fwnode_get_name(sldr_node), val); @@ -2023,9 +2037,14 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, sldr_setup[2] |= (val / 16 << IQS7222_SLDR_SETUP_2_RES_SHIFT); } + } else if (error != -EINVAL) { + dev_err(&client->dev, "Failed to read %s size: %d\n", + fwnode_get_name(sldr_node), error); + return error; } - if (!fwnode_property_read_u32(sldr_node, "azoteq,top-speed", &val)) { + error = fwnode_property_read_u32(sldr_node, "azoteq,top-speed", &val); + if (!error) { if (val > (reg_offset ? U16_MAX : U8_MAX * 4)) { dev_err(&client->dev, "Invalid %s top speed: %u\n", fwnode_get_name(sldr_node), val); @@ -2038,9 +2057,14 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, sldr_setup[2] &= ~IQS7222_SLDR_SETUP_2_TOP_SPEED_MASK; sldr_setup[2] |= (val / 4); } + } else if (error != -EINVAL) { + dev_err(&client->dev, "Failed to read %s top speed: %d\n", + fwnode_get_name(sldr_node), error); + return error; } - if (!fwnode_property_read_u32(sldr_node, "linux,axis", &val)) { + error = fwnode_property_read_u32(sldr_node, "linux,axis", &val); + if (!error) { u16 sldr_max = sldr_setup[3] - 1; if (!reg_offset) { @@ -2054,6 +2078,10 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, input_set_abs_params(iqs7222->keypad, val, 0, sldr_max, 0, 0); iqs7222->sl_axis[sldr_index] = val; + } else if (error != -EINVAL) { + dev_err(&client->dev, "Failed to read %s axis: %d\n", + fwnode_get_name(sldr_node), error); + return error; } if (dev_desc->wheel_enable) { From patchwork Sun Oct 23 00:56:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 618481 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 D832AC433FE for ; Sun, 23 Oct 2022 00:56:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbiJWA46 (ORCPT ); Sat, 22 Oct 2022 20:56:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbiJWA45 (ORCPT ); Sat, 22 Oct 2022 20:56:57 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2045.outbound.protection.outlook.com [40.107.101.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2F916FC53; Sat, 22 Oct 2022 17:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LG/EntL/dh3fZurqQucP9Vg+Lp+TMyILiKrSO0SYMbOXDOr/BKc+NhIplvqzec+F+EMMaZNaENrm+EPDpTCXIdsMtBGESn4z5BikvcjRfvTioTqjc3R2RbAvYBn2L4w1uW5ieNctzPWeuhBnQlBpEoART0ryl/1S72YvlqGRpLidR9ovgd+xYOQyuPffmkH58wcnlGzZPERbxVVuVtN6iRxB03K/IIxySwG84t8AzGCr+SKe9eNXRLvmb3/DGXzsBwkwI8YWtDsc901dzN+dWBBtZoh7M5JCLm5LvoXerMy34TVsUJI4ZCwmMHSt6EnWJPfm3/duZg9Rsrbfp/wPMA== 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=Bv7ACRtHxLiqz2slFo425iQreJljEZ1CamuAqvbf7oo=; b=SWKHIgnZae5LblvTJ7v15HNiauXCKYHQSE8BpRKUectduDc+XVvv/DIBjBqFxHXZsBWF4eDsk1Pzayp1+XuRJXJYDZNqeLV8wM3uJcotB/5PShknRVtR49064quX49jnqEvH4S2qXo1SNIltxjM9stxZ6qhhbQpeebtHJyJkH5z77/7jl5RPfu1Qvl15ZQbm7FOV/KjITYIO7DE0DCkC7I9Pp4+8HwAXKPEvQI3KvQWRuv3b5/fbEiJN0FaBXaHm28RUZhOKsTH/S4DohDiL58wPY89igfm801486+DyJjzQUl5uimGbi52QCxcHTwfQJqDgls/O0UN6cNv1H6seIQ== 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=Bv7ACRtHxLiqz2slFo425iQreJljEZ1CamuAqvbf7oo=; b=rm7uqrn6liZkj/Im05EdZ/z4RGTKWK3QpqU5P0yfwOLP2lMdloJhfqDig70UtvH0ZY/N/PITa4iaH+UFO8KCPhaFRUxkRkoO9+DtKnTOwuL7dDButpry3UwsinsO16J76KhewTlXUImtx6HD9SBKexExRbJXDQq3Bku017f3FTM= 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:56:52 +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:56:52 +0000 Date: Sat, 22 Oct 2022 19:56:51 -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 4/7] dt-bindings: input: iqs7222: Correct minimum slider size Message-ID: Content-Disposition: inline In-Reply-To: Y1SQ2t6yUvdaIQPG@nixie71 References: Y1SQ2t6yUvdaIQPG@nixie71 X-ClientProxiedBy: SN6PR2101CA0004.namprd21.prod.outlook.com (2603:10b6:805:106::14) 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: 78643cfc-c656-45e0-2a30-08dab4917956 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wxbz1UasrEmTGXnkSwSIRGeaOppQhMdTpdnavWom+Pw6tkclAK3QQMn1kV8bHIPrL7/NH2S3zp4D+Q9nSWTPx2LQyZGajMckI2eTgnxFjeWdW56BB28rpdVU0Pmyks+fliJL2vUlVcIZ1HtcU0jaj905jmz5rd/fQqkWqq5ncS4KXLcOUjvCenQgDQJqrQYS7lhPAdgw45rqdG2yB+mGrf63nROwj9vBLkzEUOUXjeCkC2Poxmlbq/ZnyNgQLhJglmHwCndtcxOpLHchCWGJXws258aVQ6FtXHy/Fom2Y9sM5EPhaVKdmdrgYKygthUmp4Z1Q6vkuidc7cS0uW8TuKQr79sOiZFBkFpOoYjC8jEKklMYUqGQroj69hOBxW1WOAFY+aBcCwbgbUagsJBM5kIDjBNg7fZZ9BL5mvmhQ19xRFkA0Y3XwMqAdqDeNPXrbFTcu28s2m+eDt1AO4E7GiWmavi1rCBLE6v82L7rAgQibd30Y7Gqxmm+hft2pN61q0026vt9Io7f1Lm/2sXyrkgcP5eFao16U+6UTNtXkxqaE3Se0DtE9nUPjksxbJO9WOdt02tmzXQQKC2u4/GYOew1GnadBSC0VN43AWczJC2PJs4ZUh1kQWnQJgRrNagTmn31DURNItg9FA0vOuNEGkg8kVDna3yRFTsyhWaHxwEfjyn8ia8sTrRxCeD3cVG+6Gds5QSuaPkvf8OjgUEdeg== 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)(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: 4A3ZK/qRLr7zvDG9jpYBJl+gTH/t9c1UaKqz+OzMS3Js9QjKbDptr8rXqRC45F1ks3YRxH/9A6pBmovDJGVEegR1klEm2XX/4C2OwbX7EAbrh2fvM6uniHsCFi70YLsG0o6wQzKNvYUKvVUQmjRHicAKGZ6n5qeY8rajp0VD+nr3rX0/a9rm8Jjjuil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WJ5tHSP1ejEYeMk8k5iRf+VbkjksFKGZU6L/X0lkHUpFIxoieMXtvy4G5oFow8Lu+UeeuXiJdLfsxjBxQynWyvYLt4F+9PNvEl8qg85HghiZuzrPq0mMStOrif0z7zDg0SxQzK2MaLGdaD7TPeOg4qfodCyjK5C8i1dlr/kLZ1gjGzvlSO/cB9UD2pkeIVPYskV4mOyoOvvg/7atc4BdQKs6zN06V+P2f3X49uHtwtUg6ahNUZ0Tq041an+XXD+hnnLEJsEBm7eCjCDrIiZAbS2KhiP7+uxpxrWjpzm4gK1FsU64X/mDPN1B3r+NXgZhjyU1BtM85Fjl7PYFMh X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78643cfc-c656-45e0-2a30-08dab4917956 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:56:52.6231 (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: AOwkoAOrdgAAcZopG1a60x21rgpQ7nKumnnp8TM6gZTJ+OcmEbszmMT0kc1mrXQHSyUEzjUc/MSeU25lrcfUsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR08MB4896 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The minimum slider size enforced by the driver is 1 or 16 for the IQS7222C or IQS7222A, respectively. Fixes: 44dc42d254bf ("dt-bindings: input: Add bindings for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Acked-by: Rob Herring --- Changes in v3: - None Changes in v2: - Added Acked-by Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml b/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml index b4eb650dbcb8..913fd2da9862 100644 --- a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +++ b/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml @@ -498,7 +498,7 @@ patternProperties: azoteq,slider-size: $ref: /schemas/types.yaml#/definitions/uint32 - minimum: 0 + minimum: 1 maximum: 65535 description: Specifies the slider's one-dimensional resolution, equal to the @@ -687,6 +687,7 @@ allOf: properties: azoteq,slider-size: multipleOf: 16 + minimum: 16 maximum: 4080 azoteq,top-speed: From patchwork Sun Oct 23 00:57:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 617698 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 5224AECDFA1 for ; Sun, 23 Oct 2022 00:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229964AbiJWA5F (ORCPT ); Sat, 22 Oct 2022 20:57:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbiJWA5E (ORCPT ); Sat, 22 Oct 2022 20:57:04 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2077.outbound.protection.outlook.com [40.107.101.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E0DE6FC59; Sat, 22 Oct 2022 17:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OZksq9bMDBLlyPMot9WVw+sl1XdNwwiw09r+KwUCIs4iQFeNeUlEMNuTQObECl2nH03XcmantreteNjxbuxeLGTb1MJl4/QmFpui47FF66IMsrEIN9YTyxidbJ/oFO1hfSjsSdgKLQujR6nd5mKydQRhh8ZrOo/OI/RSDKJ3NLOeX62cdyeQNaV7H9ptBWYhqTalwgIuSq3poVWKBjY9/mPJWPZYzENe7E9yS4v6zPU+fpbxaJfI1yd8vjxnKJrXLvYkK9m5rKcw+p8fZi4glFHR7WELUvTvluRziJhlLbJV2UAtpIRYqm4rQ3ofkToYYEnuI2gI9Z7RQmPZkICe+g== 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=mXJ5SCYEVsgv+7MUmitiFrDln+lhibJDQg5dsOBMsUw=; b=IKu+rXzk4fcZ5/eE1Rb+2pMVUxs9fH7APn1YZDYZqDJTEy1AOrpBhq0Yp3EeKGQbSf9u1zk6H/knlfuc6ML39SCHSoVXNzrmAO1uYt0RjZHb/9TrAhCkTOrjld9lOld266NxjjEr9jOVWIf5a2MQq8vMbvCEDmO1tTcOTB3BEUXH2N7zvYaH3qZlIvyDd1JjHEF4uPGmSOGDI+EgaDcgYoVcYynLywMJBbh8WPwb2JJYLhmf664EQTTJrGRiE2wshtfRew70XRLhHI3EjIUvRuT3T5sFqAv2AwdjNoiegiacwgvvHc1wd/cWGBdwjPfxZyxL2/mfUC5WyDcbDdf7pw== 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=mXJ5SCYEVsgv+7MUmitiFrDln+lhibJDQg5dsOBMsUw=; b=tum//7xP7T8QNPel5juSrKq63iK5ymTRMmQfvG9c0klB4BuC8Vww69oM9Pm71BtjdxpdQusv+gxv7OwRWTfjBdfWBVqa70Z0cfP1tPY7fjpxD9zeBiWwYd4rOtdA9fZcUbUSNr7tBd8LkKP4B71ciq+T0f6g9VBHFPQs4hNMjtw= 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:02 +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:02 +0000 Date: Sat, 22 Oct 2022 19:57:00 -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 5/7] Input: iqs7222 - protect against undefined slider size Message-ID: Content-Disposition: inline In-Reply-To: Y1SQ2t6yUvdaIQPG@nixie71 References: Y1SQ2t6yUvdaIQPG@nixie71 X-ClientProxiedBy: SA0PR13CA0023.namprd13.prod.outlook.com (2603:10b6:806:130::28) 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: eb2f9ccb-eb15-4717-051b-08dab4917f02 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kG3tCFjYo3QKtDU2bGN05ZHjX/1mPN9asIXtiJlMefSHwrOXHrpSWVW57GPhmS8QC7dN7L74s7MlBF0NnYnPMMG25nwiDwACFYF/VsrqbvaHn8GS25Tz0pto3h5FLUbcnfSl4O3Ylgsn0d82gN9TSoZjMvIN9rebvntKAtel812sep5LDizkhqe2of+50ELpK5Q8/hAt7ilrO6AWX69Q3xhR2T2qQXVtBHm/8H70SfBtfAHRIQUkLgJGbsAMTSa6hsiOzHsNBjGx8SQ/b/uNCldm+rcKMP2KbK9YI4hg9PCyDHg9wFIWDHCrN36O+I7VQBA7rkicKhvCv5eNqa9fjWMW1QhPm6qhtnJd+yOcqBcsG8r2JGHb4b0xJw3UfQEsDJvtBxuNQkb/wuMypB0fEwYZSQTdpCZVD1Dsqu+eZZPEgmYlYCuH3+75FP//AbATUm8UF7tlY5XVNYTCckD2ubkdYgiEBE4n/sbGq9AJiqCbjWegHz2kchQQt8MnijGpPHpEeCGZGWm63AEEVONzuIfbbw5ez9xPi15XhhlsR3niB1gvvQBOkFdq902TcEzuN9Hm4hD+EvXDfqEYoIOemOGsJqXhLlB0Nm9T653xjYV4R0jeJQuxHEZbxVoX55jlNHuQhK91f3+ZNypV7+FKkzssj0z95XW0qBJJoW5w7m5cms+vckdqLMSsj3XvLGzG0V1aboG+UCUL7twf8YSw2Q== 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)(316002)(6486002)(107886003)(4326008)(8676002)(66556008)(66476007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ZAiCOqFyJIX09xuT89kJfFnrIkY4JAtoPieyf4LQbt0tvXg2pRWRb3nlKTTRc9Zflyyp9/3m/I3Ott2Ukvd5/u+PD2DU3MDeE/jZcQaof62lSN5WFiqq+F3SS5r4Bjzv7Os/KGn2SlUW9WQuHBflGCoBBZH++2k8Acoagz8mQBKYoHr0JdbUAM4SDAYh6s7rJS92SarUExc9JWyI1wP/u5uAiZMQGz7WhTIvu3inbRkauOkhVvVFRlqhpnyLwJ76M66aMa5qiT6v7yMxGX3UmnCXZzS5LWveZO2Ow6ZJuaFFOrJ3mnD4sbBUfew8WXwwPyvcv3Kxguf05P/EHfyY+DljvtFBvrpX3zioAki2wNH7dvVJBsmVhJdK7M9tpXXScAPNYtHe3IgB3lZiLSGZELxotcQ9A/F9G4MTuoypQzA6pHyxXBBCdIMiNb/7yu88T2DHGfQyxblzLJ9DhV0kRujdc9kWKQ/zBAbS6BHPF/c1PQKjMf4y2E19mlHGPdHj/Y/JjHy2FS8/FmFeTgXMHtwxeDpQOswo5U8nm7QO7SKjxESRpN8WqEwFa50usPAHcpGmcdsD0TPN6P2R7mFWbsgkIzgHpUfa X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb2f9ccb-eb15-4717-051b-08dab4917f02 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:02.1380 (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: cQm9LspkYXmfXlIX5tqw7Kuy9okIft8dmL9jrhw5e0DWEWvmi7PWbtMq+ymDUBDRGpSem+qE6owz9bbr5FJvsA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR08MB4896 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Select variants of silicon do not define a default slider size, in which case the size must be specified in the device tree. If it is not, the axis's maximum value is reported as 65535 due to unsigned integer overflow. To solve this problem, move the existing zero-check outside of the conditional block that checks whether the property is present. Fixes: e505edaedcb9 ("Input: add support for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Reviewed-by: Mattijs Korpershoek --- Changes in v3: - None Changes in v2: - Rebased to account for changes earlier in series drivers/input/misc/iqs7222.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index a5c08b1d9c9b..6af25dfd1d2a 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -2024,7 +2024,7 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, error = fwnode_property_read_u32(sldr_node, "azoteq,slider-size", &val); if (!error) { - if (!val || val > dev_desc->sldr_res) { + if (val > dev_desc->sldr_res) { dev_err(&client->dev, "Invalid %s size: %u\n", fwnode_get_name(sldr_node), val); return -EINVAL; @@ -2043,6 +2043,13 @@ static int iqs7222_parse_sldr(struct iqs7222_private *iqs7222, return error; } + if (!(reg_offset ? sldr_setup[3] + : sldr_setup[2] & IQS7222_SLDR_SETUP_2_RES_MASK)) { + dev_err(&client->dev, "Undefined %s size\n", + fwnode_get_name(sldr_node)); + return -EINVAL; + } + error = fwnode_property_read_u32(sldr_node, "azoteq,top-speed", &val); if (!error) { if (val > (reg_offset ? U16_MAX : U8_MAX * 4)) { From patchwork Sun Oct 23 00:57:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 618480 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 E0E96C04A95 for ; Sun, 23 Oct 2022 00:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229971AbiJWA5R (ORCPT ); Sat, 22 Oct 2022 20:57:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbiJWA5Q (ORCPT ); Sat, 22 Oct 2022 20:57:16 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2066.outbound.protection.outlook.com [40.107.101.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF3896FC59; Sat, 22 Oct 2022 17:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m2/cHnopfA9SAVaMOpVfeO6IjG5mG6MyF1KYs0a0Ua2UPzbC7zlJ6b9BMNYMVPImay432YLvKiJY8OsJ4/JFh0RNXveWARBqbjJ76FZwaY2tc5GS9dCKGubeD5+UBHj5jUggli6dVb+DBl+DBtFKN/IUbMZwKkmg2T0rYKk+K0SepUVL5fmpyoRr6krkBw5jjJUfPBs03q0FvqaNjkSJLQYzTH62fptdWf/hqnC5mXc4XWYfP3SHTbvQk9P807LqruzoZtN3MfgzLXzZzWmxjzpijVJ9LJccZis7yUXjA6LkyTGFifwKjFz+bNB2xBBQvRXpt0Z1I2I2+bqR8UqOyQ== 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=AN62QG8HQBCFyq/0bRO9070JfA6KLOTZZ4t7WhFmIS4=; b=HV6N+YN3CTaPAegZNh4yFAT4MZMZBgHVO0jawn1yhk5hmozJd7/8xZRq5jWfvlK9U3jR8fHUl6MC9q1HHeGjxyMTGS4xMwe5eok04Dyk6f5vOxa9BHQ5+LLBOYyvmflnMloBhu3dsAU87Z9DO/vOd6iE1YoajmWlSfTfgAGyHphjIcG5T9bLffjsAZzyIH1RLTL2QW/npsB+oSK6sCRiyLyjh3MVLFd1kHMvbm3DLaD6ZibL6Zgl4T/k/HhYHHmvBXR4LZhHnKuHzBNwPxGrWvFPcwV2a8Wby/D7DPZG/fh9v+77R9wRSYueP07loyysLi5Jwz4+WtuKLe/jlAEWGw== 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=AN62QG8HQBCFyq/0bRO9070JfA6KLOTZZ4t7WhFmIS4=; b=qLGxFBt3sbOp6GsnJWqOaoncLIuAqvqqBbS5uWG/8EmPjabQoIK56Hgemo1919kEkeILHo5xEvcekhZyp8UaB6yKHGbK38nyEBSN4K529OeETcDdU5G+2qz2NCman93WoDrcQzUXTHxt81k0JKXBEFCxdBOcZCyB2HA12P40Ru0= 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:14 +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:14 +0000 Date: Sat, 22 Oct 2022 19:57:13 -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 6/7] dt-bindings: input: iqs7222: Add support for IQS7222A v1.13+ Message-ID: Content-Disposition: inline In-Reply-To: Y1SQ2t6yUvdaIQPG@nixie71 References: Y1SQ2t6yUvdaIQPG@nixie71 X-ClientProxiedBy: SN6PR04CA0106.namprd04.prod.outlook.com (2603:10b6:805:f2::47) 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: 058a6fe8-6846-49b0-e820-08dab4918685 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5H10bsjKr2pqttEQ43t9+Jr8u6UzMkzkPXQgIIwUT+phEpMJoD6imunBCBOTQi89NV47W/Rxzs0Yi5FAxfEn5pc0HuJt0r8Y4EGbaQ06bGE7f4Q7FDVS2UFQKzXrfBH4ahWf6A9nSUR4vejV8uMzSQDjWBLBMJxBf1/VBmr8kBdI3NFHMPTXtCNwWJ9RPwwebtCVW55mIojzUQKvp1npu/rNkAjlZJHVaoX8set/Kwywem4uk5fBZFmvv4U0Os4aoOoquVlLrss1ma2Ljt+gBvQoqgV2hbsEQl3nwHTDm1XeddStizNTi4T3B9jTfaz68zCvMYnrjiq2WkVErkqCCuO/hxRHeAvBdZiYRfn50zI+w9Vq0Ul2XOh3xuqqf+joREcRQJpOlQ/wpXp8svXjTX2kgk/Kgo64/XnnPKUZ6XfazLCP4SpnCrnDIij3P5AYy8fe1LninWvBtrc8NpR84FfywbOnHwhi8WnVO07zE2qSzucp+Yfykoxw5OgC/sISE/m/c6+IAUyNcsQRffEl/ht/y3S2lik90exIQeVwGfpd31ZuJnbLArQWSyJYvgHaqClbcvYk6rCC3xHmxZs68MXav/0OnqQXSp2PC4WU7dT4sgDRpcaDaoH5nSTsa1yJfYbuzhMXklWqCvC/GoRhsW5sfYhJE0xjrvVJQkNclcJg8AAokACnwfd7IT2Ey7ku4a3v2ha02w1d2JWMEXeVSQ== 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)(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: ulq3MMq6bveAeoSUxElZAgaxsix3rsTgpv+pCOBHLQA5Gyu8N/ZMPOlZZIXsryQfRS6HYNe0NodPvyparh5BvCoZUiMxM+DrUznfkPD8ZBKHY/EPGV9zbfFgZtFt5GJJBvPpBEO4e64RfFCOQzQz0giI/kGd2djLIoSRGhAwb94NgSlKjcTMzGmewpdHItWvLTE0p+Hf63PXys2AXgiGMAu+m7vyw6MhxOzmSZ8Uw05hblZ4nUzuhc3O565zLe2YXejc2EvXtbj6vdW83GnHJUlBWJ2ls8kZAsVNzzjcsODzonFRSbbZBFk8Si4ftjyUlfWlZ2muLCDCI2kKmyBuwvHqsd70NRiUofJnTjHJXd+ZopdN8BnAl7pO06z9osa2SM2MugHRbj+QTPxGFED/ni4lwh6/zaZkFarBx393GQSoU7c8aCysTfVW5LAR/6S0rZpuXLKxsohZ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YZyWTvx0IxfuXc+SEmSwjFduhZ+U8HiZ2VL61KPqBOg30aHf5l6oJ8fnIdo X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 058a6fe8-6846-49b0-e820-08dab4918685 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:14.7464 (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: lDeJtnIBboCkkhvmh8qnws2LimJAf3blqNcjo2tc/N2KjuLkNceZZ6DDi4bDV2KzlD0bvdgSFL7qmc2zN+CzYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR08MB4896 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org IQS7222A revisions 1.13 and later widen the gesture multiplier from x4 ms to x16 ms; update the binding accordingly. As part of this change, refresh the corresponding properties in the example as well. Fixes: 44dc42d254bf ("dt-bindings: input: Add bindings for Azoteq IQS7222A/B/C") Signed-off-by: Jeff LaBundy Reviewed-by: Rob Herring --- Changes in v3: - None Changes in v2: - Added Reviewed-by .../bindings/input/azoteq,iqs7222.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml b/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml index 913fd2da9862..9ddba7f2e7aa 100644 --- a/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml +++ b/Documentation/devicetree/bindings/input/azoteq,iqs7222.yaml @@ -572,9 +572,9 @@ patternProperties: linux,code: true azoteq,gesture-max-ms: - multipleOf: 4 + multipleOf: 16 minimum: 0 - maximum: 1020 + maximum: 4080 description: Specifies the length of time (in ms) within which a tap, swipe or flick gesture must be completed in order to be acknowledged @@ -582,9 +582,9 @@ patternProperties: gesture applies to all remaining swipe or flick gestures. azoteq,gesture-min-ms: - multipleOf: 4 + multipleOf: 16 minimum: 0 - maximum: 124 + maximum: 496 description: Specifies the length of time (in ms) for which a tap gesture must be held in order to be acknowledged by the device. @@ -930,14 +930,14 @@ examples: event-tap { linux,code = ; - azoteq,gesture-max-ms = <600>; - azoteq,gesture-min-ms = <24>; + azoteq,gesture-max-ms = <400>; + azoteq,gesture-min-ms = <32>; }; event-flick-pos { linux,code = ; - azoteq,gesture-max-ms = <600>; - azoteq,gesture-dist = <816>; + azoteq,gesture-max-ms = <800>; + azoteq,gesture-dist = <800>; }; event-flick-neg { 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: 617697 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 254B6ECDFA1 for ; Sun, 23 Oct 2022 00:57:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229973AbiJWA5b (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+k2Hx9+Q/DAKCDTIX8rYUB7n6DXKAPeSZ4RrXaeYSRw1/B31cgNKwB/XBR2w5GtxK7FNEIG9mP2Oah3m2JNk2u0/onyMr5IQf+W4Kh9K5T2k22thFyKFvj7sE6CUeBhEFrJMLYdKrET75c+QInB4dI3oaQ8Q7vOUysL3MhH6dkvbKNOqfOyhURPKkOJbb4XTBVJEzvK/2DFTjHcRWv6TGf96NFkc0vUfPcOUtbhHEWMcr2gag5t+8L53TVq+phV8NmvRkSwjCbEqGjWtDHG7UREmMZcmoKqOct/WLppYBu9H8HUlSFvol2YEsbzeKxPu8A9QIm6A5hut4x3m6Ip6rvctsa4TDc943SYgYt2SM4s73JiqAJDu+0X1yr2cReg6PsyiuTswhmI+BHtL2F6we3myJKwNXSflOO0TfqRAxmuIJcmzsN0GXvcBED2dd/N1reuav9LtG9q3HJXofos/u4RkucB2GON8MwOlS5F2QHTA6qu/xY2xKnBrtAKH6X9xSgJqFGFooyGt0CiUOXcCXdZ5JuVKYPRdrQNBHSxwBOM8zkCsSmj3h5FWY6CTuc9C8ZTbggUwgR1/+w0gz54h6vUwULCfreI0OKqdn4n/Jc/u1QT7VI++WaLyuXVznJ8uuyH0Fz9vPKJ8w4vuS/53vusrgLLZYRJ5GATfZGg3FquBruLXmIDDzx+lFdAS52qHVZgSg2GlqwLGic9lBjXL3rxELgo67tyJJSWrFS/2dnju9aBRktIhg85bxOfPEecFb3KQPH4ckMDW7YCFvr0IcjyG1jtmG5zk+28UYdq0bktVSprVEsFirXHYK2HAHvHzhDWBG0hNb6cbRgC2POOyWnDzgdI1czqwnjDtxwzmY5+mkf3C+7cMmSWGhOIXeolC2eEaAQA999MYAU/KHJJuTmM3+xfbjJLo1u3hAJsWcl2DKsT89YHpR1ZFAcEGgi6j+A5mJMrDXMIdNSyr2itfJwla93zEi1dT2rSuxtrqFqqC+wvUI7Gchvx9QKRHvou5mQYZzCa+UEOMwJcnoVSehLVQXoTgl/Hi8TPllJNpGB37n2mk/sf3efYmj7DcFkajnrqG7P8/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: linux-input@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;