* [PATCH v1 0/3] pinctrl: baytrail: Fix debounce feature @ 2017-01-26 17:24 Andy Shevchenko 2017-01-26 17:24 ` [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) Andy Shevchenko ` (2 more replies) 0 siblings, 3 replies; 17+ messages in thread From: Andy Shevchenko @ 2017-01-26 17:24 UTC (permalink / raw) To: Linus Walleij, Mika Westerberg, linux-gpio, Jean Delvare; +Cc: Andy Shevchenko 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(-) -- 2.11.0 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) 2017-01-26 17:24 [PATCH v1 0/3] pinctrl: baytrail: Fix debounce feature Andy Shevchenko @ 2017-01-26 17:24 ` Andy Shevchenko 2017-01-27 9:14 ` Jean Delvare ` (2 more replies) 2017-01-26 17:24 ` [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community Andy Shevchenko 2017-01-26 17:24 ` [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output Andy Shevchenko 2 siblings, 3 replies; 17+ messages in thread From: Andy Shevchenko @ 2017-01-26 17:24 UTC (permalink / raw) To: Linus Walleij, Mika Westerberg, linux-gpio, Jean Delvare; +Cc: 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. Reported-by: Jean Delvare <jdelvare@suse.de> Fixes: 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/pinctrl/intel/pinctrl-baytrail.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index e696a01365cb..958db4f5ee9b 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -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) -- 2.11.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) 2017-01-26 17:24 ` [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) Andy Shevchenko @ 2017-01-27 9:14 ` Jean Delvare 2017-01-27 13:28 ` Andy Shevchenko 2017-01-27 9:34 ` Mika Westerberg 2017-01-30 14:47 ` Linus Walleij 2 siblings, 1 reply; 17+ messages in thread From: Jean Delvare @ 2017-01-27 9:14 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Linus Walleij, Mika Westerberg, linux-gpio Hi Andy, On Thu, 26 Jan 2017 19:24:07 +0200, Andy Shevchenko wrote: > 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 <jdelvare@suse.de> > Fixes: 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support") > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/pinctrl/intel/pinctrl-baytrail.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c > index e696a01365cb..958db4f5ee9b 100644 > --- a/drivers/pinctrl/intel/pinctrl-baytrail.c > +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c > @@ -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; Or you could keep the case 0: above. Makes the patch even smaller. > + break; That break isn't needed. > } > > if (!ret) Looks good to me. Reviewed-by: Jean Delvare <jdelvare@suse.de> -- Jean Delvare SUSE L3 Support ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) 2017-01-27 9:14 ` Jean Delvare @ 2017-01-27 13:28 ` Andy Shevchenko 0 siblings, 0 replies; 17+ messages in thread From: Andy Shevchenko @ 2017-01-27 13:28 UTC (permalink / raw) To: Jean Delvare; +Cc: Linus Walleij, Mika Westerberg, linux-gpio On Fri, 2017-01-27 at 10:14 +0100, Jean Delvare wrote: > Hi Andy, > > On Thu, 26 Jan 2017 19:24:07 +0200, Andy Shevchenko wrote: > > 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 <jdelvare@suse.de> > > Fixes: 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support") > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > --- > > drivers/pinctrl/intel/pinctrl-baytrail.c | 12 ++++++++---- > > 1 file changed, 8 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c > > b/drivers/pinctrl/intel/pinctrl-baytrail.c > > index e696a01365cb..958db4f5ee9b 100644 > > --- a/drivers/pinctrl/intel/pinctrl-baytrail.c > > +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c > > @@ -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; > > Or you could keep the case 0: above. Makes the patch even smaller. I would keep the way I put it here. > > > + break; > > That break isn't needed. Same explanation as in patch 2. > > > } > > > > if (!ret) > > Looks good to me. > > Reviewed-by: Jean Delvare <jdelvare@suse.de> Thanks! -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) 2017-01-26 17:24 ` [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) Andy Shevchenko 2017-01-27 9:14 ` Jean Delvare @ 2017-01-27 9:34 ` Mika Westerberg 2017-01-30 14:47 ` Linus Walleij 2 siblings, 0 replies; 17+ messages in thread From: Mika Westerberg @ 2017-01-27 9:34 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Linus Walleij, linux-gpio, Jean Delvare On Thu, Jan 26, 2017 at 07:24:07PM +0200, Andy Shevchenko wrote: > The commit 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support") > almost fixes the logic of debuonce but missed couple of things, i.e. ^^^^^^^^ debounce > typo in mask when disabling debounce and lack of enabling it back. > > This patch addresses above issues. > > Reported-by: Jean Delvare <jdelvare@suse.de> > Fixes: 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support") > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) 2017-01-26 17:24 ` [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) Andy Shevchenko 2017-01-27 9:14 ` Jean Delvare 2017-01-27 9:34 ` Mika Westerberg @ 2017-01-30 14:47 ` Linus Walleij 2 siblings, 0 replies; 17+ messages in thread From: Linus Walleij @ 2017-01-30 14:47 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Mika Westerberg, linux-gpio, Jean Delvare On Thu, Jan 26, 2017 at 6:24 PM, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > 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 <jdelvare@suse.de> > Fixes: 04ff5a095d66 ("pinctrl: baytrail: Rectify debounce support") > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Patch applied for fixes, with the ACKs. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community 2017-01-26 17:24 [PATCH v1 0/3] pinctrl: baytrail: Fix debounce feature Andy Shevchenko 2017-01-26 17:24 ` [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) Andy Shevchenko @ 2017-01-26 17:24 ` Andy Shevchenko 2017-01-27 9:21 ` Jean Delvare ` (2 more replies) 2017-01-26 17:24 ` [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output Andy Shevchenko 2 siblings, 3 replies; 17+ messages in thread From: Andy Shevchenko @ 2017-01-26 17:24 UTC (permalink / raw) To: Linus Walleij, Mika Westerberg, linux-gpio, Jean Delvare Cc: Andy Shevchenko, Cristina Ciocan 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 <cristina.ciocan@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/pinctrl/intel/pinctrl-baytrail.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index 958db4f5ee9b..a1f85a79f186 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -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; } -- 2.11.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community 2017-01-26 17:24 ` [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community Andy Shevchenko @ 2017-01-27 9:21 ` Jean Delvare 2017-01-27 13:27 ` Andy Shevchenko 2017-01-27 9:35 ` Mika Westerberg 2017-01-30 14:49 ` Linus Walleij 2 siblings, 1 reply; 17+ messages in thread From: Jean Delvare @ 2017-01-27 9:21 UTC (permalink / raw) To: Andy Shevchenko Cc: Linus Walleij, Mika Westerberg, linux-gpio, Cristina Ciocan On Thu, 26 Jan 2017 19:24:08 +0200, Andy Shevchenko wrote: > 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 <cristina.ciocan@intel.com> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/pinctrl/intel/pinctrl-baytrail.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c > index 958db4f5ee9b..a1f85a79f186 100644 > --- a/drivers/pinctrl/intel/pinctrl-baytrail.c > +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c > @@ -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; That break isn't needed ;-) > + } > > return comm->reg_base + reg_offset + reg; > } The code looks sane to me, although I can't verify its correctness without a datasheet. Reviewed-by: Jean Delvare <jdelvare@suse.de> -- Jean Delvare SUSE L3 Support ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community 2017-01-27 9:21 ` Jean Delvare @ 2017-01-27 13:27 ` Andy Shevchenko 2017-01-27 14:06 ` Jean Delvare 0 siblings, 1 reply; 17+ messages in thread From: Andy Shevchenko @ 2017-01-27 13:27 UTC (permalink / raw) To: Jean Delvare; +Cc: Linus Walleij, Mika Westerberg, linux-gpio, Cristina Ciocan On Fri, 2017-01-27 at 10:21 +0100, Jean Delvare wrote: > On Thu, 26 Jan 2017 19:24:08 +0200, Andy Shevchenko wrote: > > 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 <cristina.ciocan@intel.com> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > --- > > drivers/pinctrl/intel/pinctrl-baytrail.c | 13 ++++++++++--- > > 1 file changed, 10 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c > > b/drivers/pinctrl/intel/pinctrl-baytrail.c > > index 958db4f5ee9b..a1f85a79f186 100644 > > --- a/drivers/pinctrl/intel/pinctrl-baytrail.c > > +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c > > @@ -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; > > That break isn't needed ;-) Would be better to have in my opinion. I already did myself some mistakes regarding to missed break. > > + } > > > > 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 > > Reviewed-by: Jean Delvare <jdelvare@suse.de> Thanks! -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community 2017-01-27 13:27 ` Andy Shevchenko @ 2017-01-27 14:06 ` Jean Delvare 0 siblings, 0 replies; 17+ messages in thread From: Jean Delvare @ 2017-01-27 14:06 UTC (permalink / raw) To: Andy Shevchenko Cc: Linus Walleij, Mika Westerberg, linux-gpio, Cristina Ciocan On Fri, 27 Jan 2017 15:27:19 +0200, Andy Shevchenko wrote: > On Fri, 2017-01-27 at 10:21 +0100, Jean Delvare wrote: > > 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. > > 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. -- Jean Delvare SUSE L3 Support ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community 2017-01-26 17:24 ` [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community Andy Shevchenko 2017-01-27 9:21 ` Jean Delvare @ 2017-01-27 9:35 ` Mika Westerberg 2017-01-30 14:49 ` Linus Walleij 2 siblings, 0 replies; 17+ messages in thread From: Mika Westerberg @ 2017-01-27 9:35 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Linus Walleij, linux-gpio, Jean Delvare, Cristina Ciocan On Thu, Jan 26, 2017 at 07:24:08PM +0200, Andy Shevchenko wrote: > 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 <cristina.ciocan@intel.com> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community 2017-01-26 17:24 ` [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community Andy Shevchenko 2017-01-27 9:21 ` Jean Delvare 2017-01-27 9:35 ` Mika Westerberg @ 2017-01-30 14:49 ` Linus Walleij 2 siblings, 0 replies; 17+ messages in thread From: Linus Walleij @ 2017-01-30 14:49 UTC (permalink / raw) To: Andy Shevchenko Cc: Mika Westerberg, linux-gpio, Jean Delvare, Cristina Ciocan On Thu, Jan 26, 2017 at 6:24 PM, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > 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 <cristina.ciocan@intel.com> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Patch applied for fixes. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output 2017-01-26 17:24 [PATCH v1 0/3] pinctrl: baytrail: Fix debounce feature Andy Shevchenko 2017-01-26 17:24 ` [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) Andy Shevchenko 2017-01-26 17:24 ` [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community Andy Shevchenko @ 2017-01-26 17:24 ` Andy Shevchenko 2017-01-27 9:40 ` Mika Westerberg ` (2 more replies) 2 siblings, 3 replies; 17+ messages in thread From: Andy Shevchenko @ 2017-01-26 17:24 UTC (permalink / raw) To: Linus Walleij, Mika Westerberg, linux-gpio, Jean Delvare; +Cc: Andy Shevchenko When debug pin configuration is printed out debounce setting is missed. Add it here. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/pinctrl/intel/pinctrl-baytrail.c | 46 ++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index a1f85a79f186..6bdb6e5879f8 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -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"); -- 2.11.0 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output 2017-01-26 17:24 ` [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output Andy Shevchenko @ 2017-01-27 9:40 ` Mika Westerberg 2017-01-27 10:07 ` Jean Delvare 2017-01-30 14:51 ` Linus Walleij 2 siblings, 0 replies; 17+ messages in thread From: Mika Westerberg @ 2017-01-27 9:40 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Linus Walleij, linux-gpio, Jean Delvare On Thu, Jan 26, 2017 at 07:24:09PM +0200, Andy Shevchenko wrote: > 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. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output 2017-01-26 17:24 ` [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output Andy Shevchenko 2017-01-27 9:40 ` Mika Westerberg @ 2017-01-27 10:07 ` Jean Delvare 2017-01-30 14:51 ` Linus Walleij 2 siblings, 0 replies; 17+ messages in thread From: Jean Delvare @ 2017-01-27 10:07 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Linus Walleij, Mika Westerberg, linux-gpio Hi Andy, On Thu, 26 Jan 2017 19:24:09 +0200, Andy Shevchenko wrote: > When debug pin configuration is printed out debounce setting is missed. > Add it here. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/pinctrl/intel/pinctrl-baytrail.c | 46 ++++++++++++++++++++++++++++++-- > 1 file changed, 44 insertions(+), 2 deletions(-) > > diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c > index a1f85a79f186..6bdb6e5879f8 100644 > --- a/drivers/pinctrl/intel/pinctrl-baytrail.c > +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c > @@ -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, " "); Isn't that one space too many? > > if (conf0 & BYT_IODEN) > seq_puts(s, " open-drain"); Looks good to me. Reviewed-by: Jean Delvare <jdelvare@suse.de> -- Jean Delvare SUSE L3 Support ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output 2017-01-26 17:24 ` [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output Andy Shevchenko 2017-01-27 9:40 ` Mika Westerberg 2017-01-27 10:07 ` Jean Delvare @ 2017-01-30 14:51 ` Linus Walleij 2017-01-30 15:13 ` Andy Shevchenko 2 siblings, 1 reply; 17+ messages in thread From: Linus Walleij @ 2017-01-30 14:51 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Mika Westerberg, linux-gpio, Jean Delvare On Thu, Jan 26, 2017 at 6:24 PM, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > When debug pin configuration is printed out debounce setting is missed. > Add it here. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> I have dropped this patch for now due to Mika's skepticism. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output 2017-01-30 14:51 ` Linus Walleij @ 2017-01-30 15:13 ` Andy Shevchenko 0 siblings, 0 replies; 17+ messages in thread From: Andy Shevchenko @ 2017-01-30 15:13 UTC (permalink / raw) To: Linus Walleij; +Cc: Mika Westerberg, linux-gpio, Jean Delvare On Mon, 2017-01-30 at 15:51 +0100, Linus Walleij wrote: > On Thu, Jan 26, 2017 at 6:24 PM, Andy Shevchenko > <andriy.shevchenko@linux.intel.com> wrote: > > > When debug pin configuration is printed out debounce setting is > > missed. > > Add it here. > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > I have dropped this patch for now due to Mika's skepticism. Thank you, that what I was expecting. -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2017-01-30 15:18 UTC | newest] Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-01-26 17:24 [PATCH v1 0/3] pinctrl: baytrail: Fix debounce feature Andy Shevchenko 2017-01-26 17:24 ` [PATCH v1 1/3] pinctrl: baytrail: Rectify debounce support (part 2) Andy Shevchenko 2017-01-27 9:14 ` Jean Delvare 2017-01-27 13:28 ` Andy Shevchenko 2017-01-27 9:34 ` Mika Westerberg 2017-01-30 14:47 ` Linus Walleij 2017-01-26 17:24 ` [PATCH v1 2/3] pinctrl: baytrail: Debounce register is one per community Andy Shevchenko 2017-01-27 9:21 ` Jean Delvare 2017-01-27 13:27 ` Andy Shevchenko 2017-01-27 14:06 ` Jean Delvare 2017-01-27 9:35 ` Mika Westerberg 2017-01-30 14:49 ` Linus Walleij 2017-01-26 17:24 ` [PATCH v1 3/3] pinctrl: baytrail: Add debounce to debug output Andy Shevchenko 2017-01-27 9:40 ` Mika Westerberg 2017-01-27 10:07 ` Jean Delvare 2017-01-30 14:51 ` Linus Walleij 2017-01-30 15:13 ` Andy Shevchenko
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.