From patchwork Tue May 7 08:23:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Nyekjaer X-Patchwork-Id: 10932539 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 CAB4B13AD for ; Tue, 7 May 2019 08:23:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA200286CC for ; Tue, 7 May 2019 08:23:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADBE828927; Tue, 7 May 2019 08:23:20 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AF1F286CC for ; Tue, 7 May 2019 08:23:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726103AbfEGIXT (ORCPT ); Tue, 7 May 2019 04:23:19 -0400 Received: from first.geanix.com ([116.203.34.67]:42562 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726063AbfEGIXT (ORCPT ); Tue, 7 May 2019 04:23:19 -0400 Received: from zen.localdomain (unknown [85.184.147.232]) by first.geanix.com (Postfix) with ESMTPSA id F36169A4; Tue, 7 May 2019 08:22:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1557217359; bh=KUEy8lkDyGgm1Jf2E9ADSE8XlfO1mY2FOQ1/BZwwZpM=; h=From:To:Cc:Subject:Date; b=Z2vlBpYPyltF5ve/XRcfjSBBsdK4cM6nhFV/Y4lcB8sKF/riXNCiwRC3JvaT9b6Sx fUGzAZG539oo8WylE5BCVSYnPLAsGI7+HH3Kt6lpafOdCTEBHWXT6U30iRBZYd0ELs Jm82uLkPb2TekkvJEo/cBvf8Kt9wx7xnNfrvPlBqswgwLEBDWXdxZaqaBLD0Tcqqx3 jhg6dHp6Jw/wuQ3g6lNaVGSNaOIDSiPb+0yTnoRNawYl8zDUHWkprVwfjne5tCB8ON hvDGhZSkM7bLvQxw1x0MgFQTvO34G5AYUe7rAj0EZprEPhccF4050iLyTZC8j8pw6Z nbFUk/TcTH6vA== From: Sean Nyekjaer To: linux-iio@vger.kernel.org, jic23@kernel.org Cc: Sean Nyekjaer Subject: [PATCH 1/2] iio: adc: ti-ads8688: save values correct in buffer Date: Tue, 7 May 2019 10:23:03 +0200 Message-Id: <20190507082304.11692-1-sean@geanix.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fill the read values in the buffer so we comply with the given index values. Fixes: 2a86487786b5c ("iio: adc: ti-ads8688: add trigger and buffer support") Signed-off-by: Sean Nyekjaer --- drivers/iio/adc/ti-ads8688.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c index f9461070a74a..d9c354dbd7e4 100644 --- a/drivers/iio/adc/ti-ads8688.c +++ b/drivers/iio/adc/ti-ads8688.c @@ -387,13 +387,12 @@ static irqreturn_t ads8688_trigger_handler(int irq, void *p) struct iio_poll_func *pf = p; struct iio_dev *indio_dev = pf->indio_dev; u16 buffer[ADS8688_MAX_CHANNELS + sizeof(s64)/sizeof(u16)]; - int i, j = 0; + int bit; - for (i = 0; i < indio_dev->masklength; i++) { - if (!test_bit(i, indio_dev->active_scan_mask)) - continue; - buffer[j] = ads8688_read(indio_dev, i); - j++; + memset(buffer, 0, sizeof(buffer)); + + for_each_set_bit(bit, indio_dev->active_scan_mask, indio_dev->masklength) { + buffer[bit] = ads8688_read(indio_dev, bit); } iio_push_to_buffers_with_timestamp(indio_dev, buffer, From patchwork Tue May 7 08:23:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Nyekjaer X-Patchwork-Id: 10932541 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 AF7F314DB for ; Tue, 7 May 2019 08:23:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A13B1286CC for ; Tue, 7 May 2019 08:23:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 953CA28927; Tue, 7 May 2019 08:23: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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 444E5286CC for ; Tue, 7 May 2019 08:23:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726175AbfEGIXU (ORCPT ); Tue, 7 May 2019 04:23:20 -0400 Received: from first.geanix.com ([116.203.34.67]:42566 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726063AbfEGIXU (ORCPT ); Tue, 7 May 2019 04:23:20 -0400 Received: from zen.localdomain (unknown [85.184.147.232]) by first.geanix.com (Postfix) with ESMTPSA id D73B79EE; Tue, 7 May 2019 08:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1557217360; bh=NrfwDtp6F2bgm/6UPCb/JSu6blnlk9a81UTHq+Kuq2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aGEGeC6OVJLN3T4KqbdBwh3/g323Hz+aRm2JcXIsudsTN0cwRhN8xAZ0vX1LzN7Nr nelTbgU0vI7dZMxp6pZi3WNUKqokfXDqIx86iUzzPWcTMcDbKd2DRkqhtZFVLCq8tC 5zqphpj3GVbvTBw4JUpplgcCNDljyBVbtBbSYDCcgwaTxFu34NnlOM2vD5IrWzvd1s CNxIuOBCO9eK81bTOsnL8FFLbpPzI1E1RUiD67Sn/x/vPGKfUUhKO3cbKpsKFGvbzP VhoMhJLAdh2AFZzRS4ohoIYB5u3RI9dEMn9U6AyGKnb3zrID99D012KOiMSOWpOwb2 5DliLtvsh+S3Q== From: Sean Nyekjaer To: linux-iio@vger.kernel.org, jic23@kernel.org Cc: Sean Nyekjaer Subject: [PATCH 2/2] iio: adc: ti-ads8688: fix timestamp is not updated in buffer Date: Tue, 7 May 2019 10:23:04 +0200 Message-Id: <20190507082304.11692-2-sean@geanix.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190507082304.11692-1-sean@geanix.com> References: <20190507082304.11692-1-sean@geanix.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When using the hrtimer iio trigger timestamp isn't updated. If we use iio_get_time_ns it is updated correctly. Fixes: 2a86487786b5c ("iio: adc: ti-ads8688: add trigger and buffer support") Signed-off-by: Sean Nyekjaer --- drivers/iio/adc/ti-ads8688.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ti-ads8688.c b/drivers/iio/adc/ti-ads8688.c index d9c354dbd7e4..304cad3dddc6 100644 --- a/drivers/iio/adc/ti-ads8688.c +++ b/drivers/iio/adc/ti-ads8688.c @@ -396,7 +396,7 @@ static irqreturn_t ads8688_trigger_handler(int irq, void *p) } iio_push_to_buffers_with_timestamp(indio_dev, buffer, - pf->timestamp); + iio_get_time_ns(indio_dev)); iio_trigger_notify_done(indio_dev->trig);