Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2469468rwe; Sun, 28 Aug 2022 12:22:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR5/AsrrIdSgNZ+1ySYvLyklEWnmIGSszmC3XIuyqGCZCOgOD7CywfS1BE60yKbBLuhw/8D/ X-Received: by 2002:a17:902:7689:b0:170:8b17:37f4 with SMTP id m9-20020a170902768900b001708b1737f4mr13477530pll.42.1661714566340; Sun, 28 Aug 2022 12:22:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661714566; cv=none; d=google.com; s=arc-20160816; b=FPz431UFZwTgIgXPXBuh91hKALBl08rbSIxWe2SZZY8sLQZ5KZ0Hr0H2uhNZUICMzu 5jPpbOPIaQfoCZibAG+aIYbgYSXwPmR8UaUGn+vQntwXBKT2muIs60FOBtMtEEiUYdJ8 nuNH+oomCSacKCXnVacZ/3Fgn7/82smSZ4L6Ju03U8/Rgi6ThuTHYuZFH09YstMkrtnv dyPK54QgJa7+dG6XI3+6hyZSPiVotbIhogugrc8PdlXIPM0gUkO93xrilvvdrEe6Mywj SO/94VLvtDXMvcrNhJqd6Y1Fs3BflROTui/eyaRm510cIScxcyvmy4ylvWkFeVgfEJo+ IV3w== 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=7BqDwHOJ2so2IVMEevIQWW69b6jWTh5K1q/w2nsiv9Q=; b=l54h6C8w8bc0u9tCVHp1RL5NchfT7F9jayRM+Uq03CV2YOQUy9ir8cmagZyggqucyv aLPekQ7/APbI8SsvfMYyTh7iWf9ZcnivOwTQM4FKh6gwoRre1mERTh6ia2JTN88SE1c2 d+jAHEhWpwS2Go9RKD26QwWpqcjnWh4kGwd/euMHmwNsg0vc2tSxW8LSmHhHTMTMnTlt 5bGhgxlNwkaO53UE+MmiOVKYAv29fwQ75x48Wvwef7c5T0WVUFMFhMB7LQA/gI2XsFwY QWQcE3WR//BQkPENvze5jxCqtEh/3JRhdPqW41OmXO1yltD2nQWkX0NRjHRzz9wZ9OmL Lnqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Vk/UR70P"; 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 j62-20020a638041000000b0042b77c2ce6bsi7319537pgd.130.2022.08.28.12.22.28; Sun, 28 Aug 2022 12:22:46 -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="Vk/UR70P"; 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 S229877AbiH1Sh5 (ORCPT + 99 others); Sun, 28 Aug 2022 14:37:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbiH1Sh4 (ORCPT ); Sun, 28 Aug 2022 14:37:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 171D53206C; Sun, 28 Aug 2022 11:37:55 -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 A794B60BBB; Sun, 28 Aug 2022 18:37:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36C7CC433D6; Sun, 28 Aug 2022 18:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661711874; bh=jYHVQ0rSstcQBx3vvBMzsqc5C7/5CLyfa/jyYuVEQZM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Vk/UR70PdAV6jPHdLFbhzvud7dL99EaRXVPXgmgxYZ3af/F1WFsfsUijDk+CQtG84 /uJshm4Eukzah7YKWgzCZXD014MPovXcpB8RYK7aC0NM0Zq2s4DwFzaKGv/PAsGnWQ yOQjoi9xogfeMnjhMBzOZdD/5M2BpuyA6hhZxi7KubrkU153Oky7s4SV5iOZs1JsmV rH6A1m0jpJZ8Gf7zA2sDbVIQedAHJimN+7F+f3/AHQnabkLe34dIXC7ZI3TrY7/QLl IqV5f8fXiBNj8KeT7Q4kbHajjadI85W5PjeFCyrnAgg0s2LcnhBwm40ldVKe4Ey9Fo EyUmXVZGn0Q8A== Date: Sun, 28 Aug 2022 19:03:32 +0100 From: Jonathan Cameron To: Jagath Jog J Cc: Andy Shevchenko , Bastien Nocera , Hans de Goede , linux-iio , Linux Kernel Mailing List Subject: Re: [PATCH v3 2/2] iio: accel: bma400: Add support for single and double tap events Message-ID: <20220828190332.57ee9aa2@jic23-huawei> In-Reply-To: References: <20220825194604.15645-1-jagathjog1996@gmail.com> <20220825194604.15645-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.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,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, 27 Aug 2022 03:36:23 +0530 Jagath Jog J wrote: > Hi Andy, > > On Fri, Aug 26, 2022 at 1:53 AM Andy Shevchenko > wrote: > > > > On Thu, Aug 25, 2022 at 10:46 PM 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. > > > > ... > > > > > +static int tap_reset_timeout[] = { > > > + 300000, > > > + 400000, > > > + 500000, > > > + 600000 > > > > + Comma and so on for the rest of the similar cases. > > This is the terminator case so I have not added a comma in the last. > All three tap configurations have only 4 value options. > > > > > > +}; > > > > ... > > > > > +static int usec_to_tapreg_raw(int usec, const int *time_list) > > > +{ > > > + int index; > > > + > > > + for (index = 0; index < 4; index++) { > > > > Magic. Shouldn't be defined? > > All tap configuration value arrays are of size 4, I will define a > macro for that. > > > > > Also you may add it to each data structure in question. > > Do you mean storing these values in the device's private structure? I suspect Andy means making sure they are all 4 long via +static int tap_reset_timeout[NEW_LENGTH_DEFINE] = { etc. > > Tap configuration values are not stored in the device's private > structure because. > - I am directly accessing the device registers in _read_event_value() > and _write_event_value(). > - These configuration values are not used in the other parts of > the driver. > - Two of these configurations have a default value so instead of > reading and storing these values in the device's private structure > during device init, I am directly accessing the device's register. > > > > > > + if (usec == time_list[index]) > > > + return index; > > > + } > > > + return -EINVAL; > > > +} > > > > ... > > > > > + int ret; > > > + unsigned int mask, field_value; > > > > Reversed xmas tree order? > > > > > + * Tap interrupts are operating with the data rate of 200Hz. > > > > a data > > Sure, I will correct these in the next patch series. > > Thank you > Jagath > > > > > > + * See section 4.7 "Tap sensing interrupt" in datasheet v1.2. > > > + */ > > > > -- > > With Best Regards, > > Andy Shevchenko