|
21 | 21 |
|
22 | 22 | #include "psmouse.h"
|
23 | 23 | #include "alps.h"
|
| 24 | +#include "trackpoint.h" |
24 | 25 |
|
25 | 26 | /*
|
26 | 27 | * Definitions for ALPS version 3 and 4 command mode protocol
|
@@ -2861,6 +2862,23 @@ static const struct alps_protocol_info *alps_match_table(unsigned char *e7,
|
2861 | 2862 | return NULL;
|
2862 | 2863 | }
|
2863 | 2864 |
|
| 2865 | +static bool alps_is_cs19_trackpoint(struct psmouse *psmouse) |
| 2866 | +{ |
| 2867 | + u8 param[2] = { 0 }; |
| 2868 | + |
| 2869 | + if (ps2_command(&psmouse->ps2dev, |
| 2870 | + param, MAKE_PS2_CMD(0, 2, TP_READ_ID))) |
| 2871 | + return false; |
| 2872 | + |
| 2873 | + /* |
| 2874 | + * param[0] contains the trackpoint device variant_id while |
| 2875 | + * param[1] contains the firmware_id. So far all alps |
| 2876 | + * trackpoint-only devices have their variant_ids equal |
| 2877 | + * TP_VARIANT_ALPS and their firmware_ids are in 0x20~0x2f range. |
| 2878 | + */ |
| 2879 | + return param[0] == TP_VARIANT_ALPS && (param[1] & 0x20); |
| 2880 | +} |
| 2881 | + |
2864 | 2882 | static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
|
2865 | 2883 | {
|
2866 | 2884 | const struct alps_protocol_info *protocol;
|
@@ -3161,6 +3179,20 @@ int alps_detect(struct psmouse *psmouse, bool set_properties)
|
3161 | 3179 | if (error)
|
3162 | 3180 | return error;
|
3163 | 3181 |
|
| 3182 | + /* |
| 3183 | + * ALPS cs19 is a trackpoint-only device, and uses different |
| 3184 | + * protocol than DualPoint ones, so we return -EINVAL here and let |
| 3185 | + * trackpoint.c drive this device. If the trackpoint driver is not |
| 3186 | + * enabled, the device will fall back to a bare PS/2 mouse. |
| 3187 | + * If ps2_command() fails here, we depend on the immediately |
| 3188 | + * followed psmouse_reset() to reset the device to normal state. |
| 3189 | + */ |
| 3190 | + if (alps_is_cs19_trackpoint(psmouse)) { |
| 3191 | + psmouse_dbg(psmouse, |
| 3192 | + "ALPS CS19 trackpoint-only device detected, ignoring\n"); |
| 3193 | + return -EINVAL; |
| 3194 | + } |
| 3195 | + |
3164 | 3196 | /*
|
3165 | 3197 | * Reset the device to make sure it is fully operational:
|
3166 | 3198 | * on some laptops, like certain Dell Latitudes, we may
|
|
0 commit comments