From patchwork Wed Aug 11 20:27:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Hutchings X-Patchwork-Id: 1516024 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; dkim=pass (2048-bit key; unprotected) header.d=mind.be header.i=@mind.be header.a=rsa-sha256 header.s=google header.b=avVBCPDa; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4GlLwt54lNz9sT6 for ; Thu, 12 Aug 2021 06:27:58 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230413AbhHKU2U (ORCPT ); Wed, 11 Aug 2021 16:28:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbhHKU2U (ORCPT ); Wed, 11 Aug 2021 16:28:20 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 030F7C061765 for ; Wed, 11 Aug 2021 13:27:56 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id go31so6740423ejc.6 for ; Wed, 11 Aug 2021 13:27:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mind.be; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=/fBXwRi3zHoXySC63co3Zg3PXm2L8vBGwxoAcufUXkE=; b=avVBCPDaLVUmDViSx3YbB7UlpUecmw+Dl9WLOuSsCFc3QzOCGYgUgykxq+RoRi/DKR gqM/V0uhDSZc4p781wOzqvPleRfs+SCh2cm8+S3Jy52lh23ZmYKZp8gPU5M7thqgI4/Q qcrPNbWgSK0DEGtyRfSboba8TsiKYluB7z7JDHpQIq34IclPX/CCn7Fbc9dxX2ni0wNO YKvpQxhQ3rOyNYGXqn9kaYax6gHNdMzbeF7Ixh5pB3m7Z5bFxGYEu94GzAhCVNmCnP1O DQQof8Gckr5sQQpheRhbuy/lFhXTNO4gWsdFDDNq7lTET0h1eg8ET0ug7t56RwlHZlUg A25Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=/fBXwRi3zHoXySC63co3Zg3PXm2L8vBGwxoAcufUXkE=; b=fySNoky94XWggvYVhz8V5piZx+pquN5DmiNiAzTbwkRg1DeAKtUUSJEJPYQLc8ozFt n4PomIeQqNoDLb7j4NB0FSJTN8MJigadC85RsRRacEywg+SMFUVSoQ9gr51p3FHGehJC 0k8z8qmJKffnhIy3Qqf0rkIjGYCpqQFaH6C4aqedoHRbxjcxp/DTfN6ybmy4GhsuRnS0 AcLLbNXJUb2UBNA9e/Mu8kpZSGBZTOSIpzrJVysNuHZnWZwiNfEpE41nTs3fyK26syAC gI/JzGuETkLMqC9eVjQd08GRP3nS4tCtKzRFGu2Wzw0ta/rRgahkqOZr4H1kyvTaSXQV cU3A== X-Gm-Message-State: AOAM53033D0dWSWBXQTS6OFnxWG8x4O03/6pE1LhfeCc7nCnybuN1sYr d0mKKSxSWXigHOrG91vxR51B5Jp1c8i6Uw== X-Google-Smtp-Source: ABdhPJza6hhstiptmW8MZiHRPpoG6hxDjeyvEurzf5TaW7W6YwdRbkysNloYH4rSzqWFA9FpnqxTUQ== X-Received: by 2002:a17:906:1f82:: with SMTP id t2mr277207ejr.499.1628713674568; Wed, 11 Aug 2021 13:27:54 -0700 (PDT) Received: from cephalopod (168.7-181-91.adsl-dyn.isp.belgacom.be. [91.181.7.168]) by smtp.gmail.com with ESMTPSA id q9sm142191ejf.70.2021.08.11.13.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 13:27:54 -0700 (PDT) Date: Wed, 11 Aug 2021 22:27:52 +0200 From: Ben Hutchings To: Grygorii Strashko , Santosh Shilimkar , Kevin Hilman Cc: linux-gpio@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH] gpio: omap: Enable software fallback for long debounce periods Message-ID: <20210811202751.GB18930@cephalopod> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org omap2_set_gpio_debounce() currently returns -EINVAL if the debounce period is too long to be handled in hardware. gpiolib provides a software fallback, but it is used only if the driver returns -ENOTSUPP. * Enable the software fallback by using the expected error code * Downgrade the log message about this from info to debug, since the error is now handled Signed-off-by: Ben Hutchings Reviewed-by: Tony Lindgren --- drivers/gpio/gpio-omap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index ca23f72165ca..93812480dd0a 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -190,7 +190,7 @@ static int omap2_set_gpio_debounce(struct gpio_bank *bank, unsigned offset, if (enable) { debounce = DIV_ROUND_UP(debounce, 31) - 1; if ((debounce & OMAP4_GPIO_DEBOUNCINGTIME_MASK) != debounce) - return -EINVAL; + return -ENOTSUPP; } l = BIT(offset); @@ -887,9 +887,9 @@ static int omap_gpio_debounce(struct gpio_chip *chip, unsigned offset, raw_spin_unlock_irqrestore(&bank->lock, flags); if (ret) - dev_info(chip->parent, - "Could not set line %u debounce to %u microseconds (%d)", - offset, debounce, ret); + dev_dbg(chip->parent, + "Could not set line %u debounce to %u microseconds (%d)", + offset, debounce, ret); return ret; }