Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3975651ybz; Tue, 28 Apr 2020 03:39:15 -0700 (PDT) X-Google-Smtp-Source: APiQypJTBhJAzLMJ1r2sUkbYzjOPD5j011ATWV6+PKDmsnCg3vVegOK9xSRfJ6P3HhWLAfm8Kn8K X-Received: by 2002:a17:906:5287:: with SMTP id c7mr24322125ejm.141.1588070355756; Tue, 28 Apr 2020 03:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588070355; cv=none; d=google.com; s=arc-20160816; b=SHiFobVtfIvgSAczCBHqUNwr6F6VN/vTUVB9+JpIzfZRiggiFuQ7VHXqWqxNZOmtZy B7vQ2dAgAYROVo84g3Ezj1AMOZaKrZhze1yAsYJBcSGRH0oPQ1xNs1LrNNztgsGFP6na vdwWoFC2T/Jb4uiOXJvNlugRMIVrQPO83PhbnU4AAq/zvfkp7zwAd6FiipmsvNrPyM01 aOvf3XbCgKnuee6LrlSzcA5aWHr/2MYus6sCa2InKSJ5O1vOWzwunTK5nSDkyzjU1vY4 RMWp1VVRmVZ+bC6eNQu2oHTUx/k6XQVteDk6/TdUcExP9LnK4/nOSG5isdxgn84rGklp DvWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=BJeRnwA9amHTr9HBEW7mHHem3+zV44srWi4Z/fPkb/4=; b=XRTMLEFJTFHYNLpJIrzUwiwXvZ77tn9+J7U+VgsPp/mC8VaQYaovykcpJJeC7LpLQP ryQRCpr5MfokXjnqUh+8vdB94cG2EWD4VHg8IgdWosIXmI49keUtqpfBUSDXrYMAYFM1 fUWRYsDA2Bd0BQdYp1w83XWBcNKqRDOglVigfRRZJfVjPsO1vDGkIcsKNDFbcmO4HRqc dEEdnFkCsH9WaTEaNpkJJoHz0wL190rcW3dj5tEgCx5TZqwESWOd08CK/byMWUEdfZNY h/IvA1MMOAD7JbOhsnp08GQQS/GDncaHXm1c2+vyvXuryvnAzgu4sMVIuLAW0WDNfMGD 6Sgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FkJkBtD/"; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn16si1402423edb.488.2020.04.28.03.38.53; Tue, 28 Apr 2020 03:39:15 -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=@linaro.org header.s=google header.b="FkJkBtD/"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726397AbgD1KfT (ORCPT + 99 others); Tue, 28 Apr 2020 06:35:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726345AbgD1KfS (ORCPT ); Tue, 28 Apr 2020 06:35:18 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 939ECC03C1AB for ; Tue, 28 Apr 2020 03:35:18 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id r17so16449522lff.2 for ; Tue, 28 Apr 2020 03:35:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BJeRnwA9amHTr9HBEW7mHHem3+zV44srWi4Z/fPkb/4=; b=FkJkBtD/KENicQYgV8/9KEdp8orrQgIFyT8zmHnW3Mmp+OnH1EUrSPkgFaAg7rlchX +x9wIx2GcWtef8yKRxW2LS2+lJhQzg4O7CvPlq35R9E/b77f5c3yVqjodC6AWLuIrjpC ZZ3Yv2dbBK4OV+W6SO3oy7dR13A6BBHvJAr094oN+JHE0yFTpbEG11D1hiAVxQDVmsG3 u2rsoy++wB9s/xSFhf11yHvF6EgyXav/TWlMOgfJTVtgZYELJRT0juiYqxxpzQoGLnxE PlDm2IZvcXvllzW7RQ/ZPx6HDNBLisPgsdamz+sZ0J+VdUf8wgDn+ytmTx70QEXxeFPy l5Xg== 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=BJeRnwA9amHTr9HBEW7mHHem3+zV44srWi4Z/fPkb/4=; b=A3mAdC3Fpz1tMwx+opo30/bAEOSCvu2omNAi5Efqz3Wz5OcmrHVeYnmT+btJMl3gay zdAXJETKdlTIicEVzup178r0Ii3Z50snZEl8c3pS6o2DnRIHdRiPYO/PEZ2TDDuZ+ZiM 754p/SX0gW9Et0nQUQ5aHgLLomrCLmJeIB/3EUhXukxAzzM2CS9lNujq1bdboppmMuyq CPHoLheBoWGN5doncvDYlxLrcRj8bUTmgr8EOtHLWcc2XvkObyYc32eE87uoKihY8kVX huTa1Dak5DE/Ey0MSoKywt+d0fXhyiNesqyR8m7/eu6W7f80XOq4UjQJlFYQfkOZlIVF Wo+g== X-Gm-Message-State: AGi0PuYklmo4xL4rESEw3ofKdzyzAoWQg46XaOpv2lb9e/ikdYrYRhGT r+/PJHnTWzl142o6EPdK3/lPAHf1xeD+S+VaJdJtwA== X-Received: by 2002:a19:42c3:: with SMTP id p186mr548845lfa.194.1588070116907; Tue, 28 Apr 2020 03:35:16 -0700 (PDT) MIME-Version: 1.0 References: <20200419002220.105338-1-hector.bujanda@digi.com> In-Reply-To: <20200419002220.105338-1-hector.bujanda@digi.com> From: Linus Walleij Date: Tue, 28 Apr 2020 12:35:05 +0200 Message-ID: Subject: Re: [PATCH] gpiolib: add GPIO_SET_DEBOUNCE_IOCTL To: Hector Bujanda , Bartosz Golaszewski , Drew Fustini , Kent Gibson Cc: "open list:GPIO SUBSYSTEM" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hector, thanks for your patch! On Sun, Apr 19, 2020 at 2:22 AM Hector Bujanda wrote: > This allows calling gpiod_set_debounce function through char device ioctl. > > Signed-off-by: Hector Bujanda (...) > +/** > + * struct gpioline_debounce - GPIO line debounce > + * @line_offset: the local offset on this GPIO device, fill this in when > + * requesting the line information from the kernel > + * @debounce_usec: debounce in uSeconds to set for this line > + */ > +struct gpioline_debounce { > + __u32 line_offset; > + __u32 debounce_usec; > +}; (...) > @@ -154,5 +165,6 @@ struct gpioevent_data { > #define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info) > #define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request) > #define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request) > +#define GPIO_SET_DEBOUNCE_IOCTL _IOW(0xB4, 0x05, struct gpioline_debounce) Please do not define a new ioctl for this: since of commit e588bb1eae31be73fbec2b731be986a7c09635a4 "gpio: add new SET_CONFIG ioctl() to gpio chardev" by Kent Gibson we have this: /** * struct gpiohandle_config - Configuration for a GPIO handle request * @flags: updated flags for the requested GPIO lines, such as * GPIOHANDLE_REQUEST_OUTPUT, GPIOHANDLE_REQUEST_ACTIVE_LOW etc, OR:ed * together * @default_values: if the GPIOHANDLE_REQUEST_OUTPUT is set in flags, * this specifies the default output value, should be 0 (low) or * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high) * @padding: reserved for future use and should be zero filled */ struct gpiohandle_config { __u32 flags; __u8 default_values[GPIOHANDLES_MAX]; __u32 padding[4]; /* padding for future use */ }; #define GPIOHANDLE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0a, struct gpiohandle_config) Setting debounce is just another type of config, so please use Kent's work as a base for this. Yours, Linus Walleij