4 Feb
2011
4 Feb
'11
4:50 a.m.
- pr_debug("interrupt id read in sram = 0x%x\n", jack_msg->intr_id);
- if (jack_msg->intr_id & 0x1) {
pr_debug("short_push detected\n");
mask = status = SND_JACK_BTN_0;
- } else if (jack_msg->intr_id & 0x2) {
pr_debug("long_push detected\n");
mask = status = SND_JACK_BTN_1;
Shouldn't this be using a mask of BTN_0 and BTN_1 for both buttons, they can't be detected simultaneously?
By the way, this logic for reporting the buttons separately to the detection of the headset/headphone status is something that should be pulled out into generic code as the same mechanism is going to be needed by anything using voltage based detection.
But here, we don't do button press detection based on voltage. We get a separate value being set in register when interrupt is generated. In the generic code of adding zones and retrieving type, we can add the button press.