Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'input-for-v6.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input fix from Dmitry Torokhov:

- a fix for Cypress PS/2 touchpad for regression introduced in 6.11
merge window where a timeout condition is incorrectly reported for
all extended Cypress commands

* tag 'input-for-v6.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: cypress_ps2 - fix waiting for command response

+13 -45
+13 -45
drivers/input/mouse/cypress_ps2.c
··· 91 91 return rc; 92 92 } 93 93 94 - static int cypress_ps2_read_cmd_status(struct psmouse *psmouse, 95 - u8 cmd, u8 *param) 96 - { 97 - struct ps2dev *ps2dev = &psmouse->ps2dev; 98 - enum psmouse_state old_state; 99 - int pktsize; 100 - int rc; 101 - 102 - ps2_begin_command(ps2dev); 103 - 104 - old_state = psmouse->state; 105 - psmouse->state = PSMOUSE_CMD_MODE; 106 - psmouse->pktcnt = 0; 107 - 108 - pktsize = (cmd == CYTP_CMD_READ_TP_METRICS) ? 8 : 3; 109 - memset(param, 0, pktsize); 110 - 111 - rc = cypress_ps2_sendbyte(psmouse, PSMOUSE_CMD_GETINFO & 0xff); 112 - if (rc) 113 - goto out; 114 - 115 - if (!wait_event_timeout(ps2dev->wait, 116 - psmouse->pktcnt >= pktsize, 117 - msecs_to_jiffies(CYTP_CMD_TIMEOUT))) { 118 - rc = -ETIMEDOUT; 119 - goto out; 120 - } 121 - 122 - memcpy(param, psmouse->packet, pktsize); 123 - 124 - psmouse_dbg(psmouse, "Command 0x%02x response data (0x): %*ph\n", 125 - cmd, pktsize, param); 126 - 127 - out: 128 - psmouse->state = old_state; 129 - psmouse->pktcnt = 0; 130 - 131 - ps2_end_command(ps2dev); 132 - 133 - return rc; 134 - } 135 - 136 94 static bool cypress_verify_cmd_state(struct psmouse *psmouse, u8 cmd, u8* param) 137 95 { 138 96 bool rate_match = false; ··· 124 166 static int cypress_send_ext_cmd(struct psmouse *psmouse, u8 cmd, u8 *param) 125 167 { 126 168 u8 cmd_prefix = PSMOUSE_CMD_SETRES & 0xff; 169 + unsigned int resp_size = cmd == CYTP_CMD_READ_TP_METRICS ? 8 : 3; 170 + unsigned int ps2_cmd = (PSMOUSE_CMD_GETINFO & 0xff) | (resp_size << 8); 127 171 int tries = CYTP_PS2_CMD_TRIES; 128 172 int error; 129 173 ··· 139 179 cypress_ps2_ext_cmd(psmouse, cmd_prefix, DECODE_CMD_BB(cmd)); 140 180 cypress_ps2_ext_cmd(psmouse, cmd_prefix, DECODE_CMD_AA(cmd)); 141 181 142 - error = cypress_ps2_read_cmd_status(psmouse, cmd, param); 143 - if (!error && cypress_verify_cmd_state(psmouse, cmd, param)) 144 - return 0; 182 + error = ps2_command(&psmouse->ps2dev, param, ps2_cmd); 183 + if (error) { 184 + psmouse_dbg(psmouse, "Command 0x%02x failed: %d\n", 185 + cmd, error); 186 + } else { 187 + psmouse_dbg(psmouse, 188 + "Command 0x%02x response data (0x): %*ph\n", 189 + cmd, resp_size, param); 145 190 191 + if (cypress_verify_cmd_state(psmouse, cmd, param)) 192 + return 0; 193 + } 146 194 } while (--tries > 0); 147 195 148 196 return -EIO;