Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp115342pxx; Tue, 27 Oct 2020 23:21:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH7e/1ocGtAKqmpuV6zqabDEQYiYOVIGspzIWnYj/LLiHPLoDEZ6xBwjV2JAh6xvf3lX4n X-Received: by 2002:aa7:c054:: with SMTP id k20mr6326275edo.224.1603866106942; Tue, 27 Oct 2020 23:21:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603866106; cv=none; d=google.com; s=arc-20160816; b=nGyDmf7zBGKn9U6nLYuKyqXEkcw1aoDp8BKIlZDWKOU23GW9se5fWBWepKFn+KhKBj ImpjewhqHWDdayBkQL3rPmM9Aqm38N+JImonoYmNQY0I/FkAmMeV0AJTFnSVOapGkT12 zYEyG9qXWaq6URU3KLOAC+s43jQwyGNU/JxjrSYeeNkRYcjEhAAz78SC6+L7xWpHqJgm 9Uv9QsF/EAACvLYPU6P1hWGen36p2pwIlO4kn1G2wZTmYbQTfJ+Oqy2QOUvaAO/ObCFO NXTzgoOnrK1EfN+ojWtVYibw7Y2Afw/Lj7m5ceNtLiREbNjISGaC4XgdVc3c4J3lTjpT BpbA== 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=XCeec5IImxL2EGXfGQqgVj5bq/FQ6sYk1H41/XnYwtU=; b=X8Smh+L/tPm4/X6w484dEMPpZQmkipAGLf1s4hHCAuyX/yOmeuSAwydmUrXiIbfZ+U YV+eViJVKROe2BRMxHAPh2L8iu3sjebUkJ8wnCpws6TJcxiSF4Q/L+Y2TE+/KyVxcw4/ y7mD3uhMjP2ygtNJWObvwCfitcBMtugMsmtqXyLIl93bE+s/gQOxa+HyuAvxFm5fQiVb eWniHS4VPwUOwzIT048KZnXKWLuiyMC8Kqp+4m2a1lA3Tki38Bkfx7mezEvoF8p5T4fq 1H5q/92J7T+w0XsxIvxTIxI0hzSojGesefwUBUnVXv2bkr7/qoknjkOAgYFHufyl4533 nAPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TIGNx8Y4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k6si2723488edl.228.2020.10.27.23.21.25; Tue, 27 Oct 2020 23:21:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TIGNx8Y4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2895755AbgJ0Jmp (ORCPT + 99 others); Tue, 27 Oct 2020 05:42:45 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:38951 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2895750AbgJ0Jmo (ORCPT ); Tue, 27 Oct 2020 05:42:44 -0400 Received: by mail-pg1-f193.google.com with SMTP id o7so464567pgv.6; Tue, 27 Oct 2020 02:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XCeec5IImxL2EGXfGQqgVj5bq/FQ6sYk1H41/XnYwtU=; b=TIGNx8Y4jEjyo+b7+5wApbszjIMBLHM2fsBg458QxhAvvvv4s8zZxCALWrqBhRrahb /odYggV8e8wy66I3MwdjPyB0gxtRUH1upAEmSo+JoSwBgViOusxtdO0WXsTn293siaF2 F7bgZg6O0V6uD+geGKe10nDPvH6nxrjbkHDhut2RyTFv92W7TxznWQPRr+6pEjv4ZYhe QTU9eRG9o28mUDNkNPZ2Il/14ImuOuFq7w7suCFPH+uSbGpRxBMWAxFsGscN339DmVXB mWkxK3JS7NyyodfQcEVmWY77ZqWqO4jhoN/a8t16TsakpZFq8KMwdFBj7tQhdh7g3oNc 3Iwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XCeec5IImxL2EGXfGQqgVj5bq/FQ6sYk1H41/XnYwtU=; b=h7/A818XVDnQQ0V4XwNXtKhlZ990uAr2xwbhKz6wd8JGORZ6cHAnVw9+X7LP27Sc6G RL4Flt7UiQDgcdSYSupzwowGAwWagh+avifHZMN9tOTOJIBLd0bgiWXCUyU58KNuUF3c 5EBGqZ4+nvEKQOt7bGwc0Sv1A2DhEquFi7izAa+gKToLpwl03vQUmOw2w9yiOcUj0khy i2qUeDYUUEq4dEA+gn4YRfph7mCN6woPiQLy4eeYi9OHfJW0enJlHhKE12hiAg5TJD3J wr5CqTsM/A3SFc2rOJl+Kg9Zg9LqxFjF/xAWQkAg9RQ0jBDSqhwJoWf6RabUdynZ/Tu4 AYHA== X-Gm-Message-State: AOAM531SyNz3gOxT/3fqL3sxjw+Tw1z2Dl0JcynB3XBsKq/BfF/CcGZJ 99LoenrtRakvegK7KGAU0EazdiSRqTu7ktyinmVEiLQsob8= X-Received: by 2002:a62:343:0:b029:15c:e33c:faff with SMTP id 64-20020a6203430000b029015ce33cfaffmr718328pfd.7.1603791762715; Tue, 27 Oct 2020 02:42:42 -0700 (PDT) MIME-Version: 1.0 References: <20201026151600.2703-1-coiby.xu@gmail.com> <20201026231631.6l6kei3z45cunzmx@Rk> In-Reply-To: <20201026231631.6l6kei3z45cunzmx@Rk> From: Andy Shevchenko Date: Tue, 27 Oct 2020 11:42:26 +0200 Message-ID: Subject: Re: [PATCH v2] pinctrl: amd: print debounce filter info in debugfs To: Coiby Xu Cc: "open list:GPIO SUBSYSTEM" , Linus Walleij , Hans de Goede , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2020 at 1:16 AM Coiby Xu wrote: > On Mon, Oct 26, 2020 at 05:22:45PM +0200, Andy Shevchenko wrote: > >On Mon, Oct 26, 2020 at 5:16 PM Coiby Xu wrote: ... > >> + if (tmr_large) { > >> + if (tmr_out_unit) > >> + unit = 62500; > >> + else > > > >> + unit = 15600; > > > >Side note: Hmm... Shouldn't be 15625? As 1/4. > > Thank you for discovering the inconsistency! I wrote these code based on > amd_gpio_set_debounce. I'll send an email to the original author to > confirm it. > > static int amd_gpio_set_debounce(struct gpio_chip *gc, unsigned offset, > unsigned debounce) > { > ... > if (debounce) { > pin_reg |= DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF; > pin_reg &= ~DB_TMR_OUT_MASK; > /* > Debounce Debounce Timer Max > TmrLarge TmrOutUnit Unit Debounce > Time > 0 0 61 usec (2 RtcClk) 976 usec > 0 1 244 usec (8 RtcClk) 3.9 msec > 1 0 15.6 msec (512 RtcClk) 250 msec > 1 1 62.5 msec (2048 RtcClk) 1 sec > */ What the heck with HW companies! (Just an emotion based on the experience) They like to use really bad precision when it's clear that the numbers should be different (note the cycles, it's 1/4 sharp ratio). > if (debounce < 61) { > pin_reg |= 1; > pin_reg &= ~BIT(DB_TMR_OUT_UNIT_OFF); > pin_reg &= ~BIT(DB_TMR_LARGE_OFF); > } else if (debounce < 976) { > time = debounce / 61; > pin_reg |= time & DB_TMR_OUT_MASK; > pin_reg &= ~BIT(DB_TMR_OUT_UNIT_OFF); > pin_reg &= ~BIT(DB_TMR_LARGE_OFF); > ... > > > >> + } else { > >> + if (tmr_out_unit) > >> + unit = 244; > >> + else > >> + unit = 61; -- With Best Regards, Andy Shevchenko