Skip to content

Commit b039147

Browse files
thierryredingbrgl
authored andcommitted
gpio: max77620: Fixup debounce delays
When converting milliseconds to microseconds in commit fffa6af ("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 <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Acked-by: Pavel Machek <[email protected]> Cc: <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 31f4f5b commit b039147

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/gpio/gpio-max77620.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,13 @@ static int max77620_gpio_set_debounce(struct max77620_gpio *mgpio,
192192
case 0:
193193
val = MAX77620_CNFG_GPIO_DBNC_None;
194194
break;
195-
case 1000 ... 8000:
195+
case 1 ... 8000:
196196
val = MAX77620_CNFG_GPIO_DBNC_8ms;
197197
break;
198-
case 9000 ... 16000:
198+
case 8001 ... 16000:
199199
val = MAX77620_CNFG_GPIO_DBNC_16ms;
200200
break;
201-
case 17000 ... 32000:
201+
case 16001 ... 32000:
202202
val = MAX77620_CNFG_GPIO_DBNC_32ms;
203203
break;
204204
default:

0 commit comments

Comments
 (0)