From patchwork Fri May 3 13:57:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 10928815 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 B1B301390 for ; Fri, 3 May 2019 13:58:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D8F7285D8 for ; Fri, 3 May 2019 13:58:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FDED285E2; Fri, 3 May 2019 13:58:13 +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_SIGNED, DKIM_VALID,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 4818F285D8 for ; Fri, 3 May 2019 13:58:13 +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: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:In-Reply-To:References: List-Owner; bh=J8aRsIOJmUoflzhXIhlfBu+85jx6mHnwkAl3qoduXiA=; b=csKCdrxSAy0yiM m+392Nvt9w4a1eqJMw5W7NdcaRHb6NuG5ZEENjpuD2MDuPDvLc5dzK01ISiK7kSgcLCyClGW2IRz+ lGYQ2saiiuldf7e9ba4oWsZvdkESjfeEOU2NKdpqfDxzpSsMKGwdieX6rJ6qLRBnyHYAsJfMGKOvQ 8XFAPGdEEqYelrAcATNy2dhYM4oPuqANexJgQ298WCPPqqX6LjXrOq7KZTbM/ZSUpdODyZihdPT5U s9GH6OLX9xE/RggCYFxxCeXaGjEHqm7N9igIs+CWq68NXgvE5GEMGRXdo5EQUXHicykTqNH7XLWjA yOvC1ULg8/EesRQMgrdg==; 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 1hMYhU-00069n-Sz; Fri, 03 May 2019 13:58:08 +0000 Received: from mxout014.mail.hostpoint.ch ([2a00:d70:0:e::314]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMYhE-0005oV-3j for linux-arm-kernel@lists.infradead.org; Fri, 03 May 2019 13:57:54 +0000 Received: from [10.0.2.46] (helo=asmtp013.mail.hostpoint.ch) by mxout014.mail.hostpoint.ch with esmtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1hMYgy-000329-Ma; Fri, 03 May 2019 15:57:36 +0200 Received: from [46.140.72.82] (helo=philippe-pc.toradex.int) by asmtp013.mail.hostpoint.ch with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91 (FreeBSD)) (envelope-from ) id 1hMYgy-0003ks-De; Fri, 03 May 2019 15:57:36 +0200 X-Authenticated-Sender-Id: dev@pschenker.ch From: Philippe Schenker To: linux-iio@vger.kernel.org, Jonathan Cameron , Stefan Agner , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Subject: [PATCH 1/3] iio: stmpe-adc: Remove unnecessary assignment Date: Fri, 3 May 2019 15:57:23 +0200 Message-Id: <20190503135725.9959-1-dev@pschenker.ch> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190503_065752_147358_22EA1BA7 X-CRM114-Status: UNSURE ( 7.38 ) X-CRM114-Notice: Please train this message. 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: Maxime Coquelin , Alexandre Torgue , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Philippe Schenker , Max Krummenacher , Lee Jones , dev@pschenker.ch, linux-arm-kernel@lists.infradead.org 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 From: Philippe Schenker Remove unnecessary assignment. This could potentially cause an issue, if the wait function runs into a timeout. Furthermore is this assignment also not there in stmpe_read_temp() Signed-off-by: Philippe Schenker --- drivers/iio/adc/stmpe-adc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c index 37f4b74a5d32..87141177fbda 100644 --- a/drivers/iio/adc/stmpe-adc.c +++ b/drivers/iio/adc/stmpe-adc.c @@ -78,8 +78,6 @@ static int stmpe_read_voltage(struct stmpe_adc *info, stmpe_reg_write(info->stmpe, STMPE_REG_ADC_CAPT, STMPE_ADC_CH(info->channel)); - *val = info->value; - ret = wait_for_completion_interruptible_timeout (&info->completion, STMPE_ADC_TIMEOUT); From patchwork Fri May 3 13:57:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 10928813 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 15B1014B6 for ; Fri, 3 May 2019 13:58:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03B78285D8 for ; Fri, 3 May 2019 13:58:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB995285E2; Fri, 3 May 2019 13:58:06 +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_SIGNED, DKIM_VALID,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 A2622285D8 for ; Fri, 3 May 2019 13:58:06 +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=hX5iFRlj54+02exhCLw8m4FyPoO06n/9c2Y0zWpJCPg=; b=qLZgv31Tcg3gXT Hwu5SKNRa8wS1xjamuR40ya5g6qQkdWLvdnVArLzoyMuUoIIkIa3fED0DRNgpayygVGqnRPLd6Yap a0ZfIQA1sEdersbqtjSvphwOpHyjvIUgi6H8W+Fh20Xoyns1tCyG4qkiISAPvguk7bwJki5gAOS/m 9YarIEo/STS4+LgVKRIpL6JcUEtDuO+3ATsCa9hCvLFkL4vvd3Ous1wNqiaANyaeG7Sto9o62+Sbg LDHWhb9CoDAlK1mmZjzuZU2e3RiQsGKsJdV1x7OqTeM9Ta76K/2FPrd91QgU9FOKjIFTc0TEVwrfy RGSuWUElEOrFIxrKu5JQ==; 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 1hMYhN-0005wI-V3; Fri, 03 May 2019 13:58:01 +0000 Received: from mxout013.mail.hostpoint.ch ([2a00:d70:0:e::313]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMYhC-0005nb-Hh for linux-arm-kernel@lists.infradead.org; Fri, 03 May 2019 13:57:52 +0000 Received: from [10.0.2.46] (helo=asmtp013.mail.hostpoint.ch) by mxout013.mail.hostpoint.ch with esmtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1hMYh0-0000Tx-H3; Fri, 03 May 2019 15:57:38 +0200 Received: from [46.140.72.82] (helo=philippe-pc.toradex.int) by asmtp013.mail.hostpoint.ch with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91 (FreeBSD)) (envelope-from ) id 1hMYh0-0003ks-8i; Fri, 03 May 2019 15:57:38 +0200 X-Authenticated-Sender-Id: dev@pschenker.ch From: Philippe Schenker To: linux-iio@vger.kernel.org, Jonathan Cameron , Stefan Agner , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Subject: [PATCH 2/3] iio: stmpe-adc: Make wait_completion non interruptible Date: Fri, 3 May 2019 15:57:24 +0200 Message-Id: <20190503135725.9959-2-dev@pschenker.ch> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190503135725.9959-1-dev@pschenker.ch> References: <20190503135725.9959-1-dev@pschenker.ch> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190503_065750_583537_259FD44E X-CRM114-Status: UNSURE ( 7.94 ) X-CRM114-Notice: Please train this message. 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: Maxime Coquelin , Alexandre Torgue , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Philippe Schenker , Max Krummenacher , Lee Jones , dev@pschenker.ch, linux-arm-kernel@lists.infradead.org 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 From: Philippe Schenker In some cases, the wait_completion got interrupted. This caused the error-handling to mutex_unlock the function. The before turned on interrupt then got called anyway. In the ISR then completion() was called causing problems. Making this wait_completion non interruptible solves the problem. Signed-off-by: Philippe Schenker --- drivers/iio/adc/stmpe-adc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c index 87141177fbda..baa41ffc0d76 100644 --- a/drivers/iio/adc/stmpe-adc.c +++ b/drivers/iio/adc/stmpe-adc.c @@ -78,8 +78,7 @@ static int stmpe_read_voltage(struct stmpe_adc *info, stmpe_reg_write(info->stmpe, STMPE_REG_ADC_CAPT, STMPE_ADC_CH(info->channel)); - ret = wait_for_completion_interruptible_timeout - (&info->completion, STMPE_ADC_TIMEOUT); + ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT); if (ret <= 0) { mutex_unlock(&info->lock); @@ -113,8 +112,7 @@ static int stmpe_read_temp(struct stmpe_adc *info, stmpe_reg_write(info->stmpe, STMPE_REG_TEMP_CTRL, STMPE_START_ONE_TEMP_CONV); - ret = wait_for_completion_interruptible_timeout - (&info->completion, STMPE_ADC_TIMEOUT); + ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT); if (ret <= 0) { mutex_unlock(&info->lock); From patchwork Fri May 3 13:57:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 10928811 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 5F6E514B6 for ; Fri, 3 May 2019 13:58:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4DA32285DD for ; Fri, 3 May 2019 13:58:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41767285E5; Fri, 3 May 2019 13:58:00 +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_SIGNED, DKIM_VALID,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 DCA6D285DD for ; Fri, 3 May 2019 13:57:59 +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=aCD0q74ZVR6P3L1T2F87ZTJl+hdF5lwWL0+T1TH1NNU=; b=rExYekstZWuGzs R+lk9BV06X4fQYhNSC8CCRuxQS6L43KIE6+FsRBdeGj4BO0y78x62DjtyJ8Fnu7wnB09iYCtVoR9x xa63Qv/gz/l6qHYniR06F1HDEunLeQqKEl95ukOfPNnyKRCNaXdm7gWN5FTcZ59c63cUFAcobmQ4I A7XdtffGTw2ENw9Osxz+AYwHhh13nCA3BwMQ7SU36vhNjskEYUIk9P6Ry1PnHKJZShBS9qj6lOt4t uNT7bYVDNEjHmOOva9l2fYyRGYNH+0TVSCp23oxj8JwU3rWvrgXht0MQSxD8aWdI/WiXqy08dx/Hn bKRKI76n9V1QuqK41TUQ==; 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 1hMYhG-0005pk-KK; Fri, 03 May 2019 13:57:54 +0000 Received: from mxout012.mail.hostpoint.ch ([2a00:d70:0:e::312]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMYhC-0005o1-Hi for linux-arm-kernel@lists.infradead.org; Fri, 03 May 2019 13:57:52 +0000 Received: from [10.0.2.46] (helo=asmtp013.mail.hostpoint.ch) by mxout012.mail.hostpoint.ch with esmtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1hMYh1-000K4m-UA; Fri, 03 May 2019 15:57:39 +0200 Received: from [46.140.72.82] (helo=philippe-pc.toradex.int) by asmtp013.mail.hostpoint.ch with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91 (FreeBSD)) (envelope-from ) id 1hMYh1-0003ks-Oj; Fri, 03 May 2019 15:57:39 +0200 X-Authenticated-Sender-Id: dev@pschenker.ch From: Philippe Schenker To: linux-iio@vger.kernel.org, Jonathan Cameron , Stefan Agner , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Subject: [PATCH 3/3] iio: stmpe-adc: Enable all stmpe-adc interrupts just once Date: Fri, 3 May 2019 15:57:25 +0200 Message-Id: <20190503135725.9959-3-dev@pschenker.ch> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190503135725.9959-1-dev@pschenker.ch> References: <20190503135725.9959-1-dev@pschenker.ch> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190503_065750_637830_F35D72C2 X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. 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: Maxime Coquelin , Alexandre Torgue , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Philippe Schenker , Max Krummenacher , Lee Jones , dev@pschenker.ch, linux-arm-kernel@lists.infradead.org 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 From: Philippe Schenker This commit will enable the interrupts of all channels handled by this driver only once in the probe function. This will improve performance because one byte less has to be written over i2c on each read out of the adc. On the fastest ADC mode this will improve read out speed by 15%. Signed-off-by: Philippe Schenker --- drivers/iio/adc/stmpe-adc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c index baa41ffc0d76..427c890c6e7d 100644 --- a/drivers/iio/adc/stmpe-adc.c +++ b/drivers/iio/adc/stmpe-adc.c @@ -72,9 +72,6 @@ static int stmpe_read_voltage(struct stmpe_adc *info, return -EINVAL; } - stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_EN, - STMPE_ADC_CH(info->channel)); - stmpe_reg_write(info->stmpe, STMPE_REG_ADC_CAPT, STMPE_ADC_CH(info->channel)); @@ -328,6 +325,9 @@ static int stmpe_adc_probe(struct platform_device *pdev) if (ret) return ret; + stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_EN, + ~(norequest_mask & 0xFF)); + return devm_iio_device_register(&pdev->dev, indio_dev); }