Commit 471637a5 authored by Antonio Ospite's avatar Antonio Ospite Committed by Dmitry Torokhov

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: default avatarAntonio Ospite <ao2@openezx.org>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 57f5b159
...@@ -136,6 +136,9 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) ...@@ -136,6 +136,9 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
set_bit(code, input_dev->keybit); set_bit(code, input_dev->keybit);
} }
for (i = 0; i < pdata->direct_key_num; i++)
set_bit(pdata->direct_key_map[i], input_dev->keybit);
keypad->rotary_up_key[0] = pdata->rotary0_up_key; keypad->rotary_up_key[0] = pdata->rotary0_up_key;
keypad->rotary_up_key[1] = pdata->rotary1_up_key; keypad->rotary_up_key[1] = pdata->rotary1_up_key;
keypad->rotary_down_key[0] = pdata->rotary0_down_key; keypad->rotary_down_key[0] = pdata->rotary0_down_key;
...@@ -143,17 +146,21 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad) ...@@ -143,17 +146,21 @@ static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
keypad->rotary_rel_code[0] = pdata->rotary0_rel_code; keypad->rotary_rel_code[0] = pdata->rotary0_rel_code;
keypad->rotary_rel_code[1] = pdata->rotary1_rel_code; keypad->rotary_rel_code[1] = pdata->rotary1_rel_code;
if (pdata->enable_rotary0) {
if (pdata->rotary0_up_key && pdata->rotary0_down_key) { if (pdata->rotary0_up_key && pdata->rotary0_down_key) {
set_bit(pdata->rotary0_up_key, input_dev->keybit); set_bit(pdata->rotary0_up_key, input_dev->keybit);
set_bit(pdata->rotary0_down_key, input_dev->keybit); set_bit(pdata->rotary0_down_key, input_dev->keybit);
} else } else
set_bit(pdata->rotary0_rel_code, input_dev->relbit); set_bit(pdata->rotary0_rel_code, input_dev->relbit);
}
if (pdata->enable_rotary1) {
if (pdata->rotary1_up_key && pdata->rotary1_down_key) { if (pdata->rotary1_up_key && pdata->rotary1_down_key) {
set_bit(pdata->rotary1_up_key, input_dev->keybit); set_bit(pdata->rotary1_up_key, input_dev->keybit);
set_bit(pdata->rotary1_down_key, input_dev->keybit); set_bit(pdata->rotary1_down_key, input_dev->keybit);
} else } else
set_bit(pdata->rotary1_rel_code, input_dev->relbit); set_bit(pdata->rotary1_rel_code, input_dev->relbit);
}
} }
static inline unsigned int lookup_matrix_keycode( static inline unsigned int lookup_matrix_keycode(
...@@ -484,8 +491,13 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev) ...@@ -484,8 +491,13 @@ static int __devinit pxa27x_keypad_probe(struct platform_device *pdev)
keypad->input_dev = input_dev; keypad->input_dev = input_dev;
input_set_drvdata(input_dev, keypad); input_set_drvdata(input_dev, keypad);
input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
BIT_MASK(EV_REL); if ((keypad->pdata->enable_rotary0 &&
keypad->pdata->rotary0_rel_code) ||
(keypad->pdata->enable_rotary1 &&
keypad->pdata->rotary1_rel_code)) {
input_dev->evbit[0] |= BIT_MASK(EV_REL);
}
pxa27x_keypad_build_keycode(keypad); pxa27x_keypad_build_keycode(keypad);
platform_set_drvdata(pdev, keypad); platform_set_drvdata(pdev, keypad);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment