From patchwork Mon May 14 21:05:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Baptiste Maneyrol X-Patchwork-Id: 10399231 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2CBF9600F4 for ; Mon, 14 May 2018 21:06:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA09B2851D for ; Mon, 14 May 2018 21:06:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E79728526; Mon, 14 May 2018 21:06:26 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 C117D2851D for ; Mon, 14 May 2018 21:06:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752453AbeENVGY (ORCPT ); Mon, 14 May 2018 17:06:24 -0400 Received: from mail-cys01nam02on0070.outbound.protection.outlook.com ([104.47.37.70]:61284 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752432AbeENVGT (ORCPT ); Mon, 14 May 2018 17:06:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=invensense.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=btxVDSV9rEAPYfQ18W5yCLDlo2IKPlAA1ONIx8R1dzY=; b=qNDYxudFltseewFw6Rd3y4rxhanUokWyEfyV2w7pbXkWUSN+MtHbsKucbHIUrtJ46XBRVTlNnrN+nyhiq65hbtjEQZ/gHT9EahQDsFnDy0yvzCjFZky0FlfES9IsInYq7PC+9xOC2XMLajEb9r3w25NMG+UloxOxpzCW191NsRY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=JManeyrol@invensense.com; Received: from frgnb-l-34296kv.invcorp.invensense.com (2a01:e35:87fd:c140:998d:db6c:4387:dfad) by MWHPR1201MB0191.namprd12.prod.outlook.com (2603:10b6:301:56::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Mon, 14 May 2018 21:06:16 +0000 From: Jean-Baptiste Maneyrol To: linux-iio@vger.kernel.org Cc: Jean-Baptiste Maneyrol Subject: [PATCH 1/5] iio: imu: inv_mpu6050: replace timestamp fifo by generic timestamp Date: Mon, 14 May 2018 23:05:51 +0200 Message-Id: <1526331955-11869-1-git-send-email-jmaneyrol@invensense.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [2a01:e35:87fd:c140:998d:db6c:4387:dfad] X-ClientProxiedBy: LO2P265CA0024.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:62::36) To MWHPR1201MB0191.namprd12.prod.outlook.com (2603:10b6:301:56::13) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:MWHPR1201MB0191; X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0191; 3:SCljvkc5x5F8XuaNtwgJwFcy2UTJI8RunAtra1yR0H+OfpZpZlZjkNz9NSKgBIYLem6GV11Ub8VWIl8AlLSzEYjIELsLh6ZWoRvj0wyHBFJIjBTdQlInOVesR+w1INjwLs+HaQmLbyDCY2hKhKsllF1PrQajm19b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JAijNwJuPAAqwTvjPyJh5FydmKCTtNmOq+B2en7N4HrWRvaOjoS3u3m6aAudeK8lZiyZuWip9A+AjmbUbRTrfhNkaJqAwbH0VY+gxiFojvkYd4kU1j+FRavekHjv65mq7p6IVIc+XlUMn+5KYeFyXmKeDwcPrggsAvcpKk9YdAUKGCdsNhlVy+03n+M4k08LQNwp; 4:cCFB99G+cxFDJg7buzBwS41niQg1tKFH4Ru3C0KsbgFN89Ejpv/fGd7fMVV3T7CYB44h66BE57mC38Yi/qJMcu+kOwMDULSUKnc5Mb4CGF1inX+KPEuv5885XchPvggUKuFLxR6KUyzR5ksOx474e8lnkCkuaFFYoP+imuPSOEoVBMA6sOhY6owN3lxeK1Uv+M5PvFOlzFjeh2jSvnCo3ICcGxDy1Gw8LWcaq9/oT4BAxuCNI7CEgvP7qKl+P4RRW+9b6yYs+5LRcc1IvLkpoWb5vnncRPyEqHpMLOJMEgVk2MBndeecqTumYMmHQf3rvm/zvpMgbWeoUNLpRK7y2cETjZqGMeESRVF7cJMteEg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(257004950022427); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:MWHPR1201MB0191; BCL:0; PCL:0; RULEID:; SRVR:MWHPR1201MB0191; X-Forefront-PRVS: 067270ECAF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(366004)(39380400002)(376002)(39850400004)(346002)(189003)(199004)(81156014)(186003)(7736002)(59450400001)(6666003)(4326008)(386003)(48376002)(52396003)(50466002)(25786009)(80792005)(8936002)(68736007)(47776003)(6916009)(107886003)(8676002)(16526019)(36756003)(2906002)(53936002)(50226002)(6116002)(478600001)(305945005)(86362001)(72206003)(2351001)(46003)(6486002)(5660300001)(316002)(486006)(7696005)(52116002)(81166006)(51416003)(97736004)(476003)(105586002)(106356001)(2361001)(16586007)(2616005)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR1201MB0191; H:frgnb-l-34296kv.invcorp.invensense.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: invensense.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR1201MB0191; 23:ZSQ2WQbQqi0U+JjXh9lZfsYTGiEPmiVpzfxKVwy?= =?us-ascii?Q?ey7YIqwoe9j1ORhwOUaTngnUYEZvDVIpzz/G85IfYpu0lKnATAF9vQ1XvWw3?= =?us-ascii?Q?DezUlOB0ztghvbndCCR9KuxVQNkAfPhMcdcbJt9kWDPVvOzaZ/pRVb/KEsIq?= =?us-ascii?Q?PUFjBGPqL22AoAlob+Gg9J216bzukw74cLCPQI/saWemdawn9zIJH01EHc0b?= =?us-ascii?Q?Q2WmoO7QCfoMXqEla64jIJFMR6kMqz8/5Hil6sXHspPmajj0ypEWtzdwkBkt?= =?us-ascii?Q?5qhQS65pW5m8Y9YMJI7PvxJE4ZxM+yPdopC0kMy+WuPYDCh6KqCMDI1vdfqd?= =?us-ascii?Q?FQZC2giyPnC75edEEg2L3fpDYtcH26BEzwVsuWGVCrcT2ViEiKJ50eaxYIuP?= =?us-ascii?Q?xs2ZfYKUpUhAxZn+5CiOozecsJhhJnRKXcLwAzuyCh84AURdQlGtBb1pYyf1?= =?us-ascii?Q?+yzcu2UkE3Ul/P/ZJoPgn+ZuokjVhN8nn8PB+piy0eqZhMhAdTuZTGnRPm1w?= =?us-ascii?Q?XCCFUvJIXEwX/dBVVN3EgYj9+H2b96njET95tiZrlJ+sRH4ySXcK5MdhYAmp?= =?us-ascii?Q?N9CBVETaXHSyFqeqteCyGKe4Rk4u82007SqQfJf5PgjO7Dkj95H3ilMq5SDn?= =?us-ascii?Q?pp1efeeBLMEpnPkFZCAikIHSfm7ZjSvMADjtyp+vbJHyg3iJgTM1derjz1lN?= =?us-ascii?Q?AQyrwKGh4KLVlR+4fPMHnIhphQENt8dMHZ/9//oMLCrBifMPECI6MWbtO1NN?= =?us-ascii?Q?0zhLIz86T3aqGqHofPXIRS5vY9fmXS/wg41KK6cdstarMvWA1EwVI32TLorn?= =?us-ascii?Q?xwqdyGKAeBMlmopujJgQj1nKohAMNrPLlA3bO3ru2CYeOsIDaRNey4oUQk68?= =?us-ascii?Q?a6BUnffWm1XyOqCFDh1SL4eE/8InxiUzTMN5PSHGAky/KNJfkhmrzDllzzQG?= =?us-ascii?Q?M+FIRU3fS0hQHGIdOs1mbc111vVm+fT5v0lx07dAAPEEbsIM+mitjvY0SxMe?= =?us-ascii?Q?VAldsvAH/ZpNv0snqTvBVj0mGt1EF2PoxXWPhNj3v4C33axBfcu9fdXIehOq?= =?us-ascii?Q?kv5Qi2SSmmrdCb3yJh8iBb1KZ7C57r5Nfv1MeYCcKHytEdYkc+4VwdFQKOv+?= =?us-ascii?Q?bfTqvAbIXhNgdPuF0eZlq+QirLmpZI83QgUsjATB0bxy59BRzThadY4Iuipl?= =?us-ascii?Q?933x955PlVE2tVCmAdMM7DKFXJoEBAsHsysRyOVDnYyWW4OByQz72pZTjqw?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Antispam-Message-Info: UXyTr+cMHd2FYMnAvs38mY/WAkmWSshOYxGzhc+0wVtUvBBG8nmZjl8VaG+HXBn4LPJjlutX8J4MBp3jcaq1qM2PLxLkEZcNX7WZwZmiF/8ToJfXZ0JsZRbNiWqFkwl3RVLpDMv8m0pG0sXHNEy84VkTW0WtbgkPKSlaevvio+im0U7FFU2ZcxU9zdUlGovY X-Microsoft-Exchange-Diagnostics: 1; MWHPR1201MB0191; 6:DBtdJoIPJ/C92JeHSDq0LsOJAU6SgdF3xZXtBM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filtering-Correlation-Id: 19f2ba7d-c177-4ff7-9f75-08d5b9de88f6 X-OriginatorOrg: invensense.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2018 21:06:16.5316 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 19f2ba7d-c177-4ff7-9f75-08d5b9de88f6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 462b3b3b-e42b-47ea-801a-f1581aac892d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0191 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 Using a fifo for storing timestamps is useless since the interrupt is in one-shot mode, preventing the hard irq handler to be called when the irq thread is running. Instead use the generic timestamp function iio_pollfunc_store_time. Signed-off-by: Jean-Baptiste Maneyrol --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 6 +--- drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 10 ------- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 44 +----------------------------- 3 files changed, 2 insertions(+), 58 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 43fba5f..1e7e750 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include #include #include @@ -996,7 +994,7 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, indio_dev->modes = INDIO_BUFFER_TRIGGERED; result = devm_iio_triggered_buffer_setup(dev, indio_dev, - inv_mpu6050_irq_handler, + iio_pollfunc_store_time, inv_mpu6050_read_fifo, NULL); if (result) { @@ -1009,8 +1007,6 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, return result; } - INIT_KFIFO(st->timestamps); - spin_lock_init(&st->time_stamp_lock); result = devm_iio_device_register(dev, indio_dev); if (result) { dev_err(dev, "IIO register fail %d\n", result); diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h index c54da77..a92ddd4 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h @@ -12,8 +12,6 @@ */ #include #include -#include -#include #include #include #include @@ -116,36 +114,30 @@ struct inv_mpu6050_hw { /* * struct inv_mpu6050_state - Driver state variables. - * @TIMESTAMP_FIFO_SIZE: fifo size for timestamp. * @lock: Chip access lock. * @trig: IIO trigger. * @chip_config: Cached attribute information. * @reg: Map of important registers. * @hw: Other hardware-specific information. * @chip_type: chip type. - * @time_stamp_lock: spin lock to time stamp. * @plat_data: platform data (deprecated in favor of @orientation). * @orientation: sensor chip orientation relative to main hardware. - * @timestamps: kfifo queue to store time stamp. * @map regmap pointer. * @irq interrupt number. * @irq_mask the int_pin_cfg mask to configure interrupt type. */ struct inv_mpu6050_state { -#define TIMESTAMP_FIFO_SIZE 16 struct mutex lock; struct iio_trigger *trig; struct inv_mpu6050_chip_config chip_config; const struct inv_mpu6050_reg_map *reg; const struct inv_mpu6050_hw *hw; enum inv_devices chip_type; - spinlock_t time_stamp_lock; struct i2c_mux_core *muxc; struct i2c_client *mux_client; unsigned int powerup_count; struct inv_mpu6050_platform_data plat_data; struct iio_mount_matrix orientation; - DECLARE_KFIFO(timestamps, long long, TIMESTAMP_FIFO_SIZE); struct regmap *map; int irq; u8 irq_mask; @@ -234,7 +226,6 @@ struct inv_mpu6050_state { /* init parameters */ #define INV_MPU6050_INIT_FIFO_RATE 50 -#define INV_MPU6050_TIME_STAMP_TOR 5 #define INV_MPU6050_MAX_FIFO_RATE 1000 #define INV_MPU6050_MIN_FIFO_RATE 4 #define INV_MPU6050_ONE_K_HZ 1000 @@ -300,7 +291,6 @@ enum inv_mpu6050_clock_sel_e { NUM_CLK }; -irqreturn_t inv_mpu6050_irq_handler(int irq, void *p); irqreturn_t inv_mpu6050_read_fifo(int irq, void *p); int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev, int irq_type); int inv_reset_fifo(struct iio_dev *indio_dev); diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c index 1795418..5436d18 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c @@ -19,20 +19,9 @@ #include #include #include -#include #include #include "inv_mpu_iio.h" -static void inv_clear_kfifo(struct inv_mpu6050_state *st) -{ - unsigned long flags; - - /* take the spin lock sem to avoid interrupt kick in */ - spin_lock_irqsave(&st->time_stamp_lock, flags); - kfifo_reset(&st->timestamps); - spin_unlock_irqrestore(&st->time_stamp_lock, flags); -} - int inv_reset_fifo(struct iio_dev *indio_dev) { int result; @@ -62,9 +51,6 @@ int inv_reset_fifo(struct iio_dev *indio_dev) if (result) goto reset_fifo_fail; - /* clear timestamps fifo */ - inv_clear_kfifo(st); - /* enable interrupt */ if (st->chip_config.accl_fifo_enable || st->chip_config.gyro_fifo_enable) { @@ -99,23 +85,6 @@ int inv_reset_fifo(struct iio_dev *indio_dev) } /** - * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt. - */ -irqreturn_t inv_mpu6050_irq_handler(int irq, void *p) -{ - struct iio_poll_func *pf = p; - struct iio_dev *indio_dev = pf->indio_dev; - struct inv_mpu6050_state *st = iio_priv(indio_dev); - s64 timestamp; - - timestamp = iio_get_time_ns(indio_dev); - kfifo_in_spinlocked(&st->timestamps, ×tamp, 1, - &st->time_stamp_lock); - - return IRQ_WAKE_THREAD; -} - -/** * inv_mpu6050_read_fifo() - Transfer data from hardware FIFO to KFIFO. */ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) @@ -127,7 +96,7 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) int result; u8 data[INV_MPU6050_OUTPUT_DATA_SIZE]; u16 fifo_count; - s64 timestamp; + s64 timestamp = pf->timestamp; int int_status; mutex_lock(&st->lock); @@ -171,28 +140,17 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p) goto flush_fifo; if (fifo_count > INV_MPU6050_FIFO_THRESHOLD) goto flush_fifo; - /* Timestamp mismatch. */ - if (kfifo_len(&st->timestamps) > - fifo_count / bytes_per_datum + INV_MPU6050_TIME_STAMP_TOR) - goto flush_fifo; do { result = regmap_bulk_read(st->map, st->reg->fifo_r_w, data, bytes_per_datum); if (result) goto flush_fifo; - - result = kfifo_out(&st->timestamps, ×tamp, 1); - /* when there is no timestamp, put timestamp as 0 */ - if (result == 0) - timestamp = 0; - /* skip first samples if needed */ if (st->skip_samples) st->skip_samples--; else iio_push_to_buffers_with_timestamp(indio_dev, data, timestamp); - fifo_count -= bytes_per_datum; } while (fifo_count >= bytes_per_datum);