From patchwork Tue May 7 14:36:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 10933071 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 F1FE9912 for ; Tue, 7 May 2019 14:36:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE3DD1FFB7 for ; Tue, 7 May 2019 14:36:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D19F1286A0; Tue, 7 May 2019 14:36:49 +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 896441FFB7 for ; Tue, 7 May 2019 14:36:49 +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=B5Jxk9xkmylRuBWJFVd89XBJ827OwBnNDMyVHQGwZgc=; b=g4innhPMUF51vE Rt7z4nksxHubIvQk5UJKKT/iIWhi0knWSd8Rccea57yRkPnvBAzWddPbbCjKlyBPGpHwPSHvZqHEH hEIfKyKQ3cWAdMeVV6PTMBqsFB0t4oDYmYQWDq6ohdhWYvWC4IvxEne889tKijg/nNHWnZZ2HDhQ1 4BERgwY+ROEmyaRFe/eo7pHzd2Bt0BWLlVhS9GDmOgrieGHp2Vp4ZAi/8mvQOPLIjmOya/J7zswje qjGbN4oR37a5F/j1J7gQVwaNw1vXBhH57mqXcqsQMlUcEOaM/6iRVw4tOfsCVD5Ad6o8ch/o8NFjW W4HfjiCkuaUpF/cFtUhw==; 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 1hO1D3-0004TP-84; Tue, 07 May 2019 14:36:45 +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 1hO1Ct-0004K7-NG for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2019 14:36:37 +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 1hO1Cd-00044q-T8; Tue, 07 May 2019 16:36:19 +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 1hO1Cd-0008oW-Km; Tue, 07 May 2019 16:36:19 +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/5] iio: stmpe-adc: Add compatible name Date: Tue, 7 May 2019 16:36:11 +0200 Message-Id: <20190507143615.28477-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-20190507_073635_755871_077510AC X-CRM114-Status: UNSURE ( 8.60 ) 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 , Marcel Ziswiler , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Philippe Schenker , David Laight , 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 Add the compatible name to the driver so it gets loaded when the proper node in DT is detected. Signed-off-by: Philippe Schenker --- drivers/iio/adc/stmpe-adc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c index 37f4b74a5d32..9ec338ba3440 100644 --- a/drivers/iio/adc/stmpe-adc.c +++ b/drivers/iio/adc/stmpe-adc.c @@ -354,9 +354,14 @@ static struct platform_driver stmpe_adc_driver = { .pm = &stmpe_adc_pm_ops, }, }; - module_platform_driver(stmpe_adc_driver); +static const struct of_device_id stmpe_adc_ids[] = { + { .compatible = "st,stmpe-adc", }, + { }, +}; +MODULE_DEVICE_TABLE(of, stmpe_adc_ids); + MODULE_AUTHOR("Stefan Agner "); MODULE_DESCRIPTION("STMPEXXX ADC driver"); MODULE_LICENSE("GPL v2"); From patchwork Tue May 7 14:36:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 10933065 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 6233D1390 for ; Tue, 7 May 2019 14:36:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D3371FFB7 for ; Tue, 7 May 2019 14:36:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4109728746; Tue, 7 May 2019 14:36:41 +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 EC0A3286A0 for ; Tue, 7 May 2019 14:36:40 +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=TEz8p5H3DwjBeC3DJe5LacX76SvGxwidhvEYx4nSqo8=; b=Tw+9RHiZVNd378 lhir5Bbic0WsCTjCUISS1J45/Ib4CfxEgjH3Pijy0TfC0EuQ+WT4oxVqRXBDKa8OMdHIYuqw/39Xm NqbZC1yHsLRRCf4vG8laGn/e//GdLBcop4aWt5oz8QeP7zCQJKkCZYBL7H3uT46prdKNNo70hegb/ qnk0nHmjWAaa4uDfhbcfDZS7d0RtQzLDPOTh78eSQLoUpOHReVrIfrQ4vtyVhaeDhJj/hd0dnSvBV iUWAYXF1GUiKHByMBVD09C0j8attewJHMPNFchueL+yB+iBc3ixSt17VMysNicd+z71bzfidf6x6l T5DhwOsuxg5DCyp9OiQw==; 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 1hO1Cy-0004MP-4k; Tue, 07 May 2019 14:36:40 +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 1hO1Ct-0004K3-Nt for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2019 14:36:37 +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 1hO1Ce-000454-QD; Tue, 07 May 2019 16:36:20 +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 1hO1Ce-0008oW-Jv; Tue, 07 May 2019 16:36:20 +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/5] iio: stmpe-adc: Reinit completion struct on begin conversion Date: Tue, 7 May 2019 16:36:12 +0200 Message-Id: <20190507143615.28477-2-dev@pschenker.ch> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190507143615.28477-1-dev@pschenker.ch> References: <20190507143615.28477-1-dev@pschenker.ch> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190507_073635_779603_28E948CA X-CRM114-Status: UNSURE ( 7.41 ) 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 , Marcel Ziswiler , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Philippe Schenker , David Laight , 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 wrong adc-values returned in a following adc-readout. Reinitialise completion struct to make sure the counter is zero when beginning a new adc-conversion. Signed-off-by: Philippe Schenker --- drivers/iio/adc/stmpe-adc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c index 9ec338ba3440..b3872eb37293 100644 --- a/drivers/iio/adc/stmpe-adc.c +++ b/drivers/iio/adc/stmpe-adc.c @@ -65,6 +65,8 @@ static int stmpe_read_voltage(struct stmpe_adc *info, mutex_lock(&info->lock); + reinit_completion(&info->completion); + info->channel = (u8)chan->channel; if (info->channel > STMPE_ADC_LAST_NR) { @@ -105,6 +107,8 @@ static int stmpe_read_temp(struct stmpe_adc *info, mutex_lock(&info->lock); + reinit_completion(&info->completion); + info->channel = (u8)chan->channel; if (info->channel != STMPE_TEMP_CHANNEL) { From patchwork Tue May 7 14:36:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 10933075 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 2B218912 for ; Tue, 7 May 2019 14:37:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 183CD2848D for ; Tue, 7 May 2019 14:37:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B465287BD; Tue, 7 May 2019 14:37: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 B49262848D for ; Tue, 7 May 2019 14:37:12 +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=vThYdyfpblZ4H4WG+v9CF1Fxmmzww5pVON6ZU8StQNA=; b=GvGadHtApjOeg4 1y2/tK29ebSiINpfjK5lvXmq5Pg8HsMG6OsL+pdwZN05R2+BxI95JWwnRUeIXD1c2KNMjCauUjZhU h71eT1ukiEzYVEcKy6V4Qj6WeGMIfs0IoVhJVS4PqMR32D1hnFJdWu3un9BXgg1eCRhKJ56uzaNz2 cYhJIPX7Yna187F7LEtfMD+TcpX3xZSTvnq4gzdAOkB2jPNXMuOf62cTTe8Y/VqSrIQ4Qv1C22Tbd Sbn5sNW5iQeB4j41AybHajChn3xtJyxfuIS28Je8IUy+Bnzx1cHe0m3vqPMR5dGoiLowDYmpEuP0E uI2c9UWvkoBOxyKISthQ==; 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 1hO1DO-0004wA-Ud; Tue, 07 May 2019 14:37:06 +0000 Received: from mxout017.mail.hostpoint.ch ([2a00:d70:0:e::317]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hO1Ct-0004K5-Sg for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2019 14:36:39 +0000 Received: from [10.0.2.46] (helo=asmtp013.mail.hostpoint.ch) by mxout017.mail.hostpoint.ch with esmtp (Exim 4.91 (FreeBSD)) (envelope-from ) id 1hO1Cf-000DwF-Qc; Tue, 07 May 2019 16:36:21 +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 1hO1Cf-0008oW-Jv; Tue, 07 May 2019 16:36:21 +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/5] iio: stmpe-adc: Enable all stmpe-adc interrupts just once Date: Tue, 7 May 2019 16:36:13 +0200 Message-Id: <20190507143615.28477-3-dev@pschenker.ch> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190507143615.28477-1-dev@pschenker.ch> References: <20190507143615.28477-1-dev@pschenker.ch> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190507_073635_972133_8B609081 X-CRM114-Status: UNSURE ( 9.74 ) 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 , Marcel Ziswiler , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Philippe Schenker , David Laight , 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 b3872eb37293..82b43e4522b6 100644 --- a/drivers/iio/adc/stmpe-adc.c +++ b/drivers/iio/adc/stmpe-adc.c @@ -74,9 +74,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)); @@ -336,6 +333,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); } From patchwork Tue May 7 14:36:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 10933077 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 9A97E1390 for ; Tue, 7 May 2019 14:37:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 858AF2848D for ; Tue, 7 May 2019 14:37:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 795DA287BD; Tue, 7 May 2019 14:37:19 +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 228992848D for ; Tue, 7 May 2019 14:37:19 +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=v7moF3hWpL3GiKVO4AKH8NMVGkvpyw7EeDh8doaEx9Q=; b=kyZoOCJ/t+gy3P 7tcb6et+ePdyoVzy6djLwoqtppI9cy7eKPTic/ooDUoAXehBshofCUsP2/6o5+S44z2hTgFo0kuqj MblrLFPjdlUvqAsziHvHW64JdyVHeOIgegUzyNKg58KCsjBAFNe2ku8u9k1d/zZFfPvoQJH+CfXLl BRPDOJkpJjOwVDPWGntzk4aco6D9e0UBcmJj1SHb4YuEqCXeChnEUySbd2YGc9B6i0dJJQrWenyDS FEol7+N3q8fxM/2NNXvgyPVG+jcPCRKtPICBZGlZ8p1MX3H7tTWDsIz+nIjqT84uqDHyWrwvJlkcb 3tx91GV5mA/3FLp2Mp6A==; 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 1hO1DZ-000593-4H; Tue, 07 May 2019 14:37:17 +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 1hO1Cw-0004Lq-Iv for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2019 14:36:40 +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 1hO1Ch-000IFQ-3D; Tue, 07 May 2019 16:36:23 +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 1hO1Cg-0008oW-Sg; Tue, 07 May 2019 16:36:23 +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 4/5] iio: stmpe-adc: Use wait_for_completion_timeout Date: Tue, 7 May 2019 16:36:14 +0200 Message-Id: <20190507143615.28477-4-dev@pschenker.ch> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190507143615.28477-1-dev@pschenker.ch> References: <20190507143615.28477-1-dev@pschenker.ch> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190507_073638_618066_F3CCE106 X-CRM114-Status: UNSURE ( 9.32 ) 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 , Marcel Ziswiler , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Philippe Schenker , David Laight , 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 Use wait_for_completion_timeout instead of wait_for_completion_interuptible_timeout. The interruptible variant gets constantly interrupted if a user program is compiled with the -pg option. The killable variant was not used due to the fact that a second program, reading on this device, that gets killed is then also killing that wait. Signed-off-by: Philippe Schenker --- drivers/iio/adc/stmpe-adc.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c index 82b43e4522b6..cc752a47444c 100644 --- a/drivers/iio/adc/stmpe-adc.c +++ b/drivers/iio/adc/stmpe-adc.c @@ -77,17 +77,11 @@ 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); + ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT); if (ret <= 0) { mutex_unlock(&info->lock); - if (ret == 0) - return -ETIMEDOUT; - else - return ret; + return -ETIMEDOUT; } *val = info->value; @@ -116,15 +110,11 @@ 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); - if (ret == 0) - return -ETIMEDOUT; - else - return ret; + return -ETIMEDOUT; } /* From patchwork Tue May 7 14:36:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Schenker X-Patchwork-Id: 10933073 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 D9F061390 for ; Tue, 7 May 2019 14:37:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5C091FFB7 for ; Tue, 7 May 2019 14:37:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6E9C286A0; Tue, 7 May 2019 14:37:01 +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 6756A2848D for ; Tue, 7 May 2019 14:37:01 +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=3wvwJk1AtNo+bSl4qR2hg43TMYfhWbg13D9P7e0j8Xw=; b=SQe2F3nHovwjxo dQ8rWCRXzcoEY+JmlHCKa6eiy9sQpHPbGuONZ4at+iXqFXUgywPbbYwxqr9nTkgDf5kwUPGCduFs4 QjocKUZb1oHfCx0DxIgebBQeIys5rpNIG52LxUXgNSMdVhUKjf8AUUAJi0fvvK17XZah1MBvbdrdb xXZ7ohRbKM9/TVuQTiQA7hQaRMdlj1ak2VcRLU5EAEqJ446oFhXOpi+9g+TYOvYyHkJCCCkbib/Hu DT7mtxUM7v6Im5KxTdmLS39bH3N/Wl4Zp0LdDLtcktvUjlK6mRxRaL8wsC6g9cwd4vRyvzxk4HdqX 7bpIyGXCmjJAS32bySSA==; 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 1hO1DE-0004jf-CP; Tue, 07 May 2019 14:36:56 +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 1hO1Ct-0004KQ-Nb for linux-arm-kernel@lists.infradead.org; Tue, 07 May 2019 14:36:39 +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 1hO1Ci-00028n-4E; Tue, 07 May 2019 16:36:24 +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 1hO1Ch-0008oW-Sx; Tue, 07 May 2019 16:36:24 +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 5/5] iio: stmpe-adc: Reset possible interrupts Date: Tue, 7 May 2019 16:36:15 +0200 Message-Id: <20190507143615.28477-5-dev@pschenker.ch> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190507143615.28477-1-dev@pschenker.ch> References: <20190507143615.28477-1-dev@pschenker.ch> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190507_073635_761674_5A956D1B X-CRM114-Status: UNSURE ( 8.86 ) 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 , Marcel Ziswiler , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Philippe Schenker , David Laight , 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 Clear any interrupt that still is on the device on every channel this driver is activated for in probe and specific channels in the timeout handler. Signed-off-by: Philippe Schenker --- drivers/iio/adc/stmpe-adc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c index cc752a47444c..a5990e9f2c80 100644 --- a/drivers/iio/adc/stmpe-adc.c +++ b/drivers/iio/adc/stmpe-adc.c @@ -80,6 +80,8 @@ static int stmpe_read_voltage(struct stmpe_adc *info, ret = wait_for_completion_timeout(&info->completion, STMPE_ADC_TIMEOUT); if (ret <= 0) { + stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_STA, + STMPE_ADC_CH(info->channel)); mutex_unlock(&info->lock); return -ETIMEDOUT; } @@ -326,6 +328,9 @@ static int stmpe_adc_probe(struct platform_device *pdev) stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_EN, ~(norequest_mask & 0xFF)); + stmpe_reg_write(info->stmpe, STMPE_REG_ADC_INT_STA, + ~(norequest_mask & 0xFF)); + return devm_iio_device_register(&pdev->dev, indio_dev); }