From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C568C83003 for ; Wed, 29 Apr 2020 12:59:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 771BD21707 for ; Wed, 29 Apr 2020 12:59:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="vwXabPs8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726963AbgD2M7n (ORCPT ); Wed, 29 Apr 2020 08:59:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726776AbgD2M7n (ORCPT ); Wed, 29 Apr 2020 08:59:43 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23456C03C1AE for ; Wed, 29 Apr 2020 05:59:43 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id t12so2260781ile.9 for ; Wed, 29 Apr 2020 05:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=2Yxo09dVJPBtr3rN/uHT49nTIyQW+DSWfIZukN4aXZw=; b=vwXabPs8YT5zmX7I08aiEU6YxNfudTyc2yD7lMX45G1aFxMiRpykGJKv4ffjcRCLIq JIQayGNer6Hyzg5Kc5RlolmXrRySsefligu8k5AWZCI6FJsJE61o4LfMtKmjq/c9WMcu IjYkjt/9JDFArta3aN9OxWEg6Ies2RjNWZnF5mQ+Q87rG6auNpPTLnQN+fUTNVp3NAxH T0scTOt+tgh660Eh5IX0BcsBUy58bCYWB6PB3G3zVp2gg18fgQFRIlY2l5WpAiZnr3UM YX7wjikHPjxZJprZmyZJufvn1cffI7HKGT4F2FiYWT7Xlm16QSBW+ZCM7QT3WvNgWofL 7LeA== 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:content-transfer-encoding; bh=2Yxo09dVJPBtr3rN/uHT49nTIyQW+DSWfIZukN4aXZw=; b=SiCRFGhAfOHelrbF/o+2GBqSAMbkmHkz73wMqCI5hR+zZ65mYRNDOkqGJ1vhb8bhVn MsEY3gCgOZaHREdmifPzdC1YTacTP/1sy4IyI2sgdEsgcrWFNG1LEDIlMJsyzr0tfXdn TlK+zDsqu1CtNOQVj9+F+xDkWXWdLh/ufQqQ7L9KGc8xRxzPDkwhybSdKWUVgbUM2vPV cwGI0DjqDQHx23CDPnnlDP8cSvPNQchKuFATq2uU2dOGSKWj2HBtA65qrKQ4ktPyrVsm y/ESG7TtWltlVpPlIpIIOCaFRJgYnqc23zAxBn14YoB9TYDZsDas1TRVU8ctH+nfvWzM 3+Xw== X-Gm-Message-State: AGi0PubTDLRA+84Z54vbZ8osaixVRDRJFI49o3QRhphj6Dv55dbBiMrI w/+tC9qvsrtdzlHu0wt3ATCALSTQDpETDKNZD4C/lw== X-Google-Smtp-Source: APiQypJ+wLPj7v940XymAn8ea0zNXoCXn3l3t9ul5ZusFNcHLuU4YPecSJ0vNhXcTwF13kUf7tiPSxCM9fr4V/YzLJ8= X-Received: by 2002:a92:dac8:: with SMTP id o8mr29703394ilq.189.1588165182371; Wed, 29 Apr 2020 05:59:42 -0700 (PDT) MIME-Version: 1.0 References: <20200419001858.105281-1-hector.bujanda@digi.com> In-Reply-To: From: Bartosz Golaszewski Date: Wed, 29 Apr 2020 14:59:31 +0200 Message-ID: Subject: Re: [PATCH] gpiolib: add GPIO_SET_DEBOUNCE_IOCTL To: Linus Walleij Cc: Hector Bujanda , "open list:GPIO SUBSYSTEM" , Linux Kernel Mailing List , Kent Gibson Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org =C5=9Br., 29 kwi 2020 o 14:38 Linus Walleij napi= sa=C5=82(a): > > On Wed, Apr 29, 2020 at 2:06 PM Bartosz Golaszewski wrote= : > > > I understand the need to set debounce time to make line events > > reliable. As I see it: there'll be a couple steps to add this. > > I think there is a serious user-facing problem here though, because > not all GPIO controllers supports debounce, so the call may return > "nope" (error code). > > I think that is unavoidable with things like pull-up/down or drive > strength, but for debounce I think we could do better. For bias we don't return an error if the operation is not supported by the driver. > drivers/input/keyboard/gpio_keys.c contains generic > debounce code using kernel timers if the GPIO driver > cannot provide debouncing, and I have thought for a long > time that it would be nice if we could do this generic, so that > we always provide debouncing if requested, even for in-kernel > consumers but most certainly for userspace consumers, > else userspace will just start to reinvent this too. > Thanks for bringing this to my attention. This definitely looks like something we could pull into gpiolib for others to use. Bart