From patchwork Tue Oct 29 00:58:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11216847 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B9CA112C for ; Tue, 29 Oct 2019 00:58:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6717521479 for ; Tue, 29 Oct 2019 00:58:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=megous.com header.i=@megous.com header.b="mvHrNhcj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727532AbfJ2A6V (ORCPT ); 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_Joss?= =?utf-8?q?erand?= 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 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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)) { From patchwork Tue Oct 29 00:58:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11216841 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 069CA112C for ; Tue, 29 Oct 2019 00:58:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D26F6218AC for ; Tue, 29 Oct 2019 00:58:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=megous.com header.i=@megous.com header.b="TNSWyl2Z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727455AbfJ2A6Q (ORCPT ); Mon, 28 Oct 2019 20:58:16 -0400 Received: from vps.xff.cz ([195.181.215.36]:51638 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727228AbfJ2A6P (ORCPT ); Mon, 28 Oct 2019 20:58:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1572310693; bh=uU9Ed1alXCTlnQaio2JNHFayvG2JjVGihZ0Bc7pg244=; h=From:To:Cc:Subject:Date:References:From; b=TNSWyl2Ze999zgh7h9TR1ACGGQ+600wsxoAwo6/ah57BQv45WGNuo6SRGE63DXY8V nSNzXQ3IhZjgWgihIcrcbH+nBnLGRGmS/mpobvX0Wm/3PY5Bhi8rpDKTJfoUT7mRjl 2z6VKA1md2oeqQvdJkkb5YkUlQMqrdPyqXMl2i78= 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_Joss?= =?utf-8?q?erand?= Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Rob Herring Subject: [PATCH 2/3] dt-bindings: input: edt-ft5x06: Add regulator support Date: Tue, 29 Oct 2019 01:58:05 +0100 Message-Id: <20191029005806.3577376-3-megous@megous.com> In-Reply-To: <20191029005806.3577376-1-megous@megous.com> References: <20191029005806.3577376-1-megous@megous.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Touch controller may have an optional regulator. Reviewed-by: Rob Herring Signed-off-by: Ondrej Jirman --- .../devicetree/bindings/input/touchscreen/edt-ft5x06.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt b/Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt index 870b8c5cce9b..0f6950073d6f 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 From patchwork Tue Oct 29 00:58:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11216845 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A0B371515 for ; Tue, 29 Oct 2019 00:58:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E5C6218BA for ; Tue, 29 Oct 2019 00:58:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=megous.com header.i=@megous.com header.b="txcdpDXc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727228AbfJ2A6Q (ORCPT ); Mon, 28 Oct 2019 20:58:16 -0400 Received: from vps.xff.cz ([195.181.215.36]:51658 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727441AbfJ2A6Q (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=HlkHtBIrl2Pu/yMqJm7oISnuzbeLkbNyGnJaRkUbXDA=; h=From:To:Cc:Subject:Date:References:From; b=txcdpDXcilixDJQpryeqFSA3pevzH5StDEHTo9UTXPMnP/dL0CHe2pudqWhYQZj80 IP8Cxqot5KkvVCez+SqRfMVZHgLADbC/uFtlc51DvMQ+XmNfu2erqlQsq5GvSWYvW0 hbyaWNp7IS8AmxyaR4wpE0zuLcdVHTABra9GsSTk= 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_Joss?= =?utf-8?q?erand?= Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/3] arm: dts: sun8i: a83t: a711: Add touchscreen node Date: Tue, 29 Oct 2019 01:58:06 +0100 Message-Id: <20191029005806.3577376-4-megous@megous.com> In-Reply-To: <20191029005806.3577376-1-megous@megous.com> References: <20191029005806.3577376-1-megous@megous.com> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org From: Mylène Josserand Enable a FocalTech EDT-FT5x06 Polytouch touchscreen. Signed-off-by: Ondrej Jirman Signed-off-by: Mylène Josserand --- arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts index 568b90ece342..19f520252dc5 100644 --- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts +++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts @@ -164,6 +164,22 @@ status = "okay"; }; +&i2c0 { + clock-frequency = <400000>; + status = "okay"; + + touchscreen@38 { + compatible = "edt,edt-ft5x06"; + reg = <0x38>; + interrupt-parent = <&r_pio>; + interrupts = <0 7 IRQ_TYPE_EDGE_FALLING>; /* PL7 */ + reset-gpios = <&pio 3 5 GPIO_ACTIVE_LOW>; /* PD5 */ + vcc-supply = <®_ldo_io0>; + touchscreen-size-x = <1024>; + touchscreen-size-y = <600>; + }; +}; + &i2c1 { clock-frequency = <400000>; status = "okay";