* [PATCH v2] pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce
@ 2016-04-02 6:57 Yingjoe Chen
2016-04-08 11:01 ` Daniel Kurtz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yingjoe Chen @ 2016-04-02 6:57 UTC (permalink / raw)
To: Linus Walleij
Cc: Matthias Brugger, Hongzhou Yang, linux-gpio, linux-arm-kernel,
linux-mediatek, linux-kernel, srv_heupstream, djkurtz,
Yingjoe Chen
The debounce time unit for gpio_chip.set_debounce is us but
mtk_gpio_set_debounce regard it as ms.
Fix this by correct debounce time array dbnc_arr so it can find correct
debounce setting. Debounce time for first debounce setting is 500us,
correct this as well.
While I'm at it, also change the debounce time array name to
"debounce_time" for readability.
Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
---
This was based on v4.6-rc1
Change since v1:
- Improve commit message.
- Change dbnc_arr name to debounce_time
---
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 2bbe6f7..6ab8c3c 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1004,7 +1004,8 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent);
int eint_num, virq, eint_offset;
unsigned int set_offset, bit, clr_bit, clr_offset, rst, i, unmask, dbnc;
- static const unsigned int dbnc_arr[] = {0 , 1, 16, 32, 64, 128, 256};
+ static const unsigned int debounce_time[] = {500, 1000, 16000, 32000, 64000,
+ 128000, 256000};
const struct mtk_desc_pin *pin;
struct irq_data *d;
@@ -1022,9 +1023,9 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
if (!mtk_eint_can_en_debounce(pctl, eint_num))
return -ENOSYS;
- dbnc = ARRAY_SIZE(dbnc_arr);
- for (i = 0; i < ARRAY_SIZE(dbnc_arr); i++) {
- if (debounce <= dbnc_arr[i]) {
+ dbnc = ARRAY_SIZE(debounce_time);
+ for (i = 0; i < ARRAY_SIZE(debounce_time); i++) {
+ if (debounce <= debounce_time[i]) {
dbnc = i;
break;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce
2016-04-02 6:57 [PATCH v2] pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce Yingjoe Chen
@ 2016-04-08 11:01 ` Daniel Kurtz
[not found] ` <1459580269-64531-1-git-send-email-yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-04-15 8:29 ` Linus Walleij
2 siblings, 0 replies; 4+ messages in thread
From: Daniel Kurtz @ 2016-04-08 11:01 UTC (permalink / raw)
To: Yingjoe Chen
Cc: Linus Walleij, Matthias Brugger, Hongzhou Yang,
open list:PIN CONTROL SUBSYSTEM,
linux-arm-kernel@lists.infradead.org,
moderated list:ARM/Mediatek SoC support,
linux-kernel@vger.kernel.org, srv_heupstream
On Sat, Apr 2, 2016 at 2:57 PM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> The debounce time unit for gpio_chip.set_debounce is us but
> mtk_gpio_set_debounce regard it as ms.
> Fix this by correct debounce time array dbnc_arr so it can find correct
> debounce setting. Debounce time for first debounce setting is 500us,
> correct this as well.
>
> While I'm at it, also change the debounce time array name to
> "debounce_time" for readability.
>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
> ---
> This was based on v4.6-rc1
> Change since v1:
> - Improve commit message.
> - Change dbnc_arr name to debounce_time
> ---
> drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 2bbe6f7..6ab8c3c 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1004,7 +1004,8 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
> struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent);
> int eint_num, virq, eint_offset;
> unsigned int set_offset, bit, clr_bit, clr_offset, rst, i, unmask, dbnc;
> - static const unsigned int dbnc_arr[] = {0 , 1, 16, 32, 64, 128, 256};
> + static const unsigned int debounce_time[] = {500, 1000, 16000, 32000, 64000,
> + 128000, 256000};
> const struct mtk_desc_pin *pin;
> struct irq_data *d;
>
> @@ -1022,9 +1023,9 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
> if (!mtk_eint_can_en_debounce(pctl, eint_num))
> return -ENOSYS;
>
> - dbnc = ARRAY_SIZE(dbnc_arr);
> - for (i = 0; i < ARRAY_SIZE(dbnc_arr); i++) {
> - if (debounce <= dbnc_arr[i]) {
> + dbnc = ARRAY_SIZE(debounce_time);
> + for (i = 0; i < ARRAY_SIZE(debounce_time); i++) {
> + if (debounce <= debounce_time[i]) {
> dbnc = i;
> break;
> }
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce
[not found] ` <1459580269-64531-1-git-send-email-yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
@ 2016-04-13 17:30 ` Hongzhou Yang
0 siblings, 0 replies; 4+ messages in thread
From: Hongzhou Yang @ 2016-04-13 17:30 UTC (permalink / raw)
To: Yingjoe Chen
Cc: srv_heupstream-NuS5LvNUpcJWk0Htik3J/w, Linus Walleij,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-gpio-u79uwXL29TY76Z2rM5mHXA,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Matthias Brugger,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Sat, 2016-04-02 at 14:57 +0800, Yingjoe Chen wrote:
> The debounce time unit for gpio_chip.set_debounce is us but
> mtk_gpio_set_debounce regard it as ms.
> Fix this by correct debounce time array dbnc_arr so it can find correct
> debounce setting. Debounce time for first debounce setting is 500us,
> correct this as well.
>
> While I'm at it, also change the debounce time array name to
> "debounce_time" for readability.
>
> Signed-off-by: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Acked-by: Hongzhou Yang <hongzhou.yang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> ---
> This was based on v4.6-rc1
> Change since v1:
> - Improve commit message.
> - Change dbnc_arr name to debounce_time
> ---
> drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 2bbe6f7..6ab8c3c 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1004,7 +1004,8 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
> struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent);
> int eint_num, virq, eint_offset;
> unsigned int set_offset, bit, clr_bit, clr_offset, rst, i, unmask, dbnc;
> - static const unsigned int dbnc_arr[] = {0 , 1, 16, 32, 64, 128, 256};
> + static const unsigned int debounce_time[] = {500, 1000, 16000, 32000, 64000,
> + 128000, 256000};
> const struct mtk_desc_pin *pin;
> struct irq_data *d;
>
> @@ -1022,9 +1023,9 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
> if (!mtk_eint_can_en_debounce(pctl, eint_num))
> return -ENOSYS;
>
> - dbnc = ARRAY_SIZE(dbnc_arr);
> - for (i = 0; i < ARRAY_SIZE(dbnc_arr); i++) {
> - if (debounce <= dbnc_arr[i]) {
> + dbnc = ARRAY_SIZE(debounce_time);
> + for (i = 0; i < ARRAY_SIZE(debounce_time); i++) {
> + if (debounce <= debounce_time[i]) {
> dbnc = i;
> break;
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce
2016-04-02 6:57 [PATCH v2] pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce Yingjoe Chen
2016-04-08 11:01 ` Daniel Kurtz
[not found] ` <1459580269-64531-1-git-send-email-yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
@ 2016-04-15 8:29 ` Linus Walleij
2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2016-04-15 8:29 UTC (permalink / raw)
To: Yingjoe Chen
Cc: Matthias Brugger, Hongzhou Yang, linux-gpio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
moderated list:ARM/Mediatek SoC support,
linux-kernel@vger.kernel.org, srv_heupstream, Daniel Kurtz
On Sat, Apr 2, 2016 at 8:57 AM, Yingjoe Chen <yingjoe.chen@mediatek.com> wrote:
> The debounce time unit for gpio_chip.set_debounce is us but
> mtk_gpio_set_debounce regard it as ms.
> Fix this by correct debounce time array dbnc_arr so it can find correct
> debounce setting. Debounce time for first debounce setting is 500us,
> correct this as well.
>
> While I'm at it, also change the debounce time array name to
> "debounce_time" for readability.
>
> Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com>
> ---
> This was based on v4.6-rc1
> Change since v1:
> - Improve commit message.
> - Change dbnc_arr name to debounce_time
Patch applied to fixes and tagged for stable.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-04-15 8:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-02 6:57 [PATCH v2] pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce Yingjoe Chen
2016-04-08 11:01 ` Daniel Kurtz
[not found] ` <1459580269-64531-1-git-send-email-yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2016-04-13 17:30 ` Hongzhou Yang
2016-04-15 8:29 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox