Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1279541rdh; Mon, 25 Sep 2023 08:09:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFl1VBfro6fK5ViM8NS94tU88fKNdytBkVWRhbd+F8mJ4tIh7N5i2x/joSzZBgE0Q4qte0Y X-Received: by 2002:a17:90a:5785:b0:274:8330:c7da with SMTP id g5-20020a17090a578500b002748330c7damr4852837pji.28.1695654586932; Mon, 25 Sep 2023 08:09:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695654586; cv=none; d=google.com; s=arc-20160816; b=WXJ6J1KL2bmD9m4kEYMd9bq2w94akqups69GX9YJxuRZldKLgdP2jEO2WiWuyfHyH4 +BuJzHpjF9VgpnyvO1N2LJQB5odsM/HYkj3LVwDBvl7js8LwBsd+oAM7XJmLco63BMDJ 8WcEJ2JpAkdtnFTIEp7H0fK9B+14wL+Wn/5fdjpunQ96eKSfH8oOyeXgMV4OXLNHi7Wt UiEbVWB6kf1S3r6tAzSS4qHUuOBpUYAzp0G9mlgloF452R8Iju+n9MFCczzanxTNMRL/ 2lrxuR/fxsEcFmPk5iZl8rJLgpHAF8Af3vRSjbCMaWoLNHH8LQooadNygB/HtUy9kY83 C39w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=NxcsoZ0xLkSaR9KvbRz9tqLOvey6ZsTOWgCgXDOLYzQ=; fh=dxoBAk+tf7ycQh/P0SlfpWb85UN79JHYIVAMCkwy+vM=; b=SovsF2FKTPdXQo5zIJug8CNMvUY6UUZuhBpnMaE2Mqi9A9Undv2dnHKdw+GGPVjT5q 0eoNCLTGCylTbhcULlhyZYUdAplm4/uH6wMmJoSj1T5gHHJCus4knQjm/Z5PBfJUSbZ+ 8t0ULPNSYFmdJcSQoLbMOn1SJgVqqWdULKK6kLUYqL8ag6AMFk9Dxx4hoLSzaYcVxVy3 H6zromkc3FRX+h6oUrmA+s0YrqzvhlgfgOXxytp6V9I9QVNrsmMuHm+zd5MKHcUgOKp4 BRPSSCGb2G92omb1eMa9+p4A4w780uu45MGcJgDPFo2QiYuchweYKY22NBRGk8WVPf2k MijA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NiRw72CF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id qa2-20020a17090b4fc200b002765eee2b6bsi12512559pjb.46.2023.09.25.08.09.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:09:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NiRw72CF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 710F08114D15; Mon, 25 Sep 2023 06:19:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231956AbjIYNT6 (ORCPT + 99 others); Mon, 25 Sep 2023 09:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231889AbjIYNTv (ORCPT ); Mon, 25 Sep 2023 09:19:51 -0400 Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06D5A127 for ; Mon, 25 Sep 2023 06:19:44 -0700 (PDT) Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-59c0b9ad491so75549457b3.1 for ; Mon, 25 Sep 2023 06:19:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695647983; x=1696252783; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NxcsoZ0xLkSaR9KvbRz9tqLOvey6ZsTOWgCgXDOLYzQ=; b=NiRw72CF44qD5RVEI4kmkzdIE9ee+3ZrxznvKmTjcstj/djsgS2ZSul6Yf4cXCFtEi V38ePqG50wqqK2umzgznK5f/1istebfAEo6AevT+9fgdfCbAd0JQlfJ9CC7PrZ92DHJQ RDsSMqW01Cbo2ie0m+fEqgaypR9cqlMYiZz+1VoiJk6/EJV9o+vlYWTMz3CUurcNUJFr LjIEhDTx6ad6//cW4bC8opbrhvJZaY60dZObGU/3bZ8B1WGPt+Odk8z9w4qS+KUhvse+ rMlCwNMvIxM+44YiWQo6fXX0YR2WEzLuYuZox4PJidi/JVOkMj0ntUiyHTdbtyVnGZcJ zkdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695647983; x=1696252783; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NxcsoZ0xLkSaR9KvbRz9tqLOvey6ZsTOWgCgXDOLYzQ=; b=cpQ2JPJmjRQa7BgoWciMtlYrdqndk840+GeWc2hYbOeWrpyP9Mo5FRHWJgZr3XCapA q7N58bQSqn1Uwsqj5LlhDKqpHcDkqondtZdxMDESbDca0zlDSUGycIgm9dRwmZwS06A8 XuyDcqh9UGJ2c3bBcy4m3JO+eceeVumrWMRI89o5mvJX4O4cp8RRjEBguYUnqtsOlLWU QFM5M0UE0bQPvpXygUIWWyHafqLYJ9txrIOddmnaaxduZlGPsid2FuqUvOl6/M9eYeuc awLobUvXV3bgDaw8igU5YvFT/Dndzf0wmrnl1C/UKdNW0J0WHqG6fGDeow6WodKJuu/Y UUVA== X-Gm-Message-State: AOJu0YxKQw1no4BRgk+SEKeZ71ROp7tuUp274W7zgFNGxfJ4bH/sQQ7r Ij8g85u0uPkhq9QI/dIwA7tu3h0Z6YJsFjwfx+jlCA== X-Received: by 2002:a81:4e12:0:b0:5a1:d352:9fe1 with SMTP id c18-20020a814e12000000b005a1d3529fe1mr115994ywb.42.1695647983132; Mon, 25 Sep 2023 06:19:43 -0700 (PDT) MIME-Version: 1.0 References: <20230918123355.262115-1-biju.das.jz@bp.renesas.com> <20230918123355.262115-3-biju.das.jz@bp.renesas.com> In-Reply-To: From: Linus Walleij Date: Mon, 25 Sep 2023 15:19:32 +0200 Message-ID: Subject: Re: [PATCH 2/2] pinctrl: renesas: rzg2l: Enable noise filter for GPIO interrupt input To: Biju Das Cc: Geert Uytterhoeven , Claudiu Beznea , Prabhakar Mahadev Lad , Marc Zyngier , "linux-kernel@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , "linux-gpio@vger.kernel.org" , Biju Das Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 25 Sep 2023 06:19:59 -0700 (PDT) On Wed, Sep 20, 2023 at 4:06=E2=80=AFPM Biju Das wrote: > > > 2) Digital Noise Filter Clock Selection Register (FILCLKSEL): > > > > > > The FILCLKSEL register selects the divided clock to be input to digit= al > > noise filters. > > > > > > 00b: Not divided (initial value) > > > 01b: Divided by 9000 (41.666 ns x 9000 =3D 375,000 ns) > > > 10b: Divided by 18000 (41.666 ns x 18000 =3D 750,000 ns) > > > 11b: Divided by 36000 (41.666 ns x 36000 =3D 1,500,000 ns) > > > Note: This value is the value when the external clock is 24MHz. > > > > > > Q1) What is the recommended way to associate the above values with > > > PIN_CONFIG_INPUT_DEBOUNCE? > > > > > > Eg: I need to configure filter on, 8 stage filter , a divisor of 1800= 0 > > for a mechanical button bounce noise. > > > > As per the generic pin config and DT bindings: > > > > * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce > > mode, > > * which means it will wait for signals to settle when reading inp= uts. > > The > > * argument gives the debounce time in usecs. Setting the > > * argument to zero turns debouncing off. > > > > input-debounce: > > $ref: /schemas/types.yaml#/definitions/uint32 > > description: Takes the debounce time in usec as argument or 0 to > > disable > > debouncing > > > > The recommended way is to pass the desired clock cycle in microseconds = as > > the argument to the pin config. > > How to add number of FF stages info on top of this clock cycle? You don't, look below. > Use some encoding in DT and decode it in driver?? No you put in the desired delay in microseconds, the you use the table that you already provided to look up the appropriate divisor: > 00b: Not divided (initial value) > 01b: Divided by 9000 (41.666 ns x 9000 =3D 375,000 ns) > 10b: Divided by 18000 (41.666 ns x 18000 =3D 750,000 ns) > 11b: Divided by 36000 (41.666 ns x 36000 =3D 1,500,000 ns) For 0, 375, 750 and 1500 us... > Note: This value is the value when the external clock is 24MHz. And this can be provided from the clock framework, and then you need some more elaborate math to calculate the right divisor from the parameter in the device tree. Yours, Linus Walleij