NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/53444 (extended W mode enabling makes vt-switching very slow)



Synopsis: extended W mode enabling makes vt-switching very slow

Responsible-Changed-From-To: kern-bug-people->ryoon
Responsible-Changed-By: maya%NetBSD.org@localhost
Responsible-Changed-When: Fri, 13 Jul 2018 21:02:45 +0000
Responsible-Changed-Why:
This patch works for me (with uwe improving the driver): http://coypu.sdf.org/synaptics6.diff
Does it still work with the extended W mode for you?


State-Changed-From-To: open->feedback
State-Changed-By: maya%NetBSD.org@localhost
State-Changed-When: Fri, 13 Jul 2018 21:02:45 +0000
State-Changed-Why:
Index: synaptics.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pckbport/synaptics.c,v
retrieving revision 1.41
diff -u -r1.41 synaptics.c
--- synaptics.c	3 Jun 2018 15:10:12 -0000	1.41
+++ synaptics.c	13 Jul 2018 20:59:33 -0000
@@ -179,7 +179,7 @@
 }
 
 static int
-synaptics_poll_status(struct pms_softc *psc, u_char slice, u_char resp[3])
+synaptics_special_read(struct pms_softc *psc, u_char slice, u_char resp[3])
 {
 	u_char cmd[1] = { PMS_SEND_DEV_STATUS };
 	int res = pms_sliced_command(psc->sc_kbctag, psc->sc_kbcslot, slice);
@@ -188,6 +188,21 @@
 	    cmd, 1, 3, resp, 0);
 }
 
+static int
+synaptics_special_write(struct pms_softc *psc, u_char command, u_char arg)
+{
+	int res = pms_sliced_command(psc->sc_kbctag, psc->sc_kbcslot, arg);
+	if (res)
+		return res;
+
+	u_char cmd[2];
+	cmd[0] = PMS_SET_SAMPLE;
+	cmd[1] = command;
+	res = pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot,
+	    cmd, 2, 0, NULL, 0);
+	return res;
+}
+
 static void
 pms_synaptics_probe_extended(struct pms_softc *psc)
 {
@@ -213,7 +228,7 @@
 	if (((sc->caps & SYNAPTICS_CAP_EXTNUM) + 0x08)
 	    >= SYNAPTICS_EXTENDED_QUERY)
 	{
-		res = synaptics_poll_status(psc, SYNAPTICS_EXTENDED_QUERY, resp);
+		res = synaptics_special_read(psc, SYNAPTICS_EXTENDED_QUERY, resp);
 		if (res == 0) {
 			int buttons = (resp[1] >> 4);
 			aprint_debug_dev(psc->sc_dev,
@@ -245,7 +260,7 @@
 	if (((sc->caps & SYNAPTICS_CAP_EXTNUM) + 0x08) >=
 	    SYNAPTICS_CONTINUED_CAPABILITIES)
 	{
-		res = synaptics_poll_status(psc,
+		res = synaptics_special_read(psc,
 		    SYNAPTICS_CONTINUED_CAPABILITIES, resp);
 
 /*
@@ -362,7 +377,7 @@
 
 
 	/* Query the hardware capabilities. */
-	res = synaptics_poll_status(psc, SYNAPTICS_READ_CAPABILITIES, resp);
+	res = synaptics_special_read(psc, SYNAPTICS_READ_CAPABILITIES, resp);
 	if (res) {
 		/* Hmm, failed to get capabilites. */
 		aprint_error_dev(psc->sc_dev,
@@ -410,7 +425,6 @@
 	struct synaptics_softc *sc = &psc->u.synaptics;
 	u_char enable_modes;
 	int res;
-	u_char cmd[1], resp[3];
 
 	if (sc->flags & SYN_FLAG_HAS_PASSTHROUGH) {
 		/*
@@ -441,37 +455,17 @@
 	for (int i = 0; i < 2; i++)
 		synaptics_poll_cmd(psc, PMS_SET_SCALE11, 0);
 
-	res = pms_sliced_command(psc->sc_kbctag, psc->sc_kbcslot,
-	    enable_modes);
+	res = synaptics_special_write(psc, SYNAPTICS_CMD_SET_MODE2, enable_modes);
 	if (res)
 		aprint_error("synaptics: set mode error\n");
 
-	synaptics_poll_cmd(psc, PMS_SET_SAMPLE, SYNAPTICS_CMD_SET_MODE2, 0);
-
 	/* a couple of set scales to clear out pending commands */
 	for (int i = 0; i < 2; i++)
 		synaptics_poll_cmd(psc, PMS_SET_SCALE11, 0);
 
-	/*
-	 * Enable multi-finger capability in cold boot case with
-	 * undocumented sequence.
-	 * Parameters from
-	 * https://github.com/RehabMan/OS-X-Voodoo-PS2-Controller/
-	 * VoodooPS2Trackpad/VoodooPS2SynapticsTouchPad.cpp
-	 * setTouchPadModeByte function.
-	 */
-	if (sc->flags & SYN_FLAG_HAS_EXTENDED_WMODE) {
-		static const uint8_t seq[] = {
-		    0xe6, 0xe8, 0x00, 0xe8, 0x00,
-		    0xe8, 0x00, 0xe8, 0x03, 0xf3,
-		    0xc8,
-		};
-		for (size_t s = 0; s < __arraycount(seq); s++) {
-			cmd[0] = seq[s];
-			(void)pckbport_poll_cmd(psc->sc_kbctag, psc->sc_kbcslot,
-				cmd, 1, 3, resp, 0);
-		}
-	}
+	/* Set advanced gesture mode */
+	if (sc->flags & SYN_FLAG_HAS_EXTENDED_WMODE)
+		synaptics_special_write(psc, SYNAPTICS_WRITE_DELUXE_3, 0x3); 
 
 	synaptics_poll_cmd(psc, PMS_DEV_ENABLE, 0);
 
Index: synapticsreg.h
===================================================================
RCS file: /cvsroot/src/sys/dev/pckbport/synapticsreg.h,v
retrieving revision 1.9
diff -u -r1.9 synapticsreg.h
--- synapticsreg.h	6 Nov 2017 21:07:17 -0000	1.9
+++ synapticsreg.h	13 Jul 2018 20:59:33 -0000
@@ -45,6 +45,7 @@
 #define	SYNAPTICS_READ_MODEL_ID		0x3
 #define	SYNAPTICS_EXTENDED_QUERY	0x9
 #define	SYNAPTICS_CONTINUED_CAPABILITIES 0x0c
+#define	SYNAPTICS_WRITE_DELUXE_3	0xc8 /* 6.2.3. Deluxe mode setting sequence */
 
 /* Synaptics special commands */
 #define	SYNAPTICS_CMD_SET_MODE2		0x14






Home | Main Index | Thread Index | Old Index