Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp834333imm; Wed, 18 Jul 2018 11:28:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfgpHNlYSPmx1+u9twlLBUsvZMIrh1++w2sHqhmgGSnRqK1ahgW9NvDByUV0xdp9sE8NaI7 X-Received: by 2002:a62:dc8f:: with SMTP id c15-v6mr6280720pfl.155.1531938510021; Wed, 18 Jul 2018 11:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531938509; cv=none; d=google.com; s=arc-20160816; b=VmMF6B7fDsO1/iUGBkOZpqDwqzNTYkgCdKDYZWR69YUlK5fNZqeskga9X+eevJdR/m U5/ZILYbzou4UVZPzhsz9nq/Wul1rL2ZASpLl2tAHsSDJa0EFRNEmf3AdSRS+yilLC2/ xkGswX7pEGf7l9aAB+n/RVXjl7K9zlsYj6qG3yak6/p4jOigejz9XHJLrFqa02OhBXdv k2dzEC/Xxoz6EWT1RZwk3/dVXHXl9nsWzMCLYa4uGWIgYyqc4CcQZHL3los1uss3qS+x MzuKeTgtV2D7nNnC9RBca7v81OqOybiE+Pu1YYMVqm9dpe4g9wmJWmsx0gflqx53Iq5s tONg== 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 :arc-authentication-results; bh=dtqL1yFtFl8y4+emY4ZD2mcyduiKewzG7FoCDvBFj0w=; b=OA6RYh562iGXY6wl+rLkArCxzzoHyswNhB3vpYmz/MycFQjDx3+HwPha1BVhtFICPs wR8JAz5rMRNvGic/CC9QR8M1hGkwgk4PHfIzhHymbtOciIILCh8J1eEYe9Q6hcXnVQl7 j814iJLA1oVY8yxYd3WsmZKDfZmLxfIhRiZntbBTD7Us9scZ5Sp2U4h5n/mXvo44u7X/ LV3JptdNMB1LZO0SXOaCcyYAU4SfLLj6rIzEMU6ncAWR27Ok+g75WViaD9zXYTPQxxPW kAnU9oqmY48G+9hx4/GPgOVMDnpw7pM+DMkuIj8Zptq4xSObuuUOu9uttQ4RAwWdlIzT OvMw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10-v6si3980150pge.624.2018.07.18.11.28.14; Wed, 18 Jul 2018 11:28:29 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729280AbeGRTGo (ORCPT + 99 others); Wed, 18 Jul 2018 15:06:44 -0400 Received: from mail.bootlin.com ([62.4.15.54]:36593 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726992AbeGRTGn (ORCPT ); Wed, 18 Jul 2018 15:06:43 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 817F120884; Wed, 18 Jul 2018 20:27:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from dell-desktop.home (176-137-37-244.abo.bbox.fr [176.137.37.244]) by mail.bootlin.com (Postfix) with ESMTPSA id D2A5F206A6; Wed, 18 Jul 2018 20:27:32 +0200 (CEST) From: =?UTF-8?q?Myl=C3=A8ne=20Josserand?= To: dmitry.torokhov@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mylene.josserand@bootlin.com, thomas.petazzoni@bootlin.com Subject: [PATCH v3 1/3] Input: edt-ft5x06 - Add support for regulator Date: Wed, 18 Jul 2018 20:27:17 +0200 Message-Id: <20180718182719.29663-2-mylene.josserand@bootlin.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180718182719.29663-1-mylene.josserand@bootlin.com> References: <20180718182719.29663-1-mylene.josserand@bootlin.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 Add the support of regulator to use it as VCC source. Signed-off-by: Mylène Josserand --- .../bindings/input/touchscreen/edt-ft5x06.txt | 1 + drivers/input/touchscreen/edt-ft5x06.c | 29 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt index 025cf8c9324a..48e975b9c1aa 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt @@ -30,6 +30,7 @@ Required properties: Optional properties: - reset-gpios: GPIO specification for the RESET input - wake-gpios: GPIO specification for the WAKE input + - vcc-supply: Regulator that supplies the touchscreen - pinctrl-names: should be "default" - pinctrl-0: a phandle pointing to the pin settings for the diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 1e18ca0d1b4e..aa94494b06b5 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -39,6 +39,7 @@ #include #include #include +#include #define WORK_REGISTER_THRESHOLD 0x00 #define WORK_REGISTER_REPORT_RATE 0x08 @@ -91,6 +92,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; @@ -991,6 +993,22 @@ 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; + } + tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(tsdata->reset_gpio)) { @@ -1120,20 +1138,31 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client) static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); + struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client); if (device_may_wakeup(dev)) enable_irq_wake(client->irq); + regulator_disable(tsdata->vcc); + return 0; } static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); + struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client); + int ret; if (device_may_wakeup(dev)) disable_irq_wake(client->irq); + ret = regulator_enable(tsdata->vcc); + if (ret < 0) { + dev_err(dev, "failed to enable vcc: %d\n", ret); + return ret; + } + return 0; } -- 2.11.0