Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6020623ybc; Wed, 27 Nov 2019 13:32:00 -0800 (PST) X-Google-Smtp-Source: APXvYqyGdvF3Fe7jCY8BINUJkKOlsVcwGlX0Lb86XlV4+IsabtZqhEZ1GNilofuRemnqmOsmzCDs X-Received: by 2002:a17:906:c2d6:: with SMTP id ch22mr52461162ejb.262.1574890320670; Wed, 27 Nov 2019 13:32:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574890320; cv=none; d=google.com; s=arc-20160816; b=ZKiaTRvMet8/Ssj39O52huxak7kHYTYy4EtSKZHOrztogtB2lPehEotO+tf0y2QGJy plbnWtzjcDkuMxDWMKQHmbmOm3zzr4agCiPCyjVUazQnbMo7Yd2qOOdGRR/WQj8Ui9ec oZz/LcabHSiDuRMpB79B8H29Wv7Q12ocTnCMRMW+38W9dn7nAFu7vcJEdvaJmmfXhvMu XZ5h4Iwms+bf4kYdWO8BZmxNW4OcwgOdxTXMv1NCbpVDm07wkWQ4KENIiFM0TzuRKvfP cf7/seWZSym3CkZjKBd3OjtJDdet6ReePUYpaCIHCc4csiId3DrOiJAjhBKq1fxZC/Wq ek/w== 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=BX+BkgmSMcU9Eawis/+XfQ9Czl31w1a7MTHU27Ht1Tk=; b=TSBzIvsdH4Wv7Qa9QCFHyR9mq2nhYZBqxxrfS/hcvGle3bHsv31q5vlE1mjRbnmrW+ mwnvpJdZQO4rbjtu7F/90F9aAXr4cxVVcBuNyXl/IhG3dehDKs9UWiHbfwYTKHWjb85F mCWAhX90OJVVEkemSJipvIrIVa9DdfyG+wBAWVvE6yeMHaIyMhK1Mv5kQCjvM8RsalOK KgpPwRqATGMMfCbZh9n8V286ds9OIA1MACk9vKzu0Z9FCrVP0E7am2SRiuFZnTnESxxM txiRbeCPGl9R31H94XJAHSaJzNL30Kq4cWWjoGkB5AEIzMJos74lmhU4SWKKZedvA/HX CRQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xW781Gt0; 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 dk20si4609772edb.413.2019.11.27.13.31.36; Wed, 27 Nov 2019 13:32:00 -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=xW781Gt0; 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 S1731153AbfK0U5N (ORCPT + 99 others); Wed, 27 Nov 2019 15:57:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:48104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730235AbfK0U5L (ORCPT ); Wed, 27 Nov 2019 15:57:11 -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 3CD962084D; Wed, 27 Nov 2019 20:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888230; bh=WajqnPq4dsx7I+SPiCmzJ+aTu8m7lvldsvZsRlaltAs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xW781Gt0eDdyP2tr6/9zIIfphv/BUWL7FneqZFCMLWH/Lc7yQzuQNrHcUw1K6M4yh sKOsyL26PKjjdA//+aQEoOuGIWlZ68oFcf3Gu1xpdaDYdFCuhEChoT626N7UKigPE5 btUIOTFV+Z2FQDg9IhzgnGnJKUKLpl4zZaNwOGK0= 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.19 012/306] gpio: max77620: Fixup debounce delays Date: Wed, 27 Nov 2019 21:27:42 +0100 Message-Id: <20191127203115.617058049@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@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 @@ -163,13 +163,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: