From patchwork Sat Dec 15 15:18:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 98 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-yw1-f71.google.com (cartago.priv [10.11.12.1]) by cassiopea (Postfix) with ESMTPS id 149392E545D for ; Sat, 15 Dec 2018 16:18:33 +0100 (CET) Received: by mail-yw1-f71.google.com with SMTP id d78sf5368785ywa.19 for ; Sat, 15 Dec 2018 07:18:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1544887112; cv=pass; d=google.com; s=arc-20160816; b=vUHUiNCcW3kc9RuA5winOTRKpb+ILAUOc3Fxi2Cgd7brZU4piTBgR+rblW7Agr3fAS 6AcRdHtmTQy7cy5Q4+6+9+8ftO8nW/X4NLt7bQX3ZF2cA2rstDmwFWLjJFXAaJxXUPkN wdmZ9VPvMemJmd6VcLXVF/72PNPpcuwoCBVVfJRI7GekgYsZqE65GwIZ6l6EHXsDfeJz +chZjYKLQb6RDqLKrecRR4E7/A12/Qnli9/ii+6svwFafH46PKtSa9ZKnUICXS0W5pPy wk2EkplLPLzTpzK0pdA83S7XK0nf6s/QZFyLiYR+REJNPP+uwR8Qrw2zNifWepJmeVO9 x8Yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=duKzC7XIbmzTlndaKTXS3J2cZIplwvKfqW+lEcLnAYs=; b=YxQyDokMPx5e2nLzuqbPA7Bwxl5g9fwy+tJtGbXXpyXnLworbiDM3kdJM6DPFrOWgw 6mrC9WPSny0X3Bw+kmscGV7yPWsHNoFpelb/25jpfvQlhULOcyeLQxvdngB36I62+0m8 nr82KRv84PcF7dgHoSdrJNiewbGIq2D8CxMTedmeFu1bcmjxTu6v85GKK4SaOfeY7sOP lCT7KiUdF61xGXD29q8Vm+MjdGQj+Svp4qRtkX7jmOwy/66XLBnqo+ecGkJBZoU09R7w KAWBZyip3oj18xZDXSconkMO01+ZC1Vwy1bYsjhXgI39eFn/hwhCtA8a9hhNIe6dG2Ky zmyA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=evQM7WvD; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=duKzC7XIbmzTlndaKTXS3J2cZIplwvKfqW+lEcLnAYs=; b=IV6C1DN7qdyC58dGBcyUItrm4v7+5k2m9EXsgjRF0oHQ0P/u+tJso+3BXRWnCcJ40S tj+zav+8VrNBscZ/bzNaIXgnH5VMQBkyG4Lf5E/umx24pFlTf66JpL1NxQmvYgtnLg5z h1GQqBKiRelPjgOD2p2SiotSlLWeXwm5VumQc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=duKzC7XIbmzTlndaKTXS3J2cZIplwvKfqW+lEcLnAYs=; b=eerdLC9I5145g5aswxEDqZJNtHld8aZiPanPl1ek/Gz72mwT7lBclsUv+UuncHDt7U Tl81y92lVtkun5MptJ8dr4wP76JXBNccRkVWvFSvMwk3kwbOovlFc/47CrNkAayXVilt DMnGdLFitO1VzT1qjaImCuntQJiPb/zHLMK+0Xu1xy81DiOWZWVd2RHPQROExmgntnLL 0cRq9dYW/szMPP8aSVIzMkYiCZrXSkD2MsA/0oXOzU+YavOcDGC42gjBwO08XYPqPegr qx8NAVPHV2UqzYyEkJm9bK/boIGk93PgZH3HoNS2AvVc+FGgO/5fETKhQ+KqW94oV98o B/6g== X-Gm-Message-State: AA+aEWaTSS7p5DcRpW5yKfIYY2nkugG/TXBWoNAyyCRvezRcCSBsmZnK PBO8+u5LWZXKt/2ZXL0p+6tgXDIt X-Google-Smtp-Source: AFSGD/UdO29pkTVuKQVFvGuVdSE5WwjjNNIYrdNbr62XYlFCFx/w6DJPZ8RexMXd0ohSJ64hIMHTXg== X-Received: by 2002:a5b:f4f:: with SMTP id y15-v6mr3738866ybr.30.1544887112052; Sat, 15 Dec 2018 07:18:32 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a25:b901:: with SMTP id x1-v6ls1844543ybj.7.gmail; Sat, 15 Dec 2018 07:18:31 -0800 (PST) X-Received: by 2002:a25:748b:: with SMTP id p133mr7152066ybc.222.1544887111759; Sat, 15 Dec 2018 07:18:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544887111; cv=none; d=google.com; s=arc-20160816; b=V0pLxFf/fjFsG5Dpqbqcfyc+bQ5ePTt5hm2pHfLOKJzQ64tUBeA7arh3E5fYx3buEb FNww3prXLMzhlK7+p7COPpU+nyd67xBXxax6nRYOtf/sUR7B8a4M+wA5/0LRrpfQrcN4 LjpbSDIVN8Xq4pacrDao7X+w45MnZo7oLo6ZOnjvuAC7dUA4rRUgbOVkXW53d9eRTniK xyjeqxqwhR7sGZQuc588JnrOTgNdzt3zcylZkTAA5Hui6C+TwTYUASWs0r+pLmPzPrqX fKfOYHqpqSO4QRqs51IHQsKdFj7JOLgtwKzGScchUAhLyoICLxaXOPtcHOxmzwNMR/at em9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=duKzC7XIbmzTlndaKTXS3J2cZIplwvKfqW+lEcLnAYs=; b=VECi1uuHsDfxcPngVQE+w7eW/FwQGml7j98hkVKfB090QdsKO/vgrTqMvXjKPXtGSx lUqlatxxUbg3cT7hdbPPJzcrjJb1bStbr4eK8bK4Q1FEE9EOw1HXRazpTxGWvTkg4t5n UIUa6AwQPPXevjzokp7FXPzXI/ETJRBaDUcK0RADxtOyDFnCfKodZeKz3Qq547flBwTP fkXUMhDCvK6uAgJopQUe4nLEea9RWSBUHo5RMvj0fHM5+hHsTQkXCHJe+5Jo2SDWF/S9 mRIMszTrSTQXI5ODhMZfPBOmsEK/afRNTWNhQxUNzT7+xrJi6YXuJg59bDli9YDEjeep EAHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=evQM7WvD; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f4sor1229022ywk.87.2018.12.15.07.18.31 for (Google Transport Security); Sat, 15 Dec 2018 07:18:31 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a81:37c3:: with SMTP id e186mr7399784ywa.506.1544887111397; Sat, 15 Dec 2018 07:18:31 -0800 (PST) Received: from jagan-XPS-13-9350.homenet.telecomitalia.it (host211-95-static.0-79-b.business.telecomitalia.it. [79.0.95.211]) by smtp.gmail.com with ESMTPSA id x203sm2855664ywd.41.2018.12.15.07.18.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Dec 2018 07:18:30 -0800 (PST) From: Jagan Teki To: Dmitry Torokhov Cc: Chen-Yu Tsai , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Trimarchi , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v3 2/4] Input: goodix - Add AVDD28-supply regulator support Date: Sat, 15 Dec 2018 20:48:00 +0530 Message-Id: <20181215151802.18592-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181215151802.18592-1-jagan@amarulasolutions.com> References: <20181215151802.18592-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=evQM7WvD; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Goodix CTP controllers have AVDD28 pin connected to voltage regulator which may not be turned on by default, like for GT5663. Add support for such ctp used boards by adding voltage regulator handling code to goodix ctp driver. Signed-off-by: Jagan Teki --- drivers/input/touchscreen/goodix.c | 33 +++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index f2d9c2c41885..7371f6946098 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ struct goodix_ts_data { struct touchscreen_properties prop; unsigned int max_touch_num; unsigned int int_trigger_type; + struct regulator *avdd28; struct gpio_desc *gpiod_int; struct gpio_desc *gpiod_rst; u16 id; @@ -786,25 +788,41 @@ static int goodix_ts_probe(struct i2c_client *client, if (error) return error; + ts->avdd28 = devm_regulator_get(&client->dev, "AVDD28"); + if (IS_ERR(ts->avdd28)) { + error = PTR_ERR(ts->avdd28); + if (error != -EPROBE_DEFER) + dev_err(&client->dev, + "Failed to get AVDD28 regulator: %d\n", error); + return error; + } + + /* power the controller */ + error = regulator_enable(ts->avdd28); + if (error) { + dev_err(&client->dev, "Controller fail to enable AVDD28\n"); + return error; + } + if (ts->gpiod_int && ts->gpiod_rst) { /* reset the controller */ error = goodix_reset(ts); if (error) { dev_err(&client->dev, "Controller reset failed.\n"); - return error; + goto error; } } error = goodix_i2c_test(client); if (error) { dev_err(&client->dev, "I2C communication failure: %d\n", error); - return error; + goto error; } error = goodix_read_version(ts); if (error) { dev_err(&client->dev, "Read version failed.\n"); - return error; + goto error; } ts->chip = goodix_get_chip_data(ts->id); @@ -823,23 +841,28 @@ static int goodix_ts_probe(struct i2c_client *client, dev_err(&client->dev, "Failed to invoke firmware loader: %d\n", error); - return error; + goto error; } return 0; } else { error = goodix_configure_dev(ts); if (error) - return error; + goto error; } return 0; + +error: + regulator_disable(ts->avdd28); + return error; } static int goodix_ts_remove(struct i2c_client *client) { struct goodix_ts_data *ts = i2c_get_clientdata(client); + regulator_disable(ts->avdd28); if (ts->gpiod_int && ts->gpiod_rst) wait_for_completion(&ts->firmware_loading_complete);