Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1730960rwb; Sun, 14 Aug 2022 10:39:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR6BSylhyRTw/O3Tq8XWujLB/BEtzfcPKvbHIilqI51E4ru1X/r0vvnRaMqe59DGYwkqykQq X-Received: by 2002:a05:6402:4282:b0:43e:612c:fcf7 with SMTP id g2-20020a056402428200b0043e612cfcf7mr11162000edc.242.1660498754147; Sun, 14 Aug 2022 10:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660498754; cv=none; d=google.com; s=arc-20160816; b=nSsxxJV9PhrguOvemviSx7ZQIKcHQfgiu5zfGN7S6CmpbZROH2bqW/xTqxG0YV0/3G INgiyxtTFSF338smwRvS19dgZL2BYf2nVpdwfffl5v6n7+iAeXxHjX+nKoJaCfvEZw0o akK3dvEfxgDktCH6/oeVI3HyLQ1Cy9H4O0VUJpQnHcBfTOeXJHqoa9cip5FJZaiOdORf ewawLzVLiXc7s/jxL9USC8LoMni5Xh0M8em42DJitz7eJvZyP7CsLiFWeYx+ulep24nf caKMKj6rOGhlkBDUW91sprd04McDM3AH2yigFYnXG8KAbunZGyDsoAwMx/rSQNWlvesz p0Cw== 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=odybq/G3nwp17cGZQAkiNtnU8ZcocMQ9hilu3ws7Gm4=; b=GiqjqZEnNhUQY7zo3DbM3q0t8sCZwV1UlZDLL+UKit8B3nHoKRSL8Q77LBwTEYoJmJ QZ5M5Bz27ai/ZjjOF+CM4kGsKOW4lWszLW0iRtB4zpUv+iapCucYcGEt6LXbxZLSCjgX dli7rtHLzScw8/tZ0LTVP36bTlwpJbBnP/wjyxFga9IFxfXTFnrJJpmuk2N4ahB2F3Ha xxQRyCaUyKAecQ6fyDs3rladW9VlyO743+uhtYr5JR4o5ms/f2h3DRyt9z/5xk68LlPu yqeflmlffUpn+q17XuO4/UyoKZ/1prgr3VAiqDJCDcSoMpILajYt0bYZKwmiVlXtraQM GDsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CaIBR7n0; 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 jg40-20020a170907972800b006feb76dbd51si6629745ejc.289.2022.08.14.10.38.49; Sun, 14 Aug 2022 10:39:14 -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=CaIBR7n0; 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 S232033AbiHNRCx (ORCPT + 99 others); Sun, 14 Aug 2022 13:02:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241053AbiHNRCd (ORCPT ); Sun, 14 Aug 2022 13:02:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B81A14096; Sun, 14 Aug 2022 10:01:44 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 2490C60CF2; Sun, 14 Aug 2022 17:01:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AD68C433D6; Sun, 14 Aug 2022 17:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660496503; bh=C+NBUIt/OAPZ5ok6KDEfnNIxE6j/hCtl+wI/5p8/VEQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CaIBR7n0o2HWHt1nvGMDVMISp52uros2CkV0utEBBDCCtSFEUS51UaxBQgqSX3yIW HVm5Um6vduPB3xRzdtFnFY4+QQE6Gl6UaJishPEYj0JmuEdosaZUWldiZEMtTXniQy sNtYKrbak2aDxp+g6gcl1uozBgennkKyCrz9Zt+qPoed7E8yKDeGYN1/X2ub9fI8hR dkMoG+C7q50ixHigMsmV0IpjVvj2uQaKsM5Ob9E35EUVI36J9Ce6itVxWFHoenEDrs iQDC9SFaU5vLbKM1HV5/eNKxfmxDNLK/rFWqDcLv6eCP8YphaS8SgFA7XulyPn/Hi5 U0Yjho3XHxOkQ== Date: Sun, 14 Aug 2022 18:12:12 +0100 From: Jonathan Cameron To: Jagath Jog J Cc: andy.shevchenko@gmail.com, hadess@hadess.net, hdegoede@redhat.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] iio: accel: bma400: Add support for single and double tap events Message-ID: <20220814181212.2171bd34@jic23-huawei> In-Reply-To: <20220813071803.4692-3-jagathjog1996@gmail.com> References: <20220813071803.4692-1-jagathjog1996@gmail.com> <20220813071803.4692-3-jagathjog1996@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.2 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,T_SCC_BODY_TEXT_LINE 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 Sat, 13 Aug 2022 12:48:03 +0530 Jagath Jog J wrote: > Add support for single and double tap events based on the tap threshold > value, minimum quiet time before and after the tap and minimum time > between the taps in the double tap. The INT1 pin is used to interrupt > and the event is pushed to userspace. > > Signed-off-by: Jagath Jog J Hi Jagath, As, for this series, the difficult bit from review point of view is the ABI I've only taken a quick look at the implementation. Basically looks fine to me, but one trivial thing below (and that might just be me failing to read a diff) ... > ret = bma400_steps_event_enable(data, state); > @@ -1157,10 +1379,10 @@ static int bma400_read_event_value(struct iio_dev *indio_dev, > int *val, int *val2) > { > struct bma400_data *data = iio_priv(indio_dev); > - int ret, reg; > + int ret, reg, reg_val, raw; > > - switch (chan->type) { > - case IIO_ACCEL: We've lost the check on ACCEL I think. Might be worth putting it back as if (chan->type != ACCEL) return -EINVAL; > + switch (type) { > + case IIO_EV_TYPE_MAG: > reg = get_gen_config_reg(dir); > if (reg < 0) > return -EINVAL; > @@ -1196,6 +1418,39 @@ static int bma400_read_event_value(struct iio_dev *indio_dev, > default: > return -EINVAL; > } > + case IIO_EV_TYPE_GESTURE: > + switch (info) { > + case IIO_EV_INFO_VALUE: > + ret = regmap_read(data->regmap, BMA400_TAP_CONFIG, > + ®_val); > + if (ret) > + return ret; > + > + *val = FIELD_GET(BMA400_TAP_SEN_MSK, reg_val); > + return IIO_VAL_INT; > + case IIO_EV_INFO_RESET_TIMEOUT: > + ret = regmap_read(data->regmap, BMA400_TAP_CONFIG1, > + ®_val); > + if (ret) > + return ret; > + > + raw = FIELD_GET(BMA400_TAP_QUIET_MSK, reg_val); > + *val = 0; > + *val2 = tap_timeout[raw]; > + return IIO_VAL_INT_PLUS_MICRO; > + case IIO_EV_INFO_TAP_2MIN_DELAY: > + ret = regmap_read(data->regmap, BMA400_TAP_CONFIG1, > + ®_val); > + if (ret) > + return ret; > + > + raw = FIELD_GET(BMA400_TAP_QUIETDT_MSK, reg_val); > + *val = 0; > + *val2 = doubletap_2min_delay[raw]; > + return IIO_VAL_INT_PLUS_MICRO; > + default: > + return -EINVAL; > + } > default: > return -EINVAL; > }