Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input layer updates from Dmitry Torokhov:

- evdev interface has been adjusted to extend the life of timestamps on
32 bit systems to the year of 2108

- Synaptics RMI4 driver's PS/2 guest handling ha beed updated to
improve chances of detecting trackpoints on the pass-through port

- mms114 touchcsreen controller driver has been updated to support
generic device properties and work with mms152 cntrollers

- Goodix driver now supports generic touchscreen properties

- couple of drivers for AVR32 architecture are gone as the architecture
support has been removed from the kernel

- gpio-tilt driver has been removed as there are no mainline users and
the driver itself is using legacy APIs and relies on platform data

- MODULE_LINECSE/MODULE_VERSION cleanups

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (45 commits)
Input: goodix - use generic touchscreen_properties
Input: mms114 - fix typo in definition
Input: mms114 - use BIT() macro instead of explicit shifting
Input: mms114 - replace mdelay with msleep
Input: mms114 - add support for mms152
Input: mms114 - drop platform data and use generic APIs
Input: mms114 - mark as direct input device
Input: mms114 - do not clobber interrupt trigger
Input: edt-ft5x06 - fix error handling for factory mode on non-M06
Input: stmfts - set IRQ_NOAUTOEN to the irq flag
Input: auo-pixcir-ts - delete an unnecessary return statement
Input: auo-pixcir-ts - remove custom log for a failed memory allocation
Input: da9052_tsi - remove unused mutex
Input: docs - use PROPERTY_ENTRY_U32() directly
Input: synaptics-rmi4 - log when we create a guest serio port
Input: synaptics-rmi4 - unmask F03 interrupts when port is opened
Input: synaptics-rmi4 - do not delete interrupt memory too early
Input: ad7877 - use managed resource allocations
Input: stmfts,s6sy671 - add SPDX identifier
Input: remove atmel-wm97xx touchscreen driver
...

