diff mbox series

[v1] pinctrl: baytrail: fix debounce disable case

Message ID 20230912154815.28975-1-raag.jadav@intel.com
State Accepted
Commit 2d325e54d9e2e4ae247c9fd03f810208ce958c51
Headers show
Series [v1] pinctrl: baytrail: fix debounce disable case | expand

Commit Message

Raag Jadav Sept. 12, 2023, 3:48 p.m. UTC
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>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Mika Westerberg Sept. 12, 2023, 3:54 p.m. UTC | #1
On Tue, Sep 12, 2023 at 09:18:15PM +0530, Raag Jadav wrote:
> 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>
Andy Shevchenko Sept. 12, 2023, 4:50 p.m. UTC | #2
On Tue, Sep 12, 2023 at 06:54:43PM +0300, Mika Westerberg wrote:
> On Tue, Sep 12, 2023 at 09:18:15PM +0530, Raag Jadav wrote:
> > 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>

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 6b45b165604c..c522fd2283f9 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -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;