From 1fc4ec3791729db4e2602e9afb1045aef1bc3a58 Mon Sep 17 00:00:00 2001 From: Nicolas Ferre Date: Thu, 15 Mar 2012 16:02:02 +0100 Subject: Input: Kconfig: remove dependency for atmel_tsadcc driver This will allow to select this driver for newer SoCs. Keep dependency on AT91 because of the use of an header file located in include/mach directory. Signed-off-by: Nicolas Ferre Acked-by: Dmitry Torokhov --- drivers/input/touchscreen/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 2a2141915aa0..75838d7710ce 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -489,10 +489,10 @@ config TOUCHSCREEN_TI_TSCADC config TOUCHSCREEN_ATMEL_TSADCC tristate "Atmel Touchscreen Interface" - depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 + depends on ARCH_AT91 help Say Y here if you have a 4-wire touchscreen connected to the - ADC Controller on your Atmel SoC (such as the AT91SAM9RL). + ADC Controller on your Atmel SoC. If unsure, say N. -- cgit v1.2.3 From 7b22a8855a727c5d8265508cbba05437a68f7043 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:34:49 -0700 Subject: USB: iforce: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. Cc: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/iforce/iforce-main.c | 3 ++- drivers/input/joystick/iforce/iforce-packets.c | 10 +++++++--- drivers/input/joystick/iforce/iforce-usb.c | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) (limited to 'drivers/input') 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) break; if (i == 20) { /* 5 seconds */ - err("Timeout waiting for response from device."); + dev_err(&input_dev->dev, + "Timeout waiting for response from device.\n"); error = -ENODEV; goto fail; } diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c index a17b50016009..137326a5c2aa 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) status = usb_submit_urb(iforce->ctrl, GFP_ATOMIC); if (status) { - err("usb_submit_urb failed %d", status); + dev_err(&iforce->usbdev->dev, + "usb_submit_urb failed %d\n", status); return -1; } @@ -289,12 +290,15 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) return -1; } #else - err("iforce_get_id_packet: iforce->bus = SERIO!"); + dev_err(&iforce->dev->dev, + "iforce_get_id_packet: iforce->bus = SERIO!\n"); #endif break; default: - err("iforce_get_id_packet: iforce->bus = %d", iforce->bus); + dev_err(&iforce->dev->dev, + "iforce_get_id_packet: iforce->bus = %d\n", + iforce->bus); break; } diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 6c96631ae5d9..ecbfae7d7539 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c @@ -100,8 +100,9 @@ static void iforce_usb_irq(struct urb *urb) exit: status = usb_submit_urb (urb, GFP_ATOMIC); if (status) - err ("%s - usb_submit_urb failed with result %d", - __func__, status); + dev_err(&iforce->usbdev->dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, status); } static void iforce_usb_out(struct urb *urb) -- cgit v1.2.3 From 9cb757bfac332cb43122c494597dce80e5424820 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:23 -0700 Subject: USB: xpad.c: remove err() usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov CC: "Magnus Hörlin" CC: Rusty Russell CC: Mauro Carvalho Chehab CC: Chris Moeller Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/xpad.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index fd7a0d5bc94d..bee9c00032ee 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -492,8 +492,9 @@ static void xpad_irq_in(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - err ("%s - usb_submit_urb failed with result %d", - __func__, retval); + dev_err(&xpad->udev->dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, retval); } static void xpad_bulk_out(struct urb *urb) @@ -516,6 +517,7 @@ static void xpad_bulk_out(struct urb *urb) #if defined(CONFIG_JOYSTICK_XPAD_FF) || defined(CONFIG_JOYSTICK_XPAD_LEDS) static void xpad_irq_out(struct urb *urb) { + struct usb_xpad *xpad = urb->context; int retval, status; status = urb->status; @@ -540,8 +542,9 @@ static void xpad_irq_out(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - err("%s - usb_submit_urb failed with result %d", - __func__, retval); + dev_err(&xpad->udev->dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, retval); } static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) -- cgit v1.2.3 From 3f37d8e8e18f4ec7a1bb96ea95910e51e5775d5b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:25 -0700 Subject: USB: cm109.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov CC: Axel Lin Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/cm109.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c index ab860511f016..412fe5719cb6 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) error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); if (error) - err("%s: usb_submit_urb (urb_ctl) failed %d", __func__, error); + dev_err(&dev->intf->dev, + "%s: usb_submit_urb (urb_ctl) failed %d\n", + __func__, error); } /* @@ -349,7 +351,7 @@ static void cm109_urb_irq_callback(struct urb *urb) if (status) { if (status == -ESHUTDOWN) return; - err("%s: urb status %d", __func__, status); + dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); } /* Special keys */ @@ -396,7 +398,8 @@ static void cm109_urb_irq_callback(struct urb *urb) error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); if (error) - err("%s: usb_submit_urb (urb_ctl) failed %d", + dev_err(&dev->intf->dev, + "%s: usb_submit_urb (urb_ctl) failed %d\n", __func__, error); } @@ -416,7 +419,7 @@ static void cm109_urb_ctl_callback(struct urb *urb) dev->ctl_data->byte[3]); if (status) - err("%s: urb status %d", __func__, status); + dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); spin_lock(&dev->ctl_submit_lock); @@ -433,7 +436,8 @@ static void cm109_urb_ctl_callback(struct urb *urb) dev->irq_urb_pending = 1; error = usb_submit_urb(dev->urb_irq, GFP_ATOMIC); if (error) - err("%s: usb_submit_urb (urb_irq) failed %d", + dev_err(&dev->intf->dev, + "%s: usb_submit_urb (urb_irq) failed %d\n", __func__, error); } } @@ -476,7 +480,8 @@ static void cm109_toggle_buzzer_sync(struct cm109_dev *dev, int on) dev->ctl_data, USB_PKT_LEN, USB_CTRL_SET_TIMEOUT); if (error < 0 && error != -EINTR) - err("%s: usb_control_msg() failed %d", __func__, error); + dev_err(&dev->intf->dev, "%s: usb_control_msg() failed %d\n", + __func__, error); } static void cm109_stop_traffic(struct cm109_dev *dev) @@ -518,8 +523,8 @@ static int cm109_input_open(struct input_dev *idev) error = usb_autopm_get_interface(dev->intf); if (error < 0) { - err("%s - cannot autoresume, result %d", - __func__, error); + dev_err(&idev->dev, "%s - cannot autoresume, result %d\n", + __func__, error); return error; } @@ -537,7 +542,8 @@ static int cm109_input_open(struct input_dev *idev) error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL); if (error) - err("%s: usb_submit_urb (urb_ctl) failed %d", __func__, error); + dev_err(&idev->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n", + __func__, error); else dev->open = 1; @@ -710,7 +716,8 @@ static int cm109_usb_probe(struct usb_interface *intf, pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); if (ret != USB_PKT_LEN) - err("invalid payload size %d, expected %d", ret, USB_PKT_LEN); + dev_err(&intf->dev, "invalid payload size %d, expected %d\n", + ret, USB_PKT_LEN); /* initialise irq urb */ usb_fill_int_urb(dev->urb_irq, udev, pipe, dev->irq_data, -- cgit v1.2.3 From 4efeca581bc84105c2e82d28a3a29e6cd9784204 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:28 -0700 Subject: USB: keyspan_remote.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/keyspan_remote.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c index d99151a8bf10..9a45c88bc65f 100644 --- a/drivers/input/misc/keyspan_remote.c +++ b/drivers/input/misc/keyspan_remote.c @@ -267,7 +267,9 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - err("%s - Unknown sequence found in system data.\n", __func__); + dev_err(&remote->udev->dev, + "%s - Unknown sequence found in system data.\n", + __func__); remote->stage = 0; return; } @@ -286,7 +288,9 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - err("%s - Unknown sequence found in button data.\n", __func__); + dev_err(&remote->udev->dev, + "%s - Unknown sequence found in button data.\n", + __func__); remote->stage = 0; return; } @@ -302,7 +306,9 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - err("%s - Error in message, invalid toggle.\n", __func__); + dev_err(&remote->udev->dev, + "%s - Error in message, invalid toggle.\n", + __func__); remote->stage = 0; return; } @@ -312,7 +318,8 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 5; remote->data.bits_left -= 5; } else { - err("Bad message received, no stop bit found.\n"); + dev_err(&remote->udev->dev, + "Bad message received, no stop bit found.\n"); } dev_dbg(&remote->udev->dev, @@ -397,7 +404,9 @@ static void keyspan_irq_recv(struct urb *urb) resubmit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - err ("%s - usb_submit_urb failed with result: %d", __func__, retval); + dev_err(&dev->udev->dev, + "%s - usb_submit_urb failed with result: %d\n", + __func__, retval); } static int keyspan_open(struct input_dev *dev) -- cgit v1.2.3 From 2385f3c3c757b6ffb766c320df4a7f7a45593f24 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:30 -0700 Subject: USB: powermate.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/powermate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c index 538f7049ec64..71ec621fbefa 100644 --- a/drivers/input/misc/powermate.c +++ b/drivers/input/misc/powermate.c @@ -110,8 +110,9 @@ static void powermate_irq(struct urb *urb) exit: retval = usb_submit_urb (urb, GFP_ATOMIC); if (retval) - err ("%s - usb_submit_urb failed with result %d", - __func__, retval); + dev_err(&pm->udev->dev, + "%s - usb_submit_urb failed with result: %d\n", + __func__, retval); } /* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */ -- cgit v1.2.3 From 08813d35d2ac6f304a53eb3a9ee59283fa7cc67f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:31 -0700 Subject: USB: yealink.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Henk Vergonet CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/yealink.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c index f4776e7f8c15..4984823b3681 100644 --- a/drivers/input/misc/yealink.c +++ b/drivers/input/misc/yealink.c @@ -428,7 +428,8 @@ static void urb_irq_callback(struct urb *urb) int ret, status = urb->status; if (status) - err("%s - urb status %d", __func__, status); + dev_err(&yld->udev->dev, "%s - urb status %d\n", + __func__, status); switch (yld->irq_data->cmd) { case CMD_KEYPRESS: @@ -443,7 +444,8 @@ static void urb_irq_callback(struct urb *urb) break; default: - err("unexpected response %x", yld->irq_data->cmd); + dev_err(&yld->udev->dev, "unexpected response %x\n", + yld->irq_data->cmd); } yealink_do_idle_tasks(yld); @@ -451,7 +453,9 @@ static void urb_irq_callback(struct urb *urb) if (!yld->shutdown) { ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); if (ret && ret != -EPERM) - err("%s - usb_submit_urb failed %d", __func__, ret); + dev_err(&yld->udev->dev, + "%s - usb_submit_urb failed %d\n", + __func__, ret); } } @@ -461,7 +465,8 @@ static void urb_ctl_callback(struct urb *urb) int ret = 0, status = urb->status; if (status) - err("%s - urb status %d", __func__, status); + dev_err(&yld->udev->dev, "%s - urb status %d\n", + __func__, status); switch (yld->ctl_data->cmd) { case CMD_KEYPRESS: @@ -479,7 +484,8 @@ static void urb_ctl_callback(struct urb *urb) } if (ret && ret != -EPERM) - err("%s - usb_submit_urb failed %d", __func__, ret); + dev_err(&yld->udev->dev, "%s - usb_submit_urb failed %d\n", + __func__, ret); } /******************************************************************************* @@ -909,7 +915,8 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); if (ret != USB_PKT_LEN) - err("invalid payload size %d, expected %zd", ret, USB_PKT_LEN); + dev_err(&intf->dev, "invalid payload size %d, expected %zd\n", + ret, USB_PKT_LEN); /* initialise irq urb */ usb_fill_int_urb(yld->urb_irq, udev, pipe, yld->irq_data, -- cgit v1.2.3 From 9c113dc67ab712e1bb82e974e51c49a678562713 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:31 -0700 Subject: USB: appletouch.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Alessandro Rubini CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/appletouch.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index 0acbc7d50d05..90db679b44af 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c @@ -262,7 +262,7 @@ static int atp_geyser_init(struct usb_device *udev) data = kmalloc(8, GFP_KERNEL); if (!data) { - err("Out of memory"); + dev_err(&udev->dev, "Out of memory\n"); return -ENOMEM; } @@ -277,7 +277,7 @@ static int atp_geyser_init(struct usb_device *udev) for (i = 0; i < 8; i++) dprintk("appletouch[%d]: %d\n", i, data[i]); - err("Failed to read mode from device."); + dev_err(&udev->dev, "Failed to read mode from device.\n"); ret = -EIO; goto out_free; } @@ -296,7 +296,7 @@ static int atp_geyser_init(struct usb_device *udev) for (i = 0; i < 8; i++) dprintk("appletouch[%d]: %d\n", i, data[i]); - err("Failed to request geyser raw mode"); + dev_err(&udev->dev, "Failed to request geyser raw mode\n"); ret = -EIO; goto out_free; } @@ -321,8 +321,9 @@ static void atp_reinit(struct work_struct *work) retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - err("atp_reinit: usb_submit_urb failed with error %d", - retval); + dev_err(&udev->dev, + "atp_reinit: usb_submit_urb failed with error %d\n", + retval); } static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, @@ -588,8 +589,9 @@ static void atp_complete_geyser_1_2(struct urb *urb) exit: retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - err("atp_complete: usb_submit_urb failed with result %d", - retval); + dev_err(&dev->udev->dev, + "atp_complete: usb_submit_urb failed with result %d\n", + retval); } /* Interrupt function for older touchpads: GEYSER3/GEYSER4 */ @@ -722,8 +724,9 @@ static void atp_complete_geyser_3_4(struct urb *urb) exit: retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - err("atp_complete: usb_submit_urb failed with result %d", - retval); + dev_err(&dev->udev->dev, + "atp_complete: usb_submit_urb failed with result %d\n", + retval); } static int atp_open(struct input_dev *input) @@ -785,7 +788,7 @@ static int atp_probe(struct usb_interface *iface, } } if (!int_in_endpointAddr) { - err("Could not find int-in endpoint"); + dev_err(&iface->dev, "Could not find int-in endpoint\n"); return -EIO; } @@ -793,7 +796,7 @@ static int atp_probe(struct usb_interface *iface, dev = kzalloc(sizeof(struct atp), GFP_KERNEL); input_dev = input_allocate_device(); if (!dev || !input_dev) { - err("Out of memory"); + dev_err(&iface->dev, "Out of memory\n"); goto err_free_devs; } -- cgit v1.2.3 From 6c1d1b246199c75486f5ffa677cf0e411ce4ac6e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:31 -0700 Subject: USB: bcm5974.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Henrik Rydberg CC: Alessandro Rubini CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/bcm5974.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index f9e2758b9f46..8cd7c932c202 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c @@ -584,7 +584,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) int retval = 0, size; if (!data) { - err("bcm5974: out of memory"); + dev_err(&dev->intf->dev, "out of memory\n"); retval = -ENOMEM; goto out; } @@ -597,7 +597,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); if (size != 8) { - err("bcm5974: could not read from device"); + dev_err(&dev->intf->dev, "could not read from device\n"); retval = -EIO; goto out; } @@ -615,7 +615,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); if (size != 8) { - err("bcm5974: could not write to device"); + dev_err(&dev->intf->dev, "could not write to device\n"); retval = -EIO; goto out; } @@ -654,7 +654,7 @@ static void bcm5974_irq_button(struct urb *urb) exit: error = usb_submit_urb(dev->bt_urb, GFP_ATOMIC); if (error) - err("bcm5974: button urb failed: %d", error); + dev_err(&dev->intf->dev, "button urb failed: %d\n", error); } static void bcm5974_irq_trackpad(struct urb *urb) @@ -687,7 +687,7 @@ static void bcm5974_irq_trackpad(struct urb *urb) exit: error = usb_submit_urb(dev->tp_urb, GFP_ATOMIC); if (error) - err("bcm5974: trackpad urb failed: %d", error); + dev_err(&dev->intf->dev, "trackpad urb failed: %d\n", error); } /* @@ -833,7 +833,7 @@ static int bcm5974_probe(struct usb_interface *iface, dev = kzalloc(sizeof(struct bcm5974), GFP_KERNEL); input_dev = input_allocate_device(); if (!dev || !input_dev) { - err("bcm5974: out of memory"); + dev_err(&iface->dev, "out of memory\n"); goto err_free_devs; } -- cgit v1.2.3 From b59c82bd6f9d60dd09dd2c696fb1894802ae3e33 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:34 -0700 Subject: USB: acecad.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/acecad.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c index f8b0b1df9138..da6c34106190 100644 --- a/drivers/input/tablet/acecad.c +++ b/drivers/input/tablet/acecad.c @@ -105,8 +105,10 @@ static void usb_acecad_irq(struct urb *urb) resubmit: status = usb_submit_urb(urb, GFP_ATOMIC); if (status) - err("can't resubmit intr, %s-%s/input0, status %d", - acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); + dev_err(&acecad->usbdev->dev, + "can't resubmit intr, %s-%s/input0, status %d\n", + acecad->usbdev->bus->bus_name, + acecad->usbdev->devpath, status); } static int usb_acecad_open(struct input_dev *dev) -- cgit v1.2.3 From 1f80bb943d755d48b894c677097fd80c7d7cce16 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:36 -0700 Subject: USB: aiptek.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov CC: Jesper Juhl CC: JJ Ding CC: Edwin van Vliet Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/aiptek.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index 205d16aab441..b8d43eb3c8f1 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c @@ -811,8 +811,9 @@ static void aiptek_irq(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval != 0) { - err("%s - usb_submit_urb failed with result %d", - __func__, retval); + dev_err(&aiptek->usbdev->dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, retval); } } -- cgit v1.2.3 From 3bd9597a6b8d5111c698a38761c4e2883cdcf8c9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:39 -0700 Subject: USB: gtco.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/gtco.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 89a297801dce..fed555bf9ff7 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c @@ -2,8 +2,6 @@ GTCO digitizer USB driver -Use the err() and dbg() macros from usb.h for system logging - TO CHECK: Is pressure done right on report 5? Copyright (C) 2006 GTCO CalComp @@ -808,7 +806,8 @@ static void gtco_urb_callback(struct urb *urbinfo) resubmit: rc = usb_submit_urb(urbinfo, GFP_ATOMIC); if (rc != 0) - err("usb_submit_urb failed rc=0x%x", rc); + dev_err(&device->usbdev->dev, + "usb_submit_urb failed rc=0x%x\n", rc); } /* @@ -838,7 +837,7 @@ static int gtco_probe(struct usb_interface *usbinterface, gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL); input_dev = input_allocate_device(); if (!gtco || !input_dev) { - err("No more memory"); + dev_err(&usbinterface->dev, "No more memory\n"); error = -ENOMEM; goto err_free_devs; } @@ -853,7 +852,7 @@ static int gtco_probe(struct usb_interface *usbinterface, gtco->buffer = usb_alloc_coherent(gtco->usbdev, REPORT_MAX_SIZE, GFP_KERNEL, >co->buf_dma); if (!gtco->buffer) { - err("No more memory for us buffers"); + dev_err(&usbinterface->dev, "No more memory for us buffers\n"); error = -ENOMEM; goto err_free_devs; } @@ -861,7 +860,7 @@ static int gtco_probe(struct usb_interface *usbinterface, /* Allocate URB for reports */ gtco->urbinfo = usb_alloc_urb(0, GFP_KERNEL); if (!gtco->urbinfo) { - err("Failed to allocate URB"); + dev_err(&usbinterface->dev, "Failed to allocate URB\n"); error = -ENOMEM; goto err_free_buf; } @@ -888,7 +887,8 @@ static int gtco_probe(struct usb_interface *usbinterface, */ if (usb_get_extra_descriptor(usbinterface->cur_altsetting, HID_DEVICE_TYPE, &hid_desc) != 0){ - err("Can't retrieve exta USB descriptor to get hid report descriptor length"); + dev_err(&usbinterface->dev, + "Can't retrieve exta USB descriptor to get hid report descriptor length\n"); error = -EIO; goto err_free_urb; } @@ -898,7 +898,7 @@ static int gtco_probe(struct usb_interface *usbinterface, report = kzalloc(le16_to_cpu(hid_desc->wDescriptorLength), GFP_KERNEL); if (!report) { - err("No more memory for report"); + dev_err(&usbinterface->dev, "No more memory for report\n"); error = -ENOMEM; goto err_free_urb; } @@ -926,8 +926,9 @@ static int gtco_probe(struct usb_interface *usbinterface, /* If we didn't get the report, fail */ if (result != le16_to_cpu(hid_desc->wDescriptorLength)) { - err("Failed to get HID Report Descriptor of size: %d", - hid_desc->wDescriptorLength); + dev_err(&usbinterface->dev, + "Failed to get HID Report Descriptor of size: %d\n", + hid_desc->wDescriptorLength); error = -EIO; goto err_free_urb; } -- cgit v1.2.3 From 202712c2322a1b87f3359046f5ebe92e0384ff6d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:41 -0700 Subject: USB: kbtab.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/kbtab.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c index 85a5b40333ac..1eb6341f81c5 100644 --- a/drivers/input/tablet/kbtab.c +++ b/drivers/input/tablet/kbtab.c @@ -80,8 +80,9 @@ static void kbtab_irq(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - err("%s - usb_submit_urb failed with result %d", - __func__, retval); + dev_err(&kbtab->usbdev->dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, retval); } static struct usb_device_id kbtab_ids[] = { -- cgit v1.2.3 From b3169fecb10594ac1182de904d367631a4dbdf1c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:44 -0700 Subject: USB: wacom_sys.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov CC: Ping Cheng CC: Chris Bagwell CC: Eduard Hasenleithner CC: Jason Gerecke Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/wacom_sys.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 0d269212931e..3db4684a0b77 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -122,8 +122,9 @@ static void wacom_sys_irq(struct urb *urb) usb_mark_last_busy(wacom->usbdev); retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - err ("%s - usb_submit_urb failed with result %d", - __func__, retval); + dev_err(&wacom->intf->dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, retval); } static int wacom_open(struct input_dev *dev) -- cgit v1.2.3 From e27ad0fe9cca5e6c98c3af6d7021690b6960adf8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 25 Apr 2012 14:48:46 -0700 Subject: USB: usbtouchscreen.c: remove err() usage err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov CC: Henrik Rydberg CC: Rusty Russell CC: Viresh Kumar CC: Armando Visconti Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/usbtouchscreen.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 22cd96f58c99..955441cb030d 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -1380,8 +1380,9 @@ exit: usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - err("%s - usb_submit_urb failed with result: %d", - __func__, retval); + dev_err(&usbtouch->interface->dev, + "%s - usb_submit_urb failed with result: %d\n", + __func__, retval); } static int usbtouch_open(struct input_dev *input) @@ -1622,8 +1623,9 @@ static int usbtouch_probe(struct usb_interface *intf, err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); if (err) { usb_autopm_put_interface(intf); - err("%s - usb_submit_urb failed with result: %d", - __func__, err); + dev_err(&intf->dev, + "%s - usb_submit_urb failed with result: %d\n", + __func__, err); goto out_unregister_input; } } -- cgit v1.2.3 From 6ce34a5fb4955fac1eebe080e1c2784bc8710449 Mon Sep 17 00:00:00 2001 From: Chao Xie Date: Sun, 1 Apr 2012 10:08:01 +0800 Subject: Input: pxa27x_keypad keep clock on as wakeup source When the keypad is used as wake up source, the clock can not be disabled. Or it can not detect key pressing. If the keypad is used as wake up source, when resume back, do not enable the clock and configure it again because the register content is retained. Signed-off-by: Chao Xie Signed-off-by: Haojian Zhuang --- drivers/input/keyboard/pxa27x_keypad.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 29fe1b2be1c1..b07771e83063 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c @@ -399,7 +399,7 @@ static int pxa27x_keypad_open(struct input_dev *dev) struct pxa27x_keypad *keypad = input_get_drvdata(dev); /* Enable unit clock */ - clk_enable(keypad->clk); + clk_prepare_enable(keypad->clk); pxa27x_keypad_config(keypad); return 0; @@ -410,7 +410,7 @@ static void pxa27x_keypad_close(struct input_dev *dev) struct pxa27x_keypad *keypad = input_get_drvdata(dev); /* Disable clock unit */ - clk_disable(keypad->clk); + clk_disable_unprepare(keypad->clk); } #ifdef CONFIG_PM @@ -419,10 +419,14 @@ static int pxa27x_keypad_suspend(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); - clk_disable(keypad->clk); - + /* + * If the keypad is used a wake up source, clock can not be disabled. + * Or it can not detect the key pressing. + */ if (device_may_wakeup(&pdev->dev)) enable_irq_wake(keypad->irq); + else + clk_disable_unprepare(keypad->clk); return 0; } @@ -433,19 +437,24 @@ static int pxa27x_keypad_resume(struct device *dev) struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); struct input_dev *input_dev = keypad->input_dev; - if (device_may_wakeup(&pdev->dev)) + /* + * If the keypad is used as wake up source, the clock is not turned + * off. So do not need configure it again. + */ + if (device_may_wakeup(&pdev->dev)) { disable_irq_wake(keypad->irq); + } else { + mutex_lock(&input_dev->mutex); - mutex_lock(&input_dev->mutex); + if (input_dev->users) { + /* Enable unit clock */ + clk_prepare_enable(keypad->clk); + pxa27x_keypad_config(keypad); + } - if (input_dev->users) { - /* Enable unit clock */ - clk_enable(keypad->clk); - pxa27x_keypad_config(keypad); + mutex_unlock(&input_dev->mutex); } - mutex_unlock(&input_dev->mutex); - return 0; } -- cgit v1.2.3 From 5545fa897a0a1a34249e98ea4244b256cbe58df3 Mon Sep 17 00:00:00 2001 From: Chao Xie Date: Sun, 1 Apr 2012 10:08:02 +0800 Subject: Input: pxa27x_keypad bug fix for direct_key_mask When direcct_key_num is 0, the mask should be 0. When direcct_key_num is 1, the mask should be 0b1. Signed-off-by: Chao Xie Signed-off-by: Haojian Zhuang --- drivers/input/keyboard/pxa27x_keypad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index b07771e83063..5d717202aad8 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c @@ -383,7 +383,7 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad) if (pdata->direct_key_num > direct_key_num) direct_key_num = pdata->direct_key_num; - keypad->direct_key_mask = ((2 << direct_key_num) - 1) & ~mask; + keypad->direct_key_mask = ((1 << direct_key_num) - 1) & ~mask; /* enable direct key */ if (direct_key_num) -- cgit v1.2.3 From ee1d8040a6b0a8106c7d9e80b9193077224493ba Mon Sep 17 00:00:00 2001 From: Chao Xie Date: Sun, 1 Apr 2012 10:08:03 +0800 Subject: Input: pxa27x_keypad direct key may be low active KPDK_DK only indicates the pin level of direct key. So it is related to board, and low level may be active which indicates that a key is pressed. Signed-off-by: Chao Xie Signed-off-by: Haojian Zhuang --- arch/arm/plat-pxa/include/plat/pxa27x_keypad.h | 2 ++ drivers/input/keyboard/pxa27x_keypad.c | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/arch/arm/plat-pxa/include/plat/pxa27x_keypad.h b/arch/arm/plat-pxa/include/plat/pxa27x_keypad.h index abcc36eb1242..7ffb16b80639 100644 --- a/arch/arm/plat-pxa/include/plat/pxa27x_keypad.h +++ b/arch/arm/plat-pxa/include/plat/pxa27x_keypad.h @@ -44,6 +44,8 @@ struct pxa27x_keypad_platform_data { /* direct keys */ int direct_key_num; unsigned int direct_key_map[MAX_DIRECT_KEY_NUM]; + /* the key output may be low active */ + int direct_key_low_active; /* rotary encoders 0 */ int enable_rotary0; diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index 5d717202aad8..a60f14e7983e 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) if (pdata->enable_rotary0 || pdata->enable_rotary1) pxa27x_keypad_scan_rotary(keypad); - new_state = KPDK_DK(kpdk) & keypad->direct_key_mask; + /* + * The KPDR_DK only output the key pin level, so it relates to board, + * and low level may be active. + */ + if (pdata->direct_key_low_active) + new_state = ~KPDK_DK(kpdk) & keypad->direct_key_mask; + else + new_state = KPDK_DK(kpdk) & keypad->direct_key_mask; + bits_changed = keypad->direct_key_state ^ new_state; if (bits_changed == 0) -- cgit v1.2.3 From fb054bf26914ee4c55cf149bc5b2a8e2c89fb81f Mon Sep 17 00:00:00 2001 From: Chao Xie Date: Sun, 1 Apr 2012 10:08:04 +0800 Subject: Input: pxa27x_keypad add choice to set direct_key_mask Direct keys usage may not start from KP_DKIN0, add a msk option to configure the specifics for platforms that can skip some keys. Signed-off-by: Chao Xie Signed-off-by: Haojian Zhuang --- arch/arm/plat-pxa/include/plat/pxa27x_keypad.h | 2 ++ drivers/input/keyboard/pxa27x_keypad.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/arch/arm/plat-pxa/include/plat/pxa27x_keypad.h b/arch/arm/plat-pxa/include/plat/pxa27x_keypad.h index 7ffb16b80639..5ce8d5e6ea51 100644 --- a/arch/arm/plat-pxa/include/plat/pxa27x_keypad.h +++ b/arch/arm/plat-pxa/include/plat/pxa27x_keypad.h @@ -46,6 +46,8 @@ struct pxa27x_keypad_platform_data { unsigned int direct_key_map[MAX_DIRECT_KEY_NUM]; /* the key output may be low active */ int direct_key_low_active; + /* give board a chance to choose the start direct key */ + unsigned int direct_key_mask; /* rotary encoders 0 */ int enable_rotary0; diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index a60f14e7983e..7f7b72464a37 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c @@ -391,7 +391,14 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad) if (pdata->direct_key_num > direct_key_num) direct_key_num = pdata->direct_key_num; - keypad->direct_key_mask = ((1 << direct_key_num) - 1) & ~mask; + /* + * Direct keys usage may not start from KP_DKIN0, check the platfrom + * mask data to config the specific. + */ + if (pdata->direct_key_mask) + keypad->direct_key_mask = pdata->direct_key_mask; + else + keypad->direct_key_mask = ((1 << direct_key_num) - 1) & ~mask; /* enable direct key */ if (direct_key_num) -- cgit v1.2.3 From d331efdd993f4c392f5f63f970b3a55996e3a959 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 18:40:57 -0400 Subject: USB: input: joystick: iforce: fix up dev_err() usages We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/iforce/iforce-packets.c | 2 +- drivers/input/joystick/iforce/iforce-usb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c index 137326a5c2aa..68f5f1e2d73b 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c @@ -257,7 +257,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) status = usb_submit_urb(iforce->ctrl, GFP_ATOMIC); if (status) { - dev_err(&iforce->usbdev->dev, + dev_err(&iforce->dev->dev, "usb_submit_urb failed %d\n", status); return -1; } diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index ecbfae7d7539..86d3538e104d 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c @@ -100,7 +100,7 @@ static void iforce_usb_irq(struct urb *urb) exit: status = usb_submit_urb (urb, GFP_ATOMIC); if (status) - dev_err(&iforce->usbdev->dev, + dev_err(&iforce->dev->dev, "%s - usb_submit_urb failed with result %d\n", __func__, status); } -- cgit v1.2.3 From 39e85a2673c0c9696939dbe10e79c2fb4b91b91c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:56:34 -0400 Subject: USB: input: xpad.c: fix up dev_err() usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov CC: "Magnus Hörlin" CC: Rusty Russell CC: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/xpad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index bee9c00032ee..d760031430a3 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -492,7 +492,7 @@ static void xpad_irq_in(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&xpad->udev->dev, + dev_err(&xpad->dev->dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } @@ -542,7 +542,7 @@ static void xpad_irq_out(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&xpad->udev->dev, + dev_err(&xpad->dev->dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } -- cgit v1.2.3 From 388fd2026633acf2a23fcb7918ba24d9d646bcfb Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:56:38 -0400 Subject: USB: input: cm109.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov CC: Axel Lin Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/cm109.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c index 412fe5719cb6..9e76ab18e944 100644 --- a/drivers/input/misc/cm109.c +++ b/drivers/input/misc/cm109.c @@ -327,7 +327,7 @@ static void cm109_submit_buzz_toggle(struct cm109_dev *dev) error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); if (error) - dev_err(&dev->intf->dev, + dev_err(&dev->idev->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n", __func__, error); } @@ -351,7 +351,7 @@ static void cm109_urb_irq_callback(struct urb *urb) if (status) { if (status == -ESHUTDOWN) return; - dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); + dev_err(&dev->idev->dev, "%s: urb status %d\n", __func__, status); } /* Special keys */ @@ -398,7 +398,7 @@ static void cm109_urb_irq_callback(struct urb *urb) error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); if (error) - dev_err(&dev->intf->dev, + dev_err(&dev->idev->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n", __func__, error); } @@ -419,7 +419,7 @@ static void cm109_urb_ctl_callback(struct urb *urb) dev->ctl_data->byte[3]); if (status) - dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); + dev_err(&dev->idev->dev, "%s: urb status %d\n", __func__, status); spin_lock(&dev->ctl_submit_lock); @@ -436,7 +436,7 @@ static void cm109_urb_ctl_callback(struct urb *urb) dev->irq_urb_pending = 1; error = usb_submit_urb(dev->urb_irq, GFP_ATOMIC); if (error) - dev_err(&dev->intf->dev, + dev_err(&dev->idev->dev, "%s: usb_submit_urb (urb_irq) failed %d\n", __func__, error); } @@ -480,7 +480,7 @@ static void cm109_toggle_buzzer_sync(struct cm109_dev *dev, int on) dev->ctl_data, USB_PKT_LEN, USB_CTRL_SET_TIMEOUT); if (error < 0 && error != -EINTR) - dev_err(&dev->intf->dev, "%s: usb_control_msg() failed %d\n", + dev_err(&dev->idev->dev, "%s: usb_control_msg() failed %d\n", __func__, error); } -- cgit v1.2.3 From 3b449fe5d5585a43f26bda4c3d86b7677d4c80db Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:56:41 -0400 Subject: USB: input: keyspan_remote.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/keyspan_remote.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c index 9a45c88bc65f..7f017d497d83 100644 --- a/drivers/input/misc/keyspan_remote.c +++ b/drivers/input/misc/keyspan_remote.c @@ -267,7 +267,7 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - dev_err(&remote->udev->dev, + dev_err(&remote->input->dev, "%s - Unknown sequence found in system data.\n", __func__); remote->stage = 0; @@ -288,7 +288,7 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - dev_err(&remote->udev->dev, + dev_err(&remote->input->dev, "%s - Unknown sequence found in button data.\n", __func__); remote->stage = 0; @@ -306,7 +306,7 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - dev_err(&remote->udev->dev, + dev_err(&remote->input->dev, "%s - Error in message, invalid toggle.\n", __func__); remote->stage = 0; @@ -318,7 +318,7 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 5; remote->data.bits_left -= 5; } else { - dev_err(&remote->udev->dev, + dev_err(&remote->input->dev, "Bad message received, no stop bit found.\n"); } @@ -404,7 +404,7 @@ static void keyspan_irq_recv(struct urb *urb) resubmit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&dev->udev->dev, + dev_err(&dev->input->dev, "%s - usb_submit_urb failed with result: %d\n", __func__, retval); } -- cgit v1.2.3 From 6b37dbba5d5f4e167eb5ca57e43c1bd49a696831 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:56:45 -0400 Subject: USB: input: powermate.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/powermate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c index 71ec621fbefa..3091b82b1f97 100644 --- a/drivers/input/misc/powermate.c +++ b/drivers/input/misc/powermate.c @@ -110,7 +110,7 @@ static void powermate_irq(struct urb *urb) exit: retval = usb_submit_urb (urb, GFP_ATOMIC); if (retval) - dev_err(&pm->udev->dev, + dev_err(&pm->input->dev, "%s - usb_submit_urb failed with result: %d\n", __func__, retval); } -- cgit v1.2.3 From aa330384a6444682126de5dd49982fa428badd08 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:56:46 -0400 Subject: USB: input: yealink.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov CC: Henk Vergonet Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/yealink.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c index 4984823b3681..9f71bb174eed 100644 --- a/drivers/input/misc/yealink.c +++ b/drivers/input/misc/yealink.c @@ -428,7 +428,7 @@ static void urb_irq_callback(struct urb *urb) int ret, status = urb->status; if (status) - dev_err(&yld->udev->dev, "%s - urb status %d\n", + dev_err(&yld->idev->dev, "%s - urb status %d\n", __func__, status); switch (yld->irq_data->cmd) { @@ -444,7 +444,7 @@ static void urb_irq_callback(struct urb *urb) break; default: - dev_err(&yld->udev->dev, "unexpected response %x\n", + dev_err(&yld->idev->dev, "unexpected response %x\n", yld->irq_data->cmd); } @@ -453,7 +453,7 @@ static void urb_irq_callback(struct urb *urb) if (!yld->shutdown) { ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); if (ret && ret != -EPERM) - dev_err(&yld->udev->dev, + dev_err(&yld->idev->dev, "%s - usb_submit_urb failed %d\n", __func__, ret); } @@ -465,7 +465,7 @@ static void urb_ctl_callback(struct urb *urb) int ret = 0, status = urb->status; if (status) - dev_err(&yld->udev->dev, "%s - urb status %d\n", + dev_err(&yld->idev->dev, "%s - urb status %d\n", __func__, status); switch (yld->ctl_data->cmd) { @@ -484,7 +484,7 @@ static void urb_ctl_callback(struct urb *urb) } if (ret && ret != -EPERM) - dev_err(&yld->udev->dev, "%s - usb_submit_urb failed %d\n", + dev_err(&yld->idev->dev, "%s - usb_submit_urb failed %d\n", __func__, ret); } -- cgit v1.2.3 From 80f8594f63dd35179235aa22901dfa5ce786fe00 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:56:47 -0400 Subject: USB: input: appletouch.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov CC: Alessandro Rubini Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/appletouch.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index 90db679b44af..a5f15477a7ea 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c @@ -253,8 +253,9 @@ MODULE_PARM_DESC(debug, "Activate debugging output"); * packets (Report ID 2). This code changes device mode, so it * sends raw sensor reports (Report ID 5). */ -static int atp_geyser_init(struct usb_device *udev) +static int atp_geyser_init(struct atp *dev) { + struct usb_device *udev = dev->udev; char *data; int size; int i; @@ -262,7 +263,7 @@ static int atp_geyser_init(struct usb_device *udev) data = kmalloc(8, GFP_KERNEL); if (!data) { - dev_err(&udev->dev, "Out of memory\n"); + dev_err(&dev->input->dev, "Out of memory\n"); return -ENOMEM; } @@ -277,7 +278,7 @@ static int atp_geyser_init(struct usb_device *udev) for (i = 0; i < 8; i++) dprintk("appletouch[%d]: %d\n", i, data[i]); - dev_err(&udev->dev, "Failed to read mode from device.\n"); + dev_err(&dev->input->dev, "Failed to read mode from device.\n"); ret = -EIO; goto out_free; } @@ -296,7 +297,7 @@ static int atp_geyser_init(struct usb_device *udev) for (i = 0; i < 8; i++) dprintk("appletouch[%d]: %d\n", i, data[i]); - dev_err(&udev->dev, "Failed to request geyser raw mode\n"); + dev_err(&dev->input->dev, "Failed to request geyser raw mode\n"); ret = -EIO; goto out_free; } @@ -313,15 +314,14 @@ out_free: static void atp_reinit(struct work_struct *work) { struct atp *dev = container_of(work, struct atp, work); - struct usb_device *udev = dev->udev; int retval; dprintk("appletouch: putting appletouch to sleep (reinit)\n"); - atp_geyser_init(udev); + atp_geyser_init(dev); retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - dev_err(&udev->dev, + dev_err(&dev->input->dev, "atp_reinit: usb_submit_urb failed with error %d\n", retval); } @@ -589,7 +589,7 @@ static void atp_complete_geyser_1_2(struct urb *urb) exit: retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - dev_err(&dev->udev->dev, + dev_err(&dev->input->dev, "atp_complete: usb_submit_urb failed with result %d\n", retval); } @@ -724,7 +724,7 @@ static void atp_complete_geyser_3_4(struct urb *urb) exit: retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - dev_err(&dev->udev->dev, + dev_err(&dev->input->dev, "atp_complete: usb_submit_urb failed with result %d\n", retval); } @@ -751,14 +751,12 @@ static void atp_close(struct input_dev *input) static int atp_handle_geyser(struct atp *dev) { - struct usb_device *udev = dev->udev; - if (dev->info != &fountain_info) { /* switch to raw sensor mode */ - if (atp_geyser_init(udev)) + if (atp_geyser_init(dev)) return -EIO; - printk(KERN_INFO "appletouch: Geyser mode initialized.\n"); + dev_info(&dev->input->dev, "Geyser mode initialized.\n"); } return 0; -- cgit v1.2.3 From 140b1230a19b65489317271da36465e42865f2e4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:56:47 -0400 Subject: USB: input: bcm5974.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov CC: Henrik Rydberg CC: Alessandro Rubini Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/bcm5974.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 8cd7c932c202..e2e8d815da76 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c @@ -584,7 +584,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) int retval = 0, size; if (!data) { - dev_err(&dev->intf->dev, "out of memory\n"); + dev_err(&dev->input->dev, "out of memory\n"); retval = -ENOMEM; goto out; } @@ -597,7 +597,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); if (size != 8) { - dev_err(&dev->intf->dev, "could not read from device\n"); + dev_err(&dev->input->dev, "could not read from device\n"); retval = -EIO; goto out; } @@ -615,7 +615,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); if (size != 8) { - dev_err(&dev->intf->dev, "could not write to device\n"); + dev_err(&dev->input->dev, "could not write to device\n"); retval = -EIO; goto out; } @@ -654,7 +654,7 @@ static void bcm5974_irq_button(struct urb *urb) exit: error = usb_submit_urb(dev->bt_urb, GFP_ATOMIC); if (error) - dev_err(&dev->intf->dev, "button urb failed: %d\n", error); + dev_err(&dev->input->dev, "button urb failed: %d\n", error); } static void bcm5974_irq_trackpad(struct urb *urb) @@ -687,7 +687,7 @@ static void bcm5974_irq_trackpad(struct urb *urb) exit: error = usb_submit_urb(dev->tp_urb, GFP_ATOMIC); if (error) - dev_err(&dev->intf->dev, "trackpad urb failed: %d\n", error); + dev_err(&dev->input->dev, "trackpad urb failed: %d\n", error); } /* -- cgit v1.2.3 From b30662c4721ea77ca5930dd60f3294cd1413067f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:56:51 -0400 Subject: USB: input: acecad.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/acecad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c index da6c34106190..a81a2b060284 100644 --- a/drivers/input/tablet/acecad.c +++ b/drivers/input/tablet/acecad.c @@ -105,7 +105,7 @@ static void usb_acecad_irq(struct urb *urb) resubmit: status = usb_submit_urb(urb, GFP_ATOMIC); if (status) - dev_err(&acecad->usbdev->dev, + dev_err(&dev->dev, "can't resubmit intr, %s-%s/input0, status %d\n", acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); -- cgit v1.2.3 From 383c52f3388b5ddb2fbf1ec073081bc9c4bdfeff Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:56:56 -0400 Subject: USB: input: aiptek.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov CC: Jesper Juhl CC: JJ Ding CC: Edwin van Vliet Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/aiptek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index b8d43eb3c8f1..dc16bfd24738 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c @@ -811,7 +811,7 @@ static void aiptek_irq(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval != 0) { - dev_err(&aiptek->usbdev->dev, + dev_err(&inputdev->dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } -- cgit v1.2.3 From 88d5ab3a1817bcfe192ae79ef85ef3fb3e8c6669 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:57:00 -0400 Subject: USB: input: gtco.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/gtco.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index fed555bf9ff7..937215373e95 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c @@ -806,7 +806,7 @@ static void gtco_urb_callback(struct urb *urbinfo) resubmit: rc = usb_submit_urb(urbinfo, GFP_ATOMIC); if (rc != 0) - dev_err(&device->usbdev->dev, + dev_err(&inputdev->dev, "usb_submit_urb failed rc=0x%x\n", rc); } -- cgit v1.2.3 From 3415b57cb3d7b6b6cd5fcbf5f3f64ca28a3f95e2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:57:03 -0400 Subject: USB: input: kbtab.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/kbtab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c index 1eb6341f81c5..be717d758cb2 100644 --- a/drivers/input/tablet/kbtab.c +++ b/drivers/input/tablet/kbtab.c @@ -80,7 +80,7 @@ static void kbtab_irq(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&kbtab->usbdev->dev, + dev_err(&dev->dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } -- cgit v1.2.3 From 1b5ca928e7d09c5ce0cefe6aec7392e4a3aa1d3b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:57:07 -0400 Subject: USB: input: wacom_sys.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov CC: Ping Cheng CC: Chris Bagwell CC: Eduard Hasenleithner Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/wacom_sys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 3db4684a0b77..821d2a958e44 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -122,7 +122,7 @@ static void wacom_sys_irq(struct urb *urb) usb_mark_last_busy(wacom->usbdev); retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&wacom->intf->dev, + dev_err(&wacom->wacom_wac.input->dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } @@ -818,7 +818,7 @@ static int wacom_initialize_leds(struct wacom *wacom) } if (error) { - dev_err(&wacom->intf->dev, + dev_err(&wacom->wacom_wac.input->dev, "cannot create sysfs group err: %d\n", error); return error; } -- cgit v1.2.3 From f864b60ad0078b74c765f00f0600588b85c0a239 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 20:57:11 -0400 Subject: USB: input: usbtouchscreen.c: fix up dev_err() usage We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov CC: Henrik Rydberg CC: Rusty Russell CC: Viresh Kumar CC: Armando Visconti Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/usbtouchscreen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 955441cb030d..4127cf7bb25a 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -1380,7 +1380,7 @@ exit: usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&usbtouch->interface->dev, + dev_err(&usbtouch->input->dev, "%s - usb_submit_urb failed with result: %d\n", __func__, retval); } @@ -1623,7 +1623,7 @@ static int usbtouch_probe(struct usb_interface *intf, err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); if (err) { usb_autopm_put_interface(intf); - dev_err(&intf->dev, + dev_err(&input_dev->dev, "%s - usb_submit_urb failed with result: %d\n", __func__, err); goto out_unregister_input; -- cgit v1.2.3 From 3b6aee237e889a189fd8c558207ca0e55818f744 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:24:28 -0700 Subject: USB: wacom: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. Cc: Dmitry Torokhov Cc: Ping Cheng Cc: Eduard Hasenleithner Cc: Chris Bagwell Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/wacom_sys.c | 10 ++++++---- drivers/input/tablet/wacom_wac.c | 16 +++++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 821d2a958e44..ac29a68ac53e 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -99,6 +99,7 @@ static int wacom_set_report(struct usb_interface *intf, u8 type, u8 id, static void wacom_sys_irq(struct urb *urb) { struct wacom *wacom = urb->context; + struct device *dev = &wacom->wacom_wac.input->dev; int retval; switch (urb->status) { @@ -109,10 +110,12 @@ static void wacom_sys_irq(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __func__, urb->status); + dev_dbg(dev, "%s - urb shutting down with status: %d\n", + __func__, urb->status); return; default: - dbg("%s - nonzero urb status received: %d", __func__, urb->status); + dev_dbg(dev, "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto exit; } @@ -122,8 +125,7 @@ static void wacom_sys_irq(struct urb *urb) usb_mark_last_busy(wacom->usbdev); retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&wacom->wacom_wac.input->dev, - "%s - usb_submit_urb failed with result %d\n", + dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index cecd35c8f0b3..b327790e9a0c 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -76,7 +76,8 @@ static int wacom_pl_irq(struct wacom_wac *wacom) int prox, pressure; if (data[0] != WACOM_REPORT_PENABLED) { - dbg("wacom_pl_irq: received unknown report #%d", data[0]); + dev_dbg(&input->dev, + "wacom_pl_irq: received unknown report #%d\n", data[0]); return 0; } @@ -175,7 +176,7 @@ static int wacom_dtu_irq(struct wacom_wac *wacom) struct input_dev *input = wacom->input; int prox = data[1] & 0x20, pressure; - dbg("wacom_dtu_irq: received report #%d", data[0]); + dev_dbg(&input->dev, "wacom_dtu_irq: received report #%d\n", data[0]); if (prox) { /* Going into proximity select tool */ @@ -211,7 +212,9 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) int retval = 0; if (data[0] != WACOM_REPORT_PENABLED) { - dbg("wacom_graphire_irq: received unknown report #%d", data[0]); + dev_dbg(&input->dev, + "wacom_graphire_irq: received unknown report #%d\n", + data[0]); goto exit; } @@ -484,7 +487,9 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_INTUOSREAD && data[0] != WACOM_REPORT_INTUOSWRITE && data[0] != WACOM_REPORT_INTUOSPAD) { - dbg("wacom_intuos_irq: received unknown report #%d", data[0]); + dev_dbg(&input->dev, + "wacom_intuos_irq: received unknown report #%d\n", + data[0]); return 0; } @@ -830,7 +835,8 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) { char *data = wacom->data; - dbg("wacom_tpc_irq: received report #%d", data[0]); + dev_dbg(&wacom->input->dev, "wacom_tpc_irq: received report #%d\n", + data[0]); switch (len) { case WACOM_PKGLEN_TPC1FG: -- cgit v1.2.3 From f576125dc872f28da2f89c29bfc73ec0ff02f7d9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:26:05 -0700 Subject: USB: iforce: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. Cc: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/iforce/iforce-packets.c | 6 ++++-- drivers/input/joystick/iforce/iforce-usb.c | 14 ++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c index 68f5f1e2d73b..0d8f53b5ce53 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c @@ -266,12 +266,14 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) iforce->ctrl->status != -EINPROGRESS, HZ); if (iforce->ctrl->status) { - dbg("iforce->ctrl->status = %d", iforce->ctrl->status); + dev_dbg(&iforce->dev->dev, + "iforce->ctrl->status = %d\n", + iforce->ctrl->status); usb_unlink_urb(iforce->ctrl); return -1; } #else - dbg("iforce_get_id_packet: iforce->bus = USB!"); + printk(KERN_DEBUG "iforce_get_id_packet: iforce->bus = USB!\n"); #endif } break; diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 86d3538e104d..15e8d6531e25 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c @@ -76,6 +76,7 @@ void iforce_usb_xmit(struct iforce *iforce) static void iforce_usb_irq(struct urb *urb) { struct iforce *iforce = urb->context; + struct device *dev = &iforce->dev->dev; int status; switch (urb->status) { @@ -86,11 +87,12 @@ static void iforce_usb_irq(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", - __func__, urb->status); + dev_dbg(dev, "%s - urb shutting down with status: %d\n", + __func__, urb->status); return; default: - dbg("%s - urb has status of: %d", __func__, urb->status); + dev_dbg(dev, "%s - urb has status of: %d\n", + __func__, urb->status); goto exit; } @@ -100,8 +102,7 @@ static void iforce_usb_irq(struct urb *urb) exit: status = usb_submit_urb (urb, GFP_ATOMIC); if (status) - dev_err(&iforce->dev->dev, - "%s - usb_submit_urb failed with result %d\n", + dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, status); } @@ -111,7 +112,8 @@ static void iforce_usb_out(struct urb *urb) if (urb->status) { clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); - dbg("urb->status %d, exiting", urb->status); + dev_dbg(&iforce->dev->dev, "urb->status %d, exiting\n", + urb->status); return; } -- cgit v1.2.3 From c4f0bbcd1d53dc40e2ac56f2ab116f9ba612a8ee Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:32:59 -0700 Subject: USB: xpad.c: remove dbg() usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Dmitry Torokhov CC: "Magnus Hörlin" CC: Rusty Russell CC: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/xpad.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index d760031430a3..2e106b0796ce 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -457,6 +457,7 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha static void xpad_irq_in(struct urb *urb) { struct usb_xpad *xpad = urb->context; + struct device *dev = &xpad->dev->dev; int retval, status; status = urb->status; @@ -469,11 +470,11 @@ static void xpad_irq_in(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", + dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status); return; default: - dbg("%s - nonzero urb status received: %d", + dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); goto exit; } @@ -492,13 +493,15 @@ static void xpad_irq_in(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&xpad->dev->dev, - "%s - usb_submit_urb failed with result %d\n", + dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } static void xpad_bulk_out(struct urb *urb) { + struct usb_xpad *xpad = urb->context; + struct device *dev = &xpad->dev->dev; + switch (urb->status) { case 0: /* success */ @@ -507,10 +510,12 @@ static void xpad_bulk_out(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __func__, urb->status); + dev_dbg(dev, "%s - urb shutting down with status: %d\n", + __func__, urb->status); break; default: - dbg("%s - nonzero urb status received: %d", __func__, urb->status); + dev_dbg(dev, "%s - nonzero urb status received: %d\n", + __func__, urb->status); } } @@ -518,6 +523,7 @@ static void xpad_bulk_out(struct urb *urb) static void xpad_irq_out(struct urb *urb) { struct usb_xpad *xpad = urb->context; + struct device *dev = &xpad->dev->dev; int retval, status; status = urb->status; @@ -531,19 +537,20 @@ static void xpad_irq_out(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __func__, status); + dev_dbg(dev, "%s - urb shutting down with status: %d\n", + __func__, status); return; default: - dbg("%s - nonzero urb status received: %d", __func__, status); + dev_dbg(dev, "%s - nonzero urb status received: %d\n", + __func__, status); goto exit; } exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&xpad->dev->dev, - "%s - usb_submit_urb failed with result %d\n", + dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } @@ -657,7 +664,8 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect return usb_submit_urb(xpad->irq_out, GFP_ATOMIC); default: - dbg("%s - rumble command sent to unsupported xpad type: %d", + dev_dbg(&xpad->dev->dev, + "%s - rumble command sent to unsupported xpad type: %d\n", __func__, xpad->xtype); return -1; } -- cgit v1.2.3 From 8b0725c0593871106d24ed94e7a14cf2316cb21d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:33:03 -0700 Subject: USB: powermate.c: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/powermate.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c index 3091b82b1f97..d16717e8e9c4 100644 --- a/drivers/input/misc/powermate.c +++ b/drivers/input/misc/powermate.c @@ -85,6 +85,7 @@ static void powermate_config_complete(struct urb *urb); static void powermate_irq(struct urb *urb) { struct powermate_device *pm = urb->context; + struct device *dev = &pm->input->dev; int retval; switch (urb->status) { @@ -95,10 +96,12 @@ static void powermate_irq(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __func__, urb->status); + dev_dbg(dev, "%s - urb shutting down with status: %d\n", + __func__, urb->status); return; default: - dbg("%s - nonzero urb status received: %d", __func__, urb->status); + dev_dbg(dev, "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto exit; } @@ -110,8 +113,7 @@ static void powermate_irq(struct urb *urb) exit: retval = usb_submit_urb (urb, GFP_ATOMIC); if (retval) - dev_err(&pm->input->dev, - "%s - usb_submit_urb failed with result: %d\n", + dev_err(dev, "%s - usb_submit_urb failed with result: %d\n", __func__, retval); } -- cgit v1.2.3 From 938476f9237ee97480ddb091c06d67851bb4d7e9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:33:03 -0700 Subject: USB: yealink.c: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Henk Vergonet CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/yealink.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c index 9f71bb174eed..37b126c06fc1 100644 --- a/drivers/input/misc/yealink.c +++ b/drivers/input/misc/yealink.c @@ -438,7 +438,8 @@ static void urb_irq_callback(struct urb *urb) break; case CMD_SCANCODE: - dbg("get scancode %x", yld->irq_data->data[0]); + dev_dbg(&yld->idev->dev, "get scancode %x\n", + yld->irq_data->data[0]); report_key(yld, map_p1k_to_key(yld->irq_data->data[0])); break; @@ -517,7 +518,7 @@ static int input_open(struct input_dev *dev) struct yealink_dev *yld = input_get_drvdata(dev); int i, ret; - dbg("%s", __func__); + dev_dbg(&yld->idev->dev, "%s\n", __func__); /* force updates to device */ for (i = 0; imaster); i++) @@ -532,8 +533,9 @@ static int input_open(struct input_dev *dev) yld->ctl_data->size = 10; yld->ctl_data->sum = 0x100-CMD_INIT-10; if ((ret = usb_submit_urb(yld->urb_ctl, GFP_KERNEL)) != 0) { - dbg("%s - usb_submit_urb failed with result %d", - __func__, ret); + dev_dbg(&yld->idev->dev, + "%s - usb_submit_urb failed with result %d\n", + __func__, ret); return ret; } return 0; -- cgit v1.2.3 From 67946d136879a129fccd35b79a87e1f05ace148e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:33:04 -0700 Subject: USB: appletouch.c: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Alessandro Rubini CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/appletouch.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index a5f15477a7ea..d0a590f87c2b 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c @@ -401,6 +401,7 @@ static inline void atp_report_fingers(struct input_dev *input, int fingers) static int atp_status_check(struct urb *urb) { struct atp *dev = urb->context; + struct input_dev *idev = dev->input; switch (urb->status) { case 0: @@ -408,8 +409,8 @@ static int atp_status_check(struct urb *urb) break; case -EOVERFLOW: if (!dev->overflow_warned) { - printk(KERN_WARNING "appletouch: OVERFLOW with data " - "length %d, actual length is %d\n", + dev_warn(&idev->dev, + "appletouch: OVERFLOW with data length %d, actual length is %d\n", dev->info->datalen, dev->urb->actual_length); dev->overflow_warned = true; } @@ -417,13 +418,15 @@ static int atp_status_check(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* This urb is terminated, clean up */ - dbg("atp_complete: urb shutting down with status: %d", - urb->status); + dev_dbg(&idev->dev, + "atp_complete: urb shutting down with status: %d\n", + urb->status); return ATP_URB_STATUS_ERROR_FATAL; default: - dbg("atp_complete: nonzero urb status received: %d", - urb->status); + dev_dbg(&idev->dev, + "atp_complete: nonzero urb status received: %d\n", + urb->status); return ATP_URB_STATUS_ERROR; } @@ -446,7 +449,8 @@ static void atp_detect_size(struct atp *dev) for (i = dev->info->xsensors; i < ATP_XSENSORS; i++) { if (dev->xy_cur[i]) { - printk(KERN_INFO "appletouch: 17\" model detected.\n"); + dev_info(&dev->input->dev, + "appletouch: 17\" model detected.\n"); input_set_abs_params(dev->input, ABS_X, 0, (dev->info->xsensors_17 - 1) * -- cgit v1.2.3 From bd028769f741b88dc06831bfe7edb181671758ea Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:33:05 -0700 Subject: USB: bcm5974.c: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Henrik Rydberg CC: Alessandro Rubini CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/bcm5974.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index e2e8d815da76..e32928ee7cc2 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c @@ -631,6 +631,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) static void bcm5974_irq_button(struct urb *urb) { struct bcm5974 *dev = urb->context; + struct input_dev *idev = dev->input; int error; switch (urb->status) { @@ -640,10 +641,11 @@ static void bcm5974_irq_button(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dbg("bcm5974: button urb shutting down: %d", urb->status); + dev_dbg(&idev->dev, "button urb shutting down: %d\n", + urb->status); return; default: - dbg("bcm5974: button urb status: %d", urb->status); + dev_dbg(&idev->dev, "button urb status: %d\n", urb->status); goto exit; } @@ -654,12 +656,13 @@ static void bcm5974_irq_button(struct urb *urb) exit: error = usb_submit_urb(dev->bt_urb, GFP_ATOMIC); if (error) - dev_err(&dev->input->dev, "button urb failed: %d\n", error); + dev_err(&idev->dev, "button urb failed: %d\n", error); } static void bcm5974_irq_trackpad(struct urb *urb) { struct bcm5974 *dev = urb->context; + struct input_dev *idev = dev->input; int error; switch (urb->status) { @@ -669,10 +672,11 @@ static void bcm5974_irq_trackpad(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dbg("bcm5974: trackpad urb shutting down: %d", urb->status); + dev_dbg(&idev->dev, "trackpad urb shutting down: %d\n", + urb->status); return; default: - dbg("bcm5974: trackpad urb status: %d", urb->status); + dev_dbg(&idev->dev, "trackpad urb status: %d\n", urb->status); goto exit; } @@ -687,7 +691,7 @@ static void bcm5974_irq_trackpad(struct urb *urb) exit: error = usb_submit_urb(dev->tp_urb, GFP_ATOMIC); if (error) - dev_err(&dev->input->dev, "trackpad urb failed: %d\n", error); + dev_err(&idev->dev, "trackpad urb failed: %d\n", error); } /* -- cgit v1.2.3 From eeba1ae13cbddc6e9cbc4adcd0d9fd686ba09f5f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:33:09 -0700 Subject: USB: acecad.c: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/acecad.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c index a81a2b060284..baa9d4ad0d00 100644 --- a/drivers/input/tablet/acecad.c +++ b/drivers/input/tablet/acecad.c @@ -73,10 +73,12 @@ static void usb_acecad_irq(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __func__, urb->status); + dev_dbg(&dev->dev, "%s - urb shutting down with status: %d\n", + __func__, urb->status); return; default: - dbg("%s - nonzero urb status received: %d", __func__, urb->status); + dev_dbg(&dev->dev, "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto resubmit; } -- cgit v1.2.3 From 8fb6321b6bd9ebcc03243f27fe98e18e246a5c97 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:33:12 -0700 Subject: USB: aiptek.c: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Dmitry Torokhov CC: Jesper Juhl CC: JJ Ding CC: Edwin van Vliet Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/aiptek.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index dc16bfd24738..37dba769bf0f 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c @@ -447,13 +447,15 @@ static void aiptek_irq(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* This urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", - __func__, urb->status); + dev_dbg(&inputdev->dev, + "%s - urb shutting down with status: %d\n", + __func__, urb->status); return; default: - dbg("%s - nonzero urb status received: %d", - __func__, urb->status); + dev_dbg(&inputdev->dev, + "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto exit; } @@ -785,7 +787,7 @@ static void aiptek_irq(struct urb *urb) 1 | AIPTEK_REPORT_TOOL_UNKNOWN); input_sync(inputdev); } else { - dbg("Unknown report %d", data[0]); + dev_dbg(&inputdev->dev, "Unknown report %d\n", data[0]); } /* Jitter may occur when the user presses a button on the stlyus @@ -913,8 +915,9 @@ aiptek_command(struct aiptek *aiptek, unsigned char command, unsigned char data) if ((ret = aiptek_set_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { - dbg("aiptek_program: failed, tried to send: 0x%02x 0x%02x", - command, data); + dev_dbg(&aiptek->inputdev->dev, + "aiptek_program: failed, tried to send: 0x%02x 0x%02x\n", + command, data); } kfree(buf); return ret < 0 ? ret : 0; @@ -948,8 +951,9 @@ aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data) if ((ret = aiptek_get_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { - dbg("aiptek_query failed: returned 0x%02x 0x%02x 0x%02x", - buf[0], buf[1], buf[2]); + dev_dbg(&aiptek->inputdev->dev, + "aiptek_query failed: returned 0x%02x 0x%02x 0x%02x\n", + buf[0], buf[1], buf[2]); ret = -EIO; } else { ret = get_unaligned_le16(buf + 1); -- cgit v1.2.3 From c6f880a7812766b896edcba51ac8a449ff5d4320 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:33:16 -0700 Subject: USB: gtco.c: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/gtco.c | 87 +++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 42 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 937215373e95..422b1a2ef309 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c @@ -200,6 +200,7 @@ struct hid_descriptor static void parse_hid_report_descriptor(struct gtco *device, char * report, int length) { + struct device *ddev = &device->inputdevice->dev; int x, i = 0; /* Tag primitive vars */ @@ -226,7 +227,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, char indentstr[10] = ""; - dbg("======>>>>>>PARSE<<<<<<======"); + dev_dbg(ddev, "======>>>>>>PARSE<<<<<<======\n"); /* Walk this report and pull out the info we need */ while (i < length) { @@ -275,11 +276,11 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, else if (data == 3) strcpy(globtype, "Var|Const"); - dbg("::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits", - globalval[TAG_GLOB_REPORT_ID], inputnum, - globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX], - globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN], - globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]); + dev_dbg(ddev, "::::: Saving Report: %d input #%d Max: 0x%X(%d) Min:0x%X(%d) of %d bits\n", + globalval[TAG_GLOB_REPORT_ID], inputnum, + globalval[TAG_GLOB_LOG_MAX], globalval[TAG_GLOB_LOG_MAX], + globalval[TAG_GLOB_LOG_MIN], globalval[TAG_GLOB_LOG_MIN], + globalval[TAG_GLOB_REPORT_SZ] * globalval[TAG_GLOB_REPORT_CNT]); /* @@ -290,7 +291,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, */ switch (inputnum) { case 0: /* X coord */ - dbg("GER: X Usage: 0x%x", usage); + dev_dbg(ddev, "GER: X Usage: 0x%x\n", usage); if (device->max_X == 0) { device->max_X = globalval[TAG_GLOB_LOG_MAX]; device->min_X = globalval[TAG_GLOB_LOG_MIN]; @@ -298,7 +299,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, break; case 1: /* Y coord */ - dbg("GER: Y Usage: 0x%x", usage); + dev_dbg(ddev, "GER: Y Usage: 0x%x\n", usage); if (device->max_Y == 0) { device->max_Y = globalval[TAG_GLOB_LOG_MAX]; device->min_Y = globalval[TAG_GLOB_LOG_MIN]; @@ -348,10 +349,10 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, maintype = 'S'; if (data == 0) { - dbg("======>>>>>> Physical"); + dev_dbg(ddev, "======>>>>>> Physical\n"); strcpy(globtype, "Physical"); } else - dbg("======>>>>>>"); + dev_dbg(ddev, "======>>>>>>\n"); /* Indent the debug output */ indent++; @@ -366,7 +367,7 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, break; case TAG_MAIN_COL_END: - dbg("<<<<<<======"); + dev_dbg(ddev, "<<<<<<======\n"); maintype = 'E'; indent--; for (x = 0; x < indent; x++) @@ -382,18 +383,18 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, switch (size) { case 1: - dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", - indentstr, tag, maintype, size, globtype, data); + dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n", + indentstr, tag, maintype, size, globtype, data); break; case 2: - dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", - indentstr, tag, maintype, size, globtype, data16); + dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n", + indentstr, tag, maintype, size, globtype, data16); break; case 4: - dbg("%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x", - indentstr, tag, maintype, size, globtype, data32); + dev_dbg(ddev, "%sMAINTAG:(%d) %c SIZE: %d Data: %s 0x%x\n", + indentstr, tag, maintype, size, globtype, data32); break; } break; @@ -463,26 +464,26 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, if (tag < TAG_GLOB_MAX) { switch (size) { case 1: - dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", - indentstr, globtype, tag, size, data); + dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n", + indentstr, globtype, tag, size, data); globalval[tag] = data; break; case 2: - dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", - indentstr, globtype, tag, size, data16); + dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n", + indentstr, globtype, tag, size, data16); globalval[tag] = data16; break; case 4: - dbg("%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x", - indentstr, globtype, tag, size, data32); + dev_dbg(ddev, "%sGLOBALTAG:%s(%d) SIZE: %d Data: 0x%x\n", + indentstr, globtype, tag, size, data32); globalval[tag] = data32; break; } } else { - dbg("%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d ", - indentstr, tag, size); + dev_dbg(ddev, "%sGLOBALTAG: ILLEGAL TAG:%d SIZE: %d\n", + indentstr, tag, size); } break; @@ -509,18 +510,18 @@ static void parse_hid_report_descriptor(struct gtco *device, char * report, switch (size) { case 1: - dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", - indentstr, tag, globtype, size, data); + dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n", + indentstr, tag, globtype, size, data); break; case 2: - dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", - indentstr, tag, globtype, size, data16); + dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n", + indentstr, tag, globtype, size, data16); break; case 4: - dbg("%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x", - indentstr, tag, globtype, size, data32); + dev_dbg(ddev, "%sLOCALTAG:(%d) %s SIZE: %d Data: 0x%x\n", + indentstr, tag, globtype, size, data32); break; } @@ -712,8 +713,9 @@ static void gtco_urb_callback(struct urb *urbinfo) * the rest as 0 */ val = device->buffer[5] & MASK_BUTTON; - dbg("======>>>>>>REPORT 1: val 0x%X(%d)", - val, val); + dev_dbg(&inputdev->dev, + "======>>>>>>REPORT 1: val 0x%X(%d)\n", + val, val); /* * We don't apply any meaning to the button @@ -872,14 +874,14 @@ static int gtco_probe(struct usb_interface *usbinterface, endpoint = &usbinterface->altsetting[0].endpoint[0].desc; /* Some debug */ - dbg("gtco # interfaces: %d", usbinterface->num_altsetting); - dbg("num endpoints: %d", usbinterface->cur_altsetting->desc.bNumEndpoints); - dbg("interface class: %d", usbinterface->cur_altsetting->desc.bInterfaceClass); - dbg("endpoint: attribute:0x%x type:0x%x", endpoint->bmAttributes, endpoint->bDescriptorType); + dev_dbg(&usbinterface->dev, "gtco # interfaces: %d\n", usbinterface->num_altsetting); + dev_dbg(&usbinterface->dev, "num endpoints: %d\n", usbinterface->cur_altsetting->desc.bNumEndpoints); + dev_dbg(&usbinterface->dev, "interface class: %d\n", usbinterface->cur_altsetting->desc.bInterfaceClass); + dev_dbg(&usbinterface->dev, "endpoint: attribute:0x%x type:0x%x\n", endpoint->bmAttributes, endpoint->bDescriptorType); if (usb_endpoint_xfer_int(endpoint)) - dbg("endpoint: we have interrupt endpoint\n"); + dev_dbg(&usbinterface->dev, "endpoint: we have interrupt endpoint\n"); - dbg("endpoint extra len:%d ", usbinterface->altsetting[0].extralen); + dev_dbg(&usbinterface->dev, "endpoint extra len:%d\n", usbinterface->altsetting[0].extralen); /* * Find the HID descriptor so we can find out the size of the @@ -893,8 +895,9 @@ static int gtco_probe(struct usb_interface *usbinterface, goto err_free_urb; } - dbg("Extra descriptor success: type:%d len:%d", - hid_desc->bDescriptorType, hid_desc->wDescriptorLength); + dev_dbg(&usbinterface->dev, + "Extra descriptor success: type:%d len:%d\n", + hid_desc->bDescriptorType, hid_desc->wDescriptorLength); report = kzalloc(le16_to_cpu(hid_desc->wDescriptorLength), GFP_KERNEL); if (!report) { @@ -915,7 +918,7 @@ static int gtco_probe(struct usb_interface *usbinterface, le16_to_cpu(hid_desc->wDescriptorLength), 5000); /* 5 secs */ - dbg("usb_control_msg result: %d", result); + dev_dbg(&usbinterface->dev, "usb_control_msg result: %d\n", result); if (result == le16_to_cpu(hid_desc->wDescriptorLength)) { parse_hid_report_descriptor(gtco, report, result); break; -- cgit v1.2.3 From 6d0f7dcba6ea0d04fb0d1374188c2479abf7f951 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:33:20 -0700 Subject: USB: kbtab.c: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/kbtab.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c index be717d758cb2..a39d1761a6cb 100644 --- a/drivers/input/tablet/kbtab.c +++ b/drivers/input/tablet/kbtab.c @@ -53,10 +53,12 @@ static void kbtab_irq(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __func__, urb->status); + dev_dbg(&dev->dev, "%s - urb shutting down with status: %d\n", + __func__, urb->status); return; default: - dbg("%s - nonzero urb status received: %d", __func__, urb->status); + dev_dbg(&dev->dev, "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto exit; } -- cgit v1.2.3 From b741ab9da614b08da51cffa961435bc81314f3c4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 1 May 2012 21:33:23 -0700 Subject: USB: usbtouchscreen.c: remove dbg() usage dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Dmitry Torokhov CC: Henrik Rydberg CC: Rusty Russell CC: Viresh Kumar CC: Armando Visconti Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/usbtouchscreen.c | 68 ++++++++++++++++++------------ 1 file changed, 42 insertions(+), 26 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 4127cf7bb25a..100eded96b0e 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) 0x01, 0x02, 0x0000, 0x0081, NULL, 0, USB_CTRL_SET_TIMEOUT); - dbg("%s - usb_control_msg - E2I_RESET - bytes|err: %d", - __func__, ret); + dev_dbg(&usbtouch->input->dev, + "%s - usb_control_msg - E2I_RESET - bytes|err: %d\n", + __func__, ret); return ret; } @@ -425,8 +426,9 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) MTOUCHUSB_RESET, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); - dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d", - __func__, ret); + dev_dbg(&usbtouch->input->dev, + "%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d\n", + __func__, ret); if (ret < 0) return ret; msleep(150); @@ -436,8 +438,9 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) MTOUCHUSB_ASYNC_REPORT, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); - dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d", - __func__, ret); + dev_dbg(&usbtouch->input->dev, + "%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d\n", + __func__, ret); if (ret >= 0) break; if (ret != -EPIPE) @@ -737,27 +740,29 @@ static int jastec_read_data(struct usbtouch_usb *dev, unsigned char *pkt) #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) { + struct input_dev *input = dev->input; + switch (pkt[0]) { case 0x3A: /* command response */ - dbg("%s: Command response %d", __func__, pkt[1]); + dev_dbg(&input->dev, "%s: Command response %d\n", __func__, pkt[1]); break; case 0xC0: /* down */ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); dev->touch = 1; - dbg("%s: down %d,%d", __func__, dev->x, dev->y); + dev_dbg(&input->dev, "%s: down %d,%d\n", __func__, dev->x, dev->y); return 1; case 0x80: /* up */ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); dev->touch = 0; - dbg("%s: up %d,%d", __func__, dev->x, dev->y); + dev_dbg(&input->dev, "%s: up %d,%d\n", __func__, dev->x, dev->y); return 1; default: - dbg("%s: Unknown return %d", __func__, pkt[0]); + dev_dbg(&input->dev, "%s: Unknown return %d\n", __func__, pkt[0]); break; } @@ -812,7 +817,8 @@ static int nexio_alloc(struct usbtouch_usb *usbtouch) priv->ack = usb_alloc_urb(0, GFP_KERNEL); if (!priv->ack) { - dbg("%s - usb_alloc_urb failed: usbtouch->ack", __func__); + dev_dbg(&usbtouch->input->dev, + "%s - usb_alloc_urb failed: usbtouch->ack\n", __func__); goto err_ack_buf; } @@ -1349,6 +1355,7 @@ out_flush_buf: static void usbtouch_irq(struct urb *urb) { struct usbtouch_usb *usbtouch = urb->context; + struct device *dev = &usbtouch->input->dev; int retval; switch (urb->status) { @@ -1357,20 +1364,21 @@ static void usbtouch_irq(struct urb *urb) break; case -ETIME: /* this urb is timing out */ - dbg("%s - urb timed out - was the device unplugged?", - __func__); + dev_dbg(dev, + "%s - urb timed out - was the device unplugged?\n", + __func__); return; case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: case -EPIPE: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", - __func__, urb->status); + dev_dbg(dev, "%s - urb shutting down with status: %d\n", + __func__, urb->status); return; default: - dbg("%s - nonzero urb status received: %d", - __func__, urb->status); + dev_dbg(dev, "%s - nonzero urb status received: %d\n", + __func__, urb->status); goto exit; } @@ -1457,8 +1465,9 @@ static int usbtouch_reset_resume(struct usb_interface *intf) if (usbtouch->type->init) { err = usbtouch->type->init(usbtouch); if (err) { - dbg("%s - type->init() failed, err: %d", - __func__, err); + dev_dbg(&input->dev, + "%s - type->init() failed, err: %d\n", + __func__, err); return err; } } @@ -1533,7 +1542,8 @@ static int usbtouch_probe(struct usb_interface *intf, usbtouch->irq = usb_alloc_urb(0, GFP_KERNEL); if (!usbtouch->irq) { - dbg("%s - usb_alloc_urb failed: usbtouch->irq", __func__); + dev_dbg(&intf->dev, + "%s - usb_alloc_urb failed: usbtouch->irq\n", __func__); goto out_free_buffers; } @@ -1595,7 +1605,9 @@ static int usbtouch_probe(struct usb_interface *intf, if (type->alloc) { err = type->alloc(usbtouch); if (err) { - dbg("%s - type->alloc() failed, err: %d", __func__, err); + dev_dbg(&intf->dev, + "%s - type->alloc() failed, err: %d\n", + __func__, err); goto out_free_urb; } } @@ -1604,14 +1616,18 @@ static int usbtouch_probe(struct usb_interface *intf, if (type->init) { err = type->init(usbtouch); if (err) { - dbg("%s - type->init() failed, err: %d", __func__, err); + dev_dbg(&intf->dev, + "%s - type->init() failed, err: %d\n", + __func__, err); goto out_do_exit; } } err = input_register_device(usbtouch->input); if (err) { - dbg("%s - input_register_device failed, err: %d", __func__, err); + dev_dbg(&intf->dev, + "%s - input_register_device failed, err: %d\n", + __func__, err); goto out_do_exit; } @@ -1652,12 +1668,12 @@ static void usbtouch_disconnect(struct usb_interface *intf) { struct usbtouch_usb *usbtouch = usb_get_intfdata(intf); - dbg("%s - called", __func__); - if (!usbtouch) return; - dbg("%s - usbtouch is initialized, cleaning up", __func__); + dev_dbg(&usbtouch->input->dev, + "%s - usbtouch is initialized, cleaning up\n", __func__); + usb_set_intfdata(intf, NULL); /* this will stop IO via close */ input_unregister_device(usbtouch->input); -- cgit v1.2.3 From a852d78e4e24f2200fa1764ca3366b4fa4fd072a Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:23:04 -0700 Subject: USB: input: iforce: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. Cc: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/iforce/iforce-packets.c | 4 ++-- drivers/input/joystick/iforce/iforce-usb.c | 7 ++++--- drivers/input/joystick/iforce/iforce.h | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c index 0d8f53b5ce53..08f98f2eaf88 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c @@ -257,7 +257,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) status = usb_submit_urb(iforce->ctrl, GFP_ATOMIC); if (status) { - dev_err(&iforce->dev->dev, + dev_err(&iforce->intf->dev, "usb_submit_urb failed %d\n", status); return -1; } @@ -266,7 +266,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) iforce->ctrl->status != -EINPROGRESS, HZ); if (iforce->ctrl->status) { - dev_dbg(&iforce->dev->dev, + dev_dbg(&iforce->intf->dev, "iforce->ctrl->status = %d\n", iforce->ctrl->status); usb_unlink_urb(iforce->ctrl); diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index 15e8d6531e25..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) if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); - dev_warn(&iforce->dev->dev, "usb_submit_urb failed %d\n", n); + dev_warn(&iforce->intf->dev, "usb_submit_urb failed %d\n", n); } /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. @@ -76,7 +76,7 @@ void iforce_usb_xmit(struct iforce *iforce) static void iforce_usb_irq(struct urb *urb) { struct iforce *iforce = urb->context; - struct device *dev = &iforce->dev->dev; + struct device *dev = &iforce->intf->dev; int status; switch (urb->status) { @@ -112,7 +112,7 @@ static void iforce_usb_out(struct urb *urb) if (urb->status) { clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags); - dev_dbg(&iforce->dev->dev, "urb->status %d, exiting\n", + dev_dbg(&iforce->intf->dev, "urb->status %d, exiting\n", urb->status); return; } @@ -158,6 +158,7 @@ static int iforce_usb_probe(struct usb_interface *intf, iforce->bus = IFORCE_USB; iforce->usbdev = dev; + iforce->intf = intf; iforce->cr.bRequestType = USB_TYPE_VENDOR | USB_DIR_IN | USB_RECIP_INTERFACE; 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 { #endif #ifdef CONFIG_JOYSTICK_IFORCE_USB struct usb_device *usbdev; /* USB transfer */ + struct usb_interface *intf; struct urb *irq, *out, *ctrl; struct usb_ctrlrequest cr; #endif -- cgit v1.2.3 From 8818e4190f0e04ad20a30e7488dcdd3029b4b96d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:32:53 -0700 Subject: USB: input: xpad.c: fix up dev_* messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov CC: "Magnus Hörlin" CC: Rusty Russell CC: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/input/joystick/xpad.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 2e106b0796ce..ee16fb67b7ae 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -252,6 +252,7 @@ MODULE_DEVICE_TABLE (usb, xpad_table); struct usb_xpad { struct input_dev *dev; /* input device interface */ struct usb_device *udev; /* usb device */ + struct usb_interface *intf; /* usb interface */ int pad_present; @@ -457,7 +458,7 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha static void xpad_irq_in(struct urb *urb) { struct usb_xpad *xpad = urb->context; - struct device *dev = &xpad->dev->dev; + struct device *dev = &xpad->intf->dev; int retval, status; status = urb->status; @@ -500,7 +501,7 @@ exit: static void xpad_bulk_out(struct urb *urb) { struct usb_xpad *xpad = urb->context; - struct device *dev = &xpad->dev->dev; + struct device *dev = &xpad->intf->dev; switch (urb->status) { case 0: @@ -523,7 +524,7 @@ static void xpad_bulk_out(struct urb *urb) static void xpad_irq_out(struct urb *urb) { struct usb_xpad *xpad = urb->context; - struct device *dev = &xpad->dev->dev; + struct device *dev = &xpad->intf->dev; int retval, status; status = urb->status; @@ -855,6 +856,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id } xpad->udev = udev; + xpad->intf = intf; xpad->mapping = xpad_device[i].mapping; xpad->xtype = xpad_device[i].xtype; -- cgit v1.2.3 From ab242a73a109c227d6ed0fcccab5dd2d9e220b07 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:32:55 -0700 Subject: USB: input: cm109.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov CC: Axel Lin Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/cm109.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c index 9e76ab18e944..082684e7f390 100644 --- a/drivers/input/misc/cm109.c +++ b/drivers/input/misc/cm109.c @@ -327,7 +327,7 @@ static void cm109_submit_buzz_toggle(struct cm109_dev *dev) error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); if (error) - dev_err(&dev->idev->dev, + dev_err(&dev->intf->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n", __func__, error); } @@ -341,7 +341,7 @@ static void cm109_urb_irq_callback(struct urb *urb) const int status = urb->status; int error; - dev_dbg(&urb->dev->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n", + dev_dbg(&dev->intf->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n", dev->irq_data->byte[0], dev->irq_data->byte[1], dev->irq_data->byte[2], @@ -351,7 +351,7 @@ static void cm109_urb_irq_callback(struct urb *urb) if (status) { if (status == -ESHUTDOWN) return; - dev_err(&dev->idev->dev, "%s: urb status %d\n", __func__, status); + dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); } /* Special keys */ @@ -398,7 +398,7 @@ static void cm109_urb_irq_callback(struct urb *urb) error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC); if (error) - dev_err(&dev->idev->dev, + dev_err(&dev->intf->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n", __func__, error); } @@ -412,14 +412,14 @@ static void cm109_urb_ctl_callback(struct urb *urb) const int status = urb->status; int error; - dev_dbg(&urb->dev->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n", + dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n", dev->ctl_data->byte[0], dev->ctl_data->byte[1], dev->ctl_data->byte[2], dev->ctl_data->byte[3]); if (status) - dev_err(&dev->idev->dev, "%s: urb status %d\n", __func__, status); + dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); spin_lock(&dev->ctl_submit_lock); @@ -436,7 +436,7 @@ static void cm109_urb_ctl_callback(struct urb *urb) dev->irq_urb_pending = 1; error = usb_submit_urb(dev->urb_irq, GFP_ATOMIC); if (error) - dev_err(&dev->idev->dev, + dev_err(&dev->intf->dev, "%s: usb_submit_urb (urb_irq) failed %d\n", __func__, error); } @@ -480,7 +480,7 @@ static void cm109_toggle_buzzer_sync(struct cm109_dev *dev, int on) dev->ctl_data, USB_PKT_LEN, USB_CTRL_SET_TIMEOUT); if (error < 0 && error != -EINTR) - dev_err(&dev->idev->dev, "%s: usb_control_msg() failed %d\n", + dev_err(&dev->intf->dev, "%s: usb_control_msg() failed %d\n", __func__, error); } @@ -542,7 +542,7 @@ static int cm109_input_open(struct input_dev *idev) error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL); if (error) - dev_err(&idev->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n", + dev_err(&dev->intf->dev, "%s: usb_submit_urb (urb_ctl) failed %d\n", __func__, error); else dev->open = 1; @@ -579,7 +579,7 @@ static int cm109_input_ev(struct input_dev *idev, unsigned int type, { struct cm109_dev *dev = input_get_drvdata(idev); - dev_dbg(&dev->udev->dev, + dev_dbg(&dev->intf->dev, "input_ev: type=%u code=%u value=%d\n", type, code, value); if (type != EV_SND) -- cgit v1.2.3 From 419b1a11fbe7889f8c3e62b0ef33e8b393279563 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:32:58 -0700 Subject: USB: input: keyspan_remote.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/keyspan_remote.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c index 7f017d497d83..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) * though so it's not too big a deal */ if (dev->data.pos >= dev->data.len) { - dev_dbg(&dev->udev->dev, + dev_dbg(&dev->interface->dev, "%s - Error ran out of data. pos: %d, len: %d\n", __func__, dev->data.pos, dev->data.len); return -1; @@ -267,7 +267,7 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - dev_err(&remote->input->dev, + dev_err(&remote->interface->dev, "%s - Unknown sequence found in system data.\n", __func__); remote->stage = 0; @@ -288,7 +288,7 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - dev_err(&remote->input->dev, + dev_err(&remote->interface->dev, "%s - Unknown sequence found in button data.\n", __func__); remote->stage = 0; @@ -306,7 +306,7 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - dev_err(&remote->input->dev, + dev_err(&remote->interface->dev, "%s - Error in message, invalid toggle.\n", __func__); remote->stage = 0; @@ -318,11 +318,11 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 5; remote->data.bits_left -= 5; } else { - dev_err(&remote->input->dev, + dev_err(&remote->interface->dev, "Bad message received, no stop bit found.\n"); } - dev_dbg(&remote->udev->dev, + dev_dbg(&remote->interface->dev, "%s found valid message: system: %d, button: %d, toggle: %d\n", __func__, message.system, message.button, message.toggle); @@ -404,7 +404,7 @@ static void keyspan_irq_recv(struct urb *urb) resubmit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&dev->input->dev, + dev_err(&dev->interface->dev, "%s - usb_submit_urb failed with result: %d\n", __func__, retval); } -- cgit v1.2.3 From c25e647836cd53f2da7ceff6fabf2603b4362212 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:33:00 -0700 Subject: USB: input: powermate.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/powermate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c index d16717e8e9c4..49c0c3ebd321 100644 --- a/drivers/input/misc/powermate.c +++ b/drivers/input/misc/powermate.c @@ -65,6 +65,7 @@ struct powermate_device { struct urb *irq, *config; struct usb_ctrlrequest *configcr; struct usb_device *udev; + struct usb_interface *intf; struct input_dev *input; spinlock_t lock; int static_brightness; @@ -85,7 +86,7 @@ static void powermate_config_complete(struct urb *urb); static void powermate_irq(struct urb *urb) { struct powermate_device *pm = urb->context; - struct device *dev = &pm->input->dev; + struct device *dev = &pm->intf->dev; int retval; switch (urb->status) { @@ -333,6 +334,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i goto fail3; pm->udev = udev; + pm->intf = intf; pm->input = input_dev; usb_make_path(udev, pm->phys, sizeof(pm->phys)); -- cgit v1.2.3 From 73e66ceada0b51279ffd4a6f5bffe79d7168d4e8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:33:01 -0700 Subject: USB: input: yealink.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Henk Vergonet CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/misc/yealink.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c index 37b126c06fc1..285a5bd6cbc9 100644 --- a/drivers/input/misc/yealink.c +++ b/drivers/input/misc/yealink.c @@ -101,6 +101,7 @@ static const struct lcd_segment_map { struct yealink_dev { struct input_dev *idev; /* input device */ struct usb_device *udev; /* usb device */ + struct usb_interface *intf; /* usb interface */ /* irq input channel */ struct yld_ctl_packet *irq_data; @@ -428,7 +429,7 @@ static void urb_irq_callback(struct urb *urb) int ret, status = urb->status; if (status) - dev_err(&yld->idev->dev, "%s - urb status %d\n", + dev_err(&yld->intf->dev, "%s - urb status %d\n", __func__, status); switch (yld->irq_data->cmd) { @@ -438,14 +439,14 @@ static void urb_irq_callback(struct urb *urb) break; case CMD_SCANCODE: - dev_dbg(&yld->idev->dev, "get scancode %x\n", + dev_dbg(&yld->intf->dev, "get scancode %x\n", yld->irq_data->data[0]); report_key(yld, map_p1k_to_key(yld->irq_data->data[0])); break; default: - dev_err(&yld->idev->dev, "unexpected response %x\n", + dev_err(&yld->intf->dev, "unexpected response %x\n", yld->irq_data->cmd); } @@ -454,7 +455,7 @@ static void urb_irq_callback(struct urb *urb) if (!yld->shutdown) { ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); if (ret && ret != -EPERM) - dev_err(&yld->idev->dev, + dev_err(&yld->intf->dev, "%s - usb_submit_urb failed %d\n", __func__, ret); } @@ -466,7 +467,7 @@ static void urb_ctl_callback(struct urb *urb) int ret = 0, status = urb->status; if (status) - dev_err(&yld->idev->dev, "%s - urb status %d\n", + dev_err(&yld->intf->dev, "%s - urb status %d\n", __func__, status); switch (yld->ctl_data->cmd) { @@ -485,7 +486,7 @@ static void urb_ctl_callback(struct urb *urb) } if (ret && ret != -EPERM) - dev_err(&yld->idev->dev, "%s - usb_submit_urb failed %d\n", + dev_err(&yld->intf->dev, "%s - usb_submit_urb failed %d\n", __func__, ret); } @@ -518,7 +519,7 @@ static int input_open(struct input_dev *dev) struct yealink_dev *yld = input_get_drvdata(dev); int i, ret; - dev_dbg(&yld->idev->dev, "%s\n", __func__); + dev_dbg(&yld->intf->dev, "%s\n", __func__); /* force updates to device */ for (i = 0; imaster); i++) @@ -533,7 +534,7 @@ static int input_open(struct input_dev *dev) yld->ctl_data->size = 10; yld->ctl_data->sum = 0x100-CMD_INIT-10; if ((ret = usb_submit_urb(yld->urb_ctl, GFP_KERNEL)) != 0) { - dev_dbg(&yld->idev->dev, + dev_dbg(&yld->intf->dev, "%s - usb_submit_urb failed with result %d\n", __func__, ret); return ret; @@ -884,6 +885,7 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) return -ENOMEM; yld->udev = udev; + yld->intf = intf; yld->idev = input_dev = input_allocate_device(); if (!input_dev) -- cgit v1.2.3 From 2d744b09199d2481c99563fdcf7f1c60f87fd965 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:33:01 -0700 Subject: USB: input: appletouch.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Alessandro Rubini CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/appletouch.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index d0a590f87c2b..38268e8ea469 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c @@ -195,6 +195,7 @@ enum atp_status_bits { struct atp { char phys[64]; struct usb_device *udev; /* usb device */ + struct usb_interface *intf; /* usb interface */ struct urb *urb; /* usb request block */ u8 *data; /* transferred data */ struct input_dev *input; /* input dev */ @@ -263,7 +264,7 @@ static int atp_geyser_init(struct atp *dev) data = kmalloc(8, GFP_KERNEL); if (!data) { - dev_err(&dev->input->dev, "Out of memory\n"); + dev_err(&dev->intf->dev, "Out of memory\n"); return -ENOMEM; } @@ -278,7 +279,7 @@ static int atp_geyser_init(struct atp *dev) for (i = 0; i < 8; i++) dprintk("appletouch[%d]: %d\n", i, data[i]); - dev_err(&dev->input->dev, "Failed to read mode from device.\n"); + dev_err(&dev->intf->dev, "Failed to read mode from device.\n"); ret = -EIO; goto out_free; } @@ -297,7 +298,7 @@ static int atp_geyser_init(struct atp *dev) for (i = 0; i < 8; i++) dprintk("appletouch[%d]: %d\n", i, data[i]); - dev_err(&dev->input->dev, "Failed to request geyser raw mode\n"); + dev_err(&dev->intf->dev, "Failed to request geyser raw mode\n"); ret = -EIO; goto out_free; } @@ -321,7 +322,7 @@ static void atp_reinit(struct work_struct *work) retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - dev_err(&dev->input->dev, + dev_err(&dev->intf->dev, "atp_reinit: usb_submit_urb failed with error %d\n", retval); } @@ -402,6 +403,7 @@ static int atp_status_check(struct urb *urb) { struct atp *dev = urb->context; struct input_dev *idev = dev->input; + struct usb_interface *intf = dev->intf; switch (urb->status) { case 0: @@ -409,7 +411,7 @@ static int atp_status_check(struct urb *urb) break; case -EOVERFLOW: if (!dev->overflow_warned) { - dev_warn(&idev->dev, + dev_warn(&intf->dev, "appletouch: OVERFLOW with data length %d, actual length is %d\n", dev->info->datalen, dev->urb->actual_length); dev->overflow_warned = true; @@ -418,13 +420,13 @@ static int atp_status_check(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* This urb is terminated, clean up */ - dev_dbg(&idev->dev, + dev_dbg(&intf->dev, "atp_complete: urb shutting down with status: %d\n", urb->status); return ATP_URB_STATUS_ERROR_FATAL; default: - dev_dbg(&idev->dev, + dev_dbg(&intf->dev, "atp_complete: nonzero urb status received: %d\n", urb->status); return ATP_URB_STATUS_ERROR; @@ -449,7 +451,7 @@ static void atp_detect_size(struct atp *dev) for (i = dev->info->xsensors; i < ATP_XSENSORS; i++) { if (dev->xy_cur[i]) { - dev_info(&dev->input->dev, + dev_info(&dev->intf->dev, "appletouch: 17\" model detected.\n"); input_set_abs_params(dev->input, ABS_X, 0, @@ -593,7 +595,7 @@ static void atp_complete_geyser_1_2(struct urb *urb) exit: retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - dev_err(&dev->input->dev, + dev_err(&dev->intf->dev, "atp_complete: usb_submit_urb failed with result %d\n", retval); } @@ -728,7 +730,7 @@ static void atp_complete_geyser_3_4(struct urb *urb) exit: retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) - dev_err(&dev->input->dev, + dev_err(&dev->intf->dev, "atp_complete: usb_submit_urb failed with result %d\n", retval); } @@ -760,7 +762,7 @@ static int atp_handle_geyser(struct atp *dev) if (atp_geyser_init(dev)) return -EIO; - dev_info(&dev->input->dev, "Geyser mode initialized.\n"); + dev_info(&dev->intf->dev, "Geyser mode initialized.\n"); } return 0; @@ -803,6 +805,7 @@ static int atp_probe(struct usb_interface *iface, } dev->udev = udev; + dev->intf = iface; dev->input = input_dev; dev->info = info; dev->overflow_warned = false; @@ -891,7 +894,7 @@ static void atp_disconnect(struct usb_interface *iface) usb_free_urb(dev->urb); kfree(dev); } - printk(KERN_INFO "input: appletouch disconnected\n"); + dev_info(&iface->dev, "input: appletouch disconnected\n"); } static int atp_recover(struct atp *dev) -- cgit v1.2.3 From ab943ca8942c50b7c35c561103efb4622c5bfb85 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:33:02 -0700 Subject: USB: input: bcm5974.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Henrik Rydberg CC: Alessandro Rubini CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/bcm5974.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index e32928ee7cc2..2cf681d98c0d 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c @@ -584,7 +584,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) int retval = 0, size; if (!data) { - dev_err(&dev->input->dev, "out of memory\n"); + dev_err(&dev->intf->dev, "out of memory\n"); retval = -ENOMEM; goto out; } @@ -597,7 +597,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); if (size != 8) { - dev_err(&dev->input->dev, "could not read from device\n"); + dev_err(&dev->intf->dev, "could not read from device\n"); retval = -EIO; goto out; } @@ -615,7 +615,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); if (size != 8) { - dev_err(&dev->input->dev, "could not write to device\n"); + dev_err(&dev->intf->dev, "could not write to device\n"); retval = -EIO; goto out; } @@ -631,7 +631,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) static void bcm5974_irq_button(struct urb *urb) { struct bcm5974 *dev = urb->context; - struct input_dev *idev = dev->input; + struct usb_interface *intf = dev->intf; int error; switch (urb->status) { @@ -641,11 +641,11 @@ static void bcm5974_irq_button(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dev_dbg(&idev->dev, "button urb shutting down: %d\n", + dev_dbg(&intf->dev, "button urb shutting down: %d\n", urb->status); return; default: - dev_dbg(&idev->dev, "button urb status: %d\n", urb->status); + dev_dbg(&intf->dev, "button urb status: %d\n", urb->status); goto exit; } @@ -656,13 +656,13 @@ static void bcm5974_irq_button(struct urb *urb) exit: error = usb_submit_urb(dev->bt_urb, GFP_ATOMIC); if (error) - dev_err(&idev->dev, "button urb failed: %d\n", error); + dev_err(&intf->dev, "button urb failed: %d\n", error); } static void bcm5974_irq_trackpad(struct urb *urb) { struct bcm5974 *dev = urb->context; - struct input_dev *idev = dev->input; + struct usb_interface *intf = dev->intf; int error; switch (urb->status) { @@ -672,11 +672,11 @@ static void bcm5974_irq_trackpad(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dev_dbg(&idev->dev, "trackpad urb shutting down: %d\n", + dev_dbg(&intf->dev, "trackpad urb shutting down: %d\n", urb->status); return; default: - dev_dbg(&idev->dev, "trackpad urb status: %d\n", urb->status); + dev_dbg(&intf->dev, "trackpad urb status: %d\n", urb->status); goto exit; } @@ -691,7 +691,7 @@ static void bcm5974_irq_trackpad(struct urb *urb) exit: error = usb_submit_urb(dev->tp_urb, GFP_ATOMIC); if (error) - dev_err(&idev->dev, "trackpad urb failed: %d\n", error); + dev_err(&intf->dev, "trackpad urb failed: %d\n", error); } /* -- cgit v1.2.3 From 334698d435b4446d796a2059284256b9d28a0d19 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:33:04 -0700 Subject: USB: input: acecad.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/acecad.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c index baa9d4ad0d00..e062ec899ca1 100644 --- a/drivers/input/tablet/acecad.c +++ b/drivers/input/tablet/acecad.c @@ -51,6 +51,7 @@ struct usb_acecad { char name[128]; char phys[64]; struct usb_device *usbdev; + struct usb_interface *intf; struct input_dev *input; struct urb *irq; @@ -63,6 +64,7 @@ static void usb_acecad_irq(struct urb *urb) struct usb_acecad *acecad = urb->context; unsigned char *data = acecad->data; struct input_dev *dev = acecad->input; + struct usb_interface *intf = acecad->intf; int prox, status; switch (urb->status) { @@ -73,11 +75,11 @@ static void usb_acecad_irq(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dev_dbg(&dev->dev, "%s - urb shutting down with status: %d\n", + dev_dbg(&intf->dev, "%s - urb shutting down with status: %d\n", __func__, urb->status); return; default: - dev_dbg(&dev->dev, "%s - nonzero urb status received: %d\n", + dev_dbg(&intf->dev, "%s - nonzero urb status received: %d\n", __func__, urb->status); goto resubmit; } @@ -107,7 +109,7 @@ static void usb_acecad_irq(struct urb *urb) resubmit: status = usb_submit_urb(urb, GFP_ATOMIC); if (status) - dev_err(&dev->dev, + dev_err(&intf->dev, "can't resubmit intr, %s-%s/input0, status %d\n", acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); @@ -172,6 +174,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ } acecad->usbdev = dev; + acecad->intf = intf; acecad->input = input_dev; if (dev->manufacturer) -- cgit v1.2.3 From 871ba51c130d4f2e7d33b8c57e834df701357102 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:33:06 -0700 Subject: USB: input: aiptek.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov CC: Jesper Juhl CC: JJ Ding CC: Edwin van Vliet Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/aiptek.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index 37dba769bf0f..755a39e4c9e9 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c @@ -309,6 +309,7 @@ struct aiptek_settings { struct aiptek { struct input_dev *inputdev; /* input device struct */ struct usb_device *usbdev; /* usb device struct */ + struct usb_interface *intf; /* usb interface struct */ struct urb *urb; /* urb for incoming reports */ dma_addr_t data_dma; /* our dma stuffage */ struct aiptek_features features; /* tablet's array of features */ @@ -435,6 +436,7 @@ static void aiptek_irq(struct urb *urb) struct aiptek *aiptek = urb->context; unsigned char *data = aiptek->data; struct input_dev *inputdev = aiptek->inputdev; + struct usb_interface *intf = aiptek->intf; int jitterable = 0; int retval, macro, x, y, z, left, right, middle, p, dv, tip, bs, pck; @@ -447,14 +449,12 @@ static void aiptek_irq(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* This urb is terminated, clean up */ - dev_dbg(&inputdev->dev, - "%s - urb shutting down with status: %d\n", + dev_dbg(&intf->dev, "%s - urb shutting down with status: %d\n", __func__, urb->status); return; default: - dev_dbg(&inputdev->dev, - "%s - nonzero urb status received: %d\n", + dev_dbg(&intf->dev, "%s - nonzero urb status received: %d\n", __func__, urb->status); goto exit; } @@ -787,7 +787,7 @@ static void aiptek_irq(struct urb *urb) 1 | AIPTEK_REPORT_TOOL_UNKNOWN); input_sync(inputdev); } else { - dev_dbg(&inputdev->dev, "Unknown report %d\n", data[0]); + dev_dbg(&intf->dev, "Unknown report %d\n", data[0]); } /* Jitter may occur when the user presses a button on the stlyus @@ -813,7 +813,7 @@ static void aiptek_irq(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval != 0) { - dev_err(&inputdev->dev, + dev_err(&intf->dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } @@ -915,7 +915,7 @@ aiptek_command(struct aiptek *aiptek, unsigned char command, unsigned char data) if ((ret = aiptek_set_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { - dev_dbg(&aiptek->inputdev->dev, + dev_dbg(&aiptek->intf->dev, "aiptek_program: failed, tried to send: 0x%02x 0x%02x\n", command, data); } @@ -951,7 +951,7 @@ aiptek_query(struct aiptek *aiptek, unsigned char command, unsigned char data) if ((ret = aiptek_get_report(aiptek, 3, 2, buf, sizeof_buf)) != sizeof_buf) { - dev_dbg(&aiptek->inputdev->dev, + dev_dbg(&aiptek->intf->dev, "aiptek_query failed: returned 0x%02x 0x%02x 0x%02x\n", buf[0], buf[1], buf[2]); ret = -EIO; @@ -1731,6 +1731,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) aiptek->inputdev = inputdev; aiptek->usbdev = usbdev; + aiptek->intf = intf; aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; aiptek->inDelay = 0; aiptek->endDelay = 0; -- cgit v1.2.3 From 27c2597d455a24507f1d0be6991a0a84b5c1b035 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:33:09 -0700 Subject: USB: input: gtco.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/gtco.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 422b1a2ef309..29e01ab6859f 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c @@ -106,6 +106,7 @@ struct gtco { struct input_dev *inputdevice; /* input device struct pointer */ struct usb_device *usbdev; /* the usb device for this device */ + struct usb_interface *intf; /* the usb interface for this device */ struct urb *urbinfo; /* urb for incoming reports */ dma_addr_t buf_dma; /* dma addr of the data buffer*/ unsigned char * buffer; /* databuffer for reports */ @@ -200,7 +201,7 @@ struct hid_descriptor static void parse_hid_report_descriptor(struct gtco *device, char * report, int length) { - struct device *ddev = &device->inputdevice->dev; + struct device *ddev = &device->intf->dev; int x, i = 0; /* Tag primitive vars */ @@ -713,7 +714,7 @@ static void gtco_urb_callback(struct urb *urbinfo) * the rest as 0 */ val = device->buffer[5] & MASK_BUTTON; - dev_dbg(&inputdev->dev, + dev_dbg(&device->intf->dev, "======>>>>>>REPORT 1: val 0x%X(%d)\n", val, val); @@ -808,7 +809,7 @@ static void gtco_urb_callback(struct urb *urbinfo) resubmit: rc = usb_submit_urb(urbinfo, GFP_ATOMIC); if (rc != 0) - dev_err(&inputdev->dev, + dev_err(&device->intf->dev, "usb_submit_urb failed rc=0x%x\n", rc); } @@ -849,6 +850,7 @@ static int gtco_probe(struct usb_interface *usbinterface, /* Save interface information */ gtco->usbdev = usb_get_dev(interface_to_usbdev(usbinterface)); + gtco->intf = usbinterface; /* Allocate some data for incoming reports */ gtco->buffer = usb_alloc_coherent(gtco->usbdev, REPORT_MAX_SIZE, -- cgit v1.2.3 From ed2b2f2db2d52098bdda3877367d59984febdd9f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:33:11 -0700 Subject: USB: input: kbtab.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/kbtab.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c index a39d1761a6cb..3fba74b9b602 100644 --- a/drivers/input/tablet/kbtab.c +++ b/drivers/input/tablet/kbtab.c @@ -33,6 +33,7 @@ struct kbtab { dma_addr_t data_dma; struct input_dev *dev; struct usb_device *usbdev; + struct usb_interface *intf; struct urb *irq; char phys[32]; }; @@ -53,11 +54,13 @@ static void kbtab_irq(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dev_dbg(&dev->dev, "%s - urb shutting down with status: %d\n", + dev_dbg(&kbtab->intf->dev, + "%s - urb shutting down with status: %d\n", __func__, urb->status); return; default: - dev_dbg(&dev->dev, "%s - nonzero urb status received: %d\n", + dev_dbg(&kbtab->intf->dev, + "%s - nonzero urb status received: %d\n", __func__, urb->status); goto exit; } @@ -82,7 +85,7 @@ static void kbtab_irq(struct urb *urb) exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&dev->dev, + dev_err(&kbtab->intf->dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } @@ -134,6 +137,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i goto fail2; kbtab->usbdev = dev; + kbtab->intf = intf; kbtab->dev = input_dev; usb_make_path(dev, kbtab->phys, sizeof(kbtab->phys)); -- cgit v1.2.3 From 65e78a2062d5e56f906d52c45820d08711d2c2e2 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:33:13 -0700 Subject: USB: input: wacom_sys.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov CC: Ping Cheng CC: Chris Bagwell CC: Eduard Hasenleithner Signed-off-by: Greg Kroah-Hartman --- drivers/input/tablet/wacom_sys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index ac29a68ac53e..79a0509882d4 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -99,7 +99,7 @@ static int wacom_set_report(struct usb_interface *intf, u8 type, u8 id, static void wacom_sys_irq(struct urb *urb) { struct wacom *wacom = urb->context; - struct device *dev = &wacom->wacom_wac.input->dev; + struct device *dev = &wacom->intf->dev; int retval; switch (urb->status) { @@ -820,7 +820,7 @@ static int wacom_initialize_leds(struct wacom *wacom) } if (error) { - dev_err(&wacom->wacom_wac.input->dev, + dev_err(&wacom->intf->dev, "cannot create sysfs group err: %d\n", error); return error; } -- cgit v1.2.3 From 0a5ebc88c74d8029e80a72e57cbebc0b3b4e5d98 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:33:16 -0700 Subject: USB: input: usbtouchscreen.c: fix up dev_* messages Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov CC: Henrik Rydberg CC: Rusty Russell CC: Viresh Kumar CC: Armando Visconti Signed-off-by: Greg Kroah-Hartman --- drivers/input/touchscreen/usbtouchscreen.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 100eded96b0e..e32709e0dd65 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c @@ -269,7 +269,7 @@ static int e2i_init(struct usbtouch_usb *usbtouch) 0x01, 0x02, 0x0000, 0x0081, NULL, 0, USB_CTRL_SET_TIMEOUT); - dev_dbg(&usbtouch->input->dev, + dev_dbg(&usbtouch->interface->dev, "%s - usb_control_msg - E2I_RESET - bytes|err: %d\n", __func__, ret); return ret; @@ -426,7 +426,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) MTOUCHUSB_RESET, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); - dev_dbg(&usbtouch->input->dev, + dev_dbg(&usbtouch->interface->dev, "%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d\n", __func__, ret); if (ret < 0) @@ -438,7 +438,7 @@ static int mtouch_init(struct usbtouch_usb *usbtouch) MTOUCHUSB_ASYNC_REPORT, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 1, 1, NULL, 0, USB_CTRL_SET_TIMEOUT); - dev_dbg(&usbtouch->input->dev, + dev_dbg(&usbtouch->interface->dev, "%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d\n", __func__, ret); if (ret >= 0) @@ -740,29 +740,29 @@ static int jastec_read_data(struct usbtouch_usb *dev, unsigned char *pkt) #ifdef CONFIG_TOUCHSCREEN_USB_ZYTRONIC static int zytronic_read_data(struct usbtouch_usb *dev, unsigned char *pkt) { - struct input_dev *input = dev->input; + struct usb_interface *intf = dev->interface; switch (pkt[0]) { case 0x3A: /* command response */ - dev_dbg(&input->dev, "%s: Command response %d\n", __func__, pkt[1]); + dev_dbg(&intf->dev, "%s: Command response %d\n", __func__, pkt[1]); break; case 0xC0: /* down */ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); dev->touch = 1; - dev_dbg(&input->dev, "%s: down %d,%d\n", __func__, dev->x, dev->y); + dev_dbg(&intf->dev, "%s: down %d,%d\n", __func__, dev->x, dev->y); return 1; case 0x80: /* up */ dev->x = (pkt[1] & 0x7f) | ((pkt[2] & 0x07) << 7); dev->y = (pkt[3] & 0x7f) | ((pkt[4] & 0x07) << 7); dev->touch = 0; - dev_dbg(&input->dev, "%s: up %d,%d\n", __func__, dev->x, dev->y); + dev_dbg(&intf->dev, "%s: up %d,%d\n", __func__, dev->x, dev->y); return 1; default: - dev_dbg(&input->dev, "%s: Unknown return %d\n", __func__, pkt[0]); + dev_dbg(&intf->dev, "%s: Unknown return %d\n", __func__, pkt[0]); break; } @@ -817,7 +817,7 @@ static int nexio_alloc(struct usbtouch_usb *usbtouch) priv->ack = usb_alloc_urb(0, GFP_KERNEL); if (!priv->ack) { - dev_dbg(&usbtouch->input->dev, + dev_dbg(&usbtouch->interface->dev, "%s - usb_alloc_urb failed: usbtouch->ack\n", __func__); goto err_ack_buf; } @@ -1355,7 +1355,7 @@ out_flush_buf: static void usbtouch_irq(struct urb *urb) { struct usbtouch_usb *usbtouch = urb->context; - struct device *dev = &usbtouch->input->dev; + struct device *dev = &usbtouch->interface->dev; int retval; switch (urb->status) { @@ -1388,8 +1388,7 @@ exit: usb_mark_last_busy(interface_to_usbdev(usbtouch->interface)); retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - dev_err(&usbtouch->input->dev, - "%s - usb_submit_urb failed with result: %d\n", + dev_err(dev, "%s - usb_submit_urb failed with result: %d\n", __func__, retval); } @@ -1465,7 +1464,7 @@ static int usbtouch_reset_resume(struct usb_interface *intf) if (usbtouch->type->init) { err = usbtouch->type->init(usbtouch); if (err) { - dev_dbg(&input->dev, + dev_dbg(&intf->dev, "%s - type->init() failed, err: %d\n", __func__, err); return err; @@ -1639,7 +1638,7 @@ static int usbtouch_probe(struct usb_interface *intf, err = usb_submit_urb(usbtouch->irq, GFP_KERNEL); if (err) { usb_autopm_put_interface(intf); - dev_err(&input_dev->dev, + dev_err(&intf->dev, "%s - usb_submit_urb failed with result: %d\n", __func__, err); goto out_unregister_input; @@ -1671,7 +1670,7 @@ static void usbtouch_disconnect(struct usb_interface *intf) if (!usbtouch) return; - dev_dbg(&usbtouch->input->dev, + dev_dbg(&intf->dev, "%s - usbtouch is initialized, cleaning up\n", __func__); usb_set_intfdata(intf, NULL); -- cgit v1.2.3 From 3b923993daaa38f1ae297a79f734c308866dd026 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 4 May 2012 15:35:56 -0700 Subject: USB: input: appletouch: fix up compiler warning My last patch fixing up the dev_* messages caused a compiler warning accidentally for an unused variable. Fix this up, as it was my fault. Cc: Alessandro Rubini Cc: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/mouse/appletouch.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index 38268e8ea469..e42f1fa8cdc0 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c @@ -402,7 +402,6 @@ static inline void atp_report_fingers(struct input_dev *input, int fingers) static int atp_status_check(struct urb *urb) { struct atp *dev = urb->context; - struct input_dev *idev = dev->input; struct usb_interface *intf = dev->intf; switch (urb->status) { -- cgit v1.2.3 From c8e1fb4a67eed95364a50f33f5201a88877c5215 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 14 May 2012 08:07:44 -0300 Subject: [media] Input: move drivers/input/fixp-arith.h to include/linux Move drivers/input/fixp-arith.h to include/linux so that the functions defined there can be used by other subsystems, for instance some video devices ISPs can control the output HUE value by setting registers for sin(HUE) and cos(HUE). Signed-off-by: Antonio Ospite Acked-by: Dmitry Torokhov Signed-off-by: Mauro Carvalho Chehab --- drivers/input/ff-memless.c | 3 +- drivers/input/fixp-arith.h | 87 ---------------------------------------------- include/linux/fixp-arith.h | 87 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 89 deletions(-) delete mode 100644 drivers/input/fixp-arith.h create mode 100644 include/linux/fixp-arith.h (limited to 'drivers/input') diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c index 117a59aaa70e..5f558851d646 100644 --- a/drivers/input/ff-memless.c +++ b/drivers/input/ff-memless.c @@ -31,8 +31,7 @@ #include #include #include - -#include "fixp-arith.h" +#include MODULE_LICENSE("GPL"); MODULE_AUTHOR("Anssi Hannula "); 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 @@ -#ifndef _FIXP_ARITH_H -#define _FIXP_ARITH_H - -/* - * Simplistic fixed-point arithmetics. - * Hmm, I'm probably duplicating some code :( - * - * Copyright (c) 2002 Johann Deneux - */ - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Should you need to contact me, the author, you can do so by - * e-mail - mail your message to - */ - -#include - -/* The type representing fixed-point values */ -typedef s16 fixp_t; - -#define FRAC_N 8 -#define FRAC_MASK ((1< 123.0 */ -static inline fixp_t fixp_new(s16 a) -{ - return a< -1.0 - 0x8000 -> 1.0 - 0x0000 -> 0.0 -*/ -static inline fixp_t fixp_new16(s16 a) -{ - return ((s32)a)>>(16-FRAC_N); -} - -static inline fixp_t fixp_cos(unsigned int degrees) -{ - int quadrant = (degrees / 90) & 3; - unsigned int i = degrees % 90; - - if (quadrant == 1 || quadrant == 3) - i = 90 - i; - - i >>= 1; - - return (quadrant == 1 || quadrant == 2)? -cos_table[i] : cos_table[i]; -} - -static inline fixp_t fixp_sin(unsigned int degrees) -{ - return -fixp_cos(degrees + 90); -} - -static inline fixp_t fixp_mult(fixp_t a, fixp_t b) -{ - return ((s32)(a*b))>>FRAC_N; -} - -#endif diff --git a/include/linux/fixp-arith.h b/include/linux/fixp-arith.h new file mode 100644 index 000000000000..3089d7382325 --- /dev/null +++ b/include/linux/fixp-arith.h @@ -0,0 +1,87 @@ +#ifndef _FIXP_ARITH_H +#define _FIXP_ARITH_H + +/* + * Simplistic fixed-point arithmetics. + * Hmm, I'm probably duplicating some code :( + * + * Copyright (c) 2002 Johann Deneux + */ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Should you need to contact me, the author, you can do so by + * e-mail - mail your message to + */ + +#include + +/* The type representing fixed-point values */ +typedef s16 fixp_t; + +#define FRAC_N 8 +#define FRAC_MASK ((1< 123.0 */ +static inline fixp_t fixp_new(s16 a) +{ + return a< -1.0 + 0x8000 -> 1.0 + 0x0000 -> 0.0 +*/ +static inline fixp_t fixp_new16(s16 a) +{ + return ((s32)a)>>(16-FRAC_N); +} + +static inline fixp_t fixp_cos(unsigned int degrees) +{ + int quadrant = (degrees / 90) & 3; + unsigned int i = degrees % 90; + + if (quadrant == 1 || quadrant == 3) + i = 90 - i; + + i >>= 1; + + return (quadrant == 1 || quadrant == 2)? -cos_table[i] : cos_table[i]; +} + +static inline fixp_t fixp_sin(unsigned int degrees) +{ + return -fixp_cos(degrees + 90); +} + +static inline fixp_t fixp_mult(fixp_t a, fixp_t b) +{ + return ((s32)(a*b))>>FRAC_N; +} + +#endif -- cgit v1.2.3 From cd99758ba3bde64347a8ece381cbae2fb5c745b2 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 14 May 2012 23:14:24 +0200 Subject: mfd: Convert wm831x to irq_domain The modern idiom is to use irq_domain to allocate interrupts. This is useful partly to allow further infrastructure to be based on the domains and partly because it makes it much easier to allocate virtual interrupts to devices as we don't need to allocate a contiguous range of interrupt numbers. Convert the wm831x driver over to this infrastructure, using a legacy IRQ mapping if an irq_base is specified in platform data and otherwise using a linear mapping, always registering the interrupts even if they won't ever be used. Only boards which need to use the GPIOs as interrupts should need to use an irq_base. This means that we can't use the MFD irq_base management since the unless we're using an explicit irq_base from platform data we can't rely on a linear mapping of interrupts. Instead we need to map things via the irq_domain - provide a conveniencem function wm831x_irq() to save a small amount of typing when doing so. Looking at this I couldn't clearly see anything the MFD core could do to make this nicer. Since we're not supporting device tree yet there's no meaningful advantage if we don't do this conversion in one, the fact that the interrupt resources are used for repeated IP blocks makes accessor functions for the irq_domain more trouble to do than they're worth. Signed-off-by: Mark Brown Signed-off-by: Samuel Ortiz --- drivers/gpio/gpio-wm831x.c | 6 +- drivers/input/misc/wm831x-on.c | 2 +- drivers/input/touchscreen/wm831x-ts.c | 9 +-- drivers/mfd/Kconfig | 2 + drivers/mfd/wm831x-auxadc.c | 6 +- drivers/mfd/wm831x-core.c | 19 +++---- drivers/mfd/wm831x-irq.c | 101 +++++++++++++++++++++------------- drivers/power/wm831x_power.c | 21 ++++--- drivers/regulator/wm831x-dcdc.c | 24 +++++--- drivers/regulator/wm831x-isink.c | 4 +- drivers/regulator/wm831x-ldo.c | 10 ++-- drivers/rtc/rtc-wm831x.c | 2 +- include/linux/mfd/wm831x/core.h | 9 ++- 13 files changed, 131 insertions(+), 84 deletions(-) (limited to 'drivers/input') diff --git a/drivers/gpio/gpio-wm831x.c b/drivers/gpio/gpio-wm831x.c index deb949e75ec1..e56a2165641c 100644 --- a/drivers/gpio/gpio-wm831x.c +++ b/drivers/gpio/gpio-wm831x.c @@ -102,10 +102,8 @@ static int wm831x_gpio_to_irq(struct gpio_chip *chip, unsigned offset) struct wm831x_gpio *wm831x_gpio = to_wm831x_gpio(chip); struct wm831x *wm831x = wm831x_gpio->wm831x; - if (!wm831x->irq_base) - return -EINVAL; - - return wm831x->irq_base + WM831X_IRQ_GPIO_1 + offset; + return irq_create_mapping(wm831x->irq_domain, + WM831X_IRQ_GPIO_1 + offset); } static int wm831x_gpio_set_debounce(struct gpio_chip *chip, unsigned offset, 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) { struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x_on *wm831x_on; - int irq = platform_get_irq(pdev, 0); + int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); int ret; wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL); 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) * If we have a direct IRQ use it, otherwise use the interrupt * from the WM831x IRQ controller. */ + wm831x_ts->data_irq = wm831x_irq(wm831x, + platform_get_irq_byname(pdev, + "TCHDATA")); if (pdata && pdata->data_irq) wm831x_ts->data_irq = pdata->data_irq; - else - wm831x_ts->data_irq = platform_get_irq_byname(pdev, "TCHDATA"); + wm831x_ts->pd_irq = wm831x_irq(wm831x, + platform_get_irq_byname(pdev, "TCHPD")); if (pdata && pdata->pd_irq) wm831x_ts->pd_irq = pdata->pd_irq; - else - wm831x_ts->pd_irq = platform_get_irq_byname(pdev, "TCHPD"); if (pdata) wm831x_ts->pressure = pdata->pressure; diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index a0e1b834af61..8325c44c04c6 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -496,6 +496,7 @@ config MFD_WM831X_I2C select MFD_CORE select MFD_WM831X select REGMAP_I2C + select IRQ_DOMAIN depends on I2C=y && GENERIC_HARDIRQS help Support for the Wolfson Microelecronics WM831x and WM832x PMICs @@ -508,6 +509,7 @@ config MFD_WM831X_SPI select MFD_CORE select MFD_WM831X select REGMAP_SPI + select IRQ_DOMAIN depends on SPI_MASTER && GENERIC_HARDIRQS help Support for the Wolfson Microelecronics WM831x and WM832x PMICs diff --git a/drivers/mfd/wm831x-auxadc.c b/drivers/mfd/wm831x-auxadc.c index 87210954a066..6ee3018d8653 100644 --- a/drivers/mfd/wm831x-auxadc.c +++ b/drivers/mfd/wm831x-auxadc.c @@ -280,11 +280,11 @@ void wm831x_auxadc_init(struct wm831x *wm831x) mutex_init(&wm831x->auxadc_lock); INIT_LIST_HEAD(&wm831x->auxadc_pending); - if (wm831x->irq && wm831x->irq_base) { + if (wm831x->irq) { wm831x->auxadc_read = wm831x_auxadc_read_irq; - ret = request_threaded_irq(wm831x->irq_base + - WM831X_IRQ_AUXADC_DATA, + ret = request_threaded_irq(wm831x_irq(wm831x, + WM831X_IRQ_AUXADC_DATA), NULL, wm831x_auxadc_irq, 0, "auxadc", wm831x); if (ret < 0) { diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 476e4d31a823..946698fd2dc6 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c @@ -1813,27 +1813,27 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) case WM8310: ret = mfd_add_devices(wm831x->dev, wm831x_num, wm8310_devs, ARRAY_SIZE(wm8310_devs), - NULL, wm831x->irq_base); + NULL, 0); break; case WM8311: ret = mfd_add_devices(wm831x->dev, wm831x_num, wm8311_devs, ARRAY_SIZE(wm8311_devs), - NULL, wm831x->irq_base); + NULL, 0); if (!pdata || !pdata->disable_touch) mfd_add_devices(wm831x->dev, wm831x_num, touch_devs, ARRAY_SIZE(touch_devs), - NULL, wm831x->irq_base); + NULL, 0); break; case WM8312: ret = mfd_add_devices(wm831x->dev, wm831x_num, wm8312_devs, ARRAY_SIZE(wm8312_devs), - NULL, wm831x->irq_base); + NULL, 0); if (!pdata || !pdata->disable_touch) mfd_add_devices(wm831x->dev, wm831x_num, touch_devs, ARRAY_SIZE(touch_devs), - NULL, wm831x->irq_base); + NULL, 0); break; case WM8320: @@ -1842,7 +1842,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) case WM8326: ret = mfd_add_devices(wm831x->dev, wm831x_num, wm8320_devs, ARRAY_SIZE(wm8320_devs), - NULL, wm831x->irq_base); + NULL, 0); break; default: @@ -1867,7 +1867,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) if (ret & WM831X_XTAL_ENA) { ret = mfd_add_devices(wm831x->dev, wm831x_num, rtc_devs, ARRAY_SIZE(rtc_devs), - NULL, wm831x->irq_base); + NULL, 0); if (ret != 0) { dev_err(wm831x->dev, "Failed to add RTC: %d\n", ret); goto err_irq; @@ -1880,7 +1880,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) /* Treat errors as non-critical */ ret = mfd_add_devices(wm831x->dev, wm831x_num, backlight_devs, ARRAY_SIZE(backlight_devs), NULL, - wm831x->irq_base); + 0); if (ret < 0) dev_err(wm831x->dev, "Failed to add backlight: %d\n", ret); @@ -1909,8 +1909,7 @@ void wm831x_device_exit(struct wm831x *wm831x) { wm831x_otp_exit(wm831x); mfd_remove_devices(wm831x->dev); - if (wm831x->irq_base) - free_irq(wm831x->irq_base + WM831X_IRQ_AUXADC_DATA, wm831x); + free_irq(wm831x_irq(wm831x, WM831X_IRQ_AUXADC_DATA), wm831x); wm831x_irq_exit(wm831x); } diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c index 2be9628074bd..ecc9d6d62fad 100644 --- a/drivers/mfd/wm831x-irq.c +++ b/drivers/mfd/wm831x-irq.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -328,7 +329,7 @@ static inline int irq_data_to_status_reg(struct wm831x_irq_data *irq_data) static inline struct wm831x_irq_data *irq_to_wm831x_irq(struct wm831x *wm831x, int irq) { - return &wm831x_irqs[irq - wm831x->irq_base]; + return &wm831x_irqs[irq]; } static void wm831x_irq_lock(struct irq_data *data) @@ -374,7 +375,7 @@ static void wm831x_irq_enable(struct irq_data *data) { struct wm831x *wm831x = irq_data_get_irq_chip_data(data); struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, - data->irq); + data->hwirq); wm831x->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask; } @@ -383,7 +384,7 @@ static void wm831x_irq_disable(struct irq_data *data) { struct wm831x *wm831x = irq_data_get_irq_chip_data(data); struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, - data->irq); + data->hwirq); wm831x->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask; } @@ -393,7 +394,7 @@ static int wm831x_irq_set_type(struct irq_data *data, unsigned int type) struct wm831x *wm831x = irq_data_get_irq_chip_data(data); int irq; - irq = data->irq - wm831x->irq_base; + irq = data->hwirq; if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) { /* Ignore internal-only IRQs */ @@ -469,9 +470,11 @@ static irqreturn_t wm831x_irq_thread(int irq, void *data) * descriptors. */ if (primary & WM831X_TCHPD_INT) - handle_nested_irq(wm831x->irq_base + WM831X_IRQ_TCHPD); + handle_nested_irq(irq_find_mapping(wm831x->irq_domain, + WM831X_IRQ_TCHPD)); if (primary & WM831X_TCHDATA_INT) - handle_nested_irq(wm831x->irq_base + WM831X_IRQ_TCHDATA); + handle_nested_irq(irq_find_mapping(wm831x->irq_domain, + WM831X_IRQ_TCHDATA)); primary &= ~(WM831X_TCHDATA_EINT | WM831X_TCHPD_EINT); for (i = 0; i < ARRAY_SIZE(wm831x_irqs); i++) { @@ -507,7 +510,8 @@ static irqreturn_t wm831x_irq_thread(int irq, void *data) } if (*status & wm831x_irqs[i].mask) - handle_nested_irq(wm831x->irq_base + i); + handle_nested_irq(irq_find_mapping(wm831x->irq_domain, + i)); /* Simulate an edge triggered IRQ by polling the input * status. This is sucky but improves interoperability. @@ -516,7 +520,8 @@ static irqreturn_t wm831x_irq_thread(int irq, void *data) wm831x->gpio_level[i - WM831X_IRQ_GPIO_1]) { ret = wm831x_reg_read(wm831x, WM831X_GPIO_LEVEL); while (ret & 1 << (i - WM831X_IRQ_GPIO_1)) { - handle_nested_irq(wm831x->irq_base + i); + handle_nested_irq(irq_find_mapping(wm831x->irq_domain, + i)); ret = wm831x_reg_read(wm831x, WM831X_GPIO_LEVEL); } @@ -527,10 +532,34 @@ out: return IRQ_HANDLED; } +static int wm831x_irq_map(struct irq_domain *h, unsigned int virq, + irq_hw_number_t hw) +{ + irq_set_chip_data(virq, h->host_data); + irq_set_chip_and_handler(virq, &wm831x_irq_chip, handle_edge_irq); + irq_set_nested_thread(virq, 1); + + /* ARM needs us to explicitly flag the IRQ as valid + * and will set them noprobe when we do so. */ +#ifdef CONFIG_ARM + set_irq_flags(virq, IRQF_VALID); +#else + irq_set_noprobe(virq); +#endif + + return 0; +} + +static struct irq_domain_ops wm831x_irq_domain_ops = { + .map = wm831x_irq_map, + .xlate = irq_domain_xlate_twocell, +}; + int wm831x_irq_init(struct wm831x *wm831x, int irq) { struct wm831x_pdata *pdata = wm831x->dev->platform_data; - int i, cur_irq, ret; + struct irq_domain *domain; + int i, ret, irq_base; mutex_init(&wm831x->irq_lock); @@ -543,18 +572,33 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq) } /* Try to dynamically allocate IRQs if no base is specified */ - if (!pdata || !pdata->irq_base) - wm831x->irq_base = -1; + if (pdata && pdata->irq_base) { + irq_base = irq_alloc_descs(pdata->irq_base, 0, + WM831X_NUM_IRQS, 0); + if (irq_base < 0) { + dev_warn(wm831x->dev, "Failed to allocate IRQs: %d\n", + irq_base); + irq_base = 0; + } + } else { + irq_base = 0; + } + + if (irq_base) + domain = irq_domain_add_legacy(wm831x->dev->of_node, + ARRAY_SIZE(wm831x_irqs), + irq_base, 0, + &wm831x_irq_domain_ops, + wm831x); else - wm831x->irq_base = pdata->irq_base; + domain = irq_domain_add_linear(wm831x->dev->of_node, + ARRAY_SIZE(wm831x_irqs), + &wm831x_irq_domain_ops, + wm831x); - wm831x->irq_base = irq_alloc_descs(wm831x->irq_base, 0, - WM831X_NUM_IRQS, 0); - if (wm831x->irq_base < 0) { - dev_warn(wm831x->dev, "Failed to allocate IRQs: %d\n", - wm831x->irq_base); - wm831x->irq_base = 0; - return 0; + if (!domain) { + dev_warn(wm831x->dev, "Failed to allocate IRQ domain\n"); + return -EINVAL; } if (pdata && pdata->irq_cmos) @@ -566,24 +610,7 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq) WM831X_IRQ_OD, i); wm831x->irq = irq; - - /* Register them with genirq */ - for (cur_irq = wm831x->irq_base; - cur_irq < ARRAY_SIZE(wm831x_irqs) + wm831x->irq_base; - cur_irq++) { - irq_set_chip_data(cur_irq, wm831x); - irq_set_chip_and_handler(cur_irq, &wm831x_irq_chip, - handle_edge_irq); - irq_set_nested_thread(cur_irq, 1); - - /* ARM needs us to explicitly flag the IRQ as valid - * and will set them noprobe when we do so. */ -#ifdef CONFIG_ARM - set_irq_flags(cur_irq, IRQF_VALID); -#else - irq_set_noprobe(cur_irq); -#endif - } + wm831x->irq_domain = domain; if (irq) { /* Try to flag /IRQ as a wake source; there are a number of diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c index 987332b71d8d..fc1ad9551182 100644 --- a/drivers/power/wm831x_power.c +++ b/drivers/power/wm831x_power.c @@ -565,7 +565,7 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev) goto err_usb; } - irq = platform_get_irq_byname(pdev, "SYSLO"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "SYSLO")); ret = request_threaded_irq(irq, NULL, wm831x_syslo_irq, IRQF_TRIGGER_RISING, "System power low", power); @@ -575,7 +575,7 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev) goto err_battery; } - irq = platform_get_irq_byname(pdev, "PWR SRC"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "PWR SRC")); ret = request_threaded_irq(irq, NULL, wm831x_pwr_src_irq, IRQF_TRIGGER_RISING, "Power source", power); @@ -586,7 +586,9 @@ static __devinit int wm831x_power_probe(struct platform_device *pdev) } for (i = 0; i < ARRAY_SIZE(wm831x_bat_irqs); i++) { - irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]); + irq = wm831x_irq(wm831x, + platform_get_irq_byname(pdev, + wm831x_bat_irqs[i])); ret = request_threaded_irq(irq, NULL, wm831x_bat_irq, IRQF_TRIGGER_RISING, wm831x_bat_irqs[i], @@ -606,10 +608,10 @@ err_bat_irq: irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]); free_irq(irq, power); } - irq = platform_get_irq_byname(pdev, "PWR SRC"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "PWR SRC")); free_irq(irq, power); err_syslo: - irq = platform_get_irq_byname(pdev, "SYSLO"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "SYSLO")); free_irq(irq, power); err_battery: if (power->have_battery) @@ -626,17 +628,20 @@ err_kmalloc: static __devexit int wm831x_power_remove(struct platform_device *pdev) { struct wm831x_power *wm831x_power = platform_get_drvdata(pdev); + struct wm831x *wm831x = wm831x_power->wm831x; int irq, i; for (i = 0; i < ARRAY_SIZE(wm831x_bat_irqs); i++) { - irq = platform_get_irq_byname(pdev, wm831x_bat_irqs[i]); + irq = wm831x_irq(wm831x, + platform_get_irq_byname(pdev, + wm831x_bat_irqs[i])); free_irq(irq, wm831x_power); } - irq = platform_get_irq_byname(pdev, "PWR SRC"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "PWR SRC")); free_irq(irq, wm831x_power); - irq = platform_get_irq_byname(pdev, "SYSLO"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "SYSLO")); free_irq(irq, wm831x_power); if (wm831x_power->have_battery) diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index ff810e787eac..33b2f20a2932 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c @@ -565,7 +565,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev) goto err; } - irq = platform_get_irq_byname(pdev, "UV"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); ret = request_threaded_irq(irq, NULL, wm831x_dcdc_uv_irq, IRQF_TRIGGER_RISING, dcdc->name, dcdc); if (ret != 0) { @@ -574,7 +574,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev) goto err_regulator; } - irq = platform_get_irq_byname(pdev, "HC"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "HC")); ret = request_threaded_irq(irq, NULL, wm831x_dcdc_oc_irq, IRQF_TRIGGER_RISING, dcdc->name, dcdc); if (ret != 0) { @@ -588,7 +588,8 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev) return 0; err_uv: - free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); + free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")), + dcdc); err_regulator: regulator_unregister(dcdc->regulator); err: @@ -600,11 +601,14 @@ err: static __devexit int wm831x_buckv_remove(struct platform_device *pdev) { struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); + struct wm831x *wm831x = dcdc->wm831x; platform_set_drvdata(pdev, NULL); - free_irq(platform_get_irq_byname(pdev, "HC"), dcdc); - free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); + free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "HC")), + dcdc); + free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")), + dcdc); regulator_unregister(dcdc->regulator); if (dcdc->dvs_gpio) gpio_free(dcdc->dvs_gpio); @@ -758,7 +762,7 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev) goto err; } - irq = platform_get_irq_byname(pdev, "UV"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); ret = request_threaded_irq(irq, NULL, wm831x_dcdc_uv_irq, IRQF_TRIGGER_RISING, dcdc->name, dcdc); if (ret != 0) { @@ -783,7 +787,8 @@ static __devexit int wm831x_buckp_remove(struct platform_device *pdev) platform_set_drvdata(pdev, NULL); - free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); + free_irq(wm831x_irq(dcdc->wm831x, platform_get_irq_byname(pdev, "UV")), + dcdc); regulator_unregister(dcdc->regulator); return 0; @@ -883,7 +888,7 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev) goto err; } - irq = platform_get_irq_byname(pdev, "UV"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); ret = request_threaded_irq(irq, NULL, wm831x_dcdc_uv_irq, IRQF_TRIGGER_RISING, dcdc->name, dcdc); @@ -910,7 +915,8 @@ static __devexit int wm831x_boostp_remove(struct platform_device *pdev) platform_set_drvdata(pdev, NULL); - free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); + free_irq(wm831x_irq(dcdc->wm831x, platform_get_irq_byname(pdev, "UV")), + dcdc); regulator_unregister(dcdc->regulator); kfree(dcdc); diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c index b414e09c5620..1596947f603f 100644 --- a/drivers/regulator/wm831x-isink.c +++ b/drivers/regulator/wm831x-isink.c @@ -198,7 +198,7 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev) goto err; } - irq = platform_get_irq(pdev, 0); + irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); ret = request_threaded_irq(irq, NULL, wm831x_isink_irq, IRQF_TRIGGER_RISING, isink->name, isink); if (ret != 0) { @@ -223,7 +223,7 @@ static __devexit int wm831x_isink_remove(struct platform_device *pdev) platform_set_drvdata(pdev, NULL); - free_irq(platform_get_irq(pdev, 0), isink); + free_irq(wm831x_irq(isink->wm831x, platform_get_irq(pdev, 0)), isink); regulator_unregister(isink->regulator); diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index 641e9f6499d1..b09ba05ada6d 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c @@ -359,7 +359,7 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev) goto err; } - irq = platform_get_irq_byname(pdev, "UV"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); ret = request_threaded_irq(irq, NULL, wm831x_ldo_uv_irq, IRQF_TRIGGER_RISING, ldo->name, ldo); @@ -385,7 +385,8 @@ static __devexit int wm831x_gp_ldo_remove(struct platform_device *pdev) platform_set_drvdata(pdev, NULL); - free_irq(platform_get_irq_byname(pdev, "UV"), ldo); + free_irq(wm831x_irq(ldo->wm831x, + platform_get_irq_byname(pdev, "UV")), ldo); regulator_unregister(ldo->regulator); return 0; @@ -624,7 +625,7 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev) goto err; } - irq = platform_get_irq_byname(pdev, "UV"); + irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); ret = request_threaded_irq(irq, NULL, wm831x_ldo_uv_irq, IRQF_TRIGGER_RISING, ldo->name, ldo); if (ret != 0) { @@ -647,7 +648,8 @@ static __devexit int wm831x_aldo_remove(struct platform_device *pdev) { struct wm831x_ldo *ldo = platform_get_drvdata(pdev); - free_irq(platform_get_irq_byname(pdev, "UV"), ldo); + free_irq(wm831x_irq(ldo->wm831x, platform_get_irq_byname(pdev, "UV")), + ldo); regulator_unregister(ldo->regulator); return 0; diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c index 3b6e6a67e765..59c6245e0421 100644 --- a/drivers/rtc/rtc-wm831x.c +++ b/drivers/rtc/rtc-wm831x.c @@ -396,7 +396,7 @@ static int wm831x_rtc_probe(struct platform_device *pdev) { struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x_rtc *wm831x_rtc; - int alm_irq = platform_get_irq_byname(pdev, "ALM"); + int alm_irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "ALM")); int ret = 0; wm831x_rtc = devm_kzalloc(&pdev->dev, sizeof(*wm831x_rtc), GFP_KERNEL); diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h index 4b1211859f74..736191cc7e00 100644 --- a/include/linux/mfd/wm831x/core.h +++ b/include/linux/mfd/wm831x/core.h @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -338,6 +339,7 @@ #define WM831X_FLL_CLK_SRC_WIDTH 2 /* FLL_CLK_SRC - [1:0] */ struct regulator_dev; +struct irq_domain; #define WM831X_NUM_IRQ_REGS 5 #define WM831X_NUM_GPIO_REGS 16 @@ -367,7 +369,7 @@ struct wm831x { int irq; /* Our chip IRQ */ struct mutex irq_lock; - int irq_base; + struct irq_domain *irq_domain; int irq_masks_cur[WM831X_NUM_IRQ_REGS]; /* Currently active value */ int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */ @@ -417,6 +419,11 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq); void wm831x_irq_exit(struct wm831x *wm831x); void wm831x_auxadc_init(struct wm831x *wm831x); +static inline int wm831x_irq(struct wm831x *wm831x, int irq) +{ + return irq_create_mapping(wm831x->irq_domain, irq); +} + extern struct regmap_config wm831x_regmap_config; #endif -- cgit v1.2.3 From 14674e70119ea01549ce593d8901a797f8a90f74 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 30 May 2012 10:55:34 +0200 Subject: i2c: Split I2C_M_NOSTART support out of I2C_FUNC_PROTOCOL_MANGLING Since there are uses for I2C_M_NOSTART which are much more sensible and standard than most of the protocol mangling functionality (the main one being gather writes to devices where something like a register address needs to be inserted before a block of data) create a new I2C_FUNC_NOSTART for this feature and update all the users to use it. Also strengthen the disrecommendation of the protocol mangling while we're at it. In the case of regmap-i2c we remove the requirement for mangling as I2C_M_NOSTART is the only mangling feature which is being used. Signed-off-by: Mark Brown Acked-by: Wolfram Sang Signed-off-by: Jean Delvare --- Documentation/i2c/functionality | 9 ++++++--- Documentation/i2c/i2c-protocol | 9 ++++++++- drivers/base/regmap/regmap-i2c.c | 2 +- drivers/i2c/algos/i2c-algo-bit.c | 2 +- drivers/i2c/busses/i2c-nuc900.c | 3 ++- drivers/i2c/busses/i2c-s3c2410.c | 3 ++- drivers/input/joystick/as5011.c | 1 + drivers/video/matrox/matroxfb_maven.c | 1 + include/linux/i2c.h | 5 +++-- 9 files changed, 25 insertions(+), 10 deletions(-) (limited to 'drivers/input') diff --git a/Documentation/i2c/functionality b/Documentation/i2c/functionality index 42c17c1fb3cd..b0ff2ab596ce 100644 --- a/Documentation/i2c/functionality +++ b/Documentation/i2c/functionality @@ -18,9 +18,9 @@ For the most up-to-date list of functionality constants, please check adapters typically can not do these) I2C_FUNC_10BIT_ADDR Handles the 10-bit address extensions I2C_FUNC_PROTOCOL_MANGLING Knows about the I2C_M_IGNORE_NAK, - I2C_M_REV_DIR_ADDR, I2C_M_NOSTART and - I2C_M_NO_RD_ACK flags (which modify the - I2C protocol!) + I2C_M_REV_DIR_ADDR and I2C_M_NO_RD_ACK + flags (which modify the I2C protocol!) + I2C_FUNC_NOSTART Can skip repeated start sequence I2C_FUNC_SMBUS_QUICK Handles the SMBus write_quick command I2C_FUNC_SMBUS_READ_BYTE Handles the SMBus read_byte command I2C_FUNC_SMBUS_WRITE_BYTE Handles the SMBus write_byte command @@ -50,6 +50,9 @@ A few combinations of the above flags are also defined for your convenience: emulated by a real I2C adapter (using the transparent emulation layer) +In kernel versions prior to 3.5 I2C_FUNC_NOSTART was implemented as +part of I2C_FUNC_PROTOCOL_MANGLING. + ADAPTER IMPLEMENTATION ---------------------- diff --git a/Documentation/i2c/i2c-protocol b/Documentation/i2c/i2c-protocol index 10518dd58814..0b3e62d1f77a 100644 --- a/Documentation/i2c/i2c-protocol +++ b/Documentation/i2c/i2c-protocol @@ -49,7 +49,9 @@ a byte read, followed by a byte write: Modified transactions ===================== -We have found some I2C devices that needs the following modifications: +The following modifications to the I2C protocol can also be generated, +with the exception of I2C_M_NOSTART these are usually only needed to +work around device issues: Flag I2C_M_NOSTART: In a combined transaction, no 'S Addr Wr/Rd [A]' is generated at some @@ -60,6 +62,11 @@ We have found some I2C devices that needs the following modifications: we do not generate Addr, but we do generate the startbit S. This will probably confuse all other clients on your bus, so don't try this. + This is often used to gather transmits from multiple data buffers in + system memory into something that appears as a single transfer to the + I2C device but may also be used between direction changes by some + rare devices. + Flags I2C_M_REV_DIR_ADDR This toggles the Rd/Wr flag. That is, if you want to do a write, but need to emit an Rd instead of a Wr, or vice versa, you set this diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c index 5f6b2478bf17..fa6bf5279d28 100644 --- a/drivers/base/regmap/regmap-i2c.c +++ b/drivers/base/regmap/regmap-i2c.c @@ -42,7 +42,7 @@ static int regmap_i2c_gather_write(void *context, /* If the I2C controller can't do a gather tell the core, it * will substitute in a linear write for us. */ - if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_PROTOCOL_MANGLING)) + if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_NOSTART)) return -ENOTSUPP; xfer[0].addr = i2c->addr; diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index 7f0b83219744..fad22b0bb5b0 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c @@ -608,7 +608,7 @@ bailout: static u32 bit_func(struct i2c_adapter *adap) { - return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | + return I2C_FUNC_I2C | I2C_FUNC_NOSTART | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL | I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING; diff --git a/drivers/i2c/busses/i2c-nuc900.c b/drivers/i2c/busses/i2c-nuc900.c index 03b615778887..a26dfb8cd586 100644 --- a/drivers/i2c/busses/i2c-nuc900.c +++ b/drivers/i2c/busses/i2c-nuc900.c @@ -502,7 +502,8 @@ static int nuc900_i2c_xfer(struct i2c_adapter *adap, /* declare our i2c functionality */ static u32 nuc900_i2c_func(struct i2c_adapter *adap) { - return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_NOSTART | + I2C_FUNC_PROTOCOL_MANGLING; } /* i2c bus registration info */ diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index fa0b13490873..01959154572d 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -626,7 +626,8 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, /* declare our i2c functionality */ static u32 s3c24xx_i2c_func(struct i2c_adapter *adap) { - return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_NOSTART | + I2C_FUNC_PROTOCOL_MANGLING; } /* i2c bus registration info */ diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index 3063464474bf..57d19d4e0a2d 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, } if (!i2c_check_functionality(client->adapter, + I2C_FUNC_NOSTART | I2C_FUNC_PROTOCOL_MANGLING)) { dev_err(&client->dev, "need i2c bus that supports protocol mangling\n"); diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c index 31b8f67477b7..217678e0b983 100644 --- a/drivers/video/matrox/matroxfb_maven.c +++ b/drivers/video/matrox/matroxfb_maven.c @@ -1243,6 +1243,7 @@ static int maven_probe(struct i2c_client *client, if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_WORD_DATA | I2C_FUNC_SMBUS_BYTE_DATA | + I2C_FUNC_NOSTART | I2C_FUNC_PROTOCOL_MANGLING)) goto ERROR0; if (!(data = kzalloc(sizeof(*data), GFP_KERNEL))) { diff --git a/include/linux/i2c.h b/include/linux/i2c.h index b66cb601435f..ddfa04108baf 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -541,7 +541,7 @@ struct i2c_msg { __u16 flags; #define I2C_M_TEN 0x0010 /* this is a ten bit chip address */ #define I2C_M_RD 0x0001 /* read data, from slave to master */ -#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_PROTOCOL_MANGLING */ +#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */ #define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */ #define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */ #define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */ @@ -554,8 +554,9 @@ struct i2c_msg { #define I2C_FUNC_I2C 0x00000001 #define I2C_FUNC_10BIT_ADDR 0x00000002 -#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_NOSTART etc. */ +#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_IGNORE_NAK etc. */ #define I2C_FUNC_SMBUS_PEC 0x00000008 +#define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */ #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ #define I2C_FUNC_SMBUS_QUICK 0x00010000 #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 -- cgit v1.2.3 From 27c347d64f5e4a7e141f6bdb85bbf59e0f1dcde6 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Mon, 4 Jun 2012 16:28:48 +0530 Subject: Input: MT - fix null pointer warning Fixes the following sparse warning: drivers/input/input-mt.c:138:40: warning: Using plain integer as NULL pointer Signed-off-by: Sachin Kamat Signed-off-by: Henrik Rydberg --- drivers/input/input-mt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') 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); */ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) { - struct input_mt_slot *oldest = 0; + struct input_mt_slot *oldest = NULL; int oldid = dev->trkid; int count = 0; int i; -- cgit v1.2.3 From 4eceb14f669cb9e9d189019e8fcbf73577fe77a7 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 11 Jun 2012 23:55:32 -0700 Subject: Input: gpio_keys - remove useless reinitialization of pdata->nbuttons pdata is zeroed using memset just a few lines before, so there is no need to set the nbuttons member to 0 again. Signed-off-by: Tobias Klauser Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/gpio_keys.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/input') 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, pdata->rep = !!of_get_property(node, "autorepeat", NULL); /* First count the subnodes */ - pdata->nbuttons = 0; pp = NULL; while ((pp = of_get_next_child(node, pp))) pdata->nbuttons++; -- cgit v1.2.3 From 03ecd229a5d05a5c62e7262d66ec6cd57d5eca6c Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Tue, 12 Jun 2012 00:21:47 -0700 Subject: Input: ab8500-ponkey - add device tree support Allow the ab8500-ponkey driver to be probed during boot when Device Tree is enabled. Signed-off-by: Lee Jones Acked-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- drivers/input/misc/ab8500-ponkey.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/input') 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 @@ #include #include #include +#include #include /** @@ -131,10 +132,18 @@ static int __devexit ab8500_ponkey_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id ab8500_ponkey_match[] = { + { .compatible = "stericsson,ab8500-ponkey", }, + {} +}; +#endif + static struct platform_driver ab8500_ponkey_driver = { .driver = { .name = "ab8500-poweron-key", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(ab8500_ponkey_match), }, .probe = ab8500_ponkey_probe, .remove = __devexit_p(ab8500_ponkey_remove), -- cgit v1.2.3 From ea2e60244573a9204c8cee9b4fb181106784c617 Mon Sep 17 00:00:00 2001 From: Ping Cheng Date: Tue, 12 Jun 2012 00:14:12 -0700 Subject: Input: wacom - rearrange type enum So we can simplify a few type related if statements Signed-off-by: Ping Cheng Acked-by: Chris Bagwell Reviewed-by: Jason Gerecke Signed-off-by: Dmitry Torokhov --- drivers/input/tablet/wacom_sys.c | 10 +++------- drivers/input/tablet/wacom_wac.c | 6 ++---- drivers/input/tablet/wacom_wac.h | 6 +++--- 3 files changed, 8 insertions(+), 14 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index b3a8bd3514b2..79b5cfbc1bc4 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -440,8 +440,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat /* ask to report Wacom data */ if (features->device_type == BTN_TOOL_FINGER) { /* if it is an MT Tablet PC touch */ - if (features->type == TABLETPC2FG || - features->type == MTSCREEN) { + if (features->type > TABLETPC) { do { rep_data[0] = 3; rep_data[1] = 4; @@ -460,7 +459,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); } - } else if (features->type != TABLETPC && + } else if (features->type <= BAMBOO_PT && features->type != WIRELESS && features->device_type == BTN_TOOL_PEN) { do { @@ -510,10 +509,7 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, } /* only devices that support touch need to retrieve the info */ - if (features->type != TABLETPC && - features->type != TABLETPC2FG && - features->type != BAMBOO_PT && - features->type != MTSCREEN) { + if (features->type < BAMBOO_PT) { goto out; } diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 004bc1bb1544..c40dcb7036b3 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -1317,10 +1317,8 @@ void wacom_setup_device_quirks(struct wacom_features *features) } /* these device have multiple inputs */ - if (features->type == TABLETPC || features->type == TABLETPC2FG || - features->type == BAMBOO_PT || features->type == WIRELESS || - (features->type >= INTUOS5S && features->type <= INTUOS5L) || - features->type == MTSCREEN) + if (features->type >= WIRELESS || + (features->type >= INTUOS5S && features->type <= INTUOS5L)) features->quirks |= WACOM_QUIRK_MULTI_INPUT; /* quirk for bamboo touch with 2 low res touches */ diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 78fbd3f42009..87080435116c 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h @@ -62,8 +62,6 @@ enum { PTU, PL, DTU, - BAMBOO_PT, - WIRELESS, INTUOS, INTUOS3S, INTUOS3, @@ -79,7 +77,9 @@ enum { CINTIQ, WACOM_BEE, WACOM_MO, - TABLETPC, + WIRELESS, + BAMBOO_PT, + TABLETPC, /* add new TPC below */ TABLETPC2FG, MTSCREEN, MAX_TYPE -- cgit v1.2.3 From ac173837cd4b268a538235a1699b91457551a9a9 Mon Sep 17 00:00:00 2001 From: Ping Cheng Date: Tue, 12 Jun 2012 00:15:06 -0700 Subject: Input: wacom - add two new devices (0xed and 0xef) 0xed supports pen and one finger touch; 0xef is pen only. Signed-off-by: Ping Cheng Acked-by: Chris Bagwell Reviewed-by: Jason Gerecke Signed-off-by: Dmitry Torokhov --- drivers/input/tablet/wacom_wac.c | 13 ++++++++++++- drivers/input/tablet/wacom_wac.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index c40dcb7036b3..fd0cf4d328a3 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -888,7 +888,7 @@ static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len) prox = data[0] & 0x01; x = get_unaligned_le16(&data[1]); y = get_unaligned_le16(&data[3]); - } else { /* with capacity */ + } else { prox = data[1] & 0x01; x = le16_to_cpup((__le16 *)&data[2]); y = le16_to_cpup((__le16 *)&data[4]); @@ -961,6 +961,7 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) case WACOM_REPORT_TPC1FG: case WACOM_REPORT_TPCHID: case WACOM_REPORT_TPCST: + case WACOM_REPORT_TPC1FGE: return wacom_tpc_single_touch(wacom, len); case WACOM_REPORT_TPCMT: @@ -1244,6 +1245,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) break; case TABLETPC: + case TABLETPCE: case TABLETPC2FG: case MTSCREEN: sync = wacom_tpc_irq(wacom_wac, len); @@ -1569,6 +1571,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, /* fall through */ case TABLETPC: + case TABLETPCE: __clear_bit(ABS_MISC, input_dev->absbit); __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); @@ -1886,6 +1889,12 @@ static const struct wacom_features wacom_features_0xE6 = static const struct wacom_features wacom_features_0xEC = { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +static const struct wacom_features wacom_features_0xED = + { "Wacom ISDv4 ED", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, + 0, TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; +static const struct wacom_features wacom_features_0xEF = + { "Wacom ISDv4 EF", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, + 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; static const struct wacom_features wacom_features_0x47 = { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; @@ -2060,6 +2069,8 @@ const struct usb_device_id wacom_ids[] = { { USB_DEVICE_WACOM(0xE5) }, { USB_DEVICE_WACOM(0xE6) }, { USB_DEVICE_WACOM(0xEC) }, + { USB_DEVICE_WACOM(0xED) }, + { USB_DEVICE_WACOM(0xEF) }, { USB_DEVICE_WACOM(0x47) }, { USB_DEVICE_WACOM(0xF4) }, { USB_DEVICE_LENOVO(0x6004) }, diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 87080435116c..bd5d37b28714 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h @@ -48,6 +48,7 @@ #define WACOM_REPORT_TPCMT 13 #define WACOM_REPORT_TPCHID 15 #define WACOM_REPORT_TPCST 16 +#define WACOM_REPORT_TPC1FGE 18 /* device quirks */ #define WACOM_QUIRK_MULTI_INPUT 0x0001 @@ -80,6 +81,7 @@ enum { WIRELESS, BAMBOO_PT, TABLETPC, /* add new TPC below */ + TABLETPCE, TABLETPC2FG, MTSCREEN, MAX_TYPE -- cgit v1.2.3 From b7af2bb84cea328c766c615aac45cdd498c50bc6 Mon Sep 17 00:00:00 2001 From: Chris Bagwell Date: Tue, 12 Jun 2012 00:25:23 -0700 Subject: Input: wacom - battery reporting improvements Do not register battery device until connected to a tablet. This prevents an empty battery icon from being shown when tablet is connected using USB cable. Also, call power_supply_powers() for apps that can make use of that info. And stop ignoring input registration failures. Signed-off-by: Chris Bagwell Reviewed-by: Ping Cheng Signed-off-by: Dmitry Torokhov --- drivers/input/tablet/wacom_sys.c | 82 ++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 29 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 79b5cfbc1bc4..a48fcb76bb83 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -963,6 +963,10 @@ static int wacom_initialize_battery(struct wacom *wacom) error = power_supply_register(&wacom->usbdev->dev, &wacom->battery); + + if (!error) + power_supply_powers(&wacom->battery, + &wacom->usbdev->dev); } return error; @@ -970,8 +974,11 @@ static int wacom_initialize_battery(struct wacom *wacom) static void wacom_destroy_battery(struct wacom *wacom) { - if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR) + if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR && + wacom->battery.dev) { power_supply_unregister(&wacom->battery); + wacom->battery.dev = NULL; + } } static int wacom_register_input(struct wacom *wacom) @@ -1018,23 +1025,30 @@ static void wacom_wireless_work(struct work_struct *work) struct wacom *wacom = container_of(work, struct wacom, work); struct usb_device *usbdev = wacom->usbdev; struct wacom_wac *wacom_wac = &wacom->wacom_wac; + struct wacom *wacom1, *wacom2; + struct wacom_wac *wacom_wac1, *wacom_wac2; + int error; /* * Regardless if this is a disconnect or a new tablet, - * remove any existing input devices. + * remove any existing input and battery devices. */ + wacom_destroy_battery(wacom); + /* Stylus interface */ - wacom = usb_get_intfdata(usbdev->config->interface[1]); - if (wacom->wacom_wac.input) - input_unregister_device(wacom->wacom_wac.input); - wacom->wacom_wac.input = NULL; + wacom1 = usb_get_intfdata(usbdev->config->interface[1]); + wacom_wac1 = &(wacom1->wacom_wac); + if (wacom_wac1->input) + input_unregister_device(wacom_wac1->input); + wacom_wac1->input = NULL; /* Touch interface */ - wacom = usb_get_intfdata(usbdev->config->interface[2]); - if (wacom->wacom_wac.input) - input_unregister_device(wacom->wacom_wac.input); - wacom->wacom_wac.input = NULL; + wacom2 = usb_get_intfdata(usbdev->config->interface[2]); + wacom_wac2 = &(wacom2->wacom_wac); + if (wacom_wac2->input) + input_unregister_device(wacom_wac2->input); + wacom_wac2->input = NULL; if (wacom_wac->pid == 0) { dev_info(&wacom->intf->dev, "wireless tablet disconnected\n"); @@ -1059,24 +1073,39 @@ static void wacom_wireless_work(struct work_struct *work) } /* Stylus interface */ - wacom = usb_get_intfdata(usbdev->config->interface[1]); - wacom_wac = &wacom->wacom_wac; - wacom_wac->features = + wacom_wac1->features = *((struct wacom_features *)id->driver_info); - wacom_wac->features.device_type = BTN_TOOL_PEN; - wacom_register_input(wacom); + wacom_wac1->features.device_type = BTN_TOOL_PEN; + error = wacom_register_input(wacom1); + if (error) + goto fail1; /* Touch interface */ - wacom = usb_get_intfdata(usbdev->config->interface[2]); - wacom_wac = &wacom->wacom_wac; - wacom_wac->features = + wacom_wac2->features = *((struct wacom_features *)id->driver_info); - wacom_wac->features.pktlen = WACOM_PKGLEN_BBTOUCH3; - wacom_wac->features.device_type = BTN_TOOL_FINGER; - wacom_set_phy_from_res(&wacom_wac->features); - wacom_wac->features.x_max = wacom_wac->features.y_max = 4096; - wacom_register_input(wacom); + wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; + wacom_wac2->features.device_type = BTN_TOOL_FINGER; + wacom_set_phy_from_res(&wacom_wac2->features); + wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; + error = wacom_register_input(wacom2); + if (error) + goto fail2; + + error = wacom_initialize_battery(wacom); + if (error) + goto fail3; } + + return; + +fail3: + input_unregister_device(wacom_wac2->input); + wacom_wac2->input = NULL; +fail2: + input_unregister_device(wacom_wac1->input); + wacom_wac1->input = NULL; +fail1: + return; } static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) @@ -1179,14 +1208,10 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i if (error) goto fail4; - error = wacom_initialize_battery(wacom); - if (error) - goto fail5; - if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { error = wacom_register_input(wacom); if (error) - goto fail6; + goto fail5; } /* Note that if query fails it is not a hard failure */ @@ -1201,7 +1226,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i return 0; - fail6: wacom_destroy_battery(wacom); fail5: wacom_destroy_leds(wacom); fail4: wacom_remove_shared_data(wacom_wac); fail3: usb_free_urb(wacom->irq); -- cgit v1.2.3 From 6dc463511d4a690f01a9248df3b384db717e0b1c Mon Sep 17 00:00:00 2001 From: Chris Bagwell Date: Tue, 12 Jun 2012 00:25:48 -0700 Subject: Input: wacom - Bamboo One 1024 pressure fix Bamboo One's with ID of 0x6a and 0x6b were added with correct indication of 1024 pressure levels but the Graphire packet routine was only looking at 9 bits. Increased to 10 bits. This bug caused these devices to roll over to zero pressure at half way mark. The other devices using this routine only support 256 or 512 range and look to fix unused bits at zero. Signed-off-by: Chris Bagwell Reported-by: Tushant Mirchandani Reviewed-by: Ping Cheng Signed-off-by: Dmitry Torokhov --- drivers/input/tablet/wacom_wac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index fd0cf4d328a3..4453864956b6 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) input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); if (wacom->tool[0] != BTN_TOOL_MOUSE) { - input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x01) << 8)); + input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x03) << 8)); input_report_key(input, BTN_TOUCH, data[1] & 0x01); input_report_key(input, BTN_STYLUS, data[1] & 0x02); input_report_key(input, BTN_STYLUS2, data[1] & 0x04); -- cgit v1.2.3 From a19fc98685ad0b5bccc38ca17acb50a92915ec51 Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Tue, 12 Jun 2012 00:27:53 -0700 Subject: Input: wacom - initialize and destroy LEDs for Intuos4 S tablets This case appears to have been missed in the original commit. Signed-off-by: Jason Gerecke Reviewed-by: Chris Bagwell Signed-off-by: Dmitry Torokhov --- drivers/input/tablet/wacom_sys.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index a48fcb76bb83..a5d1c60e77ee 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -851,6 +851,7 @@ static int wacom_initialize_leds(struct wacom *wacom) /* Initialize default values */ switch (wacom->wacom_wac.features.type) { + case INTUOS4S: case INTUOS4: case INTUOS4L: wacom->led.select[0] = 0; @@ -904,6 +905,7 @@ static int wacom_initialize_leds(struct wacom *wacom) static void wacom_destroy_leds(struct wacom *wacom) { switch (wacom->wacom_wac.features.type) { + case INTUOS4S: case INTUOS4: case INTUOS4L: sysfs_remove_group(&wacom->intf->dev.kobj, -- cgit v1.2.3 From 32edbf562cabc0fb927692c86274c3cd2ccde0d0 Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Tue, 12 Jun 2012 00:28:37 -0700 Subject: Input: wacom - remove code duplication Replaces code to calculate Intuos5 physical dimensions with a call to an existing function that performs the same task. Signed-off-by: Jason Gerecke Reviewed-by: Chris Bagwell Signed-off-by: Dmitry Torokhov --- drivers/input/tablet/wacom_sys.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index a5d1c60e77ee..9e8fdcf005a3 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -1171,10 +1171,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i features->device_type = BTN_TOOL_FINGER; features->pktlen = WACOM_PKGLEN_BBTOUCH3; - features->x_phy = - (features->x_max * 100) / features->x_resolution; - features->y_phy = - (features->y_max * 100) / features->y_resolution; + wacom_set_phy_from_res(features); features->x_max = 4096; features->y_max = 4096; -- cgit v1.2.3 From e7ec014a47e4d68fc01561d0541a50650646317c Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 12 Jun 2012 01:10:02 -0700 Subject: Input: twl6040-vibra - update for device tree support The twl6040 DT support implementation has been changed from the originally planned. None of the child devices going to have compatible_of property which means that the child devices of twl6040 will be created as traditional MFD devices. The mfd core driver will decide (based on the DT blob) to create a device for the twl6040-vibra or not. If the DT blob has 'vibra' section the device will be created without pdata. In this case the vibra driver will reach up to the parent node to get the needed properties. With DT booted kernel we no longer be able to link the regulators to the vibra driver, they can be only linked to the MFD device (probed via DT). From the vibra driver we ned to use pdev->dev.parent to get the regulators. Signed-off-by: Peter Ujfalusi Signed-off-by: Dmitry Torokhov --- .../devicetree/bindings/input/twl6040-vibra.txt | 37 ------------------- drivers/input/misc/twl6040-vibra.c | 42 ++++++++++++---------- 2 files changed, 24 insertions(+), 55 deletions(-) delete mode 100644 Documentation/devicetree/bindings/input/twl6040-vibra.txt (limited to 'drivers/input') diff --git a/Documentation/devicetree/bindings/input/twl6040-vibra.txt b/Documentation/devicetree/bindings/input/twl6040-vibra.txt deleted file mode 100644 index 5b1918b818fb..000000000000 --- a/Documentation/devicetree/bindings/input/twl6040-vibra.txt +++ /dev/null @@ -1,37 +0,0 @@ -Vibra driver for the twl6040 family - -The vibra driver is a child of the twl6040 MFD dirver. -Documentation/devicetree/bindings/mfd/twl6040.txt - -Required properties: -- compatible : Must be "ti,twl6040-vibra"; -- interrupts: 4, Vibra overcurrent interrupt -- vddvibl-supply: Regulator supplying the left vibra motor -- vddvibr-supply: Regulator supplying the right vibra motor -- vibldrv_res: Board specific left driver resistance -- vibrdrv_res: Board specific right driver resistance -- viblmotor_res: Board specific left motor resistance -- vibrmotor_res: Board specific right motor resistance - -Optional properties: -- vddvibl_uV: If the vddvibl default voltage need to be changed -- vddvibr_uV: If the vddvibr default voltage need to be changed - -Example: -/* - * 8-channel high quality low-power audio codec - * http://www.ti.com/lit/ds/symlink/twl6040.pdf - */ -twl6040: twl6040@4b { - ... - twl6040_vibra: twl6040@1 { - compatible = "ti,twl6040-vibra"; - interrupts = <4>; - vddvibl-supply = <&vbat>; - vddvibr-supply = <&vbat>; - vibldrv_res = <8>; - vibrdrv_res = <3>; - viblmotor_res = <10>; - vibrmotor_res = <10>; - }; -}; 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) return 0; } - #endif 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); static int __devinit twl6040_vibra_probe(struct platform_device *pdev) { struct twl6040_vibra_data *pdata = pdev->dev.platform_data; - struct device_node *node = pdev->dev.of_node; + struct device *twl6040_core_dev = pdev->dev.parent; + struct device_node *twl6040_core_node = NULL; struct vibra_info *info; int vddvibl_uV = 0; int vddvibr_uV = 0; int ret; - if (!pdata && !node) { +#ifdef CONFIG_OF + twl6040_core_node = of_find_node_by_name(twl6040_core_dev->of_node, + "vibra"); +#endif + + if (!pdata && !twl6040_core_node) { dev_err(&pdev->dev, "platform_data not available\n"); return -EINVAL; } @@ -287,14 +292,18 @@ static int __devinit twl6040_vibra_probe(struct platform_device *pdev) vddvibl_uV = pdata->vddvibl_uV; vddvibr_uV = pdata->vddvibr_uV; } else { - of_property_read_u32(node, "vibldrv_res", &info->vibldrv_res); - of_property_read_u32(node, "vibrdrv_res", &info->vibrdrv_res); - of_property_read_u32(node, "viblmotor_res", + of_property_read_u32(twl6040_core_node, "ti,vibldrv-res", + &info->vibldrv_res); + of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res", + &info->vibrdrv_res); + of_property_read_u32(twl6040_core_node, "ti,viblmotor-res", &info->viblmotor_res); - of_property_read_u32(node, "vibrmotor_res", + of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res", &info->vibrmotor_res); - of_property_read_u32(node, "vddvibl_uV", &vddvibl_uV); - of_property_read_u32(node, "vddvibr_uV", &vddvibr_uV); + of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV", + &vddvibl_uV); + of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV", + &vddvibr_uV); } if ((!info->vibldrv_res && !info->viblmotor_res) || @@ -351,8 +360,12 @@ static int __devinit twl6040_vibra_probe(struct platform_device *pdev) info->supplies[0].supply = "vddvibl"; info->supplies[1].supply = "vddvibr"; - ret = regulator_bulk_get(info->dev, ARRAY_SIZE(info->supplies), - info->supplies); + /* + * When booted with Device tree the regulators are attached to the + * parent device (twl6040 MFD core) + */ + ret = regulator_bulk_get(pdata ? info->dev : twl6040_core_dev, + ARRAY_SIZE(info->supplies), info->supplies); if (ret) { dev_err(info->dev, "couldn't get regulators %d\n", ret); goto err_regulator; @@ -418,12 +431,6 @@ static int __devexit twl6040_vibra_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id twl6040_vibra_of_match[] = { - {.compatible = "ti,twl6040-vibra", }, - { }, -}; -MODULE_DEVICE_TABLE(of, twl6040_vibra_of_match); - static struct platform_driver twl6040_vibra_driver = { .probe = twl6040_vibra_probe, .remove = __devexit_p(twl6040_vibra_remove), @@ -431,7 +438,6 @@ static struct platform_driver twl6040_vibra_driver = { .name = "twl6040-vibra", .owner = THIS_MODULE, .pm = &twl6040_vibra_pm_ops, - .of_match_table = twl6040_vibra_of_match, }, }; module_platform_driver(twl6040_vibra_driver); -- cgit v1.2.3 From af77c88b8971232f23b4cba7a46fc7a43914bf22 Mon Sep 17 00:00:00 2001 From: Naveen Kumar Gaddipati Date: Mon, 25 Jun 2012 00:25:41 -0700 Subject: Input: nomadik-ske-keypad - add multi key press support Added the multi key press support for SKE keypad by modifying the irq function for handling the two different keys on the same column and also pressing the two different keys of different columns on the same ASR register. Signed-off-by: Naveen Kumar Gaddipati Reviewed-by: Srinidhi Kasagar Signed-off-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/nomadik-ske-keypad.c | 65 ++++++++++++++++++----------- 1 file changed, 40 insertions(+), 25 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c index 4ea4341a68c5..6857454bb13c 100644 --- a/drivers/input/keyboard/nomadik-ske-keypad.c +++ b/drivers/input/keyboard/nomadik-ske-keypad.c @@ -135,12 +135,37 @@ static int __init ske_keypad_chip_init(struct ske_keypad *keypad) return 0; } -static void ske_keypad_read_data(struct ske_keypad *keypad) +static void ske_keypad_report(struct ske_keypad *keypad, u8 status, int col) { + int row = 0, code, pos; struct input_dev *input = keypad->input; - u16 status; - int col = 0, row = 0, code; - int ske_asr, ske_ris, key_pressed, i; + u32 ske_ris; + int key_pressed; + int num_of_rows; + + /* find out the row */ + num_of_rows = hweight8(status); + do { + pos = __ffs(status); + row = pos; + status &= ~(1 << pos); + + code = MATRIX_SCAN_CODE(row, col, SKE_KEYPAD_ROW_SHIFT); + ske_ris = readl(keypad->reg_base + SKE_RIS); + key_pressed = ske_ris & SKE_KPRISA; + + input_event(input, EV_MSC, MSC_SCAN, code); + input_report_key(input, keypad->keymap[code], key_pressed); + input_sync(input); + num_of_rows--; + } while (num_of_rows); +} + +static void ske_keypad_read_data(struct ske_keypad *keypad) +{ + u8 status; + int col = 0; + int ske_asr, i; /* * Read the auto scan registers @@ -154,25 +179,17 @@ static void ske_keypad_read_data(struct ske_keypad *keypad) if (!ske_asr) continue; - /* now that ASRx is zero, find out the column x and row y*/ - if (ske_asr & 0xff) { + /* now that ASRx is zero, find out the coloumn x and row y */ + status = ske_asr & 0xff; + if (status) { col = i * 2; - status = ske_asr & 0xff; - } else { + ske_keypad_report(keypad, status, col); + } + status = (ske_asr & 0xff00) >> 8; + if (status) { col = (i * 2) + 1; - status = (ske_asr & 0xff00) >> 8; + ske_keypad_report(keypad, status, col); } - - /* find out the row */ - row = __ffs(status); - - code = MATRIX_SCAN_CODE(row, col, SKE_KEYPAD_ROW_SHIFT); - ske_ris = readl(keypad->reg_base + SKE_RIS); - key_pressed = ske_ris & SKE_KPRISA; - - input_event(input, EV_MSC, MSC_SCAN, code); - input_report_key(input, keypad->keymap[code], key_pressed); - input_sync(input); } } @@ -186,12 +203,10 @@ static irqreturn_t ske_keypad_irq(int irq, void *dev_id) ske_keypad_set_bits(keypad, SKE_ICR, 0x0, SKE_KPICA); while ((readl(keypad->reg_base + SKE_CR) & SKE_KPASON) && --retries) - msleep(5); + cpu_relax(); - if (retries) { - /* SKEx registers are stable and can be read */ - ske_keypad_read_data(keypad); - } + /* SKEx registers are stable and can be read */ + ske_keypad_read_data(keypad); /* enable auto scan interrupts */ ske_keypad_set_bits(keypad, SKE_IMSC, 0x0, SKE_KPIMA); -- cgit v1.2.3 From 84b63ad8477c822edbeb1e310b201609f33522ec Mon Sep 17 00:00:00 2001 From: Naveen Kumar Gaddipati Date: Mon, 25 Jun 2012 00:34:36 -0700 Subject: Input: nomadik-ske-keypad - get rid of multiple interrupts The keypad could cause multiple interrupts to be fired in succession since we weren't waiting for the IRQs to clear properly in the interrupt handler. We wait for a number of bus iterations (the readl():s from the peripheral bus will stall, so these are quite long) before giving up on getting keys ready to read, then we sleep until the IRQ is deasserted (this is OK since the interrupt is threaded). Also use the debounce platform data for another hardcoded wait loop. Signed-off-by: Naveen Kumar Gaddipati Reviewed-by: Rikard Olsson Reviewed-by: Srinidhi Kasagar Signed-off-by: Linus Walleij Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/nomadik-ske-keypad.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c index 6857454bb13c..a880e7414202 100644 --- a/drivers/input/keyboard/nomadik-ske-keypad.c +++ b/drivers/input/keyboard/nomadik-ske-keypad.c @@ -49,6 +49,7 @@ #define SKE_ASR3 0x2C #define SKE_NUM_ASRX_REGISTERS (4) +#define KEY_PRESSED_DELAY 10 /** * 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, static int __init ske_keypad_chip_init(struct ske_keypad *keypad) { u32 value; - int timeout = 50; + int timeout = keypad->board->debounce_ms; /* check SKE_RIS to be 0 */ while ((readl(keypad->reg_base + SKE_RIS) != 0x00000000) && timeout--) @@ -196,18 +197,22 @@ static void ske_keypad_read_data(struct ske_keypad *keypad) static irqreturn_t ske_keypad_irq(int irq, void *dev_id) { struct ske_keypad *keypad = dev_id; - int retries = 20; + int timeout = keypad->board->debounce_ms; /* disable auto scan interrupt; mask the interrupt generated */ ske_keypad_set_bits(keypad, SKE_IMSC, ~SKE_KPIMA, 0x0); ske_keypad_set_bits(keypad, SKE_ICR, 0x0, SKE_KPICA); - while ((readl(keypad->reg_base + SKE_CR) & SKE_KPASON) && --retries) + while ((readl(keypad->reg_base + SKE_CR) & SKE_KPASON) && --timeout) cpu_relax(); /* SKEx registers are stable and can be read */ ske_keypad_read_data(keypad); + /* wait until raw interrupt is clear */ + while ((readl(keypad->reg_base + SKE_RIS)) && --timeout) + msleep(KEY_PRESSED_DELAY); + /* enable auto scan interrupts */ ske_keypad_set_bits(keypad, SKE_IMSC, 0x0, SKE_KPIMA); -- cgit v1.2.3 From adad004e1a50f8c64d9f116cd4934da937b51e27 Mon Sep 17 00:00:00 2001 From: Ping Cheng Date: Thu, 28 Jun 2012 16:48:17 -0700 Subject: Input: wacom - BTN_TOOL_DOUBLETAP is not a valid device_type It is replaced by BTN_TOOL_FINGER. Signed-off-by: Ping Cheng Tested-by: Rafi Rubin Reviewed-by: Jason Gerecke Signed-off-by: Dmitry Torokhov --- drivers/input/tablet/wacom_sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 9e8fdcf005a3..c24ab5468e02 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c @@ -503,7 +503,7 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, if (intf->cur_altsetting->desc.bInterfaceNumber == 0) { features->device_type = 0; } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) { - features->device_type = BTN_TOOL_DOUBLETAP; + features->device_type = BTN_TOOL_FINGER; features->pktlen = WACOM_PKGLEN_BBTOUCH3; } } -- cgit v1.2.3 From 6795a524f0b049ceb5417d5036ab5e233345b900 Mon Sep 17 00:00:00 2001 From: Ping Cheng Date: Thu, 28 Jun 2012 16:49:00 -0700 Subject: Input: wacom - TPC2FG doesn't store touch id for slots Signed-off-by: Ping Cheng Tested-by: Rafi Rubin Reviewed-by: Jason Gerecke Signed-off-by: Dmitry Torokhov --- drivers/input/tablet/wacom_wac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 4453864956b6..6533f44be5bd 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c @@ -1547,10 +1547,8 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, __set_bit(INPUT_PROP_POINTER, input_dev->propbit); break; - case TABLETPC2FG: case MTSCREEN: if (features->device_type == BTN_TOOL_FINGER) { - wacom_wac->slots = kmalloc(features->touch_max * sizeof(int), GFP_KERNEL); @@ -1559,7 +1557,11 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, for (i = 0; i < features->touch_max; i++) wacom_wac->slots[i] = -1; + } + /* fall through */ + case TABLETPC2FG: + if (features->device_type == BTN_TOOL_FINGER) { input_mt_init_slots(input_dev, features->touch_max); input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, 0, MT_TOOL_MAX, 0, 0); -- cgit v1.2.3 From ec02ac2b7e1ad04ab2486fe9b2fbfc3ad5178f7c Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:02 +0800 Subject: Input: atmel_mxt_ts - derive phys from i2c client adapter This allows userspace to more easily distinguish which bus a particular atmel_mxt_ts device is attached to. The resulting phys will be something like: i2c-1-0067/input0 Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 42e645062c20..b1108cae73ac 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -250,6 +250,7 @@ struct mxt_finger { struct mxt_data { struct i2c_client *client; struct input_dev *input_dev; + char phys[64]; /* device physical location */ const struct mxt_platform_data *pdata; struct mxt_object *object_table; struct mxt_info info; @@ -1106,6 +1107,10 @@ static int __devinit mxt_probe(struct i2c_client *client, } input_dev->name = "Atmel maXTouch Touchscreen"; + snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0", + client->adapter->nr, client->addr); + input_dev->phys = data->phys; + input_dev->id.bustype = BUS_I2C; input_dev->dev.parent = &client->dev; input_dev->open = mxt_input_open; -- cgit v1.2.3 From c2ef9a1a248bc597f3275e8d52e8ad68416d039f Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:03 +0800 Subject: Input: atmel_mxt_ts - use client name for irq The atmel_mxt_ts driver can support multiple devices simultaneously. Use the i2c_client name instead of the driver name when requesting an interrupt to make the different interrupts distinguishable in /proc/interrupts and top. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index b1108cae73ac..8b33f3ae4eba 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -1154,7 +1154,7 @@ static int __devinit mxt_probe(struct i2c_client *client, goto err_free_object; error = request_threaded_irq(client->irq, NULL, mxt_interrupt, - pdata->irqflags, client->dev.driver->name, data); + pdata->irqflags, client->name, data); if (error) { dev_err(&client->dev, "Failed to register interrupt\n"); goto err_free_object; -- cgit v1.2.3 From e1e1658d2eeb06e09f9855bdf6edb93474eca0c0 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:04 +0800 Subject: Input: atmel_mxt_ts - detect OOM when creating mt slots Hopefully this new code path will never be used, but better safe than sorry... Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 8b33f3ae4eba..926209cba77d 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -1136,7 +1136,9 @@ static int __devinit mxt_probe(struct i2c_client *client, 0, 255, 0, 0); /* For multi touch */ - input_mt_init_slots(input_dev, MXT_MAX_FINGER); + error = input_mt_init_slots(input_dev, MXT_MAX_FINGER); + if (error) + goto err_free_mem; input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, MXT_MAX_AREA, 0, 0); input_set_abs_params(input_dev, ABS_MT_POSITION_X, -- cgit v1.2.3 From 639900380062ecd78ee8b265ea23929c565469b4 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:05 +0800 Subject: Input: atmel_mxt_ts - warn if sysfs could not be created If sysfs entry creation fails, the driver is still usable, so don't just abort probe. Just warn and continue. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 926209cba77d..c72f595a3203 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -1172,13 +1172,10 @@ static int __devinit mxt_probe(struct i2c_client *client, error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group); if (error) - goto err_unregister_device; + dev_warn(&client->dev, "error creating sysfs entries.\n"); return 0; -err_unregister_device: - input_unregister_device(input_dev); - input_dev = NULL; err_free_irq: free_irq(client->irq, data); err_free_object: -- cgit v1.2.3 From 55d6867fe659f4783e57db7b2ae0bb04e4ac816e Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:06 +0800 Subject: Input: atmel_mxt_ts - don't read T5 when dumping objects T5 is the message processor object. Reading it will only have two outcomes, neither of which is particularly useful: 1) the message count decrements, and a valid message will be lost 2) an invalid message will be read (reportid == 0xff) Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index c72f595a3203..9f8dd973e5f5 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -263,7 +263,6 @@ struct mxt_data { static bool mxt_object_readable(unsigned int type) { switch (type) { - case MXT_GEN_MESSAGE_T5: case MXT_GEN_COMMAND_T6: case MXT_GEN_POWER_T7: case MXT_GEN_ACQUIRE_T8: -- cgit v1.2.3 From 9c67b789e051449d3914d683ba3604c5babc4dd9 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:07 +0800 Subject: Input: atmel_mxt_ts - use scnprintf for object sysfs entry Using scnprintf() is a cleaner way to ensure that we don't overwrite the PAGE_SIZE sysfs output buffer. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 9f8dd973e5f5..55855b8c2efd 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -904,17 +904,13 @@ static ssize_t mxt_object_show(struct device *dev, for (i = 0; i < data->info.object_num; i++) { object = data->object_table + i; - count += snprintf(buf + count, PAGE_SIZE - count, + count += scnprintf(buf + count, PAGE_SIZE - count, "Object[%d] (Type %d)\n", i + 1, object->type); - if (count >= PAGE_SIZE) - return PAGE_SIZE - 1; if (!mxt_object_readable(object->type)) { - count += snprintf(buf + count, PAGE_SIZE - count, + count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); - if (count >= PAGE_SIZE) - return PAGE_SIZE - 1; continue; } @@ -924,15 +920,11 @@ static ssize_t mxt_object_show(struct device *dev, if (error) return error; - count += snprintf(buf + count, PAGE_SIZE - count, + count += scnprintf(buf + count, PAGE_SIZE - count, "\t[%2d]: %02x (%d)\n", j, val, val); - if (count >= PAGE_SIZE) - return PAGE_SIZE - 1; } - count += snprintf(buf + count, PAGE_SIZE - count, "\n"); - if (count >= PAGE_SIZE) - return PAGE_SIZE - 1; + count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); } return count; -- cgit v1.2.3 From 43a91d51d3750dd9d5a6e5d14e9250a51f01f3c1 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:08 +0800 Subject: Input: atmel_mxt_ts - optimize reading objects in object sysfs entry Read each object in a single i2c transaction instead of byte-by-byte Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 35 ++++++++++++++------------------ 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 55855b8c2efd..94dd1d156a98 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -479,20 +479,6 @@ static int mxt_read_message(struct mxt_data *data, sizeof(struct mxt_message), message); } -static int mxt_read_object(struct mxt_data *data, - u8 type, u8 offset, u8 *val) -{ - struct mxt_object *object; - u16 reg; - - object = mxt_get_object(data, type); - if (!object) - return -EINVAL; - - reg = object->start_address; - return __mxt_read_reg(data->client, reg + offset, 1, val); -} - static int mxt_write_object(struct mxt_data *data, u8 type, u8 offset, u8 val) { @@ -900,7 +886,14 @@ static ssize_t mxt_object_show(struct device *dev, int i, j; int error; u8 val; + u8 *obuf; + + /* Pre-allocate buffer large enough to hold max sized object. */ + obuf = kmalloc(256, GFP_KERNEL); + if (!obuf) + return -ENOMEM; + error = 0; for (i = 0; i < data->info.object_num; i++) { object = data->object_table + i; @@ -914,20 +907,22 @@ static ssize_t mxt_object_show(struct device *dev, continue; } + error = __mxt_read_reg(data->client, object->start_address, + object->size + 1, obuf); + if (error) + break; + for (j = 0; j < object->size + 1; j++) { - error = mxt_read_object(data, - object->type, j, &val); - if (error) - return error; + val = obuf[j]; count += scnprintf(buf + count, PAGE_SIZE - count, "\t[%2d]: %02x (%d)\n", j, val, val); } - count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); } - return count; + kfree(obuf); + return error ?: count; } static int mxt_load_fw(struct device *dev, const char *fn) -- cgit v1.2.3 From 91630955cb4c9899aa4521d1459837c66c5e9c7a Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:09 +0800 Subject: Input: atmel_mxt_ts - print less overhead when dumping objects Conserve limited (PAGE_SIZE) sysfs output buffer space by only showing readable objects and not printing the object's index, which is not useful to userspace. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 94dd1d156a98..c8cfd7b3dc9e 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -897,15 +897,11 @@ static ssize_t mxt_object_show(struct device *dev, for (i = 0; i < data->info.object_num; i++) { object = data->object_table + i; - count += scnprintf(buf + count, PAGE_SIZE - count, - "Object[%d] (Type %d)\n", - i + 1, object->type); - - if (!mxt_object_readable(object->type)) { - count += scnprintf(buf + count, PAGE_SIZE - count, - "\n"); + if (!mxt_object_readable(object->type)) continue; - } + + count += scnprintf(buf + count, PAGE_SIZE - count, + "T%u:\n", object->type); error = __mxt_read_reg(data->client, object->start_address, object->size + 1, obuf); -- cgit v1.2.3 From 794eb67e76118108af5280ace2be8ae4983a6a81 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:10 +0800 Subject: Input: atmel_mxt_ts - print all instances when dumping objects For objects with multiple instances, dump them all, prepending each with its "Instance #". [rydberg@euromail.se: break out mxt_show_instance()] Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 36 +++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index c8cfd7b3dc9e..ee37b0b0e0e4 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -877,6 +877,24 @@ static void mxt_calc_resolution(struct mxt_data *data) } } +static ssize_t mxt_show_instance(char *buf, int count, + struct mxt_object *object, int instance, + const u8 *val) +{ + int i; + + if (object->instances > 0) + count += scnprintf(buf + count, PAGE_SIZE - count, + "Instance %u\n", instance); + + for (i = 0; i < object->size + 1; i++) + count += scnprintf(buf + count, PAGE_SIZE - count, + "\t[%2u]: %02x (%d)\n", i, val[i], val[i]); + count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); + + return count; +} + static ssize_t mxt_object_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -885,7 +903,6 @@ static ssize_t mxt_object_show(struct device *dev, int count = 0; int i, j; int error; - u8 val; u8 *obuf; /* Pre-allocate buffer large enough to hold max sized object. */ @@ -903,20 +920,19 @@ static ssize_t mxt_object_show(struct device *dev, count += scnprintf(buf + count, PAGE_SIZE - count, "T%u:\n", object->type); - error = __mxt_read_reg(data->client, object->start_address, - object->size + 1, obuf); - if (error) - break; + for (j = 0; j < object->instances + 1; j++) { + u16 size = object->size + 1; + u16 addr = object->start_address + j * size; - for (j = 0; j < object->size + 1; j++) { - val = obuf[j]; + error = __mxt_read_reg(data->client, addr, size, obuf); + if (error) + goto done; - count += scnprintf(buf + count, PAGE_SIZE - count, - "\t[%2d]: %02x (%d)\n", j, val, val); + count = mxt_show_instance(buf, count, object, j, obuf); } - count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); } +done: kfree(obuf); return error ?: count; } -- cgit v1.2.3 From 771733e348e3df5b6283ab3b97d28577452bf09f Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:11 +0800 Subject: Input: atmel_mxt_ts - return errors from i2c layer The i2c layer can report a variety of errors, including -ENXIO for an i2c NAK. Instead of treating them all as -EIO, pass the actual i2c layer error up to the caller. However, still report as -EIO the unlikely case that a transaction was partially completed, and no error message was returned from i2c_*(). Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index ee37b0b0e0e4..a68b2279e8df 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -396,6 +396,7 @@ static int __mxt_read_reg(struct i2c_client *client, { struct i2c_msg xfer[2]; u8 buf[2]; + int ret; buf[0] = reg & 0xff; buf[1] = (reg >> 8) & 0xff; @@ -412,12 +413,17 @@ static int __mxt_read_reg(struct i2c_client *client, xfer[1].len = len; xfer[1].buf = val; - if (i2c_transfer(client->adapter, xfer, 2) != 2) { - dev_err(&client->dev, "%s: i2c transfer failed\n", __func__); - return -EIO; + ret = i2c_transfer(client->adapter, xfer, 2); + if (ret == 2) { + ret = 0; + } else { + if (ret >= 0) + ret = -EIO; + dev_err(&client->dev, "%s: i2c transfer failed (%d)\n", + __func__, ret); } - return 0; + return ret; } static int mxt_read_reg(struct i2c_client *client, u16 reg, u8 *val) @@ -428,17 +434,23 @@ static int mxt_read_reg(struct i2c_client *client, u16 reg, u8 *val) static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val) { u8 buf[3]; + int ret; buf[0] = reg & 0xff; buf[1] = (reg >> 8) & 0xff; buf[2] = val; - if (i2c_master_send(client, buf, 3) != 3) { - dev_err(&client->dev, "%s: i2c send failed\n", __func__); - return -EIO; + ret = i2c_master_send(client, buf, 3); + if (ret == 3) { + ret = 0; + } else { + if (ret >= 0) + ret = -EIO; + dev_err(&client->dev, "%s: i2c send failed (%d)\n", + __func__, ret); } - return 0; + return ret; } static int mxt_read_object_table(struct i2c_client *client, -- cgit v1.2.3 From 9638ab7c9c3b352d54f4f7e80027bd6e1c0584e8 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:12 +0800 Subject: Input: atmel_mxt_ts - add variable length __mxt_write_reg The i2c bus requires 4 bytes to do a 1-byte write (1 byte i2c address + 2 byte offset + 1 byte data). By taking a length with writes, the driver can amortize transaction overhead by performing larger transactions where appropriate. This patch just sets up the new API. Later patches refactor writes to take advantage of the larger transactions. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index a68b2279e8df..dd2577b796a4 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -431,17 +431,24 @@ static int mxt_read_reg(struct i2c_client *client, u16 reg, u8 *val) return __mxt_read_reg(client, reg, 1, val); } -static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val) +static int __mxt_write_reg(struct i2c_client *client, u16 reg, u16 len, + const void *val) { - u8 buf[3]; + u8 *buf; + size_t count; int ret; + count = len + 2; + buf = kmalloc(count, GFP_KERNEL); + if (!buf) + return -ENOMEM; + buf[0] = reg & 0xff; buf[1] = (reg >> 8) & 0xff; - buf[2] = val; + memcpy(&buf[2], val, len); - ret = i2c_master_send(client, buf, 3); - if (ret == 3) { + ret = i2c_master_send(client, buf, count); + if (ret == count) { ret = 0; } else { if (ret >= 0) @@ -450,9 +457,15 @@ static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val) __func__, ret); } + kfree(buf); return ret; } +static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val) +{ + return __mxt_write_reg(client, reg, 1, &val); +} + static int mxt_read_object_table(struct i2c_client *client, u16 reg, u8 *object_buf) { -- cgit v1.2.3 From cf94bc09c89c923d339c68cf89360c02578ceee3 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:13 +0800 Subject: Input: atmel_mxt_ts - optimize writing of object table entries Write each object using a single bulk i2c write transfer. Signed-off-by: Daniel Kurtz Reviewed-by: Joonyoung Shim Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index dd2577b796a4..99d5210c7ae8 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -655,7 +655,8 @@ static int mxt_check_reg_init(struct mxt_data *data) struct mxt_object *object; struct device *dev = &data->client->dev; int index = 0; - int i, j, config_offset; + int i, size; + int ret; if (!pdata->config) { dev_dbg(dev, "No cfg data defined, skipping reg init\n"); @@ -668,18 +669,17 @@ static int mxt_check_reg_init(struct mxt_data *data) if (!mxt_object_writable(object->type)) continue; - for (j = 0; - j < (object->size + 1) * (object->instances + 1); - j++) { - config_offset = index + j; - if (config_offset > pdata->config_length) { - dev_err(dev, "Not enough config data!\n"); - return -EINVAL; - } - mxt_write_object(data, object->type, j, - pdata->config[config_offset]); + size = (object->size + 1) * (object->instances + 1); + if (index + size > pdata->config_length) { + dev_err(dev, "Not enough config data!\n"); + return -EINVAL; } - index += (object->size + 1) * (object->instances + 1); + + ret = __mxt_write_reg(data->client, object->start_address, + size, &pdata->config[index]); + if (ret) + return ret; + index += size; } return 0; -- cgit v1.2.3 From 23003a8496b3f8100ed215dfda438cece5745545 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:14 +0800 Subject: Input: atmel_mxt_ts - read ID information block in one i2c transaction Reading the whole info block in one i2c transaction speeds up driver probe significantly, especially on slower i2c busses. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 99d5210c7ae8..fac379146546 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -36,6 +36,7 @@ #define MXT_FW_NAME "maxtouch.fw" /* Registers */ +#define MXT_INFO 0x00 #define MXT_FAMILY_ID 0x00 #define MXT_VARIANT_ID 0x01 #define MXT_VERSION 0x02 @@ -760,32 +761,11 @@ static int mxt_get_info(struct mxt_data *data) struct i2c_client *client = data->client; struct mxt_info *info = &data->info; int error; - u8 val; - - error = mxt_read_reg(client, MXT_FAMILY_ID, &val); - if (error) - return error; - info->family_id = val; - - error = mxt_read_reg(client, MXT_VARIANT_ID, &val); - if (error) - return error; - info->variant_id = val; - - error = mxt_read_reg(client, MXT_VERSION, &val); - if (error) - return error; - info->version = val; - - error = mxt_read_reg(client, MXT_BUILD, &val); - if (error) - return error; - info->build = val; - error = mxt_read_reg(client, MXT_OBJECT_NUM, &val); + /* Read 7-byte info block starting at address 0 */ + error = __mxt_read_reg(client, MXT_INFO, sizeof(*info), info); if (error) return error; - info->object_num = val; return 0; } -- cgit v1.2.3 From e0e0269f347ce89251ecf02ec4a209136bda258e Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:15 +0800 Subject: Input: atmel_mxt_ts - update driver ID info logging Print unsigned values as '%u'. Also, parse and print the firmware version in its canonical format, as suggested by Nick Dyer. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index fac379146546..7a839d106336 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -856,12 +856,12 @@ static int mxt_initialize(struct mxt_data *data) info->matrix_ysize = val; dev_info(&client->dev, - "Family ID: %d Variant ID: %d Version: %d Build: %d\n", - info->family_id, info->variant_id, info->version, - info->build); + "Family ID: %u Variant ID: %u Major.Minor.Build: %u.%u.%02X\n", + info->family_id, info->variant_id, info->version >> 4, + info->version & 0xf, info->build); dev_info(&client->dev, - "Matrix X Size: %d Matrix Y Size: %d Object Num: %d\n", + "Matrix X Size: %u Matrix Y Size: %u Object Num: %u\n", info->matrix_xsize, info->matrix_ysize, info->object_num); -- cgit v1.2.3 From b19fc9ec241382c2155bf56f08f02066f2fb4826 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:16 +0800 Subject: Input: atmel_mxt_ts - add sysfs entries to read fw and hw version Make firmware and hardware version strings available to userspace. This is useful, for example, to allow a userspace program to implement a firwmare update policy. Change-Id: I1eddb4bbf5f3f9ae6947a8528598973ddead18cf Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 7a839d106336..f2c1fbe2556e 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -882,6 +882,26 @@ static void mxt_calc_resolution(struct mxt_data *data) } } +/* Firmware Version is returned as Major.Minor.Build */ +static ssize_t mxt_fw_version_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct mxt_data *data = dev_get_drvdata(dev); + struct mxt_info *info = &data->info; + return scnprintf(buf, PAGE_SIZE, "%u.%u.%02X\n", + info->version >> 4, info->version & 0xf, info->build); +} + +/* Hardware Version is returned as FamilyID.VariantID */ +static ssize_t mxt_hw_version_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct mxt_data *data = dev_get_drvdata(dev); + struct mxt_info *info = &data->info; + return scnprintf(buf, PAGE_SIZE, "%u.%u\n", + info->family_id, info->variant_id); +} + static ssize_t mxt_show_instance(char *buf, int count, struct mxt_object *object, int instance, const u8 *val) @@ -1047,10 +1067,14 @@ static ssize_t mxt_update_fw_store(struct device *dev, return count; } +static DEVICE_ATTR(fw_version, S_IRUGO, mxt_fw_version_show, NULL); +static DEVICE_ATTR(hw_version, S_IRUGO, mxt_hw_version_show, NULL); static DEVICE_ATTR(object, S_IRUGO, mxt_object_show, NULL); static DEVICE_ATTR(update_fw, S_IWUSR, NULL, mxt_update_fw_store); static struct attribute *mxt_attrs[] = { + &dev_attr_fw_version.attr, + &dev_attr_hw_version.attr, &dev_attr_object.attr, &dev_attr_update_fw.attr, NULL -- cgit v1.2.3 From fba5bc313c44acfb3561da69526cbc1a0029cdd8 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:17 +0800 Subject: Input: atmel_mxt_ts - simplify event reporting Instead of carrying around per-finger state in the driver instance, just report each finger as it arrives to the input layer, and let the input layer (evdev) hold the event state (which it does anyway). Note: this driver does not really do MT-B properly. Each input report (a group of input events followed by a SYN_REPORT) only contains data for a single contact. When multiple fingers are present on a device, each is properly reported in its own MT_SLOT. However, there is only ever one MT_SLOT per SYN_REPORT. This is fixed in a subsequent patch. This patch was tested with an mXT224E. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 89 +++++--------------------------- 1 file changed, 13 insertions(+), 76 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index f2c1fbe2556e..c37584de49ca 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -239,14 +239,6 @@ struct mxt_message { u8 message[7]; }; -struct mxt_finger { - int status; - int x; - int y; - int area; - int pressure; -}; - /* Each client has this additional data */ struct mxt_data { struct i2c_client *client; @@ -255,7 +247,6 @@ struct mxt_data { const struct mxt_platform_data *pdata; struct mxt_object *object_table; struct mxt_info info; - struct mxt_finger finger[MXT_MAX_FINGER]; unsigned int irq; unsigned int max_x; unsigned int max_y; @@ -519,75 +510,17 @@ static int mxt_write_object(struct mxt_data *data, return mxt_write_reg(data->client, reg + offset, val); } -static void mxt_input_report(struct mxt_data *data, int single_id) -{ - struct mxt_finger *finger = data->finger; - struct input_dev *input_dev = data->input_dev; - int status = finger[single_id].status; - int finger_num = 0; - int id; - - for (id = 0; id < MXT_MAX_FINGER; id++) { - if (!finger[id].status) - continue; - - input_mt_slot(input_dev, id); - input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, - finger[id].status != MXT_RELEASE); - - if (finger[id].status != MXT_RELEASE) { - finger_num++; - input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, - finger[id].area); - input_report_abs(input_dev, ABS_MT_POSITION_X, - finger[id].x); - input_report_abs(input_dev, ABS_MT_POSITION_Y, - finger[id].y); - input_report_abs(input_dev, ABS_MT_PRESSURE, - finger[id].pressure); - } else { - finger[id].status = 0; - } - } - - input_report_key(input_dev, BTN_TOUCH, finger_num > 0); - - if (status != MXT_RELEASE) { - input_report_abs(input_dev, ABS_X, finger[single_id].x); - input_report_abs(input_dev, ABS_Y, finger[single_id].y); - input_report_abs(input_dev, - ABS_PRESSURE, finger[single_id].pressure); - } - - input_sync(input_dev); -} - static void mxt_input_touchevent(struct mxt_data *data, struct mxt_message *message, int id) { - struct mxt_finger *finger = data->finger; struct device *dev = &data->client->dev; u8 status = message->message[0]; + struct input_dev *input_dev = data->input_dev; int x; int y; int area; int pressure; - /* Check the touch is present on the screen */ - if (!(status & MXT_DETECT)) { - if (status & MXT_RELEASE) { - dev_dbg(dev, "[%d] released\n", id); - - finger[id].status = MXT_RELEASE; - mxt_input_report(data, id); - } - return; - } - - /* Check only AMP detection */ - if (!(status & (MXT_PRESS | MXT_MOVE))) - return; - x = (message->message[1] << 4) | ((message->message[3] >> 4) & 0xf); y = (message->message[2] << 4) | ((message->message[3] & 0xf)); if (data->max_x < 1024) @@ -601,15 +534,19 @@ static void mxt_input_touchevent(struct mxt_data *data, dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id, status & MXT_MOVE ? "moved" : "pressed", x, y, area); + input_mt_slot(input_dev, id); + input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, + status & MXT_DETECT); + + if (status & MXT_DETECT) { + input_report_abs(input_dev, ABS_MT_POSITION_X, x); + input_report_abs(input_dev, ABS_MT_POSITION_Y, y); + input_report_abs(input_dev, ABS_MT_PRESSURE, pressure); + input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, area); + } - finger[id].status = status & MXT_MOVE ? - MXT_MOVE : MXT_PRESS; - finger[id].x = x; - finger[id].y = y; - finger[id].area = area; - finger[id].pressure = pressure; - - mxt_input_report(data, id); + input_mt_report_pointer_emulation(input_dev, false); + input_sync(input_dev); } static irqreturn_t mxt_interrupt(int irq, void *dev_id) -- cgit v1.2.3 From b2e459b81b33ca17052de03b1315d8511d769507 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:18 +0800 Subject: Input: atmel_mxt_ts - add detail to touchevent debug message Update the debug message: * print inidividual status bits * print the pressure value * use '%u' for unsigned quantities Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index c37584de49ca..d6b64a0fed45 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -195,6 +195,7 @@ #define MXT_BOOT_STATUS_MASK 0x3f /* Touch status */ +#define MXT_UNGRIP (1 << 0) #define MXT_SUPPRESS (1 << 1) #define MXT_AMP (1 << 2) #define MXT_VECTOR (1 << 3) @@ -531,9 +532,19 @@ static void mxt_input_touchevent(struct mxt_data *data, area = message->message[4]; pressure = message->message[5]; - dev_dbg(dev, "[%d] %s x: %d, y: %d, area: %d\n", id, - status & MXT_MOVE ? "moved" : "pressed", - x, y, area); + dev_dbg(dev, + "[%u] %c%c%c%c%c%c%c%c x: %5u y: %5u area: %3u amp: %3u\n", + id, + (status & MXT_DETECT) ? 'D' : '.', + (status & MXT_PRESS) ? 'P' : '.', + (status & MXT_RELEASE) ? 'R' : '.', + (status & MXT_MOVE) ? 'M' : '.', + (status & MXT_VECTOR) ? 'V' : '.', + (status & MXT_AMP) ? 'A' : '.', + (status & MXT_SUPPRESS) ? 'S' : '.', + (status & MXT_UNGRIP) ? 'U' : '.', + x, y, area, pressure); + input_mt_slot(input_dev, id); input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, status & MXT_DETECT); -- cgit v1.2.3 From 7d4fa100b0cc069b2d788e1d9fe086e9e057958e Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:19 +0800 Subject: Input: atmel_mxt_ts - refactor when and how object table is freed The Object Table is freed in three cases: 1) When the driver is being removed. 2) In the error path of mxt_initialize(). 3) Just after a firmware update, when a new object table is about to be read. For cases 2 & 3, the driver is not immediately unloaded, so this patch refactors these cases to use a common cleanup function. It also refactors the mxt_initialize error paths to ensure that this cleanup happens. Note: mxt_update_fw_store() does not handle errors during mxt_initialize(). A proposed fix for this is in a subsequent patchset. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index d6b64a0fed45..488e3e88c3fc 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -750,6 +750,12 @@ static int mxt_get_object_table(struct mxt_data *data) return 0; } +static void mxt_free_object_table(struct mxt_data *data) +{ + kfree(data->object_table); + data->object_table = NULL; +} + static int mxt_initialize(struct mxt_data *data) { struct i2c_client *client = data->client; @@ -772,12 +778,12 @@ static int mxt_initialize(struct mxt_data *data) /* Get object table information */ error = mxt_get_object_table(data); if (error) - return error; + goto err_free_object_table; /* Check register init values */ error = mxt_check_reg_init(data); if (error) - return error; + goto err_free_object_table; mxt_handle_pdata(data); @@ -795,12 +801,12 @@ static int mxt_initialize(struct mxt_data *data) /* Update matrix size at info struct */ error = mxt_read_reg(client, MXT_MATRIX_X_SIZE, &val); if (error) - return error; + goto err_free_object_table; info->matrix_xsize = val; error = mxt_read_reg(client, MXT_MATRIX_Y_SIZE, &val); if (error) - return error; + goto err_free_object_table; info->matrix_ysize = val; dev_info(&client->dev, @@ -814,6 +820,10 @@ static int mxt_initialize(struct mxt_data *data) info->object_num); return 0; + +err_free_object_table: + mxt_free_object_table(data); + return error; } static void mxt_calc_resolution(struct mxt_data *data) @@ -1000,8 +1010,7 @@ static ssize_t mxt_update_fw_store(struct device *dev, /* Wait for reset */ msleep(MXT_FWRESET_TIME); - kfree(data->object_table); - data->object_table = NULL; + mxt_free_object_table(data); mxt_initialize(data); } @@ -1128,7 +1137,7 @@ static int __devinit mxt_probe(struct i2c_client *client, error = mxt_initialize(data); if (error) - goto err_free_object; + goto err_free_mem; error = request_threaded_irq(client->irq, NULL, mxt_interrupt, pdata->irqflags, client->name, data); -- cgit v1.2.3 From 333e5a9a99b8bba14f1a8631218d2d1e55fd58b1 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:20 +0800 Subject: Input: atmel_mxt_ts - cache T9 reportid range when reading object table Streamline interrupt processing by caching the T9 reportid range when first reading the object table. In the process, refactor reading the object descriptor table. First, since the object_table entries are now exactly the same layout in device memory and in the driver, allocate an appropriately sized array and fetch the entire table directly into it in a single i2c transaction. Since a 6 byte table object requires 10 bytes to read, doing this dramatically reduces overhead. Note: The cached T9 reportid's are initialized to 0, which is an invalid reportid. Thus, the checks in the interrupt handler will always fail for devices that do not support the T9 object. Therefore, after doing a firmware update, the old object table is destroyed and all cached object values are reset to 0, before reading the new object table, in case the new firmware does not have the old objects. This patch tested on an MXT224E. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 76 +++++++++++++++++--------------- 1 file changed, 41 insertions(+), 35 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 488e3e88c3fc..48f3637aecaa 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -227,13 +227,10 @@ struct mxt_info { struct mxt_object { u8 type; u16 start_address; - u8 size; - u8 instances; + u8 size; /* Size of each instance - 1 */ + u8 instances; /* Number of instances - 1 */ u8 num_report_ids; - - /* to map object and message */ - u8 max_reportid; -}; +} __packed; struct mxt_message { u8 reportid; @@ -251,6 +248,10 @@ struct mxt_data { unsigned int irq; unsigned int max_x; unsigned int max_y; + + /* Cached parameters from object table */ + u8 T9_reportid_min; + u8 T9_reportid_max; }; static bool mxt_object_readable(unsigned int type) @@ -459,13 +460,6 @@ static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val) return __mxt_write_reg(client, reg, 1, &val); } -static int mxt_read_object_table(struct i2c_client *client, - u16 reg, u8 *object_buf) -{ - return __mxt_read_reg(client, reg, MXT_OBJECT_SIZE, - object_buf); -} - static struct mxt_object * mxt_get_object(struct mxt_data *data, u8 type) { @@ -564,7 +558,6 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) { struct mxt_data *data = dev_id; struct mxt_message message; - struct mxt_object *object; struct device *dev = &data->client->dev; int id; u8 reportid; @@ -579,13 +572,8 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) reportid = message.reportid; - /* whether reportid is thing of MXT_TOUCH_MULTI_T9 */ - object = mxt_get_object(data, MXT_TOUCH_MULTI_T9); - if (!object) - goto end; - - max_reportid = object->max_reportid; - min_reportid = max_reportid - object->num_report_ids + 1; + max_reportid = data->T9_reportid_max; + min_reportid = data->T9_reportid_min; id = reportid - min_reportid; if (reportid >= min_reportid && reportid <= max_reportid) @@ -720,30 +708,46 @@ static int mxt_get_info(struct mxt_data *data) static int mxt_get_object_table(struct mxt_data *data) { + struct i2c_client *client = data->client; + size_t table_size; int error; int i; - u16 reg; - u8 reportid = 0; - u8 buf[MXT_OBJECT_SIZE]; + u8 reportid; + + table_size = data->info.object_num * sizeof(struct mxt_object); + error = __mxt_read_reg(client, MXT_OBJECT_START, table_size, + data->object_table); + if (error) + return error; + /* Valid Report IDs start counting from 1 */ + reportid = 1; for (i = 0; i < data->info.object_num; i++) { struct mxt_object *object = data->object_table + i; + u8 min_id, max_id; - reg = MXT_OBJECT_START + MXT_OBJECT_SIZE * i; - error = mxt_read_object_table(data->client, reg, buf); - if (error) - return error; - - object->type = buf[0]; - object->start_address = (buf[2] << 8) | buf[1]; - object->size = buf[3]; - object->instances = buf[4]; - object->num_report_ids = buf[5]; + le16_to_cpus(&object->start_address); if (object->num_report_ids) { + min_id = reportid; reportid += object->num_report_ids * (object->instances + 1); - object->max_reportid = reportid; + max_id = reportid - 1; + } else { + min_id = 0; + max_id = 0; + } + + dev_dbg(&data->client->dev, + "Type %2d Start %3d Size %3d Instances %2d ReportIDs %3u : %3u\n", + object->type, object->start_address, object->size + 1, + object->instances + 1, min_id, max_id); + + switch (object->type) { + case MXT_TOUCH_MULTI_T9: + data->T9_reportid_min = min_id; + data->T9_reportid_max = max_id; + break; } } @@ -754,6 +758,8 @@ static void mxt_free_object_table(struct mxt_data *data) { kfree(data->object_table); data->object_table = NULL; + data->T9_reportid_min = 0; + data->T9_reportid_max = 0; } static int mxt_initialize(struct mxt_data *data) -- cgit v1.2.3 From 04a79181c40d3ad99885e7f799c799c153e93431 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:21 +0800 Subject: Input: atmel_mxt_ts - refactor reportid checking in mxt_interrupt This small refactor is in preparation for checking more report types in the mxt_interrupt message processing loop. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 48f3637aecaa..a9e0b541c638 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -554,6 +554,12 @@ static void mxt_input_touchevent(struct mxt_data *data, input_sync(input_dev); } +static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg) +{ + u8 id = msg->reportid; + return (id >= data->T9_reportid_min && id <= data->T9_reportid_max); +} + static irqreturn_t mxt_interrupt(int irq, void *dev_id) { struct mxt_data *data = dev_id; @@ -561,8 +567,6 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) struct device *dev = &data->client->dev; int id; u8 reportid; - u8 max_reportid; - u8 min_reportid; do { if (mxt_read_message(data, &message)) { @@ -572,11 +576,9 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) reportid = message.reportid; - max_reportid = data->T9_reportid_max; - min_reportid = data->T9_reportid_min; - id = reportid - min_reportid; + id = reportid - data->T9_reportid_min; - if (reportid >= min_reportid && reportid <= max_reportid) + if (mxt_is_T9_message(data, &message)) mxt_input_touchevent(data, &message, id); else mxt_dump_message(dev, &message); -- cgit v1.2.3 From cb15911509164f052f103e85a935f513f82e6b54 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:22 +0800 Subject: Input: atmel_mxt_ts - use T9 reportid range to init number of mt slots Atmel mxt devices can report one finger for each T9 reportid. Therefore, this range can be used to report the max number of MT-B slots to userspace instead of assuming a fixed 10. Note that mxt_initialized() must complete early, since the input_dev properties now depend on values in the object table. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index a9e0b541c638..2746b0dc7f36 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -212,8 +212,6 @@ /* Touchscreen absolute values */ #define MXT_MAX_AREA 0xff -#define MXT_MAX_FINGER 10 - struct mxt_info { u8 family_id; u8 variant_id; @@ -1086,6 +1084,7 @@ static int __devinit mxt_probe(struct i2c_client *client, struct mxt_data *data; struct input_dev *input_dev; int error; + unsigned int num_mt_slots; if (!pdata) return -EINVAL; @@ -1115,6 +1114,10 @@ static int __devinit mxt_probe(struct i2c_client *client, mxt_calc_resolution(data); + error = mxt_initialize(data); + if (error) + goto err_free_mem; + __set_bit(EV_ABS, input_dev->evbit); __set_bit(EV_KEY, input_dev->evbit); __set_bit(BTN_TOUCH, input_dev->keybit); @@ -1128,9 +1131,10 @@ static int __devinit mxt_probe(struct i2c_client *client, 0, 255, 0, 0); /* For multi touch */ - error = input_mt_init_slots(input_dev, MXT_MAX_FINGER); + num_mt_slots = data->T9_reportid_max - data->T9_reportid_min + 1; + error = input_mt_init_slots(input_dev, num_mt_slots); if (error) - goto err_free_mem; + goto err_free_object; input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, MXT_MAX_AREA, 0, 0); input_set_abs_params(input_dev, ABS_MT_POSITION_X, @@ -1143,10 +1147,6 @@ static int __devinit mxt_probe(struct i2c_client *client, input_set_drvdata(input_dev, data); i2c_set_clientdata(client, data); - error = mxt_initialize(data); - if (error) - goto err_free_mem; - error = request_threaded_irq(client->irq, NULL, mxt_interrupt, pdata->irqflags, client->name, data); if (error) { -- cgit v1.2.3 From 64464ae8e1d64fc9f63d9686d5e40b56ffa77203 Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:23 +0800 Subject: Input: atmel_mxt_ts - send all MT-B slots in one input report Each interrupt contains information for all contacts with changing properties. Process all of this information at once, and send it all in a a single input report (ie input events ending in EV_SYN/SYN_REPORT). This patch was tested using an MXT224E. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 2746b0dc7f36..4c9a06c7eae3 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -547,9 +547,6 @@ static void mxt_input_touchevent(struct mxt_data *data, input_report_abs(input_dev, ABS_MT_PRESSURE, pressure); input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, area); } - - input_mt_report_pointer_emulation(input_dev, false); - input_sync(input_dev); } static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg) @@ -565,6 +562,7 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) struct device *dev = &data->client->dev; int id; u8 reportid; + bool update_input = false; do { if (mxt_read_message(data, &message)) { @@ -576,12 +574,19 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) id = reportid - data->T9_reportid_min; - if (mxt_is_T9_message(data, &message)) + if (mxt_is_T9_message(data, &message)) { mxt_input_touchevent(data, &message, id); - else + update_input = true; + } else { mxt_dump_message(dev, &message); + } } while (reportid != 0xff); + if (update_input) { + input_mt_report_pointer_emulation(data->input_dev, false); + input_sync(data->input_dev); + } + end: return IRQ_HANDLED; } -- cgit v1.2.3 From fdf804210f297b7a114fa7a216c2ab65b0f693da Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 28 Jun 2012 21:08:24 +0800 Subject: Input: atmel_mxt_ts - parse T6 reports The normal messages sent after boot or NVRAM update are T6 reports, containing a status, and the config memory checksum. Parse them and dump a useful info message. This patch tested on an MXT224E. Signed-off-by: Daniel Kurtz Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 4c9a06c7eae3..37190ab1f817 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -248,6 +248,7 @@ struct mxt_data { unsigned int max_y; /* Cached parameters from object table */ + u8 T6_reportid; u8 T9_reportid_min; u8 T9_reportid_max; }; @@ -549,6 +550,11 @@ static void mxt_input_touchevent(struct mxt_data *data, } } +static unsigned mxt_extract_T6_csum(const u8 *csum) +{ + return csum[0] | (csum[1] << 8) | (csum[2] << 16); +} + static bool mxt_is_T9_message(struct mxt_data *data, struct mxt_message *msg) { u8 id = msg->reportid; @@ -559,8 +565,8 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) { struct mxt_data *data = dev_id; struct mxt_message message; + const u8 *payload = &message.message[0]; struct device *dev = &data->client->dev; - int id; u8 reportid; bool update_input = false; @@ -572,9 +578,13 @@ static irqreturn_t mxt_interrupt(int irq, void *dev_id) reportid = message.reportid; - id = reportid - data->T9_reportid_min; - - if (mxt_is_T9_message(data, &message)) { + if (reportid == data->T6_reportid) { + u8 status = payload[0]; + unsigned csum = mxt_extract_T6_csum(&payload[1]); + dev_dbg(dev, "Status: %02x Config Checksum: %06x\n", + status, csum); + } else if (mxt_is_T9_message(data, &message)) { + int id = reportid - data->T9_reportid_min; mxt_input_touchevent(data, &message, id); update_input = true; } else { @@ -749,6 +759,9 @@ static int mxt_get_object_table(struct mxt_data *data) object->instances + 1, min_id, max_id); switch (object->type) { + case MXT_GEN_COMMAND_T6: + data->T6_reportid = min_id; + break; case MXT_TOUCH_MULTI_T9: data->T9_reportid_min = min_id; data->T9_reportid_max = max_id; @@ -763,8 +776,10 @@ static void mxt_free_object_table(struct mxt_data *data) { kfree(data->object_table); data->object_table = NULL; + data->T6_reportid = 0; data->T9_reportid_min = 0; data->T9_reportid_max = 0; + } static int mxt_initialize(struct mxt_data *data) -- cgit v1.2.3 From c45361a1287a74d327d72d4d2b96f4ac170653d9 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Thu, 5 Jul 2012 20:55:24 +0200 Subject: Revert "Input: atmel_mxt_ts - warn if sysfs could not be created" Dmitry: I understand that I am a bit late to the party :) but I do not agree with this change. Failure to create attributes is not sometihng that user could cause (at least not easily) and thus would not be a setup issue but something more severe. I believe we should fail loading the driver so sysfs attribute breakage will be noticed as soon as possible, instead of discovering it much much later in the process. This reverts commit 639900380062ecd78ee8b265ea23929c565469b4. Requested-by: Dmitry Torokhov Signed-off-by: Henrik Rydberg --- drivers/input/touchscreen/atmel_mxt_ts.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 37190ab1f817..3ad942ca8725 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -1184,10 +1184,13 @@ static int __devinit mxt_probe(struct i2c_client *client, error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group); if (error) - dev_warn(&client->dev, "error creating sysfs entries.\n"); + goto err_unregister_device; return 0; +err_unregister_device: + input_unregister_device(input_dev); + input_dev = NULL; err_free_irq: free_irq(client->irq, data); err_free_object: -- cgit v1.2.3 From f2bb26b9b7652287719f08f080c09c2d7ddcf6b5 Mon Sep 17 00:00:00 2001 From: Bob Ross Date: Fri, 6 Jul 2012 11:34:47 -0700 Subject: Input: synaptics_usb - Remove TrackPoint name trailing whitespace The USB TrackPoint name string contains a space at the trailing end that can cause confusion/difficulty when creating udev rules. Example: "Synaptics Inc. Composite TouchPad / TrackPoint (Stick) " This patch removes the trailing space. Signed-off-by: Bob Ross Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/synaptics_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') 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, le16_to_cpu(udev->descriptor.idProduct)); if (synusb->flags & SYNUSB_STICK) - strlcat(synusb->name, " (Stick) ", sizeof(synusb->name)); + strlcat(synusb->name, " (Stick)", sizeof(synusb->name)); usb_make_path(udev, synusb->phys, sizeof(synusb->phys)); strlcat(synusb->phys, "/input0", sizeof(synusb->phys)); -- cgit v1.2.3 From 6680884a44207efe8ef6bc56b1c932cce2b89994 Mon Sep 17 00:00:00 2001 From: Michael Hennerich Date: Fri, 6 Jul 2012 10:44:19 -0700 Subject: Input: ad7879 - add option to correct xy axis Sebastian Zenker reported that driver swaps x and y samples when the touchscreen leads are connected in accordance with the datasheet specification. Transposed axis can be typically corrected by touch screen calibration however this bug also negatively influences touch pressure measurements. Add an option to correct x and y axis. Signed-off-by: Michael Hennerich Reported-and-tested-by: Sebastian Zenker Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/ad7879.c | 5 +++++ include/linux/spi/ad7879.h | 2 ++ 2 files changed, 7 insertions(+) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index e2482b40da51..e60709261951 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c @@ -118,6 +118,7 @@ struct ad7879 { unsigned int irq; bool disabled; /* P: input->mutex */ bool suspended; /* P: input->mutex */ + bool swap_xy; u16 conversion_data[AD7879_NR_SENSE]; char phys[32]; u8 first_conversion_delay; @@ -161,6 +162,9 @@ static int ad7879_report(struct ad7879 *ts) z1 = ts->conversion_data[AD7879_SEQ_Z1] & MAX_12BIT; z2 = ts->conversion_data[AD7879_SEQ_Z2] & MAX_12BIT; + if (ts->swap_xy) + swap(x, y); + /* * The samples processed here are already preprocessed by the AD7879. * 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, ts->dev = dev; ts->input = input_dev; ts->irq = irq; + ts->swap_xy = pdata->swap_xy; setup_timer(&ts->timer, ad7879_timer, (unsigned long) ts); diff --git a/include/linux/spi/ad7879.h b/include/linux/spi/ad7879.h index 6334cee1a3be..58368be0b4c0 100644 --- a/include/linux/spi/ad7879.h +++ b/include/linux/spi/ad7879.h @@ -12,6 +12,8 @@ struct ad7879_platform_data { u16 y_min, y_max; u16 pressure_min, pressure_max; + bool swap_xy; /* swap x and y axes */ + /* [0..255] 0=OFF Starts at 1=550us and goes * all the way to 9.440ms in steps of 35us. */ -- cgit v1.2.3 From a1e636e6d35944a2b970481b78a621774276acfd Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Fri, 6 Jul 2012 11:26:05 -0700 Subject: Input: imx_keypad - use clk_prepare_enable/clk_disable_unprepare() Adapt clock handling to the new i.mx clock framework and fix the following warning: input: imx-keypad as /devices/platform/imx-keypad/input/input0 ------------[ cut here ]------------ WARNING: at drivers/clk/clk.c:511 __clk_enable+0x98/0xa8() Modules linked in: [] (unwind_backtrace+0x0/0xf4) from [] (warn_slowpath_commo) [] (warn_slowpath_common+0x48/0x60) from [] (warn_slowpath_) [] (warn_slowpath_null+0x1c/0x24) from [] (__clk_enable+0x9) [] (__clk_enable+0x98/0xa8) from [] (clk_enable+0x24/0x5c) [] (clk_enable+0x24/0x5c) from [] (imx_keypad_open+0x28/0xc) [] (imx_keypad_open+0x28/0xc8) from [] (input_open_device+0) [] (input_open_device+0x78/0xa8) from [] (kbd_connect+0x60/) [] (kbd_connect+0x60/0x80) from [] (input_attach_handler+0x) [] (input_attach_handler+0x220/0x258) from [] (input_regist) [] (input_register_device+0x31c/0x390) from [] (imx_keypad_) [] (imx_keypad_probe+0x2e4/0x3b8) from [] (platform_drv_pro) [] (platform_drv_probe+0x18/0x1c) from [] (driver_probe_dev) [] (driver_probe_device+0x84/0x210) from [] (__driver_attac) [] (__driver_attach+0x8c/0x90) from [] (bus_for_each_dev+0x) [] (bus_for_each_dev+0x68/0x90) from [] (bus_add_driver+0xa) [] (bus_add_driver+0xa4/0x23c) from [] (driver_register+0x7) [] (driver_register+0x78/0x12c) from [] (do_one_initcall+0x) [] (do_one_initcall+0x34/0x188) from [] (kernel_init+0xe4/0) [] (kernel_init+0xe4/0x1a8) from [] (kernel_thread_exit+0x0) ---[ end trace 1d550e891d03d7ce ]--- Signed-off-by: Fabio Estevam Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/imx_keypad.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index 6ee7421e2321..9d57945db53d 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c @@ -378,7 +378,7 @@ static void imx_keypad_close(struct input_dev *dev) imx_keypad_inhibit(keypad); /* Disable clock unit */ - clk_disable(keypad->clk); + clk_disable_unprepare(keypad->clk); } static int imx_keypad_open(struct input_dev *dev) @@ -391,7 +391,7 @@ static int imx_keypad_open(struct input_dev *dev) keypad->enabled = true; /* Enable the kpp clock */ - clk_enable(keypad->clk); + clk_prepare_enable(keypad->clk); imx_keypad_config(keypad); /* Sanity control, not all the rows must be actived now. */ @@ -581,7 +581,7 @@ static int imx_kbd_suspend(struct device *dev) mutex_lock(&input_dev->mutex); if (input_dev->users) - clk_disable(kbd->clk); + clk_disable_unprepare(kbd->clk); mutex_unlock(&input_dev->mutex); @@ -603,7 +603,7 @@ static int imx_kbd_resume(struct device *dev) mutex_lock(&input_dev->mutex); if (input_dev->users) - clk_enable(kbd->clk); + clk_prepare_enable(kbd->clk); mutex_unlock(&input_dev->mutex); -- cgit v1.2.3 From a40ec72d540553fc0e1d1fea94c1d7629b7f35f4 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Fri, 6 Jul 2012 11:26:37 -0700 Subject: Input: imx_keypad - adapt the new kpp clock name With the new i.mx clock framework we should pass NULL as the keypad clock name. Signed-off-by: Fabio Estevam Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/imx_keypad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index 9d57945db53d..4830615ed2ec 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c @@ -467,7 +467,7 @@ static int __devinit imx_keypad_probe(struct platform_device *pdev) goto failed_free_priv; } - keypad->clk = clk_get(&pdev->dev, "kpp"); + keypad->clk = clk_get(&pdev->dev, NULL); if (IS_ERR(keypad->clk)) { dev_err(&pdev->dev, "failed to get keypad clock\n"); error = PTR_ERR(keypad->clk); -- cgit v1.2.3 From 333fbe8409dfabd3d3581af5cdbd30f666857437 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Fri, 6 Jul 2012 11:31:14 -0700 Subject: Input: imx_keypad - check error returned by clk_prepare_enable() Check error returned by clk_prepare_enable(). Signed-off-by: Fabio Estevam Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/imx_keypad.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index 4830615ed2ec..ff4c0a87a25f 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c @@ -384,14 +384,18 @@ static void imx_keypad_close(struct input_dev *dev) static int imx_keypad_open(struct input_dev *dev) { struct imx_keypad *keypad = input_get_drvdata(dev); + int error; dev_dbg(&dev->dev, ">%s\n", __func__); + /* Enable the kpp clock */ + error = clk_prepare_enable(keypad->clk); + if (error) + return error; + /* We became active from now */ keypad->enabled = true; - /* Enable the kpp clock */ - clk_prepare_enable(keypad->clk); imx_keypad_config(keypad); /* Sanity control, not all the rows must be actived now. */ @@ -596,18 +600,23 @@ static int imx_kbd_resume(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct imx_keypad *kbd = platform_get_drvdata(pdev); struct input_dev *input_dev = kbd->input_dev; + int ret = 0; if (device_may_wakeup(&pdev->dev)) disable_irq_wake(kbd->irq); mutex_lock(&input_dev->mutex); - if (input_dev->users) - clk_prepare_enable(kbd->clk); + if (input_dev->users) { + ret = clk_prepare_enable(kbd->clk); + if (ret) + goto err_clk; + } +err_clk: mutex_unlock(&input_dev->mutex); - return 0; + return ret; } #endif -- cgit v1.2.3 From 8830cb88dd6d60c3bb4cb46d8a855628e4875b18 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sat, 7 Jul 2012 16:40:16 -0700 Subject: Input: wacom_i2c - fix compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently GCC can't figure out that we bail if we fail to query device and will not try to use 'features': drivers/input/touchscreen/wacom_i2c.c: In function ‘wacom_i2c_probe’: drivers/input/touchscreen/wacom_i2c.c:177:20: warning: ‘features.fw_version’ may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/wacom_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/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, { struct wacom_i2c *wac_i2c; struct input_dev *input; - struct wacom_features features; + struct wacom_features features = { 0 }; int error; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { -- cgit v1.2.3 From 5bdea83565e8b290410521d0dd64b7d3cc41603b Mon Sep 17 00:00:00 2001 From: Vipul Kumar Samar Date: Sat, 7 Jul 2012 18:00:10 -0700 Subject: Input: spear-keyboard - fix disable device_init_wakeup in remove This patch is to disable device wakeup while removing keyboard. Signed-off-by: Vipul Kumar Samar Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/spear-keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 6f287f7e1538..45dd02cbcaa0 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -302,7 +302,7 @@ static int __devexit spear_kbd_remove(struct platform_device *pdev) release_mem_region(kbd->res->start, resource_size(kbd->res)); kfree(kbd); - device_init_wakeup(&pdev->dev, 1); + device_init_wakeup(&pdev->dev, 0); platform_set_drvdata(pdev, NULL); return 0; -- cgit v1.2.3 From e99191f0391973326dd4de5cee5a72bf5aeb7040 Mon Sep 17 00:00:00 2001 From: Shiraz Hashim Date: Sat, 7 Jul 2012 18:00:36 -0700 Subject: Input: spear_keyboard - use correct io accessors All SPEAr keyboard registers are 32 bit wide and are word aligned. This patch aligns all io access to be word size using relaxed version of readl/writel. Signed-off-by: Shiraz Hashim Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/spear-keyboard.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 45dd02cbcaa0..10dda9f8e706 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -27,9 +27,9 @@ #include /* Keyboard Registers */ -#define MODE_REG 0x00 /* 16 bit reg */ -#define STATUS_REG 0x0C /* 2 bit reg */ -#define DATA_REG 0x10 /* 8 bit reg */ +#define MODE_REG 0x00 +#define STATUS_REG 0x0C +#define DATA_REG 0x10 #define INTR_MASK 0x54 /* Register Values */ @@ -72,9 +72,9 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) struct spear_kbd *kbd = dev_id; struct input_dev *input = kbd->input; unsigned int key; - u8 sts, val; + u32 sts, val; - sts = readb(kbd->io_base + STATUS_REG); + sts = readl_relaxed(kbd->io_base + STATUS_REG); if (!(sts & DATA_AVAIL)) return IRQ_NONE; @@ -84,7 +84,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) } /* following reads active (row, col) pair */ - val = readb(kbd->io_base + DATA_REG); + val = readl_relaxed(kbd->io_base + DATA_REG); key = kbd->keycodes[val]; input_event(input, EV_MSC, MSC_SCAN, val); @@ -94,7 +94,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) kbd->last_key = key; /* clear interrupt */ - writeb(0, kbd->io_base + STATUS_REG); + writel_relaxed(0, kbd->io_base + STATUS_REG); return IRQ_HANDLED; } @@ -103,7 +103,7 @@ static int spear_kbd_open(struct input_dev *dev) { struct spear_kbd *kbd = input_get_drvdata(dev); int error; - u16 val; + u32 val; kbd->last_key = KEY_RESERVED; @@ -114,13 +114,13 @@ static int spear_kbd_open(struct input_dev *dev) /* program keyboard */ val = SCAN_RATE_80 | MODE_KEYBOARD | PCLK_FREQ_MSK | (kbd->mode << KEY_MATRIX_SHIFT); - writew(val, kbd->io_base + MODE_REG); - writeb(1, kbd->io_base + STATUS_REG); + writel_relaxed(val, kbd->io_base + MODE_REG); + writel_relaxed(1, kbd->io_base + STATUS_REG); /* start key scan */ - val = readw(kbd->io_base + MODE_REG); + val = readl_relaxed(kbd->io_base + MODE_REG); val |= START_SCAN; - writew(val, kbd->io_base + MODE_REG); + writel_relaxed(val, kbd->io_base + MODE_REG); return 0; } @@ -128,12 +128,12 @@ static int spear_kbd_open(struct input_dev *dev) static void spear_kbd_close(struct input_dev *dev) { struct spear_kbd *kbd = input_get_drvdata(dev); - u16 val; + u32 val; /* stop key scan */ - val = readw(kbd->io_base + MODE_REG); + val = readl_relaxed(kbd->io_base + MODE_REG); val &= ~START_SCAN; - writew(val, kbd->io_base + MODE_REG); + writel_relaxed(val, kbd->io_base + MODE_REG); clk_disable(kbd->clk); -- cgit v1.2.3 From f6f2efa35f6b76034e5a31a075218feaa10f1812 Mon Sep 17 00:00:00 2001 From: Shiraz Hashim Date: Sat, 7 Jul 2012 18:00:54 -0700 Subject: Input: spear_keyboard - rename bit definitions to reflect register Rename bit definition macros to reflect keyboard registers clearly thus being more readable. Signed-off-by: Shiraz Hashim Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/spear-keyboard.c | 52 +++++++++++++++++---------------- 1 file changed, 27 insertions(+), 25 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 10dda9f8e706..a51cdc75466a 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -27,7 +27,7 @@ #include /* Keyboard Registers */ -#define MODE_REG 0x00 +#define MODE_CTL_REG 0x00 #define STATUS_REG 0x0C #define DATA_REG 0x10 #define INTR_MASK 0x54 @@ -38,22 +38,23 @@ * control register as 1010010(82MHZ) */ #define PCLK_FREQ_MSK 0xA400 /* 82 MHz */ -#define START_SCAN 0x0100 -#define SCAN_RATE_10 0x0000 -#define SCAN_RATE_20 0x0004 -#define SCAN_RATE_40 0x0008 -#define SCAN_RATE_80 0x000C -#define MODE_KEYBOARD 0x0002 -#define DATA_AVAIL 0x2 - -#define KEY_MASK 0xFF000000 -#define KEY_VALUE 0x00FFFFFF -#define ROW_MASK 0xF0 -#define COLUMN_MASK 0x0F #define NUM_ROWS 16 #define NUM_COLS 16 -#define KEY_MATRIX_SHIFT 6 +#define MODE_CTL_KEYBOARD (0x2 << 0) +#define MODE_CTL_SCAN_RATE_10 (0x0 << 2) +#define MODE_CTL_SCAN_RATE_20 (0x1 << 2) +#define MODE_CTL_SCAN_RATE_40 (0x2 << 2) +#define MODE_CTL_SCAN_RATE_80 (0x3 << 2) +#define MODE_CTL_KEYNUM_SHIFT 6 +#define MODE_CTL_START_SCAN (0x1 << 8) + +#define STATUS_DATA_AVAIL (0x1 << 1) + +#define DATA_ROW_MASK 0xF0 +#define DATA_COLUMN_MASK 0x0F + +#define ROW_SHIFT 4 struct spear_kbd { struct input_dev *input; @@ -75,7 +76,7 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) u32 sts, val; sts = readl_relaxed(kbd->io_base + STATUS_REG); - if (!(sts & DATA_AVAIL)) + if (!(sts & STATUS_DATA_AVAIL)) return IRQ_NONE; if (kbd->last_key != KEY_RESERVED) { @@ -84,7 +85,8 @@ static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) } /* following reads active (row, col) pair */ - val = readl_relaxed(kbd->io_base + DATA_REG); + val = readl_relaxed(kbd->io_base + DATA_REG) & + (DATA_ROW_MASK | DATA_COLUMN_MASK); key = kbd->keycodes[val]; input_event(input, EV_MSC, MSC_SCAN, val); @@ -112,15 +114,15 @@ static int spear_kbd_open(struct input_dev *dev) return error; /* program keyboard */ - val = SCAN_RATE_80 | MODE_KEYBOARD | PCLK_FREQ_MSK | - (kbd->mode << KEY_MATRIX_SHIFT); - writel_relaxed(val, kbd->io_base + MODE_REG); + val = MODE_CTL_SCAN_RATE_80 | MODE_CTL_KEYBOARD | PCLK_FREQ_MSK | + (kbd->mode << MODE_CTL_KEYNUM_SHIFT); + writel_relaxed(val, kbd->io_base + MODE_CTL_REG); writel_relaxed(1, kbd->io_base + STATUS_REG); /* start key scan */ - val = readl_relaxed(kbd->io_base + MODE_REG); - val |= START_SCAN; - writel_relaxed(val, kbd->io_base + MODE_REG); + val = readl_relaxed(kbd->io_base + MODE_CTL_REG); + val |= MODE_CTL_START_SCAN; + writel_relaxed(val, kbd->io_base + MODE_CTL_REG); return 0; } @@ -131,9 +133,9 @@ static void spear_kbd_close(struct input_dev *dev) u32 val; /* stop key scan */ - val = readl_relaxed(kbd->io_base + MODE_REG); - val &= ~START_SCAN; - writel_relaxed(val, kbd->io_base + MODE_REG); + val = readl_relaxed(kbd->io_base + MODE_CTL_REG); + val &= ~MODE_CTL_START_SCAN; + writel_relaxed(val, kbd->io_base + MODE_CTL_REG); clk_disable(kbd->clk); -- cgit v1.2.3 From 98e4d4d6bcf130cbf5a684c4f98c345f13e2f28c Mon Sep 17 00:00:00 2001 From: Shiraz Hashim Date: Sat, 7 Jul 2012 18:01:07 -0700 Subject: Input: spear_keyboard - generalize keyboard frequency configuration Current implementation hard coded keyboard frequency configuration assuming input clock as fixed APB (83 MHz). Generalize the configuration using clock framework APIs. Signed-off-by: Shiraz Hashim Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/spear-keyboard.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index a51cdc75466a..c499387d8735 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -33,13 +33,10 @@ #define INTR_MASK 0x54 /* Register Values */ -/* - * pclk freq mask = (APB FEQ -1)= 82 MHZ.Programme bit 15-9 in mode - * control register as 1010010(82MHZ) - */ -#define PCLK_FREQ_MSK 0xA400 /* 82 MHz */ #define NUM_ROWS 16 #define NUM_COLS 16 +#define MODE_CTL_PCLK_FREQ_SHIFT 9 +#define MODE_CTL_PCLK_FREQ_MSK 0x7F #define MODE_CTL_KEYBOARD (0x2 << 0) #define MODE_CTL_SCAN_RATE_10 (0x0 << 2) @@ -113,8 +110,12 @@ static int spear_kbd_open(struct input_dev *dev) if (error) return error; + /* keyboard rate to be programmed is input clock (in MHz) - 1 */ + val = clk_get_rate(kbd->clk) / 1000000 - 1; + val = (val & MODE_CTL_PCLK_FREQ_MSK) << MODE_CTL_PCLK_FREQ_SHIFT; + /* program keyboard */ - val = MODE_CTL_SCAN_RATE_80 | MODE_CTL_KEYBOARD | PCLK_FREQ_MSK | + val = MODE_CTL_SCAN_RATE_80 | MODE_CTL_KEYBOARD | val | (kbd->mode << MODE_CTL_KEYNUM_SHIFT); writel_relaxed(val, kbd->io_base + MODE_CTL_REG); writel_relaxed(1, kbd->io_base + STATUS_REG); -- cgit v1.2.3 From c6bd9d465500effa710634876fa9e35581da522d Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Sat, 7 Jul 2012 18:08:51 -0700 Subject: Input: synaptics - print firmware ID and board number at init Read the Firmware ID and Board Number from a synaptics device at init and display them in the system log. Device behavior is very board and firmware dependent. It may prove useful for users to include this information when providing bug reports or other feedback. Signed-off-by: Daniel Kurtz Acked-by: Henrik Rydberg Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/synaptics.c | 38 ++++++++++++++++++++++++++++++++++++-- drivers/input/mouse/synaptics.h | 3 +++ 2 files changed, 39 insertions(+), 2 deletions(-) (limited to 'drivers/input') 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 @@ -138,6 +138,35 @@ static int synaptics_model_id(struct psmouse *psmouse) return 0; } +/* + * Read the board id from the touchpad + * The board id is encoded in the "QUERY MODES" response + */ +static int synaptics_board_id(struct psmouse *psmouse) +{ + struct synaptics_data *priv = psmouse->private; + unsigned char bid[3]; + + if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid)) + return -1; + priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1]; + return 0; +} + +/* + * Read the firmware id from the touchpad + */ +static int synaptics_firmware_id(struct psmouse *psmouse) +{ + struct synaptics_data *priv = psmouse->private; + unsigned char fwid[3]; + + if (synaptics_send_cmd(psmouse, SYN_QUE_FIRMWARE_ID, fwid)) + return -1; + priv->firmware_id = (fwid[0] << 16) | (fwid[1] << 8) | fwid[2]; + return 0; +} + /* * Read the capability-bits from the touchpad * see also the SYN_CAP_* macros @@ -261,6 +290,10 @@ static int synaptics_query_hardware(struct psmouse *psmouse) return -1; if (synaptics_model_id(psmouse)) return -1; + if (synaptics_firmware_id(psmouse)) + return -1; + if (synaptics_board_id(psmouse)) + return -1; if (synaptics_capability(psmouse)) return -1; if (synaptics_resolution(psmouse)) @@ -1435,11 +1468,12 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; psmouse_info(psmouse, - "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n", + "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx, board id: %lu, fw id: %lu\n", SYN_ID_MODEL(priv->identity), SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), priv->model_id, - priv->capabilities, priv->ext_cap, priv->ext_cap_0c); + priv->capabilities, priv->ext_cap, priv->ext_cap_0c, + priv->board_id, priv->firmware_id); set_input_params(psmouse->dev, priv); 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 @@ #define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07 #define SYN_QUE_RESOLUTION 0x08 #define SYN_QUE_EXT_CAPAB 0x09 +#define SYN_QUE_FIRMWARE_ID 0x0a #define SYN_QUE_EXT_CAPAB_0C 0x0c #define SYN_QUE_EXT_MAX_COORDS 0x0d #define SYN_QUE_EXT_MIN_COORDS 0x0f @@ -148,6 +149,8 @@ struct synaptics_hw_state { struct synaptics_data { /* Data read from the touchpad */ unsigned long int model_id; /* Model-ID */ + unsigned long int firmware_id; /* Firmware-ID */ + unsigned long int board_id; /* Board-ID */ unsigned long int capabilities; /* Capabilities */ unsigned long int ext_cap; /* Extended Capabilities */ unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */ -- cgit v1.2.3 From 9a932145f2d57bad1092ba006dee9065adc5eb39 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Sat, 7 Jul 2012 18:17:54 -0700 Subject: Input: ff-memless - fix a couple min_t() casts envelope->attack_level is a u16 type. We're trying to clamp it here so it's between 0 and 0x7fff. Unfortunately, the cast to __s16 turns all the values larger than 0x7fff into negative numbers and min_t() thinks they are less than 0x7fff. envelope_level is an int so now we've got negative values stored there. Signed-off-by: Dan Carpenter Signed-off-by: Dmitry Torokhov --- drivers/input/ff-memless.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c index 5f558851d646..b107922514fb 100644 --- a/drivers/input/ff-memless.c +++ b/drivers/input/ff-memless.c @@ -176,7 +176,7 @@ static int apply_envelope(struct ml_effect_state *state, int value, value, envelope->attack_level); time_from_level = jiffies_to_msecs(now - state->play_at); time_of_envelope = envelope->attack_length; - envelope_level = min_t(__s16, envelope->attack_level, 0x7fff); + envelope_level = min_t(u16, envelope->attack_level, 0x7fff); } else if (envelope->fade_length && effect->replay.length && time_after(now, @@ -184,7 +184,7 @@ static int apply_envelope(struct ml_effect_state *state, int value, time_before(now, state->stop_at)) { time_from_level = jiffies_to_msecs(state->stop_at - now); time_of_envelope = envelope->fade_length; - envelope_level = min_t(__s16, envelope->fade_level, 0x7fff); + envelope_level = min_t(u16, envelope->fade_level, 0x7fff); } else return value; -- cgit v1.2.3 From 53fe628558bab9a11050ba067a09442c92dca6bb Mon Sep 17 00:00:00 2001 From: Shiraz Hashim Date: Fri, 13 Jul 2012 00:11:10 -0700 Subject: Input: spear_keyboard - fix clock handling during suspend/resume SPEAr keyboard should normally disable clock during suspend and enable it during resume. For cases where it is expected to act as a wakeup source the clock can remain in the same state i.e. kept enabled if it is being used. Signed-off-by: Shiraz Hashim Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/spear-keyboard.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index c499387d8735..617a33dc2ef3 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -320,11 +320,12 @@ static int spear_kbd_suspend(struct device *dev) mutex_lock(&input_dev->mutex); - if (input_dev->users) - clk_enable(kbd->clk); - - if (device_may_wakeup(&pdev->dev)) + if (device_may_wakeup(&pdev->dev)) { enable_irq_wake(kbd->irq); + } else { + if (input_dev->users) + clk_disable(kbd->clk); + } mutex_unlock(&input_dev->mutex); @@ -339,11 +340,12 @@ static int spear_kbd_resume(struct device *dev) mutex_lock(&input_dev->mutex); - if (device_may_wakeup(&pdev->dev)) + if (device_may_wakeup(&pdev->dev)) { disable_irq_wake(kbd->irq); - - if (input_dev->users) - clk_enable(kbd->clk); + } else { + if (input_dev->users) + clk_enable(kbd->clk); + } mutex_unlock(&input_dev->mutex); -- cgit v1.2.3 From 8314f532ebd55f1d6dc23b143cda3c1714ffe201 Mon Sep 17 00:00:00 2001 From: Shiraz Hashim Date: Fri, 13 Jul 2012 00:11:10 -0700 Subject: Input: spear_keyboard - reconfigure operating frequency on suspend On some platform it may happen that the input clock to keyboard may change during suspend, thus impacting its wakeup capability. There is no means for keyboard driver to know this frequency before hand. Hence introduce a platform data 'suspended_rate' which indicates the frequency during suspend at which keyboard operates. Accordingly reprogram keyboard while going into suspend and restore original configuration at the time of resume. Signed-off-by: Shiraz Hashim Signed-off-by: Dmitry Torokhov --- arch/arm/plat-spear/include/plat/keyboard.h | 2 ++ drivers/input/keyboard/spear-keyboard.c | 46 +++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/arch/arm/plat-spear/include/plat/keyboard.h b/arch/arm/plat-spear/include/plat/keyboard.h index 0562f134621d..9248e3a7e333 100644 --- a/arch/arm/plat-spear/include/plat/keyboard.h +++ b/arch/arm/plat-spear/include/plat/keyboard.h @@ -149,6 +149,7 @@ int _name[] = { \ * keymap: pointer to keymap data (table and size) * rep: enables key autorepeat * mode: choose keyboard support(9x9, 6x6, 2x2) + * suspended_rate: rate at which keyboard would operate in suspended mode * * This structure is supposed to be used by platform code to supply * keymaps to drivers that implement keyboards. @@ -157,6 +158,7 @@ struct kbd_platform_data { const struct matrix_keymap_data *keymap; bool rep; unsigned int mode; + unsigned int suspended_rate; }; #endif /* __PLAT_KEYBOARD_H */ diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index 617a33dc2ef3..72ef01be3360 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c @@ -63,6 +63,8 @@ struct spear_kbd { unsigned short last_key; unsigned short keycodes[NUM_ROWS * NUM_COLS]; bool rep; + unsigned int suspended_rate; + u32 mode_ctl_reg; }; static irqreturn_t spear_kbd_interrupt(int irq, void *dev_id) @@ -149,7 +151,7 @@ static int __devinit spear_kbd_parse_dt(struct platform_device *pdev, { struct device_node *np = pdev->dev.of_node; int error; - u32 val; + u32 val, suspended_rate; if (!np) { dev_err(&pdev->dev, "Missing DT data\n"); @@ -159,6 +161,9 @@ static int __devinit spear_kbd_parse_dt(struct platform_device *pdev, if (of_property_read_bool(np, "autorepeat")) kbd->rep = true; + if (of_property_read_u32(np, "suspended_rate", &suspended_rate)) + kbd->suspended_rate = suspended_rate; + error = of_property_read_u32(np, "st,mode", &val); if (error) { dev_err(&pdev->dev, "DT: Invalid or missing mode\n"); @@ -216,6 +221,7 @@ static int __devinit spear_kbd_probe(struct platform_device *pdev) } else { kbd->mode = pdata->mode; kbd->rep = pdata->rep; + kbd->suspended_rate = pdata->suspended_rate; } kbd->res = request_mem_region(res->start, resource_size(res), @@ -317,16 +323,48 @@ static int spear_kbd_suspend(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct spear_kbd *kbd = platform_get_drvdata(pdev); struct input_dev *input_dev = kbd->input; + unsigned int rate = 0, mode_ctl_reg, val; mutex_lock(&input_dev->mutex); + /* explicitly enable clock as we may program device */ + clk_enable(kbd->clk); + + mode_ctl_reg = readl_relaxed(kbd->io_base + MODE_CTL_REG); + if (device_may_wakeup(&pdev->dev)) { enable_irq_wake(kbd->irq); + + /* + * reprogram the keyboard operating frequency as on some + * platform it may change during system suspended + */ + if (kbd->suspended_rate) + rate = kbd->suspended_rate / 1000000 - 1; + else + rate = clk_get_rate(kbd->clk) / 1000000 - 1; + + val = mode_ctl_reg & + ~(MODE_CTL_PCLK_FREQ_MSK << MODE_CTL_PCLK_FREQ_SHIFT); + val |= (rate & MODE_CTL_PCLK_FREQ_MSK) + << MODE_CTL_PCLK_FREQ_SHIFT; + writel_relaxed(val, kbd->io_base + MODE_CTL_REG); + } else { - if (input_dev->users) + if (input_dev->users) { + writel_relaxed(mode_ctl_reg & ~MODE_CTL_START_SCAN, + kbd->io_base + MODE_CTL_REG); clk_disable(kbd->clk); + } } + /* store current configuration */ + if (input_dev->users) + kbd->mode_ctl_reg = mode_ctl_reg; + + /* restore previous clk state */ + clk_disable(kbd->clk); + mutex_unlock(&input_dev->mutex); return 0; @@ -347,6 +385,10 @@ static int spear_kbd_resume(struct device *dev) clk_enable(kbd->clk); } + /* restore current configuration */ + if (input_dev->users) + writel_relaxed(kbd->mode_ctl_reg, kbd->io_base + MODE_CTL_REG); + mutex_unlock(&input_dev->mutex); return 0; -- cgit v1.2.3 From 8a90c034ae0d4282e2aeb9cf8311dc90c855d815 Mon Sep 17 00:00:00 2001 From: weixing Date: Fri, 13 Jul 2012 00:08:42 -0700 Subject: Input: hanwang - add support for Art Master II tablet This change adds support for old Hanwang Art master II tablet Signed-off-by: weixing Signed-off-by: Dmitry Torokhov --- drivers/input/tablet/hanwang.c | 57 +++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 15 deletions(-) (limited to 'drivers/input') 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); enum hanwang_tablet_type { HANWANG_ART_MASTER_III, HANWANG_ART_MASTER_HD, + HANWANG_ART_MASTER_II, }; struct hanwang { @@ -99,6 +100,8 @@ static const struct hanwang_features features_array[] = { ART_MASTER_PKGLEN_MAX, 0x7f00, 0x4f60, 0x3f, 0x7f, 2048 }, { 0x8401, "Hanwang Art Master HD 5012", HANWANG_ART_MASTER_HD, ART_MASTER_PKGLEN_MAX, 0x678e, 0x4150, 0x3f, 0x7f, 1024 }, + { 0x8503, "Hanwang Art Master II", HANWANG_ART_MASTER_II, + ART_MASTER_PKGLEN_MAX, 0x27de, 0x1cfe, 0x3f, 0x7f, 1024 }, }; static const int hw_eventtypes[] = { @@ -127,14 +130,30 @@ static void hanwang_parse_packet(struct hanwang *hanwang) struct usb_device *dev = hanwang->usbdev; enum hanwang_tablet_type type = hanwang->features->type; int i; - u16 x, y, p; + u16 p; + + if (type == HANWANG_ART_MASTER_II) { + hanwang->current_tool = BTN_TOOL_PEN; + hanwang->current_id = STYLUS_DEVICE_ID; + } switch (data[0]) { case 0x02: /* data packet */ switch (data[1]) { case 0x80: /* tool prox out */ - hanwang->current_id = 0; - input_report_key(input_dev, hanwang->current_tool, 0); + if (type != HANWANG_ART_MASTER_II) { + hanwang->current_id = 0; + input_report_key(input_dev, + hanwang->current_tool, 0); + } + break; + + case 0x00: /* artmaster ii pen leave */ + if (type == HANWANG_ART_MASTER_II) { + hanwang->current_id = 0; + input_report_key(input_dev, + hanwang->current_tool, 0); + } break; case 0xc2: /* first time tool prox in */ @@ -154,15 +173,12 @@ static void hanwang_parse_packet(struct hanwang *hanwang) default: hanwang->current_id = 0; dev_dbg(&dev->dev, - "unknown tablet tool %02x ", data[0]); + "unknown tablet tool %02x\n", data[0]); break; } break; default: /* tool data packet */ - x = (data[2] << 8) | data[3]; - y = (data[4] << 8) | data[5]; - switch (type) { case HANWANG_ART_MASTER_III: p = (data[6] << 3) | @@ -171,6 +187,7 @@ static void hanwang_parse_packet(struct hanwang *hanwang) break; case HANWANG_ART_MASTER_HD: + case HANWANG_ART_MASTER_II: p = (data[7] >> 6) | (data[6] << 2); break; @@ -180,17 +197,23 @@ static void hanwang_parse_packet(struct hanwang *hanwang) } input_report_abs(input_dev, ABS_X, - le16_to_cpup((__le16 *)&x)); + be16_to_cpup((__be16 *)&data[2])); input_report_abs(input_dev, ABS_Y, - le16_to_cpup((__le16 *)&y)); - input_report_abs(input_dev, ABS_PRESSURE, - le16_to_cpup((__le16 *)&p)); + be16_to_cpup((__be16 *)&data[4])); + input_report_abs(input_dev, ABS_PRESSURE, p); input_report_abs(input_dev, ABS_TILT_X, data[7] & 0x3f); input_report_abs(input_dev, ABS_TILT_Y, data[8] & 0x7f); input_report_key(input_dev, BTN_STYLUS, data[1] & 0x02); - input_report_key(input_dev, BTN_STYLUS2, data[1] & 0x04); + + if (type != HANWANG_ART_MASTER_II) + input_report_key(input_dev, BTN_STYLUS2, + data[1] & 0x04); + else + input_report_key(input_dev, BTN_TOOL_PEN, 1); + break; } + input_report_abs(input_dev, ABS_MISC, hanwang->current_id); input_event(input_dev, EV_MSC, MSC_SERIAL, hanwang->features->pid); @@ -202,8 +225,8 @@ static void hanwang_parse_packet(struct hanwang *hanwang) switch (type) { case HANWANG_ART_MASTER_III: - input_report_key(input_dev, BTN_TOOL_FINGER, data[1] || - data[2] || data[3]); + input_report_key(input_dev, BTN_TOOL_FINGER, + data[1] || data[2] || data[3]); input_report_abs(input_dev, ABS_WHEEL, data[1]); input_report_key(input_dev, BTN_0, data[2]); for (i = 0; i < 8; i++) @@ -227,6 +250,10 @@ static void hanwang_parse_packet(struct hanwang *hanwang) BTN_5 + i, data[6] & (1 << i)); } break; + + case HANWANG_ART_MASTER_II: + dev_dbg(&dev->dev, "error packet %02x\n", data[0]); + return; } input_report_abs(input_dev, ABS_MISC, hanwang->current_id); @@ -234,7 +261,7 @@ static void hanwang_parse_packet(struct hanwang *hanwang) break; default: - dev_dbg(&dev->dev, "error packet %02x ", data[0]); + dev_dbg(&dev->dev, "error packet %02x\n", data[0]); break; } -- cgit v1.2.3 From 13987435cc28eab6e562e878e71b521e7ef5c860 Mon Sep 17 00:00:00 2001 From: Sourav Poddar Date: Fri, 13 Jul 2012 00:10:47 -0700 Subject: Input: omap4-keypad - add device tree support Add device tree support for omap4 keypad driver and update the Documentation with omap4 keypad device tree binding information. Tested on omap4430 sdp. Signed-off-by: Sourav Poddar Signed-off-by: Dmitry Torokhov --- .../devicetree/bindings/input/omap-keypad.txt | 31 +++++ drivers/input/keyboard/omap4-keypad.c | 127 ++++++++++++++------- 2 files changed, 118 insertions(+), 40 deletions(-) create mode 100644 Documentation/devicetree/bindings/input/omap-keypad.txt (limited to 'drivers/input') diff --git a/Documentation/devicetree/bindings/input/omap-keypad.txt b/Documentation/devicetree/bindings/input/omap-keypad.txt new file mode 100644 index 000000000000..f2fa5e10493d --- /dev/null +++ b/Documentation/devicetree/bindings/input/omap-keypad.txt @@ -0,0 +1,31 @@ +* TI's Keypad Controller device tree bindings + +TI's Keypad controller is used to interface a SoC with a matrix-type +keypad device. The keypad controller supports multiple row and column lines. +A key can be placed at each intersection of a unique row and a unique column. +The keypad controller can sense a key-press and key-release and report the +event using a interrupt to the cpu. + +Required SoC Specific Properties: +- compatible: should be one of the following + - "ti,omap4-keypad": For controllers compatible with omap4 keypad + controller. + +Required Board Specific Properties, in addition to those specified by +the shared matrix-keyboard bindings: +- keypad,num-rows: Number of row lines connected to the keypad + controller. + +- keypad,num-columns: Number of column lines connected to the + keypad controller. + +Optional Properties specific to linux: +- linux,keypad-no-autorepeat: do no enable autorepeat feature. + +Example: + keypad@4ae1c000{ + compatible = "ti,omap4-keypad"; + keypad,num-rows = <2>; + keypad,num-columns = <8>; + linux,keypad-no-autorepeat; + }; 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 @@ #include #include #include +#include #include #include #include @@ -84,8 +85,9 @@ struct omap4_keypad { u32 reg_offset; u32 irqreg_offset; unsigned int row_shift; + bool no_autorepeat; unsigned char key_state[8]; - unsigned short keymap[]; + unsigned short *keymap; }; static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset) @@ -208,25 +210,51 @@ static void omap4_keypad_close(struct input_dev *input) pm_runtime_put_sync(input->dev.parent); } +#ifdef CONFIG_OF +static int __devinit omap4_keypad_parse_dt(struct device *dev, + struct omap4_keypad *keypad_data) +{ + struct device_node *np = dev->of_node; + + if (!np) { + dev_err(dev, "missing DT data"); + return -EINVAL; + } + + of_property_read_u32(np, "keypad,num-rows", &keypad_data->rows); + of_property_read_u32(np, "keypad,num-columns", &keypad_data->cols); + if (!keypad_data->rows || !keypad_data->cols) { + dev_err(dev, "number of keypad rows/columns not specified\n"); + return -EINVAL; + } + + if (of_get_property(np, "linux,input-no-autorepeat", NULL)) + keypad_data->no_autorepeat = true; + + return 0; +} +#else +static inline int omap4_keypad_parse_dt(struct device *dev, + struct omap4_keypad *keypad_data) +{ + return -ENOSYS; +} +#endif + static int __devinit omap4_keypad_probe(struct platform_device *pdev) { - const struct omap4_keypad_platform_data *pdata; + const struct omap4_keypad_platform_data *pdata = + dev_get_platdata(&pdev->dev); + const struct matrix_keymap_data *keymap_data = + pdata ? pdata->keymap_data : NULL; struct omap4_keypad *keypad_data; struct input_dev *input_dev; struct resource *res; - resource_size_t size; - unsigned int row_shift, max_keys; + unsigned int max_keys; int rev; int irq; int error; - /* platform data */ - pdata = pdev->dev.platform_data; - if (!pdata) { - dev_err(&pdev->dev, "no platform data defined\n"); - return -EINVAL; - } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(&pdev->dev, "no base address specified\n"); @@ -239,25 +267,24 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev) return -EINVAL; } - if (!pdata->keymap_data) { - dev_err(&pdev->dev, "no keymap data defined\n"); - return -EINVAL; - } - - row_shift = get_count_order(pdata->cols); - max_keys = pdata->rows << row_shift; - - keypad_data = kzalloc(sizeof(struct omap4_keypad) + - max_keys * sizeof(keypad_data->keymap[0]), - GFP_KERNEL); + keypad_data = kzalloc(sizeof(struct omap4_keypad), GFP_KERNEL); if (!keypad_data) { dev_err(&pdev->dev, "keypad_data memory allocation failed\n"); return -ENOMEM; } - size = resource_size(res); + keypad_data->irq = irq; + + if (pdata) { + keypad_data->rows = pdata->rows; + keypad_data->cols = pdata->cols; + } else { + error = omap4_keypad_parse_dt(&pdev->dev, keypad_data); + if (error) + return error; + } - res = request_mem_region(res->start, size, pdev->name); + res = request_mem_region(res->start, resource_size(res), pdev->name); if (!res) { dev_err(&pdev->dev, "can't request mem region\n"); error = -EBUSY; @@ -271,15 +298,11 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev) goto err_release_mem; } - keypad_data->irq = irq; - keypad_data->row_shift = row_shift; - keypad_data->rows = pdata->rows; - keypad_data->cols = pdata->cols; /* - * Enable clocks for the keypad module so that we can read - * revision register. - */ + * Enable clocks for the keypad module so that we can read + * revision register. + */ pm_runtime_enable(&pdev->dev); error = pm_runtime_get_sync(&pdev->dev); if (error) { @@ -322,19 +345,30 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev) input_dev->open = omap4_keypad_open; input_dev->close = omap4_keypad_close; - error = matrix_keypad_build_keymap(pdata->keymap_data, NULL, - pdata->rows, pdata->cols, + input_set_capability(input_dev, EV_MSC, MSC_SCAN); + if (!keypad_data->no_autorepeat) + __set_bit(EV_REP, input_dev->evbit); + + input_set_drvdata(input_dev, keypad_data); + + keypad_data->row_shift = get_count_order(keypad_data->cols); + max_keys = keypad_data->rows << keypad_data->row_shift; + keypad_data->keymap = kzalloc(max_keys * sizeof(keypad_data->keymap[0]), + GFP_KERNEL); + if (!keypad_data->keymap) { + dev_err(&pdev->dev, "Not enough memory for keymap\n"); + error = -ENOMEM; + goto err_free_input; + } + + error = matrix_keypad_build_keymap(keymap_data, NULL, + keypad_data->rows, keypad_data->cols, keypad_data->keymap, input_dev); if (error) { dev_err(&pdev->dev, "failed to build keymap\n"); - goto err_free_input; + goto err_free_keymap; } - __set_bit(EV_REP, input_dev->evbit); - input_set_capability(input_dev, EV_MSC, MSC_SCAN); - - input_set_drvdata(input_dev, keypad_data); - error = request_irq(keypad_data->irq, omap4_keypad_interrupt, IRQF_TRIGGER_RISING, "omap4-keypad", keypad_data); @@ -357,6 +391,8 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev) err_pm_disable: pm_runtime_disable(&pdev->dev); free_irq(keypad_data->irq, keypad_data); +err_free_keymap: + kfree(keypad_data->keymap); err_free_input: input_free_device(input_dev); err_pm_put_sync: @@ -364,7 +400,7 @@ err_pm_put_sync: err_unmap: iounmap(keypad_data->base); err_release_mem: - release_mem_region(res->start, size); + release_mem_region(res->start, resource_size(res)); err_free_keypad: kfree(keypad_data); return error; @@ -386,18 +422,29 @@ static int __devexit omap4_keypad_remove(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); release_mem_region(res->start, resource_size(res)); + kfree(keypad_data->keymap); kfree(keypad_data); + platform_set_drvdata(pdev, NULL); return 0; } +#ifdef CONFIG_OF +static const struct of_device_id omap_keypad_dt_match[] = { + { .compatible = "ti,omap4-keypad" }, + {}, +}; +MODULE_DEVICE_TABLE(of, omap_keypad_dt_match); +#endif + static struct platform_driver omap4_keypad_driver = { .probe = omap4_keypad_probe, .remove = __devexit_p(omap4_keypad_remove), .driver = { .name = "omap4-keypad", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(omap_keypad_dt_match), }, }; module_platform_driver(omap4_keypad_driver); -- cgit v1.2.3 From 69690bec400e4c6cc89ef37376da1e633e14ad0f Mon Sep 17 00:00:00 2001 From: Roland Stigge Date: Fri, 13 Jul 2012 00:08:34 -0700 Subject: Input: add support for key scan interface of the LPC32xx SoC This is a driver for the key scan interface of the LPC32xx SoC Signed-off-by: Roland Stigge Signed-off-by: Dmitry Torokhov --- .../devicetree/bindings/input/lpc32xx-key.txt | 28 ++ drivers/input/keyboard/Kconfig | 10 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/lpc32xx-keys.c | 394 +++++++++++++++++++++ 4 files changed, 433 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/lpc32xx-key.txt create mode 100644 drivers/input/keyboard/lpc32xx-keys.c (limited to 'drivers/input') diff --git a/Documentation/devicetree/bindings/input/lpc32xx-key.txt b/Documentation/devicetree/bindings/input/lpc32xx-key.txt new file mode 100644 index 000000000000..31afd5014c48 --- /dev/null +++ b/Documentation/devicetree/bindings/input/lpc32xx-key.txt @@ -0,0 +1,28 @@ +NXP LPC32xx Key Scan Interface + +Required Properties: +- compatible: Should be "nxp,lpc3220-key" +- reg: Physical base address of the controller and length of memory mapped + region. +- interrupts: The interrupt number to the cpu. +- keypad,num-rows: Number of rows and columns, e.g. 1: 1x1, 6: 6x6 +- keypad,num-columns: Must be equal to keypad,num-rows since LPC32xx only + supports square matrices +- nxp,debounce-delay-ms: Debounce delay in ms +- nxp,scan-delay-ms: Repeated scan period in ms +- linux,keymap: the key-code to be reported when the key is pressed + and released, see also + Documentation/devicetree/bindings/input/matrix-keymap.txt + +Example: + + key@40050000 { + compatible = "nxp,lpc3220-key"; + reg = <0x40050000 0x1000>; + interrupts = <54 0>; + keypad,num-rows = <1>; + keypad,num-columns = <1>; + nxp,debounce-delay-ms = <3>; + nxp,scan-delay-ms = <34>; + linux,keymap = <0x00000002>; + }; 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 To compile this driver as a module, choose M here: the module will be called locomokbd. +config KEYBOARD_LPC32XX + tristate "LPC32XX matrix key scanner support" + depends on ARCH_LPC32XX && OF + help + Say Y here if you want to use NXP LPC32XX SoC key scanner interface, + connected to a key matrix. + + To compile this driver as a module, choose M here: the + module will be called lpc32xx-keys. + config KEYBOARD_MAPLE tristate "Maple bus keyboard" 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 obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o obj-$(CONFIG_KEYBOARD_LM8333) += lm8333.o obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o +obj-$(CONFIG_KEYBOARD_LPC32XX) += lpc32xx-keys.o obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o obj-$(CONFIG_KEYBOARD_MATRIX) += matrix_keypad.o obj-$(CONFIG_KEYBOARD_MAX7359) += max7359_keypad.o 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 @@ +/* + * NXP LPC32xx SoC Key Scan Interface + * + * Authors: + * Kevin Wells + * Roland Stigge + * + * Copyright (C) 2010 NXP Semiconductors + * Copyright (C) 2012 Roland Stigge + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * This controller supports square key matrices from 1x1 up to 8x8 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRV_NAME "lpc32xx_keys" + +/* + * Key scanner register offsets + */ +#define LPC32XX_KS_DEB(x) ((x) + 0x00) +#define LPC32XX_KS_STATE_COND(x) ((x) + 0x04) +#define LPC32XX_KS_IRQ(x) ((x) + 0x08) +#define LPC32XX_KS_SCAN_CTL(x) ((x) + 0x0C) +#define LPC32XX_KS_FAST_TST(x) ((x) + 0x10) +#define LPC32XX_KS_MATRIX_DIM(x) ((x) + 0x14) /* 1..8 */ +#define LPC32XX_KS_DATA(x, y) ((x) + 0x40 + ((y) << 2)) + +#define LPC32XX_KSCAN_DEB_NUM_DEB_PASS(n) ((n) & 0xFF) + +#define LPC32XX_KSCAN_SCOND_IN_IDLE 0x0 +#define LPC32XX_KSCAN_SCOND_IN_SCANONCE 0x1 +#define LPC32XX_KSCAN_SCOND_IN_IRQGEN 0x2 +#define LPC32XX_KSCAN_SCOND_IN_SCAN_MATRIX 0x3 + +#define LPC32XX_KSCAN_IRQ_PENDING_CLR 0x1 + +#define LPC32XX_KSCAN_SCTRL_SCAN_DELAY(n) ((n) & 0xFF) + +#define LPC32XX_KSCAN_FTST_FORCESCANONCE 0x1 +#define LPC32XX_KSCAN_FTST_USE32K_CLK 0x2 + +#define LPC32XX_KSCAN_MSEL_SELECT(n) ((n) & 0xF) + +struct lpc32xx_kscan_drv { + struct input_dev *input; + struct clk *clk; + struct resource *iores; + void __iomem *kscan_base; + unsigned int irq; + + u32 matrix_sz; /* Size of matrix in XxY, ie. 3 = 3x3 */ + u32 deb_clks; /* Debounce clocks (based on 32KHz clock) */ + u32 scan_delay; /* Scan delay (based on 32KHz clock) */ + + unsigned short *keymap; /* Pointer to key map for the scan matrix */ + unsigned int row_shift; + + u8 lastkeystates[8]; +}; + +static void lpc32xx_mod_states(struct lpc32xx_kscan_drv *kscandat, int col) +{ + struct input_dev *input = kscandat->input; + unsigned row, changed, scancode, keycode; + u8 key; + + key = readl(LPC32XX_KS_DATA(kscandat->kscan_base, col)); + changed = key ^ kscandat->lastkeystates[col]; + kscandat->lastkeystates[col] = key; + + for (row = 0; changed; row++, changed >>= 1) { + if (changed & 1) { + /* Key state changed, signal an event */ + scancode = MATRIX_SCAN_CODE(row, col, + kscandat->row_shift); + keycode = kscandat->keymap[scancode]; + input_event(input, EV_MSC, MSC_SCAN, scancode); + input_report_key(input, keycode, key & (1 << row)); + } + } +} + +static irqreturn_t lpc32xx_kscan_irq(int irq, void *dev_id) +{ + struct lpc32xx_kscan_drv *kscandat = dev_id; + int i; + + for (i = 0; i < kscandat->matrix_sz; i++) + lpc32xx_mod_states(kscandat, i); + + writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); + + input_sync(kscandat->input); + + return IRQ_HANDLED; +} + +static int lpc32xx_kscan_open(struct input_dev *dev) +{ + struct lpc32xx_kscan_drv *kscandat = input_get_drvdata(dev); + int error; + + error = clk_prepare_enable(kscandat->clk); + if (error) + return error; + + writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); + + return 0; +} + +static void lpc32xx_kscan_close(struct input_dev *dev) +{ + struct lpc32xx_kscan_drv *kscandat = input_get_drvdata(dev); + + writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); + clk_disable_unprepare(kscandat->clk); +} + +static int __devinit lpc32xx_parse_dt(struct device *dev, + struct lpc32xx_kscan_drv *kscandat) +{ + struct device_node *np = dev->of_node; + u32 rows = 0, columns = 0; + + of_property_read_u32(np, "keypad,num-rows", &rows); + of_property_read_u32(np, "keypad,num-columns", &columns); + if (!rows || rows != columns) { + dev_err(dev, + "rows and columns must be specified and be equal!\n"); + return -EINVAL; + } + + kscandat->matrix_sz = rows; + kscandat->row_shift = get_count_order(columns); + + of_property_read_u32(np, "nxp,debounce-delay-ms", &kscandat->deb_clks); + of_property_read_u32(np, "nxp,scan-delay-ms", &kscandat->scan_delay); + if (!kscandat->deb_clks || !kscandat->scan_delay) { + dev_err(dev, "debounce or scan delay not specified\n"); + return -EINVAL; + } + + return 0; +} + +static int __devinit lpc32xx_kscan_probe(struct platform_device *pdev) +{ + struct lpc32xx_kscan_drv *kscandat; + struct input_dev *input; + struct resource *res; + size_t keymap_size; + int error; + int irq; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "failed to get platform I/O memory\n"); + return -EINVAL; + } + + irq = platform_get_irq(pdev, 0); + if (irq < 0 || irq >= NR_IRQS) { + dev_err(&pdev->dev, "failed to get platform irq\n"); + return -EINVAL; + } + + kscandat = kzalloc(sizeof(struct lpc32xx_kscan_drv), GFP_KERNEL); + if (!kscandat) { + dev_err(&pdev->dev, "failed to allocate memory\n"); + return -ENOMEM; + } + + error = lpc32xx_parse_dt(&pdev->dev, kscandat); + if (error) { + dev_err(&pdev->dev, "failed to parse device tree\n"); + goto err_free_mem; + } + + keymap_size = sizeof(kscandat->keymap[0]) * + (kscandat->matrix_sz << kscandat->row_shift); + kscandat->keymap = kzalloc(keymap_size, GFP_KERNEL); + if (!kscandat->keymap) { + dev_err(&pdev->dev, "could not allocate memory for keymap\n"); + error = -ENOMEM; + goto err_free_mem; + } + + kscandat->input = input = input_allocate_device(); + if (!input) { + dev_err(&pdev->dev, "failed to allocate input device\n"); + error = -ENOMEM; + goto err_free_keymap; + } + + /* Setup key input */ + input->name = pdev->name; + input->phys = "lpc32xx/input0"; + input->id.vendor = 0x0001; + input->id.product = 0x0001; + input->id.version = 0x0100; + input->open = lpc32xx_kscan_open; + input->close = lpc32xx_kscan_close; + input->dev.parent = &pdev->dev; + + input_set_capability(input, EV_MSC, MSC_SCAN); + + error = matrix_keypad_build_keymap(NULL, NULL, + kscandat->matrix_sz, + kscandat->matrix_sz, + kscandat->keymap, kscandat->input); + if (error) { + dev_err(&pdev->dev, "failed to build keymap\n"); + goto err_free_input; + } + + input_set_drvdata(kscandat->input, kscandat); + + kscandat->iores = request_mem_region(res->start, resource_size(res), + pdev->name); + if (!kscandat->iores) { + dev_err(&pdev->dev, "failed to request I/O memory\n"); + error = -EBUSY; + goto err_free_input; + } + + kscandat->kscan_base = ioremap(kscandat->iores->start, + resource_size(kscandat->iores)); + if (!kscandat->kscan_base) { + dev_err(&pdev->dev, "failed to remap I/O memory\n"); + error = -EBUSY; + goto err_release_memregion; + } + + /* Get the key scanner clock */ + kscandat->clk = clk_get(&pdev->dev, NULL); + if (IS_ERR(kscandat->clk)) { + dev_err(&pdev->dev, "failed to get clock\n"); + error = PTR_ERR(kscandat->clk); + goto err_unmap; + } + + /* Configure the key scanner */ + error = clk_prepare_enable(kscandat->clk); + if (error) + goto err_clk_put; + + writel(kscandat->deb_clks, LPC32XX_KS_DEB(kscandat->kscan_base)); + writel(kscandat->scan_delay, LPC32XX_KS_SCAN_CTL(kscandat->kscan_base)); + writel(LPC32XX_KSCAN_FTST_USE32K_CLK, + LPC32XX_KS_FAST_TST(kscandat->kscan_base)); + writel(kscandat->matrix_sz, + LPC32XX_KS_MATRIX_DIM(kscandat->kscan_base)); + writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); + clk_disable_unprepare(kscandat->clk); + + error = request_irq(irq, lpc32xx_kscan_irq, 0, pdev->name, kscandat); + if (error) { + dev_err(&pdev->dev, "failed to request irq\n"); + goto err_clk_put; + } + + error = input_register_device(kscandat->input); + if (error) { + dev_err(&pdev->dev, "failed to register input device\n"); + goto err_free_irq; + } + + platform_set_drvdata(pdev, kscandat); + return 0; + +err_free_irq: + free_irq(irq, kscandat); +err_clk_put: + clk_put(kscandat->clk); +err_unmap: + iounmap(kscandat->kscan_base); +err_release_memregion: + release_mem_region(kscandat->iores->start, + resource_size(kscandat->iores)); +err_free_input: + input_free_device(kscandat->input); +err_free_keymap: + kfree(kscandat->keymap); +err_free_mem: + kfree(kscandat); + + return error; +} + +static int __devexit lpc32xx_kscan_remove(struct platform_device *pdev) +{ + struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev); + + free_irq(platform_get_irq(pdev, 0), kscandat); + clk_put(kscandat->clk); + iounmap(kscandat->kscan_base); + release_mem_region(kscandat->iores->start, + resource_size(kscandat->iores)); + input_unregister_device(kscandat->input); + kfree(kscandat->keymap); + kfree(kscandat); + + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int lpc32xx_kscan_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev); + struct input_dev *input = kscandat->input; + + mutex_lock(&input->mutex); + + if (input->users) { + /* Clear IRQ and disable clock */ + writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); + clk_disable_unprepare(kscandat->clk); + } + + mutex_unlock(&input->mutex); + return 0; +} + +static int lpc32xx_kscan_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev); + struct input_dev *input = kscandat->input; + int retval = 0; + + mutex_lock(&input->mutex); + + if (input->users) { + /* Enable clock and clear IRQ */ + retval = clk_prepare_enable(kscandat->clk); + if (retval == 0) + writel(1, LPC32XX_KS_IRQ(kscandat->kscan_base)); + } + + mutex_unlock(&input->mutex); + return retval; +} +#endif + +static SIMPLE_DEV_PM_OPS(lpc32xx_kscan_pm_ops, lpc32xx_kscan_suspend, + lpc32xx_kscan_resume); + +static const struct of_device_id lpc32xx_kscan_match[] = { + { .compatible = "nxp,lpc3220-key" }, + {}, +}; +MODULE_DEVICE_TABLE(of, lpc32xx_kscan_match); + +static struct platform_driver lpc32xx_kscan_driver = { + .probe = lpc32xx_kscan_probe, + .remove = __devexit_p(lpc32xx_kscan_remove), + .driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + .pm = &lpc32xx_kscan_pm_ops, + .of_match_table = of_match_ptr(lpc32xx_kscan_match), + } +}; + +module_platform_driver(lpc32xx_kscan_driver); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Kevin Wells "); +MODULE_AUTHOR("Roland Stigge "); +MODULE_DESCRIPTION("Key scanner driver for LPC32XX devices"); -- cgit v1.2.3 From 07b8481d4aff73d6f451f25e74ea10240ff5131e Mon Sep 17 00:00:00 2001 From: Joonyoung Shim Date: Fri, 13 Jul 2012 00:25:45 -0700 Subject: Input: add MELFAS mms114 touchscreen driver This is a initial driver for new touchscreen chip mms114 of MELFAS. It uses I2C interface and supports 10 multi touch. Signed-off-by: Joonyoung Shim Signed-off-by: Kyungmin Park Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/Kconfig | 12 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/mms114.c | 544 +++++++++++++++++++++++++++++++++++++ include/linux/i2c/mms114.h | 24 ++ 4 files changed, 581 insertions(+) create mode 100644 drivers/input/touchscreen/mms114.c create mode 100644 include/linux/i2c/mms114.h (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 98d263504eea..73bd2f6b82ec 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -369,6 +369,18 @@ config TOUCHSCREEN_MCS5000 To compile this driver as a module, choose M here: the module will be called mcs5000_ts. +config TOUCHSCREEN_MMS114 + tristate "MELFAS MMS114 touchscreen" + depends on I2C + help + Say Y here if you have the MELFAS MMS114 touchscreen controller + chip in your system. + + If unsure, say N. + + To compile this driver as a module, choose M here: the + module will be called mms114. + config TOUCHSCREEN_MTOUCH tristate "MicroTouch serial touchscreens" select SERIO 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 obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o obj-$(CONFIG_TOUCHSCREEN_MIGOR) += migor_ts.o +obj-$(CONFIG_TOUCHSCREEN_MMS114) += mms114.o obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o 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 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co.Ltd + * Author: Joonyoung Shim + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Write only registers */ +#define MMS114_MODE_CONTROL 0x01 +#define MMS114_OPERATION_MODE_MASK 0xE +#define MMS114_ACTIVE (1 << 1) + +#define MMS114_XY_RESOLUTION_H 0x02 +#define MMS114_X_RESOLUTION 0x03 +#define MMS114_Y_RESOLUTION 0x04 +#define MMS114_CONTACT_THRESHOLD 0x05 +#define MMS114_MOVING_THRESHOLD 0x06 + +/* Read only registers */ +#define MMS114_PACKET_SIZE 0x0F +#define MMS114_INFOMATION 0x10 +#define MMS114_TSP_REV 0xF0 + +/* Minimum delay time is 50us between stop and start signal of i2c */ +#define MMS114_I2C_DELAY 50 + +/* 200ms needs after power on */ +#define MMS114_POWERON_DELAY 200 + +/* Touchscreen absolute values */ +#define MMS114_MAX_AREA 0xff + +#define MMS114_MAX_TOUCH 10 +#define MMS114_PACKET_NUM 8 + +/* Touch type */ +#define MMS114_TYPE_NONE 0 +#define MMS114_TYPE_TOUCHSCREEN 1 +#define MMS114_TYPE_TOUCHKEY 2 + +struct mms114_data { + struct i2c_client *client; + struct input_dev *input_dev; + struct regulator *core_reg; + struct regulator *io_reg; + const struct mms114_platform_data *pdata; + + /* Use cache data for mode control register(write only) */ + u8 cache_mode_control; +}; + +struct mms114_touch { + u8 id:4, reserved_bit4:1, type:2, pressed:1; + u8 x_hi:4, y_hi:4; + u8 x_lo; + u8 y_lo; + u8 width; + u8 strength; + u8 reserved[2]; +} __packed; + +static int __mms114_read_reg(struct mms114_data *data, unsigned int reg, + unsigned int len, u8 *val) +{ + struct i2c_client *client = data->client; + struct i2c_msg xfer[2]; + u8 buf = reg & 0xff; + int error; + + if (reg <= MMS114_MODE_CONTROL && reg + len > MMS114_MODE_CONTROL) + BUG(); + + /* Write register: use repeated start */ + xfer[0].addr = client->addr; + xfer[0].flags = I2C_M_TEN | I2C_M_NOSTART; + xfer[0].len = 1; + xfer[0].buf = &buf; + + /* Read data */ + xfer[1].addr = client->addr; + xfer[1].flags = I2C_M_RD; + xfer[1].len = len; + xfer[1].buf = val; + + error = i2c_transfer(client->adapter, xfer, 2); + if (error != 2) { + dev_err(&client->dev, + "%s: i2c transfer failed (%d)\n", __func__, error); + return error < 0 ? error : -EIO; + } + udelay(MMS114_I2C_DELAY); + + return 0; +} + +static int mms114_read_reg(struct mms114_data *data, unsigned int reg) +{ + u8 val; + int error; + + if (reg == MMS114_MODE_CONTROL) + return data->cache_mode_control; + + error = __mms114_read_reg(data, reg, 1, &val); + return error < 0 ? error : val; +} + +static int mms114_write_reg(struct mms114_data *data, unsigned int reg, + unsigned int val) +{ + struct i2c_client *client = data->client; + u8 buf[2]; + int error; + + buf[0] = reg & 0xff; + buf[1] = val & 0xff; + + error = i2c_master_send(client, buf, 2); + if (error != 2) { + dev_err(&client->dev, + "%s: i2c send failed (%d)\n", __func__, error); + return error < 0 ? error : -EIO; + } + udelay(MMS114_I2C_DELAY); + + if (reg == MMS114_MODE_CONTROL) + data->cache_mode_control = val; + + return 0; +} + +static void mms114_process_mt(struct mms114_data *data, struct mms114_touch *touch) +{ + const struct mms114_platform_data *pdata = data->pdata; + struct i2c_client *client = data->client; + struct input_dev *input_dev = data->input_dev; + unsigned int id; + unsigned int x; + unsigned int y; + + if (touch->id > MMS114_MAX_TOUCH) { + dev_err(&client->dev, "Wrong touch id (%d)\n", touch->id); + return; + } + + if (touch->type != MMS114_TYPE_TOUCHSCREEN) { + dev_err(&client->dev, "Wrong touch type (%d)\n", touch->type); + return; + } + + id = touch->id - 1; + x = touch->x_lo | touch->x_hi << 8; + y = touch->y_lo | touch->y_hi << 8; + if (x > pdata->x_size || y > pdata->y_size) { + dev_dbg(&client->dev, + "Wrong touch coordinates (%d, %d)\n", x, y); + return; + } + + if (pdata->x_invert) + x = pdata->x_size - x; + if (pdata->y_invert) + y = pdata->y_size - y; + + dev_dbg(&client->dev, + "id: %d, type: %d, pressed: %d, x: %d, y: %d, width: %d, strength: %d\n", + id, touch->type, touch->pressed, + x, y, touch->width, touch->strength); + + input_mt_slot(input_dev, id); + input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, touch->pressed); + + if (touch->pressed) { + input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, touch->width); + input_report_abs(input_dev, ABS_MT_POSITION_X, x); + input_report_abs(input_dev, ABS_MT_POSITION_Y, y); + input_report_abs(input_dev, ABS_MT_PRESSURE, touch->strength); + } +} + +static irqreturn_t mms114_interrupt(int irq, void *dev_id) +{ + struct mms114_data *data = dev_id; + struct input_dev *input_dev = data->input_dev; + struct mms114_touch touch[MMS114_MAX_TOUCH]; + int packet_size; + int touch_size; + int index; + int error; + + mutex_lock(&input_dev->mutex); + if (!input_dev->users) { + mutex_unlock(&input_dev->mutex); + goto out; + } + mutex_unlock(&input_dev->mutex); + + packet_size = mms114_read_reg(data, MMS114_PACKET_SIZE); + if (packet_size <= 0) + goto out; + + touch_size = packet_size / MMS114_PACKET_NUM; + + error = __mms114_read_reg(data, MMS114_INFOMATION, packet_size, + (u8 *)touch); + if (error < 0) + goto out; + + for (index = 0; index < touch_size; index++) + mms114_process_mt(data, touch + index); + + input_mt_report_pointer_emulation(data->input_dev, true); + input_sync(data->input_dev); + +out: + return IRQ_HANDLED; +} + +static int mms114_set_active(struct mms114_data *data, bool active) +{ + int val; + + val = mms114_read_reg(data, MMS114_MODE_CONTROL); + if (val < 0) + return val; + + val &= ~MMS114_OPERATION_MODE_MASK; + + /* If active is false, sleep mode */ + if (active) + val |= MMS114_ACTIVE; + + return mms114_write_reg(data, MMS114_MODE_CONTROL, val); +} + +static int mms114_get_version(struct mms114_data *data) +{ + struct device *dev = &data->client->dev; + u8 buf[6]; + int error; + + error = __mms114_read_reg(data, MMS114_TSP_REV, 6, buf); + if (error < 0) + return error; + + dev_info(dev, "TSP Rev: 0x%x, HW Rev: 0x%x, Firmware Ver: 0x%x\n", + buf[0], buf[1], buf[3]); + + return 0; +} + +static int mms114_setup_regs(struct mms114_data *data) +{ + const struct mms114_platform_data *pdata = data->pdata; + int val; + int error; + + error = mms114_get_version(data); + if (error < 0) + return error; + + error = mms114_set_active(data, true); + if (error < 0) + return error; + + val = (pdata->x_size >> 8) & 0xf; + val |= ((pdata->y_size >> 8) & 0xf) << 4; + error = mms114_write_reg(data, MMS114_XY_RESOLUTION_H, val); + if (error < 0) + return error; + + val = pdata->x_size & 0xff; + error = mms114_write_reg(data, MMS114_X_RESOLUTION, val); + if (error < 0) + return error; + + val = pdata->y_size & 0xff; + error = mms114_write_reg(data, MMS114_Y_RESOLUTION, val); + if (error < 0) + return error; + + if (pdata->contact_threshold) { + error = mms114_write_reg(data, MMS114_CONTACT_THRESHOLD, + pdata->contact_threshold); + if (error < 0) + return error; + } + + if (pdata->moving_threshold) { + error = mms114_write_reg(data, MMS114_MOVING_THRESHOLD, + pdata->moving_threshold); + if (error < 0) + return error; + } + + return 0; +} + +static int mms114_start(struct mms114_data *data) +{ + struct i2c_client *client = data->client; + int error; + + if (data->core_reg) + regulator_enable(data->core_reg); + if (data->io_reg) + regulator_enable(data->io_reg); + mdelay(MMS114_POWERON_DELAY); + + error = mms114_setup_regs(data); + if (error < 0) + return error; + + if (data->pdata->cfg_pin) + data->pdata->cfg_pin(true); + + enable_irq(client->irq); + + return 0; +} + +static void mms114_stop(struct mms114_data *data) +{ + struct i2c_client *client = data->client; + + disable_irq(client->irq); + + if (data->pdata->cfg_pin) + data->pdata->cfg_pin(false); + + if (data->io_reg) + regulator_disable(data->io_reg); + if (data->core_reg) + regulator_disable(data->core_reg); +} + +static int mms114_input_open(struct input_dev *dev) +{ + struct mms114_data *data = input_get_drvdata(dev); + + return mms114_start(data); +} + +static void mms114_input_close(struct input_dev *dev) +{ + struct mms114_data *data = input_get_drvdata(dev); + + mms114_stop(data); +} + +static int __devinit mms114_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct mms114_data *data; + struct input_dev *input_dev; + int error; + + if (!client->dev.platform_data) { + dev_err(&client->dev, "Need platform data\n"); + return -EINVAL; + } + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_PROTOCOL_MANGLING)) { + dev_err(&client->dev, + "Need i2c bus that supports protocol mangling\n"); + return -ENODEV; + } + + data = kzalloc(sizeof(struct mms114_data), GFP_KERNEL); + input_dev = input_allocate_device(); + if (!data || !input_dev) { + dev_err(&client->dev, "Failed to allocate memory\n"); + error = -ENOMEM; + goto err_free_mem; + } + + data->client = client; + data->input_dev = input_dev; + data->pdata = client->dev.platform_data; + + input_dev->name = "MELPAS MMS114 Touchscreen"; + input_dev->id.bustype = BUS_I2C; + input_dev->dev.parent = &client->dev; + input_dev->open = mms114_input_open; + input_dev->close = mms114_input_close; + + __set_bit(EV_ABS, input_dev->evbit); + __set_bit(EV_KEY, input_dev->evbit); + __set_bit(BTN_TOUCH, input_dev->keybit); + input_set_abs_params(input_dev, ABS_X, 0, data->pdata->x_size, 0, 0); + input_set_abs_params(input_dev, ABS_Y, 0, data->pdata->y_size, 0, 0); + + /* For multi touch */ + input_mt_init_slots(input_dev, MMS114_MAX_TOUCH); + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, + 0, MMS114_MAX_AREA, 0, 0); + input_set_abs_params(input_dev, ABS_MT_POSITION_X, + 0, data->pdata->x_size, 0, 0); + input_set_abs_params(input_dev, ABS_MT_POSITION_Y, + 0, data->pdata->y_size, 0, 0); + input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 255, 0, 0); + + input_set_drvdata(input_dev, data); + i2c_set_clientdata(client, data); + + data->core_reg = regulator_get(&client->dev, "avdd"); + if (IS_ERR(data->core_reg)) { + error = PTR_ERR(data->core_reg); + dev_err(&client->dev, + "Unable to get the Core regulator (%d)\n", error); + goto err_free_mem; + } + + data->io_reg = regulator_get(&client->dev, "vdd"); + if (IS_ERR(data->io_reg)) { + error = PTR_ERR(data->io_reg); + dev_err(&client->dev, + "Unable to get the IO regulator (%d)\n", error); + goto err_core_reg; + } + + error = request_threaded_irq(client->irq, NULL, mms114_interrupt, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "mms114", data); + if (error) { + dev_err(&client->dev, "Failed to register interrupt\n"); + goto err_io_reg; + } + disable_irq(client->irq); + + error = input_register_device(data->input_dev); + if (error) + goto err_free_irq; + + return 0; + +err_free_irq: + free_irq(client->irq, data); +err_io_reg: + regulator_put(data->io_reg); +err_core_reg: + regulator_put(data->core_reg); +err_free_mem: + input_free_device(input_dev); + kfree(data); + return error; +} + +static int __devexit mms114_remove(struct i2c_client *client) +{ + struct mms114_data *data = i2c_get_clientdata(client); + + free_irq(client->irq, data); + regulator_put(data->io_reg); + regulator_put(data->core_reg); + input_unregister_device(data->input_dev); + kfree(data); + + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int mms114_suspend(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct mms114_data *data = i2c_get_clientdata(client); + struct input_dev *input_dev = data->input_dev; + int id; + + /* Release all touch */ + for (id = 0; id < MMS114_MAX_TOUCH; id++) { + input_mt_slot(input_dev, id); + input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, false); + } + + input_mt_report_pointer_emulation(input_dev, true); + input_sync(input_dev); + + mutex_lock(&input_dev->mutex); + if (input_dev->users) + mms114_stop(data); + mutex_unlock(&input_dev->mutex); + + return 0; +} + +static int mms114_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct mms114_data *data = i2c_get_clientdata(client); + struct input_dev *input_dev = data->input_dev; + int error; + + mutex_lock(&input_dev->mutex); + if (input_dev->users) { + error = mms114_start(data); + if (error < 0) { + mutex_unlock(&input_dev->mutex); + return error; + } + } + mutex_unlock(&input_dev->mutex); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(mms114_pm_ops, mms114_suspend, mms114_resume); + +static const struct i2c_device_id mms114_id[] = { + { "mms114", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, mms114_id); + +static struct i2c_driver mms114_driver = { + .driver = { + .name = "mms114", + .owner = THIS_MODULE, + .pm = &mms114_pm_ops, + }, + .probe = mms114_probe, + .remove = __devexit_p(mms114_remove), + .id_table = mms114_id, +}; + +module_i2c_driver(mms114_driver); + +/* Module information */ +MODULE_AUTHOR("Joonyoung Shim "); +MODULE_DESCRIPTION("MELFAS mms114 Touchscreen driver"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/i2c/mms114.h b/include/linux/i2c/mms114.h new file mode 100644 index 000000000000..5722ebfb2738 --- /dev/null +++ b/include/linux/i2c/mms114.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2012 Samsung Electronics Co.Ltd + * Author: Joonyoung Shim + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundationr + */ + +#ifndef __LINUX_MMS114_H +#define __LINUX_MMS114_H + +struct mms114_platform_data { + unsigned int x_size; + unsigned int y_size; + unsigned int contact_threshold; + unsigned int moving_threshold; + bool x_invert; + bool y_invert; + + void (*cfg_pin)(bool); +}; + +#endif /* __LINUX_MMS114_H */ -- cgit v1.2.3