From patchwork Fri Sep 16 04:30:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 12978115 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 E45C5C6FA86 for ; Fri, 16 Sep 2022 04:30:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229462AbiIPEan (ORCPT ); Fri, 16 Sep 2022 00:30:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbiIPEam (ORCPT ); Fri, 16 Sep 2022 00:30:42 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2054.outbound.protection.outlook.com [40.107.96.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 074D96E883; Thu, 15 Sep 2022 21:30:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fX2wWTr9OS2K7A/GZrPoe6yG/wRJ29u+SmK11n+w8dp6xlx4OEBOksPbRzicBww9ra4vckSSHcddCaxBK1iHgXyv3vcEGxaPrPGt+6H9T2yj5irFCHXz/sl/n74OKd8MH9LQpdPmgsgv7/OetBNyf9vEG4D5UpmIRArmrU6CtHjFN4reEUUsHkULF2ONWNC9DqUkSJQ3w9XVDTKe0ovtIhDNrOTPFEvZTjy5ktgOeXVw9fDZaNsirvvLk6K46UYO9clnpaJLLqwS/vjOlav/upVapE3f9GVypAAcRPv/5gNkt2vSniTXTLPPjZm2wH+A4RZYE+Y8pqQjvErsZiQPCA== 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=GEF/O6tH58Z7ghcXHLt8tkcGoe4PcfWr0HvVNiL0cYE=; b=DMY+hv9nfPF2kZTUv6AK+JOyxoy3FflmABSdRnvDsVmpFVn0scXWzbFP6QcI+qffktPuDmcOyQaj1uQcAbPhfJGAqhvoX6u6VLOpX8UqxNuT2NUJlxkN2iDzGcHjXt9O5xqoROHo3w29mNvL+NnohfM1KIAlC1jbnL1BuG5j5CFV5LLwx0m+ldi1iSVJfvzw7vyuKqGso5qj9LDZAqPepUfORtRJ/WdliRmr1YErJeRJtLQ0eqU9oeu66+8x/fYoJZLte3tilFl4YFzv39bGKZc+Ol/YpLQgzahLaRsyeTKJ7pUYMLPKcrLaNDHncdgEYIVIsU+qYPFNkvfCZGrrXg== 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=GEF/O6tH58Z7ghcXHLt8tkcGoe4PcfWr0HvVNiL0cYE=; b=E9WcVNl3cO1Elc8rrwgVYZRaFIQfy3L2BX3xImwLm2qJGXjSG1PNpo9QWZjhenEHQ9wTgYrw5Wxgod+DkioC28ksDku5VFRtJC0e++vQY7775KhgbhT5TUBkWiUVNjcpITDevzij7Ia7Oj7TSl49LkRL2apOjF/uS0sSqBVGMEo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=labundy.com; Received: from DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) by PH0PR08MB7210.namprd08.prod.outlook.com (2603:10b6:510:94::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.16; Fri, 16 Sep 2022 04:30:39 +0000 Received: from DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba]) by DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba%6]) with mapi id 15.20.5632.016; Fri, 16 Sep 2022 04:30:39 +0000 Date: Thu, 15 Sep 2022 23:30:37 -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 v2 1/7] Input: iqs7222 - drop unused device node references Message-ID: Content-Disposition: inline In-Reply-To: References: X-ClientProxiedBy: SA9PR03CA0014.namprd03.prod.outlook.com (2603:10b6:806:20::19) To DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0801MB3767:EE_|PH0PR08MB7210:EE_ X-MS-Office365-Filtering-Correlation-Id: 33711c29-2777-4c24-c060-08da979c353f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G3We1IuhQ+I3+wg8fvh4NkCGRwcMod/YUYfHRggpGBLLAYdbVv01utDhjIouMeZhZorbRdI4D1if47MOB+sBMgbl9dkoat1yZMgn+SV5Sf8cUTqBqpbYvyoKYISvrVeHteDwWnyEye8BXrj78v9stTZr7CdYVGSglUbHTTAc+XBEkuVtBaYbIUSrezeMkPCUR4vU5ElULLi+T5zRKTc231XZuUORYoSVEf5HWEBtm944PlxoBRjnlwi96lFk2YAgG89eTulN/s4OGpHLOztHxQe+la0hxPHWYmQaB0e+tSqp/qUweTQqoEHeXjta4MAKOVQAwbH6q4gBiEM9BZlN1H7OQdCS00v7lnZ34d3PNYm6vEF4Qo84Yk3l3wKP7PtvzLeqqGVF9DHwup2yaEiMRe9Zia6U4d43UJFFv1zpMQVZE8h1pcM4AHnSHjr5K7HbJ4nWA1+UETqsAkcNvMVKeMyw+clUW4nEF9+vHafcf6WT5jHzF0yQtztm04gajcohGkb6yAIL8BRjyi4VMVgRSwBTGNOGDBzSSZN0FBSm5rvhG6MMG9+wGqp54+GASMhluYniLqmSYaD+ogmijCLdXt2oRXVp00+Y/FibZv4y5Ew1TGI/NA+2vgdlYeNjNsQxTy+UxBHcDQFe5DOqqolyIx/mmZMNtHGfXRPud6kmd6sERQzlt9ZQCiXUPaub5pjQTMqg5UhfkYZfFM2X0ELz6g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0801MB3767.namprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(7916004)(346002)(366004)(376002)(136003)(39830400003)(396003)(451199015)(86362001)(33716001)(6486002)(316002)(38100700002)(478600001)(6506007)(107886003)(8676002)(9686003)(26005)(6512007)(66946007)(66556008)(66476007)(4326008)(8936002)(41300700001)(2906002)(186003)(5660300002)(83380400001)(30864003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nE+KunEoK4CtdyPpcq9psoU1OE6eUHalrtx3Yp5VytqG0b1lN+fZlG/mIVVbOjNSriGAo4BT2THrC4w0qvY6738IzkUOsFxECsRGQztmYLbP/61XBRN5MLO7ZqCmKFyzjVtyQpAmC1t+1dt3SbydZg5cX4kuudJpmIKk/S0jJ55TukpXssGEppbrTZITVPRr/lZovz5absETi7vTIBPsK2Xh1NUfRl/7Np4mySOouGVYue7aG5fiSWgkZJgUbZmij1OxVQj9COm6c6E28nDACTVnfqjEjjEbtNWjuiOr3TsdOG7HhwV00ihakBVSl9PSRj0LdN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bRgxbaVj3CPKyrMlEqUOhB3Lq3qhkP0a2qcHbrB7EERAXyXFGfXXk3Og/9CK5wDIuderKdHEIohSBNr1u1JqauUQWY8Ch8tY44/zKjtHgAmpM5/ZPUgVZoHraHSc6cbQ+VaImYJn0v9pIXICv4R7bIdtMAnPomF8Ut20spj1Zf8/gq56ZqhRNxJdPgTp+VSsOq9F8a2pJvuj+iQG3mz/CyC X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33711c29-2777-4c24-c060-08da979c353f X-MS-Exchange-CrossTenant-AuthSource: DM5PR0801MB3767.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2022 04:30:39.1659 (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: HnwP6XRTykMs78ue/5OYAu8f9A1hBXGQN3tqUWm/UT6GBSI05xt2Mp523NSlcIeHmkkd2d9QQkADNdY5iBy60w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR08MB7210 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 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 | 326 ++++++++++++++++------------------- 1 file changed, 149 insertions(+), 177 deletions(-) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index ddb863bf63ee..d39b3fdfb849 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; @@ -1699,15 +1715,12 @@ static int iqs7222_parse_cycle(struct iqs7222_private *iqs7222, int cycle_index) * 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, + 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 @@ -1750,11 +1763,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 +1775,12 @@ 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, + 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 +1902,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 +1917,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 +1926,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 +1947,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 +1964,12 @@ 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, + 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 +2093,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 +2144,64 @@ 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; + + if (iqs7222_parse_extra[reg_grp]) + error = iqs7222_parse_extra[reg_grp](iqs7222, reg_grp_node, + reg_grp_index); + else + error = iqs7222_parse_props(iqs7222, reg_grp_node, + reg_grp_index, + reg_grp, IQS7222_REG_KEY_NONE); + + 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 +2209,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 +2238,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 Fri Sep 16 04:31:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 12978116 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 D712FC6FA86 for ; Fri, 16 Sep 2022 04:31:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229562AbiIPEbN (ORCPT ); Fri, 16 Sep 2022 00:31:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbiIPEbM (ORCPT ); Fri, 16 Sep 2022 00:31:12 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2067.outbound.protection.outlook.com [40.107.96.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FA82558DE; Thu, 15 Sep 2022 21:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UKoVBASTy3w6kLJVCscnwtsd8G4S8BHUOaiI5H1C6zmImg+9LEfefu8w44EJ3PsgOMxEAgi8NFdjnYcydP9EmUm/ywURW4D/xNKt6odHuTFfhZ+TLCTS6YoFSCkriPEqLP8+WhSXWFeayn/8smjqfjSpJip/h2q8JjGH4iqRrgnN2lsgBB20iPF+0XYDnjbZqovdi1aW1Z/8CkTdvDhe9RSpYW+tmJ4fxvCuIQU+Rig1Oc4ssH8lKeSuApFijmQT+LCtpLy+GZMc4s/uQfUtRHtHGXO0uk5EFpagMAC2QmdJ4VCFsqLTk5LWQfCTXNE5T9Td1yk65u76vDdGSASakw== 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=abBegcGIFaLtlyVgs8j825XJFEPa46jo9cdiDRXDLT0=; b=S+iJRdP5a2eade2AFk/HO0670u3NmRxWG03ML3hccm7ioLcduZrSmOOrQD5MZqcxBd9pxiGcFNaZ3IBWGK4yC1cXhbLmh3+QjaMHcRvhKCb9DmL1ao0Fh57GBtRnnS1d2d7Ds7FLJkmFcuzMqtzOf3Ly7oIbgdKYN17AR+cldONEf0K8r1q34QCWPlYoLBtY5bHu2IaWCgQuPBwmSYMyxCzQgm8y0lwuQPrZlRkPq5vbsL8bJFwTQ1rsNuBMw3lvE2VsNN2Kvz4gGfC8xYOpVQs6M7yfYagEAejyvewlt2nJRB9R7T8cph8/76D/Ldx2Ii5uXUMi7U7TBYzYRUWzpQ== 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=abBegcGIFaLtlyVgs8j825XJFEPa46jo9cdiDRXDLT0=; b=U4BQdVXT3QBAVjvvFXSigY8RRDgXsgLO9BArtnNRlIOp8/MfbpHz1pLbGj1nP1yj3ZVCC5rQlRfnmoZhbqyU1O/KgHHdnh9x6fx2SOMBHQnfCb1HpCOvXhMBHNbqNXicVdVSQyMla8QNjikrfWjGOesZL/WvQAiBQOqpd77XgJ4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=labundy.com; Received: from DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) by PH0PR08MB7210.namprd08.prod.outlook.com (2603:10b6:510:94::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.16; Fri, 16 Sep 2022 04:31:09 +0000 Received: from DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba]) by DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba%6]) with mapi id 15.20.5632.016; Fri, 16 Sep 2022 04:31:09 +0000 Date: Thu, 15 Sep 2022 23:31:07 -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 v2 2/7] dt-bindings: input: iqs7222: Reduce 'linux,code' to optional Message-ID: Content-Disposition: inline In-Reply-To: References: X-ClientProxiedBy: SA0PR11CA0022.namprd11.prod.outlook.com (2603:10b6:806:d3::27) To DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0801MB3767:EE_|PH0PR08MB7210:EE_ X-MS-Office365-Filtering-Correlation-Id: 70e2a21d-e04d-4345-fbd6-08da979c476a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XaE+zk7D0618k4cBwUeQVDHO2roEUPPOIYTA+BznjrzYe0twT1fsvsImTbJbRfWIjQTH8F7i3rAf51vcu3V/QyQCjN13FgAAIgCHIqjkgH2kZCV0468JhYGNbZkmoENIbHiq2jYcvbLnk2ed/2+IAxq26ef3ims6LdVk7ikB+ThIU4K4w0NqwxlNiLeAIPjl48AzBUqD5PApbWliXL9zS6OwZC8rPQka8MNh9frJLhsy+fqGDxgMixuFb5KSfsFVRQAsAk/5u1wvEjes1dNkvrc9jRxlAiMZUMthEEuhzurthpEhCONTM4q3+0/+VwPHhtcpOywPFUJAls3zqWosOEsuC+QD4wPTbIqN/sjfdIRD/jqne7pQqIB4LK1/Uo3KjPwp71RCu3sSjesN3bA+0fEK+Yjy7jMqx3HHRWtDkW/fStXycg2FQOgB/PYoD73sk2n4ZCxAeZhEdUa7sHb7lu1aRQuB5skrEDa/GfR06qZ9a81AMw+teo0zKOWNjxepkcZIgoGUY0E3oCUHibXq3aLnhNlkyHKVk4bhlaw7EoL5nOf+c+73vOq16hzFr2y0jV4ZOz4fNvYrDacMh1Sb/J+mJAhAm1Wskybu93SDNuJ09w8GUHlfdvEM0QhfvUn03wS7Illfv+Dh3idkZyxHh5OGCP/2wGwSogR3QJaTXpGVhDCpLfovKl5l9PpLT/imEMRw4XmdnR8NblbD8IIb5w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0801MB3767.namprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(7916004)(346002)(366004)(376002)(136003)(39830400003)(396003)(451199015)(86362001)(33716001)(6486002)(316002)(38100700002)(478600001)(6506007)(107886003)(8676002)(9686003)(26005)(6512007)(66946007)(66556008)(66476007)(4326008)(8936002)(41300700001)(2906002)(186003)(5660300002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XTk/b/terQBv28wcpQZ4nILfJI91LexggvrzzvqxYCj6tVHyEmZSpV/yefRXXaG8uJxHorMRTq3gnD5TN7xKLdsNUquLOKKtKSKrklwi/x2dk7gLYD6gxphIMSzAhwVPlIVXwmCVfFeQIU8Yvz/wxA5IrQC+lCpO8X5l7aFcbIIPkftS0tu0EYOdeIC4Df3wVWHtDiDbzYJITteBGuEQmvB/iNtrndjF1drz4akYhP6xVVnnU2x9dA5Js1ZsRYyxDxjqur/IbtMDmuvHMGjYBS3IcjVz8H3FUaq1k2CSeh8awMvAXNDveaQT1NLnfpjGzSkX+bKsCMGavOij+L0+Ld4z6bFZPVl2NdRODDCZ30XXRHVUDJUh/NiqPiLztPyMNxgpE8eTH+jpD0F+LWLzlrBHsFHAG3M/c8KNd9GJ/KL1VDlsllOrefb06yy9So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5kGozLWaR7TXeLw5ts23T58yN21Y9PV5WLh3r9bxZ/7n11eLOa0weKA1o3q3v5ycvte/+9aSIL8bm5yK X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 70e2a21d-e04d-4345-fbd6-08da979c476a X-MS-Exchange-CrossTenant-AuthSource: DM5PR0801MB3767.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2022 04:31:09.6794 (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: i+cG6+feGfRFEFOQQhu1dO1GQ6D31br4Q1Xsr1nudAzhzMLLktZ7zXPe5jGWi4RPWPXVRkaNiPoQUvoaelYsbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR08MB7210 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 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 Fri Sep 16 04:31:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 12978117 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 B3716C54EE9 for ; Fri, 16 Sep 2022 04:31:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229541AbiIPEb0 (ORCPT ); Fri, 16 Sep 2022 00:31:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbiIPEbZ (ORCPT ); Fri, 16 Sep 2022 00:31:25 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2072.outbound.protection.outlook.com [40.107.96.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 759C0558DE; Thu, 15 Sep 2022 21:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RocvLQU/zNyHOxSlYKL0d2YhYxDOsV/yA75kJRq9t9TDIZ9PzziReSOcHKLSp6jKpZiYOutuzdo1PQvmm3PJ9AMvYpbrBq9EvcJjwUlIBSffmNJQVZi9onHfr9Guc3e+/JNwGVggX4pr4aJNj+XWw8aWqItkwWIn0P4L9WZBdlsszl4LZXhuPh3ZWr9PHnsLQimXkBD+9Y8oJ+AKmZdreAJJ0EXfzy9fkPpMdh6KvswurNDATklefOao0MKyltU1srzAHGAZOjX3bVbEWxVhm9rbPAoEFFUZKjRLajftX99o7TIyX/Czytn5jFrhcjxX2TpOTierNLQ50OUMCDiDqg== 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=e+h9aE8pGScklp1LAg53bu0IULWzTNerRnIvyw0X9Cg=; b=GIN5kftdTaZWkHWfg6Zm8zZXNY/7YOpq+kPEpGokrSACkHU8XkFzvW7VRNFknT6m1UFL1ytKISIYNgeVQX0zrogOIBNQPJ8jnOprEif+7laQTfND9EVlmAaVVu1kNE/EGvQb35HXCMvXWbQBtE31uo7grVfmhm4CJ5TY4RaRKrt7zWwXccFYUqUBnF308p1xY3nkndVUjaL6Ocq3wwjw0D8/V3S6Qj5znJu1XtGfFokcayZQoUmlL4Bht5y+HTitColoDGGbjPCYVRDbkC+6+wnLuid/PnqPLdb1BbDR5lNepbUwF+v+ICvpuBmFBXBL42MOOPDFtJbh4vwLwSmqJQ== 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=e+h9aE8pGScklp1LAg53bu0IULWzTNerRnIvyw0X9Cg=; b=eYmJ56oa/oblWPvDT04kS6GPFGPr/iFUjjgqd+yeqHYDjTSS8xVVeMW/+iVohB0IY40Vsjqr9ED7BVbmAuyVBWFkZhym5J8028yIGHw/xjACCcbB5e7CEzXUkSGPE4whXHLEMw9oVfllq29BzDejk0X0vtDHhNspXTW677fMnPs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=labundy.com; Received: from DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) by PH0PR08MB7210.namprd08.prod.outlook.com (2603:10b6:510:94::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.16; Fri, 16 Sep 2022 04:31:23 +0000 Received: from DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba]) by DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba%6]) with mapi id 15.20.5632.016; Fri, 16 Sep 2022 04:31:23 +0000 Date: Thu, 15 Sep 2022 23:31:21 -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 v2 3/7] Input: iqs7222 - report malformed properties Message-ID: Content-Disposition: inline In-Reply-To: References: X-ClientProxiedBy: SA0PR11CA0110.namprd11.prod.outlook.com (2603:10b6:806:d1::25) To DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0801MB3767:EE_|PH0PR08MB7210:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c50ac3d-3499-4d58-0349-08da979c4f72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RMXqgefF8Eho0YgDX9dcBeOs5cFatNa0bEaC6X1ZVBq67wPE+yY9cOJqB166eNGvMj9eUM76GXED258QMsw6JJPVgLGJTL4OH8gxYprBWDo1gmCk6QYOqgxxXoNLaX9NoR34OUzwqTDxxjShTz8/RayyyC1XDf5cuEvOWFGXSdC9oPXjqdtphKYUEcFS44zd3VqsmFFkI6VwYQfKir1rEn4lJ8dCa+1hy6PYWMkaFnqZBr8fLrmKsnQnLBbJXco6D1homCNI7M4IfIq2aumoXGo9qJ+LNrLva4/4A0ddUqc1ioo+kf1i16OCW4+ds6sXCk6LrPv5pzF/rCnkBXEKbnbIafJXkzufPSrGaTg+x2ZLfqnSfmJVQs5YP06Lbv3xa6rgnQ0mSjFkMh/V3RK2un6tEj9oGtQqQwAFDnh0XgS/Q7wDgMhE2PycyLCoaXn6euS4R6B8TZeaEkOfaxCdTQdWdqpTHfaScbO7Vcu7jUBY1cJGQbF0uvYbnJd0bBDq5cZ/uoWMcj0CRcb9adZJHwJ5H1NL05jYsGEVNmdlSj9BzqOLVdE9L+1fTP3ZFsfRzoqindY/BnQnZUS/rQvsnEW10WFIWjLhnHkdkzIe/Cghj9YtOxOh9Irq4fHeRqavTLWvCyFbkWfKR6+5myFM38nvr5VYuh66mQvh46BV2FxkbVmSuebkway1QUxRjGccglb0DlGUc2WdyVCwAdTAAQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0801MB3767.namprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(7916004)(346002)(366004)(376002)(136003)(39830400003)(396003)(451199015)(86362001)(33716001)(6486002)(316002)(38100700002)(478600001)(6506007)(107886003)(8676002)(9686003)(26005)(6512007)(66946007)(66556008)(66476007)(4326008)(8936002)(41300700001)(2906002)(186003)(5660300002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 59+3PXnom9/QwYM0jB4mrgQObVTP2rA03hO7Q/fG/Q0fYJwQ+3kzluggDa5/DeA16roLb8SqcD2xsRHTPWZ5tp08A00ddBV6JuqQzUH0X/aViJhswbvIbPmIqz9f2eqVwqOPNA6OWHGtKSgslxBCm9rWl1sLPl29y+Tt4dVb5sthdSuCFTh7OHPdKHECXSAe7N1tBhZ3D7V5pBrR3/KZQWrDNvD3LId865ywPqe654gGPTLYDO2xdjk4t2z4Mgp0ptKfU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JbI8QhMI6jox0J5KbXb4ANrTv9gyX6z9aX+5JjRVIe4iv0rXHH3mt7Q9UEjlqPuwdZEcXeW99TVKScKpjuFizAOjEQxw4dpCb1kBRVkw0qihd/qKyNH7u4iIVpy1D4e18nVs5SRSyx/F52gKSfrMgRszXfCg+xqG3aQtiXKEF1uq/JP/zMBd/BQtnkIgpD70wSmeStWd7D7mXRhIEgLTy/XAi5F1O5Ptt1R275Y46fzzDJERs6K4a+TYMWQgOy5V3zjsKQHOAcM+Paf X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c50ac3d-3499-4d58-0349-08da979c4f72 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0801MB3767.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2022 04:31:23.1317 (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: RzzkwtaMse9SWsQ9IsuteJRx7dMJYN5gbZO8sYIixmjTxtOfLgmYifDhFA4XEKQ/sOJ62pbSpvC5hJTOtgQ/hQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR08MB7210 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 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 | 43 +++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/drivers/input/misc/iqs7222.c b/drivers/input/misc/iqs7222.c index d39b3fdfb849..36c3b24e99a3 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -1820,8 +1820,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", @@ -1830,6 +1831,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; } /* @@ -1902,9 +1908,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. @@ -1924,6 +1931,11 @@ 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); + return error; } error = iqs7222_parse_event(iqs7222, event_node, chan_index, @@ -2028,7 +2040,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); @@ -2042,9 +2055,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); @@ -2057,9 +2075,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) { @@ -2073,6 +2096,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 Fri Sep 16 04:31: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: 12978118 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 42816ECAAD8 for ; Fri, 16 Sep 2022 04:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229473AbiIPEbn (ORCPT ); Fri, 16 Sep 2022 00:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229581AbiIPEbm (ORCPT ); Fri, 16 Sep 2022 00:31:42 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2058.outbound.protection.outlook.com [40.107.96.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B55436E883; Thu, 15 Sep 2022 21:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RC4itAoMeFliQyZS5kOpIEkRXRe3AC+sF2jYysUQrwTtKBNJmD2KgpPfvoX2N60vLLusYxA+eNB3VGToU9/PV82IZgTIX1CMYYPxQy3pNsxbZ+9j85j8EKEQK2ynBWEN84mjxXjXPR6MPfa+YeFIltjOsMl1g5ObYWYT4pCEz+J0QTywj0InyEaWA94x0r+tXLQRB9qpg/3N/RVds54WnASbgW0VqpuG+05dhZt7yB2i3dOUo0FbKEON4nQLP7Wc5bT+9hUlg0SsJnhE35N7cgRQfvjrXK2rrVyAa8ffva0eC5v968kaUd0z7O/fSvzYdsOqImQAtbiz6L5lENun3A== 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=etw85XkC6I96qQjN9N3LolKkUo1Nww5s0VbFG1ejUbk=; b=KG8yixpkO6Vk75PT8gF7gd42hrD6vYzcCw74a2Fl6G0jPUNDCXMueHpq1jMQdsVe9l5eKHyK97T4Mk4H5i2qOpwej5a0up3zGILsIYJQdzDnRQ5/Plk4EPTu2SKO0pE1/WcS/JJ3PmhCgg7W9BfjVJbVMx0IZjkneKkaZsdAbA2dpDMIk3fazyO8MfgmgGU6TznYcAOOOlL3M+w7StdsYhc8Vi5Ah6S7ZIoUSajqDNwTe7JSNAI9Bqk0X9lDrXWb2s4DCKS0X8iYsZUbmnjR91Adap6qjtvz/5G7U1DAJ1rVvK+jUHgYQBKeB1ZA0cbM6qNEl7wJ7gt9112nNRTgZg== 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=etw85XkC6I96qQjN9N3LolKkUo1Nww5s0VbFG1ejUbk=; b=MPHe8/JjOxYwjKkWl4xtjcHqGOGTjHToQk7g4N0NrO9MWyuTXCN3iPJBMGhRc2ayVCcI6nAo6WPIna/iqIfM7axe1wnFwGd5BB64uTJ2j39S35XjY358xCt40BY5gJ/m7T/xPa1/IJ+cZujaYCWbOngsbqCsiSBVX2Exr/MjWk4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=labundy.com; Received: from DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) by PH0PR08MB7210.namprd08.prod.outlook.com (2603:10b6:510:94::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.16; Fri, 16 Sep 2022 04:31:40 +0000 Received: from DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba]) by DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba%6]) with mapi id 15.20.5632.016; Fri, 16 Sep 2022 04:31:40 +0000 Date: Thu, 15 Sep 2022 23:31: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 v2 4/7] dt-bindings: input: iqs7222: Correct minimum slider size Message-ID: Content-Disposition: inline In-Reply-To: References: X-ClientProxiedBy: SN1PR12CA0044.namprd12.prod.outlook.com (2603:10b6:802:20::15) To DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0801MB3767:EE_|PH0PR08MB7210:EE_ X-MS-Office365-Filtering-Correlation-Id: b4edcc5a-8ca1-4662-f9a5-08da979c59b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ujx3XFVOJX4U1CzWlWN6DmVeUZmc7GP6o1jO/VfCspAhhwvoR2AwmBdcU5/LAT5sdpVjF7ptFaONSjzKJV0QNiiGAR84OoqvuFfKFrITZwr90kWBbfNcYBWKyzGUCipPaRHPArNxaU5jHzfiO0I0SDMzRYO1B/1FNi15ab/JnwYnPu5bSf4t6PjIn5OSDQESFX2QWWLnn44Z0z25vzuuGnuQ+z5FWe/jgr8CMiPIZKpRv+ly79fUkjTKsdwhvrm8Du079ODv1H1BVxvDERe0ZMoCibFLKQjD5wbuQHLgIQ6sV/F69+98FQ1l9C7IkesFNRPOpgYPR5Qo9XY7T9F40MhCy/SdauObplw5w5TNcPPctqA/v9lrtIvEO3/4ULkeOaCGlcFpOz/K2PP9pA/c4alXVhxyRPgMvA4yXd+/8QpGHRHQsJFoqZjAnN2iVfW2g6JCZvingbT2gwxRo7ic4C0MnUCodIEO4uh+xF3a4lhTMnLLpj/SeY+yFY/GpcstIZOdhDYW6x59CPwGAPnlRrYIZqzrCioEtSi7vj6u5nYasD2S8aaTrRYFRYIYkrsrnbsWMppW4Zckvl6inbI8uQI0SeAgrSO5aniyXg12Qekl5o3jK7ILbUtlMU56blBWPncNRVXYIHnN3wbCDt4BAH1RZaRgfq3AFf2gWSRT9Ksv3J2cK2NDTb//yUnMR8dfH6mytF62ZNxPLwGLIcAdKlkbL93vNMYcgnLIbNXOUp2auTpdkhXVu7uFAuFlRUTA X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0801MB3767.namprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(7916004)(346002)(366004)(376002)(136003)(39830400003)(396003)(451199015)(86362001)(33716001)(6486002)(316002)(38100700002)(478600001)(6506007)(107886003)(8676002)(9686003)(26005)(6512007)(66946007)(66556008)(66476007)(4326008)(8936002)(41300700001)(2906002)(186003)(5660300002)(83380400001)(67856001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ox4XH1FZyc8uqHhuFNIi+160+YLUx7kntTe1/+RCo86mthr0EIs45+YdR1sWY7LPTs88R4i+UctDdFbnmjmbWLB83gdLZFM3ePhRXAcdLjYaHM8MTrB4gauuMCsn0O2HB3ejdUwZeheFd6qwkEf0XUDo1h4qxFtrjYIiYqdywqrbE0tQ4PyX6nC4ipUnT/+a78ewrlqRmIZ2rqLv07TnrxG/9t2baIkjMmQmbKHP+qqx8QIpSZC79v70NySwSrjIIM5pabpKg6P2rPN04txybIYiKI7EHlQrXrvKVhmBB14QsqCuuljr0krQ124lVBdpa/s/QZ/BsRcy0+m3REU98hbwHzNqAAfWy3nWzSBPIGuE4XiL1yRM0UICSgc6SdT8LvPMrugt4DvtJ/kjamqs+Gt/RAv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S/QDpaksW94ilfszc8Tsu5swyjFTpheZX4EmBqHnUxUqTwMRyqCHSUn7/O5YafTJnIV7IeIq225zGI+9C9P1JpZ9rxhoeYsn/x4t5K3pkn288kAetW+ X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: b4edcc5a-8ca1-4662-f9a5-08da979c59b9 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0801MB3767.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2022 04:31:40.3649 (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: ne+RBxTFXGo0tEqxmsnPRx1id42LmBsNuohCtxUX+tLX5+zuH0itOF/AXrkcwHI8p8Gllgztc8o31K1HC2akZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR08MB7210 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 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 Fri Sep 16 04:31:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 12978119 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 BD77BC54EE9 for ; Fri, 16 Sep 2022 04:31:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229624AbiIPEbz (ORCPT ); Fri, 16 Sep 2022 00:31:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229581AbiIPEbx (ORCPT ); Fri, 16 Sep 2022 00:31:53 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2063.outbound.protection.outlook.com [40.107.96.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4450B558DE; Thu, 15 Sep 2022 21:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rr20nZglYqxODQa3byILmGD1jqyHTuIZWBg7DRVyFiIe7HK4GgC+L4uXovKiL7wbgmDeDRw2UV7pUQHoCmP5TDA8iw4eFvTC7dLePBL+amnx1QKUQeoZwo9JZdcWuP9TTIPMXotGMrPolEupwIMSR7U6tG8vXuQD2lWRlT6UnJUI8YBRn6NtPrDGhnht9HZpdL1nPyCNDtdx0ne4sykYb+kvfr/oA0XcHurA+jReu5mQg9sRMrF3lnZxEJ14y3vfRaDlC8xv6n7++OBWB5dABLw1MxZCWtuKJ0Ap0QIBg8NCa9vjnoxSGBwpynHVnJjk95BS/tk8Qqq0DGcYZMUscA== 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=PbsnWtist44WeBoTBHertNl1L9gKD3nD0ppGUQL00wk=; b=dCSeS2x4R3kU9mjf2cUCpGWIo1nxcbzglb7fYdr4AlAEkLy/Ws+G71SBdvKGn9+99Rl0VRqWVIphcCvZ2SQp7OKWLfT96oQ7YZ3MTs2LfrYVJHm+Bkkg59Zdi9/WY0lBk2xfUSbX0RYLqnjMC7rikL7/tFUYQ8gLvAhXSScoh8ka+FMVHfzGjk9E/Ukrz2lipA0XrfFMY/LJ06PElC2O9uuOJEgn4GOaw9DsKElC8XOQG3k9kGYwO2K+V1GOP5XqE8JLBHJStvRzfCFFGz/js+ozMaI/tA6BfO1L7dBZXxATvUYbXBsmKFRfzIO3+LACTDm6rJRbAO/ZSrJnM4PDHw== 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=PbsnWtist44WeBoTBHertNl1L9gKD3nD0ppGUQL00wk=; b=WxXhQhCpy92AGapZhp0u0IoZwcQWwh/hsAcdwqzf546YoHbc7au4OvSyDMJISxuNcAsACV37xMy6uAoK+qfa1mfydMRmRmybg1t3rENlQWTQxKjcF6dL/y2ruVSLTRVIuv5HBBvca/voeYSTL3D41X6758NdDjPD4g6SxiIW0pg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=labundy.com; Received: from DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) by PH0PR08MB7210.namprd08.prod.outlook.com (2603:10b6:510:94::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.16; Fri, 16 Sep 2022 04:31:51 +0000 Received: from DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba]) by DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba%6]) with mapi id 15.20.5632.016; Fri, 16 Sep 2022 04:31:51 +0000 Date: Thu, 15 Sep 2022 23:31:50 -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 v2 5/7] Input: iqs7222 - protect against undefined slider size Message-ID: Content-Disposition: inline In-Reply-To: References: X-ClientProxiedBy: DM6PR21CA0017.namprd21.prod.outlook.com (2603:10b6:5:174::27) To DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0801MB3767:EE_|PH0PR08MB7210:EE_ X-MS-Office365-Filtering-Correlation-Id: f9e4b1c6-8bd5-4674-c6a5-08da979c607c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +HCsTkvWGHjIMAXGeOpUJRtVyFDH9T+gXsKo+7H7zLyDsxsCdXdhUxg86ZhqHUbhbVZNpJS4cm6FvrBZqtLW15Q46ucIOn83bztyQz4XB+pL6ICHF6i1dz4eJKoo9/b5Lw1yoFuj6b/bkfgYfrypcheDtbF+vMALWNua9RJi7OHf/a/+or4LMps550LEzh7S+oTsy8tfv6TU3RbYbk6kr0Z5+/729ubAE9xQ/BFy1zRuxuFFEXVpH6cbrbJU7DQTDSfAuWhfk/3Alh4kBWIqVkisAe6pZ+E8uvME5HRZfHGDbJ7a9B5nJKuBKE8/i1nHO3jbO97393pVBm3JtC7i+7B2etP/eK3X56vPvvBxDdkmSGGBeqyhSDgxcwAzHagDx62vqvAgDWxo/9H76CKGDU8oMUZqUGUIit6wkmlkEAE6nAOuveZwnCDXZyfEqZM5+0KcEeqd2M4GfUiKqOtotAXBIYcFOdYqRaiwG16ZL64sQNC5wLmMxfVpvPFbx2LkADQEzqwXn5sk8ubLSUqHl+j7yGAWEm9saUImiFkcyFVzJ8gJCWM5sPqlwxVaTSaRyFSMGF6IMZ43fmKH40f2Ejr7qSEdhiOY8Yv+4ImF3KysMb/rEzlKHTrRvnWF/2tDfp5ZKBYiTzwGsrsgJLOxoPF0xtgfBlZEqwz6u0mlG0h+krhe/fwe6eXqD1rZX556iY3QhHsPsIA3+Bqpw8+DLQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0801MB3767.namprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(7916004)(346002)(366004)(376002)(136003)(39830400003)(396003)(451199015)(86362001)(33716001)(6486002)(316002)(38100700002)(478600001)(6506007)(107886003)(8676002)(9686003)(26005)(6512007)(66946007)(66556008)(66476007)(4326008)(8936002)(41300700001)(2906002)(186003)(5660300002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FdGcLMsF6vJCDVESGTDY3gcYTK4PnnoR2D951E7z+WVu0vkHozwGW2v0Z5TGIBhDQfPCwzWSCrrbSkqaYfmLR1zYCznfEbjrjSyBqH+X33EcF4d02355SPdE8rWTyAag2sY7aYFeLi953G/Lc8lTXKMZeWOMVEtNDb+U2+3hSGgcQEwlKaa7ZcKMrPJ93H6yq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APe3VuAvHiQY4qKl5Vqu0heOJxPLihgreQd/Z5wi69m3FaKrDWcZxzcW9j0vBa+rfyAKZHhmizQoex7mZpG3f7UFm8AC4uMLa+aEt8i7FIHI1ODtcxy4fGbtNJ03IDL1hHyqaGEradhGKxAJRd4ITaUzn52tWLTbcLVNMSOYODMIre4I3YqAZ1ezh4xiDeOP7oCA4Z5cEGoblgRjOlIMfaixG0aTFJcEXGO6QYhKdNqLxrBwVdxXrjboRFBySgJVxlSHyIa9RqCzA2svkj62l21yAQR7Zp/qtnSadOz5Oa0j+Nbv7eeqeVQRKlD9oZ X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9e4b1c6-8bd5-4674-c6a5-08da979c607c X-MS-Exchange-CrossTenant-AuthSource: DM5PR0801MB3767.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2022 04:31:51.6922 (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: 4mSB/yLkFr8xgczYVkm7ktbSIQT414AnarhHrBWdxNkvBp5Ddai1M17b89oP1iDwIqN7IMhwLadh/SW52BfzPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR08MB7210 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 --- 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 36c3b24e99a3..0a592b90f471 100644 --- a/drivers/input/misc/iqs7222.c +++ b/drivers/input/misc/iqs7222.c @@ -2042,7 +2042,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; @@ -2061,6 +2061,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 Fri Sep 16 04:32: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: 12978120 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 592A4C6FA86 for ; Fri, 16 Sep 2022 04:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229588AbiIPEcH (ORCPT ); Fri, 16 Sep 2022 00:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbiIPEcF (ORCPT ); Fri, 16 Sep 2022 00:32:05 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2065.outbound.protection.outlook.com [40.107.102.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1338C9FAA7; Thu, 15 Sep 2022 21:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KWd6DUrb03uVHEqtaGmbUN/H3iGOmbNOOPUOdzNVxbZtqWdb+DGMclu1UQ0Bpvzqa4H2fnzhJEIX6H3f5l/KndiI24i3pxSIHo1F8G7i7eDtKS4/6kMyVbNfRYTn08sB/qhZsgoltSaB5Ngmm0z8DfgFSTPvLRbV7bR17JJ9QQVMQ9rHUlZzYuxY+MKtsNONxm/D4rEflKZUmRixQPyNednJV9WVgp0TvD2EXeqrdw2xkg4WCWlSr/oMYZYdkn/CUMcsMPkyCL28zsWt7Q5f1uK226Y281inLWDMiVZu2dRVFTz5+uMuB0qdQsJzr15eFdvM/QT8SFKEOaE6QtDrJg== 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=XjsotK1960hLSrMOflnU1L7Sxn7MKrSbB2Dze/81BaI=; b=NGEbHbN42APCW9cYDDJNPksYg4IQPulcF6tB1g9NJISHgq0vA5Ew/5pGg3Tqg8zaRaU7EwzGhBRhTRmQwtVu6iMTaPZCURfDWzhiPJnmuXl/e3FM53OXHrBuBrJAoqNnGdwkMQ7SXw4OJKbvqFMXUMTNPDSluwUPtTiUyk3c5PbZ/ba9xQXCgxsZneccuV4m2+axYPXnEhvyZjGDHMRuQnv5kI7/2nfJKUTPRmW7IVdYHIuiag+eCb4bgV5+ibyU2ysvbhj/PbdY+g3zJteTg5A3NaOQp++t/xK/n60Q5oh4WtNwLzRcVOxXJmg5hJUllDJ69UNppB9hue+jsjOJCA== 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=XjsotK1960hLSrMOflnU1L7Sxn7MKrSbB2Dze/81BaI=; b=a8P+mDmdkN5CAVSyZhM9vF1EBwfDIUCUAOj5HHMB2Bvv9kJpeFYgZ5VWv4nr9kUrYM9m9vPfCsvlbeaj3yRho+MCXyu6LNV+yq0acjtr2BpuwIWtoPJtR5VWqo4TU7hkCEIBfioUhO0UKJaGhDiw9eB+yRGJwQ2QTSOo+MtMDWY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=labundy.com; Received: from DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) by BN7PR08MB4132.namprd08.prod.outlook.com (2603:10b6:406:8a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.16; Fri, 16 Sep 2022 04:32:02 +0000 Received: from DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba]) by DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba%6]) with mapi id 15.20.5632.016; Fri, 16 Sep 2022 04:32:01 +0000 Date: Thu, 15 Sep 2022 23:32: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 v2 6/7] dt-bindings: input: iqs7222: Add support for IQS7222A v1.13+ Message-ID: Content-Disposition: inline In-Reply-To: References: X-ClientProxiedBy: DM6PR02CA0112.namprd02.prod.outlook.com (2603:10b6:5:1b4::14) To DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0801MB3767:EE_|BN7PR08MB4132:EE_ X-MS-Office365-Filtering-Correlation-Id: 1208808d-e559-47f8-8d06-08da979c6672 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rWHWm3xXA43keajYjyLMa48nO4WeheSWRHbGIcoFA7DQrHwxxJ+O+Eytcxsp+YzaeXGx/ZyIgGLJstmmrlbGnDuhora75a5/Ig7DHG9T+/aDDO5YUogSZd6ecs2WeFylppn4k98+p8pXTopCsyPINJBD5ZtKwgdSBYnBIe+rDOF3FnidWJfSsVdLx9nHTOT9LSOjGH3aj0sNVeaaXbZTqHcE/1gMxsRG+kYMIG7+fk691L/Z6QNerYvC4Z1HSPyMwV3EY/2FxCLpAaiW7c2nrzvWw27AJ0VHpyiLro0xgN00M64prLROs9ThScOqK6Dyfu2qHKLhvJ6BymMh/8hUKPu4VZAYXlte+ovFDmC13XWmZdT+Ucn43WigzW308ILE0zn8mdN1/hijknwS6JZxW5S1t1crH24H4y8tooEv9aUIP6hnUOMP80+eliakI1Ja8z0o70jRO5oxitZW5SguDAOOts9U6r5OoeUOD38N6hj0kpfK1wNEm+Voumlu17c6o49MtFdAxsFaVndedvlibG+ICsbsty59ZXKpsOPRklTKTLaa2nDfp/xaVmihqer5cGgH6gyJ3oNzgkHs350xUcoqvbHn3gkwUEoBwnogp5t8UpA9uQI0Lv254xf/APgvqdVHXjFhne48Hc509861p3aBrj9g39WPM6jj8Vc9lNoZSDpbZj71AhD0UQ8ldurwavxWkaw5d0B/czdO7JMDXw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0801MB3767.namprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(7916004)(376002)(39830400003)(136003)(346002)(366004)(396003)(451199015)(8676002)(4326008)(316002)(66946007)(38100700002)(86362001)(83380400001)(186003)(41300700001)(478600001)(6486002)(107886003)(66476007)(6506007)(66556008)(26005)(9686003)(6512007)(2906002)(5660300002)(33716001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bGpvwkxTQbxi7gWMdQa1TKcqvTHrSdY1mpdMLgfT4Oxpej9ioROvcJr94tiZhSsp6aMg+xRQMIL0U1l92M4g8a3tGJGvN40SMVEskmQaiWyE4cZqgeXH/0HtxIjAvWkvjRkYUSOsnmKrkRD0Of6NFP0ReVlmrevH/KZk5UVSI7tH6tWH3IhNWdnar5+vIyUNLGBaSKXSUq7UwEzfquhEl1MtjMx3ys6swCcxchmtr83QRHfZY6amcNDbKnMBLWyTDs65HLqTWKmUN1ZE7Iy018xdUCBw9+WtDgpYiqBlS8Nj9WNfAz4FdarYugoIaRtAeA6AJtcX7FdfuSW7DCE74wJekt3hoRPa5INYI2DI4c+fabDiQi5n9sisGZ1ZOb4iUEwf/ijxHc3PMdrIm0B771Fe9Fr2Eox9ohv2AUbScoX5qWACIGUUSKbhs32h+Bcn3TYLRK7svlrHlmKVAYBlpNF5J4KDN9WSGSRu5Tyd3vmX+SAokw37SagTWNNUg+tvA04KKw0xjZYTniZdI24PRS5o6s4fAc8MgUZW6vXeuw3/xtZ6WMZ/cV9A0yHuMXwKGuWt4J8gEzLZCKDELX0423O3rhVXhVNpXQMIV2gqQHKnQ2FDrSQj2uGxvlqfEa26gNWw3/4FsEgzSKlci26NI7kOuPrrdvPVfiPYFcks6/WL86JFNsUafXKVuq+YHJpIyowDvE0sCHSQcR1vA6PrFtoi6/MajYgVsFe8be4sLVsK3vq7QlfP4lSvl6BX1yT6/bP5KqK0x3YyvPYuf73MrSiM7qDQ3VtafhloYp+mVa3IxZ5lPc5XWtD7uTzS6jQpsZJ8KTBvkkq6f5YJ6R2HAufc4QOK32s+NUNQbGYurCZzw6KBTRWiZtiA0/CHBUaiJ6tCs6PgPcGgU88BluKcvh3BTnOYcuLqr54iSlfR5ssqa3sKKIUMt+pe4c0Upt3MGBbMKyzGu/C8N5XMUHCzYEWGgQn5ETQ8srQ9y/MVkNepyjfN0/SEPrrX/mQk58POb8V6Vgu5sAw/6GxAvOi6OItigOTiVdDsju8ieRIXWp3S5w678i5xkbtlMkJ/0bRFwGZSJ66VXylaiuPHlz7vwje9MkJtgBE5hwyc4Ezl45hjhgZFR8rXXc6swGQgPQ9r6EWzhD1Y2wPOrgA6iBiag5xl1TVxtk8RKQeWMy1PkMh4vzCcGiPNy7yxnB5okC93/R9tdDZpgUgjbHmZG9PVNxZJIDlwsj7c5tyZ/dfbCsDhVNbOslaQ3rnCYdogsUY2MvPpJeUXQawdEQBaQFvAf7dUW8VNEhbV8NyQ3T6ueSlLByZ8P8csv7z1oNYBug9VPvWKm0Y10KMtnmVOSBWEyviP90eDVl6SczRrw31Aa0wbHwcvXuoxrmH8QgI/oiIk561B1RZBSnAwX9n5bSzMpzWfKy8FBBoS3UNShKzORx12prIDUDj6SPH+P3t/3/qLotG5r+oSsQUjffnjwRm9aQLhoSRK4xm6yjn8kIRcxwjXNPocfRvyDQburGCu0+wc53Hztx8Z2ss2tz2fPWL0Jr7DUKqA7j95eXhLBziCKh8MR4ygDVfZLPSR2FuHb9JG X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1208808d-e559-47f8-8d06-08da979c6672 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0801MB3767.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2022 04:32:01.6759 (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: NbpMpYKE3mIc6KyjHUeKOrlA1lpBv2W5g1JKBw8wCgCiOvq5++Ni6gq8PguVbkEeVccZN3RLaeVwSxdUdfl/GA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR08MB4132 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 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 Fri Sep 16 04:32:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 12978121 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 F151CECAAD8 for ; Fri, 16 Sep 2022 04:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229674AbiIPEcO (ORCPT ); Fri, 16 Sep 2022 00:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbiIPEcN (ORCPT ); Fri, 16 Sep 2022 00:32:13 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2063.outbound.protection.outlook.com [40.107.102.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27BFE6E883; Thu, 15 Sep 2022 21:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TGRtGcTAOlMkPOpeFXL6u2UyQXTDf4kz29YWLY4xoIMUhreDVCtIo4Fv2/FSJvoLOvQhZeH3gXXt6DnP7xXL+tH/Q0tQ3Uj0aBulqxyWMgTLYGJaEQCDQh1yzR6+AvOtywZr7WORaa3HNS6EX4Vnazsy8TWN5cH+5ITwi6VWpw+iGi9zWUgvPi5msWaQFhPxytEkt9hjD8kbvmAed0pZQRsgRNWp27YZDDpZ/4hAtxKIucrAs59exsFghbP9gXi3R7+jGwpVd6sZmtFwNVkg4ACE9771uZ0EuQrIGEEgJMAy++Dxgn5AihbpFQNLCQal7jQhPOC0m7ssBuNEyvvd4w== 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=D8MlTu4KHP0MjETakQ8o+bOspUeLSihO1HWlfhMQGng=; b=mv0vPS8C6ZmoOjH1bc3+B6BVeXcGfWpR2OPP3/GCSe4vgDWG2ncSSqK6TE5oGyWR4E1UBaJu8jApbC+uO6qot9X3rLllBeTxrClu9tqEPX2+CcCjsPDJwIdsGe/P1dwLPXfOvH2vImtx66OcCUur1vYzLIKXt3VzQ3GsTEJUkpA13MSINOGLyIr6cTrG2Y+bC2zb8bnorlj4sIDVLwcqVSubPsMnKvdbQWQXDCslrb6T1jCJx55+Gagc3dke/aUE8ZWBt5EKek25sK4NX9uh+VVEIHtV0CfS5KWsuYamnNHE+Fo5fClD2cNOH7qrtwLZz6yZ4rvBgRV3E+mYNkBXmw== 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=D8MlTu4KHP0MjETakQ8o+bOspUeLSihO1HWlfhMQGng=; b=B7Io04/wtsFHLoKTZX8PSPrSMk9TrKnyp0akLbb2jyVX3pbS9opJOdunInMn8KIJChhWaxWWT+ZaiZho7AHhXgc3CVgOXjaHU8U8tY/38SUGN/fCcuYEXfp1IEyQr2z4Ut5TDg8I+xMCMifFoluKTBh4fb16kWldlNktZhg6VQo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=labundy.com; Received: from DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) by BN7PR08MB4132.namprd08.prod.outlook.com (2603:10b6:406:8a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.16; Fri, 16 Sep 2022 04:32:10 +0000 Received: from DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba]) by DM5PR0801MB3767.namprd08.prod.outlook.com ([fe80::446b:5d19:f4ac:66ba%6]) with mapi id 15.20.5632.016; Fri, 16 Sep 2022 04:32:10 +0000 Date: Thu, 15 Sep 2022 23:32:09 -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 v2 7/7] Input: iqs7222 - add support for IQS7222A v1.13+ Message-ID: Content-Disposition: inline In-Reply-To: References: X-ClientProxiedBy: SA1P222CA0050.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2d0::25) To DM5PR0801MB3767.namprd08.prod.outlook.com (2603:10b6:4:7c::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR0801MB3767:EE_|BN7PR08MB4132:EE_ X-MS-Office365-Filtering-Correlation-Id: b96783b1-5973-43d7-96a2-08da979c6be7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YXRKrDHNj7eDVVYftHK8KDlCN2588C1XVrM/9Z35NzqDc55WxJGnGA+GN6bCro/OdKHZJxfiuuhCkQA9hgmEsNXf3BnwUQ89McV+Aq0cmQIRS2C96tqN6yN42d9ScLGX53KWnGEDf8f+0oC8ktHHIhoQCCItESMHT1NE9xFVVVB4YNY6RPWUdekRu6VrWpBSi3ezfDB3hjuh7yqC84tg+NjNOJ6MmB4h2TQ98cK8cOt2PiCbWoCkJV4gAgAytBY9k5xNZdvYn7X5LNo9DPL1hUDYW80hfCxSJV28c1FW80Vyl7VpyKXm9F6vDWQ5rfUKl9EdyuuJXHl1Ytc3UI0zC4XJ9TNNE4S3Rd7pQhs3zM6mkk9q4GNLnG76mCFZ2BtTgMKeiGizb8tkRX6GQTnPQI2syM0bJE53Wfee/2YRcWadxFq7aaU2lCKA50Xk2nKio4PskC+fmz0I5JpcqbN8XVPfWBdGtYjCEnUB5DC2QvFwhOVHwpUbuyJw5IXYBhl2vVM479wd9/FjA91H3pomVEO4t0Q7AkdxyCKx+S4Tz4KPz/G/4n7qjLmFHBxMBR49MY4Mf57lOUxPNByawWG+Z1OMBEpPxsLdiBVL+ey6xsEzf4BHfXbJ6YZFC/zhH8XX4mKUWr7cOa15xcPMYhomPZwpRUZE6f5Ew+ne9XzU1uPRyJesxdj/xuTfxwvTbv3nMRfWyQWEWJKCK56uHO24iA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR0801MB3767.namprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(7916004)(376002)(39830400003)(136003)(346002)(366004)(396003)(451199015)(8676002)(4326008)(316002)(66946007)(38100700002)(86362001)(83380400001)(186003)(41300700001)(478600001)(6486002)(107886003)(66476007)(6506007)(66556008)(26005)(9686003)(6512007)(2906002)(5660300002)(33716001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R58JMw1NtVLoBNzgQl+n8saVE6GzwYz934mRbL5e9QY8VZGPwXtb+7naaHbtStIx4oluKH+au9l9XxuseenCVCY83y8KIrZRhuqeoHa7GhpR9H69ncA3NNY3P8WTHDUHS+44hI5BXaIsh8zH+09H+g7cm3pCQ2b661LlEgbXBZYfbpncrs3T/K6k2DGvFNNWmWPR0p+nCwY2zGfOrOjm2Z/SQhle/SxBUktLYAqkE0/0Pj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6zUV+zdmXxDW1RFJIF8QLY7SsO9qqbYfqvJT4nhWpUgFkikLwTU2n5ClcT4JOhBHRnUZ5awBBXZsHyM0LEcCDTfonpJn85JoosHQVbsGQ6Qm1KG0kkWq67G4Rpn4/1/gmTe8kJo/unlVJs3ghQlUdNlYgFgEjUS0SLHmJQ2Dz1fylGqe3X2Z1qhg5AHnM5r8Oxf9i599FxISVJBauRvGvl2PjqI0nNxS9asZTgVyk4hvjB/FCCTjuSRXBkpUoFUHx4iizy+htm2yU3djedsjOydSGOMXlNohrNRW9bNWJrv X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: b96783b1-5973-43d7-96a2-08da979c6be7 X-MS-Exchange-CrossTenant-AuthSource: DM5PR0801MB3767.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2022 04:32:10.8628 (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: j32kHz4Xd1P2EMlrX9sMRhbbqJbJfF6VlA5Cwq7vg3IMuqpjF9KFFlVEm3sQvXlhUGqEqNf+yLEo6qwtT9RFpw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR08MB4132 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 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 0a592b90f471..3340de51fb2d 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", }, @@ -2133,8 +2234,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;