Commit 753a97c6 authored by Vasily Khoruzhick's avatar Vasily Khoruzhick Committed by Andrzej Zaborowski
Browse files

pxa2xx_keypad: make single automatic scans work



u-boot uses single automatic scans and polling in
pxa2xx_keypad driver, so clear KPC_AS bit immediately
and update keys state even if KPC_AS and KPC_ASACT are
cleared.

Signed-off-by: default avatarVasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: default avatarAndrzej Zaborowski <andrew.zaborowski@intel.com>
parent 7ab3aedf
Loading
Loading
Loading
Loading
+36 −36
Original line number Diff line number Diff line
@@ -129,12 +129,8 @@ static void pxa27x_keyboard_event (PXA2xxKeyPadState *kp, int keycode)
    if(!(kp->kpc & KPC_ME)) /* skip if not enabled */
        return;

    if(kp->kpc & KPC_AS || kp->kpc & KPC_ASACT) {
        if(kp->kpc & KPC_AS)
            kp->kpc &= ~(KPC_AS);

    rel = (keycode & 0x80) ? 1 : 0; /* key release from qemu */
        keycode &= ~(0x80); /* strip qemu key release bit */
    keycode &= ~0x80; /* strip qemu key release bit */
    if (kp->alt_code) {
        keycode |= 0x80;
        kp->alt_code = 0;
@@ -142,8 +138,9 @@ static void pxa27x_keyboard_event (PXA2xxKeyPadState *kp, int keycode)

    row = kp->map[keycode].row;
    col = kp->map[keycode].column;
        if(row == -1 || col == -1)
    if (row == -1 || col == -1) {
        return;
    }

    val = KPASMKPx_MKC(row, col);
    if (rel) {
@@ -162,15 +159,15 @@ static void pxa27x_keyboard_event (PXA2xxKeyPadState *kp, int keycode)
    kp->kpas = ((kp->pressed_cnt & 0x1f) << 26) | (0xf << 4) | 0xf;
    if (kp->pressed_cnt == 1) {
        kp->kpas &= ~((0xf << 4) | 0xf);
            if (rel)
        if (rel) {
            pxa27x_keypad_find_pressed_key(kp, &row, &col);
            kp->kpas |= ((row & 0xf) << 4) | (col & 0xf);
        }
        goto out;
        kp->kpas |= ((row & 0xf) << 4) | (col & 0xf);
    }
    return;

out:
    if (!(kp->kpc & (KPC_AS | KPC_ASACT))
        assert_irq = 0;

    if (assert_irq && (kp->kpc & KPC_MIE)) {
        kp->kpc |= KPC_MI;
        qemu_irq_raise(kp->irq);
@@ -248,6 +245,9 @@ static void pxa2xx_keypad_write(void *opaque, target_phys_addr_t offset,
    switch (offset) {
    case KPC:
        s->kpc = value;
        if (s->kpc & KPC_AS) {
            s->kpc &= ~(KPC_AS);
        }
        break;
    case KPDK:
        s->kpdk = value;