Henrik Rydberg | 27 Jun 01:06

[PATCH 001/001] linux-input: Support for BCM5974 multitouch trackpad

From: Henrik Rydberg <rydberg <at> euromail.se>

BCM5974: This driver adds support for the multitouch trackpad on the new
Apple Macbook Air and Macbook Pro Penryn laptops. It replaces the
appletouch driver on those computers, and integrates well with the
synaptics driver of the Xorg system. 

Signed-off-by: Henrik Rydberg <rydberg <at> euromail.se>
---

The touchpad on the new Macbook Air and Macbook Pro Penryn laptops is
based on the Broadcom BCM5974 chip, of which very little is publicly
known. The device is currently not recognized by the kernel, and as a
consequence the synaptics system fails to operate. The fall-back mouse
handling is very poor. The attached driver, bcm5974, remedies this. It
operates similarly to the appletouch driver, and could preferably be
added to the same place in the kernel tree, drivers/input/mouse/.

diff -uprN -X upstream-2.6/Documentation/dontdiff baseline-2.6/drivers/input/mouse/bcm5974.c upstream-2.6/drivers/input/mouse/bcm5974.c
--- baseline-2.6/drivers/input/mouse/bcm5974.c	1970-01-01 01:00:00.000000000 +0100
+++ upstream-2.6/drivers/input/mouse/bcm5974.c	2008-06-27 00:28:07.000000000 +0200
@@ -0,0 +1,674 @@
+/*
+ * Apple USB BCM5974 (Macbook Air and Penryn Macbook Pro) multitouch driver
+ *
+ * Copyright (C) 2008	   Henrik Rydberg (rydberg <at> euromail.se)
+ *
+ * The USB initialization and package decoding was made by
+ * Scott Shawcroft as part of the touchd user-space driver project:
+ * Copyright (C) 2008	   Scott Shawcroft (tannewt of tannewt.org)
(Continue reading)

Oliver Neukum | 27 Jun 09:43

Re: [PATCH 001/001] linux-input: Support for BCM5974 multitouch trackpad

Am Freitag 27 Juni 2008 01:07:19 schrieb Henrik Rydberg:
> From: Henrik Rydberg <rydberg <at> euromail.se>
> 
> BCM5974: This driver adds support for the multitouch trackpad on the new
> Apple Macbook Air and Macbook Pro Penryn laptops. It replaces the
> appletouch driver on those computers, and integrates well with the
> synaptics driver of the Xorg system. 

Some comments on the driver.

	Regards
		Oliver

> +
> +static int atp_wellspring_init(struct usb_device *udev)
> +{
> +  const struct atp_config_t *cfg = atp_product_config(udev);
> +  char data[8];

DMA on the stack. You must kmalloc that buffer.
> +  int size;
> +
> +  /* reset button endpoint */
> +  if (usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
> +		      USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT,
> +		      0, cfg->bt_ep, NULL, 0, 5000)) {
> +    err("Could not reset button endpoint");
> +    return -EIO;
> +  }
> +
(Continue reading)

Henrik Rydberg | 28 Jun 00:17

Re: [PATCH 001/001] linux-input: Support for BCM5974 multitouch trackpad

On Fri, 2008-06-27 at 09:43 +0200, Oliver Neukum wrote:
> Am Freitag 27 Juni 2008 01:07:19 schrieb Henrik Rydberg:
> > From: Henrik Rydberg <rydberg <at> euromail.se>
> > 
> > BCM5974: This driver adds support for the multitouch trackpad on the new
> > Apple Macbook Air and Macbook Pro Penryn laptops. It replaces the
> > appletouch driver on those computers, and integrates well with the
> > synaptics driver of the Xorg system. 
> 
> Some comments on the driver.
> 
> 	Regards
> 		Oliver
> 

Thank you very much for finding the bugs, and for your general comments.
I have modified the latest version accordingly, taking all of your
suggestions into account. The new patch follows below.

---
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index 7bbea09..89ef7c3 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -130,6 +130,29 @@ config MOUSE_APPLETOUCH
 	  To compile this driver as a module, choose M here: the
 	  module will be called appletouch.

+config MOUSE_BCM5974
+	tristate "Apple USB BCM5974 Multitouch trackpad support"
(Continue reading)


Gmane