From patchwork Wed Nov 11 22:05:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1398547 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4CWf2S45Hwz9sSn for ; Thu, 12 Nov 2020 09:06:24 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726781AbgKKWGX (ORCPT ); Wed, 11 Nov 2020 17:06:23 -0500 Received: from mga06.intel.com ([134.134.136.31]:46583 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbgKKWGX (ORCPT ); Wed, 11 Nov 2020 17:06:23 -0500 IronPort-SDR: ed7XoormgvXMcQESlUh1lurCYjz1hIxFYPbD0u7HIcpxUqK+lOK3BkSnEMSSKPbRinxJC/yAw/ 1Bv5g348kd+A== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="231846504" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="231846504" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:06:22 -0800 IronPort-SDR: RFWgZ9diKTFAPy5QYhVQs79PRmmxYKDffNN8zBk+H8yXCLFHwJxjqpmPyJh0Z+XwokN8MmW1KM EtW82K7I9z9Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="531880821" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 11 Nov 2020 14:06:18 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 8065A420; Thu, 12 Nov 2020 00:06:17 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Bartosz Golaszewski , linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Mika Westerberg , Hans de Goede Subject: [PATCH v6 05/18] gpiolib: Introduce gpio_set_debounce_timeout() for internal use Date: Thu, 12 Nov 2020 00:05:46 +0200 Message-Id: <20201111220559.39680-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> References: <20201111220559.39680-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org In some cases we would like to have debounce setter which doesn't fail when a feature is not supported by a controller. Cc: Mika Westerberg Signed-off-by: Andy Shevchenko Reviewed-by: Hans de Goede --- drivers/gpio/gpiolib.c | 7 +++++++ drivers/gpio/gpiolib.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index c4f73597a54d..0d691ec512a4 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -2161,6 +2161,13 @@ static int gpio_set_bias(struct gpio_desc *desc) return gpio_set_config_with_argument_optional(desc, bias, arg); } +int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce) +{ + return gpio_set_config_with_argument_optional(desc, + PIN_CONFIG_INPUT_DEBOUNCE, + debounce); +} + /** * gpiod_direction_input - set the GPIO direction to input * @desc: GPIO to set to input diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 16bc5731673c..9b1a1c782704 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -136,6 +136,7 @@ int gpiod_request(struct gpio_desc *desc, const char *label); void gpiod_free(struct gpio_desc *desc); int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, unsigned long lflags, enum gpiod_flags dflags); +int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce); int gpiod_hog(struct gpio_desc *desc, const char *name, unsigned long lflags, enum gpiod_flags dflags);