Skip to contentSkip to conversation

pinctrl: baytrail: Fix debounce feature

PATCH In review Andy Shevchenko 4 participants 17 messages Jan 26, 2017 – Jan 30, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover pinctrl: baytrail: Fix debounce feature

This series contains two important fixes of debounce feature and one extension to debug printing.

It seems no one, including me, didn't test it properly. Lesson learned.

Note that fix doesn't make any difference to the existing logic. It means the last caller will win the trade and debounce value will be configured accordingly.

The actual logic fix needs to be thought about and it's not as important as crash fix. That's why the latter goes separately and right now.

Andy Shevchenko (3):
pinctrl: baytrail: Rectify debounce support (part 2)
pinctrl: baytrail: Debounce register is one per community
pinctrl: baytrail: Add debounce to debug output

 drivers/pinctrl/intel/pinctrl-baytrail.c | 71 ++++++++++++++++++++++++++++----
 1 file changed, 62 insertions(+), 9 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 pinctrl: baytrail: Rectify debounce support (part 2)

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.

Fixes 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support")
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/pinctrl/intel/pinctrl-baytrail.c +8 -4
index e696a01365cb..958db4f5ee9b 100644
@@ -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)
Signature · 1 line
2.11.0
#12 lore raw

PATCH 3/3 pinctrl: baytrail: Add debounce to debug output

In reply to Andy Shevchenko

When debug pin configuration is printed out debounce setting is missed. Add it here.

