aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/mediatek
diff options
context:
space:
mode:
authorYingjoe Chen <yingjoe.chen@mediatek.com>2016-04-02 02:57:49 -0400
committerLinus Walleij <linus.walleij@linaro.org>2016-04-15 04:28:04 -0400
commit5fedbb923936174ab4d1d5cc92bca1cf6b2e0ca2 (patch)
tree166343c1925b02eff84fc5365052750e37145512 /drivers/pinctrl/mediatek
parent6dd22a116614acf33aeef13861e32510ef9d5392 (diff)
pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce
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. Cc: stable@vger.kernel.org Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/mediatek')
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-mtk-common.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 2bbe6f7964a7..6ab8c3ccdeea 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,
1004 struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent); 1004 struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent);
1005 int eint_num, virq, eint_offset; 1005 int eint_num, virq, eint_offset;
1006 unsigned int set_offset, bit, clr_bit, clr_offset, rst, i, unmask, dbnc; 1006 unsigned int set_offset, bit, clr_bit, clr_offset, rst, i, unmask, dbnc;
1007 static const unsigned int dbnc_arr[] = {0 , 1, 16, 32, 64, 128, 256}; 1007 static const unsigned int debounce_time[] = {500, 1000, 16000, 32000, 64000,
1008 128000, 256000};
1008 const struct mtk_desc_pin *pin; 1009 const struct mtk_desc_pin *pin;
1009 struct irq_data *d; 1010 struct irq_data *d;
1010 1011
@@ -1022,9 +1023,9 @@ static int mtk_gpio_set_debounce(struct gpio_chip *chip, unsigned offset,
1022 if (!mtk_eint_can_en_debounce(pctl, eint_num)) 1023 if (!mtk_eint_can_en_debounce(pctl, eint_num))
1023 return -ENOSYS; 1024 return -ENOSYS;
1024 1025
1025 dbnc = ARRAY_SIZE(dbnc_arr); 1026 dbnc = ARRAY_SIZE(debounce_time);
1026 for (i = 0; i < ARRAY_SIZE(dbnc_arr); i++) { 1027 for (i = 0; i < ARRAY_SIZE(debounce_time); i++) {
1027 if (debounce <= dbnc_arr[i]) { 1028 if (debounce <= debounce_time[i]) {
1028 dbnc = i; 1029 dbnc = i;
1029 break; 1030 break;
1030 } 1031 }