]>
Commit | Line | Data |
---|---|---|
93a9f3cd GKH |
1 | From 5fedbb923936174ab4d1d5cc92bca1cf6b2e0ca2 Mon Sep 17 00:00:00 2001 |
2 | From: Yingjoe Chen <yingjoe.chen@mediatek.com> | |
3 | Date: Sat, 2 Apr 2016 14:57:49 +0800 | |
4 | Subject: pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce | |
5 | ||
6 | From: Yingjoe Chen <yingjoe.chen@mediatek.com> | |
7 | ||
8 | commit 5fedbb923936174ab4d1d5cc92bca1cf6b2e0ca2 upstream. | |
9 | ||
10 | The debounce time unit for gpio_chip.set_debounce is us but | |
11 | mtk_gpio_set_debounce regard it as ms. | |
12 | Fix this by correct debounce time array dbnc_arr so it can find correct | |
13 | debounce setting. Debounce time for first debounce setting is 500us, | |
14 | correct this as well. | |
15 | ||
16 | While I'm at it, also change the debounce time array name to | |
17 | "debounce_time" for readability. | |
18 | ||
19 | Signed-off-by: Yingjoe Chen <yingjoe.chen@mediatek.com> | |
20 | Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> | |
21 | Acked-by: Hongzhou Yang <hongzhou.yang@mediatek.com> | |
22 | Signed-off-by: Linus Walleij <linus.walleij@linaro.org> | |
23 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
24 | ||
25 | --- | |
26 | drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 9 +++++---- | |
27 | 1 file changed, 5 insertions(+), 4 deletions(-) | |
28 | ||
29 | --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c | |
30 | +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c | |
31 | @@ -939,7 +939,8 @@ static int mtk_gpio_set_debounce(struct | |
32 | struct mtk_pinctrl *pctl = dev_get_drvdata(chip->dev); | |
33 | int eint_num, virq, eint_offset; | |
34 | unsigned int set_offset, bit, clr_bit, clr_offset, rst, i, unmask, dbnc; | |
35 | - static const unsigned int dbnc_arr[] = {0 , 1, 16, 32, 64, 128, 256}; | |
36 | + static const unsigned int debounce_time[] = {500, 1000, 16000, 32000, 64000, | |
37 | + 128000, 256000}; | |
38 | const struct mtk_desc_pin *pin; | |
39 | struct irq_data *d; | |
40 | ||
41 | @@ -957,9 +958,9 @@ static int mtk_gpio_set_debounce(struct | |
42 | if (!mtk_eint_can_en_debounce(pctl, eint_num)) | |
43 | return -ENOSYS; | |
44 | ||
45 | - dbnc = ARRAY_SIZE(dbnc_arr); | |
46 | - for (i = 0; i < ARRAY_SIZE(dbnc_arr); i++) { | |
47 | - if (debounce <= dbnc_arr[i]) { | |
48 | + dbnc = ARRAY_SIZE(debounce_time); | |
49 | + for (i = 0; i < ARRAY_SIZE(debounce_time); i++) { | |
50 | + if (debounce <= debounce_time[i]) { | |
51 | dbnc = i; | |
52 | break; | |
53 | } |