From patchwork Fri Jul 15 12:51:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nuno Sa X-Patchwork-Id: 591058 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 12258C43334 for ; Fri, 15 Jul 2022 12:51:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233055AbiGOMvI (ORCPT ); Fri, 15 Jul 2022 08:51:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233017AbiGOMvH (ORCPT ); Fri, 15 Jul 2022 08:51:07 -0400 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4318255B8; Fri, 15 Jul 2022 05:51:06 -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 26FCiX5f011946; Fri, 15 Jul 2022 08:51:03 -0400 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3h73h7ca5v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Jul 2022 08:51:02 -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 26FCp17t062927 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Jul 2022 08:51:01 -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:51:00 -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:51:00 -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 26FCoXmQ002053; Fri, 15 Jul 2022 08:50:54 -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 09/10] input: keyboard: adp5588-keys: add regulator support Date: Fri, 15 Jul 2022 14:51:37 +0200 Message-ID: <20220715125138.378632-10-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: t3d2O3JNTJEHbDpAbjk0FxV45_8Y-v7S X-Proofpoint-ORIG-GUID: t3d2O3JNTJEHbDpAbjk0FxV45_8Y-v7S 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: linux-input@vger.kernel.org Support feeding VCC through a regulator. Signed-off-by: Nuno Sá --- drivers/input/keyboard/adp5588-keys.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index 51871fec97f7..dd02864f7691 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -706,12 +707,18 @@ static int adp5588_fw_parse(struct adp5588_kpad *kpad) return 0; } +static void adp5588_disable_regulator(void *reg) +{ + regulator_disable(reg); +} + static int adp5588_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct adp5588_kpad *kpad; struct input_dev *input; struct gpio_desc *gpio; + struct regulator *vcc; unsigned int revid; int ret; int error; @@ -737,6 +744,18 @@ static int adp5588_probe(struct i2c_client *client, if (error) return error; + vcc = devm_regulator_get(&client->dev, "vcc"); + if (IS_ERR(vcc)) + return PTR_ERR(vcc); + + ret = regulator_enable(vcc); + if (ret) + return ret; + + ret = devm_add_action_or_reset(&client->dev, adp5588_disable_regulator, vcc); + if (ret) + return ret; + gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(gpio)) return PTR_ERR(gpio);