bcm5974-0.58: name changes, open/close and suspend/resume serialized
Subsystems (3)
PATCH 1/1 bcm5974-0.58: name changes, open/close and suspend/resume serialized
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.
---
This is version bcm5974-0.58. Changes since 0.57 are in short:
* Name changes; use usbhid definitions, rename atp to bcm5974
* Input syncing moved to report functions, event type setup broken out
* Traffic functions added for open/close and suspend/resume logic
* Open/close and suspend/resume transition logic corrected
* Open/close serialized with respect to suspend/resume
Thanks to Dmitry Torokhov for reviewing and clearing up the resume functionality, and Alan Stern for the resume error state handling.
This patch is against linux-next v2.6.26-9281-gb475aa5.
drivers/input/mouse/Kconfig +23 -0
@@ -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" + depends on USB_ARCH_HAS_HCD + depends on USB + help + Say Y here if you have an Apple USB BCM5974 Multitouch + trackpad. + + The BCM5974 is the multitouch trackpad found in the Macbook + Air (JAN2008) and Macbook Pro Penryn (FEB2008) laptops. + + It is also found in the IPhone (2007) and Ipod Touch (2008). + + This driver provides multitouch functionality together with + the synaptics X11 driver. + + The interface is currently identical to the appletouch interface, + for further information, see + <file:Documentation/input/appletouch.txt>. + + To compile this driver as a module, choose M here: the + module will be called bcm5974. + config MOUSE_INPORT tristate "InPort/MS/ATIXL busmouse" depends on ISA
drivers/input/mouse/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_MOUSE_AMIGA) += amimouse.o obj-$(CONFIG_MOUSE_APPLETOUCH) += appletouch.o +obj-$(CONFIG_MOUSE_BCM5974) += bcm5974.o obj-$(CONFIG_MOUSE_ATARI) += atarimouse.o obj-$(CONFIG_MOUSE_RISCPC) += rpcmouse.o obj-$(CONFIG_MOUSE_INPORT) += inport.o
drivers/input/mouse/bcm5974.c new file +673 -0
673 lines not on this page · raw message
Dmitry Torokhov
maintainerHi Henrik,
Quoted 9 lines · Henrik Rydberg
This is version bcm5974-0.58. Changes since 0.57 are in short:
* Name changes; use usbhid definitions, rename atp to bcm5974
* Input syncing moved to report functions, event type setup broken out
* Traffic functions added for open/close and suspend/resume logic
* Open/close and suspend/resume transition logic corrected
* Open/close serialized with respect to suspend/resume
Thank you for the changes. You don't have to track whether device is manually suspended or not - usb_submit_urb will fail and that is it.
Attached are 2 patches. First cleans suspend state tracking as it is not really needed and does some formatting and other minor changes and 2nd implements runtime pm for the device. Could you please try them and if everything still works I will apply the driver.
Thanks!
Signature · 1 line
Dmitry
From: Dmitry Torokhov <[email protected]>
---
drivers/input/mouse/Kconfig | 12 +- drivers/input/mouse/bcm5974.c | 228 ++++++++++++++++++++--------------------- 2 files changed, 118 insertions(+), 122 deletions(-)
drivers/input/mouse/Kconfig +6 -6
@@ -133,23 +133,23 @@ config MOUSE_APPLETOUCH config MOUSE_BCM5974 tristate "Apple USB BCM5974 Multitouch trackpad support" depends on USB_ARCH_HAS_HCD - depends on USB + select USB help Say Y here if you have an Apple USB BCM5974 Multitouch trackpad. - + The BCM5974 is the multitouch trackpad found in the Macbook Air (JAN2008) and Macbook Pro Penryn (FEB2008) laptops. - + It is also found in the IPhone (2007) and Ipod Touch (2008). - + This driver provides multitouch functionality together with the synaptics X11 driver. - + The interface is currently identical to the appletouch interface, for further information, see <file:Documentation/input/appletouch.txt>. - + To compile this driver as a module, choose M here: the module will be called bcm5974.
drivers/input/mouse/bcm5974.c +112 -116
399 lines not on this page · raw message
Input: bcm5974 - implement autosuspend support
From: Dmitry Torokhov <[email protected]>
---
drivers/input/mouse/bcm5974.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/input/mouse/bcm5974.c +12 -0
@@ -150,6 +150,7 @@ struct bcm5974_config {struct bcm5974 {char phys[64 ];struct usb_device *udev;/* usb device */ +struct usb_interface *intf;/* our interface */ struct input_dev *input;/* input dev */ struct bcm5974_config cfg;/* device configuration */ struct mutex pm_mutex;/* serialize access to open/suspend */
@@ -478,6 +479,10 @@ static int bcm5974_open(struct input_dev *input)struct bcm5974 *dev =input_get_drvdata (input);int error; + error =usb_autopm_get_interface (dev->intf); +if (error) +return error; +mutex_lock (&dev->pm_mutex); error =bcm5974_start_traffic (dev);
@@ -486,6 +491,9 @@ static int bcm5974_open(struct input_dev *input)mutex_unlock (&dev->pm_mutex); +if (error) +usb_autopm_put_interface (dev->intf); +return error; }
@@ -499,6 +507,8 @@ static void bcm5974_close(struct input_dev *input) dev->opened =0 ;mutex_unlock (&dev->pm_mutex); + +usb_autopm_put_interface (dev->intf); }static int bcm5974_suspend (struct usb_interface *iface,pm_message_t message)
@@ -551,6 +561,7 @@ static int bcm5974_probe(struct usb_interface *iface, } dev->udev = udev; + dev->intf = iface; dev->input = input_dev; dev->cfg = *cfg;mutex_init (&dev->pm_mutex);
@@ -652,6 +663,7 @@ static struct usb_driver bcm5974_driver = { .resume = bcm5974_resume, .reset_resume = bcm5974_resume, .id_table = bcm5974_table, + .supports_autosuspend = 1, };static int __init bcm5974_init (void )
Hello Dmitry,
Quoted 4 lines
Thank you for the changes. You don't have to track whether device is manually suspended or not -
usb_submit_urbwill fail and that is it.
Perfect.
Quoted 4 lines
Attached are 2 patches. First cleans suspend state tracking as it is not really needed and does some formatting and other minor changes and 2nd implements runtime pm for the device. Could you please try them and if everything still works I will apply the driver.
Patch 1:
Looking good, just a few comments:
* I notice that clamp_val is new since 2.6.24.3
* Regarding the open-fails comment: is EACCES correct?
Patch 2:
Perfect.
Thank you so much, Dmitry - it's a GO!
Henrik
Dmitry Torokhov
maintainerQuoted 13 lines · Henrik Rydberg
Hello Dmitry,
Quoted 4 lines
Thank you for the changes. You don't have to track whether device is manually suspended or not -
usb_submit_urbwill fail and that is it.Perfect.
Quoted 4 lines
Attached are 2 patches. First cleans suspend state tracking as it is not really needed and does some formatting and other minor changes and 2nd implements runtime pm for the device. Could you please try them and if everything still works I will apply the driver.
Quoted 5 lines
Patch 1:
Looking good, just a few comments:
* I notice that
clamp_valis new since 2.6.24.3
Probably, I am not sure...
Quoted 1 line
* Regarding the open-fails comment: is EACCES correct?
We don't return EACCESS anymore, I don't think. We will return what bcm5974_start_traffic returns which in turn returns result of usb_submit_urb and the likes.
I don't think returning -EACCESS was proper - it usually indicates permisison issues, not the fact that the hardware is unavailable.
Quoted 7 lines
Patch 2:
Perfect.
Thank you so much, Dmitry - it's a GO!
Great, thank you!
Signature · 1 line
Dmitry
Hi Dmitry,
one thing about the drivers/input/mouse/Kconfig patch:
The original version contained "select USB", which was later changed to "depends on USB" by Andrew Morton. I saw it reappear as "select USB" in your latest patch, and simply considered it a change back, but maybe it was an oversight?
Cheers,
Henrik
Dmitry Torokhov
maintainerHi Henrik,
Quoted 9 lines · Henrik Rydberg
Hi Dmitry,
one thing about the
drivers/input/mouse/Kconfigpatch:The original version contained "select USB", which was later changed to "depends on USB" by Andrew Morton. I saw it reappear as "select USB" in your latest patch, and simply considered it a change back, but maybe it was an oversight?
I am of the opinion that it is OK to "select" high-level subsystems that don't have additional dependencies, especially if they are "past" the original driver in menuconfig. I don't really like the idea of forcing users revisiting earlier sub-menus after they selected a new subsystem to see if there are any new options. Plus, if user wants driver for his touchpad he does not really care whether it is PS/2 or USB, [s]he just wants it to work.
So the change was intentional on my part.
Signature · 1 line
Dmitry
Quoted 8 lines · Dmitry Torokhov
Quoted 7 lines
one thing about the
drivers/input/mouse/Kconfigpatch:The original version contained "select USB", which was later changed to "depends on USB" by Andrew Morton. I saw it reappear as "select USB" in your latest patch, and simply considered it a change back, but maybe it was an oversight?
Quoted 7 lines
I am of the opinion that it is OK to "select" high-level subsystems that don't have additional dependencies, especially if they are "past" the original driver in menuconfig. I don't really like the idea of forcing users revisiting earlier sub-menus after they selected a new subsystem to see if there are any new options. Plus, if user wants driver for his touchpad he does not really care whether it is PS/2 or USB, [s]he just wants it to work.
USB tends to have implicit dependencies like the ehci/ohci/uhci controller though, so it's not going to work like that anyway starting from a minimal config, and all defconfigs probably have USB anyway.
Therefore, I personally would keep it as "depends on" rather than "select". YMMV.
johannes
Dmitry Torokhov
maintainerQuoted 18 lines · Johannes Berg
Quoted 8 lines · Dmitry Torokhov
Quoted 7 lines
one thing about the
drivers/input/mouse/Kconfigpatch:The original version contained "select USB", which was later changed to "depends on USB" by Andrew Morton. I saw it reappear as "select USB" in your latest patch, and simply considered it a change back, but maybe it was an oversight?
Quoted 7 lines
I am of the opinion that it is OK to "select" high-level subsystems that don't have additional dependencies, especially if they are "past" the original driver in menuconfig. I don't really like the idea of forcing users revisiting earlier sub-menus after they selected a new subsystem to see if there are any new options. Plus, if user wants driver for his touchpad he does not really care whether it is PS/2 or USB, [s]he just wants it to work.
Quoted 7 lines
USB tends to have implicit dependencies like the ehci/ohci/uhci controller though, so it's not going to work like that anyway starting from a minimal config, and all defconfigs probably have USB anyway.
Therefore, I personally would keep it as "depends on" rather than "select". YMMV.
It should work fine I think. The full dependancy of most USB input devices is:
depends on USB_ARCH_HAS_HCD
select USB
You do need to select the host controller, that is correct, but you don't need to go to USB menu, select HCD, then go back to input menu (which you already visited) and select your USB input device.
Signature · 1 line
Dmitry