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-19 08:40 +0200 |
| Articles | 4 — 3 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 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
| 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 | 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] | [standalone]
Back to top | Article view | linux.kernel
csiph-web