From patchwork Fri Jul 15 12:51:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nuno Sa X-Patchwork-Id: 591026 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 5BD0ECCA48C for ; Fri, 15 Jul 2022 12:51:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233005AbiGOMvG (ORCPT ); Fri, 15 Jul 2022 08:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232685AbiGOMvF (ORCPT ); Fri, 15 Jul 2022 08:51:05 -0400 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A26F146DA0; Fri, 15 Jul 2022 05:51:04 -0700 (PDT) Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26FBxuMO011643; Fri, 15 Jul 2022 08:51:01 -0400 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3h73h7ca5q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Jul 2022 08:51:01 -0400 Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 26FCp0TY062923 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Jul 2022 08:51:00 -0400 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Fri, 15 Jul 2022 08:50:59 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Fri, 15 Jul 2022 08:50:59 -0400 Received: from nsa.ad.analog.com ([10.44.3.55]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 26FCoXmP002053; Fri, 15 Jul 2022 08:50:53 -0400 From: =?utf-8?q?Nuno_S=C3=A1?= To: , , CC: Linus Walleij , Rob Herring , Dmitry Torokhov , Bartosz Golaszewski , Michael Hennerich , Andy Shevchenko , Krzysztof Kozlowski Subject: [PATCH v2 08/10] input: keyboard: adp5588-keys: add optional reset gpio Date: Fri, 15 Jul 2022 14:51:36 +0200 Message-ID: <20220715125138.378632-9-nuno.sa@analog.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220715125138.378632-1-nuno.sa@analog.com> References: <20220715125138.378632-1-nuno.sa@analog.com> MIME-Version: 1.0 X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: -4_pVWwbBtF9418pKFX73Tx6KFonQurb X-Proofpoint-ORIG-GUID: -4_pVWwbBtF9418pKFX73Tx6KFonQurb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-15_05,2022-07-15_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 mlxscore=0 suspectscore=0 impostorscore=0 adultscore=0 priorityscore=1501 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207150056 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Optionally reset the device during probe. Signed-off-by: Nuno Sá Reviewed-by: Linus Walleij --- drivers/input/keyboard/adp5588-keys.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 6a0b9f394960..51871fec97f7 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -710,6 +711,7 @@ static int adp5588_probe(struct i2c_client *client, { struct adp5588_kpad *kpad; struct input_dev *input; + struct gpio_desc *gpio; unsigned int revid; int ret; int error; @@ -735,6 +737,16 @@ static int adp5588_probe(struct i2c_client *client, if (error) return error; + gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(gpio)) + return PTR_ERR(gpio); + + if (gpio) { + fsleep(30); + gpiod_set_value_cansleep(gpio, 0); + fsleep(60); + } + ret = adp5588_read(client, DEV_ID); if (ret < 0) return ret;