Commit 9c930c3f authored by Vojtech Pavlik's avatar Vojtech Pavlik

Merge bk://dtor.bkbits.net/input into suse.cz:/data/bk/input

parents be7b8193 b1f6b5a0
...@@ -287,6 +287,24 @@ int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command) ...@@ -287,6 +287,24 @@ int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command)
return 0; return 0;
} }
/*
* psmouse_reset() resets the mouse into power-on state.
*/
int psmouse_reset(struct psmouse *psmouse)
{
unsigned char param[2];
if (psmouse_command(psmouse, param, PSMOUSE_CMD_RESET_BAT))
return -1;
if (param[0] != PSMOUSE_RET_BAT && param[1] != PSMOUSE_RET_ID)
return -1;
return 0;
}
/* /*
* Genius NetMouse magic init. * Genius NetMouse magic init.
*/ */
...@@ -371,6 +389,10 @@ static int psmouse_extensions(struct psmouse *psmouse) ...@@ -371,6 +389,10 @@ static int psmouse_extensions(struct psmouse *psmouse)
*/ */
psmouse_max_proto = PSMOUSE_IMEX; psmouse_max_proto = PSMOUSE_IMEX;
} }
/*
* Make sure that touchpad is in relative mode, gestures (taps) are enabled
*/
synaptics_reset(psmouse);
} }
if (psmouse_max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) { if (psmouse_max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) {
...@@ -416,6 +438,7 @@ static int psmouse_extensions(struct psmouse *psmouse) ...@@ -416,6 +438,7 @@ static int psmouse_extensions(struct psmouse *psmouse)
* pass through port it could get disabled while probing for protocol * pass through port it could get disabled while probing for protocol
* extensions. * extensions.
*/ */
psmouse_reset(psmouse);
psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS); psmouse_command(psmouse, NULL, PSMOUSE_CMD_RESET_DIS);
} }
...@@ -540,8 +563,8 @@ static void psmouse_activate(struct psmouse *psmouse) ...@@ -540,8 +563,8 @@ static void psmouse_activate(struct psmouse *psmouse)
static void psmouse_cleanup(struct serio *serio) static void psmouse_cleanup(struct serio *serio)
{ {
struct psmouse *psmouse = serio->private; struct psmouse *psmouse = serio->private;
unsigned char param[2];
psmouse_command(psmouse, param, PSMOUSE_CMD_RESET_BAT); psmouse_reset(psmouse);
} }
/* /*
...@@ -552,7 +575,7 @@ static void psmouse_disconnect(struct serio *serio) ...@@ -552,7 +575,7 @@ static void psmouse_disconnect(struct serio *serio)
{ {
struct psmouse *psmouse = serio->private; struct psmouse *psmouse = serio->private;
psmouse->state = PSMOUSE_IGNORE; psmouse->state = PSMOUSE_CMD_MODE;
if (psmouse->ptport) { if (psmouse->ptport) {
if (psmouse->ptport->deactivate) if (psmouse->ptport->deactivate)
...@@ -565,6 +588,8 @@ static void psmouse_disconnect(struct serio *serio) ...@@ -565,6 +588,8 @@ static void psmouse_disconnect(struct serio *serio)
if (psmouse->disconnect) if (psmouse->disconnect)
psmouse->disconnect(psmouse); psmouse->disconnect(psmouse);
psmouse->state = PSMOUSE_IGNORE;
input_unregister_device(&psmouse->dev); input_unregister_device(&psmouse->dev);
serio_close(serio); serio_close(serio);
kfree(psmouse); kfree(psmouse);
...@@ -592,7 +617,7 @@ static void psmouse_connect(struct serio *serio, struct serio_dev *dev) ...@@ -592,7 +617,7 @@ static void psmouse_connect(struct serio *serio, struct serio_dev *dev)
psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y); psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
psmouse->state = PSMOUSE_NEW_DEVICE; psmouse->state = PSMOUSE_CMD_MODE;
psmouse->serio = serio; psmouse->serio = serio;
psmouse->dev.private = psmouse; psmouse->dev.private = psmouse;
...@@ -652,7 +677,7 @@ static int psmouse_reconnect(struct serio *serio) ...@@ -652,7 +677,7 @@ static int psmouse_reconnect(struct serio *serio)
old_type = psmouse->type; old_type = psmouse->type;
psmouse->state = PSMOUSE_NEW_DEVICE; psmouse->state = PSMOUSE_CMD_MODE;
psmouse->type = psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = 0; psmouse->type = psmouse->acking = psmouse->cmdcnt = psmouse->pktcnt = 0;
if (psmouse->reconnect) { if (psmouse->reconnect) {
if (psmouse->reconnect(psmouse)) if (psmouse->reconnect(psmouse))
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#define PSMOUSE_RET_NAK 0xfe #define PSMOUSE_RET_NAK 0xfe
/* psmouse states */ /* psmouse states */
#define PSMOUSE_NEW_DEVICE 0 #define PSMOUSE_CMD_MODE 0
#define PSMOUSE_ACTIVATED 1 #define PSMOUSE_ACTIVATED 1
#define PSMOUSE_IGNORE 2 #define PSMOUSE_IGNORE 2
...@@ -65,6 +65,7 @@ struct psmouse { ...@@ -65,6 +65,7 @@ struct psmouse {
#define PSMOUSE_SYNAPTICS 7 #define PSMOUSE_SYNAPTICS 7
int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command); int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command);
int psmouse_reset(struct psmouse *psmouse);
extern int psmouse_smartscroll; extern int psmouse_smartscroll;
extern unsigned int psmouse_rate; extern unsigned int psmouse_rate;
......
...@@ -92,17 +92,6 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode) ...@@ -92,17 +92,6 @@ static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode)
return 0; return 0;
} }
static int synaptics_reset(struct psmouse *psmouse)
{
unsigned char r[2];
if (psmouse_command(psmouse, r, PSMOUSE_CMD_RESET_BAT))
return -1;
if (r[0] == PSMOUSE_RET_BAT && r[1] == PSMOUSE_RET_ID)
return 0;
return -1;
}
/* /*
* Read the model-id bytes from the touchpad * Read the model-id bytes from the touchpad
* see also SYN_MODEL_* macros * see also SYN_MODEL_* macros
...@@ -197,7 +186,7 @@ static int synaptics_query_hardware(struct psmouse *psmouse) ...@@ -197,7 +186,7 @@ static int synaptics_query_hardware(struct psmouse *psmouse)
{ {
int retries = 0; int retries = 0;
while ((retries++ < 3) && synaptics_reset(psmouse)) while ((retries++ < 3) && psmouse_reset(psmouse))
printk(KERN_ERR "synaptics reset failed\n"); printk(KERN_ERR "synaptics reset failed\n");
if (synaptics_identify(psmouse)) if (synaptics_identify(psmouse))
...@@ -368,9 +357,15 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) ...@@ -368,9 +357,15 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
clear_bit(REL_Y, dev->relbit); clear_bit(REL_Y, dev->relbit);
} }
static void synaptics_disconnect(struct psmouse *psmouse) void synaptics_reset(struct psmouse *psmouse)
{ {
/* reset touchpad back to relative mode, gestures enabled */
synaptics_mode_cmd(psmouse, 0); synaptics_mode_cmd(psmouse, 0);
}
static void synaptics_disconnect(struct psmouse *psmouse)
{
synaptics_reset(psmouse);
kfree(psmouse->private); kfree(psmouse->private);
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
extern void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs); extern void synaptics_process_byte(struct psmouse *psmouse, struct pt_regs *regs);
extern int synaptics_detect(struct psmouse *psmouse); extern int synaptics_detect(struct psmouse *psmouse);
extern int synaptics_init(struct psmouse *psmouse); extern int synaptics_init(struct psmouse *psmouse);
extern void synaptics_reset(struct psmouse *psmouse);
/* synaptics queries */ /* synaptics queries */
#define SYN_QUE_IDENTIFY 0x00 #define SYN_QUE_IDENTIFY 0x00
......
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