Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1007174rwe; Thu, 25 Aug 2022 13:27:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Yup3/oGPP294dIbu+mxzG9frfeRrbvOYDjCP0Ue/zx7EY1rVTfPm7w9Rgm6dfIuT88Cbj X-Received: by 2002:a17:90a:2b0f:b0:1fa:d73f:ce92 with SMTP id x15-20020a17090a2b0f00b001fad73fce92mr870435pjc.60.1661459245537; Thu, 25 Aug 2022 13:27:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661459245; cv=none; d=google.com; s=arc-20160816; b=iLjyv1t076BeZOrPkxQVM1KHFgxogkPAdC/WIoNHGEp5x5Dc7IKGceqXa79Feu+OaI eQuUDtpSDXsJpwbkgGOrUt3wvxEUPuL/eKTyUDvzOlabx6tWKrfuPWTwhYhY3hQJ5Aly C5cfoBDNVb8WtGBuq67oQl4u9s78oEjF2sONLxgIkke6IjOXUE0VE5BDNtMIDvO6H19u oFc4RERLdFy8fR/U0YZZCy3IvhpC1aTKp4VBiUlhug6LwBmtTdKzKVtgIeq9Vou9QM5p kfs9WJxcTGJVV4xXbTZSbsXSXXKYUlJpTfuFAD0sbvstu2xf3775nnzngMI+N52d0cQe ZbjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=i7uig6GCW5G9OShhUBzKaHOCH3kWh8nqS6+A+Fz4ITg=; b=pXLNhp2Ax4VG/5JGPzMumOYs+pU9XMon9GVOWYK53OZfFPdJAH8C28CjISYY/ZYbGo 3v6KdSrUj4/SulAWtFkMh4nqNqjPZijc2cRwtxN1c+XOBasge02R2MLsGFZfo9ETKliZ dCg/5aDZVaKID3P5TwtqGDL98BRBDSWWUSfGdPjHvF5xpjasx1feyHc4mJQXrwEmRiMc SCRkMDW9jFYmfxitQAIQR79EVfY2h+81RupmYGyEZHe04fKogTyBGN9WF3ii7wgISxcX UBXOVDLuuF7yCh4LiebPjFmHssMTHyy+jat9eqi8QGPFfUWokDoXB1phP/N4pyyCeuQe iM5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DJ7FjzNs; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k68-20020a633d47000000b004277f15471bsi14870pga.448.2022.08.25.13.27.00; Thu, 25 Aug 2022 13:27:25 -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=@gmail.com header.s=20210112 header.b=DJ7FjzNs; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242426AbiHYUXo (ORCPT + 99 others); Thu, 25 Aug 2022 16:23:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232230AbiHYUXn (ORCPT ); Thu, 25 Aug 2022 16:23:43 -0400 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D00E1C04C5; Thu, 25 Aug 2022 13:23:41 -0700 (PDT) Received: by mail-qk1-x72b.google.com with SMTP id h27so16099112qkk.9; Thu, 25 Aug 2022 13:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=i7uig6GCW5G9OShhUBzKaHOCH3kWh8nqS6+A+Fz4ITg=; b=DJ7FjzNsyEs25UOe2Q6dHtgNhM+184PUi9EbLwHuxuMOaLr9zwf1ucWuonZP/J+BwF sVTqyPH2NJoUbSpZZRjYyCVY+tZHGnWyiOXwjVhRYMqYEQfIFw4ckcSX/+mCjJuDEoGt 5peE4JVMEjxXlGAxPIA/BwfJQsCnVuh5ouvy4q9po+HRvKW+Bo/tdzR/skgWMqh7Wu7V BbrrufeFw3gJWVrYyRD9QNglm/3OIWrGY3+/1nIJTF+HS1KtnclNoxyn33cS+R6Qjl0a rLFtEkU6G/a7I07VcoxNFnYwhOmq7mF5UHrZHb/t0n83Ry67fPE3Y/4xSlkerqwTMJD2 0fXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=i7uig6GCW5G9OShhUBzKaHOCH3kWh8nqS6+A+Fz4ITg=; b=0jVV4QKN5hHgH6uC82+l9sOnxgbiy7bm5pkD/ixuLxaf0hQncTrcPWu9V2YxTydcmH y3SinpKLL980vqb7Mbw63LwT8RWZmiUk4NLkPb1XCnypVjuVsMUwTB5ufyheJJ85wxqU lCVuXNdx502OvGzxw/UeIfvZidX9Hq/snm9WJopOzCNlyAD2H+NhrVmfjj3ybRdKtPfB jieVjr16ofZyw3n+0weOtwVYO9YSPgwibbO/BZBXtxGoDTAVIJM0cdPtlUseJBOcd9cD Ul6ROffHVuH0fUYlsrfjCkxlMvmPYSUS3tDjFwidKC2akITbrHNXL3TCEBonBudA8pgk Dazg== X-Gm-Message-State: ACgBeo0/J+AyH71rCQBBgZfk26xkuW4tJLnccbsAGBFfNUQl/Ld+803t 4ROqrXmJOHNjw7I+PtypQW/gMRPpDOsvcnCsVr0= X-Received: by 2002:a05:620a:410e:b0:6bc:5cdc:88ec with SMTP id j14-20020a05620a410e00b006bc5cdc88ecmr4371427qko.734.1661459020971; Thu, 25 Aug 2022 13:23:40 -0700 (PDT) MIME-Version: 1.0 References: <20220825194604.15645-1-jagathjog1996@gmail.com> <20220825194604.15645-3-jagathjog1996@gmail.com> In-Reply-To: <20220825194604.15645-3-jagathjog1996@gmail.com> From: Andy Shevchenko Date: Thu, 25 Aug 2022 23:23:05 +0300 Message-ID: Subject: Re: [PATCH v3 2/2] iio: accel: bma400: Add support for single and double tap events To: Jagath Jog J Cc: Jonathan Cameron , Bastien Nocera , Hans de Goede , linux-iio , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 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. > +}; ... > +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? Also you may add it to each data structure in question. > + 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 > + * See section 4.7 "Tap sensing interrupt" in datasheet v1.2. > + */ -- With Best Regards, Andy Shevchenko