From patchwork Wed Dec 5 23:52:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 59 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (cartago.priv [10.11.12.1]) by cassiopea (Postfix) with ESMTPS id CD2EC2E543F for ; Thu, 6 Dec 2018 00:52:32 +0100 (CET) Received: by mail-wr1-f72.google.com with SMTP id j6sf16270781wrw.1 for ; Wed, 05 Dec 2018 15:52:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1544053952; cv=pass; d=google.com; s=arc-20160816; b=n3mgpZ5aSNRr8iqJ/XFb609+U+NaJ4mzXhfNEJH4NYaK2dqGzXA1rSctsFcPMvzvx4 dcxRDxo+sk2evPDc42cwmTntINUs59oEonGliMbJtK+gVrKohjHstWWBtcy3rWCMUa1d k0xC8OTy8gGmNwexYfCtVZoi6D2w6zjhEAvvwCfVu9FyjosyH/oAwacUHL5mQ241Ccyg JBAg6jUvH1xeuTc5wAwp4+pNdL+9a/z6lIHsnWVGKhgy3rGxdFxQHtCl/x+krO6XVqbr EMT4wADdocCz9+mxe55B2TFqtg8zU4QyqmKYQaiW47/gkgIUTZwM0LT8lPk5bsa3EDtV Lzgw== 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=rBYjCviXbp1GB9pLzlbZBcnM5Y0HUWSor8mlLMpmZyM=; b=cMQsL5N1dyNsMiluncA2TirYl9cmNT0pzDHOG4lf/l0o9F9xsJ1MKTzR5Xp/5MEM48 NFSWqHHujXHPifoOPq2v315lYz/MO3baiEwYOphX5PbzdB8uoNAYur/64mNjGk4JaO76 Ive2UdmB2xlkuVxTohTvYEaBRCwXbzJ5W2V/riHUcDWMSdWaTiOI9E4MuhA+qbmhcqY/ n4BVVNZIYp8zND6oX0pAYZhOYE7ISHnqwgcFKGXrOYpLcryPKHNsJ8M0thKjsXY9nl9U FVHUZIRIsriOjQbG7a5QUAOesKexLIevPt7Rl6yNGUNibFm4MFXbwdYOsVvgODFPUsHn aPeA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SFZLKqa0; 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=rBYjCviXbp1GB9pLzlbZBcnM5Y0HUWSor8mlLMpmZyM=; b=FYSAYWf/XjbhwCfvJ7OlMTCoMEknD5Mhw45s1kNG5mq/HHIykEYz9waZnJW6KKFb9B TZbF2mO4eJ8Zf89eFd8BQ2IdfCRAs8B8fXznMcp6JYH+zacZUOG1ulpIsILiIy/MsPYv JXfc4c9RujogmhPQ3DPTfZXIjLgEMad6iI5y8= 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=rBYjCviXbp1GB9pLzlbZBcnM5Y0HUWSor8mlLMpmZyM=; b=j38k0WPzaIkZjzYE8KLkjIAzm7muBTjVHxbNIqktPLslpLSm7fcWyGuwmgI5uAFLrR TYR7TvT0kjqYlewp/cxuEYmkVBdTQ8ewWlhQaT2DgZn1Qg0H6wm3A/aYuvgF5Sii9tph t6mkE9l5ZCKiVSkhsDhjsBaxjdXusNhSW+C55qXHL6Dv1ycjTbciUy1OCY4vh7ImldjN KW6iYAee4xm1B7HcI6icZZ+TE8kbBRLZV1G5DCb/+xG4BZk7O9KzQ4sNQG9MxhZH8TbE xCe52TFFtsRvPEQmrEx2TBDPeVswoRiVSN95U8mHN4XAaSuPxHQjfB9yq1NzbJ2Je0Kg /BHg== X-Gm-Message-State: AA+aEWacmB6IS0Cdol9tbCsavV2N5nwKko7pM1bJ/IXYg22Nc7BXmNcW Lp+BagNBe3nKqip78ayY4KHrfzbS X-Google-Smtp-Source: AFSGD/WQ2KN7nVAWNQow4Mb0dO6z/nWEo3G+CkShRGLiZCQ9WxdBfxmmqmDr9wFl3sNV2REM0YX5nA== X-Received: by 2002:adf:f40b:: with SMTP id g11mr3099984wro.20.1544053952344; Wed, 05 Dec 2018 15:52:32 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a1c:b1c5:: with SMTP id a188ls4107471wmf.5.gmail; Wed, 05 Dec 2018 15:52:32 -0800 (PST) X-Received: by 2002:a1c:b687:: with SMTP id g129mr17281395wmf.59.1544053951920; Wed, 05 Dec 2018 15:52:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544053951; cv=none; d=google.com; s=arc-20160816; b=kZp52Wr31lwzTCwBFL9PPzRmmgwLn4Pfnczxf6FdBpNuXmNoPfviezc65kBIa8y6xa /+Id4CXQaBFKgjBGY7CMgee2PWv1jirYAEanzD9dMeYxaguHPd0LgsD+OEr1Z+Cpa9sa nJsnNtHcV2/xfz9J3w2BoxO8RItQuZVER98NGJ5IzZar8aL6LwpVA+jQ7Z9r4okK+QdS CZb9q0qOCKzmJSx5jE2E0RI5L0Ve739M2uU6ajqf/ORqNmmch0+foQysM/qo956e8Ejh NCJFaPGgxAuQ5+1bObtpLKE9+vWSkczSGh9sww42OmWni5LCsocBUi9X0U5XWf5VM9EX 4ARQ== 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=rBYjCviXbp1GB9pLzlbZBcnM5Y0HUWSor8mlLMpmZyM=; b=U9kCD91HsHcdT5+EeMrFsdzIs6lasP4dRwl6Dpy2qltqiM5EDnBrMx410xQpNT99HA dyXg07ZA24+5IyQO/NonvESZLgYYqoUVBh1QblGvA+e7q1Iqmei2U5NSD8YiAmlo01Oy N9cw3PZtSXxIyzkM6BSGjXF6x+pmCe6IZn+UxEbeSXm5i4hPMJdc0Q++D2xzs+ateGd/ +k3ot/KHI+tA8nS1csn0aArHtqCNPEyvoWp+QdVmRCQq622hfejsWbX3I1GZfyQV2Qkh VDYnYNOo5pvZU94eGjz2ZJBul7PpK7vNC8fRWxjW3ERRmYuvjjqPzszsBF/hIYInTtjR assg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SFZLKqa0; 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 8sor9773605wmd.6.2018.12.05.15.52.31 for (Google Transport Security); Wed, 05 Dec 2018 15:52: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:a1c:f8f:: with SMTP id 137mr17208559wmp.96.1544053951508; Wed, 05 Dec 2018 15:52:31 -0800 (PST) Received: from localhost.localdomain (ip-161-243.sn-213-198.clouditalia.com. [213.198.161.243]) by smtp.gmail.com with ESMTPSA id x15sm19113324wrs.27.2018.12.05.15.52.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 15:52:30 -0800 (PST) From: Jagan Teki To: Dmitry Torokhov , Chen-Yu Tsai , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Michael Trimarchi , linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v2 2/4] Input: goodix - Add ADVV28-supply regulator support Date: Thu, 6 Dec 2018 05:22:18 +0530 Message-Id: <20181205235220.3461-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181205235220.3461-1-jagan@amarulasolutions.com> References: <20181205235220.3461-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=SFZLKqa0; 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 --- Changes for v2: - disable regulator in remove - fix to setup regulator in probe code 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);