diff options
author | Antonio Ospite <ospite@studenti.unina.it> | 2008-05-28 14:35:52 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-05-28 14:35:52 -0400 |
commit | 471637a575329f9250e7e4099e84084820a35e11 (patch) | |
tree | 4f7e469b133cdaa901c0a13e9a9e4a1f3aa97689 /drivers/input | |
parent | 57f5b1590f2d801a3a7f072e2c65f14d4545852c (diff) |
Input: pxa27x_keypad - miscellaneous fixes
1. Set input bits for direct keys codes
2. Set input bits for rotary encoder codes only if rotary
encoder is enabled
3. Enable EV_REL only if rotary encoder is enabled and rel_codes
are set up
Signed-off-by: Antonio Ospite <ao2@openezx.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/pxa27x_keypad.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 3dea0c5077a9..45767e73f071 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -136,6 +136,9 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) | |||
136 | set_bit(code, input_dev->keybit); | 136 | set_bit(code, input_dev->keybit); |
137 | } | 137 | } |
138 | 138 | ||
139 | for (i = 0; i < pdata->direct_key_num; i++) | ||
140 | set_bit(pdata->direct_key_map[i], input_dev->keybit); | ||
141 | |||
139 | keypad->rotary_up_key[0] = pdata->rotary0_up_key; | 142 | keypad->rotary_up_key[0] = pdata->rotary0_up_key; |
140 | keypad->rotary_up_key[1] = pdata->rotary1_up_key; | 143 | keypad->rotary_up_key[1] = pdata->rotary1_up_key; |
141 | keypad->rotary_down_key[0] = pdata->rotary0_down_key; | 144 | keypad->rotary_down_key[0] = pdata->rotary0_down_key; |
@@ -143,17 +146,21 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) | |||
143 | keypad->rotary_rel_code[0] = pdata->rotary0_rel_code; | 146 | keypad->rotary_rel_code[0] = pdata->rotary0_rel_code; |
144 | keypad->rotary_rel_code[1] = pdata->rotary1_rel_code; | 147 | keypad->rotary_rel_code[1] = pdata->rotary1_rel_code; |
145 | 148 | ||
146 | if (pdata->rotary0_up_key && pdata->rotary0_down_key) { | 149 | if (pdata->enable_rotary0) { |
147 | set_bit(pdata->rotary0_up_key, input_dev->keybit); | 150 | if (pdata->rotary0_up_key && pdata->rotary0_down_key) { |
148 | set_bit(pdata->rotary0_down_key, input_dev->keybit); | 151 | set_bit(pdata->rotary0_up_key, input_dev->keybit); |
149 | } else | 152 | set_bit(pdata->rotary0_down_key, input_dev->keybit); |
150 | set_bit(pdata->rotary0_rel_code, input_dev->relbit); | 153 | } else |
151 | 154 | set_bit(pdata->rotary0_rel_code, input_dev->relbit); | |
152 | if (pdata->rotary1_up_key && pdata->rotary1_down_key) { | 155 | } |
153 | set_bit(pdata->rotary1_up_key, input_dev->keybit); | 156 | |
154 | set_bit(pdata->rotary1_down_key, input_dev->keybit); | 157 | if (pdata->enable_rotary1) { |
155 | } else | 158 | if (pdata->rotary1_up_key && pdata->rotary1_down_key) { |
156 | set_bit(pdata->rotary1_rel_code, input_dev->relbit); | 159 | set_bit(pdata->rotary1_up_key, input_dev->keybit); |
160 | set_bit(pdata->rotary1_down_key, input_dev->keybit); | ||
161 | } else | ||
162 | set_bit(pdata->rotary1_rel_code, input_dev->relbit); | ||
163 | } | ||
157 | } | 164 | } |
158 | 165 | ||
159 | static inline unsigned int lookup_matrix_keycode( | 166 | static inline unsigned int lookup_matrix_keycode( |
@@ -484,8 +491,13 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev) | |||
484 | keypad->input_dev = input_dev; | 491 | keypad->input_dev = input_dev; |
485 | input_set_drvdata(input_dev, keypad); | 492 | input_set_drvdata(input_dev, keypad); |
486 | 493 | ||
487 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | | 494 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); |
488 | BIT_MASK(EV_REL); | 495 | if ((keypad->pdata->enable_rotary0 && |
496 | keypad->pdata->rotary0_rel_code) || | ||
497 | (keypad->pdata->enable_rotary1 && | ||
498 | keypad->pdata->rotary1_rel_code)) { | ||
499 | input_dev->evbit[0] |= BIT_MASK(EV_REL); | ||
500 | } | ||
489 | 501 | ||
490 | pxa27x_keypad_build_keycode(keypad); | 502 | pxa27x_keypad_build_keycode(keypad); |
491 | platform_set_drvdata(pdev, keypad); | 503 | platform_set_drvdata(pdev, keypad); |