diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-07-25 01:43:04 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-07-25 01:43:04 -0400 |
| commit | 314820c9e892d8f41ba4db300ec96770d9c8294b (patch) | |
| tree | 3d5c59a429239b180c77e57f998a78d3f2b79827 /drivers/input | |
| parent | e76b8ee25e034ab601b525abb95cea14aa167ed3 (diff) | |
| parent | 07b8481d4aff73d6f451f25e74ea10240ff5131e (diff) | |
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/input')
46 files changed, 2016 insertions, 745 deletions
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c index 117a59aaa70e..b107922514fb 100644 --- a/drivers/input/ff-memless.c +++ b/drivers/input/ff-memless.c | |||
| @@ -31,8 +31,7 @@ | |||
| 31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
| 32 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
| 33 | #include <linux/jiffies.h> | 33 | #include <linux/jiffies.h> |
| 34 | 34 | #include <linux/fixp-arith.h> | |
| 35 | #include "fixp-arith.h" | ||
| 36 | 35 | ||
| 37 | MODULE_LICENSE("GPL"); | 36 | MODULE_LICENSE("GPL"); |
| 38 | MODULE_AUTHOR("Anssi Hannula <anssi.hannula@gmail.com>"); | 37 | MODULE_AUTHOR("Anssi Hannula <anssi.hannula@gmail.com>"); |
| @@ -177,7 +176,7 @@ static int apply_envelope(struct ml_effect_state *state, int value, | |||
| 177 | value, envelope->attack_level); | 176 | value, envelope->attack_level); |
| 178 | time_from_level = jiffies_to_msecs(now - state->play_at); | 177 | time_from_level = jiffies_to_msecs(now - state->play_at); |
| 179 | time_of_envelope = envelope->attack_length; | 178 | time_of_envelope = envelope->attack_length; |
| 180 | envelope_level = min_t(__s16, envelope->attack_level, 0x7fff); | 179 | envelope_level = min_t(u16, envelope->attack_level, 0x7fff); |
| 181 | 180 | ||
| 182 | } else if (envelope->fade_length && effect->replay.length && | 181 | } else if (envelope->fade_length && effect->replay.length && |
| 183 | time_after(now, | 182 | time_after(now, |
| @@ -185,7 +184,7 @@ static int apply_envelope(struct ml_effect_state *state, int value, | |||
| 185 | time_before(now, state->stop_at)) { | 184 | time_before(now, state->stop_at)) { |
| 186 | time_from_level = jiffies_to_msecs(state->stop_at - now); | 185 | time_from_level = jiffies_to_msecs(state->stop_at - now); |
| 187 | time_of_envelope = envelope->fade_length; | 186 | time_of_envelope = envelope->fade_length; |
| 188 | envelope_level = min_t(__s16, envelope->fade_level, 0x7fff); | 187 | envelope_level = min_t(u16, envelope->fade_level, 0x7fff); |
| 189 | } else | 188 | } else |
| 190 | return value; | 189 | return value; |
| 191 | 190 | ||
diff --git a/drivers/input/fixp-arith.h b/drivers/input/fixp-arith.h deleted file mode 100644 index 3089d7382325..000000000000 --- a/drivers/input/fixp-arith.h +++ /dev/null | |||
| @@ -1,87 +0,0 @@ | |||
| 1 | #ifndef _FIXP_ARITH_H | ||
| 2 | #define _FIXP_ARITH_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * Simplistic fixed-point arithmetics. | ||
| 6 | * Hmm, I'm probably duplicating some code :( | ||
| 7 | * | ||
| 8 | * Copyright (c) 2002 Johann Deneux | ||
| 9 | */ | ||
| 10 | |||
| 11 | /* | ||
| 12 | * This program is free software; you can redistribute it and/or modify | ||
| 13 | * it under the terms of the GNU General Public License as published by | ||
| 14 | * the Free Software Foundation; either version 2 of the License, or | ||
| 15 | * (at your option) any later version. | ||
| 16 | * | ||
| 17 | * This program is distributed in the hope that it will be useful, | ||
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | * GNU General Public License for more details. | ||
| 21 | * | ||
| 22 | * You should have received a copy of the GNU General Public License | ||
| 23 | * along with this program; if not, write to the Free Software | ||
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 25 | * | ||
| 26 | * Should you need to contact me, the author, you can do so by | ||
| 27 | * e-mail - mail your message to <johann.deneux@gmail.com> | ||
| 28 | */ | ||
| 29 | |||
| 30 | #include <linux/types.h> | ||
| 31 | |||
| 32 | /* The type representing fixed-point values */ | ||
| 33 | typedef s16 fixp_t; | ||
| 34 | |||
| 35 | #define FRAC_N 8 | ||
| 36 | #define FRAC_MASK ((1<<FRAC_N)-1) | ||
| 37 | |||
| 38 | /* Not to be used directly. Use fixp_{cos,sin} */ | ||
| 39 | static const fixp_t cos_table[46] = { | ||
| 40 | 0x0100, 0x00FF, 0x00FF, 0x00FE, 0x00FD, 0x00FC, 0x00FA, 0x00F8, | ||
| 41 | 0x00F6, 0x00F3, 0x00F0, 0x00ED, 0x00E9, 0x00E6, 0x00E2, 0x00DD, | ||
| 42 | 0x00D9, 0x00D4, 0x00CF, 0x00C9, 0x00C4, 0x00BE, 0x00B8, 0x00B1, | ||
| 43 | 0x00AB, 0x00A4, 0x009D, 0x0096, 0x008F, 0x0087, 0x0080, 0x0078, | ||
| 44 | 0x0070, 0x0068, 0x005F, 0x0057, 0x004F, 0x0046, 0x003D, 0x0035, | ||
| 45 | 0x002C, 0x0023, 0x001A, 0x0011, 0x0008, 0x0000 | ||
| 46 | }; | ||
| 47 | |||
| 48 | |||
| 49 | /* a: 123 -> 123.0 */ | ||
| 50 | static inline fixp_t fixp_new(s16 a) | ||
| 51 | { | ||
| 52 | return a<<FRAC_N; | ||
| 53 | } | ||
| 54 | |||
| 55 | /* a: 0xFFFF -> -1.0 | ||
| 56 | 0x8000 -> 1.0 | ||
| 57 | 0x0000 -> 0.0 | ||
| 58 | */ | ||
| 59 | static inline fixp_t fixp_new16(s16 a) | ||
| 60 | { | ||
| 61 | return ((s32)a)>>(16-FRAC_N); | ||
| 62 | } | ||
| 63 | |||
| 64 | static inline fixp_t fixp_cos(unsigned int degrees) | ||
| 65 | { | ||
| 66 | int quadrant = (degrees / 90) & 3; | ||
| 67 | unsigned int i = degrees % 90; | ||
| 68 | |||
| 69 | if (quadrant == 1 || quadrant == 3) | ||
| 70 | i = 90 - i; | ||
| 71 | |||
| 72 | i >>= 1; | ||
| 73 | |||
| 74 | return (quadrant == 1 || quadrant == 2)? -cos_table[i] : cos_table[i]; | ||
| 75 | } | ||
| 76 | |||
| 77 | static inline fixp_t fixp_sin(unsigned int degrees) | ||
| 78 | { | ||
| 79 | return -fixp_cos(degrees + 90); | ||
| 80 | } | ||
| 81 | |||
| 82 | static inline fixp_t fixp_mult(fixp_t a, fixp_t b) | ||
| 83 | { | ||
| 84 | return ((s32)(a*b))>>FRAC_N; | ||
| 85 | } | ||
| 86 | |||
| 87 | #endif | ||
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index f658086fbbe0..70a16c7da8cc 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c | |||
| @@ -135,7 +135,7 @@ EXPORT_SYMBOL(input_mt_report_finger_count); | |||
| 135 | */ | 135 | */ |
| 136 | void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) | 136 | void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) |
| 137 | { | 137 | { |
| 138 | struct input_mt_slot *oldest = 0; | 138 | struct input_mt_slot *oldest = NULL; |
| 139 | int oldid = dev->trkid; | 139 | int oldid = dev->trkid; |
| 140 | int count = 0; | 140 | int count = 0; |
| 141 | int i; | 141 | int i; |
diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index feeefcb09e78..c96653b58867 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c | |||
| @@ -231,6 +231,7 @@ static int __devinit as5011_probe(struct i2c_client *client, | |||
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | if (!i2c_check_functionality(client->adapter, | 233 | if (!i2c_check_functionality(client->adapter, |
| 234 | I2C_FUNC_NOSTART | | ||
| 234 | I2C_FUNC_PROTOCOL_MANGLING)) { | 235 | I2C_FUNC_PROTOCOL_MANGLING)) { |
| 235 | dev_err(&client->dev, | 236 | dev_err(&client->dev, |
| 236 | "need i2c bus that supports protocol mangling\n"); | 237 | "need i2c bus that supports protocol mangling\n"); |
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index 405febd94f24..daeeb4c7e3b0 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c | |||
| @@ -317,7 +317,8 @@ int iforce_init_device(struct iforce *iforce) | |||
| 317 | break; | 317 | break; |
| 318 | 318 | ||
| 319 | if (i == 20) { /* 5 seconds */ | 319 | if (i == 20) { /* 5 seconds */ |
| 320 | err("Timeout waiting for response from device."); | 320 | dev_err(&input_dev->dev, |
| 321 | "Timeout waiting for response from device.\n"); | ||
| 321 | error = -ENODEV; | 322 | error = -ENODEV; |
| 322 | goto fail; | 323 | goto fail; |
| 323 | } | 324 | } |
diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c index a17b50016009..08f98f2eaf88 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c | |||
| @@ -257,7 +257,8 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) | |||
| 257 | 257 | ||
| 258 | status = usb_submit_urb(iforce->ctrl, GFP_ATOMIC); | 258 | status = usb_submit_urb(iforce->ctrl, GFP_ATOMIC); |
| 259 | if (status) { | 259 | if (status) { |
| 260 | err("usb_submit_urb failed %d", status); | 260 | dev_err(&iforce->intf->dev, |
| 261 | "usb_submit_urb failed %d\n", status); | ||
| 261 | return -1; | 262 | return -1; |
| 262 | } | 263 | } |
| 263 | 264 | ||
| @@ -265,12 +266,14 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) | |||
| 265 | iforce->ctrl->status != -EINPROGRESS, HZ); | 266 | iforce->ctrl->status != -EINPROGRESS, HZ); |
| 266 | 267 | ||
| 267 | if (iforce->ctrl->status) { | 268 | if (iforce->ctrl->status) { |
| 268 | dbg("iforce->ctrl->status = %d", iforce->ctrl->status); | 269 | dev_dbg(&iforce->intf->dev, |
| 270 | "iforce->ctrl->status = %d\n", | ||
| 271 | iforce->ctrl->status); | ||
| 269 | usb_unlink_urb(iforce->ctrl); | 272 | usb_unlink_urb(iforce->ctrl); |
| 270 | return -1; | 273 | return -1; |
| 271 | } | 274 | } |
| 272 | #else | 275 | #else |
| 273 | dbg("iforce_get_id_packet: iforce->bus = USB!"); | 276 | printk(KERN_DEBUG "iforce_get_id_packet: iforce->bus = USB!\n"); |
| 274 | #endif | 277 | #endif |
| 275 | } | 278 | } |
| 276 | break; | 279 | break; |
| @@ -289,12 +292,15 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) | |||
| 289 | return -1; | 292 | return -1; |
| 290 | } | 293 | } |
| 291 | #else | 294 | #else |
| 292 | err("iforce_get_id_packet: iforce->bus = SERIO!"); | 295 | dev_err(&iforce->dev->dev, |
| 296 | "iforce_get_id_packet: iforce->bus = SERIO!\n"); | ||
| 293 | #endif | 297 | #endif |
| 294 | break; | 298 | break; |
| 295 | 299 | ||
| 296 | default: | 300 | default: |
| 297 | err("iforce_get_id_packet: iforce->bus = %d", iforce->bus); | 301 | dev_err(&iforce->dev->dev, |
| 302 | "iforce_get_id_packet: iforce->bus = %d\n", | ||
| 303 | iforce->bus); | ||
| 298 | break; | 304 | break; |
| 299 | } | 305 | } |
| 300 | 306 | ||
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 6c96631ae5d9..d96aa27dfcdc 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c | |||
| @@ -64,7 +64,7 @@ void iforce_usb_xmit(struct iforce *iforce) | |||
| 64 | 64 | ||
| 65 | if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { | 65 | if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { |
| 66 | clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); | 66 | clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); |
| 67 | dev_warn(&iforce->dev->dev, "usb_submit_urb failed %d\n", n); | 67 | dev_warn(&iforce->intf->dev, "usb_submit_urb failed %d\n", n); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. | 70 | /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. |
| @@ -76,6 +76,7 @@ void iforce_usb_xmit(struct iforce *iforce) | |||
| 76 | static void iforce_usb_irq(struct urb *urb) | 76 | static void iforce_usb_irq(struct urb *urb) |
| 77 | { | 77 | { |
| 78 | struct iforce *iforce = urb->context; | 78 | struct iforce *iforce = urb->context; |
| 79 | struct device *dev = &iforce->intf->dev; | ||
| 79 | int status; | 80 | int status; |
| 80 | 81 | ||
| 81 | switch (urb->status) { | 82 | switch (urb->status) { |
| @@ -86,11 +87,12 @@ static void iforce_usb_irq(struct urb *urb) | |||
| 86 | case -ENOENT: | 87 | case -ENOENT: |
| 87 | case -ESHUTDOWN: | 88 | case -ESHUTDOWN: |
| 88 | /* this urb is terminated, clean up */ | 89 | /* this urb is terminated, clean up */ |
| 89 | dbg("%s - urb shutting down with status: %d", | 90 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", |
| 90 | __func__, urb->status); | 91 | __func__, urb->status); |
| 91 | return; | 92 | return; |
| 92 | default: | 93 | default: |
| 93 | dbg("%s - urb has status of: %d", __func__, urb->status); | 94 | dev_dbg(dev, "%s - urb has status of: %d\n", |
| 95 | __func__, urb->status); | ||
| 94 | goto exit; | 96 | goto exit; |
| 95 | } | 97 | } |
| 96 | 98 | ||
| @@ -100,8 +102,8 @@ static void iforce_usb_irq(struct urb *urb) | |||
| 100 | exit: | 102 | exit: |
| 101 | status = usb_submit_urb (urb, GFP_ATOMIC); | 103 | status = usb_submit_urb (urb, GFP_ATOMIC); |
| 102 | if (status) | 104 | if (status) |
| 103 | err ("%s - usb_submit_urb failed with result %d", | 105 | dev_err(dev, "%s - usb_submit_urb failed with result %d\n", |
| 104 | __func__, status); | 106 | __func__, status); |
| 105 | } | 107 | } |
| 106 | 108 | ||
| 107 | static void iforce_usb_out(struct urb *urb) | 109 | static void iforce_usb_out(struct urb *urb) |
| @@ -110,7 +112,8 @@ static void iforce_usb_out(struct urb *urb) | |||
| 110 | 112 | ||
| 111 | if (urb->status) { | 113 | if (urb->status) { |
| 112 | clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); | 114 | clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); |
| 113 | dbg("urb->status %d, exiting", urb->status); | 115 | dev_dbg(&iforce->intf->dev, "urb->status %d, exiting\n", |
| 116 | urb->status); | ||
| 114 | return; | 117 | return; |
| 115 | } | 118 | } |
| 116 | 119 | ||
| @@ -155,6 +158,7 @@ static int iforce_usb_probe(struct usb_interface *intf, | |||
| 155 | 158 | ||
| 156 | iforce->bus = IFORCE_USB; | 159 | iforce->bus = IFORCE_USB; |
| 157 | iforce->usbdev = dev; | 160 | iforce->usbdev = dev; |
| 161 | iforce->intf = intf; | ||
| 158 | 162 | ||
| 159 | iforce->cr.bRequestType = USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_INTERFACE; | 163 | iforce->cr.bRequestType = USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_INTERFACE; |
| 160 | iforce->cr.wIndex = 0; | 164 | iforce->cr.wIndex = 0; |
diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h index 9f494b75848a..b1d7d9b0eb86 100644 --- a/drivers/input/joystick/iforce/iforce.h +++ b/drivers/input/joystick/iforce/iforce.h | |||
| @@ -115,6 +115,7 @@ struct iforce { | |||
| 115 | #endif | 115 | #endif |
| 116 | #ifdef CONFIG_JOYSTICK_IFORCE_USB | 116 | #ifdef CONFIG_JOYSTICK_IFORCE_USB |
| 117 | struct usb_device *usbdev; /* USB transfer */ | 117 | struct usb_device *usbdev; /* USB transfer */ |
| 118 | struct usb_interface *intf; | ||
| 118 | struct urb *irq, *out, *ctrl; | 119 | struct urb *irq, *out, *ctrl; |
| 119 | struct usb_ctrlrequest cr; | 120 | struct usb_ctrlrequest cr; |
| 120 | #endif | 121 | #endif |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 42f7b257feb0..83811e45d633 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
| @@ -256,6 +256,7 @@ MODULE_DEVICE_TABLE (usb, xpad_table); | |||
| 256 | struct usb_xpad { | 256 | struct usb_xpad { |
| 257 | struct input_dev *dev; /* input device interface */ | 257 | struct input_dev *dev; /* input device interface */ |
| 258 | struct usb_device *udev; /* usb device */ | 258 | struct usb_device *udev; /* usb device */ |
| 259 | struct usb_interface *intf; /* usb interface */ | ||
| 259 | 260 | ||
| 260 | int pad_present; | 261 | int pad_present; |
| 261 | 262 | ||
| @@ -461,6 +462,7 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha | |||
| 461 | static void xpad_irq_in(struct urb *urb) | 462 | static void xpad_irq_in(struct urb *urb) |
| 462 | { | 463 | { |
| 463 | struct usb_xpad *xpad = urb->context; | 464 | struct usb_xpad *xpad = urb->context; |
| 465 | struct device *dev = &xpad->intf->dev; | ||
| 464 | int retval, status; | 466 | int retval, status; |
| 465 | 467 | ||
| 466 | status = urb->status; | 468 | status = urb->status; |
| @@ -473,11 +475,11 @@ static void xpad_irq_in(struct urb *urb) | |||
| 473 | case -ENOENT: | 475 | case -ENOENT: |
| 474 | case -ESHUTDOWN: | 476 | case -ESHUTDOWN: |
| 475 | /* this urb is terminated, clean up */ | 477 | /* this urb is terminated, clean up */ |
| 476 | dbg("%s - urb shutting down with status: %d", | 478 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", |
| 477 | __func__, status); | 479 | __func__, status); |
| 478 | return; | 480 | return; |
| 479 | default: | 481 | default: |
| 480 | dbg("%s - nonzero urb status received: %d", | 482 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", |
| 481 | __func__, status); | 483 | __func__, status); |
| 482 | goto exit; | 484 | goto exit; |
| 483 | } | 485 | } |
| @@ -496,12 +498,15 @@ static void xpad_irq_in(struct urb *urb) | |||
| 496 | exit: | 498 | exit: |
| 497 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 499 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
| 498 | if (retval) | 500 | if (retval) |
| 499 | err ("%s - usb_submit_urb failed with result %d", | 501 | dev_err(dev, "%s - usb_submit_urb failed with result %d\n", |
| 500 | __func__, retval); | 502 | __func__, retval); |
| 501 | } | 503 | } |
| 502 | 504 | ||
| 503 | static void xpad_bulk_out(struct urb *urb) | 505 | static void xpad_bulk_out(struct urb *urb) |
| 504 | { | 506 | { |
| 507 | struct usb_xpad *xpad = urb->context; | ||
| 508 | struct device *dev = &xpad->intf->dev; | ||
| 509 | |||
| 505 | switch (urb->status) { | 510 | switch (urb->status) { |
| 506 | case 0: | 511 | case 0: |
| 507 | /* success */ | 512 | /* success */ |
| @@ -510,16 +515,20 @@ static void xpad_bulk_out(struct urb *urb) | |||
| 510 | case -ENOENT: | 515 | case -ENOENT: |
| 511 | case -ESHUTDOWN: | 516 | case -ESHUTDOWN: |
| 512 | /* this urb is terminated, clean up */ | 517 | /* this urb is terminated, clean up */ |
| 513 | dbg("%s - urb shutting down with status: %d", __func__, urb->status); | 518 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", |
| 519 | __func__, urb->status); | ||
| 514 | break; | 520 | break; |
| 515 | default: | 521 | default: |
| 516 | dbg("%s - nonzero urb status received: %d", __func__, urb->status); | 522 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", |
| 523 | __func__, urb->status); | ||
| 517 | } | 524 | } |
| 518 | } | 525 | } |
| 519 | 526 | ||
| 520 | #if defined(CONFIG_JOYSTICK_XPAD_FF) || defined(CONFIG_JOYSTICK_XPAD_LEDS) | 527 | #if defined(CONFIG_JOYSTICK_XPAD_FF) || defined(CONFIG_JOYSTICK_XPAD_LEDS) |
| 521 | static void xpad_irq_out(struct urb *urb) | 528 | static void xpad_irq_out(struct urb *urb) |
| 522 | { | 529 | { |
| 530 | struct usb_xpad *xpad = urb->context; | ||
| 531 | struct device *dev = &xpad->intf->dev; | ||
| 523 | int retval, status; | 532 | int retval, status; |
| 524 | 533 | ||
| 525 | status = urb->status; | 534 | status = urb->status; |
| @@ -533,19 +542,21 @@ static void xpad_irq_out(struct urb *urb) | |||
| 533 | case -ENOENT: | 542 | case -ENOENT: |
| 534 | case -ESHUTDOWN: | 543 | case -ESHUTDOWN: |
| 535 | /* this urb is terminated, clean up */ | 544 | /* this urb is terminated, clean up */ |
| 536 | dbg("%s - urb shutting down with status: %d", __func__, status); | 545 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", |
| 546 | __func__, status); | ||
| 537 | return; | 547 | return; |
| 538 | 548 | ||
| 539 | default: | 549 | default: |
| 540 | dbg("%s - nonzero urb status received: %d", __func__, status); | 550 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", |
| 551 | __func__, status); | ||
| 541 | goto exit; | 552 | goto exit; |
| 542 | } | 553 | } |
| 543 | 554 | ||
| 544 | exit: | 555 | exit: |
| 545 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 556 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
| 546 | if (retval) | 557 | if (retval) |
| 547 | err("%s - usb_submit_urb failed with result %d", | 558 | dev_err(dev, "%s - usb_submit_urb failed with result %d\n", |
| 548 | __func__, retval); | 559 | __func__, retval); |
| 549 | } | 560 | } |
| 550 | 561 | ||
| 551 | static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) | 562 | static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) |
| @@ -658,7 +669,8 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect | |||
| 658 | return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); | 669 | return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); |
| 659 | 670 | ||
| 660 | default: | 671 | default: |
| 661 | dbg("%s - rumble command sent to unsupported xpad type: %d", | 672 | dev_dbg(&xpad->dev->dev, |
| 673 | "%s - rumble command sent to unsupported xpad type: %d\n", | ||
| 662 | __func__, xpad->xtype); | 674 | __func__, xpad->xtype); |
| 663 | return -1; | 675 | return -1; |
| 664 | } | 676 | } |
| @@ -848,6 +860,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
| 848 | } | 860 | } |
| 849 | 861 | ||
| 850 | xpad->udev = udev; | 862 | xpad->udev = udev; |
| 863 | xpad->intf = intf; | ||
| 851 | xpad->mapping = xpad_device[i].mapping; | 864 | xpad->mapping = xpad_device[i].mapping; |
| 852 | xpad->xtype = xpad_device[i].xtype; | 865 | xpad->xtype = xpad_device[i].xtype; |
| 853 | 866 | ||
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index c0e11ecc646f..c50fa75416f8 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
| @@ -332,6 +332,16 @@ config KEYBOARD_LOCOMO | |||
| 332 | To compile this driver as a module, choose M here: the | 332 | To compile this driver as a module, choose M here: the |
| 333 | module will be called locomokbd. | 333 | module will be called locomokbd. |
| 334 | 334 | ||
| 335 | config KEYBOARD_LPC32XX | ||
| 336 | tristate "LPC32XX matrix key scanner support" | ||
| 337 | depends on ARCH_LPC32XX && OF | ||
| 338 | help | ||
| 339 | Say Y here if you want to use NXP LPC32XX SoC key scanner interface, | ||
| 340 | connected to a key matrix. | ||
| 341 | |||
| 342 | To compile this driver as a module, choose M here: the | ||
| 343 | module will be called lpc32xx-keys. | ||
| 344 | |||
| 335 | config KEYBOARD_MAPLE | 345 | config KEYBOARD_MAPLE |
| 336 | tristate "Maple bus keyboard" | 346 | tristate "Maple bus keyboard" |
| 337 | depends on SH_DREAMCAST && MAPLE | 347 | depends on SH_DREAMCAST && MAPLE |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index b03b02456a82..44e76002f54b 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
| @@ -26,6 +26,7 @@ obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o | |||
| 26 | obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o | 26 | obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o |
| 27 | obj-$(CONFIG_KEYBOARD_LM8333) += lm8333.o | 27 | obj-$(CONFIG_KEYBOARD_LM8333) += lm8333.o |
| 28 | obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o | 28 | obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o |
| 29 | obj-$(CONFIG_KEYBOARD_LPC32XX) += lpc32xx-keys.o | ||
| 29 | obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o | 30 | obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o |
| 30 | obj-$(CONFIG_KEYBOARD_MATRIX) += matrix_keypad.o | 31 | obj-$(CONFIG_KEYBOARD_MATRIX) += matrix_keypad.o |
| 31 | obj-$(CONFIG_KEYBOARD_MAX7359) += max7359_keypad.o | 32 | obj-$(CONFIG_KEYBOARD_MAX7359) += max7359_keypad.o |
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 62bfce468f9f..cbb1add43d5e 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
| @@ -559,7 +559,6 @@ static int gpio_keys_get_devtree_pdata(struct device *dev, | |||
| 559 | pdata->rep = !!of_get_property(node, "autorepeat", NULL); | 559 | pdata->rep = !!of_get_property(node, "autorepeat", NULL); |
| 560 | 560 | ||
| 561 | /* First count the subnodes */ | 561 | /* First count the subnodes */ |
| 562 | pdata->nbuttons = 0; | ||
| 563 | pp = NULL; | 562 | pp = NULL; |
| 564 | while ((pp = of_get_next_child(node, pp))) | 563 | while ((pp = of_get_next_child(node, pp))) |
| 565 | pdata->nbuttons++; | 564 | pdata->nbuttons++; |
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index 6ee7421e2321..ff4c0a87a25f 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c | |||
| @@ -378,20 +378,24 @@ static void imx_keypad_close(struct input_dev *dev) | |||
| 378 | imx_keypad_inhibit(keypad); | 378 | imx_keypad_inhibit(keypad); |
| 379 | 379 | ||
| 380 | /* Disable clock unit */ | 380 | /* Disable clock unit */ |
| 381 | clk_disable(keypad->clk); | 381 | clk_disable_unprepare(keypad->clk); |
| 382 | } | 382 | } |
| 383 | 383 | ||
| 384 | static int imx_keypad_open(struct input_dev *dev) | 384 | static int imx_keypad_open(struct input_dev *dev) |
| 385 | { | 385 | { |
| 386 | struct imx_keypad *keypad = input_get_drvdata(dev); | 386 | struct imx_keypad *keypad = input_get_drvdata(dev); |
| 387 | int error; | ||
| 387 | 388 | ||
| 388 | dev_dbg(&dev->dev, ">%s\n", __func__); | 389 | dev_dbg(&dev->dev, ">%s\n", __func__); |
| 389 | 390 | ||
| 391 | /* Enable the kpp clock */ | ||
| 392 | error = clk_prepare_enable(keypad->clk); | ||
| 393 | if (error) | ||
| 394 | return error; | ||
| 395 | |||
| 390 | /* We became active from now */ | 396 | /* We became active from now */ |
| 391 | keypad->enabled = true; | 397 | keypad->enabled = true; |
| 392 | 398 | ||
| 393 | /* Enable the kpp clock */ | ||
| 394 | clk_enable(keypad->clk); | ||
| 395 | imx_keypad_config(keypad); | 399 | imx_keypad_config(keypad); |
| 396 | 400 | ||
| 397 | /* Sanity control, not all the rows must be actived now. */ | 401 | /* Sanity control, not all the rows must be actived now. */ |
| @@ -467,7 +471,7 @@ static int __devinit imx_keypad_probe(struct platform_device *pdev) | |||
| 467 | goto failed_free_priv; | 471 | goto failed_free_priv; |
| 468 | } | 472 | } |
| 469 | 473 | ||
| 470 | keypad->clk = clk_get(&pdev->dev, "kpp"); | 474 | keypad->clk = clk_get(&pdev->dev, NULL); |
| 471 | if (IS_ERR(keypad->clk)) { | 475 | if (IS_ERR(keypad->clk)) { |
| 472 | dev_err(&pdev->dev, "failed to get keypad clock\n"); | 476 | dev_err(&pdev->dev, "failed to get keypad clock\n"); |
| 473 | error = PTR_ERR(keypad->clk); | 477 | error = PTR_ERR(keypad->clk); |
| @@ -581,7 +585,7 @@ static int imx_kbd_suspend(struct device *dev) | |||
| 581 | mutex_lock(&input_dev->mutex); | 585 | mutex_lock(&input_dev->mutex); |
| 582 | 586 | ||
| 583 | if (input_dev->users) | 587 | if (input_dev->users) |
| 584 | clk_disable(kbd->clk); | 588 | clk_disable_unprepare(kbd->clk); |
| 585 | 589 | ||
| 586 | mutex_unlock(&input_dev->mutex); | 590 | mutex_unlock(&input_dev->mutex); |
| 587 | 591 | ||
| @@ -596,18 +600,23 @@ static int imx_kbd_resume(struct device *dev) | |||
| 596 | struct platform_device *pdev = to_platform_device(dev); | 600 | struct platform_device *pdev = to_platform_device(dev); |
| 597 | struct imx_keypad *kbd = platform_get_drvdata(pdev); | 601 | struct imx_keypad *kbd = platform_get_drvdata(pdev); |
| 598 | struct input_dev *input_dev = kbd->input_dev; | 602 | struct input_dev *input_dev = kbd->input_dev; |
| 603 | int ret = 0; | ||
| 599 | 604 | ||
| 600 | if (device_may_wakeup(&pdev->dev)) | 605 | if (device_may_wakeup(&pdev->dev)) |
| 601 | disable_irq_wake(kbd->irq); | 606 | disable_irq_wake(kbd->irq); |
| 602 | 607 | ||
| 603 | mutex_lock(&input_dev->mutex); | 608 | mutex_lock(&input_dev->mutex); |
| 604 | 609 | ||
| 605 | if (input_dev->users) | 610 | if (input_dev->users) { |
| 606 | clk_enable(kbd->clk); | 611 | ret = clk_prepare_enable(kbd->clk); |
| 612 | if (ret) | ||
| 613 | goto err_clk; | ||
| 614 | } | ||
| 607 | 615 | ||
| 616 | err_clk: | ||
| 608 | mutex_unlock(&input_dev->mutex); | 617 | mutex_unlock(&input_dev->mutex); |
| 609 | 618 | ||
| 610 | return 0; | 619 | return ret; |
| 611 | } | 620 | } |
| 612 | #endif | 621 | #endif |
| 613 | 622 | ||
diff --git a/drivers/input/keyboard/lpc32xx-keys.c b/drivers/input/keyboard/lpc32xx-keys.c new file mode 100644 index 000000000000..dd786c8a7584 --- /dev/null +++ b/drivers/input/keyboard/lpc32xx-keys.c | |||
| @@ -0,0 +1,394 @@ | |||
| 1 | /* | ||
| 2 | * NXP LPC32xx SoC Key Scan Interface | ||
| 3 | * | ||
| 4 | * Authors: | ||
| 5 | * Kevin Wells <kevin.wells@nxp.com> | ||
| 6 | * Roland Stigge <stigge@antcom.de> | ||
| 7 | * | ||
| 8 | * Copyright (C) 2010 NXP Semiconductors | ||
| 9 | * Copyright (C) 2012 Roland Stigge | ||
| 10 | * | ||
| 11 | * This program is free software; you can redistribute it and/or modify | ||
| 12 | * it under the terms of the GNU General Public License as published by | ||
| 13 | * the Free Software Foundation; either version 2 of the License, or | ||
| 14 | * (at your option) any later version. | ||
| 15 | * | ||
| 16 | * This program is distributed in the hope that it will be useful, | ||
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | * GNU General Public License for more details. | ||
| 20 | * | ||
| 21 | * | ||
| 22 | * This controller supports square key matrices from 1x1 up to 8x8 | ||
| 23 | */ | ||
| 24 | |||
| 25 | #include <linux/module.h> | ||
| 26 | #include <linux/interrupt.h> | ||
| 27 | #include <linux/slab.h> | ||
| 28 | #include <linux/irq.h> | ||
| 29 | #include <linux/pm.h> | ||
| 30 | #include <linux/platform_device.h> | ||
| 31 | #include <linux/input.h> | ||
| 32 | #include <linux/clk.h> | ||
| 33 | #include <linux/io.h> | ||
| 34 | #include <linux/of.h> | ||
| 35 | #include <linux/input/matrix_keypad.h> | ||
| 36 | |||
| 37 | #define DRV_NAME "lpc32xx_keys" | ||
| 38 | |||
| 39 | /* | ||
| 40 | * Key scanner register offsets | ||
| 41 | */ | ||
| 42 | #define LPC32XX_KS_DEB(x) ((x) + 0x00) | ||
| 43 | #define LPC32XX_KS_STATE_COND(x) ((x) + 0x04) | ||
| 44 | #define LPC32XX_KS_IRQ(x) ((x) + 0x08) | ||
| 45 | #define LPC32XX_KS_SCAN_CTL(x) ((x) + 0x0C) | ||
| 46 | #define LPC32XX_KS_FAST_TST(x) ((x) + 0x10) | ||
| 47 | #define LPC32XX_KS_MATRIX_DIM(x) ((x) + 0x14) /* 1..8 */ | ||
| 48 | #define LPC32XX_KS_DATA(x, y) ((x) + 0x40 + ((y) << 2)) | ||
| 49 | |||
| 50 | #define LPC32XX_KSCAN_DEB_NUM_DEB_PASS(n) ((n) & 0xFF) | ||
| 51 | |||
| 52 | #define LPC32XX_KSCAN_SCOND_IN_IDLE 0x0 | ||
| 53 | #define LPC32XX_KSCAN_SCOND_IN_SCANONCE 0x1 | ||
| 54 | #define LPC32XX_KSCAN_SCOND_IN_IRQGEN 0x2 | ||
| 55 | #define LPC32XX_KSCAN_SCOND_IN_SCAN_MATRIX 0x3 | ||
| 56 | |||
| 57 | #define LPC32XX_KSCAN_IRQ_PENDING_CLR 0x1 | ||
| 58 | |||
| 59 | #define LPC32XX_KSCAN_SCTRL_SCAN_DELAY(n) ((n) & 0xFF) | ||
| 60 | |||
| 61 | #define LPC32XX_KSCAN_FTST_FORCESCANONCE 0x1 | ||
| 62 | #define LPC32XX_KSCAN_FTST_USE32K_CLK 0x2 | ||
| 63 | |||
| 64 | #define LPC32XX_KSCAN_MSEL_SELECT(n) ((n) & 0xF) | ||
| 65 | |||
| 66 | struct lpc32xx_kscan_drv { | ||
| 67 | struct input_dev *input; | ||
| 68 | struct clk *clk; | ||
| 69 | struct resource *iores; | ||
| 70 | void __iomem *kscan_base; | ||
| 71 | unsigned int irq; | ||
| 72 | |||
| 73 | u32 matrix_sz; /* Size of matrix in XxY, ie. 3 = 3x3 */ | ||
| 74 | u32 deb_clks; /* Debounce clocks (based on 32KHz clock) */ | ||
| 75 | u32 scan_delay; /* Scan delay (based on 32KHz clock) */ | ||
| 76 | |||
| 77 | unsigned short *keymap; /* Pointer to key map for the scan matrix */ | ||
| 78 | unsigned int row_shift; | ||
| 79 | |||
| 80 | u8 lastkeystates[8]; | ||
| 81 | }; | ||
| 82 | |||
| 83 | static void lpc32xx_mod_states(struct lpc32xx_kscan_drv *kscandat, int col) | ||
| 84 | { | ||
| 85 | struct input_dev *input = kscandat->input; | ||
| 86 | unsigned row, changed, scancode, keycode; | ||
| 87 | u8 key; | ||
| 88 | |||
| 89 | key = readl(LPC32XX_KS_DATA(kscandat->kscan_base, col)); | ||
| 90 | changed = key ^ kscandat->lastkeystates[col]; | ||
| 91 | kscandat->lastkeystates[col] = key; | ||
| 92 | |||
| 93 | for (row = 0; changed; row++, changed >>= 1) { | ||
| 94 | if (changed & 1) { | ||
| 95 | /* Key state changed, signal an event */ | ||
| 96 | scancode = MATRIX_SCAN_CODE(row, col, | ||
| 97 | kscandat->row_shift); | ||
| 98 | keycode = kscandat->keymap[scancode]; | ||
| 99 | input_event(input, EV_MSC, MSC_SCAN, scancode); | ||
| 100 | input_report_key(input, keycode, key & (1 << row)); | ||
| 101 | } | ||
| 102 | } | ||
| 103 | } | ||
| 104 | |||
| 105 | static irqreturn_t lpc32xx_kscan_irq(int irq, void *dev_id) | ||
| 106 | { | ||
| 107 | struct lpc32xx_kscan_drv *kscandat = dev_id; | ||
| 108 | int i; | ||
| 109 | |||
| 110 | for (i = 0; i < kscandat->matrix_sz; i++) | ||
| 111 | lpc32xx_mod_states(kscandat, i); | ||
| 112 | |||
| 113 | writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); | ||
| 114 | |||
| 115 | input_sync(kscandat->input); | ||
| 116 | |||
| 117 | return IRQ_HANDLED; | ||
| 118 | } | ||
| 119 | |||
| 120 | static int lpc32xx_kscan_open(struct input_dev *dev) | ||
| 121 | { | ||
| 122 | struct lpc32xx_kscan_drv *kscandat = input_get_drvdata(dev); | ||
| 123 | int error; | ||
| 124 | |||
| 125 | error = clk_prepare_enable(kscandat->clk); | ||
| 126 | if (error) | ||
| 127 | return error; | ||
| 128 | |||
| 129 | writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); | ||
| 130 | |||
| 131 | return 0; | ||
| 132 | } | ||
| 133 | |||
| 134 | static void lpc32xx_kscan_close(struct input_dev *dev) | ||
| 135 | { | ||
| 136 | struct lpc32xx_kscan_drv *kscandat = input_get_drvdata(dev); | ||
| 137 | |||
| 138 | writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); | ||
| 139 | clk_disable_unprepare(kscandat->clk); | ||
| 140 | } | ||
| 141 | |||
| 142 | static int __devinit lpc32xx_parse_dt(struct device *dev, | ||
| 143 | struct lpc32xx_kscan_drv *kscandat) | ||
| 144 | { | ||
| 145 | struct device_node *np = dev->of_node; | ||
| 146 | u32 rows = 0, columns = 0; | ||
| 147 | |||
| 148 | of_property_read_u32(np, "keypad,num-rows", &rows); | ||
| 149 | of_property_read_u32(np, "keypad,num-columns", &columns); | ||
| 150 | if (!rows || rows != columns) { | ||
| 151 | dev_err(dev, | ||
| 152 | "rows and columns must be specified and be equal!\n"); | ||
| 153 | return -EINVAL; | ||
| 154 | } | ||
| 155 | |||
| 156 | kscandat->matrix_sz = rows; | ||
| 157 | kscandat->row_shift = get_count_order(columns); | ||
| 158 | |||
| 159 | of_property_read_u32(np, "nxp,debounce-delay-ms", &kscandat->deb_clks); | ||
| 160 | of_property_read_u32(np, "nxp,scan-delay-ms", &kscandat->scan_delay); | ||
| 161 | if (!kscandat->deb_clks || !kscandat->scan_delay) { | ||
| 162 | dev_err(dev, "debounce or scan delay not specified\n"); | ||
| 163 | return -EINVAL; | ||
| 164 | } | ||
| 165 | |||
| 166 | return 0; | ||
| 167 | } | ||
| 168 | |||
| 169 | static int __devinit lpc32xx_kscan_probe(struct platform_device *pdev) | ||
| 170 | { | ||
| 171 | struct lpc32xx_kscan_drv *kscandat; | ||
| 172 | struct input_dev *input; | ||
| 173 | struct resource *res; | ||
| 174 | size_t keymap_size; | ||
| 175 | int error; | ||
| 176 | int irq; | ||
| 177 | |||
| 178 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 179 | if (!res) { | ||
| 180 | dev_err(&pdev->dev, "failed to get platform I/O memory\n"); | ||
| 181 | return -EINVAL; | ||
| 182 | } | ||
| 183 | |||
| 184 | irq = platform_get_irq(pdev, 0); | ||
| 185 | if (irq < 0 || irq >= NR_IRQS) { | ||
| 186 | dev_err(&pdev->dev, "failed to get platform irq\n"); | ||
| 187 | return -EINVAL; | ||
| 188 | } | ||
| 189 | |||
| 190 | kscandat = kzalloc(sizeof(struct lpc32xx_kscan_drv), GFP_KERNEL); | ||
| 191 | if (!kscandat) { | ||
| 192 | dev_err(&pdev->dev, "failed to allocate memory\n"); | ||
| 193 | return -ENOMEM; | ||
| 194 | } | ||
| 195 | |||
| 196 | error = lpc32xx_parse_dt(&pdev->dev, kscandat); | ||
| 197 | if (error) { | ||
| 198 | dev_err(&pdev->dev, "failed to parse device tree\n"); | ||
| 199 | goto err_free_mem; | ||
| 200 | } | ||
| 201 | |||
| 202 | keymap_size = sizeof(kscandat->keymap[0]) * | ||
| 203 | (kscandat->matrix_sz << kscandat->row_shift); | ||
| 204 | kscandat->keymap = kzalloc(keymap_size, GFP_KERNEL); | ||
| 205 | if (!kscandat->keymap) { | ||
| 206 | dev_err(&pdev->dev, "could not allocate memory for keymap\n"); | ||
| 207 | error = -ENOMEM; | ||
| 208 | goto err_free_mem; | ||
| 209 | } | ||
| 210 | |||
| 211 | kscandat->input = input = input_allocate_device(); | ||
| 212 | if (!input) { | ||
| 213 | dev_err(&pdev->dev, "failed to allocate input device\n"); | ||
| 214 | error = -ENOMEM; | ||
| 215 | goto err_free_keymap; | ||
| 216 | } | ||
| 217 | |||
| 218 | /* Setup key input */ | ||
| 219 | input->name = pdev->name; | ||
| 220 | input->phys = "lpc32xx/input0"; | ||
| 221 | input->id.vendor = 0x0001; | ||
| 222 | input->id.product = 0x0001; | ||
| 223 | input->id.version = 0x0100; | ||
| 224 | input->open = lpc32xx_kscan_open; | ||
| 225 | input->close = lpc32xx_kscan_close; | ||
| 226 | input->dev.parent = &pdev->dev; | ||
| 227 | |||
| 228 | input_set_capability(input, EV_MSC, MSC_SCAN); | ||
| 229 | |||
| 230 | error = matrix_keypad_build_keymap(NULL, NULL, | ||
| 231 | kscandat->matrix_sz, | ||
| 232 | kscandat->matrix_sz, | ||
| 233 | kscandat->keymap, kscandat->input); | ||
| 234 | if (error) { | ||
| 235 | dev_err(&pdev->dev, "failed to build keymap\n"); | ||
| 236 | goto err_free_input; | ||
| 237 | } | ||
| 238 | |||
| 239 | input_set_drvdata(kscandat->input, kscandat); | ||
| 240 | |||
| 241 | kscandat->iores = request_mem_region(res->start, resource_size(res), | ||
| 242 | pdev->name); | ||
| 243 | if (!kscandat->iores) { | ||
| 244 | dev_err(&pdev->dev, "failed to request I/O memory\n"); | ||
| 245 | error = -EBUSY; | ||
| 246 | goto err_free_input; | ||
| 247 | } | ||
| 248 | |||
| 249 | kscandat->kscan_base = ioremap(kscandat->iores->start, | ||
| 250 | resource_size(kscandat->iores)); | ||
| 251 | if (!kscandat->kscan_base) { | ||
| 252 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | ||
| 253 | error = -EBUSY; | ||
| 254 | goto err_release_memregion; | ||
| 255 | } | ||
| 256 | |||
| 257 | /* Get the key scanner clock */ | ||
| 258 | kscandat->clk = clk_get(&pdev->dev, NULL); | ||
| 259 | if (IS_ERR(kscandat->clk)) { | ||
| 260 | dev_err(&pdev->dev, "failed to get clock\n"); | ||
| 261 | error = PTR_ERR(kscandat->clk); | ||
| 262 | goto err_unmap; | ||
| 263 | } | ||
| 264 | |||
| 265 | /* Configure the key scanner */ | ||
| 266 | error = clk_prepare_enable(kscandat->clk); | ||
| 267 | if (error) | ||
| 268 | goto err_clk_put; | ||
| 269 | |||
| 270 | writel(kscandat->deb_clks, LPC32XX_KS_DEB(kscandat->kscan_base)); | ||
| 271 | writel(kscandat->scan_delay, LPC32XX_KS_SCAN_CTL(kscandat->kscan_base)); | ||
| 272 | writel(LPC32XX_KSCAN_FTST_USE32K_CLK, | ||
| 273 | LPC32XX_KS_FAST_TST(kscandat->kscan_base)); | ||
| 274 | writel(kscandat->matrix_sz, | ||
| 275 | LPC32XX_KS_MATRIX_DIM(kscandat->kscan_base)); | ||
| 276 | writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); | ||
| 277 | clk_disable_unprepare(kscandat->clk); | ||
| 278 | |||
| 279 | error = request_irq(irq, lpc32xx_kscan_irq, 0, pdev->name, kscandat); | ||
| 280 | if (error) { | ||
| 281 | dev_err(&pdev->dev, "failed to request irq\n"); | ||
| 282 | goto err_clk_put; | ||
| 283 | } | ||
| 284 | |||
| 285 | error = input_register_device(kscandat->input); | ||
| 286 | if (error) { | ||
| 287 | dev_err(&pdev->dev, "failed to register input device\n"); | ||
| 288 | goto err_free_irq; | ||
| 289 | } | ||
| 290 | |||
| 291 | platform_set_drvdata(pdev, kscandat); | ||
| 292 | return 0; | ||
| 293 | |||
| 294 | err_free_irq: | ||
| 295 | free_irq(irq, kscandat); | ||
| 296 | err_clk_put: | ||
| 297 | clk_put(kscandat->clk); | ||
| 298 | err_unmap: | ||
| 299 | iounmap(kscandat->kscan_base); | ||
| 300 | err_release_memregion: | ||
| 301 | release_mem_region(kscandat->iores->start, | ||
| 302 | resource_size(kscandat->iores)); | ||
| 303 | err_free_input: | ||
| 304 | input_free_device(kscandat->input); | ||
| 305 | err_free_keymap: | ||
| 306 | kfree(kscandat->keymap); | ||
| 307 | err_free_mem: | ||
| 308 | kfree(kscandat); | ||
| 309 | |||
| 310 | return error; | ||
| 311 | } | ||
| 312 | |||
| 313 | static int __devexit lpc32xx_kscan_remove(struct platform_device *pdev) | ||
| 314 | { | ||
| 315 | struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev); | ||
| 316 | |||
| 317 | free_irq(platform_get_irq(pdev, 0), kscandat); | ||
| 318 | clk_put(kscandat->clk); | ||
| 319 | iounmap(kscandat->kscan_base); | ||
| 320 | release_mem_region(kscandat->iores->start, | ||
| 321 | resource_size(kscandat->iores)); | ||
| 322 | input_unregister_device(kscandat->input); | ||
| 323 | kfree(kscandat->keymap); | ||
| 324 | kfree(kscandat); | ||
| 325 | |||
| 326 | return 0; | ||
| 327 | } | ||
| 328 | |||
| 329 | #ifdef CONFIG_PM_SLEEP | ||
| 330 | static int lpc32xx_kscan_suspend(struct device *dev) | ||
| 331 | { | ||
| 332 | struct platform_device *pdev = to_platform_device(dev); | ||
| 333 | struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev); | ||
| 334 | struct input_dev *input = kscandat->input; | ||
| 335 | |||
| 336 | mutex_lock(&input->mutex); | ||
| 337 | |||
| 338 | if (input->users) { | ||
| 339 | /* Clear IRQ and disable clock */ | ||
| 340 | writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); | ||
| 341 | clk_disable_unprepare(kscandat->clk); | ||
| 342 | } | ||
| 343 | |||
| 344 | mutex_unlock(&input->mutex); | ||
| 345 | return 0; | ||
| 346 | } | ||
| 347 | |||
| 348 | static int lpc32xx_kscan_resume(struct device *dev) | ||
| 349 | { | ||
| 350 | struct platform_device *pdev = to_platform_device(dev); | ||
| 351 | struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev); | ||
| 352 | struct input_dev *input = kscandat->input; | ||
| 353 | int retval = 0; | ||
| 354 | |||
| 355 | mutex_lock(&input->mutex); | ||
| 356 | |||
| 357 | if (input->users) { | ||
| 358 | /* Enable clock and clear IRQ */ | ||
| 359 | retval = clk_prepare_enable(kscandat->clk); | ||
| 360 | if (retval == 0) | ||
| 361 | writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); | ||
| 362 | } | ||
| 363 | |||
| 364 | mutex_unlock(&input->mutex); | ||
| 365 | return retval; | ||
| 366 | } | ||
| 367 | #endif | ||
| 368 | |||
| 369 | static SIMPLE_DEV_PM_OPS(lpc32xx_kscan_pm_ops, lpc32xx_kscan_suspend, | ||
| 370 | lpc32xx_kscan_resume); | ||
| 371 | |||
| 372 | static const struct of_device_id lpc32xx_kscan_match[] = { | ||
| 373 | { .compatible = "nxp,lpc3220-key" }, | ||
| 374 | {}, | ||
| 375 | }; | ||
| 376 | MODULE_DEVICE_TABLE(of, lpc32xx_kscan_match); | ||
| 377 | |||
| 378 | static struct platform_driver lpc32xx_kscan_driver = { | ||
| 379 | .probe = lpc32xx_kscan_probe, | ||
| 380 | .remove = __devexit_p(lpc32xx_kscan_remove), | ||
| 381 | .driver = { | ||
| 382 | .name = DRV_NAME, | ||
| 383 | .owner = THIS_MODULE, | ||
| 384 | .pm = &lpc32xx_kscan_pm_ops, | ||
| 385 | .of_match_table = of_match_ptr(lpc32xx_kscan_match), | ||
| 386 | } | ||
| 387 | }; | ||
| 388 | |||
| 389 | module_platform_driver(lpc32xx_kscan_driver); | ||
| 390 | |||
| 391 | MODULE_LICENSE("GPL"); | ||
| 392 | MODULE_AUTHOR("Kevin Wells <kevin.wells@nxp.com>"); | ||
| 393 | MODULE_AUTHOR("Roland Stigge <stigge@antcom.de>"); | ||
| 394 | MODULE_DESCRIPTION("Key scanner driver for LPC32XX devices"); | ||
diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c index 4ea4341a68c5..a880e7414202 100644 --- a/drivers/input/keyboard/nomadik-ske-keypad.c +++ b/drivers/input/keyboard/nomadik-ske-keypad.c | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | #define SKE_ASR3 0x2C | 49 | #define SKE_ASR3 0x2C |
| 50 | 50 | ||
| 51 | #define SKE_NUM_ASRX_REGISTERS (4) | 51 | #define SKE_NUM_ASRX_REGISTERS (4) |
| 52 | #define KEY_PRESSED_DELAY 10 | ||
| 52 | 53 | ||
| 53 | /** | 54 | /** |
| 54 | * struct ske_keypad - data structure used by keypad driver | 55 | * struct ske_keypad - data structure used by keypad driver |
| @@ -92,7 +93,7 @@ static void ske_keypad_set_bits(struct ske_keypad *keypad, u16 addr, | |||
| 92 | static int __init ske_keypad_chip_init(struct ske_keypad *keypad) | 93 | static int __init ske_keypad_chip_init(struct ske_keypad *keypad) |
| 93 | { | 94 | { |
| 94 | u32 value; | 95 | u32 value; |
| 95 | int timeout = 50; | 96 | int timeout = keypad->board->debounce_ms; |
| 96 | 97 | ||
| 97 | /* check SKE_RIS to be 0 */ | 98 | /* check SKE_RIS to be 0 */ |
| 98 | while ((readl(keypad->reg_base + SKE_RIS) != 0x00000000) && timeout--) | 99 | while ((readl(keypad->reg_base + SKE_RIS) != 0x00000000) && timeout--) |
| @@ -135,12 +136,37 @@ static int __init ske_keypad_chip_init(struct ske_keypad *keypad) | |||
| 135 | return 0; | 136 | return 0; |
| 136 | } | 137 | } |
| 137 | 138 | ||
| 138 | static void ske_keypad_read_data(struct ske_keypad *keypad) | 139 | static void ske_keypad_report(struct ske_keypad *keypad, u8 status, int col) |
| 139 | { | 140 | { |
| 141 | int row = 0, code, pos; | ||
| 140 | struct input_dev *input = keypad->input; | 142 | struct input_dev *input = keypad->input; |
| 141 | u16 status; | 143 | u32 ske_ris; |
| 142 | int col = 0, row = 0, code; | 144 | int key_pressed; |
| 143 | int ske_asr, ske_ris, key_pressed, i; | 145 | int num_of_rows; |
| 146 | |||
| 147 | /* find out the row */ | ||
| 148 | num_of_rows = hweight8(status); | ||
| 149 | do { | ||
| 150 | pos = __ffs(status); | ||
| 151 | row = pos; | ||
| 152 | status &= ~(1 << pos); | ||
| 153 | |||
| 154 | code = MATRIX_SCAN_CODE(row, col, SKE_KEYPAD_ROW_SHIFT); | ||
| 155 | ske_ris = readl(keypad->reg_base + SKE_RIS); | ||
| 156 | key_pressed = ske_ris & SKE_KPRISA; | ||
| 157 | |||
| 158 | input_event(input, EV_MSC, MSC_SCAN, code); | ||
| 159 | input_report_key(input, keypad->keymap[code], key_pressed); | ||
| 160 | input_sync(input); | ||
| 161 | num_of_rows--; | ||
| 162 | } while (num_of_rows); | ||
| 163 | } | ||
| 164 | |||
| 165 | static void ske_keypad_read_data(struct ske_keypad *keypad) | ||
| 166 | { | ||
| 167 | u8 status; | ||
| 168 | int col = 0; | ||
| 169 | int ske_asr, i; | ||
| 144 | 170 | ||
| 145 | /* | 171 | /* |
| 146 | * Read the auto scan registers | 172 | * Read the auto scan registers |
| @@ -154,44 +180,38 @@ static void ske_keypad_read_data(struct ske_keypad *keypad) | |||
| 154 | if (!ske_asr) | 180 | if (!ske_asr) |
| 155 | continue; | 181 | continue; |
| 156 | 182 | ||
| 157 | /* now that ASRx is zero, find out the column x and row y*/ | 183 | /* now that ASRx is zero, find out the coloumn x and row y */ |
| 158 | if (ske_asr & 0xff) { | 184 | status = ske_asr & 0xff; |
| 185 | if (status) { | ||
| 159 | col = i * 2; | 186 | col = i * 2; |
| 160 | status = ske_asr & 0xff; | 187 | ske_keypad_report(keypad, status, col); |
| 161 | } else { | 188 | } |
| 189 | status = (ske_asr & 0xff00) >> 8; | ||
| 190 | if (status) { | ||
| 162 | col = (i * 2) + 1; | 191 | col = (i * 2) + 1; |
| 163 | status = (ske_asr & 0xff00) >> 8; | 192 | ske_keypad_report(keypad, status, col); |
| 164 | } | 193 | } |
| 165 | |||
| 166 | /* find out the row */ | ||
| 167 | row = __ffs(status); | ||
| 168 | |||
| 169 | code = MATRIX_SCAN_CODE(row, col, SKE_KEYPAD_ROW_SHIFT); | ||
| 170 | ske_ris = readl(keypad->reg_base + SKE_RIS); | ||
| 171 | key_pressed = ske_ris & SKE_KPRISA; | ||
| 172 | |||
| 173 | input_event(input, EV_MSC, MSC_SCAN, code); | ||
| 174 | input_report_key(input, keypad->keymap[code], key_pressed); | ||
| 175 | input_sync(input); | ||
| 176 | } | 194 | } |
| 177 | } | 195 | } |
| 178 | 196 | ||
| 179 | static irqreturn_t ske_keypad_irq(int irq, void *dev_id) | 197 | static irqreturn_t ske_keypad_irq(int irq, void *dev_id) |
| 180 | { | 198 | { |
| 181 | struct ske_keypad *keypad = dev_id; | 199 | struct ske_keypad *keypad = dev_id; |
| 182 | int retries = 20; | 200 | int timeout = keypad->board->debounce_ms; |
| 183 | 201 | ||
| 184 | /* disable auto scan interrupt; mask the interrupt generated */ | 202 | /* disable auto scan interrupt; mask the interrupt generated */ |
| 185 | ske_keypad_set_bits(keypad, SKE_IMSC, ~SKE_KPIMA, 0x0); | 203 | ske_keypad_set_bits(keypad, SKE_IMSC, ~SKE_KPIMA, 0x0); |
| 186 | ske_keypad_set_bits(keypad, SKE_ICR, 0x0, SKE_KPICA); | 204 | ske_keypad_set_bits(keypad, SKE_ICR, 0x0, SKE_KPICA); |
| 187 | 205 | ||
| 188 | while ((readl(keypad->reg_base + SKE_CR) & SKE_KPASON) && --retries) | 206 | while ((readl(keypad->reg_base + SKE_CR) & SKE_KPASON) && --timeout) |
| 189 | msleep(5); | 207 | cpu_relax(); |
| 190 | 208 | ||
| 191 | if (retries) { | 209 | /* SKEx registers are stable and can be read */ |
| 192 | /* SKEx registers are stable and can be read */ | 210 | ske_keypad_read_data(keypad); |
| 193 | ske_keypad_read_data(keypad); | 211 | |
| 194 | } | 212 | /* wait until raw interrupt is clear */ |
| 213 | while ((readl(keypad->reg_base + SKE_RIS)) && --timeout) | ||
| 214 | msleep(KEY_PRESSED_DELAY); | ||
| 195 | 215 | ||
| 196 | /* enable auto scan interrupts */ | 216 | /* enable auto scan interrupts */ |
| 197 | ske_keypad_set_bits(keypad, SKE_IMSC, 0x0, SKE_KPIMA); | 217 | ske_keypad_set_bits(keypad, SKE_IMSC, 0x0, SKE_KPIMA); |
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index aed5f6999ce2..c05f98c41410 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
| 28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
| 29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
| 30 | #include <linux/of.h> | ||
| 30 | #include <linux/input.h> | 31 | #include <linux/input.h> |
| 31 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
| 32 | #include <linux/pm_runtime.h> | 33 | #include <linux/pm_runtime.h> |
| @@ -84,8 +85,9 @@ struct omap4_keypad { | |||
| 84 | u32 reg_offset; | 85 | u32 reg_offset; |
| 85 | u32 irqreg_offset; | 86 | u32 irqreg_offset; |
| 86 | unsigned int row_shift; | 87 | unsigned int row_shift; |
| 88 | bool no_autorepeat; | ||
| 87 | unsigned char key_state[8]; | 89 | unsigned char key_state[8]; |
| 88 | unsigned short keymap[]; | 90 | unsigned short *keymap; |
| 89 | }; | 91 | }; |
| 90 | 92 | ||
| 91 | static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset) | 93 | static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset) |
| @@ -208,25 +210,51 @@ static void omap4_keypad_close(struct input_dev *input) | |||
| 208 | pm_runtime_put_sync(input->dev.parent); | 210 | pm_runtime_put_sync(input->dev.parent); |
| 209 | } | 211 | } |
| 210 | 212 | ||
| 213 | #ifdef CONFIG_OF | ||
| 214 | static int __devinit omap4_keypad_parse_dt(struct device *dev, | ||
| 215 | struct omap4_keypad *keypad_data) | ||
| 216 | { | ||
| 217 | struct device_node *np = dev->of_node; | ||
| 218 | |||
| 219 | if (!np) { | ||
| 220 | dev_err(dev, "missing DT data"); | ||
| 221 | return -EINVAL; | ||
| 222 | } | ||
| 223 | |||
| 224 | of_property_read_u32(np, "keypad,num-rows", &keypad_data->rows); | ||
| 225 | of_property_read_u32(np, "keypad,num-columns", &keypad_data->cols); | ||
| 226 | if (!keypad_data->rows || !keypad_data->cols) { | ||
| 227 | dev_err(dev, "number of keypad rows/columns not specified\n"); | ||
| 228 | return -EINVAL; | ||
| 229 | } | ||
| 230 | |||
| 231 | if (of_get_property(np, "linux,input-no-autorepeat", NULL)) | ||
| 232 | keypad_data->no_autorepeat = true; | ||
| 233 | |||
| 234 | return 0; | ||
| 235 | } | ||
| 236 | #else | ||
| 237 | static inline int omap4_keypad_parse_dt(struct device *dev, | ||
| 238 | struct omap4_keypad *keypad_data) | ||
| 239 | { | ||
| 240 | return -ENOSYS; | ||
| 241 | } | ||
| 242 | #endif | ||
| 243 | |||
| 211 | static int __devinit omap4_keypad_probe(struct platform_device *pdev) | 244 | static int __devinit omap4_keypad_probe(struct platform_device *pdev) |
| 212 | { | 245 | { |
| 213 | const struct omap4_keypad_platform_data *pdata; | 246 | const struct omap4_keypad_platform_data *pdata = |
| 247 | dev_get_platdata(&pdev->dev); | ||
| 248 | const struct matrix_keymap_data *keymap_data = | ||
| 249 | pdata ? pdata->keymap_data : NULL; | ||
| 214 | struct omap4_keypad *keypad_data; | 250 | struct omap4_keypad *keypad_data; |
| 215 | struct input_dev *input_dev; | 251 | struct input_dev *input_dev; |
| 216 | struct resource *res; | 252 | struct resource *res; |
| 217 | resource_size_t size; | 253 | unsigned int max_keys; |
| 218 | unsigned int row_shift, max_keys; | ||
| 219 | int rev; | 254 | int rev; |
| 220 | int irq; | 255 | int irq; |
| 221 | int error; | 256 | int error; |
| 222 | 257 | ||
| 223 | /* platform data */ | ||
| 224 | pdata = pdev->dev.platform_data; | ||
| 225 | if (!pdata) { | ||
| 226 | dev_err(&pdev->dev, "no platform data defined\n"); | ||
| 227 | return -EINVAL; | ||
| 228 | } | ||
| 229 | |||
| 230 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 258 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 231 | if (!res) { | 259 | if (!res) { |
| 232 | dev_err(&pdev->dev, "no base address specified\n"); | 260 | dev_err(&pdev->dev, "no base address specified\n"); |
| @@ -239,25 +267,24 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev) | |||
| 239 | return -EINVAL; | 267 | return -EINVAL; |
| 240 | } | 268 | } |
| 241 | 269 | ||
| 242 | if (!pdata->keymap_data) { | 270 | keypad_data = kzalloc(sizeof(struct omap4_keypad), GFP_KERNEL); |
| 243 | dev_err(&pdev->dev, "no keymap data defined\n"); | ||
| 244 | return -EINVAL; | ||
| 245 | } | ||
| 246 | |||
| 247 | row_shift = get_count_order(pdata->cols); | ||
| 248 | max_keys = pdata->rows << row_shift; | ||
| 249 | |||
| 250 | keypad_data = kzalloc(sizeof(struct omap4_keypad) + | ||
| 251 | max_keys * sizeof(keypad_data->keymap[0]), | ||
| 252 | GFP_KERNEL); | ||
| 253 | if (!keypad_data) { | 271 | if (!keypad_data) { |
| 254 | dev_err(&pdev->dev, "keypad_data memory allocation failed\n"); | 272 | dev_err(&pdev->dev, "keypad_data memory allocation failed\n"); |
| 255 | return -ENOMEM; | 273 | return -ENOMEM; |
| 256 | } | 274 | } |
| 257 | 275 | ||
| 258 | size = resource_size(res); | 276 | keypad_data->irq = irq; |
| 277 | |||
| 278 | if (pdata) { | ||
| 279 | keypad_data->rows = pdata->rows; | ||
| 280 | keypad_data->cols = pdata->cols; | ||
| 281 | } else { | ||
| 282 | error = omap4_keypad_parse_dt(&pdev->dev, keypad_data); | ||
| 283 | if (error) | ||
| 284 | return error; | ||
| 285 | } | ||
| 259 | 286 | ||
| 260 | res = request_mem_region(res->start, size, pdev->name); | 287 | res = request_mem_region(res->start, resource_size(res), pdev->name); |
| 261 | if (!res) { | 288 | if (!res) { |
| 262 | dev_err(&pdev->dev, "can't request mem region\n"); | 289 | dev_err(&pdev->dev, "can't request mem region\n"); |
| 263 | error = -EBUSY; | 290 | error = -EBUSY; |
| @@ -271,15 +298,11 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev) | |||
| 271 | goto err_release_mem; | 298 | goto err_release_mem; |
| 272 | } | 299 | } |
| 273 | 300 | ||
| 274 | keypad_data->irq = irq; | ||
| 275 | keypad_data->row_shift = row_shift; | ||
| 276 | keypad_data->rows = pdata->rows; | ||
| 277 | keypad_data->cols = pdata->cols; | ||
| 278 | 301 | ||
| 279 | /* | 302 | /* |
| 280 | * Enable clocks for the keypad module so that we can read | 303 | * Enable clocks for the keypad module so that we can read |
| 281 | * revision register. | 304 | * revision register. |
| 282 | */ | 305 | */ |
| 283 | pm_runtime_enable(&pdev->dev); | 306 | pm_runtime_enable(&pdev->dev); |
| 284 | error = pm_runtime_get_sync(&pdev->dev); | 307 | error = pm_runtime_get_sync(&pdev->dev); |
| 285 | if (error) { | 308 | if (error) { |
| @@ -322,19 +345,30 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev) | |||
| 322 | input_dev->open = omap4_keypad_open; | 345 | input_dev->open = omap4_keypad_open; |
| 323 | input_dev->close = omap4_keypad_close; | 346 | input_dev->close = omap4_keypad_close; |
| 324 | 347 | ||
| 325 | error = matrix_keypad_build_keymap(pdata->keymap_data, NULL, | 348 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); |
| 326 | pdata->rows, pdata->cols, | 349 | if (!keypad_data->no_autorepeat) |
| 350 | __set_bit(EV_REP, input_dev->evbit); | ||
| 351 | |||
| 352 | input_set_drvdata(input_dev, keypad_data); | ||
| 353 | |||
| 354 | keypad_data->row_shift = get_count_order(keypad_data->cols); | ||
| 355 | max_keys = keypad_data->rows << keypad_data->row_shift; | ||
| 356 | keypad_data->keymap = kzalloc(max_keys * sizeof(keypad_data->keymap[0]), | ||
| 357 | GFP_KERNEL); | ||
| 358 | if (!keypad_data->keymap) { | ||
| 359 | dev_err(&pdev->dev, "Not enough memory for keymap\n"); | ||
| 360 | error = -ENOMEM; | ||
| 361 | goto err_free_input; | ||
| 362 | } | ||
| 363 | |||
| 364 | error = matrix_keypad_build_keymap(keymap_data, NULL, | ||
| 365 | keypad_data->rows, keypad_data->cols, | ||
| 327 | keypad_data->keymap, input_dev); | 366 | keypad_data->keymap, input_dev); |
| 328 | if (error) { | 367 | if (error) { |
| 329 | dev_err(&pdev->dev, "failed to build keymap\n"); | 368 | dev_err(&pdev->dev, "failed to build keymap\n"); |
| 330 | goto err_free_input; | 369 | goto err_free_keymap; |
| 331 | } | 370 | } |
| 332 | 371 | ||
| 333 | __set_bit(EV_REP, input_dev->evbit); | ||
| 334 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | ||
| 335 | |||
| 336 | input_set_drvdata(input_dev, keypad_data); | ||
| 337 | |||
| 338 | error = request_irq(keypad_data->irq, omap4_keypad_interrupt, | 372 | error = request_irq(keypad_data->irq, omap4_keypad_interrupt, |
| 339 | IRQF_TRIGGER_RISING, | 373 | IRQF_TRIGGER_RISING, |
| 340 | "omap4-keypad", keypad_data); | 374 | "omap4-keypad", keypad_data); |
| @@ -357,6 +391,8 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev) | |||
| 357 | err_pm_disable: | 391 | err_pm_disable: |
| 358 | pm_runtime_disable(&pdev->dev); | 392 | pm_runtime_disable(&pdev->dev); |
| 359 | free_irq(keypad_data->irq, keypad_data); | 393 | free_irq(keypad_data->irq, keypad_data); |
| 394 | err_free_keymap: | ||
| 395 | kfree(keypad_data->keymap); | ||
| 360 | err_free_input: | 396 | err_free_input: |
| 361 | input_free_device(input_dev); | 397 | input_free_device(input_dev); |
| 362 | err_pm_put_sync: | 398 | err_pm_put_sync: |
| @@ -364,7 +400,7 @@ err_pm_put_sync: | |||
| 364 | err_unmap: | 400 | err_unmap: |
| 365 | iounmap(keypad_data->base); | 401 | iounmap(keypad_data->base); |
| 366 | err_release_mem: | 402 | err_release_mem: |
| 367 | release_mem_region(res->start, size); | 403 | release_mem_region(res->start, resource_size(res)); |
| 368 | err_free_keypad: | 404 | err_free_keypad: |
| 369 | kfree(keypad_data); | 405 | kfree(keypad_data); |
| 370 | return error; | 406 | return error; |
| @@ -386,18 +422,29 @@ static int __devexit omap4_keypad_remove(struct platform_device *pdev) | |||
| 386 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 422 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 387 | release_mem_region(res->start, resource_size(res)); | 423 | release_mem_region(res->start, resource_size(res)); |
| 388 | 424 | ||
| 425 | kfree(keypad_data->keymap); | ||
| 389 | kfree(keypad_data); | 426 | kfree(keypad_data); |
| 427 | |||
| 390 | platform_set_drvdata(pdev, NULL); | 428 | platform_set_drvdata(pdev, NULL); |
| 391 | 429 | ||
| 392 | return 0; | 430 | return 0; |
| 393 | } | 431 | } |
| 394 | 432 | ||
| 433 | #ifdef CONFIG_OF | ||
| 434 | static const struct of_device_id omap_keypad_dt_match[] = { | ||
| 435 | { .compatible = "ti,omap4-keypad" }, | ||
| 436 | {}, | ||
| 437 | }; | ||
| 438 | MODULE_DEVICE_TABLE(of, omap_keypad_dt_match); | ||
| 439 | #endif | ||
| 440 | |||
| 395 | static struct platform_driver omap4_keypad_driver = { | 441 | static struct platform_driver omap4_keypad_driver = { |
| 396 | .probe = omap4_keypad_probe, | 442 | .probe = omap4_keypad_probe, |
| 397 | .remove = __devexit_p(omap4_keypad_remove), | 443 | .remove = __devexit_p(omap4_keypad_remove), |
| 398 | .driver = { | 444 | .driver = { |
| 399 | .name = "omap4-keypad", | 445 | .name = "omap4-keypad", |
| 400 | .owner = THIS_MODULE, | 446 | .owner = THIS_MODULE, |
| 447 | .of_match_table = of_match_ptr(omap_keypad_dt_match), | ||
| 401 | }, | 448 | }, |
| 402 | }; | 449 | }; |
| 403 | module_platform_driver(omap4_keypad_driver); | 450 | module_platform_driver(omap4_keypad_driver); |
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 29fe1b2be1c1..7f7b72464a37 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
| @@ -311,7 +311,15 @@ static void pxa27x_keypad_scan_direct(struct pxa27x_keypad *keypad) | |||
| 311 | if (pdata->enable_rotary0 || pdata->enable_rotary1) | 311 | if (pdata->enable_rotary0 || pdata->enable_rotary1) |
| 312 | pxa27x_keypad_scan_rotary(keypad); | 312 | pxa27x_keypad_scan_rotary(keypad); |
| 313 | 313 | ||
| 314 | new_state = KPDK_DK(kpdk) & keypad->direct_key_mask; | 314 | /* |
| 315 | * The KPDR_DK only output the key pin level, so it relates to board, | ||
| 316 | * and low level may be active. | ||
| 317 | */ | ||
| 318 | if (pdata->direct_key_low_active) | ||
| 319 | new_state = ~KPDK_DK(kpdk) & keypad->direct_key_mask; | ||
| 320 | else | ||
| 321 | new_state = KPDK_DK(kpdk) & keypad->direct_key_mask; | ||
| 322 | |||
| 315 | bits_changed = keypad->direct_key_state ^ new_state; | 323 | bits_changed = keypad->direct_key_state ^ new_state; |
| 316 | 324 | ||
| 317 | if (bits_changed == 0) | 325 | if (bits_changed == 0) |
| @@ -383,7 +391,14 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad) | |||
| 383 | if (pdata->direct_key_num > direct_key_num) | 391 | if (pdata->direct_key_num > direct_key_num) |
| 384 | direct_key_num = pdata->direct_key_num; | 392 | direct_key_num = pdata->direct_key_num; |
| 385 | 393 | ||
| 386 | keypad->direct_key_mask = ((2 << direct_key_num) - 1) & ~mask; | 394 | /* |
| 395 | * Direct keys usage may not start from KP_DKIN0, check the platfrom | ||
| 396 | * mask data to config the specific. | ||
| 397 | */ | ||
| 398 | if (pdata->direct_key_mask) | ||
| 399 | keypad->direct_key_mask = pdata->direct_key_mask; | ||
| 400 | else | ||
| 401 | keypad->direct_key_mask = ((1 << direct_key_num) - 1) & ~mask; | ||
| 387 | 402 | ||
| 388 | /* enable direct key */ | 403 | /* enable direct key */ |
| 389 | if (direct_key_num) | 404 | if (direct_key_num) |
| @@ -399,7 +414,7 @@ static int pxa27x_keypad_open(struct input_dev *dev) | |||
| 399 | struct pxa27x_keypad *keypad = input_get_drvdata(dev); | 414 | struct pxa27x_keypad *keypad = input_get_drvdata(dev); |
| 400 | 415 | ||
| 401 | /* Enable unit clock */ | 416 | /* Enable unit clock */ |
| 402 | clk_enable(keypad->clk); | 417 | clk_prepare_enable(keypad->clk); |
| 403 | pxa27x_keypad_config(keypad); | 418 | pxa27x_keypad_config(keypad); |
| 404 | 419 | ||
| 405 | return 0; | 420 | return 0; |
| @@ -410,7 +425,7 @@ static void pxa27x_keypad_close(struct input_dev *dev) | |||
| 410 | struct pxa27x_keypad *keypad = input_get_drvdata(dev); | 425 | struct pxa27x_keypad *keypad = input_get_drvdata(dev); |
| 411 | 426 | ||
| 412 | /* Disable clock unit */ | 427 | /* Disable clock unit */ |
| 413 | clk_disable(keypad->clk); | 428 | clk_disable_unprepare(keypad->clk); |
| 414 | } | 429 | } |
| 415 | 430 | ||
| 416 | #ifdef CONFIG_PM | 431 | #ifdef CONFIG_PM |
| @@ -419,10 +434,14 @@ static int pxa27x_keypad_suspend(struct device *dev) | |||
| 419 | struct platform_device *pdev = to_platform_device(dev); | 434 | struct platform_device *pdev = to_platform_device(dev); |
| 420 | struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); | 435 | struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); |
| 421 | 436 | ||
| 422 | clk_disable(keypad->clk); | 437 | /* |
| 423 | 438 | * If the keypad is used a wake up source, clock can not be disabled. | |
| 439 | * Or it can not detect the key pressing. | ||
| 440 | */ | ||
| 424 | if (device_may_wakeup(&pdev->dev)) | 441 | if (device_may_wakeup(&pdev->dev)) |
| 425 | enable_irq_wake(keypad->irq); | 442 | enable_irq_wake(keypad->irq); |
| 443 | else | ||
| 444 | clk_disable_unprepare(keypad->clk); | ||
| 426 | 445 | ||
| 427 | return 0; | 446 | return 0; |
| 428 | } | 447 | } |
| @@ -433,19 +452,24 @@ static int pxa27x_keypad_resume(struct device *dev) | |||
| 433 | struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); | 452 | struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); |
| 434 | struct input_dev *input_dev = keypad->input_dev; | 453 | struct input_dev *input_dev = keypad->input_dev; |
| 435 | 454 | ||
| 436 | if (device_may_wakeup(&pdev->dev)) | 455 | /* |
| 456 | * If the keypad is used as wake up source, the clock is not turned | ||
| 457 | * off. So do not need configure it again. | ||
| 458 | */ | ||
| 459 | if (device_may_wakeup(&pdev->dev)) { | ||
| 437 | disable_irq_wake(keypad->irq); | 460 | disable_irq_wake(keypad->irq); |
| 461 | } else { | ||
| 462 | mutex_lock(&input_dev->mutex); | ||
| 438 | 463 | ||
| 439 | mutex_lock(&input_dev->mutex); | 464 | if (input_dev->users) { |
| 465 | /* Enable unit clock */ | ||
| 466 | clk_prepare_enable(keypad->clk); | ||
| 467 | pxa27x_keypad_config(keypad); | ||
| 468 | } | ||
| 440 | 469 | ||
| 441 | if (input_dev->users) { | 470 | mutex_unlock(&input_dev->mutex); |
| 442 | /* Enable unit clock */ | ||
| 443 | clk_enable(keypad->clk); | ||
| 444 | pxa27x_keypad_config(keypad); | ||
| 445 | } | 471 | } |
| 446 | 472 | ||
| 447 | mutex_unlock(&input_dev->mutex); | ||
| 448 | |||
| 449 | return 0; | 473 | return 0; |
| 450 | } | 474 | } |
| 451 | 475 | ||
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 6f287f7e1538..72ef01be3360 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c | |||
| @@ -27,33 +27,31 @@ | |||
| 27 | #include <plat/keyboard.h> | 27 | #include <plat/keyboard.h> |
| 28 | 28 | ||
| 29 | /* Keyboard Registers */ | 29 | /* Keyboard Registers */ |
| 30 | #define MODE_REG 0x00 /* 16 bit reg */ | 30 | #define MODE_CTL_REG 0x00 |
| 31 | #define STATUS_REG 0x0C /* 2 bit reg */ | 31 | #define STATUS_REG 0x0C |
| 32 | #define DATA_REG 0x10 /* 8 bit reg */ | 32 | #define DATA_REG 0x10 |
| 33 | #define INTR_MASK 0x54 | 33 | #define INTR_MASK 0x54 |
| 34 | 34 | ||
| 35 | /* Register Values */ | 35 | /* Register Values */ |
| 36 | /* | ||
| 37 | * pclk freq mask = (APB FEQ -1)= 82 MHZ.Programme bit 15-9 in mode | ||
| 38 | * control register as 1010010(82MHZ) | ||
| 39 | */ | ||
| 40 | #define PCLK_FREQ_MSK 0xA400 /* 82 MHz */ | ||
| 41 | #define START_SCAN 0x0100 | ||
| 42 | #define SCAN_RATE_10 0x0000 | ||
| 43 | #define SCAN_RATE_20 0x0004 | ||
| 44 | #define SCAN_RATE_40 0x0008 | ||
| 45 | #define SCAN_RATE_80 0x000C | ||
| 46 | #define MODE_KEYBOARD 0x0002 | ||
| 47 | #define DATA_AVAIL 0x2 | ||
| 48 | |||
| 49 | #define KEY_MASK 0xFF000000 | ||
| 50 | #define KEY_VALUE 0x00FFFFFF | ||
| 51 | #define ROW_MASK 0xF0 | ||
| 52 | #define COLUMN_MASK 0x0F | ||
| 53 | #define NUM_ROWS 16 | 36 | #define NUM_ROWS 16 |
| 54 | #define NUM_COLS 16 | 37 | #define NUM_COLS 16 |
| 38 | #define MODE_CTL_PCLK_FREQ_SHIFT 9 | ||
| 39 | #define MODE_CTL_PCLK_FREQ_MSK 0x7F | ||
| 40 | |||
| 41 | #define MODE_CTL_KEYBOARD (0x2 << 0) | ||
| 42 | #define MODE_CTL_SCAN_RATE_10 (0x0 << 2) | ||
| 43 | #define MODE_CTL_SCAN_RATE_20 (0x1 << 2) | ||
| 44 | #define MODE_CTL_SCAN_RATE_40 (0x2 << 2) | ||
| 45 | #define MODE_CTL_SCAN_RATE_80 (0x3 << 2) | ||
| 46 | #define MODE_CTL_KEYNUM_SHIFT 6 | ||
| 47 | #define MODE_CTL_START_SCAN (0x1 << 8) | ||
| 55 | 48 | ||
| 56 | #define KEY_MATRIX_SHIFT 6 | 49 | #define STATUS_DATA_AVAIL (0x1 << 1) |
| 50 | |||
| 51 | #define DATA_ROW_MASK 0xF0 | ||
| 52 | #define DATA_COLUMN_MASK 0x0F | ||
| 53 | |||
| 54 | #define ROW_SHIFT 4 | ||
| 57 | 55 | ||
| 58 | struct spear_kbd { | 56 | struct spear_kbd { |
| 59 | struct input_dev *input; | 57 | struct input_dev *input; |
| @@ -65,6 +63,8 @@ struct spear_kbd { | |||
| 65 | unsigned short last_key; | 63 | unsigned short last_key; |
| 66 | unsigned short keycodes[NUM_ROWS * NUM_COLS]; | 64 | unsigned short keycodes[NUM_ROWS * NUM_COLS]; |
| 67 | bool rep; | 65 | bool rep; |
| 66 | unsigned int suspended_rate; | ||
| 67 | u32 mode_ctl_reg; | ||
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) | 70 | static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) |
| @@ -72,10 +72,10 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) | |||
| 72 | struct spear_kbd *kbd = dev_id; | 72 | struct spear_kbd *kbd = dev_id; |
| 73 | struct input_dev *input = kbd->input; | 73 | struct input_dev *input = kbd->input; |
| 74 | unsigned int key; | 74 | unsigned int key; |
| 75 | u8 sts, val; | 75 | u32 sts, val; |
| 76 | 76 | ||
| 77 | sts = readb(kbd->io_base + STATUS_REG); | 77 | sts = readl_relaxed(kbd->io_base + STATUS_REG); |
| 78 | if (!(sts & DATA_AVAIL)) | 78 | if (!(sts & STATUS_DATA_AVAIL)) |
| 79 | return IRQ_NONE; | 79 | return IRQ_NONE; |
| 80 | 80 | ||
| 81 | if (kbd->last_key != KEY_RESERVED) { | 81 | if (kbd->last_key != KEY_RESERVED) { |
| @@ -84,7 +84,8 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) | |||
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | /* following reads active (row, col) pair */ | 86 | /* following reads active (row, col) pair */ |
| 87 | val = readb(kbd->io_base + DATA_REG); | 87 | val = readl_relaxed(kbd->io_base + DATA_REG) & |
| 88 | (DATA_ROW_MASK | DATA_COLUMN_MASK); | ||
| 88 | key = kbd->keycodes[val]; | 89 | key = kbd->keycodes[val]; |
| 89 | 90 | ||
| 90 | input_event(input, EV_MSC, MSC_SCAN, val); | 91 | input_event(input, EV_MSC, MSC_SCAN, val); |
| @@ -94,7 +95,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) | |||
| 94 | kbd->last_key = key; | 95 | kbd->last_key = key; |
| 95 | 96 | ||
| 96 | /* clear interrupt */ | 97 | /* clear interrupt */ |
| 97 | writeb(0, kbd->io_base + STATUS_REG); | 98 | writel_relaxed(0, kbd->io_base + STATUS_REG); |
| 98 | 99 | ||
| 99 | return IRQ_HANDLED; | 100 | return IRQ_HANDLED; |
| 100 | } | 101 | } |
| @@ -103,7 +104,7 @@ static int spear_kbd_open(struct input_dev *dev) | |||
| 103 | { | 104 | { |
| 104 | struct spear_kbd *kbd = input_get_drvdata(dev); | 105 | struct spear_kbd *kbd = input_get_drvdata(dev); |
| 105 | int error; | 106 | int error; |
| 106 | u16 val; | 107 | u32 val; |
| 107 | 108 | ||
| 108 | kbd->last_key = KEY_RESERVED; | 109 | kbd->last_key = KEY_RESERVED; |
| 109 | 110 | ||
| @@ -111,16 +112,20 @@ static int spear_kbd_open(struct input_dev *dev) | |||
| 111 | if (error) | 112 | if (error) |
| 112 | return error; | 113 | return error; |
| 113 | 114 | ||
| 115 | /* keyboard rate to be programmed is input clock (in MHz) - 1 */ | ||
| 116 | val = clk_get_rate(kbd->clk) / 1000000 - 1; | ||
| 117 | val = (val & MODE_CTL_PCLK_FREQ_MSK) << MODE_CTL_PCLK_FREQ_SHIFT; | ||
| 118 | |||
| 114 | /* program keyboard */ | 119 | /* program keyboard */ |
| 115 | val = SCAN_RATE_80 | MODE_KEYBOARD | PCLK_FREQ_MSK | | 120 | val = MODE_CTL_SCAN_RATE_80 | MODE_CTL_KEYBOARD | val | |
| 116 | (kbd->mode << KEY_MATRIX_SHIFT); | 121 | (kbd->mode << MODE_CTL_KEYNUM_SHIFT); |
| 117 | writew(val, kbd->io_base + MODE_REG); | 122 | writel_relaxed(val, kbd->io_base + MODE_CTL_REG); |
| 118 | writeb(1, kbd->io_base + STATUS_REG); | 123 | writel_relaxed(1, kbd->io_base + STATUS_REG); |
| 119 | 124 | ||
| 120 | /* start key scan */ | 125 | /* start key scan */ |
| 121 | val = readw(kbd->io_base + MODE_REG); | 126 | val = readl_relaxed(kbd->io_base + MODE_CTL_REG); |
| 122 | val |= START_SCAN; | 127 | val |= MODE_CTL_START_SCAN; |
| 123 | writew(val, kbd->io_base + MODE_REG); | 128 | writel_relaxed(val, kbd->io_base + MODE_CTL_REG); |
| 124 | 129 | ||
| 125 | return 0; | 130 | return 0; |
| 126 | } | 131 | } |
| @@ -128,12 +133,12 @@ static int spear_kbd_open(struct input_dev *dev) | |||
| 128 | static void spear_kbd_close(struct input_dev *dev) | 133 | static void spear_kbd_close(struct input_dev *dev) |
| 129 | { | 134 | { |
| 130 | struct spear_kbd *kbd = input_get_drvdata(dev); | 135 | struct spear_kbd *kbd = input_get_drvdata(dev); |
| 131 | u16 val; | 136 | u32 val; |
| 132 | 137 | ||
| 133 | /* stop key scan */ | 138 | /* stop key scan */ |
| 134 | val = readw(kbd->io_base + MODE_REG); | 139 | val = readl_relaxed(kbd->io_base + MODE_CTL_REG); |
| 135 | val &= ~START_SCAN; | 140 | val &= ~MODE_CTL_START_SCAN; |
| 136 | writew(val, kbd->io_base + MODE_REG); | 141 | writel_relaxed(val, kbd->io_base + MODE_CTL_REG); |
| 137 | 142 | ||
| 138 | clk_disable(kbd->clk); | 143 | clk_disable(kbd->clk); |
| 139 | 144 | ||
| @@ -146,7 +151,7 @@ static int __devinit spear_kbd_parse_dt(struct platform_device *pdev, | |||
| 146 | { | 151 | { |
| 147 | struct device_node *np = pdev->dev.of_node; | 152 | struct device_node *np = pdev->dev.of_node; |
| 148 | int error; | 153 | int error; |
| 149 | u32 val; | 154 | u32 val, suspended_rate; |
| 150 | 155 | ||
| 151 | if (!np) { | 156 | if (!np) { |
| 152 | dev_err(&pdev->dev, "Missing DT data\n"); | 157 | dev_err(&pdev->dev, "Missing DT data\n"); |
| @@ -156,6 +161,9 @@ static int __devinit spear_kbd_parse_dt(struct platform_device *pdev, | |||
| 156 | if (of_property_read_bool(np, "autorepeat")) | 161 | if (of_property_read_bool(np, "autorepeat")) |
| 157 | kbd->rep = true; | 162 | kbd->rep = true; |
| 158 | 163 | ||
| 164 | if (of_property_read_u32(np, "suspended_rate", &suspended_rate)) | ||
| 165 | kbd->suspended_rate = suspended_rate; | ||
| 166 | |||
| 159 | error = of_property_read_u32(np, "st,mode", &val); | 167 | error = of_property_read_u32(np, "st,mode", &val); |
| 160 | if (error) { | 168 | if (error) { |
| 161 | dev_err(&pdev->dev, "DT: Invalid or missing mode\n"); | 169 | dev_err(&pdev->dev, "DT: Invalid or missing mode\n"); |
| @@ -213,6 +221,7 @@ static int __devinit spear_kbd_probe(struct platform_device *pdev) | |||
| 213 | } else { | 221 | } else { |
| 214 | kbd->mode = pdata->mode; | 222 | kbd->mode = pdata->mode; |
| 215 | kbd->rep = pdata->rep; | 223 | kbd->rep = pdata->rep; |
| 224 | kbd->suspended_rate = pdata->suspended_rate; | ||
| 216 | } | 225 | } |
| 217 | 226 | ||
| 218 | kbd->res = request_mem_region(res->start, resource_size(res), | 227 | kbd->res = request_mem_region(res->start, resource_size(res), |
| @@ -302,7 +311,7 @@ static int __devexit spear_kbd_remove(struct platform_device *pdev) | |||
| 302 | release_mem_region(kbd->res->start, resource_size(kbd->res)); | 311 | release_mem_region(kbd->res->start, resource_size(kbd->res)); |
| 303 | kfree(kbd); | 312 | kfree(kbd); |
| 304 | 313 | ||
| 305 | device_init_wakeup(&pdev->dev, 1); | 314 | device_init_wakeup(&pdev->dev, 0); |
| 306 | platform_set_drvdata(pdev, NULL); | 315 | platform_set_drvdata(pdev, NULL); |
| 307 | 316 | ||
| 308 | return 0; | 317 | return 0; |
| @@ -314,15 +323,48 @@ static int spear_kbd_suspend(struct device *dev) | |||
| 314 | struct platform_device *pdev = to_platform_device(dev); | 323 | struct platform_device *pdev = to_platform_device(dev); |
| 315 | struct spear_kbd *kbd = platform_get_drvdata(pdev); | 324 | struct spear_kbd *kbd = platform_get_drvdata(pdev); |
| 316 | struct input_dev *input_dev = kbd->input; | 325 | struct input_dev *input_dev = kbd->input; |
| 326 | unsigned int rate = 0, mode_ctl_reg, val; | ||
| 317 | 327 | ||
| 318 | mutex_lock(&input_dev->mutex); | 328 | mutex_lock(&input_dev->mutex); |
| 319 | 329 | ||
| 320 | if (input_dev->users) | 330 | /* explicitly enable clock as we may program device */ |
| 321 | clk_enable(kbd->clk); | 331 | clk_enable(kbd->clk); |
| 322 | 332 | ||
| 323 | if (device_may_wakeup(&pdev->dev)) | 333 | mode_ctl_reg = readl_relaxed(kbd->io_base + MODE_CTL_REG); |
| 334 | |||
| 335 | if (device_may_wakeup(&pdev->dev)) { | ||
| 324 | enable_irq_wake(kbd->irq); | 336 | enable_irq_wake(kbd->irq); |
| 325 | 337 | ||
| 338 | /* | ||
| 339 | * reprogram the keyboard operating frequency as on some | ||
| 340 | * platform it may change during system suspended | ||
| 341 | */ | ||
| 342 | if (kbd->suspended_rate) | ||
| 343 | rate = kbd->suspended_rate / 1000000 - 1; | ||
| 344 | else | ||
| 345 | rate = clk_get_rate(kbd->clk) / 1000000 - 1; | ||
| 346 | |||
| 347 | val = mode_ctl_reg & | ||
| 348 | ~(MODE_CTL_PCLK_FREQ_MSK << MODE_CTL_PCLK_FREQ_SHIFT); | ||
| 349 | val |= (rate & MODE_CTL_PCLK_FREQ_MSK) | ||
| 350 | << MODE_CTL_PCLK_FREQ_SHIFT; | ||
| 351 | writel_relaxed(val, kbd->io_base + MODE_CTL_REG); | ||
| 352 | |||
| 353 | } else { | ||
| 354 | if (input_dev->users) { | ||
| 355 | writel_relaxed(mode_ctl_reg & ~MODE_CTL_START_SCAN, | ||
| 356 | kbd->io_base + MODE_CTL_REG); | ||
| 357 | clk_disable(kbd->clk); | ||
| 358 | } | ||
| 359 | } | ||
| 360 | |||
| 361 | /* store current configuration */ | ||
| 362 | if (input_dev->users) | ||
| 363 | kbd->mode_ctl_reg = mode_ctl_reg; | ||
| 364 | |||
| 365 | /* restore previous clk state */ | ||
| 366 | clk_disable(kbd->clk); | ||
| 367 | |||
| 326 | mutex_unlock(&input_dev->mutex); | 368 | mutex_unlock(&input_dev->mutex); |
| 327 | 369 | ||
| 328 | return 0; | 370 | return 0; |
| @@ -336,11 +378,16 @@ static int spear_kbd_resume(struct device *dev) | |||
| 336 | 378 | ||
| 337 | mutex_lock(&input_dev->mutex); | 379 | mutex_lock(&input_dev->mutex); |
| 338 | 380 | ||
| 339 | if (device_may_wakeup(&pdev->dev)) | 381 | if (device_may_wakeup(&pdev->dev)) { |
| 340 | disable_irq_wake(kbd->irq); | 382 | disable_irq_wake(kbd->irq); |
| 383 | } else { | ||
| 384 | if (input_dev->users) | ||
| 385 | clk_enable(kbd->clk); | ||
| 386 | } | ||
| 341 | 387 | ||
| 388 | /* restore current configuration */ | ||
| 342 | if (input_dev->users) | 389 | if (input_dev->users) |
| 343 | clk_enable(kbd->clk); | 390 | writel_relaxed(kbd->mode_ctl_reg, kbd->io_base + MODE_CTL_REG); |
| 344 | 391 | ||
| 345 | mutex_unlock(&input_dev->mutex); | 392 | mutex_unlock(&input_dev->mutex); |
| 346 | 393 | ||
diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c index 350fd0c385d2..84ec691c05aa 100644 --- a/drivers/input/misc/ab8500-ponkey.c +++ b/drivers/input/misc/ab8500-ponkey.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/input.h> | 13 | #include <linux/input.h> |
| 14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
| 15 | #include <linux/mfd/abx500/ab8500.h> | 15 | #include <linux/mfd/abx500/ab8500.h> |
| 16 | #include <linux/of.h> | ||
| 16 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
| 17 | 18 | ||
| 18 | /** | 19 | /** |
| @@ -131,10 +132,18 @@ static int __devexit ab8500_ponkey_remove(struct platform_device *pdev) | |||
| 131 | return 0; | 132 | return 0; |
| 132 | } | 133 | } |
| 133 | 134 | ||
| 135 | #ifdef CONFIG_OF | ||
| 136 | static const struct of_device_id ab8500_ponkey_match[] = { | ||
| 137 | { .compatible = "stericsson,ab8500-ponkey", }, | ||
| 138 | {} | ||
| 139 | }; | ||
| 140 | #endif | ||
| 141 | |||
| 134 | static struct platform_driver ab8500_ponkey_driver = { | 142 | static struct platform_driver ab8500_ponkey_driver = { |
| 135 | .driver = { | 143 | .driver = { |
| 136 | .name = "ab8500-poweron-key", | 144 | .name = "ab8500-poweron-key", |
| 137 | .owner = THIS_MODULE, | 145 | .owner = THIS_MODULE, |
| 146 | .of_match_table = of_match_ptr(ab8500_ponkey_match), | ||
| 138 | }, | 147 | }, |
| 139 | .probe = ab8500_ponkey_probe, | 148 | .probe = ab8500_ponkey_probe, |
| 140 | .remove = __devexit_p(ab8500_ponkey_remove), | 149 | .remove = __devexit_p(ab8500_ponkey_remove), |
diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c index ab860511f016..082684e7f390 100644 --- a/drivers/input/misc/cm109.c +++ b/drivers/input/misc/cm109.c | |||
| @@ -327,7 +327,9 @@ static void cm109_submit_buzz_toggle(struct cm109_dev *dev) | |||
| 327 | 327 | ||
| 328 | error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); | 328 | error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); |
| 329 | if (error) | 329 | if (error) |
| 330 | err("%s: usb_submit_urb (urb_ctl) failed %d", __func__, error); | 330 | dev_err(&dev->intf->dev, |
| 331 | "%s: usb_submit_urb (urb_ctl) failed %d\n", | ||
| 332 | __func__, error); | ||
| 331 | } | 333 | } |
| 332 | 334 | ||
| 333 | /* | 335 | /* |
| @@ -339,7 +341,7 @@ static void cm109_urb_irq_callback(struct urb *urb) | |||
| 339 | const int status = urb->status; | 341 | const int status = urb->status; |
| 340 | int error; | 342 | int error; |
| 341 | 343 | ||
| 342 | dev_dbg(&urb->dev->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n", | 344 | dev_dbg(&dev->intf->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n", |
| 343 | dev->irq_data->byte[0], | 345 | dev->irq_data->byte[0], |
| 344 | dev->irq_data->byte[1], | 346 | dev->irq_data->byte[1], |
| 345 | dev->irq_data->byte[2], | 347 | dev->irq_data->byte[2], |
| @@ -349,7 +351,7 @@ static void cm109_urb_irq_callback(struct urb *urb) | |||
| 349 | if (status) { | 351 | if (status) { |
| 350 | if (status == -ESHUTDOWN) | 352 | if (status == -ESHUTDOWN) |
| 351 | return; | 353 | return; |
| 352 | err("%s: urb status %d", __func__, status); | 354 | dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); |
| 353 | } | 355 | } |
| 354 | 356 | ||
| 355 | /* Special keys */ | 357 | /* Special keys */ |
| @@ -396,7 +398,8 @@ static void cm109_urb_irq_callback(struct urb *urb) | |||
| 396 | 398 | ||
| 397 | error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); | 399 | error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); |
| 398 | if (error) | 400 | if (error) |
| 399 | err("%s: usb_submit_urb (urb_ctl) failed %d", | 401 | dev_err(&dev->intf->dev, |
| 402 | "%s: usb_submit_urb (urb_ctl) failed %d\n", | ||
| 400 | __func__, error); | 403 | __func__, error); |
| 401 | } | 404 | } |
| 402 | 405 | ||
| @@ -409,14 +412,14 @@ static void cm109_urb_ctl_callback(struct urb *urb) | |||
| 409 | const int status = urb->status; | 412 | const int status = urb->status; |
| 410 | int error; | 413 | int error; |
| 411 | 414 | ||
| 412 | dev_dbg(&urb->dev->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n", | 415 | dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n", |
| 413 | dev->ctl_data->byte[0], | 416 | dev->ctl_data->byte[0], |
| 414 | dev->ctl_data->byte[1], | 417 | dev->ctl_data->byte[1], |
| 415 | dev->ctl_data->byte[2], | 418 | dev->ctl_data->byte[2], |
| 416 | dev->ctl_data->byte[3]); | 419 | dev->ctl_data->byte[3]); |
| 417 | 420 | ||
| 418 | if (status) | 421 | if (status) |
| 419 | err("%s: urb status %d", __func__, status); | 422 | dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); |
| 420 | 423 | ||
| 421 | spin_lock(&dev->ctl_submit_lock); | 424 | spin_lock(&dev->ctl_submit_lock); |
| 422 | 425 | ||
| @@ -433,7 +436,8 @@ static void cm109_urb_ctl_callback(struct urb *urb) | |||
| 433 | dev->irq_urb_pending = 1; | 436 | dev->irq_urb_pending = 1; |
| 434 | error = usb_submit_urb(dev->urb_irq, GFP_ATOMIC); | 437 | error = usb_submit_urb(dev->urb_irq, GFP_ATOMIC); |
| 435 | if (error) | 438 | if (error) |
| 436 | err("%s: usb_submit_urb (urb_irq) failed %d", | 439 | dev_err(&dev->intf->dev, |
| 440 | "%s: usb_submit_urb (urb_irq) failed %d\n", | ||
| 437 | __func__, error); | 441 | __func__, error); |
| 438 | } | 442 | } |
| 439 | } | 443 | } |
| @@ -476,7 +480,8 @@ static void cm109_toggle_buzzer_sync(struct cm109_dev *dev, int on) | |||
| 476 | dev->ctl_data, | 480 | dev->ctl_data, |
| 477 | USB_PKT_LEN, USB_CTRL_SET_TIMEOUT); | 481 | USB_PKT_LEN, USB_CTRL_SET_TIMEOUT); |
| 478 | if (error < 0 && error != -EINTR) | 482 | if (error < 0 && error != -EINTR) |
| 479 | err("%s: usb_control_msg() failed %d", __func__, error); | 483 | dev_err(&dev->intf->dev, "%s: usb_control_msg() failed %d\n", |
| 484 | __func__, error); | ||
| 480 | } | 485 | } |
| 481 | 486 | ||
| 482 | static void cm109_stop_traffic(struct cm109_dev *dev) | 487 | static void cm109_stop_traffic(struct cm109_dev *dev) |
| @@ -518,8 +523,8 @@ static int cm109_input_open(struct input_dev *idev) | |||
| 518 | 523 | ||
| 519 | error = usb_autopm_get_interface(dev->intf); | 524 | error = usb_autopm_get_interface(dev->intf); |
| 520 | if (error < 0) { | 525 | if (error < 0) { |
| 521 | err("%s - cannot autoresume, result %d", | 526 | dev_err(&idev->dev, "%s - cannot autoresume, result %d\n", |
| 522 | __func__, error); | 527 | __func__, error); |
| 523 | return error; | 528 | return error; |
| 524 | } | 529 | } |
| 525 | 530 | ||
| @@ -537,7 +542,8 @@ static int cm109_input_open(struct input_dev *idev) | |||
| 537 | 542 | ||
| 538 | error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL); | 543 | error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL); |
| 539 | if (error) | 544 | if (error) |
| 540 | err("%s: usb_submit_urb (urb_ctl) failed %d", __func__, error); | 545 | dev_err(&dev->intf->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n", |
| 546 | __func__, error); | ||
| 541 | else | 547 | else |
| 542 | dev->open = 1; | 548 | dev->open = 1; |
| 543 | 549 | ||
| @@ -573,7 +579,7 @@ static int cm109_input_ev(struct input_dev *idev, unsigned int type, | |||
| 573 | { | 579 | { |
| 574 | struct cm109_dev *dev = input_get_drvdata(idev); | 580 | struct cm109_dev *dev = input_get_drvdata(idev); |
| 575 | 581 | ||
| 576 | dev_dbg(&dev->udev->dev, | 582 | dev_dbg(&dev->intf->dev, |
| 577 | "input_ev: type=%u code=%u value=%d\n", type, code, value); | 583 | "input_ev: type=%u code=%u value=%d\n", type, code, value); |
| 578 | 584 | ||
| 579 | if (type != EV_SND) | 585 | if (type != EV_SND) |
| @@ -710,7 +716,8 @@ static int cm109_usb_probe(struct usb_interface *intf, | |||
| 710 | pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); | 716 | pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); |
| 711 | ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); | 717 | ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); |
| 712 | if (ret != USB_PKT_LEN) | 718 | if (ret != USB_PKT_LEN) |
| 713 | err("invalid payload size %d, expected %d", ret, USB_PKT_LEN); | 719 | dev_err(&intf->dev, "invalid payload size %d, expected %d\n", |
| 720 | ret, USB_PKT_LEN); | ||
| 714 | 721 | ||
| 715 | /* initialise irq urb */ | 722 | /* initialise irq urb */ |
| 716 | usb_fill_int_urb(dev->urb_irq, udev, pipe, dev->irq_data, | 723 | usb_fill_int_urb(dev->urb_irq, udev, pipe, dev->irq_data, |
diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c index d99151a8bf10..290fa5f97ded 100644 --- a/drivers/input/misc/keyspan_remote.c +++ b/drivers/input/misc/keyspan_remote.c | |||
| @@ -157,7 +157,7 @@ static int keyspan_load_tester(struct usb_keyspan* dev, int bits_needed) | |||
| 157 | * though so it's not too big a deal | 157 | * though so it's not too big a deal |
| 158 | */ | 158 | */ |
| 159 | if (dev->data.pos >= dev->data.len) { | 159 | if (dev->data.pos >= dev->data.len) { |
| 160 | dev_dbg(&dev->udev->dev, | 160 | dev_dbg(&dev->interface->dev, |
| 161 | "%s - Error ran out of data. pos: %d, len: %d\n", | 161 | "%s - Error ran out of data. pos: %d, len: %d\n", |
| 162 | __func__, dev->data.pos, dev->data.len); | 162 | __func__, dev->data.pos, dev->data.len); |
| 163 | return -1; | 163 | return -1; |
| @@ -267,7 +267,9 @@ static void keyspan_check_data(struct usb_keyspan *remote) | |||
| 267 | remote->data.tester = remote->data.tester >> 6; | 267 | remote->data.tester = remote->data.tester >> 6; |
| 268 | remote->data.bits_left -= 6; | 268 | remote->data.bits_left -= 6; |
| 269 | } else { | 269 | } else { |
| 270 | err("%s - Unknown sequence found in system data.\n", __func__); | 270 | dev_err(&remote->interface->dev, |
| 271 | "%s - Unknown sequence found in system data.\n", | ||
| 272 | __func__); | ||
| 271 | remote->stage = 0; | 273 | remote->stage = 0; |
| 272 | return; | 274 | return; |
| 273 | } | 275 | } |
| @@ -286,7 +288,9 @@ static void keyspan_check_data(struct usb_keyspan *remote) | |||
| 286 | remote->data.tester = remote->data.tester >> 6; | 288 | remote->data.tester = remote->data.tester >> 6; |
| 287 | remote->data.bits_left -= 6; | 289 | remote->data.bits_left -= 6; |
| 288 | } else { | 290 | } else { |
| 289 | err("%s - Unknown sequence found in button data.\n", __func__); | 291 | dev_err(&remote->interface->dev, |
| 292 | "%s - Unknown sequence found in button data.\n", | ||
| 293 | __func__); | ||
| 290 | remote->stage = 0; | 294 | remote->stage = 0; |
| 291 | return; | 295 | return; |
| 292 | } | 296 | } |
| @@ -302,7 +306,9 @@ static void keyspan_check_data(struct usb_keyspan *remote) | |||
| 302 | remote->data.tester = remote->data.tester >> 6; | 306 | remote->data.tester = remote->data.tester >> 6; |
| 303 | remote->data.bits_left -= 6; | 307 | remote->data.bits_left -= 6; |
| 304 | } else { | 308 | } else { |
| 305 | err("%s - Error in message, invalid toggle.\n", __func__); | 309 | dev_err(&remote->interface->dev, |
| 310 | "%s - Error in message, invalid toggle.\n", | ||
| 311 | __func__); | ||
| 306 | remote->stage = 0; | 312 | remote->stage = 0; |
| 307 | return; | 313 | return; |
| 308 | } | 314 | } |
| @@ -312,10 +318,11 @@ static void keyspan_check_data(struct usb_keyspan *remote) | |||
| 312 | remote->data.tester = remote->data.tester >> 5; | 318 | remote->data.tester = remote->data.tester >> 5; |
| 313 | remote->data.bits_left -= 5; | 319 | remote->data.bits_left -= 5; |
| 314 | } else { | 320 | } else { |
| 315 | err("Bad message received, no stop bit found.\n"); | 321 | dev_err(&remote->interface->dev, |
| 322 | "Bad message received, no stop bit found.\n"); | ||
| 316 | } | 323 | } |
| 317 | 324 | ||
| 318 | dev_dbg(&remote->udev->dev, | 325 | dev_dbg(&remote->interface->dev, |
| 319 | "%s found valid message: system: %d, button: %d, toggle: %d\n", | 326 | "%s found valid message: system: %d, button: %d, toggle: %d\n", |
| 320 | __func__, message.system, message.button, message.toggle); | 327 | __func__, message.system, message.button, message.toggle); |
| 321 | 328 | ||
| @@ -397,7 +404,9 @@ static void keyspan_irq_recv(struct urb *urb) | |||
| 397 | resubmit: | 404 | resubmit: |
| 398 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 405 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
| 399 | if (retval) | 406 | if (retval) |
| 400 | err ("%s - usb_submit_urb failed with result: %d", __func__, retval); | 407 | dev_err(&dev->interface->dev, |
| 408 | "%s - usb_submit_urb failed with result: %d\n", | ||
| 409 | __func__, retval); | ||
| 401 | } | 410 | } |
| 402 | 411 | ||
| 403 | static int keyspan_open(struct input_dev *dev) | 412 | static int keyspan_open(struct input_dev *dev) |
diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c index 538f7049ec64..49c0c3ebd321 100644 --- a/drivers/input/misc/powermate.c +++ b/drivers/input/misc/powermate.c | |||
| @@ -65,6 +65,7 @@ struct powermate_device { | |||
| 65 | struct urb *irq, *config; | 65 | struct urb *irq, *config; |
| 66 | struct usb_ctrlrequest *configcr; | 66 | struct usb_ctrlrequest *configcr; |
| 67 | struct usb_device *udev; | 67 | struct usb_device *udev; |
| 68 | struct usb_interface *intf; | ||
| 68 | struct input_dev *input; | 69 | struct input_dev *input; |
| 69 | spinlock_t lock; | 70 | spinlock_t lock; |
| 70 | int static_brightness; | 71 | int static_brightness; |
| @@ -85,6 +86,7 @@ static void powermate_config_complete(struct urb *urb); | |||
| 85 | static void powermate_irq(struct urb *urb) | 86 | static void powermate_irq(struct urb *urb) |
| 86 | { | 87 | { |
| 87 | struct powermate_device *pm = urb->context; | 88 | struct powermate_device *pm = urb->context; |
| 89 | struct device *dev = &pm->intf->dev; | ||
| 88 | int retval; | 90 | int retval; |
| 89 | 91 | ||
| 90 | switch (urb->status) { | 92 | switch (urb->status) { |
| @@ -95,10 +97,12 @@ static void powermate_irq(struct urb *urb) | |||
| 95 | case -ENOENT: | 97 | case -ENOENT: |
| 96 | case -ESHUTDOWN: | 98 | case -ESHUTDOWN: |
| 97 | /* this urb is terminated, clean up */ | 99 | /* this urb is terminated, clean up */ |
| 98 | dbg("%s - urb shutting down with status: %d", __func__, urb->status); | 100 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", |
| 101 | __func__, urb->status); | ||
| 99 | return; | 102 | return; |
| 100 | default: | 103 | default: |
| 101 | dbg("%s - nonzero urb status received: %d", __func__, urb->status); | 104 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", |
| 105 | __func__, urb->status); | ||
| 102 | goto exit; | 106 | goto exit; |
| 103 | } | 107 | } |
| 104 | 108 | ||
| @@ -110,8 +114,8 @@ static void powermate_irq(struct urb *urb) | |||
| 110 | exit: | 114 | exit: |
| 111 | retval = usb_submit_urb (urb, GFP_ATOMIC); | 115 | retval = usb_submit_urb (urb, GFP_ATOMIC); |
| 112 | if (retval) | 116 | if (retval) |
| 113 | err ("%s - usb_submit_urb failed with result %d", | 117 | dev_err(dev, "%s - usb_submit_urb failed with result: %d\n", |
| 114 | __func__, retval); | 118 | __func__, retval); |
| 115 | } | 119 | } |
| 116 | 120 | ||
| 117 | /* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */ | 121 | /* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */ |
| @@ -330,6 +334,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i | |||
| 330 | goto fail3; | 334 | goto fail3; |
| 331 | 335 | ||
| 332 | pm->udev = udev; | 336 | pm->udev = udev; |
| 337 | pm->intf = intf; | ||
| 333 | pm->input = input_dev; | 338 | pm->input = input_dev; |
| 334 | 339 | ||
| 335 | usb_make_path(udev, pm->phys, sizeof(pm->phys)); | 340 | usb_make_path(udev, pm->phys, sizeof(pm->phys)); |
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index c34f6c0371c4..c8a288ae1d5b 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c | |||
| @@ -251,7 +251,6 @@ static int twl6040_vibra_suspend(struct device *dev) | |||
| 251 | 251 | ||
| 252 | return 0; | 252 | return 0; |
| 253 | } | 253 | } |
| 254 | |||
| 255 | #endif | 254 | #endif |
| 256 | 255 | ||
| 257 | static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); | 256 | static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); |
| @@ -259,13 +258,19 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); | |||
| 259 | static int __devinit twl6040_vibra_probe(struct platform_device *pdev) | 258 | static int __devinit twl6040_vibra_probe(struct platform_device *pdev) |
| 260 | { | 259 | { |
| 261 | struct twl6040_vibra_data *pdata = pdev->dev.platform_data; | 260 | struct twl6040_vibra_data *pdata = pdev->dev.platform_data; |
| 262 | struct device_node *node = pdev->dev.of_node; | 261 | struct device *twl6040_core_dev = pdev->dev.parent; |
| 262 | struct device_node *twl6040_core_node = NULL; | ||
| 263 | struct vibra_info *info; | 263 | struct vibra_info *info; |
| 264 | int vddvibl_uV = 0; | 264 | int vddvibl_uV = 0; |
| 265 | int vddvibr_uV = 0; | 265 | int vddvibr_uV = 0; |
| 266 | int ret; | 266 | int ret; |
| 267 | 267 | ||
| 268 | if (!pdata && !node) { | 268 | #ifdef CONFIG_OF |
| 269 | twl6040_core_node = of_find_node_by_name(twl6040_core_dev->of_node, | ||
| 270 | "vibra"); | ||
| 271 | #endif | ||
| 272 | |||
| 273 | if (!pdata && !twl6040_core_node) { | ||
| 269 | dev_err(&pdev->dev, "platform_data not available\n"); | 274 | dev_err(&pdev->dev, "platform_data not available\n"); |
| 270 | return -EINVAL; | 275 | return -EINVAL; |
| 271 | } | 276 | } |
| @@ -287,14 +292,18 @@ static int __devinit twl6040_vibra_probe(struct platform_device *pdev) | |||
| 287 | vddvibl_uV = pdata->vddvibl_uV; | 292 | vddvibl_uV = pdata->vddvibl_uV; |
| 288 | vddvibr_uV = pdata->vddvibr_uV; | 293 | vddvibr_uV = pdata->vddvibr_uV; |
| 289 | } else { | 294 | } else { |
| 290 | of_property_read_u32(node, "vibldrv_res", &info->vibldrv_res); | 295 | of_property_read_u32(twl6040_core_node, "ti,vibldrv-res", |
| 291 | of_property_read_u32(node, "vibrdrv_res", &info->vibrdrv_res); | 296 | &info->vibldrv_res); |
| 292 | of_property_read_u32(node, "viblmotor_res", | 297 | of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res", |
| 298 | &info->vibrdrv_res); | ||
| 299 | of_property_read_u32(twl6040_core_node, "ti,viblmotor-res", | ||
| 293 | &info->viblmotor_res); | 300 | &info->viblmotor_res); |
| 294 | of_property_read_u32(node, "vibrmotor_res", | 301 | of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res", |
| 295 | &info->vibrmotor_res); | 302 | &info->vibrmotor_res); |
| 296 | of_property_read_u32(node, "vddvibl_uV", &vddvibl_uV); | 303 | of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV", |
| 297 | of_property_read_u32(node, "vddvibr_uV", &vddvibr_uV); | 304 | &vddvibl_uV); |
| 305 | of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV", | ||
| 306 | &vddvibr_uV); | ||
| 298 | } | 307 | } |
| 299 | 308 | ||
| 300 | if ((!info->vibldrv_res && !info->viblmotor_res) || | 309 | if ((!info->vibldrv_res && !info->viblmotor_res) || |
| @@ -351,8 +360,12 @@ static int __devinit twl6040_vibra_probe(struct platform_device *pdev) | |||
| 351 | 360 | ||
| 352 | info->supplies[0].supply = "vddvibl"; | 361 | info->supplies[0].supply = "vddvibl"; |
| 353 | info->supplies[1].supply = "vddvibr"; | 362 | info->supplies[1].supply = "vddvibr"; |
| 354 | ret = regulator_bulk_get(info->dev, ARRAY_SIZE(info->supplies), | 363 | /* |
| 355 | info->supplies); | 364 | * When booted with Device tree the regulators are attached to the |
| 365 | * parent device (twl6040 MFD core) | ||
| 366 | */ | ||
| 367 | ret = regulator_bulk_get(pdata ? info->dev : twl6040_core_dev, | ||
| 368 | ARRAY_SIZE(info->supplies), info->supplies); | ||
| 356 | if (ret) { | 369 | if (ret) { |
| 357 | dev_err(info->dev, "couldn't get regulators %d\n", ret); | 370 | dev_err(info->dev, "couldn't get regulators %d\n", ret); |
| 358 | goto err_regulator; | 371 | goto err_regulator; |
| @@ -418,12 +431,6 @@ static int __devexit twl6040_vibra_remove(struct platform_device *pdev) | |||
| 418 | return 0; | 431 | return 0; |
| 419 | } | 432 | } |
| 420 | 433 | ||
| 421 | static const struct of_device_id twl6040_vibra_of_match[] = { | ||
| 422 | {.compatible = "ti,twl6040-vibra", }, | ||
| 423 | { }, | ||
| 424 | }; | ||
| 425 | MODULE_DEVICE_TABLE(of, twl6040_vibra_of_match); | ||
| 426 | |||
| 427 | static struct platform_driver twl6040_vibra_driver = { | 434 | static struct platform_driver twl6040_vibra_driver = { |
| 428 | .probe = twl6040_vibra_probe, | 435 | .probe = twl6040_vibra_probe, |
| 429 | .remove = __devexit_p(twl6040_vibra_remove), | 436 | .remove = __devexit_p(twl6040_vibra_remove), |
| @@ -431,7 +438,6 @@ static struct platform_driver twl6040_vibra_driver = { | |||
| 431 | .name = "twl6040-vibra", | 438 | .name = "twl6040-vibra", |
| 432 | .owner = THIS_MODULE, | 439 | .owner = THIS_MODULE, |
| 433 | .pm = &twl6040_vibra_pm_ops, | 440 | .pm = &twl6040_vibra_pm_ops, |
| 434 | .of_match_table = twl6040_vibra_of_match, | ||
| 435 | }, | 441 | }, |
| 436 | }; | 442 | }; |
| 437 | module_platform_driver(twl6040_vibra_driver); | 443 | module_platform_driver(twl6040_vibra_driver); |
diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c index 47f18d6bce46..6790a812a1db 100644 --- a/drivers/input/misc/wm831x-on.c +++ b/drivers/input/misc/wm831x-on.c | |||
| @@ -73,7 +73,7 @@ static int __devinit wm831x_on_probe(struct platform_device *pdev) | |||
| 73 | { | 73 | { |
| 74 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); | 74 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); |
| 75 | struct wm831x_on *wm831x_on; | 75 | struct wm831x_on *wm831x_on; |
| 76 | int irq = platform_get_irq(pdev, 0); | 76 | int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); |
| 77 | int ret; | 77 | int ret; |
| 78 | 78 | ||
| 79 | wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL); | 79 | wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL); |
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c index f4776e7f8c15..285a5bd6cbc9 100644 --- a/drivers/input/misc/yealink.c +++ b/drivers/input/misc/yealink.c | |||
| @@ -101,6 +101,7 @@ static const struct lcd_segment_map { | |||
| 101 | struct yealink_dev { | 101 | struct yealink_dev { |
| 102 | struct input_dev *idev; /* input device */ | 102 | struct input_dev *idev; /* input device */ |
| 103 | struct usb_device *udev; /* usb device */ | 103 | struct usb_device *udev; /* usb device */ |
| 104 | struct usb_interface *intf; /* usb interface */ | ||
| 104 | 105 | ||
| 105 | /* irq input channel */ | 106 | /* irq input channel */ |
| 106 | struct yld_ctl_packet *irq_data; | 107 | struct yld_ctl_packet *irq_data; |
| @@ -428,7 +429,8 @@ static void urb_irq_callback(struct urb *urb) | |||
| 428 | int ret, status = urb->status; | 429 | int ret, status = urb->status; |
| 429 | 430 | ||
| 430 | if (status) | 431 | if (status) |
| 431 | err("%s - urb status %d", __func__, status); | 432 | dev_err(&yld->intf->dev, "%s - urb status %d\n", |
| 433 | __func__, status); | ||
| 432 | 434 | ||
| 433 | switch (yld->irq_data->cmd) { | 435 | switch (yld->irq_data->cmd) { |
| 434 | case CMD_KEYPRESS: | 436 | case CMD_KEYPRESS: |
| @@ -437,13 +439,15 @@ static void urb_irq_callback(struct urb *urb) | |||
| 437 | break; | 439 | break; |
| 438 | 440 | ||
| 439 | case CMD_SCANCODE: | 441 | case CMD_SCANCODE: |
| 440 | dbg("get scancode %x", yld->irq_data->data[0]); | 442 | dev_dbg(&yld->intf->dev, "get scancode %x\n", |
| 443 | yld->irq_data->data[0]); | ||
| 441 | 444 | ||
| 442 | report_key(yld, map_p1k_to_key(yld->irq_data->data[0])); | 445 | report_key(yld, map_p1k_to_key(yld->irq_data->data[0])); |
| 443 | break; | 446 | break; |
| 444 | 447 | ||
| 445 | default: | 448 | default: |
| 446 | err("unexpected response %x", yld->irq_data->cmd); | 449 | dev_err(&yld->intf->dev, "unexpected response %x\n", |
| 450 | yld->irq_data->cmd); | ||
| 447 | } | 451 | } |
| 448 | 452 | ||
| 449 | yealink_do_idle_tasks(yld); | 453 | yealink_do_idle_tasks(yld); |
| @@ -451,7 +455,9 @@ static void urb_irq_callback(struct urb *urb) | |||
| 451 | if (!yld->shutdown) { | 455 | if (!yld->shutdown) { |
| 452 | ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); | 456 | ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); |
| 453 | if (ret && ret != -EPERM) | 457 | if (ret && ret != -EPERM) |
| 454 | err("%s - usb_submit_urb failed %d", __func__, ret); | 458 | dev_err(&yld->intf->dev, |
| 459 | "%s - usb_submit_urb failed %d\n", | ||
| 460 | __func__, ret); | ||
| 455 | } | 461 | } |
| 456 | } | 462 | } |
| 457 | 463 | ||
| @@ -461,7 +467,8 @@ static void urb_ctl_callback(struct urb *urb) | |||
| 461 | int ret = 0, status = urb->status; | 467 | int ret = 0, status = urb->status; |
| 462 | 468 | ||
| 463 | if (status) | 469 | if (status) |
| 464 | err("%s - urb status %d", __func__, status); | 470 | dev_err(&yld->intf->dev, "%s - urb status %d\n", |
| 471 | __func__, status); | ||
| 465 | 472 | ||
| 466 | switch (yld->ctl_data->cmd) { | 473 | switch (yld->ctl_data->cmd) { |
| 467 | case CMD_KEYPRESS: | 474 | case CMD_KEYPRESS: |
| @@ -479,7 +486,8 @@ static void urb_ctl_callback(struct urb *urb) | |||
| 479 | } | 486 | } |
| 480 | 487 | ||
| 481 | if (ret && ret != -EPERM) | 488 | if (ret && ret != -EPERM) |
| 482 | err("%s - usb_submit_urb failed %d", __func__, ret); | 489 | dev_err(&yld->intf->dev, "%s - usb_submit_urb failed %d\n", |
| 490 | __func__, ret); | ||
| 483 | } | 491 | } |
| 484 | 492 | ||
| 485 | /******************************************************************************* | 493 | /******************************************************************************* |
| @@ -511,7 +519,7 @@ static int input_open(struct input_dev *dev) | |||
| 511 | struct yealink_dev *yld = input_get_drvdata(dev); | 519 | struct yealink_dev *yld = input_get_drvdata(dev); |
| 512 | int i, ret; | 520 | int i, ret; |
| 513 | 521 | ||
| 514 | dbg("%s", __func__); | 522 | dev_dbg(&yld->intf->dev, "%s\n", __func__); |
| 515 | 523 | ||
| 516 | /* force updates to device */ | 524 | /* force updates to device */ |
| 517 | for (i = 0; i<sizeof(yld->master); i++) | 525 | for (i = 0; i<sizeof(yld->master); i++) |
| @@ -526,8 +534,9 @@ static int input_open(struct input_dev *dev) | |||
| 526 | yld->ctl_data->size = 10; | 534 | yld->ctl_data->size = 10; |
| 527 | yld->ctl_data->sum = 0x100-CMD_INIT-10; | 535 | yld->ctl_data->sum = 0x100-CMD_INIT-10; |
| 528 | if ((ret = usb_submit_urb(yld->urb_ctl, GFP_KERNEL)) != 0) { | 536 | if ((ret = usb_submit_urb(yld->urb_ctl, GFP_KERNEL)) != 0) { |
| 529 | dbg("%s - usb_submit_urb failed with result %d", | 537 | dev_dbg(&yld->intf->dev, |
| 530 | __func__, ret); | 538 | "%s - usb_submit_urb failed with result %d\n", |
| 539 | __func__, ret); | ||
| 531 | return ret; | 540 | return ret; |
| 532 | } | 541 | } |
| 533 | return 0; | 542 | return 0; |
| @@ -876,6 +885,7 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
| 876 | return -ENOMEM; | 885 | return -ENOMEM; |
| 877 | 886 | ||
| 878 | yld->udev = udev; | 887 | yld->udev = udev; |
| 888 | yld->intf = intf; | ||
| 879 | 889 | ||
| 880 | yld->idev = input_dev = input_allocate_device(); | 890 | yld->idev = input_dev = input_allocate_device(); |
| 881 | if (!input_dev) | 891 | if (!input_dev) |
| @@ -909,7 +919,8 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
| 909 | pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); | 919 | pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); |
| 910 | ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); | 920 | ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); |
| 911 | if (ret != USB_PKT_LEN) | 921 | if (ret != USB_PKT_LEN) |
| 912 | err("invalid payload size %d, expected %zd", ret, USB_PKT_LEN); | 922 | dev_err(&intf->dev, "invalid payload size %d, expected %zd\n", |
| 923 | ret, USB_PKT_LEN); | ||
| 913 | 924 | ||
| 914 | /* initialise irq urb */ | 925 | /* initialise irq urb */ |
| 915 | usb_fill_int_urb(yld->urb_irq, udev, pipe, yld->irq_data, | 926 | usb_fill_int_urb(yld->urb_irq, udev, pipe, yld->irq_data, |
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index 0acbc7d50d05..e42f1fa8cdc0 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c | |||
| @@ -195,6 +195,7 @@ enum atp_status_bits { | |||
| 195 | struct atp { | 195 | struct atp { |
| 196 | char phys[64]; | 196 | char phys[64]; |
| 197 | struct usb_device *udev; /* usb device */ | 197 | struct usb_device *udev; /* usb device */ |
| 198 | struct usb_interface *intf; /* usb interface */ | ||
| 198 | struct urb *urb; /* usb request block */ | 199 | struct urb *urb; /* usb request block */ |
| 199 | u8 *data; /* transferred data */ | 200 | u8 *data; /* transferred data */ |
| 200 | struct input_dev *input; /* input dev */ | 201 | struct input_dev *input; /* input dev */ |
| @@ -253,8 +254,9 @@ MODULE_PARM_DESC(debug, "Activate debugging output"); | |||
| 253 | * packets (Report ID 2). This code changes device mode, so it | 254 | * packets (Report ID 2). This code changes device mode, so it |
| 254 | * sends raw sensor reports (Report ID 5). | 255 | * sends raw sensor reports (Report ID 5). |
| 255 | */ | 256 | */ |
| 256 | static int atp_geyser_init(struct usb_device *udev) | 257 | static int atp_geyser_init(struct atp *dev) |
| 257 | { | 258 | { |
| 259 | struct usb_device *udev = dev->udev; | ||
| 258 | char *data; | 260 | char *data; |
| 259 | int size; | 261 | int size; |
| 260 | int i; | 262 | int i; |
| @@ -262,7 +264,7 @@ static int atp_geyser_init(struct usb_device *udev) | |||
| 262 | 264 | ||
| 263 | data = kmalloc(8, GFP_KERNEL); | 265 | data = kmalloc(8, GFP_KERNEL); |
| 264 | if (!data) { | 266 | if (!data) { |
| 265 | err("Out of memory"); | 267 | dev_err(&dev->intf->dev, "Out of memory\n"); |
| 266 | return -ENOMEM; | 268 | return -ENOMEM; |
| 267 | } | 269 | } |
| 268 | 270 | ||
| @@ -277,7 +279,7 @@ static int atp_geyser_init(struct usb_device *udev) | |||
| 277 | for (i = 0; i < 8; i++) | 279 | for (i = 0; i < 8; i++) |
| 278 | dprintk("appletouch[%d]: %d\n", i, data[i]); | 280 | dprintk("appletouch[%d]: %d\n", i, data[i]); |
| 279 | 281 | ||
| 280 | err("Failed to read mode from device."); | 282 | dev_err(&dev->intf->dev, "Failed to read mode from device.\n"); |
| 281 | ret = -EIO; | 283 | ret = -EIO; |
| 282 | goto out_free; | 284 | goto out_free; |
| 283 | } | 285 | } |
| @@ -296,7 +298,7 @@ static int atp_geyser_init(struct usb_device *udev) | |||
| 296 | for (i = 0; i < 8; i++) | 298 | for (i = 0; i < 8; i++) |
| 297 | dprintk("appletouch[%d]: %d\n", i, data[i]); | 299 | dprintk("appletouch[%d]: %d\n", i, data[i]); |
| 298 | 300 | ||
| 299 | err("Failed to request geyser raw mode"); | 301 | dev_err(&dev->intf->dev, "Failed to request geyser raw mode\n"); |
| 300 | ret = -EIO; | 302 | ret = -EIO; |
| 301 | goto out_free; | 303 | goto out_free; |
| 302 | } | 304 | } |
| @@ -313,16 +315,16 @@ out_free: | |||
| 313 | static void atp_reinit(struct work_struct *work) | 315 | static void atp_reinit(struct work_struct *work) |
| 314 | { | 316 | { |
| 315 | struct atp *dev = container_of(work, struct atp, work); | 317 | struct atp *dev = container_of(work, struct atp, work); |
| 316 | struct usb_device *udev = dev->udev; | ||
| 317 | int retval; | 318 | int retval; |
| 318 | 319 | ||
| 319 | dprintk("appletouch: putting appletouch to sleep (reinit)\n"); | 320 | dprintk("appletouch: putting appletouch to sleep (reinit)\n"); |
| 320 | atp_geyser_init(udev); | 321 | atp_geyser_init(dev); |
| 321 | 322 | ||
| 322 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); | 323 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); |
| 323 | if (retval) | 324 | if (retval) |
| 324 | err("atp_reinit: usb_submit_urb failed with error %d", | 325 | dev_err(&dev->intf->dev, |
| 325 | retval); | 326 | "atp_reinit: usb_submit_urb failed with error %d\n", |
| 327 | retval); | ||
| 326 | } | 328 | } |
| 327 | 329 | ||
| 328 | static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, | 330 | static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, |
| @@ -400,6 +402,7 @@ static inline void atp_report_fingers(struct input_dev *input, int fingers) | |||
| 400 | static int atp_status_check(struct urb *urb) | 402 | static int atp_status_check(struct urb *urb) |
| 401 | { | 403 | { |
| 402 | struct atp *dev = urb->context; | 404 | struct atp *dev = urb->context; |
| 405 | struct usb_interface *intf = dev->intf; | ||
| 403 | 406 | ||
| 404 | switch (urb->status) { | 407 | switch (urb->status) { |
| 405 | case 0: | 408 | case 0: |
| @@ -407,8 +410,8 @@ static int atp_status_check(struct urb *urb) | |||
| 407 | break; | 410 | break; |
| 408 | case -EOVERFLOW: | 411 | case -EOVERFLOW: |
| 409 | if (!dev->overflow_warned) { | 412 | if (!dev->overflow_warned) { |
| 410 | printk(KERN_WARNING "appletouch: OVERFLOW with data " | 413 | dev_warn(&intf->dev, |
| 411 | "length %d, actual length is %d\n", | 414 | "appletouch: OVERFLOW with data length %d, actual length is %d\n", |
| 412 | dev->info->datalen, dev->urb->actual_length); | 415 | dev->info->datalen, dev->urb->actual_length); |
| 413 | dev->overflow_warned = true; | 416 | dev->overflow_warned = true; |
| 414 | } | 417 | } |
| @@ -416,13 +419,15 @@ static int atp_status_check(struct urb *urb) | |||
| 416 | case -ENOENT: | 419 | case -ENOENT: |
| 417 | case -ESHUTDOWN: | 420 | case -ESHUTDOWN: |
| 418 | /* This urb is terminated, clean up */ | 421 | /* This urb is terminated, clean up */ |
| 419 | dbg("atp_complete: urb shutting down with status: %d", | 422 | dev_dbg(&intf->dev, |
| 420 | urb->status); | 423 | "atp_complete: urb shutting down with status: %d\n", |
| 424 | urb->status); | ||
| 421 | return ATP_URB_STATUS_ERROR_FATAL; | 425 | return ATP_URB_STATUS_ERROR_FATAL; |
| 422 | 426 | ||
| 423 | default: | 427 | default: |
| 424 | dbg("atp_complete: nonzero urb status received: %d", | 428 | dev_dbg(&intf->dev, |
| 425 | urb->status); | 429 | "atp_complete: nonzero urb status received: %d\n", |
| 430 | urb->status); | ||
| 426 | return ATP_URB_STATUS_ERROR; | 431 | return ATP_URB_STATUS_ERROR; |
| 427 | } | 432 | } |
| 428 | 433 | ||
| @@ -445,7 +450,8 @@ static void atp_detect_size(struct atp *dev) | |||
| 445 | for (i = dev->info->xsensors; i < ATP_XSENSORS; i++) { | 450 | for (i = dev->info->xsensors; i < ATP_XSENSORS; i++) { |
| 446 | if (dev->xy_cur[i]) { | 451 | if (dev->xy_cur[i]) { |
| 447 | 452 | ||
| 448 | printk(KERN_INFO "appletouch: 17\" model detected.\n"); | 453 | dev_info(&dev->intf->dev, |
| 454 | "appletouch: 17\" model detected.\n"); | ||
| 449 | 455 | ||
| 450 | input_set_abs_params(dev->input, ABS_X, 0, | 456 | input_set_abs_params(dev->input, ABS_X, 0, |
| 451 | (dev->info->xsensors_17 - 1) * | 457 | (dev->info->xsensors_17 - 1) * |
| @@ -588,8 +594,9 @@ static void atp_complete_geyser_1_2(struct urb *urb) | |||
| 588 | exit: | 594 | exit: |
| 589 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); | 595 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); |
| 590 | if (retval) | 596 | if (retval) |
| 591 | err("atp_complete: usb_submit_urb failed with result %d", | 597 | dev_err(&dev->intf->dev, |
| 592 | retval); | 598 | "atp_complete: usb_submit_urb failed with result %d\n", |
| 599 | retval); | ||
| 593 | } | 600 | } |
| 594 | 601 | ||
| 595 | /* Interrupt function for older touchpads: GEYSER3/GEYSER4 */ | 602 | /* Interrupt function for older touchpads: GEYSER3/GEYSER4 */ |
| @@ -722,8 +729,9 @@ static void atp_complete_geyser_3_4(struct urb *urb) | |||
| 722 | exit: | 729 | exit: |
| 723 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); | 730 | retval = usb_submit_urb(dev->urb, GFP_ATOMIC); |
| 724 | if (retval) | 731 | if (retval) |
| 725 | err("atp_complete: usb_submit_urb failed with result %d", | 732 | dev_err(&dev->intf->dev, |
| 726 | retval); | 733 | "atp_complete: usb_submit_urb failed with result %d\n", |
| 734 | retval); | ||
| 727 | } | 735 | } |
| 728 | 736 | ||
| 729 | static int atp_open(struct input_dev *input) | 737 | static int atp_open(struct input_dev *input) |
| @@ -748,14 +756,12 @@ static void atp_close(struct input_dev *input) | |||
| 748 | 756 | ||
| 749 | static int atp_handle_geyser(struct atp *dev) | 757 | static int atp_handle_geyser(struct atp *dev) |
| 750 | { | 758 | { |
| 751 | struct usb_device *udev = dev->udev; | ||
| 752 | |||
| 753 | if (dev->info != &fountain_info) { | 759 | if (dev->info != &fountain_info) { |
| 754 | /* switch to raw sensor mode */ | 760 | /* switch to raw sensor mode */ |
| 755 | if (atp_geyser_init(udev)) | 761 | if (atp_geyser_init(dev)) |
| 756 | return -EIO; | 762 | return -EIO; |
| 757 | 763 | ||
| 758 | printk(KERN_INFO "appletouch: Geyser mode initialized.\n"); | 764 | dev_info(&dev->intf->dev, "Geyser mode initialized.\n"); |
| 759 | } | 765 | } |
| 760 | 766 | ||
| 761 | return 0; | 767 | return 0; |
| @@ -785,7 +791,7 @@ static int atp_probe(struct usb_interface *iface, | |||
| 785 | } | 791 | } |
| 786 | } | 792 | } |
| 787 | if (!int_in_endpointAddr) { | 793 | if (!int_in_endpointAddr) { |
| 788 | err("Could not find int-in endpoint"); | 794 | dev_err(&iface->dev, "Could not find int-in endpoint\n"); |
| 789 | return -EIO; | 795 | return -EIO; |
| 790 | } | 796 | } |
| 791 | 797 | ||
| @@ -793,11 +799,12 @@ static int atp_probe(struct usb_interface *iface, | |||
| 793 | dev = kzalloc(sizeof(struct atp), GFP_KERNEL); | 799 | dev = kzalloc(sizeof(struct atp), GFP_KERNEL); |
| 794 | input_dev = input_allocate_device(); | 800 | input_dev = input_allocate_device(); |
| 795 | if (!dev || !input_dev) { | 801 | if (!dev || !input_dev) { |
| 796 | err("Out of memory"); | 802 | dev_err(&iface->dev, "Out of memory\n"); |
| 797 | goto err_free_devs; | 803 | goto err_free_devs; |
| 798 | } | 804 | } |
| 799 | 805 | ||
| 800 | dev->udev = udev; | 806 | dev->udev = udev; |
| 807 | dev->intf = iface; | ||
| 801 | dev->input = input_dev; | 808 | dev->input = input_dev; |
| 802 | dev->info = info; | 809 | dev->info = info; |
| 803 | dev->overflow_warned = false; | 810 | dev->overflow_warned = false; |
| @@ -886,7 +893,7 @@ static void atp_disconnect(struct usb_interface *iface) | |||
| 886 | usb_free_urb(dev->urb); | 893 | usb_free_urb(dev->urb); |
| 887 | kfree(dev); | 894 | kfree(dev); |
| 888 | } | 895 | } |
| 889 | printk(KERN_INFO "input: appletouch disconnected\n"); | 896 | dev_info(&iface->dev, "input: appletouch disconnected\n"); |
| 890 | } | 897 | } |
| 891 | 898 | ||
| 892 | static int atp_recover(struct atp *dev) | 899 | static int atp_recover(struct atp *dev) |
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index e410b98c2271..d528c23e194f 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
| @@ -604,7 +604,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) | |||
| 604 | int retval = 0, size; | 604 | int retval = 0, size; |
| 605 | 605 | ||
| 606 | if (!data) { | 606 | if (!data) { |
| 607 | err("bcm5974: out of memory"); | 607 | dev_err(&dev->intf->dev, "out of memory\n"); |
| 608 | retval = -ENOMEM; | 608 | retval = -ENOMEM; |
| 609 | goto out; | 609 | goto out; |
| 610 | } | 610 | } |
| @@ -617,7 +617,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) | |||
| 617 | BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); | 617 | BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); |
| 618 | 618 | ||
| 619 | if (size != 8) { | 619 | if (size != 8) { |
| 620 | err("bcm5974: could not read from device"); | 620 | dev_err(&dev->intf->dev, "could not read from device\n"); |
| 621 | retval = -EIO; | 621 | retval = -EIO; |
| 622 | goto out; | 622 | goto out; |
| 623 | } | 623 | } |
| @@ -635,7 +635,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) | |||
| 635 | BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); | 635 | BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); |
| 636 | 636 | ||
| 637 | if (size != 8) { | 637 | if (size != 8) { |
| 638 | err("bcm5974: could not write to device"); | 638 | dev_err(&dev->intf->dev, "could not write to device\n"); |
| 639 | retval = -EIO; | 639 | retval = -EIO; |
| 640 | goto out; | 640 | goto out; |
| 641 | } | 641 | } |
| @@ -651,6 +651,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) | |||
| 651 | static void bcm5974_irq_button(struct urb *urb) | 651 | static void bcm5974_irq_button(struct urb *urb) |
| 652 | { | 652 | { |
| 653 | struct bcm5974 *dev = urb->context; | 653 | struct bcm5974 *dev = urb->context; |
| 654 | struct usb_interface *intf = dev->intf; | ||
| 654 | int error; | 655 | int error; |
| 655 | 656 | ||
| 656 | switch (urb->status) { | 657 | switch (urb->status) { |
| @@ -660,10 +661,11 @@ static void bcm5974_irq_button(struct urb *urb) | |||
| 660 | case -ECONNRESET: | 661 | case -ECONNRESET: |
| 661 | case -ENOENT: | 662 | case -ENOENT: |
| 662 | case -ESHUTDOWN: | 663 | case -ESHUTDOWN: |
| 663 | dbg("bcm5974: button urb shutting down: %d", urb->status); | 664 | dev_dbg(&intf->dev, "button urb shutting down: %d\n", |
| 665 | urb->status); | ||
| 664 | return; | 666 | return; |
| 665 | default: | 667 | default: |
| 666 | dbg("bcm5974: button urb status: %d", urb->status); | 668 | dev_dbg(&intf->dev, "button urb status: %d\n", urb->status); |
| 667 | goto exit; | 669 | goto exit; |
| 668 | } | 670 | } |
| 669 | 671 | ||
| @@ -674,12 +676,13 @@ static void bcm5974_irq_button(struct urb *urb) | |||
| 674 | exit: | 676 | exit: |
| 675 | error = usb_submit_urb(dev->bt_urb, GFP_ATOMIC); | 677 | error = usb_submit_urb(dev->bt_urb, GFP_ATOMIC); |
| 676 | if (error) | 678 | if (error) |
| 677 | err("bcm5974: button urb failed: %d", error); | 679 | dev_err(&intf->dev, "button urb failed: %d\n", error); |
| 678 | } | 680 | } |
| 679 | 681 | ||
| 680 | static void bcm5974_irq_trackpad(struct urb *urb) | 682 | static void bcm5974_irq_trackpad(struct urb *urb) |
| 681 | { | 683 | { |
| 682 | struct bcm5974 *dev = urb->context; | 684 | struct bcm5974 *dev = urb->context; |
| 685 | struct usb_interface *intf = dev->intf; | ||
| 683 | int error; | 686 | int error; |
| 684 | 687 | ||
| 685 | switch (urb->status) { | 688 | switch (urb->status) { |
| @@ -689,10 +692,11 @@ static void bcm5974_irq_trackpad(struct urb *urb) | |||
| 689 | case -ECONNRESET: | 692 | case -ECONNRESET: |
| 690 | case -ENOENT: | 693 | case -ENOENT: |
| 691 | case -ESHUTDOWN: | 694 | case -ESHUTDOWN: |
| 692 | dbg("bcm5974: trackpad urb shutting down: %d", urb->status); | 695 | dev_dbg(&intf->dev, "trackpad urb shutting down: %d\n", |
| 696 | urb->status); | ||
| 693 | return; | 697 | return; |
| 694 | default: | 698 | default: |
| 695 | dbg("bcm5974: trackpad urb status: %d", urb->status); | 699 | dev_dbg(&intf->dev, "trackpad urb status: %d\n", urb->status); |
| 696 | goto exit; | 700 | goto exit; |
| 697 | } | 701 | } |
| 698 | 702 | ||
| @@ -707,7 +711,7 @@ static void bcm5974_irq_trackpad(struct urb *urb) | |||
| 707 | exit: | 711 | exit: |
| 708 | error = usb_submit_urb(dev->tp_urb, GFP_ATOMIC); | 712 | error = usb_submit_urb(dev->tp_urb, GFP_ATOMIC); |
| 709 | if (error) | 713 | if (error) |
| 710 | err("bcm5974: trackpad urb failed: %d", error); | 714 | dev_err(&intf->dev, "trackpad urb failed: %d\n", error); |
| 711 | } | 715 | } |
| 712 | 716 | ||
| 713 | /* | 717 | /* |
| @@ -853,7 +857,7 @@ static int bcm5974_probe(struct usb_interface *iface, | |||
| 853 | dev = kzalloc(sizeof(struct bcm5974), GFP_KERNEL); | 857 | dev = kzalloc(sizeof(struct bcm5974), GFP_KERNEL); |
| 854 | input_dev = input_allocate_device(); | 858 | input_dev = input_allocate_device(); |
| 855 | if (!dev || !input_dev) { | 859 | if (!dev || !input_dev) { |
| 856 | err("bcm5974: out of memory"); | 860 | dev_err(&iface->dev, "out of memory\n"); |
| 857 | goto err_free_devs; | 861 | goto err_free_devs; |
| 858 | } | 862 | } |
| 859 | 863 | ||
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index c703d53be3a0..d5b390f75c9a 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
| @@ -139,6 +139,35 @@ static int synaptics_model_id(struct psmouse *psmouse) | |||
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | /* | 141 | /* |
| 142 | * Read the board id from the touchpad | ||
| 143 | * The board id is encoded in the "QUERY MODES" response | ||
| 144 | */ | ||
| 145 | static int synaptics_board_id(struct psmouse *psmouse) | ||
| 146 | { | ||
| 147 | struct synaptics_data *priv = psmouse->private; | ||
| 148 | unsigned char bid[3]; | ||
| 149 | |||
| 150 | if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid)) | ||
| 151 | return -1; | ||
| 152 | priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1]; | ||
| 153 | return 0; | ||
| 154 | } | ||
| 155 | |||
| 156 | /* | ||
| 157 | * Read the firmware id from the touchpad | ||
| 158 | */ | ||
| 159 | static int synaptics_firmware_id(struct psmouse *psmouse) | ||
| 160 | { | ||
| 161 | struct synaptics_data *priv = psmouse->private; | ||
| 162 | unsigned char fwid[3]; | ||
| 163 | |||
| 164 | if (synaptics_send_cmd(psmouse, SYN_QUE_FIRMWARE_ID, fwid)) | ||
| 165 | return -1; | ||
| 166 | priv->firmware_id = (fwid[0] << 16) | (fwid[1] << 8) | fwid[2]; | ||
| 167 | return 0; | ||
| 168 | } | ||
| 169 | |||
| 170 | /* | ||
| 142 | * Read the capability-bits from the touchpad | 171 | * Read the capability-bits from the touchpad |
| 143 | * see also the SYN_CAP_* macros | 172 | * see also the SYN_CAP_* macros |
| 144 | */ | 173 | */ |
| @@ -261,6 +290,10 @@ static int synaptics_query_hardware(struct psmouse *psmouse) | |||
| 261 | return -1; | 290 | return -1; |
| 262 | if (synaptics_model_id(psmouse)) | 291 | if (synaptics_model_id(psmouse)) |
| 263 | return -1; | 292 | return -1; |
| 293 | if (synaptics_firmware_id(psmouse)) | ||
| 294 | return -1; | ||
| 295 | if (synaptics_board_id(psmouse)) | ||
| 296 | return -1; | ||
| 264 | if (synaptics_capability(psmouse)) | 297 | if (synaptics_capability(psmouse)) |
| 265 | return -1; | 298 | return -1; |
| 266 | if (synaptics_resolution(psmouse)) | 299 | if (synaptics_resolution(psmouse)) |
| @@ -1435,11 +1468,12 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) | |||
| 1435 | priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; | 1468 | priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; |
| 1436 | 1469 | ||
| 1437 | psmouse_info(psmouse, | 1470 | psmouse_info(psmouse, |
| 1438 | "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n", | 1471 | "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx, board id: %lu, fw id: %lu\n", |
| 1439 | SYN_ID_MODEL(priv->identity), | 1472 | SYN_ID_MODEL(priv->identity), |
| 1440 | SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), | 1473 | SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), |
| 1441 | priv->model_id, | 1474 | priv->model_id, |
| 1442 | priv->capabilities, priv->ext_cap, priv->ext_cap_0c); | 1475 | priv->capabilities, priv->ext_cap, priv->ext_cap_0c, |
| 1476 | priv->board_id, priv->firmware_id); | ||
| 1443 | 1477 | ||
| 1444 | set_input_params(psmouse->dev, priv); | 1478 | set_input_params(psmouse->dev, priv); |
| 1445 | 1479 | ||
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index fd26ccca13d7..e594af0b264b 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07 | 18 | #define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07 |
| 19 | #define SYN_QUE_RESOLUTION 0x08 | 19 | #define SYN_QUE_RESOLUTION 0x08 |
| 20 | #define SYN_QUE_EXT_CAPAB 0x09 | 20 | #define SYN_QUE_EXT_CAPAB 0x09 |
| 21 | #define SYN_QUE_FIRMWARE_ID 0x0a | ||
| 21 | #define SYN_QUE_EXT_CAPAB_0C 0x0c | 22 | #define SYN_QUE_EXT_CAPAB_0C 0x0c |
| 22 | #define SYN_QUE_EXT_MAX_COORDS 0x0d | 23 | #define SYN_QUE_EXT_MAX_COORDS 0x0d |
| 23 | #define SYN_QUE_EXT_MIN_COORDS 0x0f | 24 | #define SYN_QUE_EXT_MIN_COORDS 0x0f |
| @@ -148,6 +149,8 @@ struct synaptics_hw_state { | |||
| 148 | struct synaptics_data { | 149 | struct synaptics_data { |
| 149 | /* Data read from the touchpad */ | 150 | /* Data read from the touchpad */ |
| 150 | unsigned long int model_id; /* Model-ID */ | 151 | unsigned long int model_id; /* Model-ID */ |
| 152 | unsigned long int firmware_id; /* Firmware-ID */ | ||
| 153 | unsigned long int board_id; /* Board-ID */ | ||
| 151 | unsigned long int capabilities; /* Capabilities */ | 154 | unsigned long int capabilities; /* Capabilities */ |
| 152 | unsigned long int ext_cap; /* Extended Capabilities */ | 155 | unsigned long int ext_cap; /* Extended Capabilities */ |
| 153 | unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */ | 156 | unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */ |
diff --git a/drivers/input/mouse/synaptics_usb.c b/drivers/input/mouse/synaptics_usb.c index 3c5eaaa5d154..64cf34ea7604 100644 --- a/drivers/input/mouse/synaptics_usb.c +++ b/drivers/input/mouse/synaptics_usb.c | |||
| @@ -364,7 +364,7 @@ static int synusb_probe(struct usb_interface *intf, | |||
| 364 | le16_to_cpu(udev->descriptor.idProduct)); | 364 | le16_to_cpu(udev->descriptor.idProduct)); |
| 365 | 365 | ||
| 366 | if (synusb->flags & SYNUSB_STICK) | 366 | if (synusb->flags & SYNUSB_STICK) |
| 367 | strlcat(synusb->name, " (Stick) ", sizeof(synusb->name)); | 367 | strlcat(synusb->name, " (Stick)", sizeof(synusb->name)); |
| 368 | 368 | ||
| 369 | usb_make_path(udev, synusb->phys, sizeof(synusb->phys)); | 369 | usb_make_path(udev, synusb->phys, sizeof(synusb->phys)); |
| 370 | strlcat(synusb->phys, "/input0", sizeof(synusb->phys)); | 370 | strlcat(synusb->phys, "/input0", sizeof(synusb->phys)); |
diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c index f8b0b1df9138..e062ec899ca1 100644 --- a/drivers/input/tablet/acecad.c +++ b/drivers/input/tablet/acecad.c | |||
| @@ -51,6 +51,7 @@ struct usb_acecad { | |||
| 51 | char name[128]; | 51 | char name[128]; |
| 52 | char phys[64]; | 52 | char phys[64]; |
| 53 | struct usb_device *usbdev; | 53 | struct usb_device *usbdev; |
| 54 | struct usb_interface *intf; | ||
| 54 | struct input_dev *input; | 55 | struct input_dev *input; |
| 55 | struct urb *irq; | 56 | struct urb *irq; |
| 56 | 57 | ||
| @@ -63,6 +64,7 @@ static void usb_acecad_irq(struct urb *urb) | |||
| 63 | struct usb_acecad *acecad = urb->context; | 64 | struct usb_acecad *acecad = urb->context; |
| 64 | unsigned char *data = acecad->data; | 65 | unsigned char *data = acecad->data; |
| 65 | struct input_dev *dev = acecad->input; | 66 | struct input_dev *dev = acecad->input; |
| 67 | struct usb_interface *intf = acecad->intf; | ||
| 66 | int prox, status; | 68 | int prox, status; |
| 67 | 69 | ||
| 68 | switch (urb->status) { | 70 | switch (urb->status) { |
| @@ -73,10 +75,12 @@ static void usb_acecad_irq(struct urb *urb) | |||
| 73 | case -ENOENT: | 75 | case -ENOENT: |
| 74 | case -ESHUTDOWN: | 76 | case -ESHUTDOWN: |
| 75 | /* this urb is terminated, clean up */ | 77 | /* this urb is terminated, clean up */ |
| 76 | dbg("%s - urb shutting down with status: %d", __func__, urb->status); | 78 | dev_dbg(&intf->dev, "%s - urb shutting down with status: %d\n", |
| 79 | __func__, urb->status); | ||
| 77 | return; | 80 | return; |
| 78 | default: | 81 | default: |
| 79 | dbg("%s - nonzero urb status received: %d", __func__, urb->status); | 82 | dev_dbg(&intf->dev, "%s - nonzero urb status received: %d\n", |
| 83 | __func__, urb->status); | ||
| 80 | goto resubmit; | 84 | goto resubmit; |
| 81 | } | 85 | } |
| 82 | 86 | ||
| @@ -105,8 +109,10 @@ static void usb_acecad_irq(struct urb *urb) | |||
| 105 | resubmit: | 109 | resubmit: |
| 106 | status = usb_submit_urb(urb, GFP_ATOMIC); | 110 | status = usb_submit_urb(urb, GFP_ATOMIC); |
| 107 | if (status) | 111 | if (status) |
| 108 | err("can't resubmit intr, %s-%s/input0, status %d", | 112 | dev_err(&intf->dev, |
| 109 | acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); | 113 | "can't resubmit intr, %s-%s/input0, status %d\n", |
| 114 | acecad->usbdev->bus->bus_name, | ||
| 115 | acecad->usbdev->devpath, status); | ||
| 110 | } | 116 | } |
| 111 | 117 | ||
| 112 | static int usb_acecad_open(struct input_dev *dev) | 118 | static int usb_acecad_open(struct input_dev *dev) |
| @@ -168,6 +174,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ | |||
| 168 | } | 174 | } |
| 169 | 175 | ||
| 170 | acecad->usbdev = dev; | 176 | acecad->usbdev = dev; |
| 177 | acecad->intf = intf; | ||
| 171 | acecad->input = input_dev; | 178 | acecad->input = input_dev; |
| 172 | 179 | ||
| 173 | if (dev->manufacturer) | 180 | if (dev->manufacturer) |
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index a33d3470c47a..ee83c3904ee8 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c | |||
| @@ -309,6 +309,7 @@ struct aiptek_settings { | |||
| 309 | struct aiptek { | 309 | struct aiptek { |
| 310 | struct input_dev *inputdev; /* input device struct */ | 310 | struct input_dev *inputdev; /* input device struct */ |
| 311 | struct usb_device *usbdev; /* usb device struct */ | 311 | struct usb_device *usbdev; /* usb device struct */ |
| 312 | struct usb_interface *intf; /* usb interface struct */ | ||
| 312 | struct urb *urb; /* urb for incoming reports */ | 313 | struct urb *urb; /* urb for incoming reports */ |
| 313 | dma_addr_t data_dma; /* our dma stuffage */ | 314 | dma_addr_t data_dma; /* our dma stuffage */ |
| 314 | struct aiptek_features features; /* tablet's array of features */ | 315 | struct aiptek_features features; /* tablet's array of features */ |
| @@ -435,6 +436,7 @@ static void aiptek_irq(struct urb *urb) | |||
| 435 | struct aiptek *aiptek = urb->context; | 436 | struct aiptek *aiptek = urb->context; |
| 436 | unsigned char *data = aiptek->data; | 437 | unsigned char *data = aiptek->data; |
| 437 | struct input_dev *inputdev = aiptek->inputdev; | 438 | struct input_dev *inputdev = aiptek->inputdev; |
| 439 | struct usb_interface *intf = aiptek->intf; | ||
| 438 | int jitterable = 0; | 440 | int jitterable = 0; |
| 439 | int retval, macro, x, y, z, left, right, middle, p, dv, tip, bs, pck; | 441 | int retval, macro, x, y, z, left, right, middle, p, dv, tip, bs, pck; |
| 440 | 442 | ||
| @@ -447,13 +449,13 @@ static void aiptek_irq(struct urb *urb) | |||
| 447 | case -ENOENT: | 449 | case -ENOENT: |
| 448 | case -ESHUTDOWN: | 450 | case -ESHUTDOWN: |
| 449 | /* This urb is terminated, clean up */ | 451 | /* This urb is terminated, clean up */ |
| 450 | dbg("%s - urb shutting down with status: %d", | 452 | dev_dbg(&intf->dev, "%s - urb shutting down with status: %d\n", |
| 451 | __func__, urb->status); | 453 | __func__, urb->status); |
| 452 | return; | 454 | return; |
| 453 | 455 | ||
| 454 | default: | 456 | default: |
| 455 | dbg("%s - nonzero urb status received: %d", | 457 | dev_dbg(&intf->dev, "%s - nonzero urb status received: %d\n", |
| 456 | __func__, urb->status); | 458 | __func__, urb->status); |
| 457 | goto exit; | 459 | goto exit; |
| 458 | } | 460 | } |
| 459 | 461 | ||
| @@ -785,7 +787,7 @@ static void aiptek_irq(struct urb *urb) | |||
| 785 | 1 | AIPTEK_REPORT_TOOL_UNKNOWN); | 787 | 1 | AIPTEK_REPORT_TOOL_UNKNOWN); |
| 786 | input_sync(inputdev); | 788 | input_sync(inputdev); |
| 787 | } else { | 789 | } else { |
| 788 | dbg("Unknown report %d", data[0]); | 790 | dev_dbg(&intf->dev, "Unknown report %d\n", data[0]); |
| 789 | } | 791 | } |
| 790 | 792 | ||
| 791 | /* Jitter may occur when the user presses a button on the stlyus | 793 | /* Jitter may occur when the user presses a button on the stlyus |
| @@ -811,8 +813,9 @@ static void aiptek_irq(struct urb *urb) | |||
| 811 | exit: | 813 | exit: |
| 812 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 814 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
| 813 | if (retval != 0) { | 815 | if (retval != 0) { |
| 814 | err("%s - usb_submit_urb failed with result %d", | 816 | dev_err(&intf->dev, |
| 815 | __func__, retval); | 817 | "%s - usb_submit_urb failed with result %d\n", |
| 818 | __func__, retval); | ||
| 816 | } | 819 | } |
| 817 | } | 820 | } |
| 818 | 821 | ||
| @@ -912,8 +915,9 @@ aiptek_command(struct aiptek *aiptek, unsigned char command, unsigned char data) | |||
| 912 | 915 | ||
| 913 | if ((ret = | 916 | if ((ret = |
| 914 | aiptek_set_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { | 917 | aiptek_set_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { |
| 915 | dbg("aiptek_program: failed, tried to send: 0x%02x 0x%02x", | 918 | dev_dbg(&aiptek->intf->dev, |
| 916 | command, data); | 919 | "aiptek_program: failed, tried to send: 0x%02x 0x%02x\n", |
| 920 | command, data); | ||
| 917 | } | 921 | } |
| 918 | kfree(buf); | 922 | kfree(buf); |
| 919 | return ret < 0 ? ret : 0; | 923 | return ret < 0 ? ret : 0; |
| @@ -947,8 +951,9 @@ aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data) | |||
| 947 | 951 | ||
| 948 | if ((ret = | 952 | if ((ret = |
| 949 | aiptek_get_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { | 953 | aiptek_get_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { |
| 950 | dbg("aiptek_query failed: returned 0x%02x 0x%02x 0x%02x", | 954 | dev_dbg(&aiptek->intf->dev, |
| 951 | buf[0], buf[1], buf[2]); | 955 | "aiptek_query failed: returned 0x%02x 0x%02x 0x%02x\n", |
| 956 | buf[0], buf[1], buf[2]); | ||
| 952 | ret = -EIO; | 957 | ret = -EIO; |
| 953 | } else { | 958 | } else { |
| 954 | ret = get_unaligned_le16(buf + 1); | 959 | ret = get_unaligned_le16(buf + 1); |
| @@ -1726,6 +1731,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
| 1726 | 1731 | ||
| 1727 | aiptek->inputdev = inputdev; | 1732 | aiptek->inputdev = inputdev; |
| 1728 | aiptek->usbdev = usbdev; | 1733 | aiptek->usbdev = usbdev; |
| 1734 | aiptek->intf = intf; | ||
| 1729 | aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; | 1735 | aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; |
| 1730 | aiptek->inDelay = 0; | 1736 | aiptek->inDelay = 0; |
| 1731 | aiptek->endDelay = 0; | 1737 | aiptek->endDelay = 0; |
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 89a297801dce..29e01ab6859f 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c | |||
| @@ -2,8 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | GTCO digitizer USB driver | 3 | GTCO digitizer USB driver |
| 4 | 4 | ||
| 5 | Use the err() and dbg() macros from usb.h for system logging | ||
| 6 | |||
| 7 | TO CHECK: Is pressure done right on report 5? | 5 | TO CHECK: Is pressure done right on report 5? |
| 8 | 6 | ||
| 9 | Copyright (C) 2006 GTCO CalComp | 7 | Copyright (C) 2006 GTCO CalComp |
| @@ -108,6 +106,7 @@ struct gtco { | |||
| 108 | 106 | ||
| 109 | struct input_dev *inputdevice; /* input device struct pointer */ | 107 | struct input_dev *inputdevice; /* input device struct pointer */ |
| 110 | struct usb_device *usbdev; /* the usb device for this device */ | 108 | struct usb_device *usbdev; /* the usb device for this device */ |
| 109 | struct usb_interface *intf; /* the usb interface for this device */ | ||
| 111 | struct urb *urbinfo; /* urb for incoming reports */ | 110 | struct urb *urbinfo; /* urb for incoming reports */ |
| 112 | dma_addr_t buf_dma; /* dma addr of the data buffer*/ | 111 | dma_addr_t buf_dma; /* dma addr of the data buffer*/ |
| 113 | unsigned char * buffer; /* databuffer for reports */ | 112 | unsigned char * buffer; /* databuffer for reports */ |
| @@ -202,6 +201,7 @@ struct hid_descriptor | |||
| 202 | static void parse_hid_report_descriptor(struct gtco *device, char * report, | 201 | static void parse_hid_report_descriptor(struct gtco *device, char * report, |
| 203 | int length) | 202 | int length) |
| 204 | { | 203 | { |
| 204 | struct device *ddev = &device->intf->dev; | ||
| 205 | int x, i = 0; | 205 | int x, i = 0; |
| 206 | 206 | ||
| 207 | /* Tag primitive vars */ | 207 | /* Tag primitive vars */ |
| @@ -228,7 +228,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, | |||
| 228 | char indentstr[10] = ""; | 228 | char indentstr[10] = ""; |
| 229 | 229 | ||
| 230 | 230 | ||
| 231 | dbg("======>>>>>>PARSE<<<<<<======"); | 231 | dev_dbg(ddev, "======>>>>>>PARSE<<<<<<======\n"); |
| 232 | 232 | ||
| 233 | /* Walk this report and pull out the info we need */ | 233 | /* Walk this report and pull out the info we need */ |
| 234 | while (i < length) { | 234 | while (i < length) { |
| @@ -277,11 +277,11 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, | |||
| 277 | else if (data == 3) | 277 | else if (data == 3) |
| 278 | strcpy(globtype, "Var|Const"); | 278 | strcpy(globtype, "Var|Const"); |
| 279 | 279 | ||
| 280 | dbg("::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits", | 280 | dev_dbg(ddev, "::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits\n", |
| 281 | globalval[TAG_GLOB_REPORT_ID], inputnum, | 281 | globalval[TAG_GLOB_REPORT_ID], inputnum, |
| 282 | globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX], | 282 | globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX], |
| 283 | globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN], | 283 | globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN], |
| 284 | globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]); | 284 | globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]); |
| 285 | 285 | ||
| 286 | 286 | ||
| 287 | /* | 287 | /* |
| @@ -292,7 +292,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, | |||
| 292 | */ | 292 | */ |
| 293 | switch (inputnum) { | 293 | switch (inputnum) { |
| 294 | case 0: /* X coord */ | 294 | case 0: /* X coord */ |
| 295 | dbg("GER: X Usage: 0x%x", usage); | 295 | dev_dbg(ddev, "GER: X Usage: 0x%x\n", usage); |
| 296 | if (device->max_X == 0) { | 296 | if (device->max_X == 0) { |
| 297 | device->max_X = globalval[TAG_GLOB_LOG_MAX]; | 297 | device->max_X = globalval[TAG_GLOB_LOG_MAX]; |
| 298 | device->min_X = globalval[TAG_GLOB_LOG_MIN]; | 298 | device->min_X = globalval[TAG_GLOB_LOG_MIN]; |
| @@ -300,7 +300,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, | |||
| 300 | break; | 300 | break; |
| 301 | 301 | ||
| 302 | case 1: /* Y coord */ | 302 | case 1: /* Y coord */ |
| 303 | dbg("GER: Y Usage: 0x%x", usage); | 303 | dev_dbg(ddev, "GER: Y Usage: 0x%x\n", usage); |
| 304 | if (device->max_Y == 0) { | 304 | if (device->max_Y == 0) { |
| 305 | device->max_Y = globalval[TAG_GLOB_LOG_MAX]; | 305 | device->max_Y = globalval[TAG_GLOB_LOG_MAX]; |
| 306 | device->min_Y = globalval[TAG_GLOB_LOG_MIN]; | 306 | device->min_Y = globalval[TAG_GLOB_LOG_MIN]; |
| @@ -350,10 +350,10 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, | |||
| 350 | maintype = 'S'; | 350 | maintype = 'S'; |
| 351 | 351 | ||
| 352 | if (data == 0) { | 352 | if (data == 0) { |
| 353 | dbg("======>>>>>> Physical"); | 353 | dev_dbg(ddev, "======>>>>>> Physical\n"); |
| 354 | strcpy(globtype, "Physical"); | 354 | strcpy(globtype, "Physical"); |
| 355 | } else | 355 | } else |
| 356 | dbg("======>>>>>>"); | 356 | dev_dbg(ddev, "======>>>>>>\n"); |
| 357 | 357 | ||
| 358 | /* Indent the debug output */ | 358 | /* Indent the debug output */ |
| 359 | indent++; | 359 | indent++; |
| @@ -368,7 +368,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, | |||
| 368 | break; | 368 | break; |
| 369 | 369 | ||
| 370 | case TAG_MAIN_COL_END: | 370 | case TAG_MAIN_COL_END: |
| 371 | dbg("<<<<<<======"); | 371 | dev_dbg(ddev, "<<<<<<======\n"); |
| 372 | maintype = 'E'; | 372 | maintype = 'E'; |
| 373 | indent--; | 373 | indent--; |
| 374 | for (x = 0; x < indent; x++) | 374 | for (x = 0; x < indent; x++) |
| @@ -384,18 +384,18 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, | |||
| 384 | 384 | ||
| 385 | switch (size) { | 385 | switch (size) { |
| 386 | case 1: | 386 | case 1: |
| 387 | dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", | 387 | dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n", |
| 388 | indentstr, tag, maintype, size, globtype, data); | 388 | indentstr, tag, maintype, size, globtype, data); |
| 389 | break; | 389 | break; |
| 390 | 390 | ||
| 391 | case 2: | 391 | case 2: |
| 392 | dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", | 392 | dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n", |
| 393 | indentstr, tag, maintype, size, globtype, data16); | 393 | indentstr, tag, maintype, size, globtype, data16); |
| 394 | break; | 394 | break; |
| 395 | 395 | ||
| 396 | case 4: | 396 | case 4: |
| 397 | dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", | 397 | dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n", |
| 398 | indentstr, tag, maintype, size, globtype, data32); | 398 | indentstr, tag, maintype, size, globtype, data32); |
| 399 | break; | 399 | break; |
| 400 | } | 400 | } |
| 401 | break; | 401 | break; |
| @@ -465,26 +465,26 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, | |||
| 465 | if (tag < TAG_GLOB_MAX) { | 465 | if (tag < TAG_GLOB_MAX) { |
| 466 | switch (size) { | 466 | switch (size) { |
| 467 | case 1: | 467 | case 1: |
| 468 | dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", | 468 | dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n", |
| 469 | indentstr, globtype, tag, size, data); | 469 | indentstr, globtype, tag, size, data); |
| 470 | globalval[tag] = data; | 470 | globalval[tag] = data; |
| 471 | break; | 471 | break; |
| 472 | 472 | ||
| 473 | case 2: | 473 | case 2: |
| 474 | dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", | 474 | dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n", |
| 475 | indentstr, globtype, tag, size, data16); | 475 | indentstr, globtype, tag, size, data16); |
| 476 | globalval[tag] = data16; | 476 | globalval[tag] = data16; |
| 477 | break; | 477 | break; |
| 478 | 478 | ||
| 479 | case 4: | 479 | case 4: |
| 480 | dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", | 480 | dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n", |
| 481 | indentstr, globtype, tag, size, data32); | 481 | indentstr, globtype, tag, size, data32); |
| 482 | globalval[tag] = data32; | 482 | globalval[tag] = data32; |
| 483 | break; | 483 | break; |
| 484 | } | 484 | } |
| 485 | } else { | 485 | } else { |
| 486 | dbg("%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d ", | 486 | dev_dbg(ddev, "%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d\n", |
| 487 | indentstr, tag, size); | 487 | indentstr, tag, size); |
| 488 | } | 488 | } |
| 489 | break; | 489 | break; |
| 490 | 490 | ||
| @@ -511,18 +511,18 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, | |||
| 511 | 511 | ||
| 512 | switch (size) { | 512 | switch (size) { |
| 513 | case 1: | 513 | case 1: |
| 514 | dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", | 514 | dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n", |
| 515 | indentstr, tag, globtype, size, data); | 515 | indentstr, tag, globtype, size, data); |
| 516 | break; | 516 | break; |
| 517 | 517 | ||
| 518 | case 2: | 518 | case 2: |
| 519 | dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", | 519 | dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n", |
| 520 | indentstr, tag, globtype, size, data16); | 520 | indentstr, tag, globtype, size, data16); |
| 521 | break; | 521 | break; |
| 522 | 522 | ||
| 523 | case 4: | 523 | case 4: |
| 524 | dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", | 524 | dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n", |
| 525 | indentstr, tag, globtype, size, data32); | 525 | indentstr, tag, globtype, size, data32); |
| 526 | break; | 526 | break; |
| 527 | } | 527 | } |
| 528 | 528 | ||
| @@ -714,8 +714,9 @@ static void gtco_urb_callback(struct urb *urbinfo) | |||
| 714 | * the rest as 0 | 714 | * the rest as 0 |
| 715 | */ | 715 | */ |
| 716 | val = device->buffer[5] & MASK_BUTTON; | 716 | val = device->buffer[5] & MASK_BUTTON; |
| 717 | dbg("======>>>>>>REPORT 1: val 0x%X(%d)", | 717 | dev_dbg(&device->intf->dev, |
| 718 | val, val); | 718 | "======>>>>>>REPORT 1: val 0x%X(%d)\n", |
| 719 | val, val); | ||
| 719 | 720 | ||
| 720 | /* | 721 | /* |
| 721 | * We don't apply any meaning to the button | 722 | * We don't apply any meaning to the button |
| @@ -808,7 +809,8 @@ static void gtco_urb_callback(struct urb *urbinfo) | |||
| 808 | resubmit: | 809 | resubmit: |
| 809 | rc = usb_submit_urb(urbinfo, GFP_ATOMIC); | 810 | rc = usb_submit_urb(urbinfo, GFP_ATOMIC); |
| 810 | if (rc != 0) | 811 | if (rc != 0) |
| 811 | err("usb_submit_urb failed rc=0x%x", rc); | 812 | dev_err(&device->intf->dev, |
| 813 | "usb_submit_urb failed rc=0x%x\n", rc); | ||
| 812 | } | 814 | } |
| 813 | 815 | ||
| 814 | /* | 816 | /* |
| @@ -838,7 +840,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 838 | gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL); | 840 | gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL); |
| 839 | input_dev = input_allocate_device(); | 841 | input_dev = input_allocate_device(); |
| 840 | if (!gtco || !input_dev) { | 842 | if (!gtco || !input_dev) { |
| 841 | err("No more memory"); | 843 | dev_err(&usbinterface->dev, "No more memory\n"); |
| 842 | error = -ENOMEM; | 844 | error = -ENOMEM; |
| 843 | goto err_free_devs; | 845 | goto err_free_devs; |
| 844 | } | 846 | } |
| @@ -848,12 +850,13 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 848 | 850 | ||
| 849 | /* Save interface information */ | 851 | /* Save interface information */ |
| 850 | gtco->usbdev = usb_get_dev(interface_to_usbdev(usbinterface)); | 852 | gtco->usbdev = usb_get_dev(interface_to_usbdev(usbinterface)); |
| 853 | gtco->intf = usbinterface; | ||
| 851 | 854 | ||
| 852 | /* Allocate some data for incoming reports */ | 855 | /* Allocate some data for incoming reports */ |
| 853 | gtco->buffer = usb_alloc_coherent(gtco->usbdev, REPORT_MAX_SIZE, | 856 | gtco->buffer = usb_alloc_coherent(gtco->usbdev, REPORT_MAX_SIZE, |
| 854 | GFP_KERNEL, >co->buf_dma); | 857 | GFP_KERNEL, >co->buf_dma); |
| 855 | if (!gtco->buffer) { | 858 | if (!gtco->buffer) { |
| 856 | err("No more memory for us buffers"); | 859 | dev_err(&usbinterface->dev, "No more memory for us buffers\n"); |
| 857 | error = -ENOMEM; | 860 | error = -ENOMEM; |
| 858 | goto err_free_devs; | 861 | goto err_free_devs; |
| 859 | } | 862 | } |
| @@ -861,7 +864,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 861 | /* Allocate URB for reports */ | 864 | /* Allocate URB for reports */ |
| 862 | gtco->urbinfo = usb_alloc_urb(0, GFP_KERNEL); | 865 | gtco->urbinfo = usb_alloc_urb(0, GFP_KERNEL); |
| 863 | if (!gtco->urbinfo) { | 866 | if (!gtco->urbinfo) { |
| 864 | err("Failed to allocate URB"); | 867 | dev_err(&usbinterface->dev, "Failed to allocate URB\n"); |
| 865 | error = -ENOMEM; | 868 | error = -ENOMEM; |
| 866 | goto err_free_buf; | 869 | goto err_free_buf; |
| 867 | } | 870 | } |
| @@ -873,14 +876,14 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 873 | endpoint = &usbinterface->altsetting[0].endpoint[0].desc; | 876 | endpoint = &usbinterface->altsetting[0].endpoint[0].desc; |
| 874 | 877 | ||
| 875 | /* Some debug */ | 878 | /* Some debug */ |
| 876 | dbg("gtco # interfaces: %d", usbinterface->num_altsetting); | 879 | dev_dbg(&usbinterface->dev, "gtco # interfaces: %d\n", usbinterface->num_altsetting); |
| 877 | dbg("num endpoints: %d", usbinterface->cur_altsetting->desc.bNumEndpoints); | 880 | dev_dbg(&usbinterface->dev, "num endpoints: %d\n", usbinterface->cur_altsetting->desc.bNumEndpoints); |
| 878 | dbg("interface class: %d", usbinterface->cur_altsetting->desc.bInterfaceClass); | 881 | dev_dbg(&usbinterface->dev, "interface class: %d\n", usbinterface->cur_altsetting->desc.bInterfaceClass); |
| 879 | dbg("endpoint: attribute:0x%x type:0x%x", endpoint->bmAttributes, endpoint->bDescriptorType); | 882 | dev_dbg(&usbinterface->dev, "endpoint: attribute:0x%x type:0x%x\n", endpoint->bmAttributes, endpoint->bDescriptorType); |
| 880 | if (usb_endpoint_xfer_int(endpoint)) | 883 | if (usb_endpoint_xfer_int(endpoint)) |
| 881 | dbg("endpoint: we have interrupt endpoint\n"); | 884 | dev_dbg(&usbinterface->dev, "endpoint: we have interrupt endpoint\n"); |
| 882 | 885 | ||
| 883 | dbg("endpoint extra len:%d ", usbinterface->altsetting[0].extralen); | 886 | dev_dbg(&usbinterface->dev, "endpoint extra len:%d\n", usbinterface->altsetting[0].extralen); |
| 884 | 887 | ||
| 885 | /* | 888 | /* |
| 886 | * Find the HID descriptor so we can find out the size of the | 889 | * Find the HID descriptor so we can find out the size of the |
| @@ -888,17 +891,19 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 888 | */ | 891 | */ |
| 889 | if (usb_get_extra_descriptor(usbinterface->cur_altsetting, | 892 | if (usb_get_extra_descriptor(usbinterface->cur_altsetting, |
| 890 | HID_DEVICE_TYPE, &hid_desc) != 0){ | 893 | HID_DEVICE_TYPE, &hid_desc) != 0){ |
| 891 | err("Can't retrieve exta USB descriptor to get hid report descriptor length"); | 894 | dev_err(&usbinterface->dev, |
| 895 | "Can't retrieve exta USB descriptor to get hid report descriptor length\n"); | ||
| 892 | error = -EIO; | 896 | error = -EIO; |
| 893 | goto err_free_urb; | 897 | goto err_free_urb; |
| 894 | } | 898 | } |
| 895 | 899 | ||
| 896 | dbg("Extra descriptor success: type:%d len:%d", | 900 | dev_dbg(&usbinterface->dev, |
| 897 | hid_desc->bDescriptorType, hid_desc->wDescriptorLength); | 901 | "Extra descriptor success: type:%d len:%d\n", |
| 902 | hid_desc->bDescriptorType, hid_desc->wDescriptorLength); | ||
| 898 | 903 | ||
| 899 | report = kzalloc(le16_to_cpu(hid_desc->wDescriptorLength), GFP_KERNEL); | 904 | report = kzalloc(le16_to_cpu(hid_desc->wDescriptorLength), GFP_KERNEL); |
| 900 | if (!report) { | 905 | if (!report) { |
| 901 | err("No more memory for report"); | 906 | dev_err(&usbinterface->dev, "No more memory for report\n"); |
| 902 | error = -ENOMEM; | 907 | error = -ENOMEM; |
| 903 | goto err_free_urb; | 908 | goto err_free_urb; |
| 904 | } | 909 | } |
| @@ -915,7 +920,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 915 | le16_to_cpu(hid_desc->wDescriptorLength), | 920 | le16_to_cpu(hid_desc->wDescriptorLength), |
| 916 | 5000); /* 5 secs */ | 921 | 5000); /* 5 secs */ |
| 917 | 922 | ||
| 918 | dbg("usb_control_msg result: %d", result); | 923 | dev_dbg(&usbinterface->dev, "usb_control_msg result: %d\n", result); |
| 919 | if (result == le16_to_cpu(hid_desc->wDescriptorLength)) { | 924 | if (result == le16_to_cpu(hid_desc->wDescriptorLength)) { |
| 920 | parse_hid_report_descriptor(gtco, report, result); | 925 | parse_hid_report_descriptor(gtco, report, result); |
| 921 | break; | 926 | break; |
| @@ -926,8 +931,9 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 926 | 931 | ||
| 927 | /* If we didn't get the report, fail */ | 932 | /* If we didn't get the report, fail */ |
| 928 | if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { | 933 | if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { |
| 929 | err("Failed to get HID Report Descriptor of size: %d", | 934 | dev_err(&usbinterface->dev, |
| 930 | hid_desc->wDescriptorLength); | 935 | "Failed to get HID Report Descriptor of size: %d\n", |
| 936 | hid_desc->wDescriptorLength); | ||
| 931 | error = -EIO; | 937 | error = -EIO; |
| 932 | goto err_free_urb; | 938 | goto err_free_urb; |
| 933 | } | 939 | } |
diff --git a/drivers/input/tablet/hanwang.c b/drivers/input/tablet/hanwang.c index b2db3cfe3084..5cc04124995c 100644 --- a/drivers/input/tablet/hanwang.c +++ b/drivers/input/tablet/hanwang.c | |||
| @@ -63,6 +63,7 @@ MODULE_LICENSE(DRIVER_LICENSE); | |||
| 63 | enum hanwang_tablet_type { | 63 | enum hanwang_tablet_type { |
| 64 | HANWANG_ART_MASTER_III, | 64 | HANWANG_ART_MASTER_III, |
| 65 | HANWANG_ART_MASTER_HD, | 65 | HANWANG_ART_MASTER_HD, |
| 66 | HANWANG_ART_MASTER_II, | ||
| 66 | }; | 67 | }; |
| 67 | 68 | ||
| 68 | struct hanwang { | 69 | struct hanwang { |
| @@ -99,6 +100,8 @@ static const struct hanwang_features features_array[] = { | |||
| 99 | ART_MASTER_PKGLEN_MAX, 0x7f00, 0x4f60, 0x3f, 0x7f, 2048 }, | 100 | ART_MASTER_PKGLEN_MAX, 0x7f00, 0x4f60, 0x3f, 0x7f, 2048 }, |
| 100 | { 0x8401, "Hanwang Art Master HD 5012", HANWANG_ART_MASTER_HD, | 101 | { 0x8401, "Hanwang Art Master HD 5012", HANWANG_ART_MASTER_HD, |
| 101 | ART_MASTER_PKGLEN_MAX, 0x678e, 0x4150, 0x3f, 0x7f, 1024 }, | 102 | ART_MASTER_PKGLEN_MAX, 0x678e, 0x4150, 0x3f, 0x7f, 1024 }, |
| 103 | { 0x8503, "Hanwang Art Master II", HANWANG_ART_MASTER_II, | ||
| 104 | ART_MASTER_PKGLEN_MAX, 0x27de, 0x1cfe, 0x3f, 0x7f, 1024 }, | ||
| 102 | }; | 105 | }; |
| 103 | 106 | ||
| 104 | static const int hw_eventtypes[] = { | 107 | static const int hw_eventtypes[] = { |
| @@ -127,14 +130,30 @@ static void hanwang_parse_packet(struct hanwang *hanwang) | |||
| 127 | struct usb_device *dev = hanwang->usbdev; | 130 | struct usb_device *dev = hanwang->usbdev; |
| 128 | enum hanwang_tablet_type type = hanwang->features->type; | 131 | enum hanwang_tablet_type type = hanwang->features->type; |
| 129 | int i; | 132 | int i; |
| 130 | u16 x, y, p; | 133 | u16 p; |
| 134 | |||
| 135 | if (type == HANWANG_ART_MASTER_II) { | ||
| 136 | hanwang->current_tool = BTN_TOOL_PEN; | ||
| 137 | hanwang->current_id = STYLUS_DEVICE_ID; | ||
| 138 | } | ||
| 131 | 139 | ||
| 132 | switch (data[0]) { | 140 | switch (data[0]) { |
| 133 | case 0x02: /* data packet */ | 141 | case 0x02: /* data packet */ |
| 134 | switch (data[1]) { | 142 | switch (data[1]) { |
| 135 | case 0x80: /* tool prox out */ | 143 | case 0x80: /* tool prox out */ |
| 136 | hanwang->current_id = 0; | 144 | if (type != HANWANG_ART_MASTER_II) { |
| 137 | input_report_key(input_dev, hanwang->current_tool, 0); | 145 | hanwang->current_id = 0; |
| 146 | input_report_key(input_dev, | ||
| 147 | hanwang->current_tool, 0); | ||
| 148 | } | ||
| 149 | break; | ||
| 150 | |||
| 151 | case 0x00: /* artmaster ii pen leave */ | ||
| 152 | if (type == HANWANG_ART_MASTER_II) { | ||
| 153 | hanwang->current_id = 0; | ||
| 154 | input_report_key(input_dev, | ||
| 155 | hanwang->current_tool, 0); | ||
| 156 | } | ||
| 138 | break; | 157 | break; |
| 139 | 158 | ||
| 140 | case 0xc2: /* first time tool prox in */ | 159 | case 0xc2: /* first time tool prox in */ |
| @@ -154,15 +173,12 @@ static void hanwang_parse_packet(struct hanwang *hanwang) | |||
| 154 | default: | 173 | default: |
| 155 | hanwang->current_id = 0; | 174 | hanwang->current_id = 0; |
| 156 | dev_dbg(&dev->dev, | 175 | dev_dbg(&dev->dev, |
| 157 | "unknown tablet tool %02x ", data[0]); | 176 | "unknown tablet tool %02x\n", data[0]); |
| 158 | break; | 177 | break; |
| 159 | } | 178 | } |
| 160 | break; | 179 | break; |
| 161 | 180 | ||
| 162 | default: /* tool data packet */ | 181 | default: /* tool data packet */ |
| 163 | x = (data[2] << 8) | data[3]; | ||
| 164 | y = (data[4] << 8) | data[5]; | ||
| 165 | |||
| 166 | switch (type) { | 182 | switch (type) { |
| 167 | case HANWANG_ART_MASTER_III: | 183 | case HANWANG_ART_MASTER_III: |
| 168 | p = (data[6] << 3) | | 184 | p = (data[6] << 3) | |
| @@ -171,6 +187,7 @@ static void hanwang_parse_packet(struct hanwang *hanwang) | |||
| 171 | break; | 187 | break; |
| 172 | 188 | ||
| 173 | case HANWANG_ART_MASTER_HD: | 189 | case HANWANG_ART_MASTER_HD: |
| 190 | case HANWANG_ART_MASTER_II: | ||
| 174 | p = (data[7] >> 6) | (data[6] << 2); | 191 | p = (data[7] >> 6) | (data[6] << 2); |
| 175 | break; | 192 | break; |
| 176 | 193 | ||
| @@ -180,17 +197,23 @@ static void hanwang_parse_packet(struct hanwang *hanwang) | |||
| 180 | } | 197 | } |
| 181 | 198 | ||
| 182 | input_report_abs(input_dev, ABS_X, | 199 | input_report_abs(input_dev, ABS_X, |
| 183 | le16_to_cpup((__le16 *)&x)); | 200 | be16_to_cpup((__be16 *)&data[2])); |
| 184 | input_report_abs(input_dev, ABS_Y, | 201 | input_report_abs(input_dev, ABS_Y, |
| 185 | le16_to_cpup((__le16 *)&y)); | 202 | be16_to_cpup((__be16 *)&data[4])); |
| 186 | input_report_abs(input_dev, ABS_PRESSURE, | 203 | input_report_abs(input_dev, ABS_PRESSURE, p); |
| 187 | le16_to_cpup((__le16 *)&p)); | ||
| 188 | input_report_abs(input_dev, ABS_TILT_X, data[7] & 0x3f); | 204 | input_report_abs(input_dev, ABS_TILT_X, data[7] & 0x3f); |
| 189 | input_report_abs(input_dev, ABS_TILT_Y, data[8] & 0x7f); | 205 | input_report_abs(input_dev, ABS_TILT_Y, data[8] & 0x7f); |
| 190 | input_report_key(input_dev, BTN_STYLUS, data[1] & 0x02); | 206 | input_report_key(input_dev, BTN_STYLUS, data[1] & 0x02); |
| 191 | input_report_key(input_dev, BTN_STYLUS2, data[1] & 0x04); | 207 | |
| 208 | if (type != HANWANG_ART_MASTER_II) | ||
| 209 | input_report_key(input_dev, BTN_STYLUS2, | ||
| 210 | data[1] & 0x04); | ||
| 211 | else | ||
| 212 | input_report_key(input_dev, BTN_TOOL_PEN, 1); | ||
| 213 | |||
| 192 | break; | 214 | break; |
| 193 | } | 215 | } |
| 216 | |||
| 194 | input_report_abs(input_dev, ABS_MISC, hanwang->current_id); | 217 | input_report_abs(input_dev, ABS_MISC, hanwang->current_id); |
| 195 | input_event(input_dev, EV_MSC, MSC_SERIAL, | 218 | input_event(input_dev, EV_MSC, MSC_SERIAL, |
| 196 | hanwang->features->pid); | 219 | hanwang->features->pid); |
| @@ -202,8 +225,8 @@ static void hanwang_parse_packet(struct hanwang *hanwang) | |||
| 202 | 225 | ||
| 203 | switch (type) { | 226 | switch (type) { |
| 204 | case HANWANG_ART_MASTER_III: | 227 | case HANWANG_ART_MASTER_III: |
| 205 | input_report_key(input_dev, BTN_TOOL_FINGER, data[1] || | 228 | input_report_key(input_dev, BTN_TOOL_FINGER, |
| 206 | data[2] || data[3]); | 229 | data[1] || data[2] || data[3]); |
| 207 | input_report_abs(input_dev, ABS_WHEEL, data[1]); | 230 | input_report_abs(input_dev, ABS_WHEEL, data[1]); |
| 208 | input_report_key(input_dev, BTN_0, data[2]); | 231 | input_report_key(input_dev, BTN_0, data[2]); |
| 209 | for (i = 0; i < 8; i++) | 232 | for (i = 0; i < 8; i++) |
| @@ -227,6 +250,10 @@ static void hanwang_parse_packet(struct hanwang *hanwang) | |||
| 227 | BTN_5 + i, data[6] & (1 << i)); | 250 | BTN_5 + i, data[6] & (1 << i)); |
| 228 | } | 251 | } |
| 229 | break; | 252 | break; |
| 253 | |||
| 254 | case HANWANG_ART_MASTER_II: | ||
| 255 | dev_dbg(&dev->dev, "error packet %02x\n", data[0]); | ||
| 256 | return; | ||
| 230 | } | 257 | } |
| 231 | 258 | ||
| 232 | input_report_abs(input_dev, ABS_MISC, hanwang->current_id); | 259 | input_report_abs(input_dev, ABS_MISC, hanwang->current_id); |
| @@ -234,7 +261,7 @@ static void hanwang_parse_packet(struct hanwang *hanwang) | |||
| 234 | break; | 261 | break; |
| 235 | 262 | ||
| 236 | default: | 263 | default: |
| 237 | dev_dbg(&dev->dev, "error packet %02x ", data[0]); | 264 | dev_dbg(&dev->dev, "error packet %02x\n", data[0]); |
| 238 | break; | 265 | break; |
| 239 | } | 266 | } |
| 240 | 267 | ||
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c index 85a5b40333ac..3fba74b9b602 100644 --- a/drivers/input/tablet/kbtab.c +++ b/drivers/input/tablet/kbtab.c | |||
| @@ -33,6 +33,7 @@ struct kbtab { | |||
| 33 | dma_addr_t data_dma; | 33 | dma_addr_t data_dma; |
| 34 | struct input_dev *dev; | 34 | struct input_dev *dev; |
| 35 | struct usb_device *usbdev; | 35 | struct usb_device *usbdev; |
| 36 | struct usb_interface *intf; | ||
| 36 | struct urb *irq; | 37 | struct urb *irq; |
| 37 | char phys[32]; | 38 | char phys[32]; |
| 38 | }; | 39 | }; |
| @@ -53,10 +54,14 @@ static void kbtab_irq(struct urb *urb) | |||
| 53 | case -ENOENT: | 54 | case -ENOENT: |
| 54 | case -ESHUTDOWN: | 55 | case -ESHUTDOWN: |
| 55 | /* this urb is terminated, clean up */ | 56 | /* this urb is terminated, clean up */ |
| 56 | dbg("%s - urb shutting down with status: %d", __func__, urb->status); | 57 | dev_dbg(&kbtab->intf->dev, |
| 58 | "%s - urb shutting down with status: %d\n", | ||
| 59 | __func__, urb->status); | ||
| 57 | return; | 60 | return; |
| 58 | default: | 61 | default: |
| 59 | dbg("%s - nonzero urb status received: %d", __func__, urb->status); | 62 | dev_dbg(&kbtab->intf->dev, |
| 63 | "%s - nonzero urb status received: %d\n", | ||
| 64 | __func__, urb->status); | ||
| 60 | goto exit; | 65 | goto exit; |
| 61 | } | 66 | } |
| 62 | 67 | ||
| @@ -80,8 +85,9 @@ static void kbtab_irq(struct urb *urb) | |||
| 80 | exit: | 85 | exit: |
| 81 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 86 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
| 82 | if (retval) | 87 | if (retval) |
| 83 | err("%s - usb_submit_urb failed with result %d", | 88 | dev_err(&kbtab->intf->dev, |
| 84 | __func__, retval); | 89 | "%s - usb_submit_urb failed with result %d\n", |
| 90 | __func__, retval); | ||
| 85 | } | 91 | } |
| 86 | 92 | ||
| 87 | static struct usb_device_id kbtab_ids[] = { | 93 | static struct usb_device_id kbtab_ids[] = { |
| @@ -131,6 +137,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 131 | goto fail2; | 137 | goto fail2; |
| 132 | 138 | ||
| 133 | kbtab->usbdev = dev; | 139 | kbtab->usbdev = dev; |
| 140 | kbtab->intf = intf; | ||
| 134 | kbtab->dev = input_dev; | 141 | kbtab->dev = input_dev; |
| 135 | 142 | ||
| 136 | usb_make_path(dev, kbtab->phys, sizeof(kbtab->phys)); | 143 | usb_make_path(dev, kbtab->phys, sizeof(kbtab->phys)); |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index b145841bdbe7..0d3219f29744 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
| @@ -100,6 +100,7 @@ static int wacom_set_report(struct usb_interface *intf, u8 type, u8 id, | |||
| 100 | static void wacom_sys_irq(struct urb *urb) | 100 | static void wacom_sys_irq(struct urb *urb) |
| 101 | { | 101 | { |
| 102 | struct wacom *wacom = urb->context; | 102 | struct wacom *wacom = urb->context; |
| 103 | struct device *dev = &wacom->intf->dev; | ||
| 103 | int retval; | 104 | int retval; |
| 104 | 105 | ||
| 105 | switch (urb->status) { | 106 | switch (urb->status) { |
| @@ -110,10 +111,12 @@ static void wacom_sys_irq(struct urb *urb) | |||
| 110 | case -ENOENT: | 111 | case -ENOENT: |
| 111 | case -ESHUTDOWN: | 112 | case -ESHUTDOWN: |
| 112 | /* this urb is terminated, clean up */ | 113 | /* this urb is terminated, clean up */ |
| 113 | dbg("%s - urb shutting down with status: %d", __func__, urb->status); | 114 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", |
| 115 | __func__, urb->status); | ||
| 114 | return; | 116 | return; |
| 115 | default: | 117 | default: |
| 116 | dbg("%s - nonzero urb status received: %d", __func__, urb->status); | 118 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", |
| 119 | __func__, urb->status); | ||
| 117 | goto exit; | 120 | goto exit; |
| 118 | } | 121 | } |
| 119 | 122 | ||
| @@ -123,8 +126,8 @@ static void wacom_sys_irq(struct urb *urb) | |||
| 123 | usb_mark_last_busy(wacom->usbdev); | 126 | usb_mark_last_busy(wacom->usbdev); |
| 124 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 127 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
| 125 | if (retval) | 128 | if (retval) |
| 126 | err ("%s - usb_submit_urb failed with result %d", | 129 | dev_err(dev, "%s - usb_submit_urb failed with result %d\n", |
| 127 | __func__, retval); | 130 | __func__, retval); |
| 128 | } | 131 | } |
| 129 | 132 | ||
| 130 | static int wacom_open(struct input_dev *dev) | 133 | static int wacom_open(struct input_dev *dev) |
| @@ -442,8 +445,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat | |||
| 442 | /* ask to report Wacom data */ | 445 | /* ask to report Wacom data */ |
| 443 | if (features->device_type == BTN_TOOL_FINGER) { | 446 | if (features->device_type == BTN_TOOL_FINGER) { |
| 444 | /* if it is an MT Tablet PC touch */ | 447 | /* if it is an MT Tablet PC touch */ |
| 445 | if (features->type == TABLETPC2FG || | 448 | if (features->type > TABLETPC) { |
| 446 | features->type == MTSCREEN) { | ||
| 447 | do { | 449 | do { |
| 448 | rep_data[0] = 3; | 450 | rep_data[0] = 3; |
| 449 | rep_data[1] = 4; | 451 | rep_data[1] = 4; |
| @@ -462,7 +464,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat | |||
| 462 | } while ((error < 0 || rep_data[1] != 4) && | 464 | } while ((error < 0 || rep_data[1] != 4) && |
| 463 | limit++ < WAC_MSG_RETRIES); | 465 | limit++ < WAC_MSG_RETRIES); |
| 464 | } | 466 | } |
| 465 | } else if (features->type != TABLETPC && | 467 | } else if (features->type <= BAMBOO_PT && |
| 466 | features->type != WIRELESS && | 468 | features->type != WIRELESS && |
| 467 | features->device_type == BTN_TOOL_PEN) { | 469 | features->device_type == BTN_TOOL_PEN) { |
| 468 | do { | 470 | do { |
| @@ -506,16 +508,13 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, | |||
| 506 | if (intf->cur_altsetting->desc.bInterfaceNumber == 0) { | 508 | if (intf->cur_altsetting->desc.bInterfaceNumber == 0) { |
| 507 | features->device_type = 0; | 509 | features->device_type = 0; |
| 508 | } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) { | 510 | } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) { |
| 509 | features->device_type = BTN_TOOL_DOUBLETAP; | 511 | features->device_type = BTN_TOOL_FINGER; |
| 510 | features->pktlen = WACOM_PKGLEN_BBTOUCH3; | 512 | features->pktlen = WACOM_PKGLEN_BBTOUCH3; |
| 511 | } | 513 | } |
| 512 | } | 514 | } |
| 513 | 515 | ||
| 514 | /* only devices that support touch need to retrieve the info */ | 516 | /* only devices that support touch need to retrieve the info */ |
| 515 | if (features->type != TABLETPC && | 517 | if (features->type < BAMBOO_PT) { |
| 516 | features->type != TABLETPC2FG && | ||
| 517 | features->type != BAMBOO_PT && | ||
| 518 | features->type != MTSCREEN) { | ||
| 519 | goto out; | 518 | goto out; |
| 520 | } | 519 | } |
| 521 | 520 | ||
| @@ -857,6 +856,7 @@ static int wacom_initialize_leds(struct wacom *wacom) | |||
| 857 | 856 | ||
| 858 | /* Initialize default values */ | 857 | /* Initialize default values */ |
| 859 | switch (wacom->wacom_wac.features.type) { | 858 | switch (wacom->wacom_wac.features.type) { |
| 859 | case INTUOS4S: | ||
| 860 | case INTUOS4: | 860 | case INTUOS4: |
| 861 | case INTUOS4L: | 861 | case INTUOS4L: |
| 862 | wacom->led.select[0] = 0; | 862 | wacom->led.select[0] = 0; |
| @@ -910,6 +910,7 @@ static int wacom_initialize_leds(struct wacom *wacom) | |||
| 910 | static void wacom_destroy_leds(struct wacom *wacom) | 910 | static void wacom_destroy_leds(struct wacom *wacom) |
| 911 | { | 911 | { |
| 912 | switch (wacom->wacom_wac.features.type) { | 912 | switch (wacom->wacom_wac.features.type) { |
| 913 | case INTUOS4S: | ||
| 913 | case INTUOS4: | 914 | case INTUOS4: |
| 914 | case INTUOS4L: | 915 | case INTUOS4L: |
| 915 | sysfs_remove_group(&wacom->intf->dev.kobj, | 916 | sysfs_remove_group(&wacom->intf->dev.kobj, |
| @@ -969,6 +970,10 @@ static int wacom_initialize_battery(struct wacom *wacom) | |||
| 969 | 970 | ||
| 970 | error = power_supply_register(&wacom->usbdev->dev, | 971 | error = power_supply_register(&wacom->usbdev->dev, |
| 971 | &wacom->battery); | 972 | &wacom->battery); |
| 973 | |||
| 974 | if (!error) | ||
| 975 | power_supply_powers(&wacom->battery, | ||
| 976 | &wacom->usbdev->dev); | ||
| 972 | } | 977 | } |
| 973 | 978 | ||
| 974 | return error; | 979 | return error; |
| @@ -976,8 +981,11 @@ static int wacom_initialize_battery(struct wacom *wacom) | |||
| 976 | 981 | ||
| 977 | static void wacom_destroy_battery(struct wacom *wacom) | 982 | static void wacom_destroy_battery(struct wacom *wacom) |
| 978 | { | 983 | { |
| 979 | if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR) | 984 | if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR && |
| 985 | wacom->battery.dev) { | ||
| 980 | power_supply_unregister(&wacom->battery); | 986 | power_supply_unregister(&wacom->battery); |
| 987 | wacom->battery.dev = NULL; | ||
| 988 | } | ||
| 981 | } | 989 | } |
| 982 | 990 | ||
| 983 | static int wacom_register_input(struct wacom *wacom) | 991 | static int wacom_register_input(struct wacom *wacom) |
| @@ -1024,23 +1032,30 @@ static void wacom_wireless_work(struct work_struct *work) | |||
| 1024 | struct wacom *wacom = container_of(work, struct wacom, work); | 1032 | struct wacom *wacom = container_of(work, struct wacom, work); |
| 1025 | struct usb_device *usbdev = wacom->usbdev; | 1033 | struct usb_device *usbdev = wacom->usbdev; |
| 1026 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; | 1034 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1035 | struct wacom *wacom1, *wacom2; | ||
| 1036 | struct wacom_wac *wacom_wac1, *wacom_wac2; | ||
| 1037 | int error; | ||
| 1027 | 1038 | ||
| 1028 | /* | 1039 | /* |
| 1029 | * Regardless if this is a disconnect or a new tablet, | 1040 | * Regardless if this is a disconnect or a new tablet, |
| 1030 | * remove any existing input devices. | 1041 | * remove any existing input and battery devices. |
| 1031 | */ | 1042 | */ |
| 1032 | 1043 | ||
| 1044 | wacom_destroy_battery(wacom); | ||
| 1045 | |||
| 1033 | /* Stylus interface */ | 1046 | /* Stylus interface */ |
| 1034 | wacom = usb_get_intfdata(usbdev->config->interface[1]); | 1047 | wacom1 = usb_get_intfdata(usbdev->config->interface[1]); |
| 1035 | if (wacom->wacom_wac.input) | 1048 | wacom_wac1 = &(wacom1->wacom_wac); |
| 1036 | input_unregister_device(wacom->wacom_wac.input); | 1049 | if (wacom_wac1->input) |
| 1037 | wacom->wacom_wac.input = NULL; | 1050 | input_unregister_device(wacom_wac1->input); |
| 1051 | wacom_wac1->input = NULL; | ||
| 1038 | 1052 | ||
| 1039 | /* Touch interface */ | 1053 | /* Touch interface */ |
| 1040 | wacom = usb_get_intfdata(usbdev->config->interface[2]); | 1054 | wacom2 = usb_get_intfdata(usbdev->config->interface[2]); |
| 1041 | if (wacom->wacom_wac.input) | 1055 | wacom_wac2 = &(wacom2->wacom_wac); |
| 1042 | input_unregister_device(wacom->wacom_wac.input); | 1056 | if (wacom_wac2->input) |
| 1043 | wacom->wacom_wac.input = NULL; | 1057 | input_unregister_device(wacom_wac2->input); |
| 1058 | wacom_wac2->input = NULL; | ||
| 1044 | 1059 | ||
| 1045 | if (wacom_wac->pid == 0) { | 1060 | if (wacom_wac->pid == 0) { |
| 1046 | dev_info(&wacom->intf->dev, "wireless tablet disconnected\n"); | 1061 | dev_info(&wacom->intf->dev, "wireless tablet disconnected\n"); |
| @@ -1065,24 +1080,39 @@ static void wacom_wireless_work(struct work_struct *work) | |||
| 1065 | } | 1080 | } |
| 1066 | 1081 | ||
| 1067 | /* Stylus interface */ | 1082 | /* Stylus interface */ |
| 1068 | wacom = usb_get_intfdata(usbdev->config->interface[1]); | 1083 | wacom_wac1->features = |
| 1069 | wacom_wac = &wacom->wacom_wac; | ||
| 1070 | wacom_wac->features = | ||
| 1071 | *((struct wacom_features *)id->driver_info); | 1084 | *((struct wacom_features *)id->driver_info); |
| 1072 | wacom_wac->features.device_type = BTN_TOOL_PEN; | 1085 | wacom_wac1->features.device_type = BTN_TOOL_PEN; |
| 1073 | wacom_register_input(wacom); | 1086 | error = wacom_register_input(wacom1); |
| 1087 | if (error) | ||
| 1088 | goto fail1; | ||
| 1074 | 1089 | ||
| 1075 | /* Touch interface */ | 1090 | /* Touch interface */ |
| 1076 | wacom = usb_get_intfdata(usbdev->config->interface[2]); | 1091 | wacom_wac2->features = |
| 1077 | wacom_wac = &wacom->wacom_wac; | ||
| 1078 | wacom_wac->features = | ||
| 1079 | *((struct wacom_features *)id->driver_info); | 1092 | *((struct wacom_features *)id->driver_info); |
| 1080 | wacom_wac->features.pktlen = WACOM_PKGLEN_BBTOUCH3; | 1093 | wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; |
| 1081 | wacom_wac->features.device_type = BTN_TOOL_FINGER; | 1094 | wacom_wac2->features.device_type = BTN_TOOL_FINGER; |
| 1082 | wacom_set_phy_from_res(&wacom_wac->features); | 1095 | wacom_set_phy_from_res(&wacom_wac2->features); |
| 1083 | wacom_wac->features.x_max = wacom_wac->features.y_max = 4096; | 1096 | wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; |
| 1084 | wacom_register_input(wacom); | 1097 | error = wacom_register_input(wacom2); |
| 1098 | if (error) | ||
| 1099 | goto fail2; | ||
| 1100 | |||
| 1101 | error = wacom_initialize_battery(wacom); | ||
| 1102 | if (error) | ||
| 1103 | goto fail3; | ||
| 1085 | } | 1104 | } |
| 1105 | |||
| 1106 | return; | ||
| 1107 | |||
| 1108 | fail3: | ||
| 1109 | input_unregister_device(wacom_wac2->input); | ||
| 1110 | wacom_wac2->input = NULL; | ||
| 1111 | fail2: | ||
| 1112 | input_unregister_device(wacom_wac1->input); | ||
| 1113 | wacom_wac1->input = NULL; | ||
| 1114 | fail1: | ||
| 1115 | return; | ||
| 1086 | } | 1116 | } |
| 1087 | 1117 | ||
| 1088 | static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) | 1118 | static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) |
| @@ -1146,10 +1176,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 1146 | features->device_type = BTN_TOOL_FINGER; | 1176 | features->device_type = BTN_TOOL_FINGER; |
| 1147 | features->pktlen = WACOM_PKGLEN_BBTOUCH3; | 1177 | features->pktlen = WACOM_PKGLEN_BBTOUCH3; |
| 1148 | 1178 | ||
| 1149 | features->x_phy = | 1179 | wacom_set_phy_from_res(features); |
| 1150 | (features->x_max * 100) / features->x_resolution; | ||
| 1151 | features->y_phy = | ||
| 1152 | (features->y_max * 100) / features->y_resolution; | ||
| 1153 | 1180 | ||
| 1154 | features->x_max = 4096; | 1181 | features->x_max = 4096; |
| 1155 | features->y_max = 4096; | 1182 | features->y_max = 4096; |
| @@ -1185,14 +1212,10 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 1185 | if (error) | 1212 | if (error) |
| 1186 | goto fail4; | 1213 | goto fail4; |
| 1187 | 1214 | ||
| 1188 | error = wacom_initialize_battery(wacom); | ||
| 1189 | if (error) | ||
| 1190 | goto fail5; | ||
| 1191 | |||
| 1192 | if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { | 1215 | if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { |
| 1193 | error = wacom_register_input(wacom); | 1216 | error = wacom_register_input(wacom); |
| 1194 | if (error) | 1217 | if (error) |
| 1195 | goto fail6; | 1218 | goto fail5; |
| 1196 | } | 1219 | } |
| 1197 | 1220 | ||
| 1198 | /* Note that if query fails it is not a hard failure */ | 1221 | /* Note that if query fails it is not a hard failure */ |
| @@ -1207,7 +1230,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 1207 | 1230 | ||
| 1208 | return 0; | 1231 | return 0; |
| 1209 | 1232 | ||
| 1210 | fail6: wacom_destroy_battery(wacom); | ||
| 1211 | fail5: wacom_destroy_leds(wacom); | 1233 | fail5: wacom_destroy_leds(wacom); |
| 1212 | fail4: wacom_remove_shared_data(wacom_wac); | 1234 | fail4: wacom_remove_shared_data(wacom_wac); |
| 1213 | fail3: usb_free_urb(wacom->irq); | 1235 | fail3: usb_free_urb(wacom->irq); |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 004bc1bb1544..6533f44be5bd 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
| @@ -248,7 +248,7 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) | |||
| 248 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); | 248 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 249 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); | 249 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
| 250 | if (wacom->tool[0] != BTN_TOOL_MOUSE) { | 250 | if (wacom->tool[0] != BTN_TOOL_MOUSE) { |
| 251 | input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x01) << 8)); | 251 | input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x03) << 8)); |
| 252 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); | 252 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); |
| 253 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); | 253 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 254 | input_report_key(input, BTN_STYLUS2, data[1] & 0x04); | 254 | input_report_key(input, BTN_STYLUS2, data[1] & 0x04); |
| @@ -888,7 +888,7 @@ static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len) | |||
| 888 | prox = data[0] & 0x01; | 888 | prox = data[0] & 0x01; |
| 889 | x = get_unaligned_le16(&data[1]); | 889 | x = get_unaligned_le16(&data[1]); |
| 890 | y = get_unaligned_le16(&data[3]); | 890 | y = get_unaligned_le16(&data[3]); |
| 891 | } else { /* with capacity */ | 891 | } else { |
| 892 | prox = data[1] & 0x01; | 892 | prox = data[1] & 0x01; |
| 893 | x = le16_to_cpup((__le16 *)&data[2]); | 893 | x = le16_to_cpup((__le16 *)&data[2]); |
| 894 | y = le16_to_cpup((__le16 *)&data[4]); | 894 | y = le16_to_cpup((__le16 *)&data[4]); |
| @@ -961,6 +961,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) | |||
| 961 | case WACOM_REPORT_TPC1FG: | 961 | case WACOM_REPORT_TPC1FG: |
| 962 | case WACOM_REPORT_TPCHID: | 962 | case WACOM_REPORT_TPCHID: |
| 963 | case WACOM_REPORT_TPCST: | 963 | case WACOM_REPORT_TPCST: |
| 964 | case WACOM_REPORT_TPC1FGE: | ||
| 964 | return wacom_tpc_single_touch(wacom, len); | 965 | return wacom_tpc_single_touch(wacom, len); |
| 965 | 966 | ||
| 966 | case WACOM_REPORT_TPCMT: | 967 | case WACOM_REPORT_TPCMT: |
| @@ -1244,6 +1245,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
| 1244 | break; | 1245 | break; |
| 1245 | 1246 | ||
| 1246 | case TABLETPC: | 1247 | case TABLETPC: |
| 1248 | case TABLETPCE: | ||
| 1247 | case TABLETPC2FG: | 1249 | case TABLETPC2FG: |
| 1248 | case MTSCREEN: | 1250 | case MTSCREEN: |
| 1249 | sync = wacom_tpc_irq(wacom_wac, len); | 1251 | sync = wacom_tpc_irq(wacom_wac, len); |
| @@ -1317,10 +1319,8 @@ void wacom_setup_device_quirks(struct wacom_features *features) | |||
| 1317 | } | 1319 | } |
| 1318 | 1320 | ||
| 1319 | /* these device have multiple inputs */ | 1321 | /* these device have multiple inputs */ |
| 1320 | if (features->type == TABLETPC || features->type == TABLETPC2FG || | 1322 | if (features->type >= WIRELESS || |
| 1321 | features->type == BAMBOO_PT || features->type == WIRELESS || | 1323 | (features->type >= INTUOS5S && features->type <= INTUOS5L)) |
| 1322 | (features->type >= INTUOS5S && features->type <= INTUOS5L) || | ||
| 1323 | features->type == MTSCREEN) | ||
| 1324 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; | 1324 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; |
| 1325 | 1325 | ||
| 1326 | /* quirk for bamboo touch with 2 low res touches */ | 1326 | /* quirk for bamboo touch with 2 low res touches */ |
| @@ -1547,10 +1547,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1547 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | 1547 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
| 1548 | break; | 1548 | break; |
| 1549 | 1549 | ||
| 1550 | case TABLETPC2FG: | ||
| 1551 | case MTSCREEN: | 1550 | case MTSCREEN: |
| 1552 | if (features->device_type == BTN_TOOL_FINGER) { | 1551 | if (features->device_type == BTN_TOOL_FINGER) { |
| 1553 | |||
| 1554 | wacom_wac->slots = kmalloc(features->touch_max * | 1552 | wacom_wac->slots = kmalloc(features->touch_max * |
| 1555 | sizeof(int), | 1553 | sizeof(int), |
| 1556 | GFP_KERNEL); | 1554 | GFP_KERNEL); |
| @@ -1559,7 +1557,11 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1559 | 1557 | ||
| 1560 | for (i = 0; i < features->touch_max; i++) | 1558 | for (i = 0; i < features->touch_max; i++) |
| 1561 | wacom_wac->slots[i] = -1; | 1559 | wacom_wac->slots[i] = -1; |
| 1560 | } | ||
| 1561 | /* fall through */ | ||
| 1562 | 1562 | ||
| 1563 | case TABLETPC2FG: | ||
| 1564 | if (features->device_type == BTN_TOOL_FINGER) { | ||
| 1563 | input_mt_init_slots(input_dev, features->touch_max); | 1565 | input_mt_init_slots(input_dev, features->touch_max); |
| 1564 | input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, | 1566 | input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, |
| 1565 | 0, MT_TOOL_MAX, 0, 0); | 1567 | 0, MT_TOOL_MAX, 0, 0); |
| @@ -1571,6 +1573,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1571 | /* fall through */ | 1573 | /* fall through */ |
| 1572 | 1574 | ||
| 1573 | case TABLETPC: | 1575 | case TABLETPC: |
| 1576 | case TABLETPCE: | ||
| 1574 | __clear_bit(ABS_MISC, input_dev->absbit); | 1577 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 1575 | 1578 | ||
| 1576 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | 1579 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
| @@ -1888,6 +1891,12 @@ static const struct wacom_features wacom_features_0xE6 = | |||
| 1888 | static const struct wacom_features wacom_features_0xEC = | 1891 | static const struct wacom_features wacom_features_0xEC = |
| 1889 | { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, | 1892 | { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, |
| 1890 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 1893 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 1894 | static const struct wacom_features wacom_features_0xED = | ||
| 1895 | { "Wacom ISDv4 ED", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | ||
| 1896 | 0, TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
| 1897 | static const struct wacom_features wacom_features_0xEF = | ||
| 1898 | { "Wacom ISDv4 EF", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | ||
| 1899 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
| 1891 | static const struct wacom_features wacom_features_0x47 = | 1900 | static const struct wacom_features wacom_features_0x47 = |
| 1892 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, | 1901 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, |
| 1893 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 1902 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| @@ -2062,6 +2071,8 @@ const struct usb_device_id wacom_ids[] = { | |||
| 2062 | { USB_DEVICE_WACOM(0xE5) }, | 2071 | { USB_DEVICE_WACOM(0xE5) }, |
| 2063 | { USB_DEVICE_WACOM(0xE6) }, | 2072 | { USB_DEVICE_WACOM(0xE6) }, |
| 2064 | { USB_DEVICE_WACOM(0xEC) }, | 2073 | { USB_DEVICE_WACOM(0xEC) }, |
| 2074 | { USB_DEVICE_WACOM(0xED) }, | ||
| 2075 | { USB_DEVICE_WACOM(0xEF) }, | ||
| 2065 | { USB_DEVICE_WACOM(0x47) }, | 2076 | { USB_DEVICE_WACOM(0x47) }, |
| 2066 | { USB_DEVICE_WACOM(0xF4) }, | 2077 | { USB_DEVICE_WACOM(0xF4) }, |
| 2067 | { USB_DEVICE_LENOVO(0x6004) }, | 2078 | { USB_DEVICE_LENOVO(0x6004) }, |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 78fbd3f42009..bd5d37b28714 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
| @@ -48,6 +48,7 @@ | |||
| 48 | #define WACOM_REPORT_TPCMT 13 | 48 | #define WACOM_REPORT_TPCMT 13 |
| 49 | #define WACOM_REPORT_TPCHID 15 | 49 | #define WACOM_REPORT_TPCHID 15 |
| 50 | #define WACOM_REPORT_TPCST 16 | 50 | #define WACOM_REPORT_TPCST 16 |
| 51 | #define WACOM_REPORT_TPC1FGE 18 | ||
| 51 | 52 | ||
| 52 | /* device quirks */ | 53 | /* device quirks */ |
| 53 | #define WACOM_QUIRK_MULTI_INPUT 0x0001 | 54 | #define WACOM_QUIRK_MULTI_INPUT 0x0001 |
| @@ -62,8 +63,6 @@ enum { | |||
| 62 | PTU, | 63 | PTU, |
| 63 | PL, | 64 | PL, |
| 64 | DTU, | 65 | DTU, |
| 65 | BAMBOO_PT, | ||
| 66 | WIRELESS, | ||
| 67 | INTUOS, | 66 | INTUOS, |
| 68 | INTUOS3S, | 67 | INTUOS3S, |
| 69 | INTUOS3, | 68 | INTUOS3, |
| @@ -79,7 +78,10 @@ enum { | |||
| 79 | CINTIQ, | 78 | CINTIQ, |
| 80 | WACOM_BEE, | 79 | WACOM_BEE, |
| 81 | WACOM_MO, | 80 | WACOM_MO, |
| 82 | TABLETPC, | 81 | WIRELESS, |
| 82 | BAMBOO_PT, | ||
| 83 | TABLETPC, /* add new TPC below */ | ||
| 84 | TABLETPCE, | ||
| 83 | TABLETPC2FG, | 85 | TABLETPC2FG, |
| 84 | MTSCREEN, | 86 | MTSCREEN, |
| 85 | MAX_TYPE | 87 | MAX_TYPE |
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index f67657b2fd5d..73bd2f6b82ec 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
| @@ -369,6 +369,18 @@ config TOUCHSCREEN_MCS5000 | |||
| 369 | To compile this driver as a module, choose M here: the | 369 | To compile this driver as a module, choose M here: the |
| 370 | module will be called mcs5000_ts. | 370 | module will be called mcs5000_ts. |
| 371 | 371 | ||
| 372 | config TOUCHSCREEN_MMS114 | ||
| 373 | tristate "MELFAS MMS114 touchscreen" | ||
| 374 | depends on I2C | ||
| 375 | help | ||
| 376 | Say Y here if you have the MELFAS MMS114 touchscreen controller | ||
| 377 | chip in your system. | ||
| 378 | |||
| 379 | If unsure, say N. | ||
| 380 | |||
| 381 | To compile this driver as a module, choose M here: the | ||
| 382 | module will be called mms114. | ||
| 383 | |||
| 372 | config TOUCHSCREEN_MTOUCH | 384 | config TOUCHSCREEN_MTOUCH |
| 373 | tristate "MicroTouch serial touchscreens" | 385 | tristate "MicroTouch serial touchscreens" |
| 374 | select SERIO | 386 | select SERIO |
| @@ -518,10 +530,10 @@ config TOUCHSCREEN_TI_TSCADC | |||
| 518 | 530 | ||
| 519 | config TOUCHSCREEN_ATMEL_TSADCC | 531 | config TOUCHSCREEN_ATMEL_TSADCC |
| 520 | tristate "Atmel Touchscreen Interface" | 532 | tristate "Atmel Touchscreen Interface" |
| 521 | depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 | 533 | depends on ARCH_AT91 |
| 522 | help | 534 | help |
| 523 | Say Y here if you have a 4-wire touchscreen connected to the | 535 | Say Y here if you have a 4-wire touchscreen connected to the |
| 524 | ADC Controller on your Atmel SoC (such as the AT91SAM9RL). | 536 | ADC Controller on your Atmel SoC. |
| 525 | 537 | ||
| 526 | If unsure, say N. | 538 | If unsure, say N. |
| 527 | 539 | ||
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index eb8bfe1c1a46..5920c60f999d 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
| @@ -38,6 +38,7 @@ obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o | |||
| 38 | obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o | 38 | obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o |
| 39 | obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o | 39 | obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o |
| 40 | obj-$(CONFIG_TOUCHSCREEN_MIGOR) += migor_ts.o | 40 | obj-$(CONFIG_TOUCHSCREEN_MIGOR) += migor_ts.o |
| 41 | obj-$(CONFIG_TOUCHSCREEN_MMS114) += mms114.o | ||
| 41 | obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o | 42 | obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o |
| 42 | obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o | 43 | obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o |
| 43 | obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o | 44 | obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o |
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index bd4eb4277697..facd3057b62d 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c | |||
| @@ -118,6 +118,7 @@ struct ad7879 { | |||
| 118 | unsigned int irq; | 118 | unsigned int irq; |
| 119 | bool disabled; /* P: input->mutex */ | 119 | bool disabled; /* P: input->mutex */ |
| 120 | bool suspended; /* P: input->mutex */ | 120 | bool suspended; /* P: input->mutex */ |
| 121 | bool swap_xy; | ||
| 121 | u16 conversion_data[AD7879_NR_SENSE]; | 122 | u16 conversion_data[AD7879_NR_SENSE]; |
| 122 | char phys[32]; | 123 | char phys[32]; |
| 123 | u8 first_conversion_delay; | 124 | u8 first_conversion_delay; |
| @@ -161,6 +162,9 @@ static int ad7879_report(struct ad7879 *ts) | |||
| 161 | z1 = ts->conversion_data[AD7879_SEQ_Z1] & MAX_12BIT; | 162 | z1 = ts->conversion_data[AD7879_SEQ_Z1] & MAX_12BIT; |
| 162 | z2 = ts->conversion_data[AD7879_SEQ_Z2] & MAX_12BIT; | 163 | z2 = ts->conversion_data[AD7879_SEQ_Z2] & MAX_12BIT; |
| 163 | 164 | ||
| 165 | if (ts->swap_xy) | ||
| 166 | swap(x, y); | ||
| 167 | |||
| 164 | /* | 168 | /* |
| 165 | * The samples processed here are already preprocessed by the AD7879. | 169 | * The samples processed here are already preprocessed by the AD7879. |
| 166 | * The preprocessing function consists of a median and an averaging | 170 | * The preprocessing function consists of a median and an averaging |
| @@ -520,6 +524,7 @@ struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned int irq, | |||
| 520 | ts->dev = dev; | 524 | ts->dev = dev; |
| 521 | ts->input = input_dev; | 525 | ts->input = input_dev; |
| 522 | ts->irq = irq; | 526 | ts->irq = irq; |
| 527 | ts->swap_xy = pdata->swap_xy; | ||
| 523 | 528 | ||
| 524 | setup_timer(&ts->timer, ad7879_timer, (unsigned long) ts); | 529 | setup_timer(&ts->timer, ad7879_timer, (unsigned long) ts); |
| 525 | 530 | ||
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 25fd0561a17d..4623cc69fc60 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #define MXT_FW_NAME "maxtouch.fw" | 36 | #define MXT_FW_NAME "maxtouch.fw" |
| 37 | 37 | ||
| 38 | /* Registers */ | 38 | /* Registers */ |
| 39 | #define MXT_INFO 0x00 | ||
| 39 | #define MXT_FAMILY_ID 0x00 | 40 | #define MXT_FAMILY_ID 0x00 |
| 40 | #define MXT_VARIANT_ID 0x01 | 41 | #define MXT_VARIANT_ID 0x01 |
| 41 | #define MXT_VERSION 0x02 | 42 | #define MXT_VERSION 0x02 |
| @@ -194,6 +195,7 @@ | |||
| 194 | #define MXT_BOOT_STATUS_MASK 0x3f | 195 | #define MXT_BOOT_STATUS_MASK 0x3f |
| 195 | 196 | ||
| 196 | /* Touch status */ | 197 | /* Touch status */ |
| 198 | #define MXT_UNGRIP (1 << 0) | ||
| 197 | #define MXT_SUPPRESS (1 << 1) | 199 | #define MXT_SUPPRESS (1 << 1) |
| 198 | #define MXT_AMP (1 << 2) | 200 | #define MXT_AMP (1 << 2) |
| 199 | #define MXT_VECTOR (1 << 3) | 201 | #define MXT_VECTOR (1 << 3) |
| @@ -210,8 +212,6 @@ | |||
| 210 | /* Touchscreen absolute values */ | 212 | /* Touchscreen absolute values */ |
| 211 | #define MXT_MAX_AREA 0xff | 213 | #define MXT_MAX_AREA 0xff |
| 212 | 214 | ||
| 213 | #define MXT_MAX_FINGER 10 | ||
| 214 | |||
| 215 | struct mxt_info { | 215 | struct mxt_info { |
| 216 | u8 family_id; | 216 | u8 family_id; |
| 217 | u8 variant_id; | 217 | u8 variant_id; |
| @@ -225,44 +225,37 @@ struct mxt_info { | |||
| 225 | struct mxt_object { | 225 | struct mxt_object { |
| 226 | u8 type; | 226 | u8 type; |
| 227 | u16 start_address; | 227 | u16 start_address; |
| 228 | u8 size; | 228 | u8 size; /* Size of each instance - 1 */ |
| 229 | u8 instances; | 229 | u8 instances; /* Number of instances - 1 */ |
| 230 | u8 num_report_ids; | 230 | u8 num_report_ids; |
| 231 | 231 | } __packed; | |
| 232 | /* to map object and message */ | ||
| 233 | u8 max_reportid; | ||
| 234 | }; | ||
| 235 | 232 | ||
| 236 | struct mxt_message { | 233 | struct mxt_message { |
| 237 | u8 reportid; | 234 | u8 reportid; |
| 238 | u8 message[7]; | 235 | u8 message[7]; |
| 239 | }; | 236 | }; |
| 240 | 237 | ||
| 241 | struct mxt_finger { | ||
| 242 | int status; | ||
| 243 | int x; | ||
| 244 | int y; | ||
| 245 | int area; | ||
| 246 | int pressure; | ||
| 247 | }; | ||
| 248 | |||
| 249 | /* Each client has this additional data */ | 238 | /* Each client has this additional data */ |
| 250 | struct mxt_data { | 239 | struct mxt_data { |
| 251 | struct i2c_client *client; | 240 | struct i2c_client *client; |
| 252 | struct input_dev *input_dev; | 241 | struct input_dev *input_dev; |
| 242 | char phys[64]; /* device physical location */ | ||
| 253 | const struct mxt_platform_data *pdata; | 243 | const struct mxt_platform_data *pdata; |
| 254 | struct mxt_object *object_table; | 244 | struct mxt_object *object_table; |
| 255 | struct mxt_info info; | 245 | struct mxt_info info; |
| 256 | struct mxt_finger finger[MXT_MAX_FINGER]; | ||
| 257 | unsigned int irq; | 246 | unsigned int irq; |
| 258 | unsigned int max_x; | 247 | unsigned int max_x; |
| 259 | unsigned int max_y; | 248 | unsigned int max_y; |
| 249 | |||
| 250 | /* Cached parameters from object table */ | ||
| 251 | u8 T6_reportid; | ||
| 252 | u8 T9_reportid_min; | ||
| 253 | u8 T9_reportid_max; | ||
| 260 | }; | 254 | }; |
| 261 | 255 | ||
| 262 | static bool mxt_object_readable(unsigned int type) | 256 | static bool mxt_object_readable(unsigned int type) |
| 263 | { | 257 | { |
| 264 | switch (type) { | 258 | switch (type) { |
| 265 | case MXT_GEN_MESSAGE_T5: | ||
| 266 | case MXT_GEN_COMMAND_T6: | 259 | case MXT_GEN_COMMAND_T6: |
| 267 | case MXT_GEN_POWER_T7: | 260 | case MXT_GEN_POWER_T7: |
| 268 | case MXT_GEN_ACQUIRE_T8: | 261 | case MXT_GEN_ACQUIRE_T8: |
| @@ -396,6 +389,7 @@ static int __mxt_read_reg(struct i2c_client *client, | |||
| 396 | { | 389 | { |
| 397 | struct i2c_msg xfer[2]; | 390 | struct i2c_msg xfer[2]; |
| 398 | u8 buf[2]; | 391 | u8 buf[2]; |
| 392 | int ret; | ||
| 399 | 393 | ||
| 400 | buf[0] = reg & 0xff; | 394 | buf[0] = reg & 0xff; |
| 401 | buf[1] = (reg >> 8) & 0xff; | 395 | buf[1] = (reg >> 8) & 0xff; |
| @@ -412,12 +406,17 @@ static int __mxt_read_reg(struct i2c_client *client, | |||
| 412 | xfer[1].len = len; | 406 | xfer[1].len = len; |
| 413 | xfer[1].buf = val; | 407 | xfer[1].buf = val; |
| 414 | 408 | ||
| 415 | if (i2c_transfer(client->adapter, xfer, 2) != 2) { | 409 | ret = i2c_transfer(client->adapter, xfer, 2); |
| 416 | dev_err(&client->dev, "%s: i2c transfer failed\n", __func__); | 410 | if (ret == 2) { |
| 417 | return -EIO; | 411 | ret = 0; |
| 412 | } else { | ||
| 413 | if (ret >= 0) | ||
| 414 | ret = -EIO; | ||
| 415 | dev_err(&client->dev, "%s: i2c transfer failed (%d)\n", | ||
| 416 | __func__, ret); | ||
| 418 | } | 417 | } |
| 419 | 418 | ||
| 420 | return 0; | 419 | return ret; |
| 421 | } | 420 | } |
| 422 | 421 | ||
| 423 | static int mxt_read_reg(struct i2c_client *client, u16 reg, u8 *val) | 422 | static int mxt_read_reg(struct i2c_client *client, u16 reg, u8 *val) |
| @@ -425,27 +424,39 @@ static int mxt_read_reg(struct i2c_client *client, u16 reg, u8 *val) | |||
| 425 | return __mxt_read_reg(client, reg, 1, val); | 424 | return __mxt_read_reg(client, reg, 1, val); |
| 426 | } | 425 | } |
| 427 | 426 | ||
| 428 | static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val) | 427 | static int __mxt_write_reg(struct i2c_client *client, u16 reg, u16 len, |
| 428 | const void *val) | ||
| 429 | { | 429 | { |
| 430 | u8 buf[3]; | 430 | u8 *buf; |
| 431 | size_t count; | ||
| 432 | int ret; | ||
| 433 | |||
| 434 | count = len + 2; | ||
| 435 | buf = kmalloc(count, GFP_KERNEL); | ||
| 436 | if (!buf) | ||
| 437 | return -ENOMEM; | ||
| 431 | 438 | ||
| 432 | buf[0] = reg & 0xff; | 439 | buf[0] = reg & 0xff; |
| 433 | buf[1] = (reg >> 8) & 0xff; | 440 | buf[1] = (reg >> 8) & 0xff; |
| 434 | buf[2] = val; | 441 | memcpy(&buf[2], val, len); |
| 435 | 442 | ||
| 436 | if (i2c_master_send(client, buf, 3) != 3) { | 443 | ret = i2c_master_send(client, buf, count); |
| 437 | dev_err(&client->dev, "%s: i2c send failed\n", __func__); | 444 | if (ret == count) { |
| 438 | return -EIO; | 445 | ret = 0; |
| 446 | } else { | ||
| 447 | if (ret >= 0) | ||
| 448 | ret = -EIO; | ||
| 449 | dev_err(&client->dev, "%s: i2c send failed (%d)\n", | ||
| 450 | __func__, ret); | ||
| 439 | } | 451 | } |
| 440 | 452 | ||
| 441 | return 0; | 453 | kfree(buf); |
| 454 | return ret; | ||
| 442 | } | 455 | } |
| 443 | 456 | ||
| 444 | static int mxt_read_object_table(struct i2c_client *client, | 457 | static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val) |
| 445 | u16 reg, u8 *object_buf) | ||
| 446 | { | 458 | { |
| 447 | return __mxt_read_reg(client, reg, MXT_OBJECT_SIZE, | 459 | return __mxt_write_reg(client, reg, 1, &val); |
| 448 | object_buf); | ||
| 449 | } | 460 | } |
| 450 | 461 | ||
| 451 | static struct mxt_object * | 462 | static struct mxt_object * |
| @@ -479,20 +490,6 @@ static int mxt_read_message(struct mxt_data *data, | |||
| 479 | sizeof(struct mxt_message), message); | 490 | sizeof(struct mxt_message), message); |
| 480 | } | 491 | } |
| 481 | 492 | ||
| 482 | static int mxt_read_object(struct mxt_data *data, | ||
| 483 | u8 type, u8 offset, u8 *val) | ||
| 484 | { | ||
| 485 | struct mxt_object *object; | ||
| 486 | u16 reg; | ||
| 487 | |||
| 488 | object = mxt_get_object(data, type); | ||
| 489 | if (!object) | ||
| 490 | return -EINVAL; | ||
| 491 | |||
| 492 | reg = object->start_address; | ||
| 493 | return __mxt_read_reg(data->client, reg + offset, 1, val); | ||
| 494 | } | ||
| 495 | |||
| 496 | static int mxt_write_object(struct mxt_data *data, | 493 | static int mxt_write_object(struct mxt_data *data, |
| 497 | u8 type, u8 offset, u8 val) | 494 | u8 type, u8 offset, u8 val) |
| 498 | { | 495 | { |
| @@ -507,75 +504,17 @@ static int mxt_write_object(struct mxt_data *data, | |||
| 507 | return mxt_write_reg(data->client, reg + offset, val); | 504 | return mxt_write_reg(data->client, reg + offset, val); |
| 508 | } | 505 | } |
| 509 | 506 | ||
| 510 | static void mxt_input_report(struct mxt_data *data, int single_id) | ||
| 511 | { | ||
| 512 | struct mxt_finger *finger = data->finger; | ||
| 513 | struct input_dev *input_dev = data->input_dev; | ||
| 514 | int status = finger[single_id].status; | ||
| 515 | int finger_num = 0; | ||
| 516 | int id; | ||
| 517 | |||
| 518 | for (id = 0; id < MXT_MAX_FINGER; id++) { | ||
| 519 | if (!finger[id].status) | ||
| 520 | continue; | ||
| 521 | |||
| 522 | input_mt_slot(input_dev, id); | ||
| 523 | input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, | ||
| 524 | finger[id].status != MXT_RELEASE); | ||
| 525 | |||
| 526 | if (finger[id].status != MXT_RELEASE) { | ||
| 527 | finger_num++; | ||
| 528 | input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, | ||
| 529 | finger[id].area); | ||
| 530 | input_report_abs(input_dev, ABS_MT_POSITION_X, | ||
| 531 | finger[id].x); | ||
| 532 | input_report_abs(input_dev, ABS_MT_POSITION_Y, | ||
| 533 | finger[id].y); | ||
| 534 | input_report_abs(input_dev, ABS_MT_PRESSURE, | ||
| 535 | finger[id].pressure); | ||
| 536 | } else { | ||
| 537 | finger[id].status = 0; | ||
| 538 | } | ||
| 539 | } | ||
| 540 | |||
| 541 | input_report_key(input_dev, BTN_TOUCH, finger_num > 0); | ||
| 542 | |||
| 543 | if (status != MXT_RELEASE) { | ||
| 544 | input_report_abs(input_dev, ABS_X, finger[single_id].x); | ||
| 545 | input_report_abs(input_dev, ABS_Y, finger[single_id].y); | ||
| 546 | input_report_abs(input_dev, | ||
| 547 | ABS_PRESSURE, finger[single_id].pressure); | ||
| 548 | } | ||
| 549 | |||
| 550 | input_sync(input_dev); | ||
| 551 | } | ||
| 552 | |||
| 553 | static void mxt_input_touchevent(struct mxt_data *data, | 507 | static void mxt_input_touchevent(struct mxt_data *data, |
| 554 | struct mxt_message *message, int id) | 508 | struct mxt_message *message, int id) |
| 555 | { | 509 | { |
| 556 | struct mxt_finger *finger = data->finger; | ||
| 557 | struct device *dev = &data->client->dev; | 510 | struct device *dev = &data->client->dev; |
| 558 | u8 status = message->message[0]; | 511 | u8 status = message->message[0]; |
| 512 | struct input_dev *input_dev = data->input_dev; | ||
| 559 | int x; | 513 | int x; |
| 560 | int y; | 514 | int y; |
| 561 | int area; | 515 | int area; |
| 562 | int pressure; | 516 | int pressure; |
| 563 | 517 | ||
| 564 | /* Check the touch is present on the screen */ | ||
| 565 | if (!(status & MXT_DETECT)) { | ||
| 566 | if (status & MXT_RELEASE) { | ||
| 567 | dev_dbg(dev, "[%d] released\n", id); | ||
| 568 | |||
| 569 | finger[id].status = MXT_RELEASE; | ||
| 570 | mxt_input_report(data, id); | ||
| 571 | } | ||
| 572 | return; | ||
| 573 | } | ||
| 574 | |||
| 575 | /* Check only AMP detection */ | ||
| 576 | if (!(status & (MXT_PRESS | MXT_MOVE))) | ||
| 577 | return; | ||
| 578 | |||
| 579 | x = (message->message[1] << 4) | ((message->message[3] >> 4) & 0xf); | 518 | x = (message->message[1] << 4) | ((message->message[3] >> 4) & 0xf); |
| 580 | y = (message->message[2] << 4) | ((message->message[3] & 0xf)); | 519 | y = (message->message[2] << 4) | ((message->message[3] & 0xf)); |
| 581 | if (data->max_x < 1024) | 520 | if (data->max_x < 1024) |
| @@ -586,30 +525,50 @@ static void mxt_input_touchevent(struct mxt_data *data, | |||
| 586 | area = message->message[4]; | 525 | area = message->message[4]; |
| 587 | pressure = message->message[5]; | 526 | pressure = message->message[5]; |
| 588 | 527 | ||
| 589 | dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id, | 528 | dev_dbg(dev, |
| 590 | status & MXT_MOVE ? "moved" : "pressed", | 529 | "[%u] %c%c%c%c%c%c%c%c x: %5u y: %5u area: %3u amp: %3u\n", |
| 591 | x, y, area); | 530 | id, |
| 531 | (status & MXT_DETECT) ? 'D' : '.', | ||
| 532 | (status & MXT_PRESS) ? 'P' : '.', | ||
| 533 | (status & MXT_RELEASE) ? 'R' : '.', | ||
| 534 | (status & MXT_MOVE) ? 'M' : '.', | ||
| 535 | (status & MXT_VECTOR) ? 'V' : '.', | ||
| 536 | (status & MXT_AMP) ? 'A' : '.', | ||
| 537 | (status & MXT_SUPPRESS) ? 'S' : '.', | ||
| 538 | (status & MXT_UNGRIP) ? 'U' : '.', | ||
| 539 | x, y, area, pressure); | ||
| 540 | |||
| 541 | input_mt_slot(input_dev, id); | ||
| 542 | input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, | ||
| 543 | status & MXT_DETECT); | ||
| 544 | |||
| 545 | if (status & MXT_DETECT) { | ||
| 546 | input_report_abs(input_dev, ABS_MT_POSITION_X, x); | ||
| 547 | input_report_abs(input_dev, ABS_MT_POSITION_Y, y); | ||
| 548 | input_report_abs(input_dev, ABS_MT_PRESSURE, pressure); | ||
| 549 | input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, area); | ||
| 550 | } | ||
| 551 | } | ||
| 592 | 552 | ||
| 593 | finger[id].status = status & MXT_MOVE ? | 553 | static unsigned mxt_extract_T6_csum(const u8 *csum) |
| 594 | MXT_MOVE : MXT_PRESS; | 554 | { |
| 595 | finger[id].x = x; | 555 | return csum[0] | (csum[1] << 8) | (csum[2] << 16); |
| 596 | finger[id].y = y; | 556 | } |
| 597 | finger[id].area = area; | ||
| 598 | finger[id].pressure = pressure; | ||
| 599 | 557 | ||
| 600 | mxt_input_report(data, id); | 558 | static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg) |
| 559 | { | ||
| 560 | u8 id = msg->reportid; | ||
| 561 | return (id >= data->T9_reportid_min && id <= data->T9_reportid_max); | ||
| 601 | } | 562 | } |
| 602 | 563 | ||
| 603 | static irqreturn_t mxt_interrupt(int irq, void *dev_id) | 564 | static irqreturn_t mxt_interrupt(int irq, void *dev_id) |
| 604 | { | 565 | { |
| 605 | struct mxt_data *data = dev_id; | 566 | struct mxt_data *data = dev_id; |
| 606 | struct mxt_message message; | 567 | struct mxt_message message; |
| 607 | struct mxt_object *object; | 568 | const u8 *payload = &message.message[0]; |
| 608 | struct device *dev = &data->client->dev; | 569 | struct device *dev = &data->client->dev; |
| 609 | int id; | ||
| 610 | u8 reportid; | 570 | u8 reportid; |
| 611 | u8 max_reportid; | 571 | bool update_input = false; |
| 612 | u8 min_reportid; | ||
| 613 | 572 | ||
| 614 | do { | 573 | do { |
| 615 | if (mxt_read_message(data, &message)) { | 574 | if (mxt_read_message(data, &message)) { |
| @@ -619,21 +578,25 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) | |||
| 619 | 578 | ||
| 620 | reportid = message.reportid; | 579 | reportid = message.reportid; |
| 621 | 580 | ||
| 622 | /* whether reportid is thing of MXT_TOUCH_MULTI_T9 */ | 581 | if (reportid == data->T6_reportid) { |
| 623 | object = mxt_get_object(data, MXT_TOUCH_MULTI_T9); | 582 | u8 status = payload[0]; |
| 624 | if (!object) | 583 | unsigned csum = mxt_extract_T6_csum(&payload[1]); |
| 625 | goto end; | 584 | dev_dbg(dev, "Status: %02x Config Checksum: %06x\n", |
| 626 | 585 | status, csum); | |
| 627 | max_reportid = object->max_reportid; | 586 | } else if (mxt_is_T9_message(data, &message)) { |
| 628 | min_reportid = max_reportid - object->num_report_ids + 1; | 587 | int id = reportid - data->T9_reportid_min; |
| 629 | id = reportid - min_reportid; | ||
| 630 | |||
| 631 | if (reportid >= min_reportid && reportid <= max_reportid) | ||
| 632 | mxt_input_touchevent(data, &message, id); | 588 | mxt_input_touchevent(data, &message, id); |
| 633 | else | 589 | update_input = true; |
| 590 | } else { | ||
| 634 | mxt_dump_message(dev, &message); | 591 | mxt_dump_message(dev, &message); |
| 592 | } | ||
| 635 | } while (reportid != 0xff); | 593 | } while (reportid != 0xff); |
| 636 | 594 | ||
| 595 | if (update_input) { | ||
| 596 | input_mt_report_pointer_emulation(data->input_dev, false); | ||
| 597 | input_sync(data->input_dev); | ||
| 598 | } | ||
| 599 | |||
| 637 | end: | 600 | end: |
| 638 | return IRQ_HANDLED; | 601 | return IRQ_HANDLED; |
| 639 | } | 602 | } |
| @@ -644,7 +607,8 @@ static int mxt_check_reg_init(struct mxt_data *data) | |||
| 644 | struct mxt_object *object; | 607 | struct mxt_object *object; |
| 645 | struct device *dev = &data->client->dev; | 608 | struct device *dev = &data->client->dev; |
| 646 | int index = 0; | 609 | int index = 0; |
| 647 | int i, j, config_offset; | 610 | int i, size; |
| 611 | int ret; | ||
| 648 | 612 | ||
| 649 | if (!pdata->config) { | 613 | if (!pdata->config) { |
| 650 | dev_dbg(dev, "No cfg data defined, skipping reg init\n"); | 614 | dev_dbg(dev, "No cfg data defined, skipping reg init\n"); |
| @@ -657,18 +621,17 @@ static int mxt_check_reg_init(struct mxt_data *data) | |||
| 657 | if (!mxt_object_writable(object->type)) | 621 | if (!mxt_object_writable(object->type)) |
| 658 | continue; | 622 | continue; |
| 659 | 623 | ||
| 660 | for (j = 0; | 624 | size = (object->size + 1) * (object->instances + 1); |
| 661 | j < (object->size + 1) * (object->instances + 1); | 625 | if (index + size > pdata->config_length) { |
| 662 | j++) { | 626 | dev_err(dev, "Not enough config data!\n"); |
| 663 | config_offset = index + j; | 627 | return -EINVAL; |
| 664 | if (config_offset > pdata->config_length) { | ||
| 665 | dev_err(dev, "Not enough config data!\n"); | ||
| 666 | return -EINVAL; | ||
| 667 | } | ||
| 668 | mxt_write_object(data, object->type, j, | ||
| 669 | pdata->config[config_offset]); | ||
| 670 | } | 628 | } |
| 671 | index += (object->size + 1) * (object->instances + 1); | 629 | |
| 630 | ret = __mxt_write_reg(data->client, object->start_address, | ||
| 631 | size, &pdata->config[index]); | ||
| 632 | if (ret) | ||
| 633 | return ret; | ||
| 634 | index += size; | ||
| 672 | } | 635 | } |
| 673 | 636 | ||
| 674 | return 0; | 637 | return 0; |
| @@ -749,68 +712,76 @@ static int mxt_get_info(struct mxt_data *data) | |||
| 749 | struct i2c_client *client = data->client; | 712 | struct i2c_client *client = data->client; |
| 750 | struct mxt_info *info = &data->info; | 713 | struct mxt_info *info = &data->info; |
| 751 | int error; | 714 | int error; |
| 752 | u8 val; | ||
| 753 | 715 | ||
| 754 | error = mxt_read_reg(client, MXT_FAMILY_ID, &val); | 716 | /* Read 7-byte info block starting at address 0 */ |
| 717 | error = __mxt_read_reg(client, MXT_INFO, sizeof(*info), info); | ||
| 755 | if (error) | 718 | if (error) |
| 756 | return error; | 719 | return error; |
| 757 | info->family_id = val; | ||
| 758 | |||
| 759 | error = mxt_read_reg(client, MXT_VARIANT_ID, &val); | ||
| 760 | if (error) | ||
| 761 | return error; | ||
| 762 | info->variant_id = val; | ||
| 763 | |||
| 764 | error = mxt_read_reg(client, MXT_VERSION, &val); | ||
| 765 | if (error) | ||
| 766 | return error; | ||
| 767 | info->version = val; | ||
| 768 | |||
| 769 | error = mxt_read_reg(client, MXT_BUILD, &val); | ||
| 770 | if (error) | ||
| 771 | return error; | ||
| 772 | info->build = val; | ||
| 773 | |||
| 774 | error = mxt_read_reg(client, MXT_OBJECT_NUM, &val); | ||
| 775 | if (error) | ||
| 776 | return error; | ||
| 777 | info->object_num = val; | ||
| 778 | 720 | ||
| 779 | return 0; | 721 | return 0; |
| 780 | } | 722 | } |
| 781 | 723 | ||
| 782 | static int mxt_get_object_table(struct mxt_data *data) | 724 | static int mxt_get_object_table(struct mxt_data *data) |
| 783 | { | 725 | { |
| 726 | struct i2c_client *client = data->client; | ||
| 727 | size_t table_size; | ||
| 784 | int error; | 728 | int error; |
| 785 | int i; | 729 | int i; |
| 786 | u16 reg; | 730 | u8 reportid; |
| 787 | u8 reportid = 0; | 731 | |
| 788 | u8 buf[MXT_OBJECT_SIZE]; | 732 | table_size = data->info.object_num * sizeof(struct mxt_object); |
| 733 | error = __mxt_read_reg(client, MXT_OBJECT_START, table_size, | ||
| 734 | data->object_table); | ||
| 735 | if (error) | ||
| 736 | return error; | ||
| 789 | 737 | ||
| 738 | /* Valid Report IDs start counting from 1 */ | ||
| 739 | reportid = 1; | ||
| 790 | for (i = 0; i < data->info.object_num; i++) { | 740 | for (i = 0; i < data->info.object_num; i++) { |
| 791 | struct mxt_object *object = data->object_table + i; | 741 | struct mxt_object *object = data->object_table + i; |
| 742 | u8 min_id, max_id; | ||
| 792 | 743 | ||
| 793 | reg = MXT_OBJECT_START + MXT_OBJECT_SIZE * i; | 744 | le16_to_cpus(&object->start_address); |
| 794 | error = mxt_read_object_table(data->client, reg, buf); | ||
| 795 | if (error) | ||
| 796 | return error; | ||
| 797 | |||
| 798 | object->type = buf[0]; | ||
| 799 | object->start_address = (buf[2] << 8) | buf[1]; | ||
| 800 | object->size = buf[3]; | ||
| 801 | object->instances = buf[4]; | ||
| 802 | object->num_report_ids = buf[5]; | ||
| 803 | 745 | ||
| 804 | if (object->num_report_ids) { | 746 | if (object->num_report_ids) { |
| 747 | min_id = reportid; | ||
| 805 | reportid += object->num_report_ids * | 748 | reportid += object->num_report_ids * |
| 806 | (object->instances + 1); | 749 | (object->instances + 1); |
| 807 | object->max_reportid = reportid; | 750 | max_id = reportid - 1; |
| 751 | } else { | ||
| 752 | min_id = 0; | ||
| 753 | max_id = 0; | ||
| 754 | } | ||
| 755 | |||
| 756 | dev_dbg(&data->client->dev, | ||
| 757 | "Type %2d Start %3d Size %3d Instances %2d ReportIDs %3u : %3u\n", | ||
| 758 | object->type, object->start_address, object->size + 1, | ||
| 759 | object->instances + 1, min_id, max_id); | ||
| 760 | |||
| 761 | switch (object->type) { | ||
| 762 | case MXT_GEN_COMMAND_T6: | ||
| 763 | data->T6_reportid = min_id; | ||
| 764 | break; | ||
| 765 | case MXT_TOUCH_MULTI_T9: | ||
| 766 | data->T9_reportid_min = min_id; | ||
| 767 | data->T9_reportid_max = max_id; | ||
| 768 | break; | ||
| 808 | } | 769 | } |
| 809 | } | 770 | } |
| 810 | 771 | ||
| 811 | return 0; | 772 | return 0; |
| 812 | } | 773 | } |
| 813 | 774 | ||
| 775 | static void mxt_free_object_table(struct mxt_data *data) | ||
| 776 | { | ||
| 777 | kfree(data->object_table); | ||
| 778 | data->object_table = NULL; | ||
| 779 | data->T6_reportid = 0; | ||
| 780 | data->T9_reportid_min = 0; | ||
| 781 | data->T9_reportid_max = 0; | ||
| 782 | |||
| 783 | } | ||
| 784 | |||
| 814 | static int mxt_initialize(struct mxt_data *data) | 785 | static int mxt_initialize(struct mxt_data *data) |
| 815 | { | 786 | { |
| 816 | struct i2c_client *client = data->client; | 787 | struct i2c_client *client = data->client; |
| @@ -833,12 +804,12 @@ static int mxt_initialize(struct mxt_data *data) | |||
| 833 | /* Get object table information */ | 804 | /* Get object table information */ |
| 834 | error = mxt_get_object_table(data); | 805 | error = mxt_get_object_table(data); |
| 835 | if (error) | 806 | if (error) |
| 836 | return error; | 807 | goto err_free_object_table; |
| 837 | 808 | ||
| 838 | /* Check register init values */ | 809 | /* Check register init values */ |
| 839 | error = mxt_check_reg_init(data); | 810 | error = mxt_check_reg_init(data); |
| 840 | if (error) | 811 | if (error) |
| 841 | return error; | 812 | goto err_free_object_table; |
| 842 | 813 | ||
| 843 | mxt_handle_pdata(data); | 814 | mxt_handle_pdata(data); |
| 844 | 815 | ||
| @@ -856,25 +827,29 @@ static int mxt_initialize(struct mxt_data *data) | |||
| 856 | /* Update matrix size at info struct */ | 827 | /* Update matrix size at info struct */ |
| 857 | error = mxt_read_reg(client, MXT_MATRIX_X_SIZE, &val); | 828 | error = mxt_read_reg(client, MXT_MATRIX_X_SIZE, &val); |
| 858 | if (error) | 829 | if (error) |
| 859 | return error; | 830 | goto err_free_object_table; |
| 860 | info->matrix_xsize = val; | 831 | info->matrix_xsize = val; |
| 861 | 832 | ||
| 862 | error = mxt_read_reg(client, MXT_MATRIX_Y_SIZE, &val); | 833 | error = mxt_read_reg(client, MXT_MATRIX_Y_SIZE, &val); |
| 863 | if (error) | 834 | if (error) |
| 864 | return error; | 835 | goto err_free_object_table; |
| 865 | info->matrix_ysize = val; | 836 | info->matrix_ysize = val; |
| 866 | 837 | ||
| 867 | dev_info(&client->dev, | 838 | dev_info(&client->dev, |
| 868 | "Family ID: %d Variant ID: %d Version: %d Build: %d\n", | 839 | "Family ID: %u Variant ID: %u Major.Minor.Build: %u.%u.%02X\n", |
| 869 | info->family_id, info->variant_id, info->version, | 840 | info->family_id, info->variant_id, info->version >> 4, |
| 870 | info->build); | 841 | info->version & 0xf, info->build); |
| 871 | 842 | ||
| 872 | dev_info(&client->dev, | 843 | dev_info(&client->dev, |
| 873 | "Matrix X Size: %d Matrix Y Size: %d Object Num: %d\n", | 844 | "Matrix X Size: %u Matrix Y Size: %u Object Num: %u\n", |
| 874 | info->matrix_xsize, info->matrix_ysize, | 845 | info->matrix_xsize, info->matrix_ysize, |
| 875 | info->object_num); | 846 | info->object_num); |
| 876 | 847 | ||
| 877 | return 0; | 848 | return 0; |
| 849 | |||
| 850 | err_free_object_table: | ||
| 851 | mxt_free_object_table(data); | ||
| 852 | return error; | ||
| 878 | } | 853 | } |
| 879 | 854 | ||
| 880 | static void mxt_calc_resolution(struct mxt_data *data) | 855 | static void mxt_calc_resolution(struct mxt_data *data) |
| @@ -891,6 +866,44 @@ static void mxt_calc_resolution(struct mxt_data *data) | |||
| 891 | } | 866 | } |
| 892 | } | 867 | } |
| 893 | 868 | ||
| 869 | /* Firmware Version is returned as Major.Minor.Build */ | ||
| 870 | static ssize_t mxt_fw_version_show(struct device *dev, | ||
| 871 | struct device_attribute *attr, char *buf) | ||
| 872 | { | ||
| 873 | struct mxt_data *data = dev_get_drvdata(dev); | ||
| 874 | struct mxt_info *info = &data->info; | ||
| 875 | return scnprintf(buf, PAGE_SIZE, "%u.%u.%02X\n", | ||
| 876 | info->version >> 4, info->version & 0xf, info->build); | ||
| 877 | } | ||
| 878 | |||
| 879 | /* Hardware Version is returned as FamilyID.VariantID */ | ||
| 880 | static ssize_t mxt_hw_version_show(struct device *dev, | ||
| 881 | struct device_attribute *attr, char *buf) | ||
| 882 | { | ||
| 883 | struct mxt_data *data = dev_get_drvdata(dev); | ||
| 884 | struct mxt_info *info = &data->info; | ||
| 885 | return scnprintf(buf, PAGE_SIZE, "%u.%u\n", | ||
| 886 | info->family_id, info->variant_id); | ||
| 887 | } | ||
| 888 | |||
| 889 | static ssize_t mxt_show_instance(char *buf, int count, | ||
| 890 | struct mxt_object *object, int instance, | ||
| 891 | const u8 *val) | ||
| 892 | { | ||
| 893 | int i; | ||
| 894 | |||
| 895 | if (object->instances > 0) | ||
| 896 | count += scnprintf(buf + count, PAGE_SIZE - count, | ||
| 897 | "Instance %u\n", instance); | ||
| 898 | |||
| 899 | for (i = 0; i < object->size + 1; i++) | ||
| 900 | count += scnprintf(buf + count, PAGE_SIZE - count, | ||
| 901 | "\t[%2u]: %02x (%d)\n", i, val[i], val[i]); | ||
| 902 | count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); | ||
| 903 | |||
| 904 | return count; | ||
| 905 | } | ||
| 906 | |||
| 894 | static ssize_t mxt_object_show(struct device *dev, | 907 | static ssize_t mxt_object_show(struct device *dev, |
| 895 | struct device_attribute *attr, char *buf) | 908 | struct device_attribute *attr, char *buf) |
| 896 | { | 909 | { |
| @@ -899,43 +912,38 @@ static ssize_t mxt_object_show(struct device *dev, | |||
| 899 | int count = 0; | 912 | int count = 0; |
| 900 | int i, j; | 913 | int i, j; |
| 901 | int error; | 914 | int error; |
| 902 | u8 val; | 915 | u8 *obuf; |
| 903 | 916 | ||
| 917 | /* Pre-allocate buffer large enough to hold max sized object. */ | ||
| 918 | obuf = kmalloc(256, GFP_KERNEL); | ||
| 919 | if (!obuf) | ||
| 920 | return -ENOMEM; | ||
| 921 | |||
| 922 | error = 0; | ||
| 904 | for (i = 0; i < data->info.object_num; i++) { | 923 | for (i = 0; i < data->info.object_num; i++) { |
| 905 | object = data->object_table + i; | 924 | object = data->object_table + i; |
| 906 | 925 | ||
| 907 | count += snprintf(buf + count, PAGE_SIZE - count, | 926 | if (!mxt_object_readable(object->type)) |
| 908 | "Object[%d] (Type %d)\n", | ||
| 909 | i + 1, object->type); | ||
| 910 | if (count >= PAGE_SIZE) | ||
| 911 | return PAGE_SIZE - 1; | ||
| 912 | |||
| 913 | if (!mxt_object_readable(object->type)) { | ||
| 914 | count += snprintf(buf + count, PAGE_SIZE - count, | ||
| 915 | "\n"); | ||
| 916 | if (count >= PAGE_SIZE) | ||
| 917 | return PAGE_SIZE - 1; | ||
| 918 | continue; | 927 | continue; |
| 919 | } | ||
| 920 | 928 | ||
| 921 | for (j = 0; j < object->size + 1; j++) { | 929 | count += scnprintf(buf + count, PAGE_SIZE - count, |
| 922 | error = mxt_read_object(data, | 930 | "T%u:\n", object->type); |
| 923 | object->type, j, &val); | 931 | |
| 932 | for (j = 0; j < object->instances + 1; j++) { | ||
| 933 | u16 size = object->size + 1; | ||
| 934 | u16 addr = object->start_address + j * size; | ||
| 935 | |||
| 936 | error = __mxt_read_reg(data->client, addr, size, obuf); | ||
| 924 | if (error) | 937 | if (error) |
| 925 | return error; | 938 | goto done; |
| 926 | 939 | ||
| 927 | count += snprintf(buf + count, PAGE_SIZE - count, | 940 | count = mxt_show_instance(buf, count, object, j, obuf); |
| 928 | "\t[%2d]: %02x (%d)\n", j, val, val); | ||
| 929 | if (count >= PAGE_SIZE) | ||
| 930 | return PAGE_SIZE - 1; | ||
| 931 | } | 941 | } |
| 932 | |||
| 933 | count += snprintf(buf + count, PAGE_SIZE - count, "\n"); | ||
| 934 | if (count >= PAGE_SIZE) | ||
| 935 | return PAGE_SIZE - 1; | ||
| 936 | } | 942 | } |
| 937 | 943 | ||
| 938 | return count; | 944 | done: |
| 945 | kfree(obuf); | ||
| 946 | return error ?: count; | ||
| 939 | } | 947 | } |
| 940 | 948 | ||
| 941 | static int mxt_load_fw(struct device *dev, const char *fn) | 949 | static int mxt_load_fw(struct device *dev, const char *fn) |
| @@ -1028,8 +1036,7 @@ static ssize_t mxt_update_fw_store(struct device *dev, | |||
| 1028 | /* Wait for reset */ | 1036 | /* Wait for reset */ |
| 1029 | msleep(MXT_FWRESET_TIME); | 1037 | msleep(MXT_FWRESET_TIME); |
| 1030 | 1038 | ||
| 1031 | kfree(data->object_table); | 1039 | mxt_free_object_table(data); |
| 1032 | data->object_table = NULL; | ||
| 1033 | 1040 | ||
| 1034 | mxt_initialize(data); | 1041 | mxt_initialize(data); |
| 1035 | } | 1042 | } |
| @@ -1043,10 +1050,14 @@ static ssize_t mxt_update_fw_store(struct device *dev, | |||
| 1043 | return count; | 1050 | return count; |
| 1044 | } | 1051 | } |
| 1045 | 1052 | ||
| 1053 | static DEVICE_ATTR(fw_version, S_IRUGO, mxt_fw_version_show, NULL); | ||
| 1054 | static DEVICE_ATTR(hw_version, S_IRUGO, mxt_hw_version_show, NULL); | ||
| 1046 | static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL); | 1055 | static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL); |
| 1047 | static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store); | 1056 | static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store); |
| 1048 | 1057 | ||
| 1049 | static struct attribute *mxt_attrs[] = { | 1058 | static struct attribute *mxt_attrs[] = { |
| 1059 | &dev_attr_fw_version.attr, | ||
| 1060 | &dev_attr_hw_version.attr, | ||
| 1050 | &dev_attr_object.attr, | 1061 | &dev_attr_object.attr, |
| 1051 | &dev_attr_update_fw.attr, | 1062 | &dev_attr_update_fw.attr, |
| 1052 | NULL | 1063 | NULL |
| @@ -1093,6 +1104,7 @@ static int __devinit mxt_probe(struct i2c_client *client, | |||
| 1093 | struct mxt_data *data; | 1104 | struct mxt_data *data; |
| 1094 | struct input_dev *input_dev; | 1105 | struct input_dev *input_dev; |
| 1095 | int error; | 1106 | int error; |
| 1107 | unsigned int num_mt_slots; | ||
| 1096 | 1108 | ||
| 1097 | if (!pdata) | 1109 | if (!pdata) |
| 1098 | return -EINVAL; | 1110 | return -EINVAL; |
| @@ -1106,6 +1118,10 @@ static int __devinit mxt_probe(struct i2c_client *client, | |||
| 1106 | } | 1118 | } |
| 1107 | 1119 | ||
| 1108 | input_dev->name = "Atmel maXTouch Touchscreen"; | 1120 | input_dev->name = "Atmel maXTouch Touchscreen"; |
| 1121 | snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0", | ||
| 1122 | client->adapter->nr, client->addr); | ||
| 1123 | input_dev->phys = data->phys; | ||
| 1124 | |||
| 1109 | input_dev->id.bustype = BUS_I2C; | 1125 | input_dev->id.bustype = BUS_I2C; |
| 1110 | input_dev->dev.parent = &client->dev; | 1126 | input_dev->dev.parent = &client->dev; |
| 1111 | input_dev->open = mxt_input_open; | 1127 | input_dev->open = mxt_input_open; |
| @@ -1118,6 +1134,10 @@ static int __devinit mxt_probe(struct i2c_client *client, | |||
| 1118 | 1134 | ||
| 1119 | mxt_calc_resolution(data); | 1135 | mxt_calc_resolution(data); |
| 1120 | 1136 | ||
| 1137 | error = mxt_initialize(data); | ||
| 1138 | if (error) | ||
| 1139 | goto err_free_mem; | ||
| 1140 | |||
| 1121 | __set_bit(EV_ABS, input_dev->evbit); | 1141 | __set_bit(EV_ABS, input_dev->evbit); |
| 1122 | __set_bit(EV_KEY, input_dev->evbit); | 1142 | __set_bit(EV_KEY, input_dev->evbit); |
| 1123 | __set_bit(BTN_TOUCH, input_dev->keybit); | 1143 | __set_bit(BTN_TOUCH, input_dev->keybit); |
| @@ -1131,7 +1151,10 @@ static int __devinit mxt_probe(struct i2c_client *client, | |||
| 1131 | 0, 255, 0, 0); | 1151 | 0, 255, 0, 0); |
| 1132 | 1152 | ||
| 1133 | /* For multi touch */ | 1153 | /* For multi touch */ |
| 1134 | input_mt_init_slots(input_dev, MXT_MAX_FINGER); | 1154 | num_mt_slots = data->T9_reportid_max - data->T9_reportid_min + 1; |
| 1155 | error = input_mt_init_slots(input_dev, num_mt_slots); | ||
| 1156 | if (error) | ||
| 1157 | goto err_free_object; | ||
| 1135 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, | 1158 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, |
| 1136 | 0, MXT_MAX_AREA, 0, 0); | 1159 | 0, MXT_MAX_AREA, 0, 0); |
| 1137 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | 1160 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, |
| @@ -1144,13 +1167,9 @@ static int __devinit mxt_probe(struct i2c_client *client, | |||
| 1144 | input_set_drvdata(input_dev, data); | 1167 | input_set_drvdata(input_dev, data); |
| 1145 | i2c_set_clientdata(client, data); | 1168 | i2c_set_clientdata(client, data); |
| 1146 | 1169 | ||
| 1147 | error = mxt_initialize(data); | ||
| 1148 | if (error) | ||
| 1149 | goto err_free_object; | ||
| 1150 | |||
| 1151 | error = request_threaded_irq(client->irq, NULL, mxt_interrupt, | 1170 | error = request_threaded_irq(client->irq, NULL, mxt_interrupt, |
| 1152 | pdata->irqflags | IRQF_ONESHOT, | 1171 | pdata->irqflags | IRQF_ONESHOT, |
| 1153 | client->dev.driver->name, data); | 1172 | client->name, data); |
| 1154 | if (error) { | 1173 | if (error) { |
| 1155 | dev_err(&client->dev, "Failed to register interrupt\n"); | 1174 | dev_err(&client->dev, "Failed to register interrupt\n"); |
| 1156 | goto err_free_object; | 1175 | goto err_free_object; |
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c new file mode 100644 index 000000000000..49c44bbf548d --- /dev/null +++ b/drivers/input/touchscreen/mms114.c | |||
| @@ -0,0 +1,544 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2012 Samsung Electronics Co.Ltd | ||
| 3 | * Author: Joonyoung Shim <jy0922.shim@samsung.com> | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <linux/module.h> | ||
| 11 | #include <linux/init.h> | ||
| 12 | #include <linux/delay.h> | ||
| 13 | #include <linux/i2c.h> | ||
| 14 | #include <linux/i2c/mms114.h> | ||
| 15 | #include <linux/input/mt.h> | ||
| 16 | #include <linux/interrupt.h> | ||
| 17 | #include <linux/regulator/consumer.h> | ||
| 18 | #include <linux/slab.h> | ||
| 19 | |||
| 20 | /* Write only registers */ | ||
| 21 | #define MMS114_MODE_CONTROL 0x01 | ||
| 22 | #define MMS114_OPERATION_MODE_MASK 0xE | ||
| 23 | #define MMS114_ACTIVE (1 << 1) | ||
| 24 | |||
| 25 | #define MMS114_XY_RESOLUTION_H 0x02 | ||
| 26 | #define MMS114_X_RESOLUTION 0x03 | ||
| 27 | #define MMS114_Y_RESOLUTION 0x04 | ||
| 28 | #define MMS114_CONTACT_THRESHOLD 0x05 | ||
| 29 | #define MMS114_MOVING_THRESHOLD 0x06 | ||
| 30 | |||
| 31 | /* Read only registers */ | ||
| 32 | #define MMS114_PACKET_SIZE 0x0F | ||
| 33 | #define MMS114_INFOMATION 0x10 | ||
| 34 | #define MMS114_TSP_REV 0xF0 | ||
| 35 | |||
| 36 | /* Minimum delay time is 50us between stop and start signal of i2c */ | ||
| 37 | #define MMS114_I2C_DELAY 50 | ||
| 38 | |||
| 39 | /* 200ms needs after power on */ | ||
| 40 | #define MMS114_POWERON_DELAY 200 | ||
| 41 | |||
| 42 | /* Touchscreen absolute values */ | ||
| 43 | #define MMS114_MAX_AREA 0xff | ||
| 44 | |||
| 45 | #define MMS114_MAX_TOUCH 10 | ||
| 46 | #define MMS114_PACKET_NUM 8 | ||
| 47 | |||
| 48 | /* Touch type */ | ||
| 49 | #define MMS114_TYPE_NONE 0 | ||
| 50 | #define MMS114_TYPE_TOUCHSCREEN 1 | ||
| 51 | #define MMS114_TYPE_TOUCHKEY 2 | ||
| 52 | |||
| 53 | struct mms114_data { | ||
| 54 | struct i2c_client *client; | ||
| 55 | struct input_dev *input_dev; | ||
| 56 | struct regulator *core_reg; | ||
| 57 | struct regulator *io_reg; | ||
| 58 | const struct mms114_platform_data *pdata; | ||
| 59 | |||
| 60 | /* Use cache data for mode control register(write only) */ | ||
| 61 | u8 cache_mode_control; | ||
| 62 | }; | ||
| 63 | |||
| 64 | struct mms114_touch { | ||
| 65 | u8 id:4, reserved_bit4:1, type:2, pressed:1; | ||
| 66 | u8 x_hi:4, y_hi:4; | ||
| 67 | u8 x_lo; | ||
| 68 | u8 y_lo; | ||
| 69 | u8 width; | ||
| 70 | u8 strength; | ||
| 71 | u8 reserved[2]; | ||
| 72 | } __packed; | ||
| 73 | |||
| 74 | static int __mms114_read_reg(struct mms114_data *data, unsigned int reg, | ||
| 75 | unsigned int len, u8 *val) | ||
| 76 | { | ||
| 77 | struct i2c_client *client = data->client; | ||
| 78 | struct i2c_msg xfer[2]; | ||
| 79 | u8 buf = reg & 0xff; | ||
| 80 | int error; | ||
| 81 | |||
| 82 | if (reg <= MMS114_MODE_CONTROL && reg + len > MMS114_MODE_CONTROL) | ||
| 83 | BUG(); | ||
| 84 | |||
| 85 | /* Write register: use repeated start */ | ||
| 86 | xfer[0].addr = client->addr; | ||
| 87 | xfer[0].flags = I2C_M_TEN | I2C_M_NOSTART; | ||
| 88 | xfer[0].len = 1; | ||
| 89 | xfer[0].buf = &buf; | ||
| 90 | |||
| 91 | /* Read data */ | ||
| 92 | xfer[1].addr = client->addr; | ||
| 93 | xfer[1].flags = I2C_M_RD; | ||
| 94 | xfer[1].len = len; | ||
| 95 | xfer[1].buf = val; | ||
| 96 | |||
| 97 | error = i2c_transfer(client->adapter, xfer, 2); | ||
| 98 | if (error != 2) { | ||
| 99 | dev_err(&client->dev, | ||
| 100 | "%s: i2c transfer failed (%d)\n", __func__, error); | ||
| 101 | return error < 0 ? error : -EIO; | ||
| 102 | } | ||
| 103 | udelay(MMS114_I2C_DELAY); | ||
| 104 | |||
| 105 | return 0; | ||
| 106 | } | ||
| 107 | |||
| 108 | static int mms114_read_reg(struct mms114_data *data, unsigned int reg) | ||
| 109 | { | ||
| 110 | u8 val; | ||
| 111 | int error; | ||
| 112 | |||
| 113 | if (reg == MMS114_MODE_CONTROL) | ||
| 114 | return data->cache_mode_control; | ||
| 115 | |||
| 116 | error = __mms114_read_reg(data, reg, 1, &val); | ||
| 117 | return error < 0 ? error : val; | ||
| 118 | } | ||
| 119 | |||
| 120 | static int mms114_write_reg(struct mms114_data *data, unsigned int reg, | ||
| 121 | unsigned int val) | ||
| 122 | { | ||
| 123 | struct i2c_client *client = data->client; | ||
| 124 | u8 buf[2]; | ||
| 125 | int error; | ||
| 126 | |||
| 127 | buf[0] = reg & 0xff; | ||
| 128 | buf[1] = val & 0xff; | ||
| 129 | |||
| 130 | error = i2c_master_send(client, buf, 2); | ||
| 131 | if (error != 2) { | ||
| 132 | dev_err(&client->dev, | ||
| 133 | "%s: i2c send failed (%d)\n", __func__, error); | ||
| 134 | return error < 0 ? error : -EIO; | ||
| 135 | } | ||
| 136 | udelay(MMS114_I2C_DELAY); | ||
| 137 | |||
| 138 | if (reg == MMS114_MODE_CONTROL) | ||
| 139 | data->cache_mode_control = val; | ||
| 140 | |||
| 141 | return 0; | ||
| 142 | } | ||
| 143 | |||
| 144 | static void mms114_process_mt(struct mms114_data *data, struct mms114_touch *touch) | ||
| 145 | { | ||
| 146 | const struct mms114_platform_data *pdata = data->pdata; | ||
| 147 | struct i2c_client *client = data->client; | ||
| 148 | struct input_dev *input_dev = data->input_dev; | ||
| 149 | unsigned int id; | ||
| 150 | unsigned int x; | ||
| 151 | unsigned int y; | ||
| 152 | |||
| 153 | if (touch->id > MMS114_MAX_TOUCH) { | ||
| 154 | dev_err(&client->dev, "Wrong touch id (%d)\n", touch->id); | ||
| 155 | return; | ||
| 156 | } | ||
| 157 | |||
| 158 | if (touch->type != MMS114_TYPE_TOUCHSCREEN) { | ||
| 159 | dev_err(&client->dev, "Wrong touch type (%d)\n", touch->type); | ||
| 160 | return; | ||
| 161 | } | ||
| 162 | |||
| 163 | id = touch->id - 1; | ||
| 164 | x = touch->x_lo | touch->x_hi << 8; | ||
| 165 | y = touch->y_lo | touch->y_hi << 8; | ||
| 166 | if (x > pdata->x_size || y > pdata->y_size) { | ||
| 167 | dev_dbg(&client->dev, | ||
| 168 | "Wrong touch coordinates (%d, %d)\n", x, y); | ||
| 169 | return; | ||
| 170 | } | ||
| 171 | |||
| 172 | if (pdata->x_invert) | ||
| 173 | x = pdata->x_size - x; | ||
| 174 | if (pdata->y_invert) | ||
| 175 | y = pdata->y_size - y; | ||
| 176 | |||
| 177 | dev_dbg(&client->dev, | ||
| 178 | "id: %d, type: %d, pressed: %d, x: %d, y: %d, width: %d, strength: %d\n", | ||
| 179 | id, touch->type, touch->pressed, | ||
| 180 | x, y, touch->width, touch->strength); | ||
| 181 | |||
| 182 | input_mt_slot(input_dev, id); | ||
| 183 | input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, touch->pressed); | ||
| 184 | |||
| 185 | if (touch->pressed) { | ||
| 186 | input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, touch->width); | ||
| 187 | input_report_abs(input_dev, ABS_MT_POSITION_X, x); | ||
| 188 | input_report_abs(input_dev, ABS_MT_POSITION_Y, y); | ||
| 189 | input_report_abs(input_dev, ABS_MT_PRESSURE, touch->strength); | ||
| 190 | } | ||
| 191 | } | ||
| 192 | |||
| 193 | static irqreturn_t mms114_interrupt(int irq, void *dev_id) | ||
| 194 | { | ||
| 195 | struct mms114_data *data = dev_id; | ||
| 196 | struct input_dev *input_dev = data->input_dev; | ||
| 197 | struct mms114_touch touch[MMS114_MAX_TOUCH]; | ||
| 198 | int packet_size; | ||
| 199 | int touch_size; | ||
| 200 | int index; | ||
| 201 | int error; | ||
| 202 | |||
| 203 | mutex_lock(&input_dev->mutex); | ||
| 204 | if (!input_dev->users) { | ||
| 205 | mutex_unlock(&input_dev->mutex); | ||
| 206 | goto out; | ||
| 207 | } | ||
| 208 | mutex_unlock(&input_dev->mutex); | ||
| 209 | |||
| 210 | packet_size = mms114_read_reg(data, MMS114_PACKET_SIZE); | ||
| 211 | if (packet_size <= 0) | ||
| 212 | goto out; | ||
| 213 | |||
| 214 | touch_size = packet_size / MMS114_PACKET_NUM; | ||
| 215 | |||
| 216 | error = __mms114_read_reg(data, MMS114_INFOMATION, packet_size, | ||
| 217 | (u8 *)touch); | ||
| 218 | if (error < 0) | ||
| 219 | goto out; | ||
| 220 | |||
| 221 | for (index = 0; index < touch_size; index++) | ||
| 222 | mms114_process_mt(data, touch + index); | ||
| 223 | |||
| 224 | input_mt_report_pointer_emulation(data->input_dev, true); | ||
| 225 | input_sync(data->input_dev); | ||
| 226 | |||
| 227 | out: | ||
| 228 | return IRQ_HANDLED; | ||
| 229 | } | ||
| 230 | |||
| 231 | static int mms114_set_active(struct mms114_data *data, bool active) | ||
| 232 | { | ||
| 233 | int val; | ||
| 234 | |||
| 235 | val = mms114_read_reg(data, MMS114_MODE_CONTROL); | ||
| 236 | if (val < 0) | ||
| 237 | return val; | ||
| 238 | |||
| 239 | val &= ~MMS114_OPERATION_MODE_MASK; | ||
| 240 | |||
| 241 | /* If active is false, sleep mode */ | ||
| 242 | if (active) | ||
| 243 | val |= MMS114_ACTIVE; | ||
| 244 | |||
| 245 | return mms114_write_reg(data, MMS114_MODE_CONTROL, val); | ||
| 246 | } | ||
| 247 | |||
| 248 | static int mms114_get_version(struct mms114_data *data) | ||
| 249 | { | ||
| 250 | struct device *dev = &data->client->dev; | ||
| 251 | u8 buf[6]; | ||
| 252 | int error; | ||
| 253 | |||
| 254 | error = __mms114_read_reg(data, MMS114_TSP_REV, 6, buf); | ||
| 255 | if (error < 0) | ||
| 256 | return error; | ||
| 257 | |||
| 258 | dev_info(dev, "TSP Rev: 0x%x, HW Rev: 0x%x, Firmware Ver: 0x%x\n", | ||
| 259 | buf[0], buf[1], buf[3]); | ||
| 260 | |||
| 261 | return 0; | ||
| 262 | } | ||
| 263 | |||
| 264 | static int mms114_setup_regs(struct mms114_data *data) | ||
| 265 | { | ||
| 266 | const struct mms114_platform_data *pdata = data->pdata; | ||
| 267 | int val; | ||
| 268 | int error; | ||
| 269 | |||
| 270 | error = mms114_get_version(data); | ||
| 271 | if (error < 0) | ||
| 272 | return error; | ||
| 273 | |||
| 274 | error = mms114_set_active(data, true); | ||
| 275 | if (error < 0) | ||
| 276 | return error; | ||
| 277 | |||
| 278 | val = (pdata->x_size >> 8) & 0xf; | ||
| 279 | val |= ((pdata->y_size >> 8) & 0xf) << 4; | ||
| 280 | error = mms114_write_reg(data, MMS114_XY_RESOLUTION_H, val); | ||
| 281 | if (error < 0) | ||
| 282 | return error; | ||
| 283 | |||
| 284 | val = pdata->x_size & 0xff; | ||
| 285 | error = mms114_write_reg(data, MMS114_X_RESOLUTION, val); | ||
| 286 | if (error < 0) | ||
| 287 | return error; | ||
| 288 | |||
| 289 | val = pdata->y_size & 0xff; | ||
| 290 | error = mms114_write_reg(data, MMS114_Y_RESOLUTION, val); | ||
| 291 | if (error < 0) | ||
| 292 | return error; | ||
| 293 | |||
| 294 | if (pdata->contact_threshold) { | ||
| 295 | error = mms114_write_reg(data, MMS114_CONTACT_THRESHOLD, | ||
| 296 | pdata->contact_threshold); | ||
| 297 | if (error < 0) | ||
| 298 | return error; | ||
| 299 | } | ||
| 300 | |||
| 301 | if (pdata->moving_threshold) { | ||
| 302 | error = mms114_write_reg(data, MMS114_MOVING_THRESHOLD, | ||
| 303 | pdata->moving_threshold); | ||
| 304 | if (error < 0) | ||
| 305 | return error; | ||
| 306 | } | ||
| 307 | |||
| 308 | return 0; | ||
| 309 | } | ||
| 310 | |||
| 311 | static int mms114_start(struct mms114_data *data) | ||
| 312 | { | ||
| 313 | struct i2c_client *client = data->client; | ||
| 314 | int error; | ||
| 315 | |||
| 316 | if (data->core_reg) | ||
| 317 | regulator_enable(data->core_reg); | ||
| 318 | if (data->io_reg) | ||
| 319 | regulator_enable(data->io_reg); | ||
| 320 | mdelay(MMS114_POWERON_DELAY); | ||
| 321 | |||
| 322 | error = mms114_setup_regs(data); | ||
| 323 | if (error < 0) | ||
| 324 | return error; | ||
| 325 | |||
| 326 | if (data->pdata->cfg_pin) | ||
| 327 | data->pdata->cfg_pin(true); | ||
| 328 | |||
| 329 | enable_irq(client->irq); | ||
| 330 | |||
| 331 | return 0; | ||
| 332 | } | ||
| 333 | |||
| 334 | static void mms114_stop(struct mms114_data *data) | ||
| 335 | { | ||
| 336 | struct i2c_client *client = data->client; | ||
| 337 | |||
| 338 | disable_irq(client->irq); | ||
| 339 | |||
| 340 | if (data->pdata->cfg_pin) | ||
| 341 | data->pdata->cfg_pin(false); | ||
| 342 | |||
| 343 | if (data->io_reg) | ||
| 344 | regulator_disable(data->io_reg); | ||
| 345 | if (data->core_reg) | ||
| 346 | regulator_disable(data->core_reg); | ||
| 347 | } | ||
| 348 | |||
| 349 | static int mms114_input_open(struct input_dev *dev) | ||
| 350 | { | ||
| 351 | struct mms114_data *data = input_get_drvdata(dev); | ||
| 352 | |||
| 353 | return mms114_start(data); | ||
| 354 | } | ||
| 355 | |||
| 356 | static void mms114_input_close(struct input_dev *dev) | ||
| 357 | { | ||
| 358 | struct mms114_data *data = input_get_drvdata(dev); | ||
| 359 | |||
| 360 | mms114_stop(data); | ||
| 361 | } | ||
| 362 | |||
| 363 | static int __devinit mms114_probe(struct i2c_client *client, | ||
| 364 | const struct i2c_device_id *id) | ||
| 365 | { | ||
| 366 | struct mms114_data *data; | ||
| 367 | struct input_dev *input_dev; | ||
| 368 | int error; | ||
| 369 | |||
| 370 | if (!client->dev.platform_data) { | ||
| 371 | dev_err(&client->dev, "Need platform data\n"); | ||
| 372 | return -EINVAL; | ||
| 373 | } | ||
| 374 | |||
| 375 | if (!i2c_check_functionality(client->adapter, | ||
| 376 | I2C_FUNC_PROTOCOL_MANGLING)) { | ||
| 377 | dev_err(&client->dev, | ||
| 378 | "Need i2c bus that supports protocol mangling\n"); | ||
| 379 | return -ENODEV; | ||
| 380 | } | ||
| 381 | |||
| 382 | data = kzalloc(sizeof(struct mms114_data), GFP_KERNEL); | ||
| 383 | input_dev = input_allocate_device(); | ||
| 384 | if (!data || !input_dev) { | ||
| 385 | dev_err(&client->dev, "Failed to allocate memory\n"); | ||
| 386 | error = -ENOMEM; | ||
| 387 | goto err_free_mem; | ||
| 388 | } | ||
| 389 | |||
| 390 | data->client = client; | ||
| 391 | data->input_dev = input_dev; | ||
| 392 | data->pdata = client->dev.platform_data; | ||
| 393 | |||
| 394 | input_dev->name = "MELPAS MMS114 Touchscreen"; | ||
| 395 | input_dev->id.bustype = BUS_I2C; | ||
| 396 | input_dev->dev.parent = &client->dev; | ||
| 397 | input_dev->open = mms114_input_open; | ||
| 398 | input_dev->close = mms114_input_close; | ||
| 399 | |||
| 400 | __set_bit(EV_ABS, input_dev->evbit); | ||
| 401 | __set_bit(EV_KEY, input_dev->evbit); | ||
| 402 | __set_bit(BTN_TOUCH, input_dev->keybit); | ||
| 403 | input_set_abs_params(input_dev, ABS_X, 0, data->pdata->x_size, 0, 0); | ||
| 404 | input_set_abs_params(input_dev, ABS_Y, 0, data->pdata->y_size, 0, 0); | ||
| 405 | |||
| 406 | /* For multi touch */ | ||
| 407 | input_mt_init_slots(input_dev, MMS114_MAX_TOUCH); | ||
| 408 | input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, | ||
| 409 | 0, MMS114_MAX_AREA, 0, 0); | ||
| 410 | input_set_abs_params(input_dev, ABS_MT_POSITION_X, | ||
| 411 | 0, data->pdata->x_size, 0, 0); | ||
| 412 | input_set_abs_params(input_dev, ABS_MT_POSITION_Y, | ||
| 413 | 0, data->pdata->y_size, 0, 0); | ||
| 414 | input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 255, 0, 0); | ||
| 415 | |||
| 416 | input_set_drvdata(input_dev, data); | ||
| 417 | i2c_set_clientdata(client, data); | ||
| 418 | |||
| 419 | data->core_reg = regulator_get(&client->dev, "avdd"); | ||
| 420 | if (IS_ERR(data->core_reg)) { | ||
| 421 | error = PTR_ERR(data->core_reg); | ||
| 422 | dev_err(&client->dev, | ||
| 423 | "Unable to get the Core regulator (%d)\n", error); | ||
| 424 | goto err_free_mem; | ||
| 425 | } | ||
| 426 | |||
| 427 | data->io_reg = regulator_get(&client->dev, "vdd"); | ||
| 428 | if (IS_ERR(data->io_reg)) { | ||
| 429 | error = PTR_ERR(data->io_reg); | ||
| 430 | dev_err(&client->dev, | ||
| 431 | "Unable to get the IO regulator (%d)\n", error); | ||
| 432 | goto err_core_reg; | ||
| 433 | } | ||
| 434 | |||
| 435 | error = request_threaded_irq(client->irq, NULL, mms114_interrupt, | ||
| 436 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "mms114", data); | ||
| 437 | if (error) { | ||
| 438 | dev_err(&client->dev, "Failed to register interrupt\n"); | ||
| 439 | goto err_io_reg; | ||
| 440 | } | ||
| 441 | disable_irq(client->irq); | ||
| 442 | |||
| 443 | error = input_register_device(data->input_dev); | ||
| 444 | if (error) | ||
| 445 | goto err_free_irq; | ||
| 446 | |||
| 447 | return 0; | ||
| 448 | |||
| 449 | err_free_irq: | ||
| 450 | free_irq(client->irq, data); | ||
| 451 | err_io_reg: | ||
| 452 | regulator_put(data->io_reg); | ||
| 453 | err_core_reg: | ||
| 454 | regulator_put(data->core_reg); | ||
| 455 | err_free_mem: | ||
| 456 | input_free_device(input_dev); | ||
| 457 | kfree(data); | ||
| 458 | return error; | ||
| 459 | } | ||
| 460 | |||
| 461 | static int __devexit mms114_remove(struct i2c_client *client) | ||
| 462 | { | ||
| 463 | struct mms114_data *data = i2c_get_clientdata(client); | ||
| 464 | |||
| 465 | free_irq(client->irq, data); | ||
| 466 | regulator_put(data->io_reg); | ||
| 467 | regulator_put(data->core_reg); | ||
| 468 | input_unregister_device(data->input_dev); | ||
| 469 | kfree(data); | ||
| 470 | |||
| 471 | return 0; | ||
| 472 | } | ||
| 473 | |||
| 474 | #ifdef CONFIG_PM_SLEEP | ||
| 475 | static int mms114_suspend(struct device *dev) | ||
| 476 | { | ||
| 477 | struct i2c_client *client = to_i2c_client(dev); | ||
| 478 | struct mms114_data *data = i2c_get_clientdata(client); | ||
| 479 | struct input_dev *input_dev = data->input_dev; | ||
| 480 | int id; | ||
| 481 | |||
| 482 | /* Release all touch */ | ||
| 483 | for (id = 0; id < MMS114_MAX_TOUCH; id++) { | ||
| 484 | input_mt_slot(input_dev, id); | ||
| 485 | input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, false); | ||
| 486 | } | ||
| 487 | |||
| 488 | input_mt_report_pointer_emulation(input_dev, true); | ||
| 489 | input_sync(input_dev); | ||
| 490 | |||
| 491 | mutex_lock(&input_dev->mutex); | ||
| 492 | if (input_dev->users) | ||
| 493 | mms114_stop(data); | ||
| 494 | mutex_unlock(&input_dev->mutex); | ||
| 495 | |||
| 496 | return 0; | ||
| 497 | } | ||
| 498 | |||
| 499 | static int mms114_resume(struct device *dev) | ||
| 500 | { | ||
| 501 | struct i2c_client *client = to_i2c_client(dev); | ||
| 502 | struct mms114_data *data = i2c_get_clientdata(client); | ||
| 503 | struct input_dev *input_dev = data->input_dev; | ||
| 504 | int error; | ||
| 505 | |||
| 506 | mutex_lock(&input_dev->mutex); | ||
| 507 | if (input_dev->users) { | ||
| 508 | error = mms114_start(data); | ||
| 509 | if (error < 0) { | ||
| 510 | mutex_unlock(&input_dev->mutex); | ||
| 511 | return error; | ||
| 512 | } | ||
| 513 | } | ||
| 514 | mutex_unlock(&input_dev->mutex); | ||
| 515 | |||
| 516 | return 0; | ||
| 517 | } | ||
| 518 | #endif | ||
| 519 | |||
| 520 | static SIMPLE_DEV_PM_OPS(mms114_pm_ops, mms114_suspend, mms114_resume); | ||
| 521 | |||
| 522 | static const struct i2c_device_id mms114_id[] = { | ||
| 523 | { "mms114", 0 }, | ||
| 524 | { } | ||
| 525 | }; | ||
| 526 | MODULE_DEVICE_TABLE(i2c, mms114_id); | ||
| 527 | |||
| 528 | static struct i2c_driver mms114_driver = { | ||
| 529 | .driver = { | ||
| 530 | .name = "mms114", | ||
| 531 | .owner = THIS_MODULE, | ||
| 532 | .pm = &mms114_pm_ops, | ||
| 533 | }, | ||
| 534 | .probe = mms114_probe, | ||
| 535 | .remove = __devexit_p(mms114_remove), | ||
| 536 | .id_table = mms114_id, | ||
| 537 | }; | ||
| 538 | |||
| 539 | module_i2c_driver(mms114_driver); | ||
| 540 | |||
| 541 | /* Module information */ | ||
| 542 | MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>"); | ||
| 543 | MODULE_DESCRIPTION("MELFAS mms114 Touchscreen driver"); | ||
| 544 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 22cd96f58c99..e32709e0dd65 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
| @@ -269,8 +269,9 @@ static int e2i_init(struct usbtouch_usb *usbtouch) | |||
| 269 | 0x01, 0x02, 0x0000, 0x0081, | 269 | 0x01, 0x02, 0x0000, 0x0081, |
| 270 | NULL, 0, USB_CTRL_SET_TIMEOUT); | 270 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
| 271 | 271 | ||
| 272 | dbg("%s - usb_control_msg - E2I_RESET - bytes|err: %d", | 272 | dev_dbg(&usbtouch->interface->dev, |
| 273 | __func__, ret); | 273 | "%s - usb_control_msg - E2I_RESET - bytes|err: %d\n", |
| 274 | __func__, ret); | ||
| 274 | return ret; | 275 | return ret; |
| 275 | } | 276 | } |
| 276 | 277 | ||
| @@ -425,8 +426,9 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) | |||
| 425 | MTOUCHUSB_RESET, | 426 | MTOUCHUSB_RESET, |
| 426 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 427 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 427 | 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); | 428 | 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); |
| 428 | dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d", | 429 | dev_dbg(&usbtouch->interface->dev, |
| 429 | __func__, ret); | 430 | "%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d\n", |
| 431 | __func__, ret); | ||
| 430 | if (ret < 0) | 432 | if (ret < 0) |
| 431 | return ret; | 433 | return ret; |
| 432 | msleep(150); | 434 | msleep(150); |
| @@ -436,8 +438,9 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) | |||
| 436 | MTOUCHUSB_ASYNC_REPORT, | 438 | MTOUCHUSB_ASYNC_REPORT, |
| 437 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 439 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 438 | 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); | 440 | 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); |
| 439 | dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d", | 441 | dev_dbg(&usbtouch->interface->dev, |
| 440 | __func__, ret); | 442 | "%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d\n", |
| 443 | __func__, ret); | ||
| 441 | if (ret >= 0) | 444 | if (ret >= 0) |
| 442 | break; | 445 | break; |
| 443 | if (ret != -EPIPE) | 446 | if (ret != -EPIPE) |
| @@ -737,27 +740,29 @@ static int jastec_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | |||
| 737 | #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC | 740 | #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC |
| 738 | static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) | 741 | static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) |
| 739 | { | 742 | { |
| 743 | struct usb_interface *intf = dev->interface; | ||
| 744 | |||
| 740 | switch (pkt[0]) { | 745 | switch (pkt[0]) { |
| 741 | case 0x3A: /* command response */ | 746 | case 0x3A: /* command response */ |
| 742 | dbg("%s: Command response %d", __func__, pkt[1]); | 747 | dev_dbg(&intf->dev, "%s: Command response %d\n", __func__, pkt[1]); |
| 743 | break; | 748 | break; |
| 744 | 749 | ||
| 745 | case 0xC0: /* down */ | 750 | case 0xC0: /* down */ |
| 746 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); | 751 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); |
| 747 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); | 752 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); |
| 748 | dev->touch = 1; | 753 | dev->touch = 1; |
| 749 | dbg("%s: down %d,%d", __func__, dev->x, dev->y); | 754 | dev_dbg(&intf->dev, "%s: down %d,%d\n", __func__, dev->x, dev->y); |
| 750 | return 1; | 755 | return 1; |
| 751 | 756 | ||
| 752 | case 0x80: /* up */ | 757 | case 0x80: /* up */ |
| 753 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); | 758 | dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); |
| 754 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); | 759 | dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); |
| 755 | dev->touch = 0; | 760 | dev->touch = 0; |
| 756 | dbg("%s: up %d,%d", __func__, dev->x, dev->y); | 761 | dev_dbg(&intf->dev, "%s: up %d,%d\n", __func__, dev->x, dev->y); |
| 757 | return 1; | 762 | return 1; |
| 758 | 763 | ||
| 759 | default: | 764 | default: |
| 760 | dbg("%s: Unknown return %d", __func__, pkt[0]); | 765 | dev_dbg(&intf->dev, "%s: Unknown return %d\n", __func__, pkt[0]); |
| 761 | break; | 766 | break; |
| 762 | } | 767 | } |
| 763 | 768 | ||
| @@ -812,7 +817,8 @@ static int nexio_alloc(struct usbtouch_usb *usbtouch) | |||
| 812 | 817 | ||
| 813 | priv->ack = usb_alloc_urb(0, GFP_KERNEL); | 818 | priv->ack = usb_alloc_urb(0, GFP_KERNEL); |
| 814 | if (!priv->ack) { | 819 | if (!priv->ack) { |
| 815 | dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__); | 820 | dev_dbg(&usbtouch->interface->dev, |
| 821 | "%s - usb_alloc_urb failed: usbtouch->ack\n", __func__); | ||
| 816 | goto err_ack_buf; | 822 | goto err_ack_buf; |
| 817 | } | 823 | } |
| 818 | 824 | ||
| @@ -1349,6 +1355,7 @@ out_flush_buf: | |||
| 1349 | static void usbtouch_irq(struct urb *urb) | 1355 | static void usbtouch_irq(struct urb *urb) |
| 1350 | { | 1356 | { |
| 1351 | struct usbtouch_usb *usbtouch = urb->context; | 1357 | struct usbtouch_usb *usbtouch = urb->context; |
| 1358 | struct device *dev = &usbtouch->interface->dev; | ||
| 1352 | int retval; | 1359 | int retval; |
| 1353 | 1360 | ||
| 1354 | switch (urb->status) { | 1361 | switch (urb->status) { |
| @@ -1357,20 +1364,21 @@ static void usbtouch_irq(struct urb *urb) | |||
| 1357 | break; | 1364 | break; |
| 1358 | case -ETIME: | 1365 | case -ETIME: |
| 1359 | /* this urb is timing out */ | 1366 | /* this urb is timing out */ |
| 1360 | dbg("%s - urb timed out - was the device unplugged?", | 1367 | dev_dbg(dev, |
| 1361 | __func__); | 1368 | "%s - urb timed out - was the device unplugged?\n", |
| 1369 | __func__); | ||
| 1362 | return; | 1370 | return; |
| 1363 | case -ECONNRESET: | 1371 | case -ECONNRESET: |
| 1364 | case -ENOENT: | 1372 | case -ENOENT: |
| 1365 | case -ESHUTDOWN: | 1373 | case -ESHUTDOWN: |
| 1366 | case -EPIPE: | 1374 | case -EPIPE: |
| 1367 | /* this urb is terminated, clean up */ | 1375 | /* this urb is terminated, clean up */ |
| 1368 | dbg("%s - urb shutting down with status: %d", | 1376 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", |
| 1369 | __func__, urb->status); | 1377 | __func__, urb->status); |
| 1370 | return; | 1378 | return; |
| 1371 | default: | 1379 | default: |
| 1372 | dbg("%s - nonzero urb status received: %d", | 1380 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", |
| 1373 | __func__, urb->status); | 1381 | __func__, urb->status); |
| 1374 | goto exit; | 1382 | goto exit; |
| 1375 | } | 1383 | } |
| 1376 | 1384 | ||
| @@ -1380,8 +1388,8 @@ exit: | |||
| 1380 | usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); | 1388 | usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); |
| 1381 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 1389 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
| 1382 | if (retval) | 1390 | if (retval) |
| 1383 | err("%s - usb_submit_urb failed with result: %d", | 1391 | dev_err(dev, "%s - usb_submit_urb failed with result: %d\n", |
| 1384 | __func__, retval); | 1392 | __func__, retval); |
| 1385 | } | 1393 | } |
| 1386 | 1394 | ||
| 1387 | static int usbtouch_open(struct input_dev *input) | 1395 | static int usbtouch_open(struct input_dev *input) |
| @@ -1456,8 +1464,9 @@ static int usbtouch_reset_resume(struct usb_interface *intf) | |||
| 1456 | if (usbtouch->type->init) { | 1464 | if (usbtouch->type->init) { |
| 1457 | err = usbtouch->type->init(usbtouch); | 1465 | err = usbtouch->type->init(usbtouch); |
| 1458 | if (err) { | 1466 | if (err) { |
| 1459 | dbg("%s - type->init() failed, err: %d", | 1467 | dev_dbg(&intf->dev, |
| 1460 | __func__, err); | 1468 | "%s - type->init() failed, err: %d\n", |
| 1469 | __func__, err); | ||
| 1461 | return err; | 1470 | return err; |
| 1462 | } | 1471 | } |
| 1463 | } | 1472 | } |
| @@ -1532,7 +1541,8 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
| 1532 | 1541 | ||
| 1533 | usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); | 1542 | usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); |
| 1534 | if (!usbtouch->irq) { | 1543 | if (!usbtouch->irq) { |
| 1535 | dbg("%s - usb_alloc_urb failed: usbtouch->irq", __func__); | 1544 | dev_dbg(&intf->dev, |
| 1545 | "%s - usb_alloc_urb failed: usbtouch->irq\n", __func__); | ||
| 1536 | goto out_free_buffers; | 1546 | goto out_free_buffers; |
| 1537 | } | 1547 | } |
| 1538 | 1548 | ||
| @@ -1594,7 +1604,9 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
| 1594 | if (type->alloc) { | 1604 | if (type->alloc) { |
| 1595 | err = type->alloc(usbtouch); | 1605 | err = type->alloc(usbtouch); |
| 1596 | if (err) { | 1606 | if (err) { |
| 1597 | dbg("%s - type->alloc() failed, err: %d", __func__, err); | 1607 | dev_dbg(&intf->dev, |
| 1608 | "%s - type->alloc() failed, err: %d\n", | ||
| 1609 | __func__, err); | ||
| 1598 | goto out_free_urb; | 1610 | goto out_free_urb; |
| 1599 | } | 1611 | } |
| 1600 | } | 1612 | } |
| @@ -1603,14 +1615,18 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
| 1603 | if (type->init) { | 1615 | if (type->init) { |
| 1604 | err = type->init(usbtouch); | 1616 | err = type->init(usbtouch); |
| 1605 | if (err) { | 1617 | if (err) { |
| 1606 | dbg("%s - type->init() failed, err: %d", __func__, err); | 1618 | dev_dbg(&intf->dev, |
| 1619 | "%s - type->init() failed, err: %d\n", | ||
| 1620 | __func__, err); | ||
| 1607 | goto out_do_exit; | 1621 | goto out_do_exit; |
| 1608 | } | 1622 | } |
| 1609 | } | 1623 | } |
| 1610 | 1624 | ||
| 1611 | err = input_register_device(usbtouch->input); | 1625 | err = input_register_device(usbtouch->input); |
| 1612 | if (err) { | 1626 | if (err) { |
| 1613 | dbg("%s - input_register_device failed, err: %d", __func__, err); | 1627 | dev_dbg(&intf->dev, |
| 1628 | "%s - input_register_device failed, err: %d\n", | ||
| 1629 | __func__, err); | ||
| 1614 | goto out_do_exit; | 1630 | goto out_do_exit; |
| 1615 | } | 1631 | } |
| 1616 | 1632 | ||
| @@ -1622,8 +1638,9 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
| 1622 | err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); | 1638 | err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); |
| 1623 | if (err) { | 1639 | if (err) { |
| 1624 | usb_autopm_put_interface(intf); | 1640 | usb_autopm_put_interface(intf); |
| 1625 | err("%s - usb_submit_urb failed with result: %d", | 1641 | dev_err(&intf->dev, |
| 1626 | __func__, err); | 1642 | "%s - usb_submit_urb failed with result: %d\n", |
| 1643 | __func__, err); | ||
| 1627 | goto out_unregister_input; | 1644 | goto out_unregister_input; |
| 1628 | } | 1645 | } |
| 1629 | } | 1646 | } |
| @@ -1650,12 +1667,12 @@ static void usbtouch_disconnect(struct usb_interface *intf) | |||
| 1650 | { | 1667 | { |
| 1651 | struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); | 1668 | struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); |
| 1652 | 1669 | ||
| 1653 | dbg("%s - called", __func__); | ||
| 1654 | |||
| 1655 | if (!usbtouch) | 1670 | if (!usbtouch) |
| 1656 | return; | 1671 | return; |
| 1657 | 1672 | ||
| 1658 | dbg("%s - usbtouch is initialized, cleaning up", __func__); | 1673 | dev_dbg(&intf->dev, |
| 1674 | "%s - usbtouch is initialized, cleaning up\n", __func__); | ||
| 1675 | |||
| 1659 | usb_set_intfdata(intf, NULL); | 1676 | usb_set_intfdata(intf, NULL); |
| 1660 | /* this will stop IO via close */ | 1677 | /* this will stop IO via close */ |
| 1661 | input_unregister_device(usbtouch->input); | 1678 | input_unregister_device(usbtouch->input); |
diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index 35572575d34a..0c01657132fd 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c | |||
| @@ -149,7 +149,7 @@ static int __devinit wacom_i2c_probe(struct i2c_client *client, | |||
| 149 | { | 149 | { |
| 150 | struct wacom_i2c *wac_i2c; | 150 | struct wacom_i2c *wac_i2c; |
| 151 | struct input_dev *input; | 151 | struct input_dev *input; |
| 152 | struct wacom_features features; | 152 | struct wacom_features features = { 0 }; |
| 153 | int error; | 153 | int error; |
| 154 | 154 | ||
| 155 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { | 155 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { |
diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c index 4bc851a9dc3d..e83410721e38 100644 --- a/drivers/input/touchscreen/wm831x-ts.c +++ b/drivers/input/touchscreen/wm831x-ts.c | |||
| @@ -260,15 +260,16 @@ static __devinit int wm831x_ts_probe(struct platform_device *pdev) | |||
| 260 | * If we have a direct IRQ use it, otherwise use the interrupt | 260 | * If we have a direct IRQ use it, otherwise use the interrupt |
| 261 | * from the WM831x IRQ controller. | 261 | * from the WM831x IRQ controller. |
| 262 | */ | 262 | */ |
| 263 | wm831x_ts->data_irq = wm831x_irq(wm831x, | ||
| 264 | platform_get_irq_byname(pdev, | ||
| 265 | "TCHDATA")); | ||
| 263 | if (pdata && pdata->data_irq) | 266 | if (pdata && pdata->data_irq) |
| 264 | wm831x_ts->data_irq = pdata->data_irq; | 267 | wm831x_ts->data_irq = pdata->data_irq; |
| 265 | else | ||
| 266 | wm831x_ts->data_irq = platform_get_irq_byname(pdev, "TCHDATA"); | ||
| 267 | 268 | ||
| 269 | wm831x_ts->pd_irq = wm831x_irq(wm831x, | ||
| 270 | platform_get_irq_byname(pdev, "TCHPD")); | ||
| 268 | if (pdata && pdata->pd_irq) | 271 | if (pdata && pdata->pd_irq) |
| 269 | wm831x_ts->pd_irq = pdata->pd_irq; | 272 | wm831x_ts->pd_irq = pdata->pd_irq; |
| 270 | else | ||
| 271 | wm831x_ts->pd_irq = platform_get_irq_byname(pdev, "TCHPD"); | ||
| 272 | 273 | ||
| 273 | if (pdata) | 274 | if (pdata) |
| 274 | wm831x_ts->pressure = pdata->pressure; | 275 | wm831x_ts->pressure = pdata->pressure; |
