diff mbox series

[v1] pinctrl: baytrail: Avoid clearing debounce value when turning it off

Message ID 20201112190301.44373-1-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1] pinctrl: baytrail: Avoid clearing debounce value when turning it off | expand

Commit Message

Andy Shevchenko Nov. 12, 2020, 7:03 p.m. UTC
Baytrail pin control has a common register to set up debounce timeout.
When a pin configuration requested debounce to be disabled, the rest
of the pins may still want to have debounce enabled and thus rely on
the common timeout value. Avoid clearing debounce value when turning
it off for one pin while others may still use it.

Fixes: 658b476c742f ("pinctrl: baytrail: Add debounce configuration")
Depends-on: 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support")
Depends-on: 827e1579e1d5 ("pinctrl: baytrail: Rectify debounce support (part 2)")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Mika Westerberg Nov. 13, 2020, 9:36 a.m. UTC | #1
On Thu, Nov 12, 2020 at 09:03:01PM +0200, Andy Shevchenko wrote:
> Baytrail pin control has a common register to set up debounce timeout.
> When a pin configuration requested debounce to be disabled, the rest
> of the pins may still want to have debounce enabled and thus rely on
> the common timeout value. Avoid clearing debounce value when turning
> it off for one pin while others may still use it.
> 
> Fixes: 658b476c742f ("pinctrl: baytrail: Add debounce configuration")
> Depends-on: 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support")
> Depends-on: 827e1579e1d5 ("pinctrl: baytrail: Rectify debounce support (part 2)")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Andy Shevchenko Nov. 16, 2020, 10:04 a.m. UTC | #2
On Fri, Nov 13, 2020 at 11:36:11AM +0200, Mika Westerberg wrote:
> On Thu, Nov 12, 2020 at 09:03:01PM +0200, Andy Shevchenko wrote:
> > Baytrail pin control has a common register to set up debounce timeout.
> > When a pin configuration requested debounce to be disabled, the rest
> > of the pins may still want to have debounce enabled and thus rely on
> > the common timeout value. Avoid clearing debounce value when turning
> > it off for one pin while others may still use it.
> > 
> > Fixes: 658b476c742f ("pinctrl: baytrail: Add debounce configuration")
> > Depends-on: 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support")
> > Depends-on: 827e1579e1d5 ("pinctrl: baytrail: Rectify debounce support (part 2)")
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Pushed to my review and testing queue, thanks!
diff mbox series

Patch

diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index d49aab3cfbaa..394a421a19d5 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1049,7 +1049,6 @@  static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
 			break;
 		case PIN_CONFIG_INPUT_DEBOUNCE:
 			debounce = readl(db_reg);
-			debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
 
 			if (arg)
 				conf |= BYT_DEBOUNCE_EN;
@@ -1058,24 +1057,31 @@  static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
 
 			switch (arg) {
 			case 375:
+				debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
 				debounce |= BYT_DEBOUNCE_PULSE_375US;
 				break;
 			case 750:
+				debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
 				debounce |= BYT_DEBOUNCE_PULSE_750US;
 				break;
 			case 1500:
+				debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
 				debounce |= BYT_DEBOUNCE_PULSE_1500US;
 				break;
 			case 3000:
+				debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
 				debounce |= BYT_DEBOUNCE_PULSE_3MS;
 				break;
 			case 6000:
+				debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
 				debounce |= BYT_DEBOUNCE_PULSE_6MS;
 				break;
 			case 12000:
+				debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
 				debounce |= BYT_DEBOUNCE_PULSE_12MS;
 				break;
 			case 24000:
+				debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
 				debounce |= BYT_DEBOUNCE_PULSE_24MS;
 				break;
 			default: