11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * ALPS touchpad PS/2 mouse driver
31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Copyright (c) 2003 Peter Osterlund <petero2@telia.com>
51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz>
61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This program is free software; you can redistribute it and/or modify it
81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * under the terms of the GNU General Public License version 2 as published by
91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the Free Software Foundation.
101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _ALPS_H
131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _ALPS_H
141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
15fa629ef5222193214da9a2b3c94369f79353bec9Seth Forshee#define ALPS_PROTO_V1	0
16fa629ef5222193214da9a2b3c94369f79353bec9Seth Forshee#define ALPS_PROTO_V2	1
1725bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee#define ALPS_PROTO_V3	2
1825bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee#define ALPS_PROTO_V4	3
19fa629ef5222193214da9a2b3c94369f79353bec9Seth Forshee
201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct alps_model_info {
211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds        unsigned char signature[3];
2225bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee	unsigned char command_mode_resp; /* v3/v4 only */
23fa629ef5222193214da9a2b3c94369f79353bec9Seth Forshee	unsigned char proto_version;
241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds        unsigned char byte0, mask0;
251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds        unsigned char flags;
261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds};
271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2825bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forsheestruct alps_nibble_commands {
2925bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee	int command;
3025bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee	unsigned char data;
3125bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee};
3225bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee
331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct alps_data {
342e5b636bb5f8dacbb91d08544e2c41ebcad5daceDmitry Torokhov	struct input_dev *dev2;		/* Relative device */
351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	char phys[32];			/* Phys */
36e38de678f6b19be3e46a678ec4deeaa7fa0fc140Helge Deller	const struct alps_model_info *i;/* Info */
3725bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee	const struct alps_nibble_commands *nibble_commands;
3825bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee	int addr_command;		/* Command to set register address */
391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int prev_fin;			/* Finger bit from previous packet */
4025bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee	int multi_packet;		/* Multi-packet data in progress */
4101ce661fc83005947dc958a5739c153843af8a73Seth Forshee	unsigned char multi_data[6];	/* Saved multi-packet data */
4225bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee	u8 quirks;
431d9f26262aef6d63ff65eba0fd5f1583f342b69bSebastian Kapfer	struct timer_list timer;
441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds};
451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
4625bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee#define ALPS_QUIRK_TRACKSTICK_BUTTONS	1 /* trakcstick buttons in trackstick packet */
4725bded7cd60fa460e520e9f819bd06f4c5cb53f0Seth Forshee
4855e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomon#ifdef CONFIG_MOUSE_PS2_ALPS
49b7802c5c1ea9563f3746bea09c214ccedc8600f4Dmitry Torokhovint alps_detect(struct psmouse *psmouse, bool set_properties);
5055e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomonint alps_init(struct psmouse *psmouse);
5155e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomon#else
52b7802c5c1ea9563f3746bea09c214ccedc8600f4Dmitry Torokhovinline int alps_detect(struct psmouse *psmouse, bool set_properties)
5355e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomon{
5455e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomon	return -ENOSYS;
5555e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomon}
5655e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomoninline int alps_init(struct psmouse *psmouse)
5755e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomon{
5855e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomon	return -ENOSYS;
5955e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomon}
6055e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomon#endif /* CONFIG_MOUSE_PS2_ALPS */
6155e3d9224b60df0fd2dc36bff9b538ce40fd9586Andres Salomon
621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
63