From 1a9027770f3d93b78f7031af79597f9659db5d70 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Mon, 12 Dec 2016 14:33:37 -0800 Subject: Input: i8042 - force synchronous probing of PNP drivers We rely on the result of scanning PNP bus for keyboard and mouse devices to decide whether we should continue initialization of i8042 driver or not, so the probes can not be asynchronous. Also, it is not a good idea to unbind either of the PNP devices while i8042 is running, so let's disable bind/unbind for the PNP drivers through sysfs and rely on i8042 cleaning after itself properly. User can still unbind and rebind entire i8042 and that will take care of PNP drivers as well. Reviewed-by: Luis R. Rodriguez Signed-off-by: Dmitry Torokhov --- drivers/input/serio/i8042-x86ia64io.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/input') diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 21e134798ba3..a4592ebf9a1d 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h @@ -910,6 +910,10 @@ static struct pnp_driver i8042_pnp_kbd_driver = { .name = "i8042 kbd", .id_table = pnp_kbd_devids, .probe = i8042_pnp_kbd_probe, + .driver = { + .probe_type = PROBE_FORCE_SYNCHRONOUS, + .suppress_bind_attrs = true, + }, }; static struct pnp_device_id pnp_aux_devids[] = { @@ -932,6 +936,10 @@ static struct pnp_driver i8042_pnp_aux_driver = { .name = "i8042 aux", .id_table = pnp_aux_devids, .probe = i8042_pnp_aux_probe, + .driver = { + .probe_type = PROBE_FORCE_SYNCHRONOUS, + .suppress_bind_attrs = true, + }, }; static void i8042_pnp_exit(void) -- cgit v1.2.3 From f63bb4f442d6c7929e58d671d1f46e122c441884 Mon Sep 17 00:00:00 2001 From: Aniroop Mathur Date: Tue, 27 Dec 2016 13:22:42 -0800 Subject: Input: bma150 - switch to using usleep_range instead of msleep msleep (1~20) may not do what the caller intends, and will often sleep longer. (~20 ms actual sleep for any value given in the 1~20ms range) This is not the desired behaviour for many cases like device resume time, device suspend time, device enable time, etc. Thus, change msleep to usleep_range for precise wakeups. Signed-off-by: Aniroop Mathur Acked by: Albert Zhang Signed-off-by: Dmitry Torokhov --- drivers/input/misc/bma150.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index 2124390ec38c..1fa85379f86c 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c @@ -207,7 +207,7 @@ static int bma150_set_mode(struct bma150_data *bma150, u8 mode) return error; if (mode == BMA150_MODE_NORMAL) - msleep(2); + usleep_range(2000, 2100); bma150->mode = mode; return 0; @@ -222,7 +222,7 @@ static int bma150_soft_reset(struct bma150_data *bma150) if (error) return error; - msleep(2); + usleep_range(2000, 2100); return 0; } -- cgit v1.2.3 From b29c139a15b627cd3db803332c89f0ea1b94fc7b Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Tue, 27 Dec 2016 11:42:28 -0800 Subject: Input: synaptics-rmi4 - use Kconfig "if" to express dependency There is no need to repeat "depends on RMI4_CORE" on every bit of RMI4 support, we can guard all of them at once with "if RMI4_CORE". Also use tabs for F03 indentation. Reviewed-by: Guenter Roeck Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/Kconfig | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig index 8993983e3fe4..78a78b99ec31 100644 --- a/drivers/input/rmi4/Kconfig +++ b/drivers/input/rmi4/Kconfig @@ -9,9 +9,11 @@ config RMI4_CORE If unsure, say Y. +if RMI4_CORE + config RMI4_I2C tristate "RMI4 I2C Support" - depends on RMI4_CORE && I2C + depends on I2C help Say Y here if you want to support RMI4 devices connected to an I2C bus. @@ -20,7 +22,7 @@ config RMI4_I2C config RMI4_SPI tristate "RMI4 SPI Support" - depends on RMI4_CORE && SPI + depends on SPI help Say Y here if you want to support RMI4 devices connected to a SPI bus. @@ -29,7 +31,7 @@ config RMI4_SPI config RMI4_SMB tristate "RMI4 SMB Support" - depends on RMI4_CORE && I2C + depends on I2C help Say Y here if you want to support RMI4 devices connected to an SMB bus. @@ -40,23 +42,20 @@ config RMI4_SMB called rmi_smbus. config RMI4_F03 - bool "RMI4 Function 03 (PS2 Guest)" - depends on RMI4_CORE + bool "RMI4 Function 03 (PS2 Guest)" depends on SERIO=y || RMI4_CORE=SERIO - help - Say Y here if you want to add support for RMI4 function 03. + help + Say Y here if you want to add support for RMI4 function 03. - Function 03 provides PS2 guest support for RMI4 devices. This - includes support for TrackPoints on TouchPads. + Function 03 provides PS2 guest support for RMI4 devices. This + includes support for TrackPoints on TouchPads. config RMI4_2D_SENSOR bool - depends on RMI4_CORE config RMI4_F11 bool "RMI4 Function 11 (2D pointing)" select RMI4_2D_SENSOR - depends on RMI4_CORE help Say Y here if you want to add support for RMI4 function 11. @@ -67,7 +66,6 @@ config RMI4_F11 config RMI4_F12 bool "RMI4 Function 12 (2D pointing)" select RMI4_2D_SENSOR - depends on RMI4_CORE help Say Y here if you want to add support for RMI4 function 12. @@ -77,7 +75,6 @@ config RMI4_F12 config RMI4_F30 bool "RMI4 Function 30 (GPIO LED)" - depends on RMI4_CORE help Say Y here if you want to add support for RMI4 function 30. @@ -86,7 +83,6 @@ config RMI4_F30 config RMI4_F34 bool "RMI4 Function 34 (Device reflash)" - depends on RMI4_CORE select FW_LOADER help Say Y here if you want to add support for RMI4 function 34. @@ -97,7 +93,6 @@ config RMI4_F34 config RMI4_F54 bool "RMI4 Function 54 (Analog diagnostics)" - depends on RMI4_CORE depends on VIDEO_V4L2=y || (RMI4_CORE=m && VIDEO_V4L2=m) select VIDEOBUF2_VMALLOC select RMI4_F55 @@ -109,9 +104,10 @@ config RMI4_F54 config RMI4_F55 bool "RMI4 Function 55 (Sensor tuning)" - depends on RMI4_CORE help Say Y here if you want to add support for RMI4 function 55 Function 55 provides access to the RMI4 touch sensor tuning mechanism. + +endif # RMI_CORE -- cgit v1.2.3 From 0c54fe74db73499637315d6b3d83a7adbc6f32aa Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 20 Dec 2016 13:23:30 -0800 Subject: Input: synaptics-rmi4 - check for non zero version logically dead code version is a u8, the check for version > 0 means that version can only be zero, so the subsequent check for version != 0 is never true and hence is redudant code and can be removed. Signed-off-by: Colin Ian King Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_f34.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/rmi4/rmi_f34.c b/drivers/input/rmi4/rmi_f34.c index 9774dfbab9bb..c3285cefe9b6 100644 --- a/drivers/input/rmi4/rmi_f34.c +++ b/drivers/input/rmi4/rmi_f34.c @@ -441,8 +441,6 @@ static int rmi_f34_probe(struct rmi_function *fn) /* v5 code only supported version 0, try V7 probe */ if (version > 0) return rmi_f34v7_probe(f34); - else if (version != 0) - return -ENODEV; f34->bl_version = 5; -- cgit v1.2.3 From 3a11c0e1f1394e9d871dd8e68f9ce01d7c96e28d Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 29 Dec 2016 10:13:43 -0800 Subject: Input: synaptics-rmi4 - remove redundant null check on rmi_dev rmi_dev is currently being dereferenced before it null checked, however, after deeper inspecting, rmi_dev can never be null, so just remove this redundant check. Fixes CoverityScan CID 1391218 ("Dereference before null check") Signed-off-by: Colin Ian King Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_f03.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/rmi4/rmi_f03.c b/drivers/input/rmi4/rmi_f03.c index 8a7ca3e2f95e..9a1b099b72e0 100644 --- a/drivers/input/rmi4/rmi_f03.c +++ b/drivers/input/rmi4/rmi_f03.c @@ -175,9 +175,6 @@ static int rmi_f03_attention(struct rmi_function *fn, unsigned long *irq_bits) int i; int error; - if (!rmi_dev) - return -ENODEV; - if (drvdata->attn_data.data) { /* First grab the data passed by the transport device */ if (drvdata->attn_data.size < ob_len) { -- cgit v1.2.3 From c02fc1d9e5d9f093296e43e13ec7f35f140784bd Mon Sep 17 00:00:00 2001 From: Daniel Tobias Date: Fri, 27 May 2016 16:25:10 -0700 Subject: Input: xpad - correctly sort vendor id's Signed-off-by: Daniel Tobias Signed-off-by: Pavel Rojtberg Signed-off-by: Dmitry Torokhov --- drivers/input/joystick/xpad.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 6d9499658671..1795f96f1b58 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -320,18 +320,18 @@ static struct usb_device_id xpad_table[] = { XPAD_XBOXONE_VENDOR(0x0738), /* Mad Catz FightStick TE 2 */ XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ XPAD_XBOXONE_VENDOR(0x0e6f), /* 0x0e6f X-Box One controllers */ + XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ + XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ - XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */ - XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ - XPAD_XBOXONE_VENDOR(0x0f0d), /* Hori Controllers */ - XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */ - XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */ - XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ XPAD_XBOX360_VENDOR(0x1532), /* Razer Sabertooth */ XPAD_XBOX360_VENDOR(0x15e4), /* Numark X-Box 360 controllers */ XPAD_XBOX360_VENDOR(0x162e), /* Joytech X-Box 360 controllers */ + XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */ + XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */ + XPAD_XBOX360_VENDOR(0x24c6), /* PowerA Controllers */ + XPAD_XBOXONE_VENDOR(0x24c6), /* PowerA Controllers */ { } }; -- cgit v1.2.3 From 4f88476c75429ba9ab71c428b4cd2f67575bc9c1 Mon Sep 17 00:00:00 2001 From: Daniel Tobias Date: Fri, 27 May 2016 16:25:32 -0700 Subject: Input: xpad - move reporting xbox one home button to common function xbox one was the only device that has a *_process_buttons routine. Signed-off-by: Pavel Rojtberg Signed-off-by: Dmitry Torokhov --- drivers/input/joystick/xpad.c | 52 ++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 33 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 1795f96f1b58..9ddd8511c138 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -608,14 +608,28 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned cha } /* - * xpadone_process_buttons + * xpadone_process_packet * - * Process a button update packet from an Xbox one controller. + * Completes a request by converting the data into events for the + * input subsystem. This version is for the Xbox One controller. + * + * The report format was gleaned from + * https://github.com/kylelemons/xbox/blob/master/xbox.go */ -static void xpadone_process_buttons(struct usb_xpad *xpad, - struct input_dev *dev, - unsigned char *data) +static void xpadone_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *data) { + struct input_dev *dev = xpad->dev; + + /* the xbox button has its own special report */ + if (data[0] == 0X07) { + input_report_key(dev, BTN_MODE, data[4] & 0x01); + input_sync(dev); + return; + } + /* check invalid packet */ + else if (data[0] != 0X20) + return; + /* menu/view buttons */ input_report_key(dev, BTN_START, data[4] & 0x04); input_report_key(dev, BTN_SELECT, data[4] & 0x08); @@ -678,34 +692,6 @@ static void xpadone_process_buttons(struct usb_xpad *xpad, input_sync(dev); } -/* - * xpadone_process_packet - * - * Completes a request by converting the data into events for the - * input subsystem. This version is for the Xbox One controller. - * - * The report format was gleaned from - * https://github.com/kylelemons/xbox/blob/master/xbox.go - */ - -static void xpadone_process_packet(struct usb_xpad *xpad, - u16 cmd, unsigned char *data) -{ - struct input_dev *dev = xpad->dev; - - switch (data[0]) { - case 0x20: - xpadone_process_buttons(xpad, dev, data); - break; - - case 0x07: - /* the xbox button has its own special report */ - input_report_key(dev, BTN_MODE, data[4] & 0x01); - input_sync(dev); - break; - } -} - static void xpad_irq_in(struct urb *urb) { struct usb_xpad *xpad = urb->context; -- cgit v1.2.3 From a8c34e27fb1ece928ec728bfe596aa6ca0b1928a Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Fri, 27 May 2016 16:26:33 -0700 Subject: Input: xpad - simplify error condition in init_output Replace first goto with simple returns as we really are just returning one error code. Signed-off-by: Pavel Rojtberg Signed-off-by: Dmitry Torokhov --- drivers/input/joystick/xpad.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 9ddd8511c138..3f6130e0f9c1 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -849,17 +849,15 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) xpad->odata = usb_alloc_coherent(xpad->udev, XPAD_PKT_LEN, GFP_KERNEL, &xpad->odata_dma); - if (!xpad->odata) { - error = -ENOMEM; - goto fail1; - } + if (!xpad->odata) + return -ENOMEM; spin_lock_init(&xpad->odata_lock); xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL); if (!xpad->irq_out) { error = -ENOMEM; - goto fail2; + goto err_free_coherent; } /* Xbox One controller has in/out endpoints swapped. */ @@ -875,8 +873,9 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) return 0; - fail2: usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); - fail1: return error; +err_free_coherent: + usb_free_coherent(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); + return error; } static void xpad_stop_output(struct usb_xpad *xpad) -- cgit v1.2.3 From c01b5e7464f0cf20936d7467c7528163c4e2782d Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 3 Jan 2017 22:40:38 -0800 Subject: Input: xpad - don't depend on endpoint order The order of endpoints is well defined on official Xbox pads, but we have found at least one 3rd-party pad that doesn't follow the standard ("Titanfall 2 Xbox One controller" 0e6f:0165). Fortunately, we get lucky with this specific pad because it uses endpoint addresses that differ only by direction. We know that there are other pads out where this is not true, so let's go ahead and fix this. Signed-off-by: Cameron Gutman Signed-off-by: Dmitry Torokhov --- drivers/input/joystick/xpad.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 3f6130e0f9c1..c06b717139ad 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c @@ -836,10 +836,9 @@ static void xpad_irq_out(struct urb *urb) spin_unlock_irqrestore(&xpad->odata_lock, flags); } -static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) +static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad, + struct usb_endpoint_descriptor *ep_irq_out) { - struct usb_endpoint_descriptor *ep_irq_out; - int ep_irq_out_idx; int error; if (xpad->xtype == XTYPE_UNKNOWN) @@ -860,10 +859,6 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) goto err_free_coherent; } - /* Xbox One controller has in/out endpoints swapped. */ - ep_irq_out_idx = xpad->xtype == XTYPE_XBOXONE ? 0 : 1; - ep_irq_out = &intf->cur_altsetting->endpoint[ep_irq_out_idx].desc; - usb_fill_int_urb(xpad->irq_out, xpad->udev, usb_sndintpipe(xpad->udev, ep_irq_out->bEndpointAddress), xpad->odata, XPAD_PKT_LEN, @@ -1447,8 +1442,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id { struct usb_device *udev = interface_to_usbdev(intf); struct usb_xpad *xpad; - struct usb_endpoint_descriptor *ep_irq_in; - int ep_irq_in_idx; + struct usb_endpoint_descriptor *ep_irq_in, *ep_irq_out; int i, error; if (intf->cur_altsetting->desc.bNumEndpoints != 2) @@ -1518,13 +1512,26 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id goto err_free_in_urb; } - error = xpad_init_output(intf, xpad); - if (error) + ep_irq_in = ep_irq_out = NULL; + + for (i = 0; i < 2; i++) { + struct usb_endpoint_descriptor *ep = + &intf->cur_altsetting->endpoint[i].desc; + + if (usb_endpoint_dir_in(ep)) + ep_irq_in = ep; + else + ep_irq_out = ep; + } + + if (!ep_irq_in || !ep_irq_out) { + error = -ENODEV; goto err_free_in_urb; + } - /* Xbox One controller has in/out endpoints swapped. */ - ep_irq_in_idx = xpad->xtype == XTYPE_XBOXONE ? 1 : 0; - ep_irq_in = &intf->cur_altsetting->endpoint[ep_irq_in_idx].desc; + error = xpad_init_output(intf, xpad, ep_irq_out); + if (error) + goto err_free_in_urb; usb_fill_int_urb(xpad->irq_in, udev, usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), -- cgit v1.2.3 From 0eeecf60394928b48806b081d4bea1a18db9318c Mon Sep 17 00:00:00 2001 From: Aniroop Mathur Date: Wed, 4 Jan 2017 10:57:51 -0800 Subject: Input: edt_ft5x06 - change msleep to usleep_range for small msecs msleep(1~20) may not do what the caller intends, and will often sleep longer (~20 ms actual sleep for any value given in the 1~20ms range). This is not the desired behaviour for many cases like device resume time, device suspend time, device enable time, retry logic, etc. Thus, change msleep to usleep_range for precise wakeups. Signed-off-by: Aniroop Mathur Acked-by: Simon Budig Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/edt-ft5x06.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 28466e358fee..8fc629fb023f 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -67,7 +67,7 @@ #define EDT_SWITCH_MODE_RETRIES 10 #define EDT_SWITCH_MODE_DELAY 5 /* msec */ #define EDT_RAW_DATA_RETRIES 100 -#define EDT_RAW_DATA_DELAY 1 /* msec */ +#define EDT_RAW_DATA_DELAY 1000 /* usec */ enum edt_ver { M06, @@ -664,7 +664,7 @@ static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file, } do { - msleep(EDT_RAW_DATA_DELAY); + usleep_range(EDT_RAW_DATA_DELAY, EDT_RAW_DATA_DELAY + 100); val = edt_ft5x06_register_read(tsdata, 0x08); if (val < 1) break; -- cgit v1.2.3 From aa142ed77099e9a614980022b3f94efc67417775 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Thu, 5 Jan 2017 14:19:01 -0800 Subject: Input: intel-mid-touch - remove driver The Moorestown support was removed by commit 1a8359e411eb ("x86/mid: Remove Intel Moorestown"). Remove this leftover. Signed-off-by: Andy Shevchenko Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/Kconfig | 12 - drivers/input/touchscreen/Makefile | 1 - drivers/input/touchscreen/intel-mid-touch.c | 654 ---------------------------- 3 files changed, 667 deletions(-) delete mode 100644 drivers/input/touchscreen/intel-mid-touch.c (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index efca0133e266..8650c94e29d0 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -546,18 +546,6 @@ config TOUCHSCREEN_INEXIO To compile this driver as a module, choose M here: the module will be called inexio. -config TOUCHSCREEN_INTEL_MID - tristate "Intel MID platform resistive touchscreen" - depends on INTEL_SCU_IPC - help - Say Y here if you have a Intel MID based touchscreen in - your system. - - If unsure, say N. - - To compile this driver as a module, choose M here: the - module will be called intel_mid_touch. - config TOUCHSCREEN_MK712 tristate "ICS MicroClock MK712 touchscreen" help diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 81b86451782d..e41e3c7aa427 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -42,7 +42,6 @@ obj-$(CONFIG_TOUCHSCREEN_GOODIX) += goodix.o obj-$(CONFIG_TOUCHSCREEN_ILI210X) += ili210x.o obj-$(CONFIG_TOUCHSCREEN_IMX6UL_TSC) += imx6ul_tsc.o obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o -obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o obj-$(CONFIG_TOUCHSCREEN_IPROC) += bcm_iproc_tsc.o obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o diff --git a/drivers/input/touchscreen/intel-mid-touch.c b/drivers/input/touchscreen/intel-mid-touch.c deleted file mode 100644 index b4f0725a1c3d..000000000000 --- a/drivers/input/touchscreen/intel-mid-touch.c +++ /dev/null @@ -1,654 +0,0 @@ -/* - * Intel MID Resistive Touch Screen Driver - * - * Copyright (C) 2008 Intel Corp - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * 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; version 2 of the License. - * - * 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. - * - * Questions/Comments/Bug fixes to Sreedhara (sreedhara.ds@intel.com) - * Ramesh Agarwal (ramesh.agarwal@intel.com) - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * TODO: - * review conversion of r/m/w sequences - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* PMIC Interrupt registers */ -#define PMIC_REG_ID1 0x00 /* PMIC ID1 register */ - -/* PMIC Interrupt registers */ -#define PMIC_REG_INT 0x04 /* PMIC interrupt register */ -#define PMIC_REG_MINT 0x05 /* PMIC interrupt mask register */ - -/* ADC Interrupt registers */ -#define PMIC_REG_ADCINT 0x5F /* ADC interrupt register */ -#define PMIC_REG_MADCINT 0x60 /* ADC interrupt mask register */ - -/* ADC Control registers */ -#define PMIC_REG_ADCCNTL1 0x61 /* ADC control register */ - -/* ADC Channel Selection registers */ -#define PMICADDR0 0xA4 -#define END_OF_CHANNEL 0x1F - -/* ADC Result register */ -#define PMIC_REG_ADCSNS0H 0x64 - -/* ADC channels for touch screen */ -#define MRST_TS_CHAN10 0xA /* Touch screen X+ connection */ -#define MRST_TS_CHAN11 0xB /* Touch screen X- connection */ -#define MRST_TS_CHAN12 0xC /* Touch screen Y+ connection */ -#define MRST_TS_CHAN13 0xD /* Touch screen Y- connection */ - -/* Touch screen channel BIAS constants */ -#define MRST_XBIAS 0x20 -#define MRST_YBIAS 0x40 -#define MRST_ZBIAS 0x80 - -/* Touch screen coordinates */ -#define MRST_X_MIN 10 -#define MRST_X_MAX 1024 -#define MRST_X_FUZZ 5 -#define MRST_Y_MIN 10 -#define MRST_Y_MAX 1024 -#define MRST_Y_FUZZ 5 -#define MRST_PRESSURE_MIN 0 -#define MRST_PRESSURE_NOMINAL 50 -#define MRST_PRESSURE_MAX 100 - -#define WAIT_ADC_COMPLETION 10 /* msec */ - -/* PMIC ADC round robin delays */ -#define ADC_LOOP_DELAY0 0x0 /* Continuous loop */ -#define ADC_LOOP_DELAY1 0x1 /* 4.5 ms approximate */ - -/* PMIC Vendor Identifiers */ -#define PMIC_VENDOR_FS 0 /* PMIC vendor FreeScale */ -#define PMIC_VENDOR_MAXIM 1 /* PMIC vendor MAXIM */ -#define PMIC_VENDOR_NEC 2 /* PMIC vendor NEC */ -#define MRSTOUCH_MAX_CHANNELS 32 /* Maximum ADC channels */ - -/* Touch screen device structure */ -struct mrstouch_dev { - struct device *dev; /* device associated with touch screen */ - struct input_dev *input; - char phys[32]; - u16 asr; /* Address selection register */ - int irq; - unsigned int vendor; /* PMIC vendor */ - unsigned int rev; /* PMIC revision */ - - int (*read_prepare)(struct mrstouch_dev *tsdev); - int (*read)(struct mrstouch_dev *tsdev, u16 *x, u16 *y, u16 *z); - int (*read_finish)(struct mrstouch_dev *tsdev); -}; - - -/*************************** NEC and Maxim Interface ************************/ - -static int mrstouch_nec_adc_read_prepare(struct mrstouch_dev *tsdev) -{ - return intel_scu_ipc_update_register(PMIC_REG_MADCINT, 0, 0x20); -} - -/* - * Enables PENDET interrupt. - */ -static int mrstouch_nec_adc_read_finish(struct mrstouch_dev *tsdev) -{ - int err; - - err = intel_scu_ipc_update_register(PMIC_REG_MADCINT, 0x20, 0x20); - if (!err) - err = intel_scu_ipc_update_register(PMIC_REG_ADCCNTL1, 0, 0x05); - - return err; -} - -/* - * Reads PMIC ADC touch screen result - * Reads ADC storage registers for higher 7 and lower 3 bits and - * converts the two readings into a single value and turns off gain bit - */ -static int mrstouch_ts_chan_read(u16 offset, u16 chan, u16 *vp, u16 *vm) -{ - int err; - u16 result; - u32 res; - - result = PMIC_REG_ADCSNS0H + offset; - - if (chan == MRST_TS_CHAN12) - result += 4; - - err = intel_scu_ipc_ioread32(result, &res); - if (err) - return err; - - /* Mash the bits up */ - - *vp = (res & 0xFF) << 3; /* Highest 7 bits */ - *vp |= (res >> 8) & 0x07; /* Lower 3 bits */ - *vp &= 0x3FF; - - res >>= 16; - - *vm = (res & 0xFF) << 3; /* Highest 7 bits */ - *vm |= (res >> 8) & 0x07; /* Lower 3 bits */ - *vm &= 0x3FF; - - return 0; -} - -/* - * Enables X, Y and Z bias values - * Enables YPYM for X channels and XPXM for Y channels - */ -static int mrstouch_ts_bias_set(uint offset, uint bias) -{ - int count; - u16 chan, start; - u16 reg[4]; - u8 data[4]; - - chan = PMICADDR0 + offset; - start = MRST_TS_CHAN10; - - for (count = 0; count <= 3; count++) { - reg[count] = chan++; - data[count] = bias | (start + count); - } - - return intel_scu_ipc_writev(reg, data, 4); -} - -/* To read touch screen channel values */ -static int mrstouch_nec_adc_read(struct mrstouch_dev *tsdev, - u16 *x, u16 *y, u16 *z) -{ - int err; - u16 xm, ym, zm; - - /* configure Y bias for X channels */ - err = mrstouch_ts_bias_set(tsdev->asr, MRST_YBIAS); - if (err) - goto ipc_error; - - msleep(WAIT_ADC_COMPLETION); - - /* read x+ and x- channels */ - err = mrstouch_ts_chan_read(tsdev->asr, MRST_TS_CHAN10, x, &xm); - if (err) - goto ipc_error; - - /* configure x bias for y channels */ - err = mrstouch_ts_bias_set(tsdev->asr, MRST_XBIAS); - if (err) - goto ipc_error; - - msleep(WAIT_ADC_COMPLETION); - - /* read y+ and y- channels */ - err = mrstouch_ts_chan_read(tsdev->asr, MRST_TS_CHAN12, y, &ym); - if (err) - goto ipc_error; - - /* configure z bias for x and y channels */ - err = mrstouch_ts_bias_set(tsdev->asr, MRST_ZBIAS); - if (err) - goto ipc_error; - - msleep(WAIT_ADC_COMPLETION); - - /* read z+ and z- channels */ - err = mrstouch_ts_chan_read(tsdev->asr, MRST_TS_CHAN10, z, &zm); - if (err) - goto ipc_error; - - return 0; - -ipc_error: - dev_err(tsdev->dev, "ipc error during adc read\n"); - return err; -} - - -/*************************** Freescale Interface ************************/ - -static int mrstouch_fs_adc_read_prepare(struct mrstouch_dev *tsdev) -{ - int err, count; - u16 chan; - u16 reg[5]; - u8 data[5]; - - /* Stop the ADC */ - err = intel_scu_ipc_update_register(PMIC_REG_MADCINT, 0x00, 0x02); - if (err) - goto ipc_error; - - chan = PMICADDR0 + tsdev->asr; - - /* Set X BIAS */ - for (count = 0; count <= 3; count++) { - reg[count] = chan++; - data[count] = 0x2A; - } - reg[count] = chan++; /* Dummy */ - data[count] = 0; - - err = intel_scu_ipc_writev(reg, data, 5); - if (err) - goto ipc_error; - - msleep(WAIT_ADC_COMPLETION); - - /* Set Y BIAS */ - for (count = 0; count <= 3; count++) { - reg[count] = chan++; - data[count] = 0x4A; - } - reg[count] = chan++; /* Dummy */ - data[count] = 0; - - err = intel_scu_ipc_writev(reg, data, 5); - if (err) - goto ipc_error; - - msleep(WAIT_ADC_COMPLETION); - - /* Set Z BIAS */ - err = intel_scu_ipc_iowrite32(chan + 2, 0x8A8A8A8A); - if (err) - goto ipc_error; - - msleep(WAIT_ADC_COMPLETION); - - return 0; - -ipc_error: - dev_err(tsdev->dev, "ipc error during %s\n", __func__); - return err; -} - -static int mrstouch_fs_adc_read(struct mrstouch_dev *tsdev, - u16 *x, u16 *y, u16 *z) -{ - int err; - u16 result; - u16 reg[4]; - u8 data[4]; - - result = PMIC_REG_ADCSNS0H + tsdev->asr; - - reg[0] = result + 4; - reg[1] = result + 5; - reg[2] = result + 16; - reg[3] = result + 17; - - err = intel_scu_ipc_readv(reg, data, 4); - if (err) - goto ipc_error; - - *x = data[0] << 3; /* Higher 7 bits */ - *x |= data[1] & 0x7; /* Lower 3 bits */ - *x &= 0x3FF; - - *y = data[2] << 3; /* Higher 7 bits */ - *y |= data[3] & 0x7; /* Lower 3 bits */ - *y &= 0x3FF; - - /* Read Z value */ - reg[0] = result + 28; - reg[1] = result + 29; - - err = intel_scu_ipc_readv(reg, data, 4); - if (err) - goto ipc_error; - - *z = data[0] << 3; /* Higher 7 bits */ - *z |= data[1] & 0x7; /* Lower 3 bits */ - *z &= 0x3FF; - - return 0; - -ipc_error: - dev_err(tsdev->dev, "ipc error during %s\n", __func__); - return err; -} - -static int mrstouch_fs_adc_read_finish(struct mrstouch_dev *tsdev) -{ - int err, count; - u16 chan; - u16 reg[5]; - u8 data[5]; - - /* Clear all TS channels */ - chan = PMICADDR0 + tsdev->asr; - for (count = 0; count <= 4; count++) { - reg[count] = chan++; - data[count] = 0; - } - err = intel_scu_ipc_writev(reg, data, 5); - if (err) - goto ipc_error; - - for (count = 0; count <= 4; count++) { - reg[count] = chan++; - data[count] = 0; - } - err = intel_scu_ipc_writev(reg, data, 5); - if (err) - goto ipc_error; - - err = intel_scu_ipc_iowrite32(chan + 2, 0x00000000); - if (err) - goto ipc_error; - - /* Start ADC */ - err = intel_scu_ipc_update_register(PMIC_REG_MADCINT, 0x02, 0x02); - if (err) - goto ipc_error; - - return 0; - -ipc_error: - dev_err(tsdev->dev, "ipc error during %s\n", __func__); - return err; -} - -static void mrstouch_report_event(struct input_dev *input, - unsigned int x, unsigned int y, unsigned int z) -{ - if (z > MRST_PRESSURE_NOMINAL) { - /* Pen touched, report button touch and coordinates */ - input_report_key(input, BTN_TOUCH, 1); - input_report_abs(input, ABS_X, x); - input_report_abs(input, ABS_Y, y); - } else { - input_report_key(input, BTN_TOUCH, 0); - } - - input_report_abs(input, ABS_PRESSURE, z); - input_sync(input); -} - -/* PENDET interrupt handler */ -static irqreturn_t mrstouch_pendet_irq(int irq, void *dev_id) -{ - struct mrstouch_dev *tsdev = dev_id; - u16 x, y, z; - - /* - * Should we lower thread priority? Probably not, since we are - * not spinning but sleeping... - */ - - if (tsdev->read_prepare(tsdev)) - goto out; - - do { - if (tsdev->read(tsdev, &x, &y, &z)) - break; - - mrstouch_report_event(tsdev->input, x, y, z); - } while (z > MRST_PRESSURE_NOMINAL); - - tsdev->read_finish(tsdev); - -out: - return IRQ_HANDLED; -} - -/* Utility to read PMIC ID */ -static int mrstouch_read_pmic_id(uint *vendor, uint *rev) -{ - int err; - u8 r; - - err = intel_scu_ipc_ioread8(PMIC_REG_ID1, &r); - if (err) - return err; - - *vendor = r & 0x7; - *rev = (r >> 3) & 0x7; - - return 0; -} - -/* - * Parse ADC channels to find end of the channel configured by other ADC user - * NEC and MAXIM requires 4 channels and FreeScale needs 18 channels - */ -static int mrstouch_chan_parse(struct mrstouch_dev *tsdev) -{ - int found = 0; - int err, i; - u8 r8; - - for (i = 0; i < MRSTOUCH_MAX_CHANNELS; i++) { - err = intel_scu_ipc_ioread8(PMICADDR0 + i, &r8); - if (err) - return err; - - if (r8 == END_OF_CHANNEL) { - found = i; - break; - } - } - - if (tsdev->vendor == PMIC_VENDOR_FS) { - if (found > MRSTOUCH_MAX_CHANNELS - 18) - return -ENOSPC; - } else { - if (found > MRSTOUCH_MAX_CHANNELS - 4) - return -ENOSPC; - } - - return found; -} - - -/* - * Writes touch screen channels to ADC address selection registers - */ -static int mrstouch_ts_chan_set(uint offset) -{ - u16 chan; - - int ret, count; - - chan = PMICADDR0 + offset; - for (count = 0; count <= 3; count++) { - ret = intel_scu_ipc_iowrite8(chan++, MRST_TS_CHAN10 + count); - if (ret) - return ret; - } - return intel_scu_ipc_iowrite8(chan++, END_OF_CHANNEL); -} - -/* Initialize ADC */ -static int mrstouch_adc_init(struct mrstouch_dev *tsdev) -{ - int err, start; - u8 ra, rm; - - err = mrstouch_read_pmic_id(&tsdev->vendor, &tsdev->rev); - if (err) { - dev_err(tsdev->dev, "Unable to read PMIC id\n"); - return err; - } - - switch (tsdev->vendor) { - case PMIC_VENDOR_NEC: - case PMIC_VENDOR_MAXIM: - tsdev->read_prepare = mrstouch_nec_adc_read_prepare; - tsdev->read = mrstouch_nec_adc_read; - tsdev->read_finish = mrstouch_nec_adc_read_finish; - break; - - case PMIC_VENDOR_FS: - tsdev->read_prepare = mrstouch_fs_adc_read_prepare; - tsdev->read = mrstouch_fs_adc_read; - tsdev->read_finish = mrstouch_fs_adc_read_finish; - break; - - default: - dev_err(tsdev->dev, - "Unsupported touchscreen: %d\n", tsdev->vendor); - return -ENXIO; - } - - start = mrstouch_chan_parse(tsdev); - if (start < 0) { - dev_err(tsdev->dev, "Unable to parse channels\n"); - return start; - } - - tsdev->asr = start; - - /* - * ADC power on, start, enable PENDET and set loop delay - * ADC loop delay is set to 4.5 ms approximately - * Loop delay more than this results in jitter in adc readings - * Setting loop delay to 0 (continuous loop) in MAXIM stops PENDET - * interrupt generation sometimes. - */ - - if (tsdev->vendor == PMIC_VENDOR_FS) { - ra = 0xE0 | ADC_LOOP_DELAY0; - rm = 0x5; - } else { - /* NEC and MAXIm not consistent with loop delay 0 */ - ra = 0xE0 | ADC_LOOP_DELAY1; - rm = 0x0; - - /* configure touch screen channels */ - err = mrstouch_ts_chan_set(tsdev->asr); - if (err) - return err; - } - - err = intel_scu_ipc_update_register(PMIC_REG_ADCCNTL1, ra, 0xE7); - if (err) - return err; - - err = intel_scu_ipc_update_register(PMIC_REG_MADCINT, rm, 0x03); - if (err) - return err; - - return 0; -} - - -/* Probe function for touch screen driver */ -static int mrstouch_probe(struct platform_device *pdev) -{ - struct mrstouch_dev *tsdev; - struct input_dev *input; - int err; - int irq; - - irq = platform_get_irq(pdev, 0); - if (irq < 0) { - dev_err(&pdev->dev, "no interrupt assigned\n"); - return -EINVAL; - } - - tsdev = devm_kzalloc(&pdev->dev, sizeof(struct mrstouch_dev), - GFP_KERNEL); - if (!tsdev) { - dev_err(&pdev->dev, "unable to allocate memory\n"); - return -ENOMEM; - } - - input = devm_input_allocate_device(&pdev->dev); - if (!input) { - dev_err(&pdev->dev, "unable to allocate input device\n"); - return -ENOMEM; - } - - tsdev->dev = &pdev->dev; - tsdev->input = input; - tsdev->irq = irq; - - snprintf(tsdev->phys, sizeof(tsdev->phys), - "%s/input0", dev_name(tsdev->dev)); - - err = mrstouch_adc_init(tsdev); - if (err) { - dev_err(&pdev->dev, "ADC initialization failed\n"); - return err; - } - - input->name = "mrst_touchscreen"; - input->phys = tsdev->phys; - input->dev.parent = tsdev->dev; - - input->id.vendor = tsdev->vendor; - input->id.version = tsdev->rev; - - input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); - input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); - - input_set_abs_params(tsdev->input, ABS_X, - MRST_X_MIN, MRST_X_MAX, MRST_X_FUZZ, 0); - input_set_abs_params(tsdev->input, ABS_Y, - MRST_Y_MIN, MRST_Y_MAX, MRST_Y_FUZZ, 0); - input_set_abs_params(tsdev->input, ABS_PRESSURE, - MRST_PRESSURE_MIN, MRST_PRESSURE_MAX, 0, 0); - - err = devm_request_threaded_irq(&pdev->dev, tsdev->irq, NULL, - mrstouch_pendet_irq, IRQF_ONESHOT, - "mrstouch", tsdev); - if (err) { - dev_err(tsdev->dev, "unable to allocate irq\n"); - return err; - } - - err = input_register_device(tsdev->input); - if (err) { - dev_err(tsdev->dev, "unable to register input device\n"); - return err; - } - - return 0; -} - -static struct platform_driver mrstouch_driver = { - .driver = { - .name = "pmic_touch", - }, - .probe = mrstouch_probe, -}; -module_platform_driver(mrstouch_driver); - -MODULE_AUTHOR("Sreedhara Murthy. D.S, sreedhara.ds@intel.com"); -MODULE_DESCRIPTION("Intel Moorestown Resistive Touch Screen Driver"); -MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 890fa16762c7b43677228014387a817380e6114d Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Sun, 15 Jan 2017 14:43:15 -0800 Subject: Input: mpr121 - annotate PM methods as __maybe_unused Instead of using #ifdef, let's mark suspend and resume methods as __maybe_unused to provide better compile coverage. Suggested-by: Dmitry Torokhov Signed-off-by: Akinobu Mita Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/mpr121_touchkey.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index 0fd612dd76ed..a3fd6e5ebfb5 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c @@ -266,8 +266,7 @@ static int mpr_touchkey_probe(struct i2c_client *client, return 0; } -#ifdef CONFIG_PM_SLEEP -static int mpr_suspend(struct device *dev) +static int __maybe_unused mpr_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -279,7 +278,7 @@ static int mpr_suspend(struct device *dev) return 0; } -static int mpr_resume(struct device *dev) +static int __maybe_unused mpr_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct mpr121_touchkey *mpr121 = i2c_get_clientdata(client); @@ -292,7 +291,6 @@ static int mpr_resume(struct device *dev) return 0; } -#endif static SIMPLE_DEV_PM_OPS(mpr121_touchkey_pm_ops, mpr_suspend, mpr_resume); -- cgit v1.2.3 From a4b1aeb72662c2a35740bdf2b7e2e19593dd5d48 Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Sun, 15 Jan 2017 14:43:40 -0800 Subject: Input: mpr121 - remove unused field in struct mpr121_touchkey Remove unused key_val field in struct mpr121_touchkey. Signed-off-by: Akinobu Mita Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/mpr121_touchkey.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index a3fd6e5ebfb5..90be99d58c85 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c @@ -59,7 +59,6 @@ struct mpr121_touchkey { struct i2c_client *client; struct input_dev *input_dev; - unsigned int key_val; unsigned int statusbits; unsigned int keycount; u16 keycodes[MPR121_MAX_KEY_COUNT]; -- cgit v1.2.3 From 9723ddc8fe0d76ce41fe0dc16afb241ec7d0a29d Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Sun, 15 Jan 2017 14:44:05 -0800 Subject: Input: mpr121 - set missing event capability This driver reports misc scan input events on the sensor's status register changes. But the event capability for them was not set in the device initialization, so these events were ignored. This change adds the missing event capability. Signed-off-by: Akinobu Mita Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/mpr121_touchkey.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index 90be99d58c85..2558c602f099 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c @@ -230,6 +230,7 @@ static int mpr_touchkey_probe(struct i2c_client *client, input_dev->id.bustype = BUS_I2C; input_dev->dev.parent = &client->dev; input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); + input_set_capability(input_dev, EV_MSC, MSC_SCAN); input_dev->keycode = mpr121->keycodes; input_dev->keycodesize = sizeof(mpr121->keycodes[0]); -- cgit v1.2.3 From 08fea55e37f58371bffc5336a59e55d1f155955a Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Sun, 15 Jan 2017 14:44:30 -0800 Subject: Input: mpr121 - handle multiple bits change of status register This driver reports input events on their interrupts which are triggered by the sensor's status register changes. But only single bit change is reported in the interrupt handler. So if there are multiple bits are changed at almost the same time, other press or release events are ignored. This fixes it by detecting all changed bits in the status register. Signed-off-by: Akinobu Mita Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/mpr121_touchkey.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index 2558c602f099..83dd5616e470 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c @@ -86,7 +86,8 @@ static irqreturn_t mpr_touchkey_interrupt(int irq, void *dev_id) struct mpr121_touchkey *mpr121 = dev_id; struct i2c_client *client = mpr121->client; struct input_dev *input = mpr121->input_dev; - unsigned int key_num, key_val, pressed; + unsigned long bit_changed; + unsigned int key_num; int reg; reg = i2c_smbus_read_byte_data(client, ELE_TOUCH_STATUS_1_ADDR); @@ -104,18 +105,22 @@ static irqreturn_t mpr_touchkey_interrupt(int irq, void *dev_id) reg &= TOUCH_STATUS_MASK; /* use old press bit to figure out which bit changed */ - key_num = ffs(reg ^ mpr121->statusbits) - 1; - pressed = reg & (1 << key_num); + bit_changed = reg ^ mpr121->statusbits; mpr121->statusbits = reg; + for_each_set_bit(key_num, &bit_changed, mpr121->keycount) { + unsigned int key_val, pressed; - key_val = mpr121->keycodes[key_num]; + pressed = reg & BIT(key_num); + key_val = mpr121->keycodes[key_num]; - input_event(input, EV_MSC, MSC_SCAN, key_num); - input_report_key(input, key_val, pressed); - input_sync(input); + input_event(input, EV_MSC, MSC_SCAN, key_num); + input_report_key(input, key_val, pressed); + + dev_dbg(&client->dev, "key %d %d %s\n", key_num, key_val, + pressed ? "pressed" : "released"); - dev_dbg(&client->dev, "key %d %d %s\n", key_num, key_val, - pressed ? "pressed" : "released"); + } + input_sync(input); out: return IRQ_HANDLED; -- cgit v1.2.3 From de901cc31d151c4c855346c29fb61eaf5ffac3ad Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Sun, 15 Jan 2017 14:51:12 -0800 Subject: Input: mpr121 - switch to device tree probe This driver currently only supports legacy platform data probe. This change adds device tree support and gets rid of platform data probe code since no one is actually using mpr121 platform data in the mainline. The device tree property parsing code is based on the work of atmel_captouch driver. Signed-off-by: Akinobu Mita Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/mpr121_touchkey.c | 137 +++++++++++++++++++++---------- 1 file changed, 94 insertions(+), 43 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index 83dd5616e470..989ca66f63af 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c @@ -12,14 +12,16 @@ * */ -#include -#include -#include -#include -#include #include +#include +#include +#include #include -#include +#include +#include +#include +#include +#include /* Register definitions */ #define ELE_TOUCH_STATUS_0_ADDR 0x0 @@ -61,7 +63,7 @@ struct mpr121_touchkey { struct input_dev *input_dev; unsigned int statusbits; unsigned int keycount; - u16 keycodes[MPR121_MAX_KEY_COUNT]; + u32 keycodes[MPR121_MAX_KEY_COUNT]; }; struct mpr121_init_register { @@ -81,6 +83,42 @@ static const struct mpr121_init_register init_reg_table[] = { { AUTO_CONFIG_CTRL_ADDR, 0x0b }, }; +static void mpr121_vdd_supply_disable(void *data) +{ + struct regulator *vdd_supply = data; + + regulator_disable(vdd_supply); +} + +static struct regulator *mpr121_vdd_supply_init(struct device *dev) +{ + struct regulator *vdd_supply; + int err; + + vdd_supply = devm_regulator_get(dev, "vdd"); + if (IS_ERR(vdd_supply)) { + dev_err(dev, "failed to get vdd regulator: %ld\n", + PTR_ERR(vdd_supply)); + return vdd_supply; + } + + err = regulator_enable(vdd_supply); + if (err) { + dev_err(dev, "failed to enable vdd regulator: %d\n", err); + return ERR_PTR(err); + } + + err = devm_add_action(dev, mpr121_vdd_supply_disable, vdd_supply); + if (err) { + regulator_disable(vdd_supply); + dev_err(dev, "failed to add disable regulator action: %d\n", + err); + return ERR_PTR(err); + } + + return vdd_supply; +} + static irqreturn_t mpr_touchkey_interrupt(int irq, void *dev_id) { struct mpr121_touchkey *mpr121 = dev_id; @@ -126,9 +164,8 @@ out: return IRQ_HANDLED; } -static int mpr121_phys_init(const struct mpr121_platform_data *pdata, - struct mpr121_touchkey *mpr121, - struct i2c_client *client) +static int mpr121_phys_init(struct mpr121_touchkey *mpr121, + struct i2c_client *client, int vdd_uv) { const struct mpr121_init_register *reg; unsigned char usl, lsl, tl, eleconf; @@ -158,9 +195,9 @@ static int mpr121_phys_init(const struct mpr121_platform_data *pdata, /* * Capacitance on sensing input varies and needs to be compensated. * The internal MPR121-auto-configuration can do this if it's - * registers are set properly (based on pdata->vdd_uv). + * registers are set properly (based on vdd_uv). */ - vdd = pdata->vdd_uv / 1000; + vdd = vdd_uv / 1000; usl = ((vdd - 700) * 256) / vdd; lsl = (usl * 65) / 100; tl = (usl * 90) / 100; @@ -191,35 +228,26 @@ err_i2c_write: static int mpr_touchkey_probe(struct i2c_client *client, const struct i2c_device_id *id) { - const struct mpr121_platform_data *pdata = - dev_get_platdata(&client->dev); + struct device *dev = &client->dev; + struct regulator *vdd_supply; + int vdd_uv; struct mpr121_touchkey *mpr121; struct input_dev *input_dev; int error; int i; - if (!pdata) { - dev_err(&client->dev, "no platform data defined\n"); - return -EINVAL; - } - - if (!pdata->keymap || !pdata->keymap_size) { - dev_err(&client->dev, "missing keymap data\n"); - return -EINVAL; - } - - if (pdata->keymap_size > MPR121_MAX_KEY_COUNT) { - dev_err(&client->dev, "too many keys defined\n"); - return -EINVAL; - } - if (!client->irq) { dev_err(&client->dev, "irq number should not be zero\n"); return -EINVAL; } - mpr121 = devm_kzalloc(&client->dev, sizeof(*mpr121), - GFP_KERNEL); + vdd_supply = mpr121_vdd_supply_init(dev); + if (IS_ERR(vdd_supply)) + return PTR_ERR(vdd_supply); + + vdd_uv = regulator_get_voltage(vdd_supply); + + mpr121 = devm_kzalloc(&client->dev, sizeof(*mpr121), GFP_KERNEL); if (!mpr121) return -ENOMEM; @@ -229,33 +257,46 @@ static int mpr_touchkey_probe(struct i2c_client *client, mpr121->client = client; mpr121->input_dev = input_dev; - mpr121->keycount = pdata->keymap_size; + mpr121->keycount = device_property_read_u32_array(dev, "linux,keycodes", + NULL, 0); + if (mpr121->keycount > MPR121_MAX_KEY_COUNT) { + dev_err(dev, "too many keys defined (%d)\n", mpr121->keycount); + return -EINVAL; + } + + error = device_property_read_u32_array(dev, "linux,keycodes", + mpr121->keycodes, + mpr121->keycount); + if (error) { + dev_err(dev, + "failed to read linux,keycode property: %d\n", error); + return error; + } input_dev->name = "Freescale MPR121 Touchkey"; input_dev->id.bustype = BUS_I2C; input_dev->dev.parent = &client->dev; - input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); + if (device_property_read_bool(dev, "autorepeat")) + __set_bit(EV_REP, input_dev->evbit); input_set_capability(input_dev, EV_MSC, MSC_SCAN); input_dev->keycode = mpr121->keycodes; input_dev->keycodesize = sizeof(mpr121->keycodes[0]); input_dev->keycodemax = mpr121->keycount; - for (i = 0; i < pdata->keymap_size; i++) { - input_set_capability(input_dev, EV_KEY, pdata->keymap[i]); - mpr121->keycodes[i] = pdata->keymap[i]; - } + for (i = 0; i < mpr121->keycount; i++) + input_set_capability(input_dev, EV_KEY, mpr121->keycodes[i]); - error = mpr121_phys_init(pdata, mpr121, client); + error = mpr121_phys_init(mpr121, client, vdd_uv); if (error) { dev_err(&client->dev, "Failed to init register\n"); return error; } - error = devm_request_threaded_irq(&client->dev, client->irq, NULL, - mpr_touchkey_interrupt, - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - client->dev.driver->name, mpr121); + error = devm_request_threaded_irq(&client->dev, client->irq, + NULL, mpr_touchkey_interrupt, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + client->dev.driver->name, mpr121); if (error) { dev_err(&client->dev, "Failed to register interrupt\n"); return error; @@ -266,7 +307,8 @@ static int mpr_touchkey_probe(struct i2c_client *client, return error; i2c_set_clientdata(client, mpr121); - device_init_wakeup(&client->dev, pdata->wakeup); + device_init_wakeup(dev, + device_property_read_bool(dev, "wakeup-source")); return 0; } @@ -305,10 +347,19 @@ static const struct i2c_device_id mpr121_id[] = { }; MODULE_DEVICE_TABLE(i2c, mpr121_id); +#ifdef CONFIG_OF +static const struct of_device_id mpr121_touchkey_dt_match_table[] = { + { .compatible = "fsl,mpr121-touchkey" }, + { }, +}; +MODULE_DEVICE_TABLE(of, mpr121_touchkey_dt_match_table); +#endif + static struct i2c_driver mpr_touchkey_driver = { .driver = { .name = "mpr121", .pm = &mpr121_touchkey_pm_ops, + .of_match_table = of_match_ptr(mpr121_touchkey_dt_match_table), }, .id_table = mpr121_id, .probe = mpr_touchkey_probe, -- cgit v1.2.3 From cd4c1b412d4dd094c2ec02be4f0ee41bcc386170 Mon Sep 17 00:00:00 2001 From: Nicholas Mc Guire Date: Sun, 15 Jan 2017 15:18:03 -0800 Subject: Input: cyapa - use time based retry loop Using counter based retry loops for peripherals results in the delay being significantly overrun during high-load situations where delay functions tend to be vary imprecise and overrun there timeouts. So condition the termination on the actual condition of 2s for the re-calibration to have been successful. As this is a very long delay there is no advantage in using high-resolution timers thus switching this to msleep(). Signed-off-by: Nicholas Mc Guire Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/cyapa_gen3.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/mouse/cyapa_gen3.c b/drivers/input/mouse/cyapa_gen3.c index f9600753eca5..a47b06f4ed51 100644 --- a/drivers/input/mouse/cyapa_gen3.c +++ b/drivers/input/mouse/cyapa_gen3.c @@ -789,7 +789,7 @@ static ssize_t cyapa_gen3_do_calibrate(struct device *dev, const char *buf, size_t count) { struct cyapa *cyapa = dev_get_drvdata(dev); - int tries; + unsigned long timeout; int ret; ret = cyapa_read_byte(cyapa, CYAPA_CMD_DEV_STATUS); @@ -812,31 +812,28 @@ static ssize_t cyapa_gen3_do_calibrate(struct device *dev, goto out; } - tries = 20; /* max recalibration timeout 2s. */ + /* max recalibration timeout 2s. */ + timeout = jiffies + 2 * HZ; do { /* * For this recalibration, the max time will not exceed 2s. * The average time is approximately 500 - 700 ms, and we * will check the status every 100 - 200ms. */ - usleep_range(100000, 200000); - + msleep(100); ret = cyapa_read_byte(cyapa, CYAPA_CMD_DEV_STATUS); if (ret < 0) { - dev_err(dev, "Error reading dev status: %d\n", - ret); + dev_err(dev, "Error reading dev status: %d\n", ret); goto out; } - if ((ret & CYAPA_DEV_NORMAL) == CYAPA_DEV_NORMAL) - break; - } while (--tries); + if ((ret & CYAPA_DEV_NORMAL) == CYAPA_DEV_NORMAL) { + dev_dbg(dev, "Calibration successful.\n"); + goto out; + } + } while (time_is_after_jiffies(timeout)); - if (tries == 0) { - dev_err(dev, "Failed to calibrate. Timeout.\n"); - ret = -ETIMEDOUT; - goto out; - } - dev_dbg(dev, "Calibration successful.\n"); + dev_err(dev, "Failed to calibrate. Timeout.\n"); + ret = -ETIMEDOUT; out: return ret < 0 ? ret : count; -- cgit v1.2.3 From 13e360ac97e2a6386f9e26e02e20bce4b6e83415 Mon Sep 17 00:00:00 2001 From: Nicholas Mc Guire Date: Sun, 15 Jan 2017 15:19:27 -0800 Subject: Input: cyapa - use msleep() for long delay ulseep_range() uses hrtimers and provides no advantage over msleep() for larger delays. Fix up the 50ms delays here to use msleep() and reduce the load on the hrtimer subsystem. Signed-off-by: Nicholas Mc Guire Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/cyapa_gen3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/mouse/cyapa_gen3.c b/drivers/input/mouse/cyapa_gen3.c index a47b06f4ed51..1cbfa4a6e830 100644 --- a/drivers/input/mouse/cyapa_gen3.c +++ b/drivers/input/mouse/cyapa_gen3.c @@ -562,7 +562,7 @@ static int cyapa_gen3_bl_exit(struct cyapa *cyapa) * Wait for bootloader to exit, and operation mode to start. * Normally, this takes at least 50 ms. */ - usleep_range(50000, 100000); + msleep(50); /* * In addition, when a device boots for the first time after being * updated to new firmware, it must first calibrate its sensors, which -- cgit v1.2.3 From 630a7fa0480bec63e0a300b8485642630340efcf Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Sun, 15 Jan 2017 15:23:05 -0800 Subject: Input: synaptics-rmi4 - correctly swap clip values if axes are swapped The clip values need the same swapping as the maximum values if the sensor axes are swapped. Signed-off-by: Lucas Stach Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_2d_sensor.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/rmi4/rmi_2d_sensor.c b/drivers/input/rmi4/rmi_2d_sensor.c index 07007ff8e29f..8bb866c7b985 100644 --- a/drivers/input/rmi4/rmi_2d_sensor.c +++ b/drivers/input/rmi4/rmi_2d_sensor.c @@ -144,8 +144,13 @@ static void rmi_2d_sensor_set_input_params(struct rmi_2d_sensor *sensor) int input_flags = 0; if (sensor->report_abs) { - if (sensor->axis_align.swap_axes) + if (sensor->axis_align.swap_axes) { swap(sensor->max_x, sensor->max_y); + swap(sensor->axis_align.clip_x_low, + sensor->axis_align.clip_y_low); + swap(sensor->axis_align.clip_x_high, + sensor->axis_align.clip_y_high); + } sensor->min_x = sensor->axis_align.clip_x_low; if (sensor->axis_align.clip_x_high) -- cgit v1.2.3 From 259b77ef853cc375a5c9198cf81f9b79fc19413c Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Tue, 17 Jan 2017 13:24:22 -0800 Subject: Input: tca8418 - use the interrupt trigger from the device tree The TCA8418 might be used using different interrupt triggers on various boards. This is not working so far because the current code forces a falling edge trigger. The device tree already provides a trigger type, so let's use whatever it sets up, and since we can be loaded without DT, keep the old behaviour for the non-DT case. Signed-off-by: Maxime Ripard Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/tca8418_keypad.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c index 3048ef3e3e16..11d5c76d9fb4 100644 --- a/drivers/input/keyboard/tca8418_keypad.c +++ b/drivers/input/keyboard/tca8418_keypad.c @@ -277,6 +277,7 @@ static int tca8418_keypad_probe(struct i2c_client *client, bool irq_is_gpio = false; int irq; int error, row_shift, max_keys; + unsigned long trigger = 0; /* Copy the platform data */ if (pdata) { @@ -289,6 +290,7 @@ static int tca8418_keypad_probe(struct i2c_client *client, cols = pdata->cols; rep = pdata->rep; irq_is_gpio = pdata->irq_is_gpio; + trigger = IRQF_TRIGGER_FALLING; } else { struct device_node *np = dev->of_node; int err; @@ -363,9 +365,7 @@ static int tca8418_keypad_probe(struct i2c_client *client, irq = gpio_to_irq(irq); error = devm_request_threaded_irq(dev, irq, NULL, tca8418_irq_handler, - IRQF_TRIGGER_FALLING | - IRQF_SHARED | - IRQF_ONESHOT, + trigger | IRQF_SHARED | IRQF_ONESHOT, client->name, keypad_data); if (error) { dev_err(dev, "Unable to claim irq %d; error %d\n", -- cgit v1.2.3 From 2057e15945a8b5d867c086371a5fb946fd8221da Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Wed, 18 Jan 2017 10:37:49 -0800 Subject: Input: cros_ec_keyb - drop unnecessary call to dev_set_drvdata and other changes There is no call to platform_get_drvdata() or dev_get_drvdata(). Drop the unnecessary call to dev_set_drvdata(). Other relevant changes: Use existing variable 'dev' instead of dereferencing it several times This conversion was done automatically with coccinelle using the following semantic patches. The semantic patches and the scripts used to generate this commit log are available at https://github.com/groeck/coccinelle-patches - Drop dev_set_drvdata() - Use local variable 'struct device *dev' consistently Signed-off-by: Guenter Roeck Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/cros_ec_keyb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index 4b0878f35471..165c722408aa 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -242,7 +242,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev) struct device_node *np; int err; - np = pdev->dev.of_node; + np = dev->of_node; if (!np) return -ENODEV; @@ -272,7 +272,6 @@ static int cros_ec_keyb_probe(struct platform_device *pdev) ckdev->ec = ec; ckdev->dev = dev; - dev_set_drvdata(dev, ckdev); idev->name = CROS_EC_DEV_NAME; idev->phys = ec->phys_name; -- cgit v1.2.3 From 009af5fdb4fb65e73c5783bf2de64490fcd84910 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Wed, 18 Jan 2017 11:12:00 -0800 Subject: Input: at32psif - drop unnecessary error messages and other changes Error messages after memory allocation failures are unnecessary and can be dropped, given that they are emitted as dev_dbg() so nobody except person actively debugging the driver would see them. Also replace jump to return 'goto l; ... l: return e;' with 'return e;' Signed-off-by: Guenter Roeck Signed-off-by: Dmitry Torokhov --- drivers/input/serio/at32psif.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/serio/at32psif.c b/drivers/input/serio/at32psif.c index 2e4ff5bac754..e420fd781d44 100644 --- a/drivers/input/serio/at32psif.c +++ b/drivers/input/serio/at32psif.c @@ -159,13 +159,12 @@ static int psif_open(struct serio *io) retval = clk_enable(psif->pclk); if (retval) - goto out; + return retval; psif_writel(psif, CR, PSIF_BIT(CR_TXEN) | PSIF_BIT(CR_RXEN)); psif_writel(psif, IER, PSIF_BIT(RXRDY)); psif->open = true; -out: return retval; } @@ -210,16 +209,12 @@ static int __init psif_probe(struct platform_device *pdev) int ret; psif = kzalloc(sizeof(struct psif), GFP_KERNEL); - if (!psif) { - dev_dbg(&pdev->dev, "out of memory\n"); - ret = -ENOMEM; - goto out; - } + if (!psif) + return -ENOMEM; psif->pdev = pdev; io = kzalloc(sizeof(struct serio), GFP_KERNEL); if (!io) { - dev_dbg(&pdev->dev, "out of memory\n"); ret = -ENOMEM; goto out_free_psif; } @@ -297,7 +292,6 @@ out_free_io: kfree(io); out_free_psif: kfree(psif); -out: return ret; } -- cgit v1.2.3 From 32237677fb6a15f08aadfe2bb4129b2de7e7caab Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Wed, 18 Jan 2017 11:16:12 -0800 Subject: Input: xilinx_ps2 - use 'dev' instead of dereferencing it Use local variable 'dev' instead of dereferencing it several times. Signed-off-by: Guenter Roeck Signed-off-by: Dmitry Torokhov --- drivers/input/serio/xilinx_ps2.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/input') diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c index 5223cbf94262..14c40892ed82 100644 --- a/drivers/input/serio/xilinx_ps2.c +++ b/drivers/input/serio/xilinx_ps2.c @@ -243,18 +243,17 @@ static int xps2_of_probe(struct platform_device *ofdev) unsigned int irq; int error; - dev_info(dev, "Device Tree Probing \'%s\'\n", - ofdev->dev.of_node->name); + dev_info(dev, "Device Tree Probing \'%s\'\n", dev->of_node->name); /* Get iospace for the device */ - error = of_address_to_resource(ofdev->dev.of_node, 0, &r_mem); + error = of_address_to_resource(dev->of_node, 0, &r_mem); if (error) { dev_err(dev, "invalid address\n"); return error; } /* Get IRQ for the device */ - irq = irq_of_parse_and_map(ofdev->dev.of_node, 0); + irq = irq_of_parse_and_map(dev->of_node, 0); if (!irq) { dev_err(dev, "no IRQ found\n"); return -ENODEV; -- cgit v1.2.3 From a8e90be161099a6e4d985a7e4a43f9acc8adfcae Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Wed, 18 Jan 2017 11:20:18 -0800 Subject: Input: ar1021_i2c - drop unnecessary call to i2c_set_clientdata There is no call to i2c_get_clientdata() or dev_get_drvdata(). Drop the unnecessary call to i2c_set_clientdata(). Signed-off-by: Guenter Roeck Signed-off-by: Dmitry Torokhov ---