pinctrl: baytrail: fix debounce disable case
authorRaag Jadav <raag.jadav@intel.com>
Tue, 12 Sep 2023 15:48:15 +0000 (21:18 +0530)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 12 Sep 2023 16:41:16 +0000 (19:41 +0300)
We don't need to update debounce pulse value in case debounce is to be
disabled. Break such a case where arg value is zero.

Fixes: 4cfff5b7af8b ("pinctrl: baytrail: consolidate common mask operation")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-gpio/d164d471-5432-4c3c-afdb-33dc8f53d043@moroto.mountain/
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/pinctrl/intel/pinctrl-baytrail.c

index faa8b7ff5bcf349210f77a78587fe121a40b8aaf..ec76e43527c5ccc6f1bedaf7dd38b18e208a3938 100644 (file)
@@ -983,11 +983,18 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
 
                        break;
                case PIN_CONFIG_INPUT_DEBOUNCE:
-                       if (arg)
+                       if (arg) {
                                conf |= BYT_DEBOUNCE_EN;
-                       else
+                       } else {
                                conf &= ~BYT_DEBOUNCE_EN;
 
+                               /*
+                                * No need to update the pulse value.
+                                * Debounce is going to be disabled.
+                                */
+                               break;
+                       }
+
                        switch (arg) {
                        case 375:
                                db_pulse = BYT_DEBOUNCE_PULSE_375US;