Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2749586pxb; Sun, 29 Aug 2021 02:22:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2RLDJenHtCENu9M0+EGIHtvURdIYNjjaLs7nIMInGqLFYsiVw33/A+4bakN958OcMO6iN X-Received: by 2002:a92:c841:: with SMTP id b1mr12691664ilq.300.1630228958797; Sun, 29 Aug 2021 02:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630228958; cv=none; d=google.com; s=arc-20160816; b=hqDG9ujKob+N90U89eRmKwc52zfohzvR3PJpcViqBqRatGFfBTUWeDJwRAwz7cqaG+ TN88dCXhDXHBbBsR3r8s8XDJo0ikd18YHtfoDXuesn0OhEmwSzRX/492mOZd2s7Pga0u 6smRc6T10LSqjPLNZiepK5az7IQ5fcqiKLi8A3Tavai4sE2NxzYphv/4uQwwKN0j0zQq x4xdNw80zf72At1WA6lXU2wOeeueNkah6IOKm7wR/t+h5+IphQ68R2qRIfOwv4ekWtst 37c4NIY6KTzBNcXVzJHMH2Qla+EyEHrwg35GBiYxBsynNChJ8tE/ago/cj1COkzVoH+S M/nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=j08Pns4+NlfOmWdwOrXi5G1T1B1NXvmyECCHk9+fUro=; b=V9kzboaFC7fShrki6gw3P7wyBYxxzqw+9Ta7GugWmNB/gpI+URvPZO4InNsozXOaKB 4K0cxEKvZy8qlMpxtumcOtxGZ646PlqA7driF85qmhF1lWjZT/7ZTQCYI3yA/FDH39ct jKSmG5vdnoklrYq+5W1vshtDPpM1imdTNrXPEB9qpoRXvMSZy4v9BdDgGfBlzg749WNg a+72TyZ19IZQXxUdlL0XuiQtRp/JMYEY/qQ4I4V/d7ODFEXS3eN+IIhrF2T4soBNZY70 UPl4FBArxdX0op4WuaitSJSbdVkYZW3ZPcGbwvuA84H62A7jdAPzmv9QUG+h/aGCAGNZ wh+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alistair23.me header.s=fm2 header.b=c07KQcnV; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=q5670IIO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x8si11311780ill.70.2021.08.29.02.22.27; Sun, 29 Aug 2021 02:22:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alistair23.me header.s=fm2 header.b=c07KQcnV; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=q5670IIO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235025AbhH2JVT (ORCPT + 99 others); Sun, 29 Aug 2021 05:21:19 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:49883 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235037AbhH2JVQ (ORCPT ); Sun, 29 Aug 2021 05:21:16 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id B1BAD580B14; Sun, 29 Aug 2021 05:20:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 29 Aug 2021 05:20:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alistair23.me; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=j08Pns4+NlfOm WdwOrXi5G1T1B1NXvmyECCHk9+fUro=; b=c07KQcnVosDVNiPrwsc+ezXMzW0oy fX0nJ3+hOSM1kKJFgQtEdn81R4QuWHKJGCEC436+3Gkm6T+81+SAJ8W71i1OBD0F wvyo9G59hgA1lYG8pOJb+3vwVtV3LUrhhZBXAJ3kPaAa8zsrXbiwpxjJWokmGiV8 E1HnUg/NTzLJpR8HfcnGBadJYM9U6vtLdtplNwvjUvZhsHjM3zCYsK+KZ2slH3Ar 0JcfHB8jJ1NmX97KzG8PAB7fbhYCc/EDKBwnIQjTzrUaD7tN+BIwx5YR+kJeLp+i NufoFtv13rBsGaiQTXKznyUdOpOP+FwN586UNm/BcGU9bM8VGKTS6B09g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=j08Pns4+NlfOmWdwOrXi5G1T1B1NXvmyECCHk9+fUro=; b=q5670IIO qyZ9XHNQMYVV4NfMcatRP7NS4SMaMxKJvhQGoJ1x4dZhzcZjWaF8FSX89pOdjDb7 gs4Y30Q7Tf5iBrWio9YTo4WsgrHH1xnH2BWQLW82zYtG3h7Vrwub75uBz6qBNK1B 8YOVzmzuea/I7N6rwSIGK9LRsGjCnjzKvUtWU9HKSqpd4o10AwG0F/tt6TtKqn+F wmztU1N1vSIDP/bisDO6Do5dTAtmsvqPcdt6TEg1yjqTIvAqfL3qAU5mzH2ZFLNp 2qhh10Oq/Stl3qHKdX+e3GtOb292eO7Xk8C7AlnrTBzup8dDW0G/6DOwcnoda2WY c6zpE+43mJLYtw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddujedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlihhsthgrihhrucfhrhgrnhgtihhsuceorghlihhsthgr ihhrsegrlhhishhtrghirhdvfedrmhgvqeenucggtffrrghtthgvrhhnpeeggedtteejke eggeeugfehueevudegvdetjeeviedugedvtdekffekhedtteduhfenucevlhhushhtvghr ufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhishhtrghirhesrghlih hsthgrihhrvdefrdhmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 29 Aug 2021 05:20:20 -0400 (EDT) From: Alistair Francis To: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, pinglinux@gmail.com, tatsunosuke.tobita@wacom.com, junkpainting@gmail.com, ping.cheng@wacom.com Cc: linux-kernel@vger.kernel.org, alistair23@gmail.com, robh+dt@kernel.org, devicetree@vger.kernel.org, Alistair Francis Subject: [PATCH v10 08/12] Input: wacom_i2c - Add support for vdd regulator Date: Sun, 29 Aug 2021 19:19:21 +1000 Message-Id: <20210829091925.190-10-alistair@alistair23.me> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210829091925.190-1-alistair@alistair23.me> References: <20210829091925.190-1-alistair@alistair23.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for a VDD regulator. This allows the kernel to probe the Wacom-I2C device on the rM2. Signed-off-by: Alistair Francis --- drivers/input/touchscreen/wacom_i2c.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index a35d8fda7e7b..13341e76368b 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -92,6 +93,7 @@ struct wacom_i2c { struct input_dev *input; struct touchscreen_properties props; struct wacom_features features; + struct regulator *vdd; u8 data[WACOM_QUERY_SIZE]; bool prox; int tool; @@ -278,6 +280,16 @@ static int wacom_i2c_probe(struct i2c_client *client, if (!wac_i2c) return -ENOMEM; + wac_i2c->vdd = regulator_get(&client->dev, "vdd"); + if (IS_ERR(wac_i2c->vdd)) + return PTR_ERR(wac_i2c->vdd); + + error = regulator_enable(wac_i2c->vdd); + if (error) { + regulator_put(wac_i2c->vdd); + return error; + } + features = &wac_i2c->features; error = wacom_query_device(client, features); if (error) @@ -286,8 +298,11 @@ static int wacom_i2c_probe(struct i2c_client *client, wac_i2c->client = client; input = devm_input_allocate_device(dev); - if (!input) + if (!input) { + regulator_disable(wac_i2c->vdd); + regulator_put(wac_i2c->vdd); return -ENOMEM; + } wac_i2c->input = input; @@ -322,6 +337,8 @@ static int wacom_i2c_probe(struct i2c_client *client, IRQF_ONESHOT, "wacom_i2c", wac_i2c); if (error) { dev_err(dev, "Failed to request IRQ: %d\n", error); + regulator_disable(wac_i2c->vdd); + regulator_put(wac_i2c->vdd); return error; } @@ -331,6 +348,8 @@ static int wacom_i2c_probe(struct i2c_client *client, error = input_register_device(wac_i2c->input); if (error) { dev_err(dev, "Failed to register input device: %d\n", error); + regulator_disable(wac_i2c->vdd); + regulator_put(wac_i2c->vdd); return error; } -- 2.31.1