From 5bf3dece8af80656f0ab23421c720451e4157ad2 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Wed, 8 Oct 2008 23:26:39 +0200 Subject: bcm5974 (0.56) unstable; urgency=low * Leave device initialization to hid; use mode-switch only * Mode switch moved to atp_open and simplified * Corrected cleanup action in atp_open * Simplified control package detection * Removed reset_resume, pre_reset, post_reset; not needed -- Henrik Rydberg Fri, 18 Jul 2008 02:42:52 +0200 --- CHANGES | 10 +++++ Makefile | 2 +- bcm5974-dkms-mkdeb/debian/changelog | 7 +++- bcm5974.c | 75 ++++++------------------------------- dkms.conf | 2 +- scripts/bcm5974-diagnostics | 9 ----- scripts/bcm5974-pre-install | 7 ++-- 7 files changed, 32 insertions(+), 80 deletions(-) diff --git a/CHANGES b/CHANGES index 6e51394..d31ea79 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,13 @@ +bcm5974 (0.56) unstable; urgency=low + + * Leave device initialization to hid; use mode-switch only + * Mode switch moved to atp_open and simplified + * Corrected cleanup action in atp_open + * Simplified control package detection + * Removed reset_resume, pre_reset, post_reset; not needed + + -- Henrik Rydberg Fri, 18 Jul 2008 02:42:52 +0200 + bcm5974 (0.55) unstable; urgency=low * Package updates. diff --git a/Makefile b/Makefile index 74335c8..6a04556 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# Makefile for USB Network drivers +# Makefile for input/mouse drivers # obj-m := bcm5974.o diff --git a/bcm5974-dkms-mkdeb/debian/changelog b/bcm5974-dkms-mkdeb/debian/changelog index 1d4e435..cd60af8 100644 --- a/bcm5974-dkms-mkdeb/debian/changelog +++ b/bcm5974-dkms-mkdeb/debian/changelog @@ -1,6 +1,9 @@ MODULE_NAME-dkms (MODULE_VERSION) unstable; urgency=low - * Package updates. - * Reverting GFP_ATOMIC for irq handlers. + * Leave device initialization to hid; use mode-switch only + * Mode switch moved to atp_open and simplified + * Corrected cleanup action in atp_open + * Simplified control package detection + * Removed reset_resume, pre_reset, post_reset; not needed -- Henrik Rydberg DATE_STAMP diff --git a/bcm5974.c b/bcm5974.c index 2b94835..67cbab3 100644 --- a/bcm5974.c +++ b/bcm5974.c @@ -157,7 +157,6 @@ struct atp { struct bt_data *bt_data; /* button transferred data */ struct urb *tp_urb; /* trackpad usb request block */ struct tp_data *tp_data; /* trackpad transferred data */ - unsigned tp_valid; /* trackpad sensors valid */ }; /* logical dimensions */ @@ -283,10 +282,9 @@ static int report_tp_state(struct atp *dev, int size) #define ATP_WELLSPRING_MODE_WRITE_REQUEST_ID 9 #define ATP_WELLSPRING_MODE_REQUEST_VALUE 0x300 #define ATP_WELLSPRING_MODE_REQUEST_INDEX 0 -#define ATP_WELLSPRING_MODE_VENDOR_VALUE_1 0x01 -#define ATP_WELLSPRING_MODE_VENDOR_VALUE_2 0x05 +#define ATP_WELLSPRING_MODE_VENDOR_VALUE 0x01 -static int atp_wellspring_init(struct atp *dev) +static int atp_wellspring_mode(struct atp *dev) { char *data = kmalloc(8, GFP_KERNEL); int error = 0, size; @@ -297,24 +295,6 @@ static int atp_wellspring_init(struct atp *dev) goto error; } - /* reset button endpoint */ - if (usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), - USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT, - 0, dev->cfg.bt_ep, NULL, 0, 5000)) { - err("bcm5974: could not reset button endpoint"); - error = -EIO; - goto error; - } - - /* reset trackpad endpoint */ - if (usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), - USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT, - 0, dev->cfg.tp_ep, NULL, 0, 5000)) { - err("bcm5974: could not reset trackpad endpoint"); - error = -EIO; - goto error; - } - /* read configuration */ size = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), ATP_WELLSPRING_MODE_READ_REQUEST_ID, @@ -329,8 +309,7 @@ static int atp_wellspring_init(struct atp *dev) } /* apply the mode switch */ - data[0] = ATP_WELLSPRING_MODE_VENDOR_VALUE_1; - data[1] = ATP_WELLSPRING_MODE_VENDOR_VALUE_2; + data[0] = ATP_WELLSPRING_MODE_VENDOR_VALUE; /* write configuration */ size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), @@ -345,9 +324,7 @@ static int atp_wellspring_init(struct atp *dev) goto error; } - dev->tp_valid = 0; - - printk(KERN_INFO "bcm5974: Wellspring mode initialized.\n"); + dprintk(2, "bcm5974: switched to wellspring mode.\n"); kfree(data); return 0; @@ -409,11 +386,9 @@ static void irq_trackpad(struct urb *urb) goto exit; } - /* first sample data ignored */ - if (!dev->tp_valid) { - dev->tp_valid = 1; + /* control response ignored */ + if (dev->tp_urb->actual_length == 2) goto exit; - } if (report_tp_state(dev, dev->tp_urb->actual_length)) { dprintk(1, "bcm5974: bad trackpad package, length: %d\n", @@ -434,18 +409,21 @@ static int atp_open(struct input_dev *input) struct atp *dev = input_get_drvdata(input); if (!dev->open) { + if (atp_wellspring_mode(dev)) + printk(KERN_INFO "bcm5974: mode switch failed\n"); + if (usb_submit_urb(dev->bt_urb, GFP_KERNEL)) goto error; if (usb_submit_urb(dev->tp_urb, GFP_KERNEL)) - goto err_free_bt_urb; + goto err_kill_bt; } dev->open = 1; dev->suspended = 0; return 0; -err_free_bt_urb: - usb_free_urb(dev->bt_urb); +err_kill_bt: + usb_kill_urb(dev->bt_urb); error: return -EIO; } @@ -486,12 +464,6 @@ static int atp_probe(struct usb_interface *iface, dev->input = input_dev; dev->cfg = *cfg; - /* switch to raw sensor mode */ - if (atp_wellspring_init(dev)) { - error = -EIO; - goto err_free_devs; - } - dev->bt_urb = usb_alloc_urb(0, GFP_KERNEL); if (!dev->bt_urb) { error = -ENOMEM; @@ -631,35 +603,12 @@ static int atp_resume(struct usb_interface *iface) return error; } -static int atp_reset_resume(struct usb_interface *iface) -{ - struct atp *dev = usb_get_intfdata(iface); - - if (dev && atp_wellspring_init(dev)) - printk(KERN_INFO "bcm5974: warning: reset failed\n"); - - return atp_resume(iface); -} - -static int atp_pre_reset(struct usb_interface *iface) -{ - return atp_suspend(iface, PMSG_ON); -} - -static int atp_post_reset(struct usb_interface *iface) -{ - return atp_reset_resume(iface); -} - static struct usb_driver atp_driver = { .name = "bcm5974", .probe = atp_probe, .disconnect = atp_disconnect, .suspend = atp_suspend, .resume = atp_resume, - .reset_resume = atp_reset_resume, - .pre_reset = atp_pre_reset, - .post_reset = atp_post_reset, .id_table = atp_table, }; diff --git a/dkms.conf b/dkms.conf index 44076e7..93e97f3 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="bcm5974" -PACKAGE_VERSION="0.55" +PACKAGE_VERSION="0.56" MAKE[0]="make -C ${kernel_source_dir} SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules" BUILT_MODULE_NAME[0]="bcm5974" diff --git a/scripts/bcm5974-diagnostics b/scripts/bcm5974-diagnostics index bacc02e..acd0bf4 100755 --- a/scripts/bcm5974-diagnostics +++ b/scripts/bcm5974-diagnostics @@ -138,15 +138,6 @@ else echo \* $DEVPATH: does not exist, ignore fi -# Was the $DRIVER properly initialized? -WELLSPRING=`dmesg|grep $DRIVER|grep Wellspring` -if [ "$WELLSPRING" != "" ]; then - echo \* $DRIVER: Wellspring was initialized -else - echo \* $DRIVER: Wellspring was NOT initialized - exit 1 -fi - # Do we have synaptics working properly? typeset -i SYNLINES=`synclient -l|wc -l` if [ $SYNLINES -gt 10 ]; then diff --git a/scripts/bcm5974-pre-install b/scripts/bcm5974-pre-install index 3c4556e..1e2b864 100755 --- a/scripts/bcm5974-pre-install +++ b/scripts/bcm5974-pre-install @@ -25,19 +25,18 @@ LSUSB=/usr/sbin/lsusb PAT[0]="05ac:022" PAT[1]="05ac:023" -#if [ -x $LSUSB ]; then -if true; then +if [ -x $LSUSB ]; then if [ "`$LSUSB|grep ${PAT[0]}`" != "" ]; then exit 0 elif [ "`$LSUSB|grep ${PAT[1]}`" != "" ]; then exit 0 else echo bcm5974: no suitable device found - exit 1 + exit -1 fi else echo bcm5974: cannot determine device type - exit 1 + exit -1 fi exit 0 -- cgit v1.2.3