Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1209195 > unrolled thread
| Started by | Grygorii Strashko <grygorii.strashko@ti.com> |
|---|---|
| First post | 2015-08-18 13:20 +0200 |
| Last post | 2015-08-26 10:00 +0200 |
| Articles | 9 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH 0/7] gpio: omap: fixes and improvements Grygorii Strashko <grygorii.strashko@ti.com> - 2015-08-18 13:20 +0200
[PATCH 3/7] gpio: omap: fix omap2_set_gpio_debounce Grygorii Strashko <grygorii.strashko@ti.com> - 2015-08-18 13:20 +0200
Re: [PATCH 3/7] gpio: omap: fix omap2_set_gpio_debounce Linus Walleij <linus.walleij@linaro.org> - 2015-08-26 09:50 +0200
Re: [PATCH 0/7] gpio: omap: fixes and improvements santosh shilimkar <santosh.shilimkar@oracle.com> - 2015-08-18 18:20 +0200
Re: [PATCH 0/7] gpio: omap: fixes and improvements Tony Lindgren <tony@atomide.com> - 2015-08-19 08:40 +0200
Re: [PATCH 0/7] gpio: omap: fixes and improvements Tony Lindgren <tony@atomide.com> - 2015-08-21 10:20 +0200
Re: [PATCH 0/7] gpio: omap: fixes and improvements Grygorii Strashko <grygorii.strashko@ti.com> - 2015-08-25 13:50 +0200
Re: [PATCH 0/7] gpio: omap: fixes and improvements Tony Lindgren <tony@atomide.com> - 2015-08-26 18:10 +0200
Re: [PATCH 0/7] gpio: omap: fixes and improvements Linus Walleij <linus.walleij@linaro.org> - 2015-08-26 10:00 +0200
| From | Grygorii Strashko <grygorii.strashko@ti.com> |
|---|---|
| Date | 2015-08-18 13:20 +0200 |
| Subject | [PATCH 0/7] gpio: omap: fixes and improvements |
| Message-ID | <pYN5T-4xo-7@gated-at.bofh.it> |
Hi, This patch series contains set of trivial fixes and improvements, and also patches which fixes wrong APIs usage in atomic context as for -RT as for non-RT kernel. The final goal of this series is to make TI OMAP GPIO driver compatible with -RT kernel as much as possible. Patch 1-4: trivial fixes and improvements Patch 5: fixes wrong CLK clk_prepare/unprepare APIs usage in atomic contexet Patch 6(rfc): required to be compatible with -RT kernel, because PM runtime can't be used in atimic context on -RT. Patch 7(rfc): This patch converts TI OMAP GPIO driver to use generic irq handler instead of chained IRQ handler. This way OMAP GPIO driver will be compatible with RT kernel where it will be forced thread IRQ handler while in non-RT kernel it still will be executed in HW IRQ context. Based on git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git branch: devel commit: 929550b gpio: mxc: fix section mismatch warning Boot, basic gpio functionality tested on: dra7-evm, BeagleBone(white), am43xx-gpevm, am437x-sk Manually tested on dra7-evm including suspend/resume and wakeup. Grygorii Strashko (7): gpio: omap: remove wrong irq_domain_remove usage in probe gpio: omap: switch to use platform_get_irq gpio: omap: fix omap2_set_gpio_debounce gpio: omap: protect regs access in omap_gpio_irq_handler gpio: omap: fix clk_prepare/unprepare usage gpio: omap: move pm runtime in irq_chip.irq_bus_lock/sync_unlock gpio: omap: convert to use generic irq handler drivers/gpio/gpio-omap.c | 146 +++++++++++++++++++++++++++-------------------- 1 file changed, 85 insertions(+), 61 deletions(-) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Grygorii Strashko <grygorii.strashko@ti.com> |
|---|---|
| Date | 2015-08-18 13:20 +0200 |
| Subject | [PATCH 3/7] gpio: omap: fix omap2_set_gpio_debounce |
| Message-ID | <pYN5U-4xo-35@gated-at.bofh.it> |
| In reply to | #1209195 |
According to TRMs:
Required input line stable =
(the value of the GPIO_DEBOUNCINGTIME[7:0].DEBOUNCETIME + 1) × 31,
where the value of the GPIO_DEBOUNCINGTIME[7:0].DEBOUNCETIME bit field
is from 0 to 255.
But now omap2_set_gpio_debounce() will calculate debounce time and
behave incorrectly in the following cases:
1) requested debounce time is !0 and <32
calculated DEBOUNCETIME = 0x1 == 62 us;
expected value of DEBOUNCETIME = 0x0 == 31us
2) requested debounce time is 0
calculated DEBOUNCETIME = 0x1 == 62 us;
expected: disable debounce and DEBOUNCETIME = 0x0
3) requested debounce time is >32 and <63
calculated DEBOUNCETIME = 0x0 and debounce will be disabled;
expected: enable debounce and DEBOUNCETIME = 0x1 == 62 us
Hence, rework omap2_set_gpio_debounce() to fix above cases:
1) introduce local variable "enable" and use it to identify
when debounce need to be enabled or disabled. Disable debounce
if requested debounce time is 0.
2) use below formula for debounce time calculation:
debounce = (DIV_ROUND_UP(debounce, 31) - 1) & 0xFF;
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
drivers/gpio/gpio-omap.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 03fd111..9ed5a67 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -29,6 +29,7 @@
#include <linux/platform_data/gpio-omap.h>
#define OFF_MODE 1
+#define OMAP4_GPIO_DEBOUNCINGTIME_MASK 0xFF
static LIST_HEAD(omap_gpio_list);
@@ -204,8 +205,9 @@ static inline void omap_gpio_dbck_disable(struct gpio_bank *bank)
* @offset: the gpio number on this @bank
* @debounce: debounce time to use
*
- * OMAP's debounce time is in 31us steps so we need
- * to convert and round up to the closest unit.
+ * OMAP's debounce time is in 31us steps
+ * <debounce time> = (GPIO_DEBOUNCINGTIME[7:0].DEBOUNCETIME + 1) x 31
+ * so we need to convert and round up to the closest unit.
*/
static void omap2_set_gpio_debounce(struct gpio_bank *bank, unsigned offset,
unsigned debounce)
@@ -213,16 +215,15 @@ static void omap2_set_gpio_debounce(struct gpio_bank *bank, unsigned offset,
void __iomem *reg;
u32 val;
u32 l;
+ bool enable = !!debounce;
if (!bank->dbck_flag)
return;
- if (debounce < 32)
- debounce = 0x01;
- else if (debounce > 7936)
- debounce = 0xff;
- else
- debounce = (debounce / 0x1f) - 1;
+ if (enable) {
+ debounce = DIV_ROUND_UP(debounce, 31) - 1;
+ debounce &= OMAP4_GPIO_DEBOUNCINGTIME_MASK;
+ }
l = BIT(offset);
@@ -233,7 +234,7 @@ static void omap2_set_gpio_debounce(struct gpio_bank *bank, unsigned offset,
reg = bank->base + bank->regs->debounce_en;
val = readl_relaxed(reg);
- if (debounce)
+ if (enable)
val |= l;
else
val &= ~l;
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2015-08-26 09:50 +0200 |
| Subject | Re: [PATCH 3/7] gpio: omap: fix omap2_set_gpio_debounce |
| Message-ID | <q1DD4-7K7-21@gated-at.bofh.it> |
| In reply to | #1209197 |
On Tue, Aug 18, 2015 at 1:10 PM, Grygorii Strashko <grygorii.strashko@ti.com> wrote: > According to TRMs: > > Required input line stable = > (the value of the GPIO_DEBOUNCINGTIME[7:0].DEBOUNCETIME + 1) × 31, > where the value of the GPIO_DEBOUNCINGTIME[7:0].DEBOUNCETIME bit field > is from 0 to 255. > > But now omap2_set_gpio_debounce() will calculate debounce time and > behave incorrectly in the following cases: > 1) requested debounce time is !0 and <32 > calculated DEBOUNCETIME = 0x1 == 62 us; > expected value of DEBOUNCETIME = 0x0 == 31us > 2) requested debounce time is 0 > calculated DEBOUNCETIME = 0x1 == 62 us; > expected: disable debounce and DEBOUNCETIME = 0x0 > 3) requested debounce time is >32 and <63 > calculated DEBOUNCETIME = 0x0 and debounce will be disabled; > expected: enable debounce and DEBOUNCETIME = 0x1 == 62 us > > Hence, rework omap2_set_gpio_debounce() to fix above cases: > 1) introduce local variable "enable" and use it to identify > when debounce need to be enabled or disabled. Disable debounce > if requested debounce time is 0. > 2) use below formula for debounce time calculation: > debounce = (DIV_ROUND_UP(debounce, 31) - 1) & 0xFF; > > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Very hightech. Patch applied. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | santosh shilimkar <santosh.shilimkar@oracle.com> |
|---|---|
| Date | 2015-08-18 18:20 +0200 |
| Message-ID | <pYRMe-2Xf-33@gated-at.bofh.it> |
| In reply to | #1209195 |
On 8/18/2015 4:10 AM, Grygorii Strashko wrote: > Hi, > > This patch series contains set of trivial fixes and improvements, and also > patches which fixes wrong APIs usage in atomic context as for -RT as for > non-RT kernel. The final goal of this series is to make TI OMAP GPIO > driver compatible with -RT kernel as much as possible. > > Patch 1-4: trivial fixes and improvements > Patch 5: fixes wrong CLK clk_prepare/unprepare APIs usage in atomic contexet > Patch 6(rfc): required to be compatible with -RT kernel, because PM runtime > can't be used in atimic context on -RT. > Patch 7(rfc): This patch converts TI OMAP GPIO driver to use generic irq > handler instead of chained IRQ handler. This way OMAP GPIO driver will be > compatible with RT kernel where it will be forced thread IRQ handler > while in non-RT kernel it still will be executed in HW IRQ context. > > Based on > git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git > branch: devel > commit: 929550b gpio: mxc: fix section mismatch warning > > Boot, basic gpio functionality tested on: > dra7-evm, BeagleBone(white), am43xx-gpevm, am437x-sk > Manually tested on dra7-evm including suspend/resume and wakeup. > > Grygorii Strashko (7): > gpio: omap: remove wrong irq_domain_remove usage in probe > gpio: omap: switch to use platform_get_irq > gpio: omap: fix omap2_set_gpio_debounce > gpio: omap: protect regs access in omap_gpio_irq_handler > gpio: omap: fix clk_prepare/unprepare usage > gpio: omap: move pm runtime in irq_chip.irq_bus_lock/sync_unlock > gpio: omap: convert to use generic irq handler > > drivers/gpio/gpio-omap.c | 146 +++++++++++++++++++++++++++-------------------- > 1 file changed, 85 insertions(+), 61 deletions(-) > Patch 1 to 5 looks fine to me. You can have that one as a series. Am not convinced about 6 and 7. Will look at it again in detail. For 1 to 5, Acked-by: Santosh Shilimkar <ssantosh@kernel.org> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Tony Lindgren <tony@atomide.com> |
|---|---|
| Date | 2015-08-19 08:40 +0200 |
| Message-ID | <pZ5ct-6jp-7@gated-at.bofh.it> |
| In reply to | #1209195 |
Hi, * Grygorii Strashko <grygorii.strashko@ti.com> [150818 04:14]: > Hi, > > This patch series contains set of trivial fixes and improvements, and also > patches which fixes wrong APIs usage in atomic context as for -RT as for > non-RT kernel. The final goal of this series is to make TI OMAP GPIO > driver compatible with -RT kernel as much as possible. > > Patch 1-4: trivial fixes and improvements > Patch 5: fixes wrong CLK clk_prepare/unprepare APIs usage in atomic contexet > Patch 6(rfc): required to be compatible with -RT kernel, because PM runtime > can't be used in atimic context on -RT. > Patch 7(rfc): This patch converts TI OMAP GPIO driver to use generic irq > handler instead of chained IRQ handler. This way OMAP GPIO driver will be > compatible with RT kernel where it will be forced thread IRQ handler > while in non-RT kernel it still will be executed in HW IRQ context. Based on quick testing this series breaks at least core off idle for omap3. You probably should add a beagle xm to your test devices so you can properly test PM features. Regards, Tony -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Tony Lindgren <tony@atomide.com> |
|---|---|
| Date | 2015-08-21 10:20 +0200 |
| Message-ID | <pZPIn-6nQ-29@gated-at.bofh.it> |
| In reply to | #1209655 |
* Tony Lindgren <tony@atomide.com> [150818 23:42]: > Hi, > > * Grygorii Strashko <grygorii.strashko@ti.com> [150818 04:14]: > > Hi, > > > > This patch series contains set of trivial fixes and improvements, and also > > patches which fixes wrong APIs usage in atomic context as for -RT as for > > non-RT kernel. The final goal of this series is to make TI OMAP GPIO > > driver compatible with -RT kernel as much as possible. > > > > Patch 1-4: trivial fixes and improvements > > Patch 5: fixes wrong CLK clk_prepare/unprepare APIs usage in atomic contexet > > Patch 6(rfc): required to be compatible with -RT kernel, because PM runtime > > can't be used in atimic context on -RT. > > Patch 7(rfc): This patch converts TI OMAP GPIO driver to use generic irq > > handler instead of chained IRQ handler. This way OMAP GPIO driver will be > > compatible with RT kernel where it will be forced thread IRQ handler > > while in non-RT kernel it still will be executed in HW IRQ context. > > Based on quick testing this series breaks at least core off idle for omap3. > You probably should add a beagle xm to your test devices so you can > properly test PM features. Sorry I take that back, after trying to figure out which patch breaks PM I noticed I had some other patches applied also. Looks like PM works just fine with this series for me, so please feel free to add: Tested-by: Tony Lindgren <tony@atomide.com> Note that I have not been able to test this with gpio button as my boards are in a rack. You may want to do some gpio button tests to make sure things wake up properly from off idle if you can get hold of a beagle xm. I posted some instructions how to test earlier today for Kishon in the "[PATCH v2 00/16] omap_hsmmc: regulator usage cleanup and fixes" thread. Regards, Tony -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Grygorii Strashko <grygorii.strashko@ti.com> |
|---|---|
| Date | 2015-08-25 13:50 +0200 |
| Message-ID | <q1kTM-5od-17@gated-at.bofh.it> |
| In reply to | #1211002 |
On 08/21/2015 11:13 AM, Tony Lindgren wrote: > * Tony Lindgren <tony@atomide.com> [150818 23:42]: >> Hi, >> >> * Grygorii Strashko <grygorii.strashko@ti.com> [150818 04:14]: >>> Hi, >>> >>> This patch series contains set of trivial fixes and improvements, and also >>> patches which fixes wrong APIs usage in atomic context as for -RT as for >>> non-RT kernel. The final goal of this series is to make TI OMAP GPIO >>> driver compatible with -RT kernel as much as possible. >>> >>> Patch 1-4: trivial fixes and improvements >>> Patch 5: fixes wrong CLK clk_prepare/unprepare APIs usage in atomic contexet >>> Patch 6(rfc): required to be compatible with -RT kernel, because PM runtime >>> can't be used in atimic context on -RT. >>> Patch 7(rfc): This patch converts TI OMAP GPIO driver to use generic irq >>> handler instead of chained IRQ handler. This way OMAP GPIO driver will be >>> compatible with RT kernel where it will be forced thread IRQ handler >>> while in non-RT kernel it still will be executed in HW IRQ context. >> >> Based on quick testing this series breaks at least core off idle for omap3. >> You probably should add a beagle xm to your test devices so you can >> properly test PM features. > > Sorry I take that back, after trying to figure out which patch breaks PM > I noticed I had some other patches applied also. Looks like PM works just > fine with this series for me, so please feel free to add: > Uh... :) Thanks Tony a lot and sorry for delayed reply (was ooo). You've restored my heartbeat :) > Tested-by: Tony Lindgren <tony@atomide.com> > > Note that I have not been able to test this with gpio button as my > boards are in a rack. You may want to do some gpio button tests to > make sure things wake up properly from off idle if you can get hold > of a beagle xm. I posted some instructions how to test earlier today > for Kishon in the "[PATCH v2 00/16] omap_hsmmc: regulator usage > cleanup and fixes" thread. I've tested it actually using GPIO buttons and UART console wake-up (Results - https://lkml.org/lkml/2015/8/14/194 :) And I'd try to retest it on beagle xm also, but not sure if i'd be able to test button's wake-up - have shared access only now to beagle xm which is rack also. -- regards, -grygorii -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Tony Lindgren <tony@atomide.com> |
|---|---|
| Date | 2015-08-26 18:10 +0200 |
| Message-ID | <q1LqY-2d7-93@gated-at.bofh.it> |
| In reply to | #1212987 |
* Grygorii Strashko <grygorii.strashko@ti.com> [150825 04:44]: > On 08/21/2015 11:13 AM, Tony Lindgren wrote: > > * Tony Lindgren <tony@atomide.com> [150818 23:42]: > >> Hi, > >> > >> * Grygorii Strashko <grygorii.strashko@ti.com> [150818 04:14]: > >>> Hi, > >>> > >>> This patch series contains set of trivial fixes and improvements, and also > >>> patches which fixes wrong APIs usage in atomic context as for -RT as for > >>> non-RT kernel. The final goal of this series is to make TI OMAP GPIO > >>> driver compatible with -RT kernel as much as possible. > >>> > >>> Patch 1-4: trivial fixes and improvements > >>> Patch 5: fixes wrong CLK clk_prepare/unprepare APIs usage in atomic contexet > >>> Patch 6(rfc): required to be compatible with -RT kernel, because PM runtime > >>> can't be used in atimic context on -RT. > >>> Patch 7(rfc): This patch converts TI OMAP GPIO driver to use generic irq > >>> handler instead of chained IRQ handler. This way OMAP GPIO driver will be > >>> compatible with RT kernel where it will be forced thread IRQ handler > >>> while in non-RT kernel it still will be executed in HW IRQ context. > >> > >> Based on quick testing this series breaks at least core off idle for omap3. > >> You probably should add a beagle xm to your test devices so you can > >> properly test PM features. > > > > Sorry I take that back, after trying to figure out which patch breaks PM > > I noticed I had some other patches applied also. Looks like PM works just > > fine with this series for me, so please feel free to add: > > > > Uh... :) Thanks Tony a lot and sorry for delayed reply (was ooo). > You've restored my heartbeat :) > > > Tested-by: Tony Lindgren <tony@atomide.com> > > > > Note that I have not been able to test this with gpio button as my > > boards are in a rack. You may want to do some gpio button tests to > > make sure things wake up properly from off idle if you can get hold > > of a beagle xm. I posted some instructions how to test earlier today > > for Kishon in the "[PATCH v2 00/16] omap_hsmmc: regulator usage > > cleanup and fixes" thread. > > > I've tested it actually using GPIO buttons and UART console wake-up > (Results - https://lkml.org/lkml/2015/8/14/194 :) OK great good to hear :) > And I'd try to retest it on beagle xm also, but not sure if i'd be able > to test button's wake-up - have shared access only now to beagle xm > which is rack also. OK. FYI, we're still missing a clean solution to omap3 errata 1.158 that requires remuxing GPIO pins to safe mode with pull for off idle to avoid glitches: http://www.spinics.net/lists/linux-omap/msg11669.html Regards, Tony -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2015-08-26 10:00 +0200 |
| Message-ID | <q1DMK-7Vl-19@gated-at.bofh.it> |
| In reply to | #1209195 |
On Tue, Aug 18, 2015 at 1:10 PM, Grygorii Strashko <grygorii.strashko@ti.com> wrote: > This patch series contains set of trivial fixes and improvements, and also > patches which fixes wrong APIs usage in atomic context as for -RT as for > non-RT kernel. The final goal of this series is to make TI OMAP GPIO > driver compatible with -RT kernel as much as possible. > > Patch 1-4: trivial fixes and improvements > Patch 5: fixes wrong CLK clk_prepare/unprepare APIs usage in atomic contexet I've applied patches 1-5 with Santosh's ACK and Tony's Tested-by. > Patch 6(rfc): required to be compatible with -RT kernel, because PM runtime > can't be used in atimic context on -RT. > Patch 7(rfc): This patch converts TI OMAP GPIO driver to use generic irq > handler instead of chained IRQ handler. This way OMAP GPIO driver will be > compatible with RT kernel where it will be forced thread IRQ handler > while in non-RT kernel it still will be executed in HW IRQ context. Waiting for more feedback here. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web