+503 -1758
+21 -14
Documentation/devicetree/bindings/input/touchscreen/mms114.txt
··· 1 - * MELFAS MMS114 touchscreen controller 1 + * MELFAS MMS114/MMS152 touchscreen controller 2 2 3 3 Required properties: 4 - - compatible: must be "melfas,mms114" 4 + - compatible: should be one of: 5 + - "melfas,mms114" 6 + - "melfas,mms152" 5 7 - reg: I2C address of the chip 6 8 - interrupts: interrupt to which the chip is connected 7 - - x-size: horizontal resolution of touchscreen 8 - - y-size: vertical resolution of touchscreen 9 + - touchscreen-size-x: See [1] 10 + - touchscreen-size-y: See [1] 9 11 10 12 Optional properties: 11 - - contact-threshold: 12 - - moving-threshold: 13 - - x-invert: invert X axis 14 - - y-invert: invert Y axis 13 + - touchscreen-fuzz-x: See [1] 14 + - touchscreen-fuzz-y: See [1] 15 + - touchscreen-fuzz-pressure: See [1] 16 + - touchscreen-inverted-x: See [1] 17 + - touchscreen-inverted-y: See [1] 18 + - touchscreen-swapped-x-y: See [1] 19 + 20 + [1]: Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt 15 21 16 22 Example: 17 23 ··· 28 22 compatible = "melfas,mms114"; 29 23 reg = <0x48>; 30 24 interrupts = <39 0>; 31 - x-size = <720>; 32 - y-size = <1280>; 33 - contact-threshold = <10>; 34 - moving-threshold = <10>; 35 - x-invert; 36 - y-invert; 25 + touchscreen-size-x = <720>; 26 + touchscreen-size-y = <1280>; 27 + touchscreen-fuzz-x = <10>; 28 + touchscreen-fuzz-y = <10>; 29 + touchscreen-fuzz-pressure = <10>; 30 + touchscreen-inverted-x; 31 + touchscreen-inverted-y; 37 32 }; 38 33 39 34 /* ... */
+2
Documentation/devicetree/bindings/input/touchscreen/silead_gsl1680.txt
··· 23 23 - touchscreen-inverted-y : See touchscreen.txt 24 24 - touchscreen-swapped-x-y : See touchscreen.txt 25 25 - silead,max-fingers : maximum number of fingers the touchscreen can detect 26 + - silead,home-button : Boolean, set to true on devices which have a 27 + capacitive home-button build into the touchscreen 26 28 - vddio-supply : regulator phandle for controller VDDIO 27 29 - avdd-supply : regulator phandle for controller AVDD 28 30
-5
Documentation/gpio/drivers-on-gpio.txt
··· 28 28 - gpio-beeper: drivers/input/misc/gpio-beeper.c is used to provide a beep from 29 29 an external speaker connected to a GPIO line. 30 30 31 - - gpio-tilt-polled: drivers/input/misc/gpio_tilt_polled.c provides tilt 32 - detection switches using GPIO, which is useful for your homebrewn pinball 33 - machine if for nothing else. It can detect different tilt angles of the 34 - monitored object. 35 - 36 31 - extcon-gpio: drivers/extcon/extcon-gpio.c is used when you need to read an 37 32 external connector status, such as a headset line for an audio driver or an 38 33 HDMI connector. It will provide a better userspace sysfs interface than GPIO.
-103
Documentation/input/devices/gpio-tilt.rst
··· 1 - Driver for tilt-switches connected via GPIOs 2 - ============================================ 3 - 4 - Generic driver to read data from tilt switches connected via gpios. 5 - Orientation can be provided by one or more than one tilt switches, 6 - i.e. each tilt switch providing one axis, and the number of axes 7 - is also not limited. 8 - 9 - 10 - Data structures 11 - --------------- 12 - 13 - The array of struct gpio in the gpios field is used to list the gpios 14 - that represent the current tilt state. 15 - 16 - The array of struct gpio_tilt_axis describes the axes that are reported 17 - to the input system. The values set therein are used for the 18 - input_set_abs_params calls needed to init the axes. 19 - 20 - The array of struct gpio_tilt_state maps gpio states to the corresponding 21 - values to report. The gpio state is represented as a bitfield where the 22 - bit-index corresponds to the index of the gpio in the struct gpio array. 23 - In the same manner the values stored in the axes array correspond to 24 - the elements of the gpio_tilt_axis-array. 25 - 26 - 27 - Example 28 - ------- 29 - 30 - Example configuration for a single TS1003 tilt switch that rotates around 31 - one axis in 4 steps and emits the current tilt via two GPIOs:: 32 - 33 - static int sg060_tilt_enable(struct device *dev) { 34 - /* code to enable the sensors */ 35 - }; 36 - 37 - static void sg060_tilt_disable(struct device *dev) { 38 - /* code to disable the sensors */ 39 - }; 40 - 41 - static struct gpio sg060_tilt_gpios[] = { 42 - { SG060_TILT_GPIO_SENSOR1, GPIOF_IN, "tilt_sensor1" }, 43 - { SG060_TILT_GPIO_SENSOR2, GPIOF_IN, "tilt_sensor2" }, 44 - }; 45 - 46 - static struct gpio_tilt_state sg060_tilt_states[] = { 47 - { 48 - .gpios = (0 << 1) | (0 << 0), 49 - .axes = (int[]) { 50 - 0, 51 - }, 52 - }, { 53 - .gpios = (0 << 1) | (1 << 0), 54 - .axes = (int[]) { 55 - 1, /* 90 degrees */ 56 - }, 57 - }, { 58 - .gpios = (1 << 1) | (1 << 0), 59 - .axes = (int[]) { 60 - 2, /* 180 degrees */ 61 - }, 62 - }, { 63 - .gpios = (1 << 1) | (0 << 0), 64 - .axes = (int[]) { 65 - 3, /* 270 degrees */ 66 - }, 67 - }, 68 - }; 69 - 70 - static struct gpio_tilt_axis sg060_tilt_axes[] = { 71 - { 72 - .axis = ABS_RY, 73 - .min = 0, 74 - .max = 3, 75 - .fuzz = 0, 76 - .flat = 0, 77 - }, 78 - }; 79 - 80 - static struct gpio_tilt_platform_data sg060_tilt_pdata= { 81 - .gpios = sg060_tilt_gpios, 82 - .nr_gpios = ARRAY_SIZE(sg060_tilt_gpios), 83 - 84 - .axes = sg060_tilt_axes, 85 - .nr_axes = ARRAY_SIZE(sg060_tilt_axes), 86 - 87 - .states = sg060_tilt_states, 88 - .nr_states = ARRAY_SIZE(sg060_tilt_states), 89 - 90 - .debounce_interval = 100, 91 - 92 - .poll_interval = 1000, 93 - .enable = sg060_tilt_enable, 94 - .disable = sg060_tilt_disable, 95 - }; 96 - 97 - static struct platform_device sg060_device_tilt = { 98 - .name = "gpio-tilt-polled", 99 - .id = -1, 100 - .dev = { 101 - .platform_data = &sg060_tilt_pdata, 102 - }, 103 - };
+3 -3
Documentation/input/devices/rotary-encoder.rst
··· 108 108 }; 109 109 110 110 static const struct property_entry rotary_encoder_properties[] __initconst = { 111 - PROPERTY_ENTRY_INTEGER("rotary-encoder,steps-per-period", u32, 24), 112 - PROPERTY_ENTRY_INTEGER("linux,axis", u32, ABS_X), 113 - PROPERTY_ENTRY_INTEGER("rotary-encoder,relative_axis", u32, 0), 111 + PROPERTY_ENTRY_U32("rotary-encoder,steps-per-period", 24), 112 + PROPERTY_ENTRY_U32("linux,axis", ABS_X), 113 + PROPERTY_ENTRY_U32("rotary-encoder,relative_axis", 0), 114 114 { }, 115 115 }; 116 116
+3 -3
Documentation/input/ff.rst
··· 31 31 32 32 Before you start, let me WARN you that some devices shake violently during the 33 33 initialisation phase. This happens for example with my "AVB Top Shot Pegasus". 34 - To stop this annoying behaviour, move you joystick to its limits. Anyway, you 34 + To stop this annoying behaviour, move your joystick to its limits. Anyway, you 35 35 should keep a hand on your device, in order to avoid it to break down if 36 36 something goes wrong. 37 37 ··· 121 121 The content of effect may be modified. In particular, its field "id" is set 122 122 to the unique id assigned by the driver. This data is required for performing 123 123 some operations (removing an effect, controlling the playback). 124 - This if field must be set to -1 by the user in order to tell the driver to 124 + The "id" field must be set to -1 by the user in order to tell the driver to 125 125 allocate a new effect. 126 126 127 127 Effects are file descriptor specific. ··· 178 178 stop.code = effect.id; 179 179 stop.value = 0; 180 180 181 - write(fd, (const void*) &play, sizeof(stop)); 181 + write(fd, (const void*) &stop, sizeof(stop)); 182 182 183 183 Setting the gain 184 184 ----------------
+13 -7
drivers/input/evdev.c
··· 135 135 continue; 136 136 } else if (head != i) { 137 137 /* move entry to fill the gap */ 138 - client->buffer[head].time = ev->time; 139 - client->buffer[head].type = ev->type; 140 - client->buffer[head].code = ev->code; 141 - client->buffer[head].value = ev->value; 138 + client->buffer[head] = *ev; 142 139 } 143 140 144 141 num++; ··· 154 157 { 155 158 struct input_event ev; 156 159 ktime_t time; 160 + struct timespec64 ts; 157 161 158 162 time = client->clk_type == EV_CLK_REAL ? 159 163 ktime_get_real() : ··· 162 164 ktime_get() : 163 165 ktime_get_boottime(); 164 166 165 - ev.time = ktime_to_timeval(time); 167 + ts = ktime_to_timespec64(time); 168 + ev.input_event_sec = ts.tv_sec; 169 + ev.input_event_usec = ts.tv_nsec / NSEC_PER_USEC; 166 170 ev.type = EV_SYN; 167 171 ev.code = SYN_DROPPED; 168 172 ev.value = 0; ··· 241 241 */ 242 242 client->tail = (client->head - 2) & (client->bufsize - 1); 243 243 244 - client->buffer[client->tail].time = event->time; 244 + client->buffer[client->tail].input_event_sec = 245 + event->input_event_sec; 246 + client->buffer[client->tail].input_event_usec = 247 + event->input_event_usec; 245 248 client->buffer[client->tail].type = EV_SYN; 246 249 client->buffer[client->tail].code = SYN_DROPPED; 247 250 client->buffer[client->tail].value = 0; ··· 265 262 struct evdev *evdev = client->evdev; 266 263 const struct input_value *v; 267 264 struct input_event event; 265 + struct timespec64 ts; 268 266 bool wakeup = false; 269 267 270 268 if (client->revoked) 271 269 return; 272 270 273 - event.time = ktime_to_timeval(ev_time[client->clk_type]); 271 + ts = ktime_to_timespec64(ev_time[client->clk_type]); 272 + event.input_event_sec = ts.tv_sec; 273 + event.input_event_usec = ts.tv_nsec / NSEC_PER_USEC; 274 274 275 275 /* Interrupts are disabled, just acquire the lock. */ 276 276 spin_lock(&client->buffer_lock);
+4 -4
drivers/input/input-compat.c
··· 24 24 sizeof(struct input_event_compat))) 25 25 return -EFAULT; 26 26 27 - event->time.tv_sec = compat_event.time.tv_sec; 28 - event->time.tv_usec = compat_event.time.tv_usec; 27 + event->input_event_sec = compat_event.sec; 28 + event->input_event_usec = compat_event.usec; 29 29 event->type = compat_event.type; 30 30 event->code = compat_event.code; 31 31 event->value = compat_event.value; ··· 44 44 if (in_compat_syscall() && !COMPAT_USE_64BIT_TIME) { 45 45 struct input_event_compat compat_event; 46 46 47 - compat_event.time.tv_sec = event->time.tv_sec; 48 - compat_event.time.tv_usec = event->time.tv_usec; 47 + compat_event.sec = event->input_event_sec; 48 + compat_event.usec = event->input_event_usec; 49 49 compat_event.type = event->type; 50 50 compat_event.code = event->code; 51 51 compat_event.value = event->value;
+2 -1
drivers/input/input-compat.h
··· 18 18 #ifdef CONFIG_COMPAT 19 19 20 20 struct input_event_compat { 21 - struct compat_timeval time; 21 + compat_ulong_t sec; 22 + compat_ulong_t usec; 22 23 __u16 type; 23 24 __u16 code; 24 25 __s32 value;
-1
drivers/input/input-polldev.c
··· 20 20 MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>"); 21 21 MODULE_DESCRIPTION("Generic implementation of a polled input device"); 22 22 MODULE_LICENSE("GPL v2"); 23 - MODULE_VERSION("0.1"); 24 23 25 24 static void input_polldev_queue_work(struct input_polled_dev *dev) 26 25 {
+2 -5
drivers/input/joystick/xpad.c
··· 84 84 #include <linux/usb/input.h> 85 85 #include <linux/usb/quirks.h> 86 86 87 - #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" 88 - #define DRIVER_DESC "X-Box pad driver" 89 - 90 87 #define XPAD_PKT_LEN 64 91 88 92 89 /* xbox d-pads should map to buttons, as is required for DDR pads ··· 1940 1943 1941 1944 module_usb_driver(xpad_driver); 1942 1945 1943 - MODULE_AUTHOR(DRIVER_AUTHOR); 1944 - MODULE_DESCRIPTION(DRIVER_DESC); 1946 + MODULE_AUTHOR("Marko Friedemann <mfr@bmx-chemnitz.de>"); 1947 + MODULE_DESCRIPTION("X-Box pad driver"); 1945 1948 MODULE_LICENSE("GPL");
-1
drivers/input/keyboard/pmic8xxx-keypad.c
··· 697 697 698 698 MODULE_LICENSE("GPL v2"); 699 699 MODULE_DESCRIPTION("PMIC8XXX keypad driver"); 700 - MODULE_VERSION("1.0"); 701 700 MODULE_ALIAS("platform:pmic8xxx_keypad"); 702 701 MODULE_AUTHOR("Trilok Soni <tsoni@codeaurora.org>");
+1 -15
drivers/input/misc/Kconfig
··· 268 268 To compile this driver as a module, choose M here: the 269 269 module will be called gpio-beeper. 270 270 271 - config INPUT_GPIO_TILT_POLLED 272 - tristate "Polled GPIO tilt switch" 273 - depends on GPIOLIB || COMPILE_TEST 274 - select INPUT_POLLDEV 275 - help 276 - This driver implements support for tilt switches connected 277 - to GPIO pins that are not capable of generating interrupts. 278 - 279 - The list of gpios to use and the mapping of their states 280 - to specific angles is done via platform data. 281 - 282 - To compile this driver as a module, choose M here: the 283 - module will be called gpio_tilt_polled. 284 - 285 271 config INPUT_GPIO_DECODER 286 272 tristate "Polled GPIO Decoder Input driver" 287 273 depends on GPIOLIB || COMPILE_TEST ··· 454 468 tristate "TPS65218 Power button driver" 455 469 depends on (MFD_TPS65217 || MFD_TPS65218) 456 470 help 457 - Say Y here if you want to enable power buttong reporting for 471 + Say Y here if you want to enable power button reporting for 458 472 TPS65217 and TPS65218 Power Management IC devices. 459 473 460 474 To compile this driver as a module, choose M here. The module will
-1
drivers/input/misc/Makefile
··· 36 36 obj-$(CONFIG_INPUT_DRV2667_HAPTICS) += drv2667.o 37 37 obj-$(CONFIG_INPUT_GP2A) += gp2ap002a00f.o 38 38 obj-$(CONFIG_INPUT_GPIO_BEEPER) += gpio-beeper.o 39 - obj-$(CONFIG_INPUT_GPIO_TILT_POLLED) += gpio_tilt_polled.o 40 39 obj-$(CONFIG_INPUT_GPIO_DECODER) += gpio_decoder.o 41 40 obj-$(CONFIG_INPUT_HISI_POWERKEY) += hisi_powerkey.o 42 41 obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
-2
drivers/input/misc/apanel.c
··· 26 26 #include <linux/leds.h> 27 27 28 28 #define APANEL_NAME "Fujitsu Application Panel" 29 - #define APANEL_VERSION "1.3.1" 30 29 #define APANEL "apanel" 31 30 32 31 /* How often we poll keys - msecs */ ··· 344 345 MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>"); 345 346 MODULE_DESCRIPTION(APANEL_NAME " driver"); 346 347 MODULE_LICENSE("GPL"); 347 - MODULE_VERSION(APANEL_VERSION); 348 348 349 349 MODULE_ALIAS("dmi:*:svnFUJITSU:pnLifeBook*:pvr*:rvnFUJITSU:*"); 350 350 MODULE_ALIAS("dmi:*:svnFUJITSU:pnLifebook*:pvr*:rvnFUJITSU:*");
-2
drivers/input/misc/ati_remote2.c
··· 14 14 #include <linux/module.h> 15 15 16 16 #define DRIVER_DESC "ATI/Philips USB RF remote driver" 17 - #define DRIVER_VERSION "0.3" 18 17 19 18 MODULE_DESCRIPTION(DRIVER_DESC); 20 - MODULE_VERSION(DRIVER_VERSION); 21 19 MODULE_AUTHOR("Ville Syrjala <syrjala@sci.fi>"); 22 20 MODULE_LICENSE("GPL"); 23 21
-210
drivers/input/misc/gpio_tilt_polled.c
··· 1 - /* 2 - * Driver for tilt switches connected via GPIO lines 3 - * not capable of generating interrupts 4 - * 5 - * Copyright (C) 2011 Heiko Stuebner <heiko@sntech.de> 6 - * 7 - * based on: drivers/input/keyboard/gpio_keys_polled.c 8 - * 9 - * Copyright (C) 2007-2010 Gabor Juhos <juhosg@openwrt.org> 10 - * Copyright (C) 2010 Nuno Goncalves <nunojpg@gmail.com> 11 - * 12 - * This program is free software; you can redistribute it and/or modify 13 - * it under the terms of the GNU General Public License version 2 as 14 - * published by the Free Software Foundation. 15 - */ 16 - 17 - #include <linux/kernel.h> 18 - #include <linux/module.h> 19 - #include <linux/slab.h> 20 - #include <linux/input.h> 21 - #include <linux/input-polldev.h> 22 - #include <linux/ioport.h> 23 - #include <linux/platform_device.h> 24 - #include <linux/gpio.h> 25 - #include <linux/input/gpio_tilt.h> 26 - 27 - #define DRV_NAME "gpio-tilt-polled" 28 - 29 - struct gpio_tilt_polled_dev { 30 - struct input_polled_dev *poll_dev; 31 - struct device *dev; 32 - const struct gpio_tilt_platform_data *pdata; 33 - 34 - int last_state; 35 - 36 - int threshold; 37 - int count; 38 - }; 39 - 40 - static void gpio_tilt_polled_poll(struct input_polled_dev *dev) 41 - { 42 - struct gpio_tilt_polled_dev *tdev = dev->private; 43 - const struct gpio_tilt_platform_data *pdata = tdev->pdata; 44 - struct input_dev *input = dev->input; 45 - struct gpio_tilt_state *tilt_state = NULL; 46 - int state, i; 47 - 48 - if (tdev->count < tdev->threshold) { 49 - tdev->count++; 50 - } else { 51 - state = 0; 52 - for (i = 0; i < pdata->nr_gpios; i++) 53 - state |= (!!gpio_get_value(pdata->gpios[i].gpio) << i); 54 - 55 - if (state != tdev->last_state) { 56 - for (i = 0; i < pdata->nr_states; i++) 57 - if (pdata->states[i].gpios == state) 58 - tilt_state = &pdata->states[i]; 59 - 60 - if (tilt_state) { 61 - for (i = 0; i < pdata->nr_axes; i++) 62 - input_report_abs(input, 63 - pdata->axes[i].axis, 64 - tilt_state->axes[i]); 65 - 66 - input_sync(input); 67 - } 68 - 69 - tdev->count = 0; 70 - tdev->last_state = state; 71 - } 72 - } 73 - } 74 - 75 - static void gpio_tilt_polled_open(struct input_polled_dev *dev) 76 - { 77 - struct gpio_tilt_polled_dev *tdev = dev->private; 78 - const struct gpio_tilt_platform_data *pdata = tdev->pdata; 79 - 80 - if (pdata->enable) 81 - pdata->enable(tdev->dev); 82 - 83 - /* report initial state of the axes */ 84 - tdev->last_state = -1; 85 - tdev->count = tdev->threshold; 86 - gpio_tilt_polled_poll(tdev->poll_dev); 87 - } 88 - 89 - static void gpio_tilt_polled_close(struct input_polled_dev *dev) 90 - { 91 - struct gpio_tilt_polled_dev *tdev = dev->private; 92 - const struct gpio_tilt_platform_data *pdata = tdev->pdata; 93 - 94 - if (pdata->disable) 95 - pdata->disable(tdev->dev); 96 - } 97 - 98 - static int gpio_tilt_polled_probe(struct platform_device *pdev) 99 - { 100 - const struct gpio_tilt_platform_data *pdata = 101 - dev_get_platdata(&pdev->dev); 102 - struct device *dev = &pdev->dev; 103 - struct gpio_tilt_polled_dev *tdev; 104 - struct input_polled_dev *poll_dev; 105 - struct input_dev *input; 106 - int error, i; 107 - 108 - if (!pdata || !pdata->poll_interval) 109 - return -EINVAL; 110 - 111 - tdev = kzalloc(sizeof(struct gpio_tilt_polled_dev), GFP_KERNEL); 112 - if (!tdev) { 113 - dev_err(dev, "no memory for private data\n"); 114 - return -ENOMEM; 115 - } 116 - 117 - error = gpio_request_array(pdata->gpios, pdata->nr_gpios); 118 - if (error) { 119 - dev_err(dev, 120 - "Could not request tilt GPIOs: %d\n", error); 121 - goto err_free_tdev; 122 - } 123 - 124 - poll_dev = input_allocate_polled_device(); 125 - if (!poll_dev) { 126 - dev_err(dev, "no memory for polled device\n"); 127 - error = -ENOMEM; 128 - goto err_free_gpios; 129 - } 130 - 131 - poll_dev->private = tdev; 132 - poll_dev->poll = gpio_tilt_polled_poll; 133 - poll_dev->poll_interval = pdata->poll_interval; 134 - poll_dev->open = gpio_tilt_polled_open; 135 - poll_dev->close = gpio_tilt_polled_close; 136 - 137 - input = poll_dev->input; 138 - 139 - input->name = pdev->name; 140 - input->phys = DRV_NAME"/input0"; 141 - input->dev.parent = dev; 142 - 143 - input->id.bustype = BUS_HOST; 144 - input->id.vendor = 0x0001; 145 - input->id.product = 0x0001; 146 - input->id.version = 0x0100; 147 - 148 - __set_bit(EV_ABS, input->evbit); 149 - for (i = 0; i < pdata->nr_axes; i++) 150 - input_set_abs_params(input, pdata->axes[i].axis, 151 - pdata->axes[i].min, pdata->axes[i].max, 152 - pdata->axes[i].fuzz, pdata->axes[i].flat); 153 - 154 - tdev->threshold = DIV_ROUND_UP(pdata->debounce_interval, 155 - pdata->poll_interval); 156 - 157 - tdev->poll_dev = poll_dev; 158 - tdev->dev = dev; 159 - tdev->pdata = pdata; 160 - 161 - error = input_register_polled_device(poll_dev); 162 - if (error) { 163 - dev_err(dev, "unable to register polled device, err=%d\n", 164 - error); 165 - goto err_free_polldev; 166 - } 167 - 168 - platform_set_drvdata(pdev, tdev); 169 - 170 - return 0; 171 - 172 - err_free_polldev: 173 - input_free_polled_device(poll_dev); 174 - err_free_gpios: 175 - gpio_free_array(pdata->gpios, pdata->nr_gpios); 176 - err_free_tdev: 177 - kfree(tdev); 178 - 179 - return error; 180 - } 181 - 182 - static int gpio_tilt_polled_remove(struct platform_device *pdev) 183 - { 184 - struct gpio_tilt_polled_dev *tdev = platform_get_drvdata(pdev); 185 - const struct gpio_tilt_platform_data *pdata = tdev->pdata; 186 - 187 - input_unregister_polled_device(tdev->poll_dev); 188 - input_free_polled_device(tdev->poll_dev); 189 - 190 - gpio_free_array(pdata->gpios, pdata->nr_gpios); 191 - 192 - kfree(tdev); 193 - 194 - return 0; 195 - } 196 - 197 - static struct platform_driver gpio_tilt_polled_driver = { 198 - .probe = gpio_tilt_polled_probe, 199 - .remove = gpio_tilt_polled_remove, 200 - .driver = { 201 - .name = DRV_NAME, 202 - }, 203 - }; 204 - 205 - module_platform_driver(gpio_tilt_polled_driver); 206 - 207 - MODULE_LICENSE("GPL v2"); 208 - MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>"); 209 - MODULE_DESCRIPTION("Polled GPIO tilt driver"); 210 - MODULE_ALIAS("platform:" DRV_NAME);
+3 -8
drivers/input/misc/keyspan_remote.c
··· 17 17 #include <linux/module.h> 18 18 #include <linux/usb/input.h> 19 19 20 - #define DRIVER_VERSION "v0.1" 21 - #define DRIVER_AUTHOR "Michael Downey <downey@zymeta.com>" 22 - #define DRIVER_DESC "Driver for the USB Keyspan remote control." 23 - #define DRIVER_LICENSE "GPL" 24 - 25 20 /* Parameters that can be passed to the driver. */ 26 21 static int debug; 27 22 module_param(debug, int, 0444); ··· 585 590 module_usb_driver(keyspan_driver); 586 591 587 592 MODULE_DEVICE_TABLE(usb, keyspan_table); 588 - MODULE_AUTHOR(DRIVER_AUTHOR); 589 - MODULE_DESCRIPTION(DRIVER_DESC); 590 - MODULE_LICENSE(DRIVER_LICENSE); 593 + MODULE_AUTHOR("Michael Downey <downey@zymeta.com>"); 594 + MODULE_DESCRIPTION("Driver for the USB Keyspan remote control."); 595 + MODULE_LICENSE("GPL");
+4 -2
drivers/input/misc/uinput.c
··· 84 84 unsigned int type, unsigned int code, int value) 85 85 { 86 86 struct uinput_device *udev = input_get_drvdata(dev); 87 + struct timespec64 ts; 87 88 88 89 udev->buff[udev->head].type = type; 89 90 udev->buff[udev->head].code = code; 90 91 udev->buff[udev->head].value = value; 91 - do_gettimeofday(&udev->buff[udev->head].time); 92 + ktime_get_ts64(&ts); 93 + udev->buff[udev->head].input_event_sec = ts.tv_sec; 94 + udev->buff[udev->head].input_event_usec = ts.tv_nsec / NSEC_PER_USEC; 92 95 udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE; 93 96 94 97 wake_up_interruptible(&udev->waitq); ··· 1088 1085 MODULE_AUTHOR("Aristeu Sergio Rozanski Filho"); 1089 1086 MODULE_DESCRIPTION("User level driver support for input subsystem"); 1090 1087 MODULE_LICENSE("GPL"); 1091 - MODULE_VERSION("0.3");
+2 -4
drivers/input/misc/yealink.c
··· 56 56 #include "yealink.h" 57 57 58 58 #define DRIVER_VERSION "yld-20051230" 59 - #define DRIVER_AUTHOR "Henk Vergonet" 60 - #define DRIVER_DESC "Yealink phone driver" 61 59 62 60 #define YEALINK_POLLING_FREQUENCY 10 /* in [Hz] */ 63 61 ··· 1004 1006 1005 1007 MODULE_DEVICE_TABLE (usb, usb_table); 1006 1008 1007 - MODULE_AUTHOR(DRIVER_AUTHOR); 1008 - MODULE_DESCRIPTION(DRIVER_DESC); 1009 + MODULE_AUTHOR("Henk Vergonet"); 1010 + MODULE_DESCRIPTION("Yealink phone driver"); 1009 1011 MODULE_LICENSE("GPL");
+1 -1
drivers/input/mouse/cyapa.c
··· 740 740 char *buf) 741 741 { 742 742 struct cyapa *cyapa = dev_get_drvdata(dev); 743 - u8 pwr_cmd = cyapa->suspend_power_mode; 743 + u8 pwr_cmd; 744 744 u16 sleep_time; 745 745 int len; 746 746 int error;
-43
drivers/input/mouse/cyapa_gen3.c
··· 137 137 138 138 139 139 /* for byte read/write command */ 140 - #define CMD_RESET 0 141 - #define CMD_POWER_MODE 1 142 - #define CMD_DEV_STATUS 2 143 - #define CMD_REPORT_MAX_BASELINE 3 144 - #define CMD_REPORT_MIN_BASELINE 4 145 - #define SMBUS_BYTE_CMD(cmd) (((cmd) & 0x3f) << 1) 146 - #define CYAPA_SMBUS_RESET SMBUS_BYTE_CMD(CMD_RESET) 147 - #define CYAPA_SMBUS_POWER_MODE SMBUS_BYTE_CMD(CMD_POWER_MODE) 148 - #define CYAPA_SMBUS_DEV_STATUS SMBUS_BYTE_CMD(CMD_DEV_STATUS) 149 - #define CYAPA_SMBUS_MAX_BASELINE SMBUS_BYTE_CMD(CMD_REPORT_MAX_BASELINE) 150 - #define CYAPA_SMBUS_MIN_BASELINE SMBUS_BYTE_CMD(CMD_REPORT_MIN_BASELINE) 151 - 152 - /* for group registers read/write command */ 153 - #define REG_GROUP_DATA 0 154 - #define REG_GROUP_CMD 2 155 - #define REG_GROUP_QUERY 3 156 - #define SMBUS_GROUP_CMD(grp) (0x80 | (((grp) & 0x07) << 3)) 157 - #define CYAPA_SMBUS_GROUP_DATA SMBUS_GROUP_CMD(REG_GROUP_DATA) 158 - #define CYAPA_SMBUS_GROUP_CMD SMBUS_GROUP_CMD(REG_GROUP_CMD) 159 - #define CYAPA_SMBUS_GROUP_QUERY SMBUS_GROUP_CMD(REG_GROUP_QUERY) 160 - 161 - /* for register block read/write command */ 162 - #define CMD_BL_STATUS 0 163 - #define CMD_BL_HEAD 1 164 - #define CMD_BL_CMD 2 165 - #define CMD_BL_DATA 3 166 - #define CMD_BL_ALL 4 167 - #define CMD_BLK_PRODUCT_ID 5 168 - #define CMD_BLK_HEAD 6 169 - #define SMBUS_BLOCK_CMD(cmd) (0xc0 | (((cmd) & 0x1f) << 1)) 170 - 171 - /* register block read/write command in bootloader mode */ 172 - #define CYAPA_SMBUS_BL_STATUS SMBUS_BLOCK_CMD(CMD_BL_STATUS) 173 - #define CYAPA_SMBUS_BL_HEAD SMBUS_BLOCK_CMD(CMD_BL_HEAD) 174 - #define CYAPA_SMBUS_BL_CMD SMBUS_BLOCK_CMD(CMD_BL_CMD) 175 - #define CYAPA_SMBUS_BL_DATA SMBUS_BLOCK_CMD(CMD_BL_DATA) 176 - #define CYAPA_SMBUS_BL_ALL SMBUS_BLOCK_CMD(CMD_BL_ALL) 177 - 178 - /* register block read/write command in operational mode */ 179 - #define CYAPA_SMBUS_BLK_PRODUCT_ID SMBUS_BLOCK_CMD(CMD_BLK_PRODUCT_ID) 180 - #define CYAPA_SMBUS_BLK_HEAD SMBUS_BLOCK_CMD(CMD_BLK_HEAD) 181 - 182 - /* for byte read/write command */ 183 140 #define CMD_RESET 0 184 141 #define CMD_POWER_MODE 1 185 142 #define CMD_DEV_STATUS 2
-2
drivers/input/mouse/elan_i2c_core.c
··· 42 42 #include "elan_i2c.h" 43 43 44 44 #define DRIVER_NAME "elan_i2c" 45 - #define ELAN_DRIVER_VERSION "1.6.3" 46 45 #define ELAN_VENDOR_ID 0x04f3 47 46 #define ETP_MAX_PRESSURE 255 48 47 #define ETP_FWIDTH_REDUCE 90 ··· 1293 1294 MODULE_AUTHOR("Duson Lin <dusonlin@emc.com.tw>"); 1294 1295 MODULE_DESCRIPTION("Elan I2C/SMBus Touchpad driver"); 1295 1296 MODULE_LICENSE("GPL"); 1296 - MODULE_VERSION(ELAN_DRIVER_VERSION);
+21 -13
drivers/input/mouse/psmouse-base.c
··· 975 975 psmouse->pt_deactivate = NULL; 976 976 } 977 977 978 + static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool), 979 + struct psmouse *psmouse, bool allow_passthrough, 980 + bool set_properties) 981 + { 982 + if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && 983 + !allow_passthrough) { 984 + return false; 985 + } 986 + 987 + if (set_properties) 988 + psmouse_apply_defaults(psmouse); 989 + 990 + return detect(psmouse, set_properties) == 0; 991 + } 992 + 978 993 static bool psmouse_try_protocol(struct psmouse *psmouse, 979 994 enum psmouse_type type, 980 995 unsigned int *max_proto, ··· 1001 986 if (!proto) 1002 987 return false; 1003 988 1004 - if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && 1005 - !proto->try_passthru) { 1006 - return false; 1007 - } 1008 - 1009 - if (set_properties) 1010 - psmouse_apply_defaults(psmouse); 1011 - 1012 - if (proto->detect(psmouse, set_properties) != 0) 989 + if (!psmouse_do_detect(proto->detect, psmouse, proto->try_passthru, 990 + set_properties)) 1013 991 return false; 1014 992 1015 993 if (set_properties && proto->init && init_allowed) { ··· 1035 1027 * Always check for focaltech, this is safe as it uses pnp-id 1036 1028 * matching. 1037 1029 */ 1038 - if (psmouse_try_protocol(psmouse, PSMOUSE_FOCALTECH, 1039 - &max_proto, set_properties, false)) { 1030 + if (psmouse_do_detect(focaltech_detect, 1031 + psmouse, false, set_properties)) { 1040 1032 if (max_proto > PSMOUSE_IMEX && 1041 1033 IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH) && 1042 1034 (!set_properties || focaltech_init(psmouse) == 0)) { ··· 1082 1074 * probing for IntelliMouse. 1083 1075 */ 1084 1076 if (max_proto > PSMOUSE_PS2 && 1085 - psmouse_try_protocol(psmouse, PSMOUSE_SYNAPTICS, &max_proto, 1086 - set_properties, false)) { 1077 + psmouse_do_detect(synaptics_detect, 1078 + psmouse, false, set_properties)) { 1087 1079 synaptics_hardware = true; 1088 1080 1089 1081 if (max_proto > PSMOUSE_IMEX) {
+10
drivers/input/mouse/synaptics.c
··· 1281 1281 INPUT_MT_POINTER | 1282 1282 (cr48_profile_sensor ? 1283 1283 INPUT_MT_TRACK : INPUT_MT_SEMI_MT)); 1284 + 1285 + /* 1286 + * For semi-mt devices we send ABS_X/Y ourselves instead of 1287 + * input_mt_report_pointer_emulation. But 1288 + * input_mt_init_slots() resets the fuzz to 0, leading to a 1289 + * filtered ABS_MT_POSITION_X but an unfiltered ABS_X 1290 + * position. Let's re-initialize ABS_X/Y here. 1291 + */ 1292 + if (!cr48_profile_sensor) 1293 + set_abs_position_params(dev, &priv->info, ABS_X, ABS_Y); 1284 1294 } 1285 1295 1286 1296 if (SYN_CAP_PALMDETECT(info->capabilities))
-1
drivers/input/rmi4/rmi_bus.c
··· 427 427 MODULE_AUTHOR("Andrew Duggan <aduggan@synaptics.com"); 428 428 MODULE_DESCRIPTION("RMI bus"); 429 429 MODULE_LICENSE("GPL"); 430 - MODULE_VERSION(RMI_DRIVER_VERSION);
+7 -7
drivers/input/rmi4/rmi_driver.c
··· 41 41 42 42 rmi_dbg(RMI_DEBUG_CORE, &rmi_dev->dev, "Freeing function list\n"); 43 43 44 + /* Doing it in the reverse order so F01 will be removed last */ 45 + list_for_each_entry_safe_reverse(fn, tmp, 46 + &data->function_list, node) { 47 + list_del(&fn->node); 48 + rmi_unregister_function(fn); 49 + } 50 + 44 51 devm_kfree(&rmi_dev->dev, data->irq_memory); 45 52 data->irq_memory = NULL; 46 53 data->irq_status = NULL; ··· 57 50 58 51 data->f01_container = NULL; 59 52 data->f34_container = NULL; 60 - 61 - /* Doing it in the reverse order so F01 will be removed last */ 62 - list_for_each_entry_safe_reverse(fn, tmp, 63 - &data->function_list, node) { 64 - list_del(&fn->node); 65 - rmi_unregister_function(fn); 66 - } 67 53 } 68 54 69 55 static int reset_one_function(struct rmi_function *fn)
-2
drivers/input/rmi4/rmi_driver.h
··· 16 16 #include <linux/input.h> 17 17 #include "rmi_bus.h" 18 18 19 - #define RMI_DRIVER_VERSION "2.0" 20 - 21 19 #define SYNAPTICS_INPUT_DEVICE_NAME "Synaptics RMI4 Touch Sensor" 22 20 #define SYNAPTICS_VENDOR_ID 0x06cb 23 21
+59 -14
drivers/input/rmi4/rmi_f03.c
··· 32 32 struct rmi_function *fn; 33 33 34 34 struct serio *serio; 35 + bool serio_registered; 35 36 36 37 unsigned int overwrite_buttons; 37 38 ··· 139 138 return 0; 140 139 } 141 140 141 + static int rmi_f03_pt_open(struct serio *serio) 142 + { 143 + struct f03_data *f03 = serio->port_data; 144 + struct rmi_function *fn = f03->fn; 145 + const u8 ob_len = f03->rx_queue_length * RMI_F03_OB_SIZE; 146 + const u16 data_addr = fn->fd.data_base_addr + RMI_F03_OB_OFFSET; 147 + u8 obs[RMI_F03_QUEUE_LENGTH * RMI_F03_OB_SIZE]; 148 + int error; 149 + 150 + /* 151 + * Consume any pending data. Some devices like to spam with 152 + * 0xaa 0x00 announcements which may confuse us as we try to 153 + * probe the device. 154 + */ 155 + error = rmi_read_block(fn->rmi_dev, data_addr, &obs, ob_len); 156 + if (!error) 157 + rmi_dbg(RMI_DEBUG_FN, &fn->dev, 158 + "%s: Consumed %*ph (%d) from PS2 guest\n", 159 + __func__, ob_len, obs, ob_len); 160 + 161 + return fn->rmi_dev->driver->set_irq_bits(fn->rmi_dev, fn->irq_mask); 162 + } 163 + 164 + static void rmi_f03_pt_close(struct serio *serio) 165 + { 166 + struct f03_data *f03 = serio->port_data; 167 + struct rmi_function *fn = f03->fn; 168 + 169 + fn->rmi_dev->driver->clear_irq_bits(fn->rmi_dev, fn->irq_mask); 170 + } 171 + 142 172 static int rmi_f03_register_pt(struct f03_data *f03) 143 173 { 144 174 struct serio *serio; ··· 180 148 181 149 serio->id.type = SERIO_PS_PSTHRU; 182 150 serio->write = rmi_f03_pt_write; 151 + serio->open = rmi_f03_pt_open; 152 + serio->close = rmi_f03_pt_close; 183 153 serio->port_data = f03; 184 154 185 - strlcpy(serio->name, "Synaptics RMI4 PS/2 pass-through", 186 - sizeof(serio->name)); 187 - strlcpy(serio->phys, "synaptics-rmi4-pt/serio1", 188 - sizeof(serio->phys)); 155 + strlcpy(serio->name, "RMI4 PS/2 pass-through", sizeof(serio->name)); 156 + snprintf(serio->phys, sizeof(serio->phys), "%s/serio0", 157 + dev_name(&f03->fn->dev)); 189 158 serio->dev.parent = &f03->fn->dev; 190 159 191 160 f03->serio = serio; 192 161 162 + printk(KERN_INFO "serio: %s port at %s\n", 163 + serio->name, dev_name(&f03->fn->dev)); 193 164 serio_register_port(serio); 194 165 195 166 return 0; ··· 219 184 f03->device_count); 220 185 221 186 dev_set_drvdata(dev, f03); 222 - 223 - error = rmi_f03_register_pt(f03); 224 - if (error) 225 - return error; 226 - 227 187 return 0; 228 188 } 229 189 230 190 static int rmi_f03_config(struct rmi_function *fn) 231 191 { 232 - fn->rmi_dev->driver->set_irq_bits(fn->rmi_dev, fn->irq_mask); 192 + struct f03_data *f03 = dev_get_drvdata(&fn->dev); 193 + int error; 194 + 195 + if (!f03->serio_registered) { 196 + error = rmi_f03_register_pt(f03); 197 + if (error) 198 + return error; 199 + 200 + f03->serio_registered = true; 201 + } else { 202 + /* 203 + * We must be re-configuring the sensor, just enable 204 + * interrupts for this function. 205 + */ 206 + fn->rmi_dev->driver->set_irq_bits(fn->rmi_dev, fn->irq_mask); 207 + } 233 208 234 209 return 0; 235 210 } ··· 249 204 struct rmi_device *rmi_dev = fn->rmi_dev; 250 205 struct rmi_driver_data *drvdata = dev_get_drvdata(&rmi_dev->dev); 251 206 struct f03_data *f03 = dev_get_drvdata(&fn->dev); 252 - u16 data_addr = fn->fd.data_base_addr; 207 + const u16 data_addr = fn->fd.data_base_addr + RMI_F03_OB_OFFSET; 253 208 const u8 ob_len = f03->rx_queue_length * RMI_F03_OB_SIZE; 254 209 u8 obs[RMI_F03_QUEUE_LENGTH * RMI_F03_OB_SIZE]; 255 210 u8 ob_status; ··· 271 226 drvdata->attn_data.size -= ob_len; 272 227 } else { 273 228 /* Grab all of the data registers, and check them for data */ 274 - error = rmi_read_block(fn->rmi_dev, data_addr + RMI_F03_OB_OFFSET, 275 - &obs, ob_len); 229 + error = rmi_read_block(fn->rmi_dev, data_addr, &obs, ob_len); 276 230 if (error) { 277 231 dev_err(&fn->dev, 278 232 "%s: Failed to read F03 output buffers: %d\n", ··· 310 266 { 311 267 struct f03_data *f03 = dev_get_drvdata(&fn->dev); 312 268 313 - serio_unregister_port(f03->serio); 269 + if (f03->serio_registered) 270 + serio_unregister_port(f03->serio); 314 271 } 315 272 316 273 struct rmi_function_handler rmi_f03_handler = {
-1
drivers/input/rmi4/rmi_f34.c
··· 11 11 #include <linux/rmi.h> 12 12 #include <linux/firmware.h> 13 13 #include <asm/unaligned.h> 14 - #include <asm/unaligned.h> 15 14 #include <linux/bitops.h> 16 15 17 16 #include "rmi_driver.h"
-1
drivers/input/rmi4/rmi_i2c.c
··· 391 391 MODULE_AUTHOR("Andrew Duggan <aduggan@synaptics.com>"); 392 392 MODULE_DESCRIPTION("RMI I2C driver"); 393 393 MODULE_LICENSE("GPL"); 394 - MODULE_VERSION(RMI_DRIVER_VERSION);
-1
drivers/input/rmi4/rmi_spi.c
··· 528 528 MODULE_AUTHOR("Andrew Duggan <aduggan@synaptics.com>"); 529 529 MODULE_DESCRIPTION("RMI SPI driver"); 530 530 MODULE_LICENSE("GPL"); 531 - MODULE_VERSION(RMI_DRIVER_VERSION);
-10
drivers/input/serio/Kconfig
··· 96 96 To compile this driver as a module, choose M here: the 97 97 module will be called rpckbd. 98 98 99 - config SERIO_AT32PSIF 100 - tristate "AVR32 PSIF PS/2 keyboard and mouse controller" 101 - depends on AVR32 102 - help 103 - Say Y here if you want to use the PSIF peripheral on AVR32 devices 104 - and connect a PS/2 keyboard and/or mouse to it. 105 - 106 - To compile this driver as a module, choose M here: the module will 107 - be called at32psif. 108 - 109 99 config SERIO_AMBAKMI 110 100 tristate "AMBA KMI keyboard controller" 111 101 depends on ARM_AMBA
-1
drivers/input/serio/Makefile
··· 13 13 obj-$(CONFIG_SERIO_RPCKBD) += rpckbd.o 14 14 obj-$(CONFIG_SERIO_SA1111) += sa1111ps2.o 15 15 obj-$(CONFIG_SERIO_AMBAKMI) += ambakmi.o 16 - obj-$(CONFIG_SERIO_AT32PSIF) += at32psif.o 17 16 obj-$(CONFIG_SERIO_Q40KBD) += q40kbd.o 18 17 obj-$(CONFIG_SERIO_GSCPS2) += gscps2.o 19 18 obj-$(CONFIG_HP_SDC) += hp_sdc.o
-357
drivers/input/serio/at32psif.c
··· 1 - /* 2 - * Copyright (C) 2007 Atmel Corporation 3 - * 4 - * Driver for the AT32AP700X PS/2 controller (PSIF). 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License version 2 as published 8 - * by the Free Software Foundation. 9 - */ 10 - #include <linux/kernel.h> 11 - #include <linux/module.h> 12 - #include <linux/device.h> 13 - #include <linux/init.h> 14 - #include <linux/serio.h> 15 - #include <linux/interrupt.h> 16 - #include <linux/delay.h> 17 - #include <linux/err.h> 18 - #include <linux/io.h> 19 - #include <linux/clk.h> 20 - #include <linux/platform_device.h> 21 - #include <linux/slab.h> 22 - 23 - /* PSIF register offsets */ 24 - #define PSIF_CR 0x00 25 - #define PSIF_RHR 0x04 26 - #define PSIF_THR 0x08 27 - #define PSIF_SR 0x10 28 - #define PSIF_IER 0x14 29 - #define PSIF_IDR 0x18 30 - #define PSIF_IMR 0x1c 31 - #define PSIF_PSR 0x24 32 - 33 - /* Bitfields in control register. */ 34 - #define PSIF_CR_RXDIS_OFFSET 1 35 - #define PSIF_CR_RXDIS_SIZE 1 36 - #define PSIF_CR_RXEN_OFFSET 0 37 - #define PSIF_CR_RXEN_SIZE 1 38 - #define PSIF_CR_SWRST_OFFSET 15 39 - #define PSIF_CR_SWRST_SIZE 1 40 - #define PSIF_CR_TXDIS_OFFSET 9 41 - #define PSIF_CR_TXDIS_SIZE 1 42 - #define PSIF_CR_TXEN_OFFSET 8 43 - #define PSIF_CR_TXEN_SIZE 1 44 - 45 - /* Bitfields in interrupt disable, enable, mask and status register. */ 46 - #define PSIF_NACK_OFFSET 8 47 - #define PSIF_NACK_SIZE 1 48 - #define PSIF_OVRUN_OFFSET 5 49 - #define PSIF_OVRUN_SIZE 1 50 - #define PSIF_PARITY_OFFSET 9 51 - #define PSIF_PARITY_SIZE 1 52 - #define PSIF_RXRDY_OFFSET 4 53 - #define PSIF_RXRDY_SIZE 1 54 - #define PSIF_TXEMPTY_OFFSET 1 55 - #define PSIF_TXEMPTY_SIZE 1 56 - #define PSIF_TXRDY_OFFSET 0 57 - #define PSIF_TXRDY_SIZE 1 58 - 59 - /* Bitfields in prescale register. */ 60 - #define PSIF_PSR_PRSCV_OFFSET 0 61 - #define PSIF_PSR_PRSCV_SIZE 12 62 - 63 - /* Bitfields in receive hold register. */ 64 - #define PSIF_RHR_RXDATA_OFFSET 0 65 - #define PSIF_RHR_RXDATA_SIZE 8 66 - 67 - /* Bitfields in transmit hold register. */ 68 - #define PSIF_THR_TXDATA_OFFSET 0 69 - #define PSIF_THR_TXDATA_SIZE 8 70 - 71 - /* Bit manipulation macros */ 72 - #define PSIF_BIT(name) \ 73 - (1 << PSIF_##name##_OFFSET) 74 - 75 - #define PSIF_BF(name, value) \ 76 - (((value) & ((1 << PSIF_##name##_SIZE) - 1)) \ 77 - << PSIF_##name##_OFFSET) 78 - 79 - #define PSIF_BFEXT(name, value) \ 80 - (((value) >> PSIF_##name##_OFFSET) \ 81 - & ((1 << PSIF_##name##_SIZE) - 1)) 82 - 83 - #define PSIF_BFINS(name, value, old) \ 84 - (((old) & ~(((1 << PSIF_##name##_SIZE) - 1) \ 85 - << PSIF_##name##_OFFSET)) \ 86 - | PSIF_BF(name, value)) 87 - 88 - /* Register access macros */ 89 - #define psif_readl(port, reg) \ 90 - __raw_readl((port)->regs + PSIF_##reg) 91 - 92 - #define psif_writel(port, reg, value) \ 93 - __raw_writel((value), (port)->regs + PSIF_##reg) 94 - 95 - struct psif { 96 - struct platform_device *pdev; 97 - struct clk *pclk; 98 - struct serio *io; 99 - void __iomem *regs; 100 - unsigned int irq; 101 - /* Prevent concurrent writes to PSIF THR. */ 102 - spinlock_t lock; 103 - bool open; 104 - }; 105 - 106 - static irqreturn_t psif_interrupt(int irq, void *_ptr) 107 - { 108 - struct psif *psif = _ptr; 109 - int retval = IRQ_NONE; 110 - unsigned int io_flags = 0; 111 - unsigned long status; 112 - 113 - status = psif_readl(psif, SR); 114 - 115 - if (status & PSIF_BIT(RXRDY)) { 116 - unsigned char val = (unsigned char) psif_readl(psif, RHR); 117 - 118 - if (status & PSIF_BIT(PARITY)) 119 - io_flags |= SERIO_PARITY; 120 - if (status & PSIF_BIT(OVRUN)) 121 - dev_err(&psif->pdev->dev, "overrun read error\n"); 122 - 123 - serio_interrupt(psif->io, val, io_flags); 124 - 125 - retval = IRQ_HANDLED; 126 - } 127 - 128 - return retval; 129 - } 130 - 131 - static int psif_write(struct serio *io, unsigned char val) 132 - { 133 - struct psif *psif = io->port_data; 134 - unsigned long flags; 135 - int timeout = 10; 136 - int retval = 0; 137 - 138 - spin_lock_irqsave(&psif->lock, flags); 139 - 140 - while (!(psif_readl(psif, SR) & PSIF_BIT(TXEMPTY)) && timeout--) 141 - udelay(50); 142 - 143 - if (timeout >= 0) { 144 - psif_writel(psif, THR, val); 145 - } else { 146 - dev_dbg(&psif->pdev->dev, "timeout writing to THR\n"); 147 - retval = -EBUSY; 148 - } 149 - 150 - spin_unlock_irqrestore(&psif->lock, flags); 151 - 152 - return retval; 153 - } 154 - 155 - static int psif_open(struct serio *io) 156 - { 157 - struct psif *psif = io->port_data; 158 - int retval; 159 - 160 - retval = clk_enable(psif->pclk); 161 - if (retval) 162 - return retval; 163 - 164 - psif_writel(psif, CR, PSIF_BIT(CR_TXEN) | PSIF_BIT(CR_RXEN)); 165 - psif_writel(psif, IER, PSIF_BIT(RXRDY)); 166 - 167 - psif->open = true; 168 - return retval; 169 - } 170 - 171 - static void psif_close(struct serio *io) 172 - { 173 - struct psif *psif = io->port_data; 174 - 175 - psif->open = false; 176 - 177 - psif_writel(psif, IDR, ~0UL); 178 - psif_writel(psif, CR, PSIF_BIT(CR_TXDIS) | PSIF_BIT(CR_RXDIS)); 179 - 180 - clk_disable(psif->pclk); 181 - } 182 - 183 - static void psif_set_prescaler(struct psif *psif) 184 - { 185 - unsigned long prscv; 186 - unsigned long rate = clk_get_rate(psif->pclk); 187 - 188 - /* PRSCV = Pulse length (100 us) * PSIF module frequency. */ 189 - prscv = 100 * (rate / 1000000UL); 190 - 191 - if (prscv > ((1<<PSIF_PSR_PRSCV_SIZE) - 1)) { 192 - prscv = (1<<PSIF_PSR_PRSCV_SIZE) - 1; 193 - dev_dbg(&psif->pdev->dev, "pclk too fast, " 194 - "prescaler set to max\n"); 195 - } 196 - 197 - clk_enable(psif->pclk); 198 - psif_writel(psif, PSR, prscv); 199 - clk_disable(psif->pclk); 200 - } 201 - 202 - static int __init psif_probe(struct platform_device *pdev) 203 - { 204 - struct resource *regs; 205 - struct psif *psif; 206 - struct serio *io; 207 - struct clk *pclk; 208 - int irq; 209 - int ret; 210 - 211 - psif = kzalloc(sizeof(struct psif), GFP_KERNEL); 212 - if (!psif) 213 - return -ENOMEM; 214 - psif->pdev = pdev; 215 - 216 - io = kzalloc(sizeof(struct serio), GFP_KERNEL); 217 - if (!io) { 218 - ret = -ENOMEM; 219 - goto out_free_psif; 220 - } 221 - psif->io = io; 222 - 223 - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 224 - if (!regs) { 225 - dev_dbg(&pdev->dev, "no mmio resources defined\n"); 226 - ret = -ENOMEM; 227 - goto out_free_io; 228 - } 229 - 230 - psif->regs = ioremap(regs->start, resource_size(regs)); 231 - if (!psif->regs) { 232 - ret = -ENOMEM; 233 - dev_dbg(&pdev->dev, "could not map I/O memory\n"); 234 - goto out_free_io; 235 - } 236 - 237 - pclk = clk_get(&pdev->dev, "pclk"); 238 - if (IS_ERR(pclk)) { 239 - dev_dbg(&pdev->dev, "could not get peripheral clock\n"); 240 - ret = PTR_ERR(pclk); 241 - goto out_iounmap; 242 - } 243 - psif->pclk = pclk; 244 - 245 - /* Reset the PSIF to enter at a known state. */ 246 - ret = clk_enable(pclk); 247 - if (ret) { 248 - dev_dbg(&pdev->dev, "could not enable pclk\n"); 249 - goto out_put_clk; 250 - } 251 - psif_writel(psif, CR, PSIF_BIT(CR_SWRST)); 252 - clk_disable(pclk); 253 - 254 - irq = platform_get_irq(pdev, 0); 255 - if (irq < 0) { 256 - dev_dbg(&pdev->dev, "could not get irq\n"); 257 - ret = -ENXIO; 258 - goto out_put_clk; 259 - } 260 - ret = request_irq(irq, psif_interrupt, IRQF_SHARED, "at32psif", psif); 261 - if (ret) { 262 - dev_dbg(&pdev->dev, "could not request irq %d\n", irq); 263 - goto out_put_clk; 264 - } 265 - psif->irq = irq; 266 - 267 - io->id.type = SERIO_8042; 268 - io->write = psif_write; 269 - io->open = psif_open; 270 - io->close = psif_close; 271 - snprintf(io->name, sizeof(io->name), "AVR32 PS/2 port%d", pdev->id); 272 - snprintf(io->phys, sizeof(io->phys), "at32psif/serio%d", pdev->id); 273 - io->port_data = psif; 274 - io->dev.parent = &pdev->dev; 275 - 276 - psif_set_prescaler(psif); 277 - 278 - spin_lock_init(&psif->lock); 279 - serio_register_port(psif->io); 280 - platform_set_drvdata(pdev, psif); 281 - 282 - dev_info(&pdev->dev, "Atmel AVR32 PSIF PS/2 driver on 0x%08x irq %d\n", 283 - (int)psif->regs, psif->irq); 284 - 285 - return 0; 286 - 287 - out_put_clk: 288 - clk_put(psif->pclk); 289 - out_iounmap: 290 - iounmap(psif->regs); 291 - out_free_io: 292 - kfree(io); 293 - out_free_psif: 294 - kfree(psif); 295 - return ret; 296 - } 297 - 298 - static int __exit psif_remove(struct platform_device *pdev) 299 - { 300 - struct psif *psif = platform_get_drvdata(pdev); 301 - 302 - psif_writel(psif, IDR, ~0UL); 303 - psif_writel(psif, CR, PSIF_BIT(CR_TXDIS) | PSIF_BIT(CR_RXDIS)); 304 - 305 - serio_unregister_port(psif->io); 306 - iounmap(psif->regs); 307 - free_irq(psif->irq, psif); 308 - clk_put(psif->pclk); 309 - kfree(psif); 310 - 311 - return 0; 312 - } 313 - 314 - #ifdef CONFIG_PM_SLEEP 315 - static int psif_suspend(struct device *dev) 316 - { 317 - struct platform_device *pdev = to_platform_device(dev); 318 - struct psif *psif = platform_get_drvdata(pdev); 319 - 320 - if (psif->open) { 321 - psif_writel(psif, CR, PSIF_BIT(CR_RXDIS) | PSIF_BIT(CR_TXDIS)); 322 - clk_disable(psif->pclk); 323 - } 324 - 325 - return 0; 326 - } 327 - 328 - static int psif_resume(struct device *dev) 329 - { 330 - struct platform_device *pdev = to_platform_device(dev); 331 - struct psif *psif = platform_get_drvdata(pdev); 332 - 333 - if (psif->open) { 334 - clk_enable(psif->pclk); 335 - psif_set_prescaler(psif); 336 - psif_writel(psif, CR, PSIF_BIT(CR_RXEN) | PSIF_BIT(CR_TXEN)); 337 - } 338 - 339 - return 0; 340 - } 341 - #endif 342 - 343 - static SIMPLE_DEV_PM_OPS(psif_pm_ops, psif_suspend, psif_resume); 344 - 345 - static struct platform_driver psif_driver = { 346 - .remove = __exit_p(psif_remove), 347 - .driver = { 348 - .name = "atmel_psif", 349 - .pm = &psif_pm_ops, 350 - }, 351 - }; 352 - 353 - module_platform_driver_probe(psif_driver, psif_probe); 354 - 355 - MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); 356 - MODULE_DESCRIPTION("Atmel AVR32 PSIF PS/2 driver"); 357 - MODULE_LICENSE("GPL");
+10 -16
drivers/input/serio/hil_mlc.c
··· 274 274 /* An LCV used to prevent runaway loops, forces 5 second sleep when reset. */ 275 275 static int hilse_init_lcv(hil_mlc *mlc, int unused) 276 276 { 277 - struct timeval tv; 277 + time64_t now = ktime_get_seconds(); 278 278 279 - do_gettimeofday(&tv); 280 - 281 - if (mlc->lcv && (tv.tv_sec - mlc->lcv_tv.tv_sec) < 5) 279 + if (mlc->lcv && (now - mlc->lcv_time) < 5) 282 280 return -1; 283 281 284 - mlc->lcv_tv = tv; 282 + mlc->lcv_time = now; 285 283 mlc->lcv = 0; 286 284 287 285 return 0; ··· 602 604 BUG(); 603 605 } 604 606 mlc->istarted = 1; 605 - mlc->intimeout = node->arg; 606 - do_gettimeofday(&(mlc->instart)); 607 + mlc->intimeout = usecs_to_jiffies(node->arg); 608 + mlc->instart = jiffies; 607 609 mlc->icount = 15; 608 610 memset(mlc->ipacket, 0, 16 * sizeof(hil_packet)); 609 611 BUG_ON(down_trylock(&mlc->isem)); ··· 708 710 break; 709 711 } 710 712 mlc->ostarted = 0; 711 - do_gettimeofday(&(mlc->instart)); 713 + mlc->instart = jiffies; 712 714 write_unlock_irqrestore(&mlc->lock, flags); 713 715 nextidx = HILSEN_NEXT; 714 716 break; ··· 729 731 #endif 730 732 731 733 while (nextidx & HILSEN_SCHED) { 732 - struct timeval tv; 734 + unsigned long now = jiffies; 733 735 734 736 if (!sched_long) 735 737 goto sched; 736 738 737 - do_gettimeofday(&tv); 738 - tv.tv_usec += USEC_PER_SEC * (tv.tv_sec - mlc->instart.tv_sec); 739 - tv.tv_usec -= mlc->instart.tv_usec; 740 - if (tv.tv_usec >= mlc->intimeout) goto sched; 741 - tv.tv_usec = (mlc->intimeout - tv.tv_usec) * HZ / USEC_PER_SEC; 742 - if (!tv.tv_usec) goto sched; 743 - mod_timer(&hil_mlcs_kicker, jiffies + tv.tv_usec); 739 + if (time_after(now, mlc->instart + mlc->intimeout)) 740 + goto sched; 741 + mod_timer(&hil_mlcs_kicker, mlc->instart + mlc->intimeout); 744 742 break; 745 743 sched: 746 744 tasklet_schedule(&hil_mlcs_tasklet);
+7 -10
drivers/input/serio/hp_sdc.c
··· 193 193 curr->seq[curr->idx++] = status; 194 194 curr->seq[curr->idx++] = data; 195 195 hp_sdc.rqty -= 2; 196 - do_gettimeofday(&hp_sdc.rtv); 196 + hp_sdc.rtime = ktime_get(); 197 197 198 198 if (hp_sdc.rqty <= 0) { 199 199 /* All data has been gathered. */ ··· 306 306 write_lock_irq(&hp_sdc.rtq_lock); 307 307 308 308 if (hp_sdc.rcurr >= 0) { 309 - struct timeval tv; 309 + ktime_t now = ktime_get(); 310 310 311 - do_gettimeofday(&tv); 312 - if (tv.tv_sec > hp_sdc.rtv.tv_sec) 313 - tv.tv_usec += USEC_PER_SEC; 314 - 315 - if (tv.tv_usec - hp_sdc.rtv.tv_usec > HP_SDC_MAX_REG_DELAY) { 311 + if (ktime_after(now, ktime_add_us(hp_sdc.rtime, 312 + HP_SDC_MAX_REG_DELAY))) { 316 313 hp_sdc_transaction *curr; 317 314 uint8_t tmp; 318 315 ··· 318 321 * we'll need to figure out a way to communicate 319 322 * it back to the application. and be less verbose. 320 323 */ 321 - printk(KERN_WARNING PREFIX "read timeout (%ius)!\n", 322 - (int)(tv.tv_usec - hp_sdc.rtv.tv_usec)); 324 + printk(KERN_WARNING PREFIX "read timeout (%lldus)!\n", 325 + ktime_us_delta(now, hp_sdc.rtime)); 323 326 curr->idx += hp_sdc.rqty; 324 327 hp_sdc.rqty = 0; 325 328 tmp = curr->seq[curr->actidx]; ··· 548 551 549 552 /* Start a new read */ 550 553 hp_sdc.rqty = curr->seq[curr->idx]; 551 - do_gettimeofday(&hp_sdc.rtv); 554 + hp_sdc.rtime = ktime_get(); 552 555 curr->idx++; 553 556 /* Still need to lock here in case of spurious irq. */ 554 557 write_lock_irq(&hp_sdc.rtq_lock);
+1 -4
drivers/input/serio/hp_sdc_mlc.c
··· 149 149 150 150 /* Try to down the semaphore */ 151 151 if (down_trylock(&mlc->isem)) { 152 - struct timeval tv; 153 152 if (priv->emtestmode) { 154 153 mlc->ipacket[0] = 155 154 HIL_ERR_INT | (mlc->opacket & ··· 159 160 /* printk(KERN_DEBUG PREFIX ">[%x]\n", mlc->ipacket[0]); */ 160 161 goto wasup; 161 162 } 162 - do_gettimeofday(&tv); 163 - tv.tv_usec += USEC_PER_SEC * (tv.tv_sec - mlc->instart.tv_sec); 164 - if (tv.tv_usec - mlc->instart.tv_usec > mlc->intimeout) { 163 + if (time_after(jiffies, mlc->instart + mlc->intimeout)) { 165 164 /* printk("!%i %i", 166 165 tv.tv_usec - mlc->instart.tv_usec, 167 166 mlc->intimeout);
-1
drivers/input/sparse-keymap.c
··· 21 21 MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>"); 22 22 MODULE_DESCRIPTION("Generic support for sparse keymaps"); 23 23 MODULE_LICENSE("GPL v2"); 24 - MODULE_VERSION("0.1"); 25 24 26 25 static unsigned int sparse_keymap_get_key_index(struct input_dev *dev, 27 26 const struct key_entry *k)
+3 -11
drivers/input/tablet/acecad.c
··· 30 30 #include <linux/module.h> 31 31 #include <linux/usb/input.h> 32 32 33 - /* 34 - * Version Information 35 - */ 36 - #define DRIVER_VERSION "v3.2" 37 - #define DRIVER_DESC "USB Acecad Flair tablet driver" 38 - #define DRIVER_LICENSE "GPL" 39 - #define DRIVER_AUTHOR "Edouard TISSERANT <edouard.tisserant@wanadoo.fr>" 40 - 41 - MODULE_AUTHOR(DRIVER_AUTHOR); 42 - MODULE_DESCRIPTION(DRIVER_DESC); 43 - MODULE_LICENSE(DRIVER_LICENSE); 33 + MODULE_AUTHOR("Edouard TISSERANT <edouard.tisserant@wanadoo.fr>"); 34 + MODULE_DESCRIPTION("USB Acecad Flair tablet driver"); 35 + MODULE_LICENSE("GPL"); 44 36 45 37 #define USB_VENDOR_ID_ACECAD 0x0460 46 38 #define USB_DEVICE_ID_FLAIR 0x0004
+2 -9
drivers/input/tablet/aiptek.c
··· 79 79 #include <asm/unaligned.h> 80 80 81 81 /* 82 - * Version Information 83 - */ 84 - #define DRIVER_VERSION "v2.3 (May 2, 2007)" 85 - #define DRIVER_AUTHOR "Bryan W. Headley/Chris Atenasio/Cedric Brun/Rene van Paassen" 86 - #define DRIVER_DESC "Aiptek HyperPen USB Tablet Driver (Linux 2.6.x)" 87 - 88 - /* 89 82 * Aiptek status packet: 90 83 * 91 84 * (returned as Report 1 - relative coordinates from mouse and stylus) ··· 1934 1941 1935 1942 module_usb_driver(aiptek_driver); 1936 1943 1937 - MODULE_AUTHOR(DRIVER_AUTHOR); 1938 - MODULE_DESCRIPTION(DRIVER_DESC); 1944 + MODULE_AUTHOR("Bryan W. Headley/Chris Atenasio/Cedric Brun/Rene van Paassen"); 1945 + MODULE_DESCRIPTION("Aiptek HyperPen USB Tablet Driver"); 1939 1946 MODULE_LICENSE("GPL"); 1940 1947 1941 1948 module_param(programmableDelay, int, 0);
+3 -7
drivers/input/tablet/hanwang.c
··· 28 28 #include <linux/module.h> 29 29 #include <linux/usb/input.h> 30 30 31 - #define DRIVER_AUTHOR "Xing Wei <weixing@hanwang.com.cn>" 32 - #define DRIVER_DESC "USB Hanwang tablet driver" 33 - #define DRIVER_LICENSE "GPL" 34 - 35 - MODULE_AUTHOR(DRIVER_AUTHOR); 36 - MODULE_DESCRIPTION(DRIVER_DESC); 37 - MODULE_LICENSE(DRIVER_LICENSE); 31 + MODULE_AUTHOR("Xing Wei <weixing@hanwang.com.cn>"); 32 + MODULE_DESCRIPTION("USB Hanwang tablet driver"); 33 + MODULE_LICENSE("GPL"); 38 34 39 35 #define USB_VENDOR_ID_HANWANG 0x0b57 40 36 #define HANWANG_TABLET_INT_CLASS 0x0003
+4 -13
drivers/input/tablet/kbtab.c
··· 5 5 #include <asm/unaligned.h> 6 6 7 7 /* 8 - * Version Information 9 - * v0.0.1 - Original, extremely basic version, 2.4.xx only 10 - * v0.0.2 - Updated, works with 2.5.62 and 2.4.20; 11 - * - added pressure-threshold modules param code from 12 - * Alex Perry <alex.perry@ieee.org> 8 + * Pressure-threshold modules param code from Alex Perry <alex.perry@ieee.org> 13 9 */ 14 10 15 - #define DRIVER_VERSION "v0.0.2" 16 - #define DRIVER_AUTHOR "Josh Myer <josh@joshisanerd.com>" 17 - #define DRIVER_DESC "USB KB Gear JamStudio Tablet driver" 18 - #define DRIVER_LICENSE "GPL" 19 - 20 - MODULE_AUTHOR(DRIVER_AUTHOR); 21 - MODULE_DESCRIPTION(DRIVER_DESC); 22 - MODULE_LICENSE(DRIVER_LICENSE); 11 + MODULE_AUTHOR("Josh Myer <josh@joshisanerd.com>"); 12 + MODULE_DESCRIPTION("USB KB Gear JamStudio Tablet driver"); 13 + MODULE_LICENSE("GPL"); 23 14 24 15 #define USB_VENDOR_ID_KBGEAR 0x084e 25 16
-15
drivers/input/touchscreen/Kconfig
··· 795 795 Say Y here to enable support for the Wolfson Microelectronics 796 796 WM9713 touchscreen controller. 797 797 798 - config TOUCHSCREEN_WM97XX_ATMEL 799 - tristate "WM97xx Atmel accelerated touch" 800 - depends on TOUCHSCREEN_WM97XX && AVR32 801 - help 802 - Say Y here for support for streaming mode with WM97xx touchscreens 803 - on Atmel AT91 or AVR32 systems with an AC97C module. 804 - 805 - Be aware that this will use channel B in the controller for 806 - streaming data, this must not conflict with other AC97C drivers. 807 - 808 - If unsure, say N. 809 - 810 - To compile this driver as a module, choose M here: the module will 811 - be called atmel-wm97xx. 812 - 813 798 config TOUCHSCREEN_WM97XX_MAINSTONE 814 799 tristate "WM97xx Mainstone/Palm accelerated touch" 815 800 depends on TOUCHSCREEN_WM97XX && ARCH_PXA
-1
drivers/input/touchscreen/Makefile
··· 97 97 wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o 98 98 wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o 99 99 wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9713) += wm9713.o 100 - obj-$(CONFIG_TOUCHSCREEN_WM97XX_ATMEL) += atmel-wm97xx.o 101 100 obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o 102 101 obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE) += zylonite-wm97xx.o 103 102 obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o
+23 -44
drivers/input/touchscreen/ad7877.c
··· 417 417 return IRQ_HANDLED; 418 418 } 419 419 420 - static void ad7877_disable(struct ad7877 *ts) 420 + static void ad7877_disable(void *data) 421 421 { 422 + struct ad7877 *ts = data; 423 + 422 424 mutex_lock(&ts->mutex); 423 425 424 426 if (!ts->disabled) { ··· 709 707 return err; 710 708 } 711 709 712 - ts = kzalloc(sizeof(struct ad7877), GFP_KERNEL); 713 - input_dev = input_allocate_device(); 714 - if (!ts || !input_dev) { 715 - err = -ENOMEM; 716 - goto err_free_mem; 717 - } 710 + ts = devm_kzalloc(&spi->dev, sizeof(struct ad7877), GFP_KERNEL); 711 + if (!ts) 712 + return -ENOMEM; 713 + 714 + input_dev = devm_input_allocate_device(&spi->dev); 715 + if (!input_dev) 716 + return -ENOMEM; 717 + 718 + err = devm_add_action_or_reset(&spi->dev, ad7877_disable, ts); 719 + if (err) 720 + return err; 718 721 719 722 spi_set_drvdata(spi, ts); 720 723 ts->spi = spi; ··· 768 761 769 762 verify = ad7877_read(spi, AD7877_REG_SEQ1); 770 763 771 - if (verify != AD7877_MM_SEQUENCE){ 764 + if (verify != AD7877_MM_SEQUENCE) { 772 765 dev_err(&spi->dev, "%s: Failed to probe %s\n", 773 766 dev_name(&spi->dev), input_dev->name); 774 - err = -ENODEV; 775 - goto err_free_mem; 767 + return -ENODEV; 776 768 } 777 769 778 770 if (gpio3) ··· 781 775 782 776 /* Request AD7877 /DAV GPIO interrupt */ 783 777 784 - err = request_threaded_irq(spi->irq, NULL, ad7877_irq, 785 - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 786 - spi->dev.driver->name, ts); 778 + err = devm_request_threaded_irq(&spi->dev, spi->irq, NULL, ad7877_irq, 779 + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 780 + spi->dev.driver->name, ts); 787 781 if (err) { 788 782 dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); 789 - goto err_free_mem; 783 + return err; 790 784 } 791 785 792 - err = sysfs_create_group(&spi->dev.kobj, &ad7877_attr_group); 786 + err = devm_device_add_group(&spi->dev, &ad7877_attr_group); 793 787 if (err) 794 - goto err_free_irq; 788 + return err; 795 789 796 790 err = input_register_device(input_dev); 797 791 if (err) 798 - goto err_remove_attr_group; 799 - 800 - return 0; 801 - 802 - err_remove_attr_group: 803 - sysfs_remove_group(&spi->dev.kobj, &ad7877_attr_group); 804 - err_free_irq: 805 - free_irq(spi->irq, ts); 806 - err_free_mem: 807 - input_free_device(input_dev); 808 - kfree(ts); 809 - return err; 810 - } 811 - 812 - static int ad7877_remove(struct spi_device *spi) 813 - { 814 - struct ad7877 *ts = spi_get_drvdata(spi); 815 - 816 - sysfs_remove_group(&spi->dev.kobj, &ad7877_attr_group); 817 - 818 - ad7877_disable(ts); 819 - free_irq(ts->spi->irq, ts); 820 - 821 - input_unregister_device(ts->input); 822 - kfree(ts); 823 - 824 - dev_dbg(&spi->dev, "unregistered touchscreen\n"); 792 + return err; 825 793 826 794 return 0; 827 795 } ··· 826 846 .pm = &ad7877_pm, 827 847 }, 828 848 .probe = ad7877_probe, 829 - .remove = ad7877_remove, 830 849 }; 831 850 832 851 module_spi_driver(ad7877_driver);
-436
drivers/input/touchscreen/atmel-wm97xx.c
··· 1 - /* 2 - * Atmel AT91 and AVR32 continuous touch screen driver for Wolfson WM97xx AC97 3 - * codecs. 4 - * 5 - * Copyright (C) 2008 - 2009 Atmel Corporation 6 - * 7 - * This program is free software; you can redistribute it and/or modify it 8 - * under the terms of the GNU General Public License version 2 as published by 9 - * the Free Software Foundation. 10 - */ 11 - #include <linux/module.h> 12 - #include <linux/moduleparam.h> 13 - #include <linux/kernel.h> 14 - #include <linux/init.h> 15 - #include <linux/delay.h> 16 - #include <linux/irq.h> 17 - #include <linux/interrupt.h> 18 - #include <linux/wm97xx.h> 19 - #include <linux/timer.h> 20 - #include <linux/gpio.h> 21 - #include <linux/io.h> 22 - #include <linux/slab.h> 23 - 24 - #define AC97C_ICA 0x10 25 - #define AC97C_CBRHR 0x30 26 - #define AC97C_CBSR 0x38 27 - #define AC97C_CBMR 0x3c 28 - #define AC97C_IER 0x54 29 - #define AC97C_IDR 0x58 30 - 31 - #define AC97C_RXRDY (1 << 4) 32 - #define AC97C_OVRUN (1 << 5) 33 - 34 - #define AC97C_CMR_SIZE_20 (0 << 16) 35 - #define AC97C_CMR_SIZE_18 (1 << 16) 36 - #define AC97C_CMR_SIZE_16 (2 << 16) 37 - #define AC97C_CMR_SIZE_10 (3 << 16) 38 - #define AC97C_CMR_CEM_LITTLE (1 << 18) 39 - #define AC97C_CMR_CEM_BIG (0 << 18) 40 - #define AC97C_CMR_CENA (1 << 21) 41 - 42 - #define AC97C_INT_CBEVT (1 << 4) 43 - 44 - #define AC97C_SR_CAEVT (1 << 3) 45 - 46 - #define AC97C_CH_MASK(slot) \ 47 - (0x7 << (3 * (slot - 3))) 48 - #define AC97C_CH_ASSIGN(slot, channel) \ 49 - (AC97C_CHANNEL_##channel << (3 * (slot - 3))) 50 - #define AC97C_CHANNEL_NONE 0x0 51 - #define AC97C_CHANNEL_B 0x2 52 - 53 - #define ac97c_writel(chip, reg, val) \ 54 - __raw_writel((val), (chip)->regs + AC97C_##reg) 55 - #define ac97c_readl(chip, reg) \ 56 - __raw_readl((chip)->regs + AC97C_##reg) 57 - 58 - #ifdef CONFIG_CPU_AT32AP700X 59 - #define ATMEL_WM97XX_AC97C_IOMEM (0xfff02800) 60 - #define ATMEL_WM97XX_AC97C_IRQ (29) 61 - #define ATMEL_WM97XX_GPIO_DEFAULT (32+16) /* Pin 16 on port B. */ 62 - #else 63 - #error Unknown CPU, this driver only supports AT32AP700X CPUs. 64 - #endif 65 - 66 - struct continuous { 67 - u16 id; /* codec id */ 68 - u8 code; /* continuous code */ 69 - u8 reads; /* number of coord reads per read cycle */ 70 - u32 speed; /* number of coords per second */ 71 - }; 72 - 73 - #define WM_READS(sp) ((sp / HZ) + 1) 74 - 75 - static const struct continuous cinfo[] = { 76 - {WM9705_ID2, 0, WM_READS(94), 94}, 77 - {WM9705_ID2, 1, WM_READS(188), 188}, 78 - {WM9705_ID2, 2, WM_READS(375), 375}, 79 - {WM9705_ID2, 3, WM_READS(750), 750}, 80 - {WM9712_ID2, 0, WM_READS(94), 94}, 81 - {WM9712_ID2, 1, WM_READS(188), 188}, 82 - {WM9712_ID2, 2, WM_READS(375), 375}, 83 - {WM9712_ID2, 3, WM_READS(750), 750}, 84 - {WM9713_ID2, 0, WM_READS(94), 94}, 85 - {WM9713_ID2, 1, WM_READS(120), 120}, 86 - {WM9713_ID2, 2, WM_READS(154), 154}, 87 - {WM9713_ID2, 3, WM_READS(188), 188}, 88 - }; 89 - 90 - /* Continuous speed index. */ 91 - static int sp_idx; 92 - 93 - /* 94 - * Pen sampling frequency (Hz) in continuous mode. 95 - */ 96 - static int cont_rate = 188; 97 - module_param(cont_rate, int, 0); 98 - MODULE_PARM_DESC(cont_rate, "Sampling rate in continuous mode (Hz)"); 99 - 100 - /* 101 - * Pen down detection. 102 - * 103 - * This driver can either poll or use an interrupt to indicate a pen down 104 - * event. If the irq request fails then it will fall back to polling mode. 105 - */ 106 - static int pen_int = 1; 107 - module_param(pen_int, int, 0); 108 - MODULE_PARM_DESC(pen_int, "Pen down detection (1 = interrupt, 0 = polling)"); 109 - 110 - /* 111 - * Pressure readback. 112 - * 113 - * Set to 1 to read back pen down pressure. 114 - */ 115 - static int pressure; 116 - module_param(pressure, int, 0); 117 - MODULE_PARM_DESC(pressure, "Pressure readback (1 = pressure, 0 = no pressure)"); 118 - 119 - /* 120 - * AC97 touch data slot. 121 - * 122 - * Touch screen readback data ac97 slot. 123 - */ 124 - static int ac97_touch_slot = 5; 125 - module_param(ac97_touch_slot, int, 0); 126 - MODULE_PARM_DESC(ac97_touch_slot, "Touch screen data slot AC97 number"); 127 - 128 - /* 129 - * GPIO line number. 130 - * 131 - * Set to GPIO number where the signal from the WM97xx device is hooked up. 132 - */ 133 - static int atmel_gpio_line = ATMEL_WM97XX_GPIO_DEFAULT; 134 - module_param(atmel_gpio_line, int, 0); 135 - MODULE_PARM_DESC(atmel_gpio_line, "GPIO line number connected to WM97xx"); 136 - 137 - struct atmel_wm97xx { 138 - struct wm97xx *wm; 139 - struct timer_list pen_timer; 140 - void __iomem *regs; 141 - unsigned long ac97c_irq; 142 - unsigned long gpio_pen; 143 - unsigned long gpio_irq; 144 - unsigned short x; 145 - unsigned short y; 146 - }; 147 - 148 - static irqreturn_t atmel_wm97xx_channel_b_interrupt(int irq, void *dev_id) 149 - { 150 - struct atmel_wm97xx *atmel_wm97xx = dev_id; 151 - struct wm97xx *wm = atmel_wm97xx->wm; 152 - int status = ac97c_readl(atmel_wm97xx, CBSR); 153 - irqreturn_t retval = IRQ_NONE; 154 - 155 - if (status & AC97C_OVRUN) { 156 - dev_dbg(&wm->touch_dev->dev, "AC97C overrun\n"); 157 - ac97c_readl(atmel_wm97xx, CBRHR); 158 - retval = IRQ_HANDLED; 159 - } else if (status & AC97C_RXRDY) { 160 - u16 data; 161 - u16 value; 162 - u16 source; 163 - u16 pen_down; 164 - 165 - data = ac97c_readl(atmel_wm97xx, CBRHR); 166 - value = data & 0x0fff; 167 - source = data & WM97XX_ADCSEL_MASK; 168 - pen_down = (data & WM97XX_PEN_DOWN) >> 8; 169 - 170 - if (source == WM97XX_ADCSEL_X) 171 - atmel_wm97xx->x = value; 172 - if (source == WM97XX_ADCSEL_Y) 173 - atmel_wm97xx->y = value; 174 - 175 - if (!pressure && source == WM97XX_ADCSEL_Y) { 176 - input_report_abs(wm->input_dev, ABS_X, atmel_wm97xx->x); 177 - input_report_abs(wm->input_dev, ABS_Y, atmel_wm97xx->y); 178 - input_report_key(wm->input_dev, BTN_TOUCH, pen_down); 179 - input_sync(wm->input_dev); 180 - } else if (pressure && source == WM97XX_ADCSEL_PRES) { 181 - input_report_abs(wm->input_dev, ABS_X, atmel_wm97xx->x); 182 - input_report_abs(wm->input_dev, ABS_Y, atmel_wm97xx->y); 183 - input_report_abs(wm->input_dev, ABS_PRESSURE, value); 184 - input_report_key(wm->input_dev, BTN_TOUCH, value); 185 - input_sync(wm->input_dev); 186 - } 187 - 188 - retval = IRQ_HANDLED; 189 - } 190 - 191 - return retval; 192 - } 193 - 194 - static void atmel_wm97xx_acc_pen_up(struct wm97xx *wm) 195 - { 196 - struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(wm->touch_dev); 197 - struct input_dev *input_dev = wm->input_dev; 198 - int pen_down = gpio_get_value(atmel_wm97xx->gpio_pen); 199 - 200 - if (pen_down != 0) { 201 - mod_timer(&atmel_wm97xx->pen_timer, 202 - jiffies + msecs_to_jiffies(1)); 203 - } else { 204 - if (pressure) 205 - input_report_abs(input_dev, ABS_PRESSURE, 0); 206 - input_report_key(input_dev, BTN_TOUCH, 0); 207 - input_sync(input_dev); 208 - } 209 - } 210 - 211 - static void atmel_wm97xx_pen_timer(struct timer_list *t) 212 - { 213 - struct atmel_wm97xx *atmel_wm97xx = from_timer(atmel_wm97xx, t, 214 - pen_timer); 215 - 216 - atmel_wm97xx_acc_pen_up(atmel_wm97xx->wm); 217 - } 218 - 219 - static int atmel_wm97xx_acc_startup(struct wm97xx *wm) 220 - { 221 - struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(wm->touch_dev); 222 - int idx = 0; 223 - 224 - if (wm->ac97 == NULL) 225 - return -ENODEV; 226 - 227 - for (idx = 0; idx < ARRAY_SIZE(cinfo); idx++) { 228 - if (wm->id != cinfo[idx].id) 229 - continue; 230 - 231 - sp_idx = idx; 232 - 233 - if (cont_rate <= cinfo[idx].speed) 234 - break; 235 - } 236 - 237 - wm->acc_rate = cinfo[sp_idx].code; 238 - wm->acc_slot = ac97_touch_slot; 239 - dev_info(&wm->touch_dev->dev, "atmel accelerated touchscreen driver, " 240 - "%d samples/sec\n", cinfo[sp_idx].speed); 241 - 242 - if (pen_int) { 243 - unsigned long reg; 244 - 245 - wm->pen_irq = atmel_wm97xx->gpio_irq; 246 - 247 - switch (wm->id) { 248 - case WM9712_ID2: /* Fall through. */ 249 - case WM9713_ID2: 250 - /* 251 - * Use GPIO 13 (PEN_DOWN) to assert GPIO line 3 252 - * (PENDOWN). 253 - */ 254 - wm97xx_config_gpio(wm, WM97XX_GPIO_13, WM97XX_GPIO_IN, 255 - WM97XX_GPIO_POL_HIGH, 256 - WM97XX_GPIO_STICKY, 257 - WM97XX_GPIO_WAKE); 258 - wm97xx_config_gpio(wm, WM97XX_GPIO_3, WM97XX_GPIO_OUT, 259 - WM97XX_GPIO_POL_HIGH, 260 - WM97XX_GPIO_NOTSTICKY, 261 - WM97XX_GPIO_NOWAKE); 262 - case WM9705_ID2: /* Fall through. */ 263 - /* 264 - * Enable touch data slot in AC97 controller channel B. 265 - */ 266 - reg = ac97c_readl(atmel_wm97xx, ICA); 267 - reg &= ~AC97C_CH_MASK(wm->acc_slot); 268 - reg |= AC97C_CH_ASSIGN(wm->acc_slot, B); 269 - ac97c_writel(atmel_wm97xx, ICA, reg); 270 - 271 - /* 272 - * Enable channel and interrupt for RXRDY and OVERRUN. 273 - */ 274 - ac97c_writel(atmel_wm97xx, CBMR, AC97C_CMR_CENA 275 - | AC97C_CMR_CEM_BIG 276 - | AC97C_CMR_SIZE_16 277 - | AC97C_OVRUN 278 - | AC97C_RXRDY); 279 - /* Dummy read to empty RXRHR. */ 280 - ac97c_readl(atmel_wm97xx, CBRHR); 281 - /* 282 - * Enable interrupt for channel B in the AC97 283 - * controller. 284 - */ 285 - ac97c_writel(atmel_wm97xx, IER, AC97C_INT_CBEVT); 286 - break; 287 - default: 288 - dev_err(&wm->touch_dev->dev, "pen down irq not " 289 - "supported on this device\n"); 290 - pen_int = 0; 291 - break; 292 - } 293 - } 294 - 295 - return 0; 296 - } 297 - 298 - static void atmel_wm97xx_acc_shutdown(struct wm97xx *wm) 299 - { 300 - if (pen_int) { 301 - struct atmel_wm97xx *atmel_wm97xx = 302 - platform_get_drvdata(wm->touch_dev); 303 - unsigned long ica; 304 - 305 - switch (wm->id & 0xffff) { 306 - case WM9705_ID2: /* Fall through. */ 307 - case WM9712_ID2: /* Fall through. */ 308 - case WM9713_ID2: 309 - /* Disable slot and turn off channel B interrupts. */ 310 - ica = ac97c_readl(atmel_wm97xx, ICA); 311 - ica &= ~AC97C_CH_MASK(wm->acc_slot); 312 - ac97c_writel(atmel_wm97xx, ICA, ica); 313 - ac97c_writel(atmel_wm97xx, IDR, AC97C_INT_CBEVT); 314 - ac97c_writel(atmel_wm97xx, CBMR, 0); 315 - wm->pen_irq = 0; 316 - break; 317 - default: 318 - dev_err(&wm->touch_dev->dev, "unknown codec\n"); 319 - break; 320 - } 321 - } 322 - } 323 - 324 - static void atmel_wm97xx_irq_enable(struct wm97xx *wm, int enable) 325 - { 326 - /* Intentionally left empty. */ 327 - } 328 - 329 - static struct wm97xx_mach_ops atmel_mach_ops = { 330 - .acc_enabled = 1, 331 - .acc_pen_up = atmel_wm97xx_acc_pen_up, 332 - .acc_startup = atmel_wm97xx_acc_startup, 333 - .acc_shutdown = atmel_wm97xx_acc_shutdown, 334 - .irq_enable = atmel_wm97xx_irq_enable, 335 - .irq_gpio = WM97XX_GPIO_3, 336 - }; 337 - 338 - static int __init atmel_wm97xx_probe(struct platform_device *pdev) 339 - { 340 - struct wm97xx *wm = platform_get_drvdata(pdev); 341 - struct atmel_wm97xx *atmel_wm97xx; 342 - int ret; 343 - 344 - atmel_wm97xx = kzalloc(sizeof(struct atmel_wm97xx), GFP_KERNEL); 345 - if (!atmel_wm97xx) 346 - return -ENOMEM; 347 - 348 - atmel_wm97xx->wm = wm; 349 - atmel_wm97xx->regs = (void *)ATMEL_WM97XX_AC97C_IOMEM; 350 - atmel_wm97xx->ac97c_irq = ATMEL_WM97XX_AC97C_IRQ; 351 - atmel_wm97xx->gpio_pen = atmel_gpio_line; 352 - atmel_wm97xx->gpio_irq = gpio_to_irq(atmel_wm97xx->gpio_pen); 353 - 354 - timer_setup(&atmel_wm97xx->pen_timer, atmel_wm97xx_pen_timer, 0); 355 - 356 - ret = request_irq(atmel_wm97xx->ac97c_irq, 357 - atmel_wm97xx_channel_b_interrupt, 358 - IRQF_SHARED, "atmel-wm97xx-ch-b", atmel_wm97xx); 359 - if (ret) { 360 - dev_dbg(&pdev->dev, "could not request ac97c irq\n"); 361 - goto err; 362 - } 363 - 364 - platform_set_drvdata(pdev, atmel_wm97xx); 365 - 366 - ret = wm97xx_register_mach_ops(wm, &atmel_mach_ops); 367 - if (ret) 368 - goto err_irq; 369 - 370 - return ret; 371 - 372 - err_irq: 373 - free_irq(atmel_wm97xx->ac97c_irq, atmel_wm97xx); 374 - err: 375 - kfree(atmel_wm97xx); 376 - return ret; 377 - } 378 - 379 - static int __exit atmel_wm97xx_remove(struct platform_device *pdev) 380 - { 381 - struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(pdev); 382 - struct wm97xx *wm = atmel_wm97xx->wm; 383 - 384 - ac97c_writel(atmel_wm97xx, IDR, AC97C_INT_CBEVT); 385 - free_irq(atmel_wm97xx->ac97c_irq, atmel_wm97xx); 386 - del_timer_sync(&atmel_wm97xx->pen_timer); 387 - wm97xx_unregister_mach_ops(wm); 388 - kfree(atmel_wm97xx); 389 - 390 - return 0; 391 - } 392 - 393 - #ifdef CONFIG_PM_SLEEP 394 - static int atmel_wm97xx_suspend(struct device *dev) 395 - { 396 - struct platform_device *pdev = to_platform_device(dev); 397 - struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(pdev); 398 - 399 - ac97c_writel(atmel_wm97xx, IDR, AC97C_INT_CBEVT); 400 - disable_irq(atmel_wm97xx->gpio_irq); 401 - del_timer_sync(&atmel_wm97xx->pen_timer); 402 - 403 - return 0; 404 - } 405 - 406 - static int atmel_wm97xx_resume(struct device *dev) 407 - { 408 - struct platform_device *pdev = to_platform_device(dev); 409 - struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(pdev); 410 - struct wm97xx *wm = atmel_wm97xx->wm; 411 - 412 - if (wm->input_dev->users) { 413 - enable_irq(atmel_wm97xx->gpio_irq); 414 - ac97c_writel(atmel_wm97xx, IER, AC97C_INT_CBEVT); 415 - } 416 - 417 - return 0; 418 - } 419 - #endif 420 - 421 - static SIMPLE_DEV_PM_OPS(atmel_wm97xx_pm_ops, 422 - atmel_wm97xx_suspend, atmel_wm97xx_resume); 423 - 424 - static struct platform_driver atmel_wm97xx_driver = { 425 - .remove = __exit_p(atmel_wm97xx_remove), 426 - .driver = { 427 - .name = "wm97xx-touch", 428 - .pm = &atmel_wm97xx_pm_ops, 429 - }, 430 - }; 431 - 432 - module_platform_driver_probe(atmel_wm97xx_driver, atmel_wm97xx_probe); 433 - 434 - MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); 435 - MODULE_DESCRIPTION("wm97xx continuous touch driver for Atmel AT91 and AVR32"); 436 - MODULE_LICENSE("GPL");
+1 -5
drivers/input/touchscreen/auo-pixcir-ts.c
··· 408 408 struct auo_pixcir_ts *ts = input_get_drvdata(dev); 409 409 410 410 auo_pixcir_stop(ts); 411 - 412 - return; 413 411 } 414 412 415 413 static int __maybe_unused auo_pixcir_suspend(struct device *dev) ··· 485 487 return ERR_PTR(-ENOENT); 486 488 487 489 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); 488 - if (!pdata) { 489 - dev_err(dev, "failed to allocate platform data\n"); 490 + if (!pdata) 490 491 return ERR_PTR(-ENOMEM); 491 - } 492 492 493 493 pdata->gpio_int = of_get_gpio(np, 0); 494 494 if (!gpio_is_valid(pdata->gpio_int)) {
-2
drivers/input/touchscreen/colibri-vf50-ts.c
··· 28 28 #include <linux/types.h> 29 29 30 30 #define DRIVER_NAME "colibri-vf50-ts" 31 - #define DRV_VERSION "1.0" 32 31 33 32 #define VF_ADC_MAX ((1 << 12) - 1) 34 33 ··· 381 382 MODULE_AUTHOR("Sanchayan Maity"); 382 383 MODULE_DESCRIPTION("Colibri VF50 Touchscreen driver"); 383 384 MODULE_LICENSE("GPL"); 384 - MODULE_VERSION(DRV_VERSION);
-1
drivers/input/touchscreen/da9052_tsi.c
··· 26 26 struct da9052 *da9052; 27 27 struct input_dev *dev; 28 28 struct delayed_work ts_pen_work; 29 - struct mutex mutex; 30 29 bool stopped; 31 30 bool adc_on; 32 31 };
+6 -8
drivers/input/touchscreen/edt-ft5x06.c
··· 511 511 int ret; 512 512 int error; 513 513 514 + if (tsdata->version != EDT_M06) { 515 + dev_err(&client->dev, 516 + "No factory mode support for non-M06 devices\n"); 517 + return -EINVAL; 518 + } 519 + 514 520 disable_irq(client->irq); 515 521 516 522 if (!tsdata->raw_buffer) { ··· 530 524 } 531 525 532 526 /* mode register is 0x3c when in the work mode */ 533 - if (tsdata->version != EDT_M06) 534 - goto m09_out; 535 - 536 527 error = edt_ft5x06_register_write(tsdata, WORK_REGISTER_OPMODE, 0x03); 537 528 if (error) { 538 529 dev_err(&client->dev, ··· 562 559 enable_irq(client->irq); 563 560 564 561 return error; 565 - 566 - m09_out: 567 - dev_err(&client->dev, "No factory mode support for M09/M12/GENERIC_FT\n"); 568 - return -EINVAL; 569 - 570 562 } 571 563 572 564 static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata)
-2
drivers/input/touchscreen/elants_i2c.c
··· 45 45 46 46 /* Device, Driver information */ 47 47 #define DEVICE_NAME "elants_i2c" 48 - #define DRV_VERSION "1.0.9" 49 48 50 49 /* Convert from rows or columns into resolution */ 51 50 #define ELAN_TS_RESOLUTION(n, m) (((n) - 1) * (m)) ··· 1405 1406 1406 1407 MODULE_AUTHOR("Scott Liu <scott.liu@emc.com.tw>"); 1407 1408 MODULE_DESCRIPTION("Elan I2c Touchscreen driver"); 1408 - MODULE_VERSION(DRV_VERSION); 1409 1409 MODULE_LICENSE("GPL");
+76 -97
drivers/input/touchscreen/goodix.c
··· 22 22 #include <linux/i2c.h> 23 23 #include <linux/input.h> 24 24 #include <linux/input/mt.h> 25 + #include <linux/input/touchscreen.h> 25 26 #include <linux/module.h> 26 27 #include <linux/delay.h> 27 28 #include <linux/irq.h> ··· 44 43 struct i2c_client *client; 45 44 struct input_dev *input_dev; 46 45 const struct goodix_chip_data *chip; 47 - int abs_x_max; 48 - int abs_y_max; 49 - bool swapped_x_y; 50 - bool inverted_x; 51 - bool inverted_y; 46 + struct touchscreen_properties prop; 52 47 unsigned int max_touch_num; 53 48 unsigned int int_trigger_type; 54 49 struct gpio_desc *gpiod_int; ··· 157 160 u16 reg, u8 *buf, int len) 158 161 { 159 162 struct i2c_msg msgs[2]; 160 - u16 wbuf = cpu_to_be16(reg); 163 + __be16 wbuf = cpu_to_be16(reg); 161 164 int ret; 162 165 163 166 msgs[0].flags = 0; ··· 292 295 int input_y = get_unaligned_le16(&coor_data[3]); 293 296 int input_w = get_unaligned_le16(&coor_data[5]); 294 297 295 - /* Inversions have to happen before axis swapping */ 296 - if (ts->inverted_x) 297 - input_x = ts->abs_x_max - input_x; 298 - if (ts->inverted_y) 299 - input_y = ts->abs_y_max - input_y; 300 - if (ts->swapped_x_y) 301 - swap(input_x, input_y); 302 - 303 298 input_mt_slot(ts->input_dev, id); 304 299 input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); 305 - input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); 306 - input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, input_y); 300 + touchscreen_report_pos(ts->input_dev, &ts->prop, 301 + input_x, input_y, true); 307 302 input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, input_w); 308 303 input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w); 309 304 } ··· 568 579 static void goodix_read_config(struct goodix_ts_data *ts) 569 580 { 570 581 u8 config[GOODIX_CONFIG_MAX_LENGTH]; 582 + int x_max, y_max; 571 583 int error; 572 584 573 585 error = goodix_i2c_read(ts->client, ts->chip->config_addr, 574 586 config, ts->chip->config_len); 575 587 if (error) { 576 - dev_warn(&ts->client->dev, 577 - "Error reading config (%d), using defaults\n", 588 + dev_warn(&ts->client->dev, "Error reading config: %d\n", 578 589 error); 579 - ts->abs_x_max = GOODIX_MAX_WIDTH; 580 - ts->abs_y_max = GOODIX_MAX_HEIGHT; 581 - if (ts->swapped_x_y) 582 - swap(ts->abs_x_max, ts->abs_y_max); 583 590 ts->int_trigger_type = GOODIX_INT_TRIGGER; 584 591 ts->max_touch_num = GOODIX_MAX_CONTACTS; 585 592 return; 586 593 } 587 594 588 - ts->abs_x_max = get_unaligned_le16(&config[RESOLUTION_LOC]); 589 - ts->abs_y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]); 590 - if (ts->swapped_x_y) 591 - swap(ts->abs_x_max, ts->abs_y_max); 592 595 ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; 593 596 ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; 594 - if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { 595 - dev_err(&ts->client->dev, 596 - "Invalid config, using defaults\n"); 597 - ts->abs_x_max = GOODIX_MAX_WIDTH; 598 - ts->abs_y_max = GOODIX_MAX_HEIGHT; 599 - if (ts->swapped_x_y) 600 - swap(ts->abs_x_max, ts->abs_y_max); 601 - ts->max_touch_num = GOODIX_MAX_CONTACTS; 602 - } 603 597 604 - if (dmi_check_system(rotated_screen)) { 605 - ts->inverted_x = true; 606 - ts->inverted_y = true; 607 - dev_dbg(&ts->client->dev, 608 - "Applying '180 degrees rotated screen' quirk\n"); 598 + x_max = get_unaligned_le16(&config[RESOLUTION_LOC]); 599 + y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]); 600 + if (x_max && y_max) { 601 + input_abs_set_max(ts->input_dev, ABS_MT_POSITION_X, x_max - 1); 602 + input_abs_set_max(ts->input_dev, ABS_MT_POSITION_Y, y_max - 1); 609 603 } 610 604 } 611 605 ··· 648 676 } 649 677 650 678 /** 651 - * goodix_request_input_dev - Allocate, populate and register the input device 652 - * 653 - * @ts: our goodix_ts_data pointer 654 - * 655 - * Must be called during probe 656 - */ 657 - static int goodix_request_input_dev(struct goodix_ts_data *ts) 658 - { 659 - int error; 660 - 661 - ts->input_dev = devm_input_allocate_device(&ts->client->dev); 662 - if (!ts->input_dev) { 663 - dev_err(&ts->client->dev, "Failed to allocate input device."); 664 - return -ENOMEM; 665 - } 666 - 667 - input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 668 - 0, ts->abs_x_max, 0, 0); 669 - input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 670 - 0, ts->abs_y_max, 0, 0); 671 - input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); 672 - input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); 673 - 674 - input_mt_init_slots(ts->input_dev, ts->max_touch_num, 675 - INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); 676 - 677 - ts->input_dev->name = "Goodix Capacitive TouchScreen"; 678 - ts->input_dev->phys = "input/ts"; 679 - ts->input_dev->id.bustype = BUS_I2C; 680 - ts->input_dev->id.vendor = 0x0416; 681 - ts->input_dev->id.product = ts->id; 682 - ts->input_dev->id.version = ts->version; 683 - 684 - /* Capacitive Windows/Home button on some devices */ 685 - input_set_capability(ts->input_dev, EV_KEY, KEY_LEFTMETA); 686 - 687 - error = input_register_device(ts->input_dev); 688 - if (error) { 689 - dev_err(&ts->client->dev, 690 - "Failed to register input device: %d", error); 691 - return error; 692 - } 693 - 694 - return 0; 695 - } 696 - 697 - /** 698 679 * goodix_configure_dev - Finish device initialization 699 680 * 700 681 * @ts: our goodix_ts_data pointer ··· 661 736 { 662 737 int error; 663 738 664 - ts->swapped_x_y = device_property_read_bool(&ts->client->dev, 665 - "touchscreen-swapped-x-y"); 666 - ts->inverted_x = device_property_read_bool(&ts->client->dev, 667 - "touchscreen-inverted-x"); 668 - ts->inverted_y = device_property_read_bool(&ts->client->dev, 669 - "touchscreen-inverted-y"); 739 + ts->int_trigger_type = GOODIX_INT_TRIGGER; 740 + ts->max_touch_num = GOODIX_MAX_CONTACTS; 670 741 742 + ts->input_dev = devm_input_allocate_device(&ts->client->dev); 743 + if (!ts->input_dev) { 744 + dev_err(&ts->client->dev, "Failed to allocate input device."); 745 + return -ENOMEM; 746 + } 747 + 748 + ts->input_dev->name = "Goodix Capacitive TouchScreen"; 749 + ts->input_dev->phys = "input/ts"; 750 + ts->input_dev->id.bustype = BUS_I2C; 751 + ts->input_dev->id.vendor = 0x0416; 752 + ts->input_dev->id.product = ts->id; 753 + ts->input_dev->id.version = ts->version; 754 + 755 + /* Capacitive Windows/Home button on some devices */ 756 + input_set_capability(ts->input_dev, EV_KEY, KEY_LEFTMETA); 757 + 758 + input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_X); 759 + input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_Y); 760 + input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); 761 + input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); 762 + 763 + /* Read configuration and apply touchscreen parameters */ 671 764 goodix_read_config(ts); 672 765 673 - error = goodix_request_input_dev(ts); 674 - if (error) 766 + /* Try overriding touchscreen parameters via device properties */ 767 + touchscreen_parse_properties(ts->input_dev, true, &ts->prop); 768 + 769 + if (!ts->prop.max_x || !ts->prop.max_y || !ts->max_touch_num) { 770 + dev_err(&ts->client->dev, "Invalid config, using defaults\n"); 771 + ts->prop.max_x = GOODIX_MAX_WIDTH - 1; 772 + ts->prop.max_y = GOODIX_MAX_HEIGHT - 1; 773 + ts->max_touch_num = GOODIX_MAX_CONTACTS; 774 + input_abs_set_max(ts->input_dev, 775 + ABS_MT_POSITION_X, ts->prop.max_x); 776 + input_abs_set_max(ts->input_dev, 777 + ABS_MT_POSITION_Y, ts->prop.max_y); 778 + } 779 + 780 + if (dmi_check_system(rotated_screen)) { 781 + ts->prop.invert_x = true; 782 + ts->prop.invert_y = true; 783 + dev_dbg(&ts->client->dev, 784 + "Applying '180 degrees rotated screen' quirk\n"); 785 + } 786 + 787 + error = input_mt_init_slots(ts->input_dev, ts->max_touch_num, 788 + INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); 789 + if (error) { 790 + dev_err(&ts->client->dev, 791 + "Failed to initialize MT slots: %d", error); 675 792 return error; 793 + } 794 + 795 + error = input_register_device(ts->input_dev); 796 + if (error) { 797 + dev_err(&ts->client->dev, 798 + "Failed to register input device: %d", error); 799 + return error; 800 + } 676 801 677 802 ts->irq_flags = goodix_irq_flags[ts->int_trigger_type] | IRQF_ONESHOT; 678 803 error = goodix_request_irq(ts); ··· 853 878 int error; 854 879 855 880 /* We need gpio pins to suspend/resume */ 856 - if (!ts->gpiod_int || !ts->gpiod_rst) 881 + if (!ts->gpiod_int || !ts->gpiod_rst) { 882 + disable_irq(client->irq); 857 883 return 0; 884 + } 858 885 859 886 wait_for_completion(&ts->firmware_loading_complete); 860 887 ··· 896 919 struct goodix_ts_data *ts = i2c_get_clientdata(client); 897 920 int error; 898 921 899 - if (!ts->gpiod_int || !ts->gpiod_rst) 922 + if (!ts->gpiod_int || !ts->gpiod_rst) { 923 + enable_irq(client->irq); 900 924 return 0; 925 + } 901 926 902 927 /* 903 928 * Exit sleep mode by outputting HIGH level to INT pin
-1
drivers/input/touchscreen/melfas_mip4.c
··· 1611 1611 module_i2c_driver(mip4_driver); 1612 1612 1613 1613 MODULE_DESCRIPTION("MELFAS MIP4 Touchscreen"); 1614 - MODULE_VERSION("2016.10.31"); 1615 1614 MODULE_AUTHOR("Sangwon Jee <jeesw@melfas.com>"); 1616 1615 MODULE_LICENSE("GPL");
+137 -103
drivers/input/touchscreen/mms114.c
··· 10 10 #include <linux/module.h> 11 11 #include <linux/delay.h> 12 12 #include <linux/of.h> 13 + #include <linux/of_device.h> 13 14 #include <linux/i2c.h> 14 15 #include <linux/input/mt.h> 16 + #include <linux/input/touchscreen.h> 15 17 #include <linux/interrupt.h> 16 - #include <linux/platform_data/mms114.h> 17 18 #include <linux/regulator/consumer.h> 18 19 #include <linux/slab.h> 19 20 20 21 /* Write only registers */ 21 22 #define MMS114_MODE_CONTROL 0x01 22 23 #define MMS114_OPERATION_MODE_MASK 0xE 23 - #define MMS114_ACTIVE (1 << 1) 24 + #define MMS114_ACTIVE BIT(1) 24 25 25 26 #define MMS114_XY_RESOLUTION_H 0x02 26 27 #define MMS114_X_RESOLUTION 0x03 ··· 31 30 32 31 /* Read only registers */ 33 32 #define MMS114_PACKET_SIZE 0x0F 34 - #define MMS114_INFOMATION 0x10 33 + #define MMS114_INFORMATION 0x10 35 34 #define MMS114_TSP_REV 0xF0 35 + 36 + #define MMS152_FW_REV 0xE1 37 + #define MMS152_COMPAT_GROUP 0xF2 36 38 37 39 /* Minimum delay time is 50us between stop and start signal of i2c */ 38 40 #define MMS114_I2C_DELAY 50 ··· 54 50 #define MMS114_TYPE_TOUCHSCREEN 1 55 51 #define MMS114_TYPE_TOUCHKEY 2 56 52 53 + enum mms_type { 54 + TYPE_MMS114 = 114, 55 + TYPE_MMS152 = 152, 56 + }; 57 + 57 58 struct mms114_data { 58 59 struct i2c_client *client; 59 60 struct input_dev *input_dev; 60 61 struct regulator *core_reg; 61 62 struct regulator *io_reg; 62 - const struct mms114_platform_data *pdata; 63 + struct touchscreen_properties props; 64 + enum mms_type type; 65 + unsigned int contact_threshold; 66 + unsigned int moving_threshold; 63 67 64 68 /* Use cache data for mode control register(write only) */ 65 69 u8 cache_mode_control; ··· 155 143 156 144 static void mms114_process_mt(struct mms114_data *data, struct mms114_touch *touch) 157 145 { 158 - const struct mms114_platform_data *pdata = data->pdata; 159 146 struct i2c_client *client = data->client; 160 147 struct input_dev *input_dev = data->input_dev; 161 148 unsigned int id; ··· 174 163 id = touch->id - 1; 175 164 x = touch->x_lo | touch->x_hi << 8; 176 165 y = touch->y_lo | touch->y_hi << 8; 177 - if (x > pdata->x_size || y > pdata->y_size) { 178 - dev_dbg(&client->dev, 179 - "Wrong touch coordinates (%d, %d)\n", x, y); 180 - return; 181 - } 182 - 183 - if (pdata->x_invert) 184 - x = pdata->x_size - x; 185 - if (pdata->y_invert) 186 - y = pdata->y_size - y; 187 166 188 167 dev_dbg(&client->dev, 189 168 "id: %d, type: %d, pressed: %d, x: %d, y: %d, width: %d, strength: %d\n", ··· 184 183 input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, touch->pressed); 185 184 186 185 if (touch->pressed) { 186 + touchscreen_report_pos(input_dev, &data->props, x, y, true); 187 187 input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, touch->width); 188 - input_report_abs(input_dev, ABS_MT_POSITION_X, x); 189 - input_report_abs(input_dev, ABS_MT_POSITION_Y, y); 190 188 input_report_abs(input_dev, ABS_MT_PRESSURE, touch->strength); 191 189 } 192 190 } ··· 213 213 214 214 touch_size = packet_size / MMS114_PACKET_NUM; 215 215 216 - error = __mms114_read_reg(data, MMS114_INFOMATION, packet_size, 216 + error = __mms114_read_reg(data, MMS114_INFORMATION, packet_size, 217 217 (u8 *)touch); 218 218 if (error < 0) 219 219 goto out; ··· 249 249 { 250 250 struct device *dev = &data->client->dev; 251 251 u8 buf[6]; 252 + int group; 252 253 int error; 253 254 254 - error = __mms114_read_reg(data, MMS114_TSP_REV, 6, buf); 255 - if (error < 0) 256 - return error; 255 + switch (data->type) { 256 + case TYPE_MMS152: 257 + error = __mms114_read_reg(data, MMS152_FW_REV, 3, buf); 258 + if (error) 259 + return error; 257 260 258 - dev_info(dev, "TSP Rev: 0x%x, HW Rev: 0x%x, Firmware Ver: 0x%x\n", 259 - buf[0], buf[1], buf[3]); 261 + group = i2c_smbus_read_byte_data(data->client, 262 + MMS152_COMPAT_GROUP); 263 + if (group < 0) 264 + return group; 265 + 266 + dev_info(dev, "TSP FW Rev: bootloader 0x%x / core 0x%x / config 0x%x, Compat group: %c\n", 267 + buf[0], buf[1], buf[2], group); 268 + break; 269 + 270 + case TYPE_MMS114: 271 + error = __mms114_read_reg(data, MMS114_TSP_REV, 6, buf); 272 + if (error) 273 + return error; 274 + 275 + dev_info(dev, "TSP Rev: 0x%x, HW Rev: 0x%x, Firmware Ver: 0x%x\n", 276 + buf[0], buf[1], buf[3]); 277 + break; 278 + } 260 279 261 280 return 0; 262 281 } 263 282 264 283 static int mms114_setup_regs(struct mms114_data *data) 265 284 { 266 - const struct mms114_platform_data *pdata = data->pdata; 285 + const struct touchscreen_properties *props = &data->props; 267 286 int val; 268 287 int error; 269 288 ··· 290 271 if (error < 0) 291 272 return error; 292 273 274 + /* MMS152 has no configuration or power on registers */ 275 + if (data->type == TYPE_MMS152) 276 + return 0; 277 + 293 278 error = mms114_set_active(data, true); 294 279 if (error < 0) 295 280 return error; 296 281 297 - val = (pdata->x_size >> 8) & 0xf; 298 - val |= ((pdata->y_size >> 8) & 0xf) << 4; 282 + val = (props->max_x >> 8) & 0xf; 283 + val |= ((props->max_y >> 8) & 0xf) << 4; 299 284 error = mms114_write_reg(data, MMS114_XY_RESOLUTION_H, val); 300 285 if (error < 0) 301 286 return error; 302 287 303 - val = pdata->x_size & 0xff; 288 + val = props->max_x & 0xff; 304 289 error = mms114_write_reg(data, MMS114_X_RESOLUTION, val); 305 290 if (error < 0) 306 291 return error; 307 292 308 - val = pdata->y_size & 0xff; 293 + val = props->max_x & 0xff; 309 294 error = mms114_write_reg(data, MMS114_Y_RESOLUTION, val); 310 295 if (error < 0) 311 296 return error; 312 297 313 - if (pdata->contact_threshold) { 298 + if (data->contact_threshold) { 314 299 error = mms114_write_reg(data, MMS114_CONTACT_THRESHOLD, 315 - pdata->contact_threshold); 300 + data->contact_threshold); 316 301 if (error < 0) 317 302 return error; 318 303 } 319 304 320 - if (pdata->moving_threshold) { 305 + if (data->moving_threshold) { 321 306 error = mms114_write_reg(data, MMS114_MOVING_THRESHOLD, 322 - pdata->moving_threshold); 307 + data->moving_threshold); 323 308 if (error < 0) 324 309 return error; 325 310 } ··· 349 326 return error; 350 327 } 351 328 352 - mdelay(MMS114_POWERON_DELAY); 329 + msleep(MMS114_POWERON_DELAY); 353 330 354 331 error = mms114_setup_regs(data); 355 332 if (error < 0) { ··· 357 334 regulator_disable(data->core_reg); 358 335 return error; 359 336 } 360 - 361 - if (data->pdata->cfg_pin) 362 - data->pdata->cfg_pin(true); 363 337 364 338 enable_irq(client->irq); 365 339 ··· 369 349 int error; 370 350 371 351 disable_irq(client->irq); 372 - 373 - if (data->pdata->cfg_pin) 374 - data->pdata->cfg_pin(false); 375 352 376 353 error = regulator_disable(data->io_reg); 377 354 if (error) ··· 393 376 mms114_stop(data); 394 377 } 395 378 396 - #ifdef CONFIG_OF 397 - static struct mms114_platform_data *mms114_parse_dt(struct device *dev) 379 + static int mms114_parse_legacy_bindings(struct mms114_data *data) 398 380 { 399 - struct mms114_platform_data *pdata; 400 - struct device_node *np = dev->of_node; 381 + struct device *dev = &data->client->dev; 382 + struct touchscreen_properties *props = &data->props; 401 383 402 - if (!np) 403 - return NULL; 404 - 405 - pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); 406 - if (!pdata) { 407 - dev_err(dev, "failed to allocate platform data\n"); 408 - return NULL; 384 + if (device_property_read_u32(dev, "x-size", &props->max_x)) { 385 + dev_dbg(dev, "failed to get legacy x-size property\n"); 386 + return -EINVAL; 409 387 } 410 388 411 - if (of_property_read_u32(np, "x-size", &pdata->x_size)) { 412 - dev_err(dev, "failed to get x-size property\n"); 413 - return NULL; 389 + if (device_property_read_u32(dev, "y-size", &props->max_y)) { 390 + dev_dbg(dev, "failed to get legacy y-size property\n"); 391 + return -EINVAL; 414 392 } 415 393 416 - if (of_property_read_u32(np, "y-size", &pdata->y_size)) { 417 - dev_err(dev, "failed to get y-size property\n"); 418 - return NULL; 419 - } 394 + device_property_read_u32(dev, "contact-threshold", 395 + &data->contact_threshold); 396 + device_property_read_u32(dev, "moving-threshold", 397 + &data->moving_threshold); 420 398 421 - of_property_read_u32(np, "contact-threshold", 422 - &pdata->contact_threshold); 423 - of_property_read_u32(np, "moving-threshold", 424 - &pdata->moving_threshold); 399 + if (device_property_read_bool(dev, "x-invert")) 400 + props->invert_x = true; 401 + if (device_property_read_bool(dev, "y-invert")) 402 + props->invert_y = true; 425 403 426 - if (of_find_property(np, "x-invert", NULL)) 427 - pdata->x_invert = true; 428 - if (of_find_property(np, "y-invert", NULL)) 429 - pdata->y_invert = true; 404 + props->swap_x_y = false; 430 405 431 - return pdata; 406 + return 0; 432 407 } 433 - #else 434 - static inline struct mms114_platform_data *mms114_parse_dt(struct device *dev) 435 - { 436 - return NULL; 437 - } 438 - #endif 439 408 440 409 static int mms114_probe(struct i2c_client *client, 441 410 const struct i2c_device_id *id) 442 411 { 443 - const struct mms114_platform_data *pdata; 444 412 struct mms114_data *data; 445 413 struct input_dev *input_dev; 414 + const void *match_data; 446 415 int error; 447 - 448 - pdata = dev_get_platdata(&client->dev); 449 - if (!pdata) 450 - pdata = mms114_parse_dt(&client->dev); 451 - 452 - if (!pdata) { 453 - dev_err(&client->dev, "Need platform data\n"); 454 - return -EINVAL; 455 - } 456 416 457 417 if (!i2c_check_functionality(client->adapter, 458 418 I2C_FUNC_PROTOCOL_MANGLING)) { ··· 448 454 449 455 data->client = client; 450 456 data->input_dev = input_dev; 451 - data->pdata = pdata; 452 457 453 - input_dev->name = "MELFAS MMS114 Touchscreen"; 458 + /* FIXME: switch to device_get_match_data() when available */ 459 + match_data = of_device_get_match_data(&client->dev); 460 + if (!match_data) 461 + return -EINVAL; 462 + 463 + data->type = (enum mms_type)match_data; 464 + 465 + input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_X); 466 + input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_Y); 467 + input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 255, 0, 0); 468 + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 469 + 0, MMS114_MAX_AREA, 0, 0); 470 + 471 + touchscreen_parse_properties(input_dev, true, &data->props); 472 + if (!data->props.max_x || !data->props.max_y) { 473 + dev_dbg(&client->dev, 474 + "missing X/Y size properties, trying legacy bindings\n"); 475 + error = mms114_parse_legacy_bindings(data); 476 + if (error) 477 + return error; 478 + 479 + input_set_abs_params(input_dev, ABS_MT_POSITION_X, 480 + 0, data->props.max_x, 0, 0); 481 + input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 482 + 0, data->props.max_y, 0, 0); 483 + } 484 + 485 + if (data->type == TYPE_MMS114) { 486 + /* 487 + * The firmware handles movement and pressure fuzz, so 488 + * don't duplicate that in software. 489 + */ 490 + data->moving_threshold = input_abs_get_fuzz(input_dev, 491 + ABS_MT_POSITION_X); 492 + data->contact_threshold = input_abs_get_fuzz(input_dev, 493 + ABS_MT_PRESSURE); 494 + input_abs_set_fuzz(input_dev, ABS_MT_POSITION_X, 0); 495 + input_abs_set_fuzz(input_dev, ABS_MT_POSITION_Y, 0); 496 + input_abs_set_fuzz(input_dev, ABS_MT_PRESSURE, 0); 497 + } 498 + 499 + input_dev->name = devm_kasprintf(&client->dev, GFP_KERNEL, 500 + "MELFAS MMS%d Touchscreen", 501 + data->type); 502 + if (!input_dev->name) 503 + return -ENOMEM; 504 + 454 505 input_dev->id.bustype = BUS_I2C; 455 506 input_dev->dev.parent = &client->dev; 456 507 input_dev->open = mms114_input_open; 457 508 input_dev->close = mms114_input_close; 458 509 459 - __set_bit(EV_ABS, input_dev->evbit); 460 - __set_bit(EV_KEY, input_dev->evbit); 461 - __set_bit(BTN_TOUCH, input_dev->keybit); 462 - input_set_abs_params(input_dev, ABS_X, 0, data->pdata->x_size, 0, 0); 463 - input_set_abs_params(input_dev, ABS_Y, 0, data->pdata->y_size, 0, 0); 464 - 465 - /* For multi touch */ 466 - input_mt_init_slots(input_dev, MMS114_MAX_TOUCH, 0); 467 - input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 468 - 0, MMS114_MAX_AREA, 0, 0); 469 - input_set_abs_params(input_dev, ABS_MT_POSITION_X, 470 - 0, data->pdata->x_size, 0, 0); 471 - input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 472 - 0, data->pdata->y_size, 0, 0); 473 - input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 255, 0, 0); 510 + error = input_mt_init_slots(input_dev, MMS114_MAX_TOUCH, 511 + INPUT_MT_DIRECT); 512 + if (error) 513 + return error; 474 514 475 515 input_set_drvdata(input_dev, data); 476 516 i2c_set_clientdata(client, data); ··· 525 497 return error; 526 498 } 527 499 528 - error = devm_request_threaded_irq(&client->dev, client->irq, NULL, 529 - mms114_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 530 - dev_name(&client->dev), data); 500 + error = devm_request_threaded_irq(&client->dev, client->irq, 501 + NULL, mms114_interrupt, IRQF_ONESHOT, 502 + dev_name(&client->dev), data); 531 503 if (error) { 532 504 dev_err(&client->dev, "Failed to register interrupt\n"); 533 505 return error; ··· 597 569 598 570 #ifdef CONFIG_OF 599 571 static const struct of_device_id mms114_dt_match[] = { 600 - { .compatible = "melfas,mms114" }, 572 + { 573 + .compatible = "melfas,mms114", 574 + .data = (void *)TYPE_MMS114, 575 + }, { 576 + .compatible = "melfas,mms152", 577 + .data = (void *)TYPE_MMS152, 578 + }, 601 579 { } 602 580 }; 603 581 MODULE_DEVICE_TABLE(of, mms114_dt_match);
+12 -2
drivers/input/touchscreen/raydium_i2c_ts.c
··· 752 752 { 753 753 struct i2c_client *client = ts->client; 754 754 const struct firmware *fw = NULL; 755 - const char *fw_file = "raydium.fw"; 755 + char *fw_file; 756 756 int error; 757 + 758 + fw_file = kasprintf(GFP_KERNEL, "raydium_%#04x.fw", 759 + le32_to_cpu(ts->info.hw_ver)); 760 + if (!fw_file) 761 + return -ENOMEM; 762 + 763 + dev_dbg(&client->dev, "firmware name: %s\n", fw_file); 757 764 758 765 error = request_firmware(&fw, fw_file, &client->dev); 759 766 if (error) { 760 767 dev_err(&client->dev, "Unable to open firmware %s\n", fw_file); 761 - return error; 768 + goto out_free_fw_file; 762 769 } 763 770 764 771 disable_irq(client->irq); ··· 793 786 msleep(100); 794 787 795 788 release_firmware(fw); 789 + 790 + out_free_fw_file: 791 + kfree(fw_file); 796 792 797 793 return error; 798 794 }
+35 -11
drivers/input/touchscreen/silead.c
··· 56 56 #define SILEAD_POINT_Y_MSB_OFF 0x01 57 57 #define SILEAD_POINT_X_OFF 0x02 58 58 #define SILEAD_POINT_X_MSB_OFF 0x03 59 - #define SILEAD_TOUCH_ID_MASK 0xF0 59 + #define SILEAD_EXTRA_DATA_MASK 0xF0 60 60 61 61 #define SILEAD_CMD_SLEEP_MIN 10000 62 62 #define SILEAD_CMD_SLEEP_MAX 20000 ··· 109 109 INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED | 110 110 INPUT_MT_TRACK); 111 111 112 + if (device_property_read_bool(dev, "silead,home-button")) 113 + input_set_capability(data->input, EV_KEY, KEY_LEFTMETA); 114 + 112 115 data->input->name = SILEAD_TS_NAME; 113 116 data->input->phys = "input/ts"; 114 117 data->input->id.bustype = BUS_I2C; ··· 142 139 struct input_dev *input = data->input; 143 140 struct device *dev = &client->dev; 144 141 u8 *bufp, buf[SILEAD_TS_DATA_LEN]; 145 - int touch_nr, error, i; 142 + int touch_nr, softbutton, error, i; 143 + bool softbutton_pressed = false; 146 144 147 145 error = i2c_smbus_read_i2c_block_data(client, SILEAD_REG_DATA, 148 146 SILEAD_TS_DATA_LEN, buf); ··· 152 148 return; 153 149 } 154 150 155 - touch_nr = buf[0]; 156 - if (touch_nr > data->max_fingers) { 151 + if (buf[0] > data->max_fingers) { 157 152 dev_warn(dev, "More touches reported then supported %d > %d\n", 158 - touch_nr, data->max_fingers); 159 - touch_nr = data->max_fingers; 153 + buf[0], data->max_fingers); 154 + buf[0] = data->max_fingers; 160 155 } 161 156 157 + touch_nr = 0; 162 158 bufp = buf + SILEAD_POINT_DATA_LEN; 163 - for (i = 0; i < touch_nr; i++, bufp += SILEAD_POINT_DATA_LEN) { 164 - /* Bits 4-7 are the touch id */ 165 - data->id[i] = (bufp[SILEAD_POINT_X_MSB_OFF] & 166 - SILEAD_TOUCH_ID_MASK) >> 4; 167 - touchscreen_set_mt_pos(&data->pos[i], &data->prop, 159 + for (i = 0; i < buf[0]; i++, bufp += SILEAD_POINT_DATA_LEN) { 160 + softbutton = (bufp[SILEAD_POINT_Y_MSB_OFF] & 161 + SILEAD_EXTRA_DATA_MASK) >> 4; 162 + 163 + if (softbutton) { 164 + /* 165 + * For now only respond to softbutton == 0x01, some 166 + * tablets *without* a capacative button send 0x04 167 + * when crossing the edges of the screen. 168 + */ 169 + if (softbutton == 0x01) 170 + softbutton_pressed = true; 171 + 172 + continue; 173 + } 174 + 175 + /* 176 + * Bits 4-7 are the touch id, note not all models have 177 + * hardware touch ids so atm we don't use these. 178 + */ 179 + data->id[touch_nr] = (bufp[SILEAD_POINT_X_MSB_OFF] & 180 + SILEAD_EXTRA_DATA_MASK) >> 4; 181 + touchscreen_set_mt_pos(&data->pos[touch_nr], &data->prop, 168 182 get_unaligned_le16(&bufp[SILEAD_POINT_X_OFF]) & 0xfff, 169 183 get_unaligned_le16(&bufp[SILEAD_POINT_Y_OFF]) & 0xfff); 184 + touch_nr++; 170 185 } 171 186 172 187 input_mt_assign_slots(input, data->slots, data->pos, touch_nr, 0); ··· 201 178 } 202 179 203 180 input_mt_sync_frame(input); 181 + input_report_key(input, KEY_LEFTMETA, softbutton_pressed); 204 182 input_sync(input); 205 183 } 206 184
+8 -3
drivers/input/touchscreen/stmfts.c
··· 682 682 683 683 input_set_drvdata(sdata->input, sdata); 684 684 685 + /* 686 + * stmfts_power_on expects interrupt to be disabled, but 687 + * at this point the device is still off and I do not trust 688 + * the status of the irq line that can generate some spurious 689 + * interrupts. To be on the safe side it's better to not enable 690 + * the interrupts during their request. 691 + */ 692 + irq_set_status_flags(client->irq, IRQ_NOAUTOEN); 685 693 err = devm_request_threaded_irq(&client->dev, client->irq, 686 694 NULL, stmfts_irq_handler, 687 695 IRQF_ONESHOT, 688 696 "stmfts_irq", sdata); 689 697 if (err) 690 698 return err; 691 - 692 - /* stmfts_power_on expects interrupt to be disabled */ 693 - disable_irq(client->irq); 694 699 695 700 dev_dbg(&client->dev, "initializing ST-Microelectronics FTS...\n"); 696 701
+2 -7
drivers/input/touchscreen/usbtouchscreen.c
··· 55 55 #include <linux/usb/input.h> 56 56 #include <linux/hid.h> 57 57 58 - 59 - #define DRIVER_VERSION "v0.6" 60 - #define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>" 61 - #define DRIVER_DESC "USB Touchscreen Driver" 62 - 63 58 static bool swap_xy; 64 59 module_param(swap_xy, bool, 0644); 65 60 MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped."); ··· 1758 1763 1759 1764 module_usb_driver(usbtouch_driver); 1760 1765 1761 - MODULE_AUTHOR(DRIVER_AUTHOR); 1762 - MODULE_DESCRIPTION(DRIVER_DESC); 1766 + MODULE_AUTHOR("Daniel Ritz <daniel.ritz@gmx.ch>"); 1767 + MODULE_DESCRIPTION("USB Touchscreen Driver"); 1763 1768 MODULE_LICENSE("GPL"); 1764 1769 1765 1770 MODULE_ALIAS("touchkitusb");
-2
drivers/input/touchscreen/wdt87xx_i2c.c
··· 23 23 #include <asm/unaligned.h> 24 24 25 25 #define WDT87XX_NAME "wdt87xx_i2c" 26 - #define WDT87XX_DRV_VER "0.9.8" 27 26 #define WDT87XX_FW_NAME "wdt87xx_fw.bin" 28 27 #define WDT87XX_CFG_NAME "wdt87xx_cfg.bin" 29 28 ··· 1182 1183 1183 1184 MODULE_AUTHOR("HN Chen <hn.chen@weidahitech.com>"); 1184 1185 MODULE_DESCRIPTION("WeidaHiTech WDT87XX Touchscreen driver"); 1185 - MODULE_VERSION(WDT87XX_DRV_VER); 1186 1186 MODULE_LICENSE("GPL");
+3 -3
include/linux/hil_mlc.h
··· 144 144 hil_packet ipacket[16]; 145 145 hil_packet imatch; 146 146 int icount; 147 - struct timeval instart; 148 - suseconds_t intimeout; 147 + unsigned long instart; 148 + unsigned long intimeout; 149 149 150 150 int ddi; /* Last operational device id */ 151 151 int lcv; /* LCV to throttle loops */ 152 - struct timeval lcv_tv; /* Time loop was started */ 152 + time64_t lcv_time; /* Time loop was started */ 153 153 154 154 int di_map[7]; /* Maps below items to live devs */ 155 155 struct hil_mlc_devinfo di[HIL_MLC_DEVMEM];
+1 -1
include/linux/hp_sdc.h
··· 281 281 hp_sdc_transaction *tq[HP_SDC_QUEUE_LEN]; /* All pending read/writes */ 282 282 283 283 int rcurr, rqty; /* Current read transact in process */ 284 - struct timeval rtv; /* Time when current read started */ 284 + ktime_t rtime; /* Time when current read started */ 285 285 int wcurr; /* Current write transact in process */ 286 286 287 287 int dev_err; /* carries status from registration */
-74
include/linux/input/gpio_tilt.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _INPUT_GPIO_TILT_H 3 - #define _INPUT_GPIO_TILT_H 4 - 5 - /** 6 - * struct gpio_tilt_axis - Axis used by the tilt switch 7 - * @axis: Constant describing the axis, e.g. ABS_X 8 - * @min: minimum value for abs_param 9 - * @max: maximum value for abs_param 10 - * @fuzz: fuzz value for abs_param 11 - * @flat: flat value for abs_param 12 - */ 13 - struct gpio_tilt_axis { 14 - int axis; 15 - int min; 16 - int max; 17 - int fuzz; 18 - int flat; 19 - }; 20 - 21 - /** 22 - * struct gpio_tilt_state - state description 23 - * @gpios: bitfield of gpio target-states for the value 24 - * @axes: array containing the axes settings for the gpio state 25 - * The array indizes must correspond to the axes defined 26 - * in platform_data 27 - * 28 - * This structure describes a supported axis settings 29 - * and the necessary gpio-state which represent it. 30 - * 31 - * The n-th bit in the bitfield describes the state of the n-th GPIO 32 - * from the gpios-array defined in gpio_regulator_config below. 33 - */ 34 - struct gpio_tilt_state { 35 - int gpios; 36 - int *axes; 37 - }; 38 - 39 - /** 40 - * struct gpio_tilt_platform_data 41 - * @gpios: Array containing the gpios determining the tilt state 42 - * @nr_gpios: Number of gpios 43 - * @axes: Array of gpio_tilt_axis descriptions 44 - * @nr_axes: Number of axes 45 - * @states: Array of gpio_tilt_state entries describing 46 - * the gpio state for specific tilts 47 - * @nr_states: Number of states available 48 - * @debounce_interval: debounce ticks interval in msecs 49 - * @poll_interval: polling interval in msecs - for polling driver only 50 - * @enable: callback to enable the tilt switch 51 - * @disable: callback to disable the tilt switch 52 - * 53 - * This structure contains gpio-tilt-switch configuration 54 - * information that must be passed by platform code to the 55 - * gpio-tilt input driver. 56 - */ 57 - struct gpio_tilt_platform_data { 58 - struct gpio *gpios; 59 - int nr_gpios; 60 - 61 - struct gpio_tilt_axis *axes; 62 - int nr_axes; 63 - 64 - struct gpio_tilt_state *states; 65 - int nr_states; 66 - 67 - int debounce_interval; 68 - 69 - unsigned int poll_interval; 70 - int (*enable)(struct device *dev); 71 - void (*disable)(struct device *dev); 72 - }; 73 - 74 - #endif
-24
include/linux/platform_data/mms114.h
··· 1 - /* 2 - * Copyright (C) 2012 Samsung Electronics Co.Ltd 3 - * Author: Joonyoung Shim <jy0922.shim@samsung.com> 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 as 7 - * published by the Free Software Foundationr 8 - */ 9 - 10 - #ifndef __LINUX_MMS114_H 11 - #define __LINUX_MMS114_H 12 - 13 - struct mms114_platform_data { 14 - unsigned int x_size; 15 - unsigned int y_size; 16 - unsigned int contact_threshold; 17 - unsigned int moving_threshold; 18 - bool x_invert; 19 - bool y_invert; 20 - 21 - void (*cfg_pin)(bool); 22 - }; 23 - 24 - #endif /* __LINUX_MMS114_H */
+11
include/uapi/linux/input.h
··· 21 21 22 22 /* 23 23 * The event structure itself 24 + * Note that __USE_TIME_BITS64 is defined by libc based on 25 + * application's request to use 64 bit time_t. 24 26 */ 25 27 26 28 struct input_event { 29 + #if (__BITS_PER_LONG != 32 || !defined(__USE_TIME_BITS64)) && !defined(__KERNEL) 27 30 struct timeval time; 31 + #define input_event_sec time.tv_sec 32 + #define input_event_usec time.tv_usec 33 + #else 34 + __kernel_ulong_t __sec; 35 + __kernel_ulong_t __usec; 36 + #define input_event_sec __sec 37 + #define input_event_usec __usec 38 + #endif 28 39 __u16 type; 29 40 __u16 code; 30 41 __s32 value;