From patchwork Tue May 22 14:18:18 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: 10418723 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 D1693600CC for ; Tue, 22 May 2018 14:19:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF85A28C79 for ; Tue, 22 May 2018 14:19:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B458628C7D; Tue, 22 May 2018 14:19:02 +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 0E0E728C79 for ; Tue, 22 May 2018 14:19:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751517AbeEVOTB (ORCPT ); Tue, 22 May 2018 10:19:01 -0400 Received: from mail-bl2nam02on0050.outbound.protection.outlook.com ([104.47.38.50]:38077 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751196AbeEVOSq (ORCPT ); Tue, 22 May 2018 10:18:46 -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:X-MS-Exchange-SenderADCheck; bh=1SsV6KvZ3cmm/b3qvPginOR/tFJSXXn3IQoTEGXgj3M=; b=bv08028g3SdRM3hWt0KmLXhiO/NFSSy0NSPxJP8ofm9kBrVW1MWrmut9lEusAi2hFAsCYGnrNCBgpygT4BGgBqtkyL4JtAmth/FcOlaZzow4L3dlM5vaDlVhQnRLTjDT50svWSFbd9szGf4jYCNkoLOyuNxOVRe1+A2LmnOvoK4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=JManeyrol@invensense.com; Received: from frgnb-12nlpn2.invcorp.invensense.com (2a01:e35:87fd:c140:d9b1:749c:d974:2408) by DM5PR1201MB0187.namprd12.prod.outlook.com (2603:10b6:4:56::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Tue, 22 May 2018 14:18:43 +0000 From: Jean-Baptiste Maneyrol To: linux-iio@vger.kernel.org Cc: Jean-Baptiste Maneyrol Subject: [PATCH v2 1/5] iio: imu: inv_mpu6050: replace timestamp fifo by generic timestamp Date: Tue, 22 May 2018 16:18:18 +0200 Message-Id: <20180522141822.11598-1-jmaneyrol@invensense.com> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 X-Originating-IP: [2a01:e35:87fd:c140:d9b1:749c:d974:2408] X-ClientProxiedBy: LNXP265CA0069.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5d::33) To DM5PR1201MB0187.namprd12.prod.outlook.com (2603:10b6:4:56::11) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM5PR1201MB0187; X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0187; 3:zTvZ0u5CPAYahgtzD/nwzV0ZATYJkQIqTmiR0PDakxjPPe6ociNm+sy+4Z0iuOtcZ5NWZcSHdyjYeXyVjF0xSGo5BX8cvMwKKOdeFFtll6gK4Af3Nfl4GdK3/CCnAx7E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owbJFZavVUecPMItVq5Dtrm2c3A0YykcLgp+qHpCbea7KaPipqafv88P3BJvWGBU3LJ3wwqjq8V7yx1ic2J+jVTxaq7phKp7daGkAvfCHP3o9sWBNjr90OLdiGWTa5W+7LNNixdRGZMjNXNZMl2S4zTF14xFvrnnwSDAPVg6HlNtFgsQRMR6uq99Cjnx8XfvGZCc3k7PMrSOgF6Ys; 4:yHVpKLGKr5TFICvORSSerjs0JYrHinJyXGk7wzWxxUOFJC62Ns6AJQotdi6lZukd2a1babVXP3JNX3PGYwxLezLLhwcJjF1YZXM1bP7ikZ+IKb85+avpPRGjawvnBYp69UGk7HTNrMt26aDUhUQ8ZOqcSIkgntslrvliXox4BWNOVRW1slJfix8YyZr/YfUPJG3lTLfXpBJ/y1d/rer4tmpeo1UlG7VpDUaPicA+wakHEcSelamvtzSq2V3MmNZngG1JkkmD6kwM10wWhQJYy4M1udkatqAKCEgzUeIhj2YFvEf5iTFX7TV10xzxNuyOXpP+H7I/xRuLzL4wKN27488vmL6uPDRF6Z2cWsTVR+k= 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)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:DM5PR1201MB0187; BCL:0; PCL:0; RULEID:; SRVR:DM5PR1201MB0187; X-Forefront-PRVS: 0680FADD48 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(396003)(376002)(366004)(39850400004)(346002)(199004)(189003)(50226002)(8676002)(52396003)(81156014)(6116002)(5660300001)(107886003)(36756003)(316002)(80792005)(97736004)(7736002)(4326008)(52116002)(1076002)(8936002)(305945005)(81166006)(7696005)(6486002)(53936002)(51416003)(186003)(476003)(2616005)(59450400001)(50466002)(48376002)(2361001)(16526019)(46003)(478600001)(106356001)(16586007)(386003)(68736007)(86362001)(2351001)(486006)(6666003)(6916009)(72206003)(105586002)(2906002)(25786009)(47776003)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR1201MB0187; H:frgnb-12nlpn2.invcorp.invensense.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: invensense.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR1201MB0187; 23:V1kgcpG82+kSEbyRCVMY4fizO1AyBNobFxVppsc?= =?us-ascii?Q?b5nT3UpmliMTQZrpQ8daf7Wh1/BysYIhQdrVPwKsDTMRSUz/UVdqdNSiD7pE?= =?us-ascii?Q?5EKYKwRavK87hAAdlteWZoKNOqm++uHi/pwjtqucvCWtdxo7KFSgm88fKPdb?= =?us-ascii?Q?qCob82sayJLVai/5StUN39myg/+chTRk3Lyx7snxg7Z3A9zWo4k1nfJbVACw?= =?us-ascii?Q?WCoopnkgyVYNQZQBK/Wx8hQ6flPHVrexbLwhABFFPNMiFe2NmpL7YWRaKFUd?= =?us-ascii?Q?7nBxBv3l62QjHUZxbaDjbIgZMQ603ex0/TR7ECXE2QqvIRCvOaghnd6Zw250?= =?us-ascii?Q?lgGU1FuPZgvIwKR8DVzyOhI109Cvy/rBwqej4nnnFR9Kbe1QOWAKNsVNdRhb?= =?us-ascii?Q?T68TZsqoP/JnIejA6Asinx0WedtbWkc1HYgYLXjZ2KKAoqFH2aSZBANf8gac?= =?us-ascii?Q?n2HqzSnK74/l7VPL52ElAniZv+GHpA3UCrpNfnoOOJNp+FtHDmxG+LkhHDig?= =?us-ascii?Q?T34sAggyySwCEw26GSUDRlCKuauPjz5kpNtmF8GGnjiHDg62VplqvnZk8gHo?= =?us-ascii?Q?jt9AKgQleQ+7ekD16oNHMbiWKm5BAB1B+YzWqy37nfXZbDsLo4ZvJ3KOOis4?= =?us-ascii?Q?nE0rIRGMnXRMBEb/j9Gn8qP3pSP6wkcVx7CWcPP2zNhIdV4q2s27y61bwhCT?= =?us-ascii?Q?s/bibi5OSM2BC4MJtbxND1aXxjh5tg9wv4sopQB1wgJ6E/c0FhcxB+hgCceA?= =?us-ascii?Q?EWbetaNOpcZDqPyQOU7B8d3vSe520rGPhDEORvB3DKFbqf3vjY8T71I0M5OP?= =?us-ascii?Q?sg+C0CjKD52tjr6kLRchSORjnY13679Vm1BCSVnWbiocm8K4XjyB4mtLC3M5?= =?us-ascii?Q?E3HNihyH4DvivA4rTuFDxQy23mcPmhbhlezRrRBNJIdhHC8YHss3TN9rvmVh?= =?us-ascii?Q?eKxgBvSNN4XmwtFOrZp1YDSkEIegJ8dWqKwrd8gXgS2w87awkIwEBV6wIUNN?= =?us-ascii?Q?qF4MHG+UeQhHhd25xbMXyE+bBAeMap7kYbh8WArQK/5k4iAImyxVt5+Hkgij?= =?us-ascii?Q?/pr7QL6p5XmQnRwUkz0t5pd5KFNZ1H3ZWoU8nViHVEbRoNMdqL6P2pLsc2TW?= =?us-ascii?Q?gFUjkXcgiRa3Dqk8OvWyAR8hvu3rmLaHd5NXsTVUDrOkvNkpE6if+tSvEpoN?= =?us-ascii?Q?FkOKownq1QVS5pU7uHe65OcpjUZB9myBVyTnblRHRHRvDPBNwlPFxd/fFXQ?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Antispam-Message-Info: bbM0jRwbEE1lXvxzdPPd3cewew9xBJ2Fo2GpW8XtX1SZ+YC17v86hxVsoRO0X7XWXd0avt/ZTEBZ7qC/olVmlgoE+Nik7ZV0PPS5PF/UtO6dSGJqtAMzAgJTO0b8igSuquEN98OQ4JXxwWRHpsNOErbl9rpq7DsJmHk6O4i+H4d9CZ1qEASmlFuC9k0oV6xY X-Microsoft-Exchange-Diagnostics: 1; DM5PR1201MB0187; 6:MVyi8mYC+r0crR58/KF0N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YhG68IwKOIbeC6r7fu0o1IO3RhGh1zT2bOAJ57zfoOOGbBTExG/4W8i7H2VjMM/V10y0C6uesbY3SHEJ3jCPFAREBQACU4+zqusK8d2RNYAR1+TDoer2jDz26+ea2SCIO06g8J1/zuaLxPjrMQidjItiu/7XTXwGtbxGc356k= X-MS-Office365-Filtering-Correlation-Id: d4ac4d15-0d69-424d-d404-08d5bfeeed0c X-OriginatorOrg: invensense.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2018 14:18:43.6861 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4ac4d15-0d69-424d-d404-08d5bfeeed0c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 462b3b3b-e42b-47ea-801a-f1581aac892d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0187 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 43fba5f7532b..1e7e750294fc 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 c54da777945d..a92ddd45586c 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 1795418438e4..5436d181f2dc 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) { @@ -98,23 +84,6 @@ int inv_reset_fifo(struct iio_dev *indio_dev) return result; } -/** - * 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. */ @@ -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);