Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4114530ybg; Tue, 29 Oct 2019 02:19:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTgWhj//Orf3ixkcPd5efVgzVKRKvMaXrYKjr9pP/shRNcEDTu05kYhrjR6R3tqHrvUnzj X-Received: by 2002:aa7:dcc2:: with SMTP id w2mr23992824edu.92.1572340796899; Tue, 29 Oct 2019 02:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572340796; cv=none; d=google.com; s=arc-20160816; b=jfrXw3GeC1SBFALpA+4WLodI2v7IFQB7BvLIfIy2gN1UQqW/7fmFuvcREJg7u9i0ig qWatA/7K16SGSlBmuyNCSitER/sjXhI1mBqXymsAqvarfuYvQlepMGDsW4x2uPLIkiu4 XPMQJeq0faeAA2VPtHEEee6i8YYN0xpwBgIZpku+Dfq3lY8QB09bqVG2JY8cHXUzzWz6 57TTGJo+qHX5PWQKtfRgmL3CKFi8SpUlEfkZzV9Rtbbu8sJ4pKlyi04aMpCh13WUD/L6 ez3fINXUqpNAXa80TGr/gf5zWnnV1HLqLbQnVOwTW3x02k1Kp50iFby/tuVk3yWGJLmR 80Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=J0f2I94mBgy721c4RZ5Jo64oqoRiWi1e62JyVziCIwg=; b=sL6X4qMOzKUD1UVmXtu59B20hqIYMILiBnXK8IxnsvbAUuVSo/gn28hBUfx/zyIUrO YDm20EV30t8+GYx5GRN65qe7cHa4gTJaStmzydzNRcDu2G1NvIo+sdXM3ij3HT22sL/8 cSFGTYn/DyVs+ss1Q+MUZcu+U/2gHAqLcjnq/xkTFYIB+Wv0yuBFQwSp0yZltRDT4Qg5 tFy99e5GEZFvxwMLOy490pabEngP+dvwIyHptlLh1jmZ+FSgW0qIqlDHuntVnGhGRmax 1bPIFHxtFLPuERsgcAKPOJbFdoRrnjCqwdhXMdgSwLT/wULjntEHepMBnXjYqeHIsGw1 Aw+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=mvHrNhcj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s46si10333684edd.336.2019.10.29.02.19.33; Tue, 29 Oct 2019 02:19:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=mvHrNhcj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727558AbfJ2A6V (ORCPT + 99 others); Mon, 28 Oct 2019 20:58:21 -0400 Received: from vps.xff.cz ([195.181.215.36]:51614 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727447AbfJ2A6Q (ORCPT ); Mon, 28 Oct 2019 20:58:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1572310693; bh=ti3Sk/6TB5q7r+RFOeAHsTKYq7LvJhhN9uE/t8+qFwI=; h=From:To:Cc:Subject:Date:References:From; b=mvHrNhcjSP83n3YV1+Oadkf1d0GZxaqQFq6D9A9X4b4SHBnyjFxRsU9EkebJNX+0C RM9tRvqOUcexIQIq3/1el2WgchOV9N1W/yiGlG1V+/ejb0W3tHAVuLOrtAOoawGQYF ev2KAsPhbWaa/QEnidHdfH77PLlk7oXw42Jw1P/o= From: Ondrej Jirman To: linux-sunxi@googlegroups.com, Dmitry Torokhov , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Marco Felsch , Ondrej Jirman , Andy Shevchenko , Greg Kroah-Hartman , =?UTF-8?q?Myl=C3=A8ne=20Josserand?= Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] input: edt-ft5x06: Add support for regulator Date: Tue, 29 Oct 2019 01:58:04 +0100 Message-Id: <20191029005806.3577376-2-megous@megous.com> In-Reply-To: <20191029005806.3577376-1-megous@megous.com> References: <20191029005806.3577376-1-megous@megous.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mylène Josserand Add the support for enabling optional regulator that may be used as VCC source. Signed-off-by: Ondrej Jirman Signed-off-by: Mylène Josserand --- drivers/input/touchscreen/edt-ft5x06.c | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 5525f1fb1526..d61731c0037d 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -28,6 +28,7 @@ #include #include #include +#include #define WORK_REGISTER_THRESHOLD 0x00 #define WORK_REGISTER_REPORT_RATE 0x08 @@ -88,6 +89,7 @@ struct edt_ft5x06_ts_data { struct touchscreen_properties prop; u16 num_x; u16 num_y; + struct regulator *vcc; struct gpio_desc *reset_gpio; struct gpio_desc *wake_gpio; @@ -1036,6 +1038,13 @@ edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata) } } +static void edt_ft5x06_disable_regulator(void *arg) +{ + struct edt_ft5x06_ts_data *data = arg; + + regulator_disable(data->vcc); +} + static int edt_ft5x06_ts_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -1064,6 +1073,27 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, tsdata->max_support_points = chip_data->max_support_points; + tsdata->vcc = devm_regulator_get(&client->dev, "vcc"); + if (IS_ERR(tsdata->vcc)) { + error = PTR_ERR(tsdata->vcc); + if (error != -EPROBE_DEFER) + dev_err(&client->dev, + "failed to request regulator: %d\n", error); + return error; + } + + error = regulator_enable(tsdata->vcc); + if (error < 0) { + dev_err(&client->dev, "failed to enable vcc: %d\n", error); + return error; + } + + error = devm_add_action_or_reset(&client->dev, + edt_ft5x06_disable_regulator, + tsdata); + if (error) + return error; + tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(tsdata->reset_gpio)) { -- 2.23.0