---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 46 ++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)
drivers/pinctrl/intel/pinctrl-baytrail.c +44 -2
index a1f85a79f186..6bdb6e5879f8 100644
@@ -1391,11 +1391,12 @@ static int byt_gpio_direction_output(struct gpio_chip *chip,
 static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 {
 	struct byt_gpio *vg = gpiochip_get_data(chip);
+	u32 conf0, debounce, val;
 	int i;
-	u32 conf0, val;
 
 	for (i = 0; i < vg->soc_data->npins; i++) {
 		const struct byt_community *comm;
+		const char *db_str = NULL;
 		const char *pull_str = NULL;
 		const char *pull = NULL;
 		void __iomem *reg;
@@ -1415,6 +1416,16 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 		}
 		conf0 = readl(reg);
 
+		reg = byt_gpio_reg(vg, pin, BYT_DEBOUNCE_REG);
+		if (!reg) {
+			seq_printf(s,
+				   "Could not retrieve pin %i debounce reg\n",
+				   pin);
+			raw_spin_unlock_irqrestore(&vg->lock, flags);
+			continue;
+		}
+		debounce = readl(reg);
+
 		reg = byt_gpio_reg(vg, pin, BYT_VAL_REG);
 		if (!reg) {
 			seq_printf(s,
@@ -1459,6 +1470,32 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 			break;
 		}
 
+		if (conf0 & BYT_DEBOUNCE_EN) {
+			switch (debounce & BYT_DEBOUNCE_PULSE_MASK) {
+			case BYT_DEBOUNCE_PULSE_375US:
+				db_str = "375us";
+				break;
+			case BYT_DEBOUNCE_PULSE_750US:
+				db_str = "750us";
+				break;
+			case BYT_DEBOUNCE_PULSE_1500US:
+				db_str = "1500us";
+				break;
+			case BYT_DEBOUNCE_PULSE_3MS:
+				db_str = "3ms";
+				break;
+			case BYT_DEBOUNCE_PULSE_6MS:
+				db_str = "6ms";
+				break;
+			case BYT_DEBOUNCE_PULSE_12MS:
+				db_str = "12ms";
+				break;
+			case BYT_DEBOUNCE_PULSE_24MS:
+				db_str = "24ms";
+				break;
+			}
+		}
+
 		seq_printf(s,
 			   " gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s",
 			   pin,
@@ -1475,7 +1512,12 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 		if (pull && pull_str)
 			seq_printf(s, " %-4s %-3s", pull, pull_str);
 		else
-			seq_puts(s, "          ");
+			seq_puts(s, "         ");
+
+		if (db_str)
+			seq_printf(s, " %-6s", db_str);
+		else
+			seq_puts(s, "        ");
 
 		if (conf0 & BYT_IODEN)
 			seq_puts(s, " open-drain");
Signature · 1 line
2.11.0
#6 lore raw

PATCH 2/3 pinctrl: baytrail: Debounce register is one per community

In reply to Andy Shevchenko

Debounce value is set globally per community. Otherwise user will easily get a kernel crash when they start using the feature:

BUG: unable to handle kernel paging request at ffffc900003be000
IP: byt_gpio_dbg_show+0xa9/0x430

Make it clear in byt_gpio_reg().

Note that this fix just prevents kernel to crash, but doesn't make any difference to the existing logic. It means the last caller will win the trade and debounce value will be configured accordingly. The actual logic fix needs to be thought about and it's not as important as crash fix. That's why the latter goes separately and right now.

Fixes 658b476c742f ("pinctrl: baytrail: Add debounce configuration")
Cc Cristina Ciocan <[email protected]>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/pinctrl/intel/pinctrl-baytrail.c +10 -3
index 958db4f5ee9b..a1f85a79f186 100644
@@ -731,16 +731,23 @@ static void __iomem *byt_gpio_reg(struct byt_gpio *vg, unsigned int offset,
 				  int reg)
 {
 	struct byt_community *comm = byt_get_community(vg, offset);
-	u32 reg_offset = 0;
+	u32 reg_offset;
 
 	if (!comm)
 		return NULL;
 
 	offset -= comm->pin_base;
-	if (reg == BYT_INT_STAT_REG)
+	switch (reg) {
+	case BYT_INT_STAT_REG:
 		reg_offset = (offset / 32) * 4;
-	else
+		break;
+	case BYT_DEBOUNCE_REG:
+		reg_offset = 0;
+		break;
+	default:
 		reg_offset = comm->pad_map[offset] * 16;
+		break;
+	}
 
 	return comm->reg_base + reg_offset + reg;
 }
Signature · 1 line
2.11.0
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2)

In reply to Andy Shevchenko

Hi Andy,

Quoted 34 lines · Andy Shevchenko

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.

Fixes 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support")
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/pinctrl/intel/pinctrl-baytrail.c +5 -3
index e696a01365cb..958db4f5ee9b 100644
@@ -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;

drivers/pinctrl/intel/pinctrl-baytrail.c static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, · line 1275

Quoted 6 lines
drivers/pinctrl/intel/pinctrl-baytrail.c +2 -1
@@ -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;

Or you could keep the case 0: above. Makes the patch even smaller.

drivers/pinctrl/intel/pinctrl-baytrail.c static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, · line 1276

Quoted 1 line
drivers/pinctrl/intel/pinctrl-baytrail.c +1 -0
+				break;

That break isn't needed.

drivers/pinctrl/intel/pinctrl-baytrail.c static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, · line 1279

Quoted 3 lines
drivers/pinctrl/intel/pinctrl-baytrail.c +0 -0
 			}
 
 			if (!ret)

Looks good to me.

Signature · 2 lines
Jean Delvare
SUSE L3 Support
Reviewed-by on v1 2/3
#7 lore raw

Re: [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community

In reply to Andy Shevchenko
Quoted 38 lines · Andy Shevchenko

Debounce value is set globally per community. Otherwise user will easily get a kernel crash when they start using the feature:

BUG: unable to handle kernel paging request at ffffc900003be000
IP: byt_gpio_dbg_show+0xa9/0x430

Make it clear in byt_gpio_reg().

Note that this fix just prevents kernel to crash, but doesn't make any difference to the existing logic. It means the last caller will win the trade and debounce value will be configured accordingly. The actual logic fix needs to be thought about and it's not as important as crash fix. That's why the latter goes separately and right now.

Fixes 658b476c742f ("pinctrl: baytrail: Add debounce configuration")
Cc Cristina Ciocan <[email protected]>
---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/pinctrl/intel/pinctrl-baytrail.c +2 -2
index 958db4f5ee9b..a1f85a79f186 100644
@@ -731,16 +731,23 @@ static void __iomem *byt_gpio_reg(struct byt_gpio *vg, unsigned int offset,
 				  int reg)
 {
 	struct byt_community *comm = byt_get_community(vg, offset);
-	u32 reg_offset = 0;
+	u32 reg_offset;
 
 	if (!comm)
 		return NULL;
 
 	offset -= comm->pin_base;
-	if (reg == BYT_INT_STAT_REG)
+	switch (reg) {

drivers/pinctrl/intel/pinctrl-baytrail.c static void __iomem *byt_gpio_reg(struct byt_gpio *vg, unsigned int offset, · line 749

Quoted 10 lines
drivers/pinctrl/intel/pinctrl-baytrail.c +7 -1
+	case BYT_INT_STAT_REG:
 		reg_offset = (offset / 32) * 4;
-	else
+		break;
+	case BYT_DEBOUNCE_REG:
+		reg_offset = 0;
+		break;
+	default:
 		reg_offset = comm->pad_map[offset] * 16;
+		break;

That break isn't needed ;-)

drivers/pinctrl/intel/pinctrl-baytrail.c static void __iomem *byt_gpio_reg(struct byt_gpio *vg, unsigned int offset, · line 753

Quoted 4 lines
drivers/pinctrl/intel/pinctrl-baytrail.c +1 -0
+	}
 
 	return comm->reg_base + reg_offset + reg;
 }

The code looks sane to me, although I can't verify its correctness without a datasheet.

Signature · 2 lines
Jean Delvare
SUSE L3 Support
maintainer Acked-by on v1 1/3
#4 lore raw

Re: [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2)

In reply to Andy Shevchenko
Quoted 2 lines · Andy Shevchenko

The commit 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support") almost fixes the logic of debuonce but missed couple of things, i.e.

                            ^^^^^^^^ debounce
Quoted 7 lines

typo in mask when disabling debounce and lack of enabling it back.

This patch addresses above issues.

Fixes 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support")
maintainer Acked-by on v1 2/3
#10 lore raw

Re: [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community

In reply to Andy Shevchenko
Quoted 14 lines · Andy Shevchenko

Debounce value is set globally per community. Otherwise user will easily get a kernel crash when they start using the feature:

BUG: unable to handle kernel paging request at ffffc900003be000
IP: byt_gpio_dbg_show+0xa9/0x430

Make it clear in byt_gpio_reg().

Note that this fix just prevents kernel to crash, but doesn't make any difference to the existing logic. It means the last caller will win the trade and debounce value will be configured accordingly. The actual logic fix needs to be thought about and it's not as important as crash fix. That's why the latter goes separately and right now.

Quoted 3 lines
Fixes 658b476c742f ("pinctrl: baytrail: Add debounce configuration")
Cc Cristina Ciocan <[email protected]>
maintainer
#13 lore raw

Re: [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output

In reply to Andy Shevchenko
Quoted 2 lines · Andy Shevchenko

When debug pin configuration is printed out debounce setting is missed. Add it here.

That information is already made available in pinctrl debugfs files so I don't see any reason to duplicate it.

Reviewed-by on v1 3/3
#14 lore raw

Re: [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output

In reply to Andy Shevchenko

Hi Andy,

Quoted 77 lines · Andy Shevchenko

When debug pin configuration is printed out debounce setting is missed. Add it here.

---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 46 ++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)
drivers/pinctrl/intel/pinctrl-baytrail.c +38 -1
index a1f85a79f186..6bdb6e5879f8 100644
@@ -1391,11 +1391,12 @@ static int byt_gpio_direction_output(struct gpio_chip *chip,
 static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 {
 	struct byt_gpio *vg = gpiochip_get_data(chip);
+	u32 conf0, debounce, val;
 	int i;
-	u32 conf0, val;
 
 	for (i = 0; i < vg->soc_data->npins; i++) {
 		const struct byt_community *comm;
+		const char *db_str = NULL;
 		const char *pull_str = NULL;
 		const char *pull = NULL;
 		void __iomem *reg;
@@ -1415,6 +1416,16 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 		}
 		conf0 = readl(reg);
 
+		reg = byt_gpio_reg(vg, pin, BYT_DEBOUNCE_REG);
+		if (!reg) {
+			seq_printf(s,
+				   "Could not retrieve pin %i debounce reg\n",
+				   pin);
+			raw_spin_unlock_irqrestore(&vg->lock, flags);
+			continue;
+		}
+		debounce = readl(reg);
+
 		reg = byt_gpio_reg(vg, pin, BYT_VAL_REG);
 		if (!reg) {
 			seq_printf(s,
@@ -1459,6 +1470,32 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 			break;
 		}
 
+		if (conf0 & BYT_DEBOUNCE_EN) {
+			switch (debounce & BYT_DEBOUNCE_PULSE_MASK) {
+			case BYT_DEBOUNCE_PULSE_375US:
+				db_str = "375us";
+				break;
+			case BYT_DEBOUNCE_PULSE_750US:
+				db_str = "750us";
+				break;
+			case BYT_DEBOUNCE_PULSE_1500US:
+				db_str = "1500us";
+				break;
+			case BYT_DEBOUNCE_PULSE_3MS:
+				db_str = "3ms";
+				break;
+			case BYT_DEBOUNCE_PULSE_6MS:
+				db_str = "6ms";
+				break;
+			case BYT_DEBOUNCE_PULSE_12MS:
+				db_str = "12ms";
+				break;
+			case BYT_DEBOUNCE_PULSE_24MS:
+				db_str = "24ms";
+				break;
+			}
+		}
+
 		seq_printf(s,
 			   " gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s",
 			   pin,

drivers/pinctrl/intel/pinctrl-baytrail.c static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) · line 1520

Quoted 10 lines
drivers/pinctrl/intel/pinctrl-baytrail.c +6 -1
@@ -1475,7 +1512,12 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 		if (pull && pull_str)
 			seq_printf(s, " %-4s %-3s", pull, pull_str);
 		else
-			seq_puts(s, "          ");
+			seq_puts(s, "         ");
+
+		if (db_str)
+			seq_printf(s, " %-6s", db_str);
+		else
+			seq_puts(s, "        ");

Isn't that one space too many?

drivers/pinctrl/intel/pinctrl-baytrail.c static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) · line 1523

Quoted 3 lines
drivers/pinctrl/intel/pinctrl-baytrail.c +0 -0
 		if (conf0 & BYT_IODEN)
 			seq_puts(s, " open-drain");

Looks good to me.

Signature · 2 lines
Jean Delvare
SUSE L3 Support
#8 lore raw

Re: [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community

In reply to Jean Delvare
Quoted 50 lines · Jean Delvare
Quoted 49 lines · Andy Shevchenko

Debounce value is set globally per community. Otherwise user will easily
get a kernel crash when they start using the feature:

BUG: unable to handle kernel paging request at ffffc900003be000
IP: byt_gpio_dbg_show+0xa9/0x430

Make it clear in byt_gpio_reg().

Note that this fix just prevents kernel to crash, but doesn't make any
difference to the existing logic. It means the last caller will win the
trade and debounce value will be configured accordingly. The actual logic fix needs to be thought about and it's not as important as crash
fix. That's why the latter goes separately and right now.

Fixes 658b476c742f ("pinctrl: baytrail: Add debounce

configuration")

---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 13 ++++++++++---

 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/pinctrl/intel/pinctrl-baytrail.c +1 -1
index 958db4f5ee9b..a1f85a79f186 100644
@@ -731,16 +731,23 @@ static void __iomem *byt_gpio_reg(struct
 byt_gpio *vg, unsigned int offset,
  				  int reg)
  {
  	struct byt_community *comm = byt_get_community(vg, offset);
-	u32 reg_offset = 0;
+	u32 reg_offset;


  if (!comm)
  return NULL;

  offset -= comm->pin_base;

drivers/pinctrl/intel/pinctrl-baytrail.c +2 -1
-	if (reg == BYT_INT_STAT_REG)
+	switch (reg) {
+	case BYT_INT_STAT_REG:

  reg_offset = (offset / 32) * 4;

drivers/pinctrl/intel/pinctrl-baytrail.c +1 -1
-	else
+		break;
Quoted 8 lines

drivers/pinctrl/intel/pinctrl-baytrail.c

Quoted 6 lines
drivers/pinctrl/intel/pinctrl-baytrail.c +4 -0
+	case BYT_DEBOUNCE_REG:
+		reg_offset = 0;
+		break;
+	default:

  reg_offset = comm->pad_map[offset] * 16;

drivers/pinctrl/intel/pinctrl-baytrail.c +1 -0
+		break;

That break isn't needed ;-)

Would be better to have in my opinion. I already did myself some mistakes regarding to missed break.

Quoted 7 lines
Quoted 4 lines
drivers/pinctrl/intel/pinctrl-baytrail.c +1 -0
+	}


  return comm->reg_base + reg_offset + reg;
 }

The code looks sane to me, although I can't verify its correctness without a datasheet.

Datasheet is public.

Intel® Atom™ Processor Z3600 and Z3700 Series Datasheet (Volume 2 of 2)
Number: 329518-002

Quoted 2 lines

Thanks!

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#3 lore raw

Re: [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2)

In reply to Jean Delvare
Quoted 43 lines · Jean Delvare

Hi Andy,

Quoted 40 lines · Andy Shevchenko

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.

Fixes 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support")

---
 drivers/pinctrl/intel/pinctrl-baytrail.c | 12 ++++++++----

 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/pinctrl/intel/pinctrl-baytrail.c +0 -0
index e696a01365cb..958db4f5ee9b 100644
@@ -1243,10 +1243,12 @@ static int byt_pin_config_set(struct
 pinctrl_dev *pctl_dev,
  			debounce = readl(db_reg);
  			debounce &= ~BYT_DEBOUNCE_PULSE_MASK;

drivers/pinctrl/intel/pinctrl-baytrail.c +5 -0
+			if (arg)
+				conf |= BYT_DEBOUNCE_EN;
+			else
+				conf &= ~BYT_DEBOUNCE_EN;
+

  switch (arg) {

drivers/pinctrl/intel/pinctrl-baytrail.c +0 -3
-			case 0:
-				conf &= BYT_DEBOUNCE_EN;
-				break;

  case 375:
  debounce |=
BYT_DEBOUNCE_PULSE_375US;
  break;

drivers/pinctrl/intel/pinctrl-baytrail.c +0 -0
@@ -1269,7 +1271,9 @@ static int byt_pin_config_set(struct
 pinctrl_dev *pctl_dev,

  debounce |=

Quoted 8 lines

drivers/pinctrl/intel/pinctrl-baytrail.c static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, · line 1275

Quoted 6 lines

BYT_DEBOUNCE_PULSE_24MS;
  break;
  default:

drivers/pinctrl/intel/pinctrl-baytrail.c +2 -1
-				ret = -EINVAL;
+				if (arg)
+					ret = -EINVAL;

Or you could keep the case 0: above. Makes the patch even smaller.

I would keep the way I put it here.

Quoted 4 lines

drivers/pinctrl/intel/pinctrl-baytrail.c static int byt_pin_config_set(struct pinctrl_dev *pctl_dev, · line 1276

Quoted 2 lines
drivers/pinctrl/intel/pinctrl-baytrail.c +1 -0
+				break;

That break isn't needed.

Same explanation as in patch 2.

Quoted 8 lines
Quoted 4 lines

  }

  if (!ret)

Looks good to me.

Thanks!

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#9 lore raw

Re: [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community

In reply to Andy Shevchenko
Quoted 5 lines · Andy Shevchenko
Quoted 1 line · Jean Delvare

That break isn't needed ;-)

Would be better to have in my opinion. I already did myself some mistakes regarding to missed break.

OK, fine with me.

Quoted 7 lines
Quoted 2 lines

The code looks sane to me, although I can't verify its correctness without a datasheet.

Datasheet is public.

Intel® Atom™ Processor Z3600 and Z3700 Series Datasheet (Volume 2 of 2)
Number: 329518-002

Apparently it was removed in December 2014 and replaced by a more concise document...

https://communities.intel.com/thread/57313

But no big deal, I trust your fix is correct.

Signature · 2 lines
Jean Delvare
SUSE L3 Support
#5 lore raw

Re: [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2)

In reply to Andy Shevchenko
Quoted 9 lines · Andy Shevchenko

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.

Fixes 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support")

Patch applied for fixes, with the ACKs.

Yours,
Linus Walleij

#11 lore raw

Re: [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community

In reply to Andy Shevchenko
Quoted 14 lines · Andy Shevchenko

Debounce value is set globally per community. Otherwise user will easily get a kernel crash when they start using the feature:

BUG: unable to handle kernel paging request at ffffc900003be000
IP: byt_gpio_dbg_show+0xa9/0x430

Make it clear in byt_gpio_reg().

Note that this fix just prevents kernel to crash, but doesn't make any difference to the existing logic. It means the last caller will win the trade and debounce value will be configured accordingly. The actual logic fix needs to be thought about and it's not as important as crash fix. That's why the latter goes separately and right now.

Quoted 3 lines
Fixes 658b476c742f ("pinctrl: baytrail: Add debounce configuration")
Cc Cristina Ciocan <[email protected]>

Patch applied for fixes.

Yours,
Linus Walleij

#16 lore raw

Re: [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output

In reply to Linus Walleij
Quoted 10 lines · Linus Walleij
Quoted 5 lines · Andy Shevchenko

When debug pin configuration is printed out debounce setting is missed.
Add it here.

I have dropped this patch for now due to Mika's skepticism.

Thank you, that what I was expecting.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy