From patchwork Fri Dec 14 15:12:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pawe=C5=82_Chmiel?= X-Patchwork-Id: 10731339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA4A5746 for ; Fri, 14 Dec 2018 15:13:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 920812D5DA for ; Fri, 14 Dec 2018 15:13:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 867382D5F3; Fri, 14 Dec 2018 15:13:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 188B42D5DA for ; Fri, 14 Dec 2018 15:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=V3AZwSS1uaznsYUYZqpB9pOs6ekTNDfj1rTS8Q3HvVI=; b=nNzAwwgR8tu0yy z94Y0PeAK7+iGkpPHNOtqVBNQCqYHqQ7QcRZDu1HzTCwFx8JhD+5YKhjxcTdJ3YgzMJCV14TJNngZ B584adly7uuuqAnuRUKRmUz8wLFH4jv/sUawGxEb/ocsucBf+agBNOoWwoeT8NFR90sub/rTui4tM 7NyQATR7wPzLDGTIcgQXv1yY7qBpQB40Y6ef+U+kozQfdDC/0ImGgDaAAOjzsOHj67x5D2/9N6IY0 /3Mxafl7E7yFw1PqQWgAd30RdVvXRKmH/2Mk3pH4CGyGzaQrFbZn58ffFeTmTxFxAzkPtVN6tLOMe oxmpw09XnvgIq6t7ihUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXp9S-0001i6-C3; Fri, 14 Dec 2018 15:13:18 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXp9A-0001Ul-2V for linux-arm-kernel@bombadil.infradead.org; Fri, 14 Dec 2018 15:13:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=CDJY0iulsgx7iN3Slcal1yubzfA4l/+2jzl1Lo0q7x8=; b=X/lkoih13NTGzCxk/xADvsDeP/ GPggq78neHg9b/Danv5HEOhTvNr0sSJ8LY8XRsXv9SZQG6uHRw70CF8ejEsS02dCgwXPQP+E6LhG4 chEZDol74/Y1PpVxWwsysJsJ5EAOkpCtG8ofKzTPBEZud3/RZtEl4958kP1Z5eDg5FDrvUZG4ONiL BFKVXE7YeD9MF7tbsspum2w0m9ZiKihRIawYCsi/QD/Y/bejw6/YX6krZ9QD1ySCUv1Ou/kdNUsyo 3EIDgKDLTR2jdUqzqNlDaUzNvghuRrYqJt0iNHgNjDyR10g6xkjEX4lSHDTCH+41eaaWTud2ziw06 XETPMUVA==; Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXp95-00073Y-9a for linux-arm-kernel@lists.infradead.org; Fri, 14 Dec 2018 15:12:58 +0000 Received: by mail-lf1-x143.google.com with SMTP id a16so4506619lfg.3 for ; Fri, 14 Dec 2018 07:12:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CDJY0iulsgx7iN3Slcal1yubzfA4l/+2jzl1Lo0q7x8=; b=YnRyMRjyoYUoa1T/lnyviF6hzTQKfzw8lD7MwA/HobzairVIQZIW07DfpDJextINJf hHd3xbR2R5pY95UONlZNkcywcrUyaCJo0YZWl3AASOrF0ZpJfFUK/NvEiGNNCkOdijgV DwfC0Zc7cVpA84uTALkBgi9NpD4dox5Vtc0+G702De9lqh/lxl8bMkfyXjDuQPA+HiNW 1KgRiGC5CxHLEJT8FWPR+iOcoxoZDJX11HZ30AhQyp01NQj5pC1DH45fXsmIZtB2k2ZZ LLbC5VreBU9Q3x6uOwuBcZZIwadoDxU+oYEDUmkkJPxEhZeUcH/s0btKNazqfFxXmlkH cQbA== 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; bh=CDJY0iulsgx7iN3Slcal1yubzfA4l/+2jzl1Lo0q7x8=; b=Dq9QMV//1SL1OJNwJTumd+m7sWv1badSrvSXN0Fg/kC8GzvesXdjfPrJtipOXwsdAk TMeIuGZhb8tmeUtfIHw4owIC0oyCTof2+/6Pek7Hvbq3fjjSs6LoVX3sgKKXyxx+QkLy OXNpxtSojDU3Erw0wNqCcufkSZnHzRRUOeMLdBH25JznSQKLFd0lfJ5zyI6JA8VH42Ks y07ziUM0rgtgXj3NWY0QzSlNAkCFiTjv4xaNA2o61YxtSvbgRVqTN4HnSFfJnfHZWGr2 2qsPQ+RR2VJChV4MBgT8O2up0OzPrHLmJCThRMMqlGM72f+zvDboZqXAByrixeEydS6K 4LMQ== X-Gm-Message-State: AA+aEWbd/bMXarJTN1D5/yuZxa7xU78zQG3nFLdoz/F4b4Dft4nphn7c nINwh46fIllhAyGLNcsJatc= X-Google-Smtp-Source: AFSGD/VdHqcg0co6kob+PtNe4FXaN8qc1HI3HiQH+J8lppE8KwqwD1UR3Q+Ro19KLWiMhrXHCLUKbg== X-Received: by 2002:a19:c115:: with SMTP id r21mr2047482lff.144.1544800360099; Fri, 14 Dec 2018 07:12:40 -0800 (PST) Received: from localhost.localdomain ([2a02:a315:5445:5300:976:99fb:a7e3:627c]) by smtp.googlemail.com with ESMTPSA id o17sm951975lff.77.2018.12.14.07.12.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 07:12:39 -0800 (PST) From: =?utf-8?q?Pawe=C5=82_Chmiel?= To: nick@shmanahar.org Subject: [PATCH v5 1/3] Input: atmel_mxt_ts: Add support for optional regulators Date: Fri, 14 Dec 2018 16:12:12 +0100 Message-Id: <20181214151214.5391-2-pawel.mikolaj.chmiel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214151214.5391-1-pawel.mikolaj.chmiel@gmail.com> References: <20181214151214.5391-1-pawel.mikolaj.chmiel@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181214_101255_357365_3547B74F X-CRM114-Status: GOOD ( 22.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, alexandre.belloni@bootlin.com, dmitry.torokhov@gmail.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Pawe=C5=82_Chmiel?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds optional regulators, which can be used to power up touchscreen. After enabling regulators, we need to wait 150msec. This value is taken from official driver. It was tested on Samsung Galaxy i9000 (based on Samsung S5PV210 SOC). Signed-off-by: Paweł Chmiel --- Changes from v4: - Add missing regulator_disable for vdd in case of error, when enabling avdd regulator Changes from v3: - Fix checkpatch issues - Drop sentence punctuation from patch subject Changes from v2: - Move code enabling regulators into separate method, to make code more readable. Changes from v1: - Enable regulators only if reset_gpio is present. - Switch from devm_regulator_get_optional to devm_regulator_get --- drivers/input/touchscreen/atmel_mxt_ts.c | 67 +++++++++++++++++++++--- 1 file changed, 61 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index d3aacd534e9c..55a107fc1b73 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -194,10 +195,10 @@ enum t100_type { /* Delay times */ #define MXT_BACKUP_TIME 50 /* msec */ -#define MXT_RESET_GPIO_TIME 20 /* msec */ #define MXT_RESET_INVALID_CHG 100 /* msec */ #define MXT_RESET_TIME 200 /* msec */ #define MXT_RESET_TIMEOUT 3000 /* msec */ +#define MXT_REGULATOR_DELAY 150 /* msec */ #define MXT_CRC_TIMEOUT 1000 /* msec */ #define MXT_FW_RESET_TIME 3000 /* msec */ #define MXT_FW_CHG_TIMEOUT 300 /* msec */ @@ -323,6 +324,8 @@ struct mxt_data { struct t7_config t7_cfg; struct mxt_dbg dbg; struct gpio_desc *reset_gpio; + struct regulator *vdd_reg; + struct regulator *avdd_reg; /* Cached parameters from object table */ u16 T5_address; @@ -3038,6 +3041,40 @@ static const struct dmi_system_id chromebook_T9_suspend_dmi[] = { { } }; +static int mxt_regulator_enable(struct mxt_data *data) +{ + int error; + + if (data->reset_gpio) { + error = regulator_enable(data->vdd_reg); + if (error) { + dev_err(&data->client->dev, + "Failed to enable vdd regulator: %d\n", error); + return error; + } + + error = regulator_enable(data->avdd_reg); + if (error) { + regulator_disable(data->vdd_reg); + + dev_err(&data->client->dev, + "Failed to enable avdd regulator: %d\n", error); + return error; + } + + /* + * According to maXTouch power sequencing specification, + * RESET line must be kept low until some time + * after regulators come up to voltage + */ + msleep(MXT_REGULATOR_DELAY); + gpiod_set_value(data->reset_gpio, 1); + msleep(MXT_RESET_INVALID_CHG); + } + + return 0; +} + static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct mxt_data *data; @@ -3098,6 +3135,22 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) return error; } + data->vdd_reg = devm_regulator_get(&client->dev, "vdd"); + if (IS_ERR(data->vdd_reg)) { + error = PTR_ERR(data->vdd_reg); + dev_err(&client->dev, "Failed to get vdd regulator: %d\n", + error); + return error; + } + + data->avdd_reg = devm_regulator_get(&client->dev, "avdd"); + if (IS_ERR(data->avdd_reg)) { + error = PTR_ERR(data->avdd_reg); + dev_err(&client->dev, "Failed to get avdd regulator: %d\n", + error); + return error; + } + error = devm_request_threaded_irq(&client->dev, client->irq, NULL, mxt_interrupt, IRQF_ONESHOT, client->name, data); @@ -3108,11 +3161,9 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) disable_irq(client->irq); - if (data->reset_gpio) { - msleep(MXT_RESET_GPIO_TIME); - gpiod_set_value(data->reset_gpio, 1); - msleep(MXT_RESET_INVALID_CHG); - } + error = mxt_regulator_enable(data); + if (error) + return error; error = mxt_initialize(data); if (error) @@ -3138,6 +3189,10 @@ static int mxt_remove(struct i2c_client *client) struct mxt_data *data = i2c_get_clientdata(client); disable_irq(data->irq); + if (data->reset_gpio) { + regulator_disable(data->avdd_reg); + regulator_disable(data->vdd_reg); + } sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); mxt_free_input_device(data); mxt_free_object_table(data); From patchwork Fri Dec 14 15:12:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pawe=C5=82_Chmiel?= X-Patchwork-Id: 10731345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E83FE1575 for ; Fri, 14 Dec 2018 15:14:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90FA12D040 for ; Fri, 14 Dec 2018 15:14:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 854F62D55F; Fri, 14 Dec 2018 15:14:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 30E792D040 for ; Fri, 14 Dec 2018 15:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KXmVR8w92lcQ3u3lqeldaLULp4/orSZtzZyMwqZenrI=; b=otAZFRbU4vj72W xQZKWmSg+yLUksmigfEbxgu0633F8fvIoRfcy4UxYM70kvs5FBj/mepzethXomSjoPPeoBoqwG4xX MjlsjtRx50O2Q22otv8bp0OBrCwbO4BoQ8dHsTOoBSW6mCyFEDDpzZTMNk5XXwxYuXtQ8FHt783je 7lC+fJ5vNvdvDcnMy+05AYiax/olKRIdkPZc4a09+fpdEzQrhqp5da/ov/lybXoGSnJLfQjuB/p5c Emz4R/+KnjREbCn3TPKsdUX7RjGfvJTDjalJybp5W3FXn7zCJylhWGbl9fL/f+y4nQ55Px5gm1NAW /UWGjnPk0B9bhdRm56Cg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXpAZ-0002aM-2O; Fri, 14 Dec 2018 15:14:27 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXp93-0001H4-Pk for linux-arm-kernel@lists.infradead.org; Fri, 14 Dec 2018 15:13:06 +0000 Received: by mail-lj1-x244.google.com with SMTP id e5-v6so5196103lja.4 for ; Fri, 14 Dec 2018 07:12:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qRMbrgz6GRxf6yeDCa+/ThuxnntpY3MOarYovcWFQ6M=; b=pFo9zzpzSc9AuhqD6m4diBv0MXXAqoaMxuil29dqVQwAj++oSDyUmNFyzDoFMjZ5hQ OBI0rcJKuz+jbyRYj4YhYRWWq55tPxud0M3BDLDM4+VuQ+/iyezGEE7qfjtDkLKjygjr 9wiVJMKnziGIUYhded+0llC7JTSXRc/kC3uLkXgmlOaYDu3EIxAou/NAKhE5NvnGRwN4 PH7UFeLYm8f2I8EmzyxuJiFtvCCDlNU92KxbgMNAa/AOiRV2U7HyKS76CUT/wdiDymzn Es+dIDlXTYtzxrO8y7X5cX/fQhSE2Zt70jBdcvndi7vSVftZc4HJNFWhhR8ONKMXXyhc 9NMA== 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; bh=qRMbrgz6GRxf6yeDCa+/ThuxnntpY3MOarYovcWFQ6M=; b=GTtzl3fwb8dufXPgsBa6RMBZv+l5tpTn058n2sKlr11nTY/cR6kP+4HRWPZZZMWuIQ bubOdp/mBM1ZkxG1UMHYWMAOrcBlMtO0h6qjdHzX3pBXF4rnvMduOpb5wL+yfH66MPCQ lG3+cpthYXtk4lgTvdoIxWLUUTuqfVpW988CWa3Wf0DCitvkLVzexO0qbEQzPIOezL6C NpXwQjZIaSHvzFDkU0Rmf4b2EdpRS50RkK2gAnT32RVmk6FTkYViC7Kwjm6aEx5KjYQT 9a0iiLsUGTL6AEvdfvnm4J+d86L5msiCL8vJDyiAKYTtunnrRAgxW5NnGGa+6bPavxwd l6fQ== X-Gm-Message-State: AA+aEWY8e3biRvHdEyvPSo85WntYWw9B+WAxLhsElji8c3KM7Hz7Oy14 p4Rv+QjaxbXwRxP7NKlmHjYmkw7efTE= X-Google-Smtp-Source: AFSGD/VOnrKfX1vyv8a22wLq9u3naOibHehdLcak71xwAg9pclRRKGzlRDURaL0/8ScC700m9cy/Uw== X-Received: by 2002:a2e:5054:: with SMTP id v20-v6mr2102682ljd.45.1544800361634; Fri, 14 Dec 2018 07:12:41 -0800 (PST) Received: from localhost.localdomain ([2a02:a315:5445:5300:976:99fb:a7e3:627c]) by smtp.googlemail.com with ESMTPSA id o17sm951975lff.77.2018.12.14.07.12.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 07:12:41 -0800 (PST) From: =?utf-8?q?Pawe=C5=82_Chmiel?= To: nick@shmanahar.org Subject: [PATCH v5 2/3] Input: atmel_mxt_ts: Wait for device be ready for communication Date: Fri, 14 Dec 2018 16:12:13 +0100 Message-Id: <20181214151214.5391-3-pawel.mikolaj.chmiel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214151214.5391-1-pawel.mikolaj.chmiel@gmail.com> References: <20181214151214.5391-1-pawel.mikolaj.chmiel@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181214_071254_155994_2957BFF0 X-CRM114-Status: GOOD ( 13.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, alexandre.belloni@bootlin.com, dmitry.torokhov@gmail.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Pawe=C5=82_Chmiel?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP According to documentation, device isn't ready for communication, until firmware asserts the CHG line. Add missing wait for this. Signed-off-by: Paweł Chmiel --- Changes from v1: - Fix checkpatch issues --- drivers/input/touchscreen/atmel_mxt_ts.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 55a107fc1b73..e8949c6ceafa 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -202,6 +202,7 @@ enum t100_type { #define MXT_CRC_TIMEOUT 1000 /* msec */ #define MXT_FW_RESET_TIME 3000 /* msec */ #define MXT_FW_CHG_TIMEOUT 300 /* msec */ +#define MXT_POWERON_DELAY 150 /* msec */ /* Command to unlock bootloader */ #define MXT_UNLOCK_CMD_MSB 0xaa @@ -3070,6 +3071,16 @@ static int mxt_regulator_enable(struct mxt_data *data) msleep(MXT_REGULATOR_DELAY); gpiod_set_value(data->reset_gpio, 1); msleep(MXT_RESET_INVALID_CHG); + +retry_wait: + reinit_completion(&data->bl_completion); + data->in_bootloader = true; + error = mxt_wait_for_completion(data, &data->bl_completion, + MXT_POWERON_DELAY); + if (error == -EINTR) + goto retry_wait; + + data->in_bootloader = false; } return 0; From patchwork Fri Dec 14 15:12:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pawe=C5=82_Chmiel?= X-Patchwork-Id: 10731343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 85FDC746 for ; Fri, 14 Dec 2018 15:14:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF79D2CEDB for ; Fri, 14 Dec 2018 15:14:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0D9C2D531; Fri, 14 Dec 2018 15:14:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 44F6B2CEDB for ; Fri, 14 Dec 2018 15:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vk/0v38ub7BW/laUWrkGZfffltDq94dC7NSuXPeQE78=; b=aqRMmdCpHNkOqi E9TA4ieosVyQZxj5wL7aUo+IxESQ8/NMNlhP/q4fecppZW6jwSk/MTm+Dqc/gxWc+4lA0Bgzp3PvB 8peZvOrpCJx2Xweuh6cLfWpvtNhJxw4RCxwakYmozUVjfLSGXNI3vY+bPbGJ/bvXv2u/b7ggx91jO Xb5XBhsn/U86+90EKKGPH7o6UrTH19uvlG+1Y6jZwRBacBwzf6PyjXqHUBKgxndoOg+7/i0v0fPRx 0sHzQiiO9Zzn5ySlZR+PU7v4FUy9UA/SBRJgSCkCfg5PJ7cz+EsuweayxLjjRQE3nZMLn0vxBJAQ3 bDZVH3GqYqeXiu1e/wjg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXpAO-0002SA-V0; Fri, 14 Dec 2018 15:14:16 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gXp93-0001IF-PD for linux-arm-kernel@lists.infradead.org; Fri, 14 Dec 2018 15:13:05 +0000 Received: by mail-lj1-x244.google.com with SMTP id x85-v6so5210037ljb.2 for ; Fri, 14 Dec 2018 07:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XFPTtMJpSFiF4PFAqSj6g1FCx0iqQrUaJq/0mQ1Us/I=; b=AA+sTsi+2r9TaO4AjoiPveHi7QEZ6CyRaTCdXyKbmlI4V5cPPLC9vA20OsRILHzxQr CvZg0bUe/UPRkXVS0MVkXtL6IhiWSOfC8Kex/z1PmxDwJchTZm4w+muB6fO9ewNLO+as XyS86vKWHrbwDakwcrtK8Ol3ZbSCqYn251CyJjaeuF1BOY6QpNqzP2ygsQ+7zLkid0gB hVA9d4lK73+xUAZeUDzFPv0m1UGCnRpfA1DEY5OSjFhs7u07FasCp7QwhuOTcZP0JWPj anWcHm7OQpXHjxwVdu7QwF6x2wSJQauFEY6WcE1OE+hJkLwH7cHdgNkSNKlrPcnrQeWo kfiw== 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; bh=XFPTtMJpSFiF4PFAqSj6g1FCx0iqQrUaJq/0mQ1Us/I=; b=H1SydnwP5B2vQ6ffKnUUm71OXoKAxABlIhVns3530zoPanHsrzkB2ziYOp8C18EW7u tv78+6oraMWbuh0lyjv1y4TLQLhAKOdkyvFo94BHrtX1vaOSJ9szbFVCGogU8V3SdPig H5PtEghvEetPge7ffCvu0qfi5SC2qCvyfK5Mo4GgITbsFwnxprj2nQwTCwwRZ+ysagKu Wq6d9yPU+kVEJwTmur6WWQaL8YSHXufCq0Lee/An4AgrqBaCwfhfplYcN6iR5qzSGxV4 zqCUlmcpeWG784HgpMSaGn2H4MFKZpLzJipBkYNhLWgtNHWumuOMD8ei7CSe6S6osp6n aWmw== X-Gm-Message-State: AA+aEWZydBynHm4UgKyHeJGbEG0z6JWdwm00zlAYEPx+gDOGTD1mMDqm 88nK90eLaH8UjbN6xaekU8k= X-Google-Smtp-Source: AFSGD/UpvwuG6QLqDJlXq4Uy1lBkqEcft6k+rwE4UIl4p+PwyZEFl5PQO5/79a6L9O4ktaEg+Nx93Q== X-Received: by 2002:a2e:87c3:: with SMTP id v3-v6mr2259538ljj.13.1544800363045; Fri, 14 Dec 2018 07:12:43 -0800 (PST) Received: from localhost.localdomain ([2a02:a315:5445:5300:976:99fb:a7e3:627c]) by smtp.googlemail.com with ESMTPSA id o17sm951975lff.77.2018.12.14.07.12.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 07:12:42 -0800 (PST) From: =?utf-8?q?Pawe=C5=82_Chmiel?= To: nick@shmanahar.org Subject: [PATCH v5 3/3] Input: atmel_mxt_ts: Document optional voltage regulators Date: Fri, 14 Dec 2018 16:12:14 +0100 Message-Id: <20181214151214.5391-4-pawel.mikolaj.chmiel@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181214151214.5391-1-pawel.mikolaj.chmiel@gmail.com> References: <20181214151214.5391-1-pawel.mikolaj.chmiel@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181214_071254_134223_51565970 X-CRM114-Status: GOOD ( 12.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, alexandre.belloni@bootlin.com, dmitry.torokhov@gmail.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Pawe=C5=82_Chmiel?= Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Document new optional voltage regulators, which can be used to power down/up touchscreen. Signed-off-by: Paweł Chmiel Reviewed-by: Rob Herring Reviewed-by: Sebastian Reichel --- Changes from v1: - Added reviewed-by --- .../devicetree/bindings/input/atmel,maxtouch.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt index c88919480d37..17930ecadad3 100644 --- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt +++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt @@ -31,6 +31,12 @@ Optional properties for main touchpad device: - reset-gpios: GPIO specifier for the touchscreen's reset pin (active low) +- avdd-supply: Analog power supply. It powers up the analog channel block + of the controller to detect the touches. + +- vdd-supply: Digital power supply. It powers up the digital block + of the controller to enable i2c communication. + Example: touch@4b { @@ -38,4 +44,6 @@ Example: reg = <0x4b>; interrupt-parent = <&gpio>; interrupts = ; + avdd-supply = <&atsp_reg>; + vdd-supply = <&tsp_reg>; };