Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3479445rwb; Sun, 9 Oct 2022 05:58:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM60FF6SwfXOjAZgFRI22illSsBzVZRj12aDVsp47L+wiLdjOLpBVwWqXU/vacGM0b5gzxuQ X-Received: by 2002:a63:5f54:0:b0:462:1149:f3b3 with SMTP id t81-20020a635f54000000b004621149f3b3mr1282764pgb.445.1665320333033; Sun, 09 Oct 2022 05:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665320333; cv=none; d=google.com; s=arc-20160816; b=Xua7Dj6KnhV2Vlesg49XLfofWXHjk6/0uVjaF/vKkTtDuJy/DkvH9PwtIP2bUdqH2S zay/CO7U3lsKMn+hD6XRUmIsYPlmgbCEq6ltzaGfOjqJ7uUkJkXf+1JAfTfrSJs2q3Zp f1viYUSIyaA6bgnyrbbQSKDTtL1JZgcnIoF3gYu31nUpEP/AnRd5DPAU1V/oJ3QMtzK4 35RBUSCSxnZ6l7zwsAWxYX0vsDOSDQ5tL7pFV8gEKN+kJcSAYhu/HeqF8vVUhGLHZ79y ZpSUtqgKu+hXAM/zwaCF1ocX0pWdbjFUoEcdB8piOTBqnX0rUdHYBdiF8jX5UZAqlphl 82Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=sd5+TUV4ortVI+VwBz+GCi2TFVWylv5E81kfdPsGgXw=; b=f+f0ytQ0K5SJpuoMl5mjcW7+9u+ixVWW4KAcxq9tsxIZXv80k3qgo1p/+BAY3buz/n QNQpYR2Ez9nlr/y5yZhy+Jm9MDbPDBpKcIvPE1E3ztVHxtfz8ej0QySJh1otq92KlDV3 Joo6xJ4N3jxFXs2NY4KJHHPOXhtV4bGgsvu1m0j8YJKgVTtQ4+IvHzIORrz0H3++pF3v EKkQuh3p2Cx5fYCagyxAZ7I41N8EnQMeLvKSgzUn+FcidPsKxisxBeTXpKGlN9wvY/aC Edav8XVyQ+bAl2N/mIj+Nqk6ZfYLCVSc4+/BMzADgSGj4uKZYfHPom/3dXtiqK3YmqDH K7Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VhIE7ZX6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h22-20020a631216000000b0045a3e1d1a6csi8759823pgl.712.2022.10.09.05.58.41; Sun, 09 Oct 2022 05:58:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VhIE7ZX6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230079AbiJIMdf (ORCPT + 99 others); Sun, 9 Oct 2022 08:33:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229728AbiJIMde (ORCPT ); Sun, 9 Oct 2022 08:33:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44F2E22B07; Sun, 9 Oct 2022 05:33:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E23B8B80D19; Sun, 9 Oct 2022 12:33:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE19DC433D6; Sun, 9 Oct 2022 12:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665318810; bh=9WyCokWSQ+YPo9bet+5rKNeJq50AKYj52DF+Ejp3zSY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VhIE7ZX6bvCAMvLCfiTxs2711lzx+ADlYUD7YVVTTFrZdjCxgqc8GTEHic/JE+W7d yj7Wtfcm3anovQseN1Kif2qsLA78Or+kWC2wg6zQNnfsXnmWZ3K6HguSlX6PK2mw7D RTdYJmUYTTEW7FqtwIqYCw1ceA31QBG9YckYxvURkeukotwI4yQWXiHJfQ+37UsCGy 8V4kMsOuv96o9t9+PC9NRXWwVxEiJsPnFY4f+Z3ZNxQ95MpzBJEXdeId5GnQhh3GI5 vE3It7kegVzCe2EAyPGUPpF9QPYjMtbfFlDwuEZiTscf1a7drJS+a4kAaZaMkPP0z8 gq9djqm7WPoAQ== Date: Sun, 9 Oct 2022 13:33:51 +0100 From: Jonathan Cameron To: Andy Shevchenko Cc: Matti Vaittinen , Matti Vaittinen , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Jagath Jog J , Nikita Yushchenko , Cosmin Tanislav , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 4/5] iio: accel: Support Kionix/ROHM KX022A accelerometer Message-ID: <20221009133351.6ff4894b@jic23-huawei> In-Reply-To: References: <88e24b01da9f44ebf5fcd8344ded0b75ff742fbf.1665066397.git.mazziesaccount@gmail.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Oct 2022 21:32:11 +0300 Andy Shevchenko wrote: > On Thu, Oct 06, 2022 at 05:38:14PM +0300, Matti Vaittinen wrote: > > KX022A is a 3-axis accelerometer from ROHM/Kionix. The senosr features > > include variable ODRs, I2C and SPI control, FIFO/LIFO with watermark IRQ, > > tap/motion detection, wake-up & back-to-sleep events, four acceleration > > ranges (2, 4, 8 and 16g) and probably some other cool features. > > > > Add support for the basic accelerometer features such as getting the > > acceleration data via IIO. (raw reads, triggered buffer [data-ready] or > > using the WMI IRQ). > > > > Important things to be added include the double-tap, motion > > detection and wake-up as well as the runtime power management. > > > > NOTE: Filling-up the hardware FIFO should be avoided. During my testing > > I noticed that filling up the hardware FIFO might mess-up the sample > > count. My sensor ended up in a state where the amount of data in FIFO was > > reported to be 0xff bytes, which equals to 42,5 samples. Specification > > says the FIFO can hold a maximum of 41 samples in HiRes mode. Also, at > > least once the FIFO was stuck in a state where reading data from > > hardware FIFO did not decrease the amount of data reported to be in the > > FIFO - eg. FIFO was "stuck". The code has now an error count and 10 > > reads with invalid FIFO data count will cause the fifo contents to be > > dropped. > > ... ... > ... > > > +module_param(g_kx022a_use_buffer, bool, 0); > > +MODULE_PARM_DESC(g_kx022a_use_buffer, > > + "Buffer samples. Use at own risk. Fifo must not overflow"); > > Why?! We usually do not allow module parameters in the new code. > Badly broken hardware - was my suggestion. Alternatives if there are usecases that need to use the fifo, but it can wedge hard in a fashion that is impossible to prevent from the driver? My gut feeling is still drop the support entirely with a strong comment in the code that the hardware is broken in a fashion we don't know how to work around. Jonathan