pinctrl: baytrail: Rectify debounce support (part 2)
authorAndy Shevchenko <[email protected]>
Thu, 26 Jan 2017 17:24:07 +0000 (19:24 +0200)
committerLinus Walleij <[email protected]>
Mon, 30 Jan 2017 14:46:33 +0000 (15:46 +0100)
The commit 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support")
almost fixes the logic of debuonce but missed couple of things, i.e.
typo in mask when disabling debounce and lack of enabling it back.

This patch addresses above issues.

Reported-by: Jean Delvare <[email protected]>
Fixes: 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support")
Signed-off-by: Andy Shevchenko <[email protected]>
Reviewed-by: Jean Delvare <[email protected]>
Acked-by: Mika Westerberg <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
drivers/pinctrl/intel/pinctrl-baytrail.c

index c123488266ce74883ed8ba972b43103d136bb66e..3eb7c2bde87e09ad8c0bfe9ff083312b2d169faa 100644 (file)
@@ -1243,10 +1243,12 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
                        debounce = readl(db_reg);
                        debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
 
+                       if (arg)
+                               conf |= BYT_DEBOUNCE_EN;
+                       else
+                               conf &= ~BYT_DEBOUNCE_EN;
+
                        switch (arg) {
-                       case 0:
-                               conf &= BYT_DEBOUNCE_EN;
-                               break;
                        case 375:
                                debounce |= BYT_DEBOUNCE_PULSE_375US;
                                break;
@@ -1269,7 +1271,9 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
                                debounce |= BYT_DEBOUNCE_PULSE_24MS;
                                break;
                        default:
-                               ret = -EINVAL;
+                               if (arg)
+                                       ret = -EINVAL;
+                               break;
                        }
 
                        if (!ret)