Commit 6b2791e9 authored by Kevin Hilman's avatar Kevin Hilman

Revert "dm355evm_keys review updates"

This reverts commit 8f7c6b8d.
parent edcc566e
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
* using a work_struct. The IRQ is active low, but we use it through * using a work_struct. The IRQ is active low, but we use it through
* the GPIO controller so we can trigger on falling edges. * the GPIO controller so we can trigger on falling edges.
* *
* Note that physically there can only be one of these devices.
*
* This driver was tested with firmware revision A4. * This driver was tested with firmware revision A4.
*/ */
struct dm355evm_keys { struct dm355evm_keys {
...@@ -122,8 +120,6 @@ static void dm355evm_keys_work(struct work_struct *work) ...@@ -122,8 +120,6 @@ static void dm355evm_keys_work(struct work_struct *work)
* Reading INPUT_LOW decrements the count. * Reading INPUT_LOW decrements the count.
*/ */
for (;;) { for (;;) {
static u16 last_event;
u16 event; u16 event;
int keycode; int keycode;
int i; int i;
...@@ -146,23 +142,6 @@ static void dm355evm_keys_work(struct work_struct *work) ...@@ -146,23 +142,6 @@ static void dm355evm_keys_work(struct work_struct *work)
if (event == 0xdead) if (event == 0xdead)
break; break;
/* Press and release a button: two events, same code.
* Press and hold (autorepeat), then release: N events
* (N > 2), same code. For RC5 buttons the toggle bits
* distinguish (for example) "1-autorepeat" from "1 1";
* but PCB buttons don't support that bit.
*
* So we must synthesize release events. We do that by
* mapping events to a press/release event pair; then
* to avoid adding extra events, skip the second event
* of each pair.
*/
if (event == last_event) {
last_event = 0;
continue;
}
last_event = event;
/* ignore the RC5 toggle bit */ /* ignore the RC5 toggle bit */
event &= ~0x0800; event &= ~0x0800;
...@@ -178,38 +157,28 @@ static void dm355evm_keys_work(struct work_struct *work) ...@@ -178,38 +157,28 @@ static void dm355evm_keys_work(struct work_struct *work)
"input event 0x%04x--> keycode %d\n", "input event 0x%04x--> keycode %d\n",
event, keycode); event, keycode);
/* report press + release */ /* Report press + release ... we can't tell if
* this is an autorepeat, and we need to guess
* about the release.
*/
input_report_key(keys->input, keycode, 1); input_report_key(keys->input, keycode, 1);
input_sync(keys->input);
input_report_key(keys->input, keycode, 0); input_report_key(keys->input, keycode, 0);
input_sync(keys->input);
} }
input_sync(keys->input);
} }
static int dm355evm_setkeycode(struct input_dev *dev, int index, int keycode) static int dm355evm_setkeycode(struct input_dev *dev, int index, int keycode)
{ {
u16 old_keycode; if (index >= ARRAY_SIZE(dm355evm_keys))
unsigned i;
if (((unsigned)index) >= ARRAY_SIZE(dm355evm_keys))
return -EINVAL; return -EINVAL;
old_keycode = dm355evm_keys[index].keycode;
dm355evm_keys[index].keycode = keycode; dm355evm_keys[index].keycode = keycode;
set_bit(keycode, dev->keybit);
for (i = 0; i < ARRAY_SIZE(dm355evm_keys); i++) {
if (dm355evm_keys[index].keycode == old_keycode)
goto done;
}
clear_bit(old_keycode, dev->keybit);
done:
return 0; return 0;
} }
static int dm355evm_getkeycode(struct input_dev *dev, int index, int *keycode) static int dm355evm_getkeycode(struct input_dev *dev, int index, int *keycode)
{ {
if (((unsigned)index) >= ARRAY_SIZE(dm355evm_keys)) if (index >= ARRAY_SIZE(dm355evm_keys))
return -EINVAL; return -EINVAL;
return dm355evm_keys[index].keycode; return dm355evm_keys[index].keycode;
...@@ -250,6 +219,8 @@ static int __devinit dm355evm_keys_probe(struct platform_device *pdev) ...@@ -250,6 +219,8 @@ static int __devinit dm355evm_keys_probe(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(dm355evm_keys); i++) for (i = 0; i < ARRAY_SIZE(dm355evm_keys); i++)
set_bit(dm355evm_keys[i].keycode, input->keybit); set_bit(dm355evm_keys[i].keycode, input->keybit);
input->keycodemax = ARRAY_SIZE(dm355evm_keys);
input->keycodesize = sizeof(dm355evm_keys[0]);
input->keycode = dm355evm_keys; input->keycode = dm355evm_keys;
input->setkeycode = dm355evm_setkeycode; input->setkeycode = dm355evm_setkeycode;
input->getkeycode = dm355evm_getkeycode; input->getkeycode = dm355evm_getkeycode;
...@@ -266,7 +237,7 @@ static int __devinit dm355evm_keys_probe(struct platform_device *pdev) ...@@ -266,7 +237,7 @@ static int __devinit dm355evm_keys_probe(struct platform_device *pdev)
/* register */ /* register */
status = input_register_device(input); status = input_register_device(input);
if (status < 0) if (status < 0)
goto fail0; goto fail1;
/* start reporting events */ /* start reporting events */
status = request_irq(keys->irq, dm355evm_keys_irq, status = request_irq(keys->irq, dm355evm_keys_irq,
......
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