Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6031845ybc; Wed, 27 Nov 2019 13:45:09 -0800 (PST) X-Google-Smtp-Source: APXvYqy26x7yZQUmCAVTPID5INKstvD/WOwtUnRF23yHZ4sj56AdEccFC86rKr+EInHoyA27TcYf X-Received: by 2002:aa7:d45a:: with SMTP id q26mr11795266edr.158.1574891109585; Wed, 27 Nov 2019 13:45:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574891109; cv=none; d=google.com; s=arc-20160816; b=iSVcHi8GSkKnDu2Jg46P09Boi3lGwcrB+WSRF8sAuMLRIBd9rML7Pzfvii5SuDhA3m EJnYUeVnFB62FOJL/0iQ8gqIBUgJpcTzOEWmvcwKDaba3sy1O/n/HlgWqfo+qCFy6YmC jZ6AIQKfzaLBki+o1Dmys07FyCfsjc/bzBEm5wN30m/wyxGzX7ho9EPBm9x3jKpxSZ4g 82dy368IIscLTu/V2W++ibSoYSY7YlPtyP73P5oHF1sjtfDGi1CSfaaMBCs9YoheAodE obtNfJUc6ABQ9jJfck+l6h5m8QuDrIFuLkivDVUvoDcb3yFuPZR1hSgaMCVmGiwsrE86 7yEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3zxpAIRDIacYuEupXLT+YKjGfb/I/Okt7rswHZIi9oU=; b=dcOpb2SLert5TMnHXy52d3mlx/QmHqj0Q6dssO0INnwYQEQZPuOEbQh7DZJhF7IZJ/ eYeaXgUAlwbVY3WKWfz2KiNBF063si85hPQA2Bp4EtFn0/ubZgo6+vcUSyTU2qbTJBhz MxJvPeLr/TmHUV5zkiCmxibi7aHthc90j6p/U0KRWwt7NeBQkbVzZ/xfvjTA4SShTfdV M2u2BMbSOAJE1DLEMixsb0IKIBFxWjCH37mJRc8X8feWNfip4nFBTcodhMNEFtB9Jmum W8qh/odtBYgnQ83istYoudAT/+m5IWxnESGpKVsyN1kbaQc34X180VZ465x6JgUg3imG ZvVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fsn3t79r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id mh1si10216842ejb.221.2019.11.27.13.44.45; Wed, 27 Nov 2019 13:45:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fsn3t79r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729202AbfK0Vme (ORCPT + 99 others); Wed, 27 Nov 2019 16:42:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:44574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727269AbfK0UkH (ORCPT ); Wed, 27 Nov 2019 15:40:07 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2C75C21774; Wed, 27 Nov 2019 20:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887206; bh=PQFfqQZTJt8OhFGzdF6KtpgMwrzOwM6x4oU3BMvFibs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fsn3t79rZn7CqgFN6W5OZR6mVGwsdqht0c1ieERIhvxIlkmhcew59omYV0S3Bhp/Y sx+U1Ev7SObpyrpm7umGdXk+neZymeZ9WA+OyAHmMYi1dBtGmoEpCvQbZ1nfmn3MTn UmZdpbkcE+Z2aNHbZPiMlAv5/aS7BNE0lPVFtzzE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , Thierry Reding , Bartosz Golaszewski Subject: [PATCH 4.9 006/151] gpio: max77620: Fixup debounce delays Date: Wed, 27 Nov 2019 21:29:49 +0100 Message-Id: <20191127203004.790459008@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203000.773542911@linuxfoundation.org> References: <20191127203000.773542911@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thierry Reding commit b0391479ae04dfcbd208b9571c375064caad9a57 upstream. When converting milliseconds to microseconds in commit fffa6af94894 ("gpio: max77620: Use correct unit for debounce times") some ~1 ms gaps were introduced between the various ranges supported by the controller. Fix this by changing the start of each range to the value immediately following the end of the previous range. This way a debounce time of, say 8250 us will translate into 16 ms instead of returning an -EINVAL error. Typically the debounce delay is only ever set through device tree and specified in milliseconds, so we can never really hit this issue because debounce times are always a multiple of 1000 us. The only notable exception for this is drivers/mmc/host/mmc-spi.c where the CD GPIO is requested, which passes a 1 us debounce time. According to a comment preceeding that code this should actually be 1 ms (i.e. 1000 us). Reported-by: Pavel Machek Signed-off-by: Thierry Reding Acked-by: Pavel Machek Cc: Signed-off-by: Bartosz Golaszewski Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-max77620.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/gpio/gpio-max77620.c +++ b/drivers/gpio/gpio-max77620.c @@ -167,13 +167,13 @@ static int max77620_gpio_set_debounce(st case 0: val = MAX77620_CNFG_GPIO_DBNC_None; break; - case 1000 ... 8000: + case 1 ... 8000: val = MAX77620_CNFG_GPIO_DBNC_8ms; break; - case 9000 ... 16000: + case 8001 ... 16000: val = MAX77620_CNFG_GPIO_DBNC_16ms; break; - case 17000 ... 32000: + case 16001 ... 32000: val = MAX77620_CNFG_GPIO_DBNC_32ms; break; default: