From patchwork Tue Mar 23 02:10:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff LaBundy X-Patchwork-Id: 12156621 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 345B0C433C1 for ; Tue, 23 Mar 2021 02:11:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0198F619B4 for ; Tue, 23 Mar 2021 02:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230034AbhCWCLF (ORCPT ); Mon, 22 Mar 2021 22:11:05 -0400 Received: from mail-bgr052100131047.outbound.protection.outlook.com ([52.100.131.47]:49282 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230001AbhCWCKg (ORCPT ); Mon, 22 Mar 2021 22:10:36 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aHFuPIhUAlCRW7gY5DDpr/VjU8zg5Q8NGx4JzL5ewmhEy1ORSH+0HY1PWhbTUJBkqaRtYCyJPtU+4KVQGgxNMwg3RAViIY/uL1fqtXcB4+askMldAKHK3EZS+oJGpwJbBzWmTp5Joz04VACvh2LyuyiFIQMme2P186Og70f98gyW2zJofY8cIsjLANa3C/yQMLvIids8A0kFQtyoOtE2tTcr+eRfD8Og7W7JheC5MaVReRrUrx+Yeo3r2J4RPN8lCJe53x+EVUsmbqT9Sbbs6thN4IbMsM/wldOSwG+KDFMM/F+jv3DvmEU/cMY7VBUus+12cMD0hWW39c7SuBSDgQ== 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-SenderADCheck; bh=5/oJltLfsLgrFaqK36SaYKcOpvYOjHrEdkY0++qn5aU=; b=gKeevjVJnQfIM/gxsC1m04ju1ZXcdYc9FZkgI5jtuxbESpZh1sApz0M0yUhOOe92iuG9W1K0bu5tUC5t0C4+4FVm7A1c9cXhXxMRSHXnisBvinhcXonlOJOK5U0ba9fo5Gfr5nOBzaDoDgDwro3MOWPIJeCWLoW4ZBnxSR/5fOpx4uastI6/4WlYEJOBdOygA6buqxi4zEMwLWdo2CgVSPxJzkh3hAJmbIKPtwFVTg7mpBnR8FwyVTYqBnj8xx2FkL9xGAEMCC2GbAH+wsFRFwzrGc/r4NXA8WYXbA/nxnuelKT8ubIRCQEVmVOv+t3w75CSVfO900qs1w8hWxTfWw== 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=5/oJltLfsLgrFaqK36SaYKcOpvYOjHrEdkY0++qn5aU=; b=ZGXjd0a2neZmQZEUeVf93GV9nfovuBaEBuPtxwOWiNjXOgTdsmisOJinSfk3JkECJ1LZ2hTUlHkSwX8ZI31hcpIlBcsFKePVvGFaf88Phu+ToTl37iWshHgobqV0FSPdJz50CponQ8hQmY45BoPQh8Dkfc1B4+VIFIeNVmE4szU= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=labundy.com; Received: from SN6PR08MB5517.namprd08.prod.outlook.com (2603:10b6:805:fb::32) by SA2PR08MB6555.namprd08.prod.outlook.com (2603:10b6:806:111::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Tue, 23 Mar 2021 02:10:29 +0000 Received: from SN6PR08MB5517.namprd08.prod.outlook.com ([fe80::d443:cdc3:d44e:d1c8]) by SN6PR08MB5517.namprd08.prod.outlook.com ([fe80::d443:cdc3:d44e:d1c8%5]) with mapi id 15.20.3955.025; Tue, 23 Mar 2021 02:10:29 +0000 From: Jeff LaBundy To: dmitry.torokhov@gmail.com, robh+dt@kernel.org Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, Jeff LaBundy Subject: [PATCH v3 1/2] Input: iqs5xx - make reset GPIO optional Date: Mon, 22 Mar 2021 21:10:05 -0500 Message-Id: <20210323021006.367-1-jeff@labundy.com> X-Mailer: git-send-email 2.17.1 X-Originating-IP: [136.49.90.243] X-ClientProxiedBy: SA9PR13CA0005.namprd13.prod.outlook.com (2603:10b6:806:21::10) To SN6PR08MB5517.namprd08.prod.outlook.com (2603:10b6:805:fb::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (136.49.90.243) by SA9PR13CA0005.namprd13.prod.outlook.com (2603:10b6:806:21::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.22 via Frontend Transport; Tue, 23 Mar 2021 02:10:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ec9f9bb-f232-4add-836f-08d8eda0d493 X-MS-TrafficTypeDiagnostic: SA2PR08MB6555: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PR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zctc1OKR1vKM0+yG/D/t0isu0/srzPjTXefRACPgDK1b X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:5;SRV:;IPV:NLI;SFV:SPM;H:SN6PR08MB5517.namprd08.prod.outlook.com;PTR:;CAT:OSPM;SFS:(366004)(136003)(346002)(396003)(376002)(39830400003)(16526019)(38100700001)(6486002)(66946007)(86362001)(186003)(8676002)(66556008)(66476007)(8936002)(107886003)(1076003)(956004)(26005)(6506007)(4326008)(52116002)(83380400001)(478600001)(316002)(6666004)(69590400012)(5660300002)(36756003)(6512007)(2906002)(2616005)(42413003);DIR:OUT;SFP:1501; X-MS-Exchange-AntiSpam-MessageData: +rWwMGEyAimmMpUHCDYPD8W7KquvhJEv1l9ewbhzjVWKLuvCiOMYACmL0QotaltyoCkjDjsA3Jy7vhlRGwedeWUz0LF5Czolh8EXWVU+Owdw85ksZ3xIQepfMsoZy/JUV2QUEm6H2lYTH4OpM43eZNTAotILfmnCWWPRXjsczpnfD8nXCfIPCcbRSjxDelkjbz1CCU9srs75QxQKwZbEbbf3SXv4XnalcvUvievLzaGzYzrU8+sw6Ik2kVo+idAQQbu0cGGoVZ/ldVNGfLjHF/3XhVa7THR9hYRP0Iccwfhr6PD12jluBGHGdltzwrS/jAti2Nr6l7zpUtEW5AJS5R7ikQ4B0gd/edJWaGsdgU6Cb1kZD6ZZc6UH1tFDkJZR4mLWX6a4M2xy3xnb8DXjY9EXP+XzVDpqLlu/n01qZjBl4UkCRVFuY4tufVI322ZBKzRh8Ccopw8gBMjTmjX7sBc5xx/PkFF/bEgTL7VprfY/Z4yIAYfNolFGnQzwKwHoIjJRus/OXo8TG3mkVT9TFC5LXQZGFFTeyqKF9jAibrMd0Y3bD0f1nhIM5YjUYq0NEQiuSdhl2uyWLpRCoGMUcHQpYEFOF4vGKXje2Ne1TjnAPhn2ZDuR94E1x3u+7xZKyqn+vhyOUK/MnZpIdZnoMM80lVTiVw/1Cd1tHYHU8P7cU9xWKh0ucb4tiS4kzAKbZvq0Y2ZVTlYbD9QqEsuGzKfQivHL+uk3HQSpXwrRJR8G7hZE0iSMhmR9N09pvNRYj7DvLZoaApyRODxUOGmCE/JBWLbaNU80HID1isXC4p0+GUYfOhFTwyQXwcakzbGaVu5UI5mOeHv4MYErI5KY/ACe5OuTvt0hWjpX3jdrPEJzG+5g1fYZUbAbain7Cx0eqruImBtRFQUTFxghkkssxpweHNT1AYi8Waw/kRqRI7vJMD6O9uBTY489578VRzVZLY5kSjth1YaHDhqQ2LttKXvkkZWpVmoY3wE0MV1KwX3XVZPvgAuXyuIkiEKftVoRaI0U6PpvGopXGG4+NdTB0b+CDpPsWBsFH9TUlahLDzP5GOLfLhb8jmnj+c0ZIlNIQgFcRgkgn7crjl+fgFTUKBDMss8TCwlDKZ+60/G4elFgC5pXNhZq/J4RmJMDNp1hVwnUQCZoNghjT+RvxZBvJZnz0B+IvEFqQWiCNS4oi1Gzq9m4fRuCf0zyEnFjACijaygm3mu3Pxifwbv9DnDY1hq9X4CnG935JJ4NLXqZRd840MFQqTbFmOA8rHk6QMaVZCZblFfxqIWFru2VdHAySrON3cmPO6dkHg+5aoFSY68U6A0U2rPBuH0rTW58hE8N X-OriginatorOrg: labundy.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ec9f9bb-f232-4add-836f-08d8eda0d493 X-MS-Exchange-CrossTenant-AuthSource: SN6PR08MB5517.namprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2021 02:10:29.1381 (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: /FEk1ZPZjvT/fy95OUR+DJdjqzNKxSJ388epobYl5PqjcLT6xnxv5IkfabADPFgpZ6ZECS8zk16h/ms83UxQ0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR08MB6555 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The device's hardware reset pin is only required if the platform must be able to update the device's firmware. As such, demote the reset GPIO to optional in support of devices that ship with pre-programmed firmware and don't route the reset pin back to the SoC. In that case, the 'fw_file' attribute is hidden because there is no way to open the bootloader. The logic is extended to the case in which the device does not advertise bootloader support in the first place. Last but not least, remove the hardware reset performed at probe because there is no reason to reset the device manually. A power on reset function already ensures a clean reset at start-up. Signed-off-by: Jeff LaBundy --- Changes in v3: - Added iqs5xx_attr_is_visible() in place of conditionally registering one of two attribute groups Changes in v2: - None drivers/input/touchscreen/iqs5xx.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/input/touchscreen/iqs5xx.c b/drivers/input/touchscreen/iqs5xx.c index a990c176abf7..b3fa71213d60 100644 --- a/drivers/input/touchscreen/iqs5xx.c +++ b/drivers/input/touchscreen/iqs5xx.c @@ -835,9 +835,6 @@ static int iqs5xx_fw_file_write(struct i2c_client *client, const char *fw_file) int error, error_init = 0; u8 *pmap; - if (iqs5xx->dev_id_info.bl_status == IQS5XX_BL_STATUS_NONE) - return -EPERM; - pmap = kzalloc(IQS5XX_PMAP_LEN, GFP_KERNEL); if (!pmap) return -ENOMEM; @@ -963,7 +960,22 @@ static struct attribute *iqs5xx_attrs[] = { NULL, }; +static umode_t iqs5xx_attr_is_visible(struct kobject *kobj, + struct attribute *attr, int i) +{ + struct device *dev = kobj_to_dev(kobj); + struct iqs5xx_private *iqs5xx = dev_get_drvdata(dev); + + if (attr == &dev_attr_fw_file.attr && + (iqs5xx->dev_id_info.bl_status == IQS5XX_BL_STATUS_NONE || + !iqs5xx->reset_gpio)) + return 0; + + return attr->mode; +} + static const struct attribute_group iqs5xx_attr_group = { + .is_visible = iqs5xx_attr_is_visible, .attrs = iqs5xx_attrs, }; @@ -1020,8 +1032,8 @@ static int iqs5xx_probe(struct i2c_client *client, i2c_set_clientdata(client, iqs5xx); iqs5xx->client = client; - iqs5xx->reset_gpio = devm_gpiod_get(&client->dev, - "reset", GPIOD_OUT_LOW); + iqs5xx->reset_gpio = devm_gpiod_get_optional(&client->dev, + "reset", GPIOD_OUT_LOW); if (IS_ERR(iqs5xx->reset_gpio)) { error = PTR_ERR(iqs5xx->reset_gpio); dev_err(&client->dev, "Failed to request GPIO: %d\n", error); @@ -1030,9 +1042,6 @@ static int iqs5xx_probe(struct i2c_client *client, mutex_init(&iqs5xx->lock); - iqs5xx_reset(client); - usleep_range(10000, 10100); - error = iqs5xx_dev_init(client); if (error) return error;