Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2701351ybx; Fri, 8 Nov 2019 08:09:10 -0800 (PST) X-Google-Smtp-Source: APXvYqzLAwGz0SbQPcorMCDAvFmbCQAhqQw+Eqg4aGSlo41+GPgTnhvExVNno2v3ucrhizi+/wsS X-Received: by 2002:adf:e283:: with SMTP id v3mr2100814wri.346.1573229350293; Fri, 08 Nov 2019 08:09:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573229350; cv=none; d=google.com; s=arc-20160816; b=bHH7xhqxF724YbFdiBPeRU5AQevxTGNGer0+w0HQ72S7xGjBknH4lJFq329BaqVAPM Z85zTG/MHlugIdrVFeSFMR3n0VIy26/tQlfz51OebCAaH0KCdbE2UqNjuo7le7f6ThLp pRNe3I86YdjqFjJh0zrVzJmaQv+qqQHmVSrGAx/hcb1cV81WZsEsQTaZMy4EhAH9IUJc EuABMd3GwNAhJXHcylXzqFM+/nKGPNAfZL7AZ+rAMrNRwCdz/qovWja8XjCWEZiNKoI8 sAMnHD3Lqf9UyWctxUQ6IqRJUPUrt5gLfJrfOf/39Je5tP1LYrygCGKoREpnfzRo6Oh4 g23g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=QwWgP/MNOhEz5ufCbsw4V77uL0IyMaSXQVGN4RuCrSY=; b=TPTiSqAYAvY0RYjjZk/ZnjvnOnliYKos5JfwxZruu0Yfkm1osYowkhSBnZZn25112O ZhZSmdGpVAN1pEiE+HCXS/wz5Flw8K4fuHSPNPsUQ2tWbrg23bwsVBBbL/19dvgRSzHY mfF2TYmORho2xpQPw202A3kpvVtoWaAGHSZto5vWZvqOg4el4OpcP0K0f92gWUgS0ZQT 4WC0JjZVSEiArCXUepysz1fxp9JQUcHp+7l6n7AixOPwj0eGYHeodFyTCA6oT5a5yUQu uRLxaTj6Pp6LUUhSsxSOuRo6DUHsxtWz4Rdgd973J7dN3lwpaG7i8XyNQY58EM8lg1cg vCuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LlaC4oqT; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si4129155ejx.3.2019.11.08.08.08.46; Fri, 08 Nov 2019 08:09:10 -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=@gmail.com header.s=20161025 header.b=LlaC4oqT; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726976AbfKHQHw (ORCPT + 99 others); Fri, 8 Nov 2019 11:07:52 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:35942 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbfKHQHv (ORCPT ); Fri, 8 Nov 2019 11:07:51 -0500 Received: by mail-wm1-f67.google.com with SMTP id c22so6785556wmd.1; Fri, 08 Nov 2019 08:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QwWgP/MNOhEz5ufCbsw4V77uL0IyMaSXQVGN4RuCrSY=; b=LlaC4oqTeuKPvEqNcqwu9cHHtPDasTQRScMSkObqZV0n6nBwCLQ7DxNBi/IvXqLmBV Yj9AmK7BnuRwu1gzBla4edDMlZzVm8MtxEcOznsOzb1x8nMlU+myOk4Zz0bufqK1ntv8 65SfhR58oNCxi73hBnkLy6Ad5tNpYbJLRzY0oWHKUZuovWW7lceZQIdIf8ydFIOVy/f+ eK1xL5zSxOGD1a8UjY1ovTXOYZIq+fgZJHpczxUcf6HtKbErKDvgXrh4mvC7u80pdar5 oU4xx1cKcc+rNM3Zi7tBaoMAYg074thhsHhy0duDd9cyIhDPcHkRko+8eRg967uBJEm8 gUuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=QwWgP/MNOhEz5ufCbsw4V77uL0IyMaSXQVGN4RuCrSY=; b=CCRxOieOErKjzxJ8JjMgfZZHpxt/8BdOQkWy2oZ+q2ZK8YEYxaF16KJ51kQddv8UC2 0BHglvaM4HteHRvh5fJOS/lN+8aicvEF4GbSXySq6jAg/YQdPkBaxXDobK65osJzo6Vm IEWga0QQzYROraIKNxoD+4+QMTnFMY9do3qNJws993ktR4pz3KzKCevqHmSGW7E6LatH mxCrgrgLvXj6XYQrR6tFNry33kpK27gAZQTBdjcyOZ4llxG5goWTUpUuj+HMjZjmVKn7 Po/AYf3+At3c+vD1D7mvb8cpCnqHnFm1Ivkrv7+asG6miQ1owTGrxrYnEQm/Hmy5swqt rQKA== X-Gm-Message-State: APjAAAVmKwI1BT5qrxzU5+LyuFhJPaqs4X5dNqwz+7MSobf4sDCzBm9k IFERKDVuN0yHXykH2FIFRZQ= X-Received: by 2002:a1c:106:: with SMTP id 6mr8561333wmb.33.1573229269372; Fri, 08 Nov 2019 08:07:49 -0800 (PST) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id n1sm6682214wrr.24.2019.11.08.08.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2019 08:07:48 -0800 (PST) From: Thierry Reding To: Linus Walleij , Bartosz Golaszewski Cc: Pavel Machek , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] gpio: max77620: Fixup debounce delays Date: Fri, 8 Nov 2019 17:07:46 +0100 Message-Id: <20191108160747.3274377-1-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 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 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 --- drivers/gpio/gpio-max77620.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-max77620.c b/drivers/gpio/gpio-max77620.c index c5b64a4ac172..313bd02dd893 100644 --- a/drivers/gpio/gpio-max77620.c +++ b/drivers/gpio/gpio-max77620.c @@ -198,13 +198,13 @@ static int max77620_gpio_set_debounce(struct max77620_gpio *mgpio, 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: -- 2.23.0