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 updates from Dmitry Torokhov:

- a driver for SGI IOC3 PS/2 controller

- updates to driver for FocalTech FT5x06 series touch screen
controllers

- other assorted fixes

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: synaptics-rmi4 - switch to reduced reporting mode
dt-bindings: touchscreen: Convert Goodix touchscreen to json-schema
dt-bindings: touchscreen: Add touchscreen schema
Input: add IOC3 serio driver
Input: axp20x-pek - enable wakeup for all AXP variants
Input: axp20x-pek - respect userspace wakeup configuration
Input: ads7846 - use new `delay` structure for SPI transfer delays
Input: edt-ft5x06 - use pm core to enable/disable the wake irq
Input: edt-ft5x06 - make wakeup-source switchable
Input: edt-ft5x06 - document wakeup-source capability
Input: edt-ft5x06 - alphabetical include reorder
Input: edt-ft5x06 - work around first register access error
Input: apbps2 - add __iomem to register struct
Input: axp20x-pek - make device attributes static
Input: elants_i2c - check Remark ID when attempting firmware update

+544 -144
+2
Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt
··· 36 36 - pinctrl-0: a phandle pointing to the pin settings for the 37 37 control gpios 38 38 39 + - wakeup-source: If present the device will act as wakeup-source 40 + 39 41 - threshold: allows setting the "click"-threshold in the range 40 42 from 0 to 80. 41 43
-50
Documentation/devicetree/bindings/input/touchscreen/goodix.txt
··· 1 - Device tree bindings for Goodix GT9xx series touchscreen controller 2 - 3 - Required properties: 4 - 5 - - compatible : Should be "goodix,gt1151" 6 - or "goodix,gt5663" 7 - or "goodix,gt5688" 8 - or "goodix,gt911" 9 - or "goodix,gt9110" 10 - or "goodix,gt912" 11 - or "goodix,gt927" 12 - or "goodix,gt9271" 13 - or "goodix,gt928" 14 - or "goodix,gt967" 15 - - reg : I2C address of the chip. Should be 0x5d or 0x14 16 - - interrupts : Interrupt to which the chip is connected 17 - 18 - Optional properties: 19 - 20 - - irq-gpios : GPIO pin used for IRQ. The driver uses the 21 - interrupt gpio pin as output to reset the device. 22 - - reset-gpios : GPIO pin used for reset 23 - - AVDD28-supply : Analog power supply regulator on AVDD28 pin 24 - - VDDIO-supply : GPIO power supply regulator on VDDIO pin 25 - - touchscreen-inverted-x 26 - - touchscreen-inverted-y 27 - - touchscreen-size-x 28 - - touchscreen-size-y 29 - - touchscreen-swapped-x-y 30 - 31 - The touchscreen-* properties are documented in touchscreen.txt in this 32 - directory. 33 - 34 - Example: 35 - 36 - i2c@00000000 { 37 - /* ... */ 38 - 39 - gt928@5d { 40 - compatible = "goodix,gt928"; 41 - reg = <0x5d>; 42 - interrupt-parent = <&gpio>; 43 - interrupts = <0 0>; 44 - 45 - irq-gpios = <&gpio1 0 0>; 46 - reset-gpios = <&gpio1 1 0>; 47 - }; 48 - 49 - /* ... */ 50 - };
+78
Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/input/touchscreen/goodix.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Goodix GT9xx series touchscreen controller Bindings 8 + 9 + maintainers: 10 + - Dmitry Torokhov <dmitry.torokhov@gmail.com> 11 + 12 + allOf: 13 + - $ref: touchscreen.yaml# 14 + 15 + properties: 16 + compatible: 17 + enum: 18 + - goodix,gt1151 19 + - goodix,gt5663 20 + - goodix,gt5688 21 + - goodix,gt911 22 + - goodix,gt9110 23 + - goodix,gt912 24 + - goodix,gt927 25 + - goodix,gt9271 26 + - goodix,gt928 27 + - goodix,gt967 28 + 29 + reg: 30 + enum: [ 0x5d, 0x14 ] 31 + 32 + interrupts: 33 + maxItems: 1 34 + 35 + irq-gpios: 36 + description: GPIO pin used for IRQ. 37 + The driver uses the interrupt gpio pin as 38 + output to reset the device. 39 + maxItems: 1 40 + 41 + reset-gpios: 42 + maxItems: 1 43 + 44 + AVDD28-supply: 45 + description: Analog power supply regulator on AVDD28 pin 46 + 47 + VDDIO-supply: 48 + description: GPIO power supply regulator on VDDIO pin 49 + 50 + touchscreen-inverted-x: true 51 + touchscreen-inverted-y: true 52 + touchscreen-size-x: true 53 + touchscreen-size-y: true 54 + touchscreen-swapped-x-y: true 55 + 56 + additionalProperties: false 57 + 58 + required: 59 + - compatible 60 + - reg 61 + - interrupts 62 + 63 + examples: 64 + - | 65 + i2c@00000000 { 66 + #address-cells = <1>; 67 + #size-cells = <0>; 68 + gt928@5d { 69 + compatible = "goodix,gt928"; 70 + reg = <0x5d>; 71 + interrupt-parent = <&gpio>; 72 + interrupts = <0 0>; 73 + irq-gpios = <&gpio1 0 0>; 74 + reset-gpios = <&gpio1 1 0>; 75 + }; 76 + }; 77 + 78 + ...
+1 -39
Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
··· 1 - General Touchscreen Properties: 2 - 3 - Optional properties for Touchscreens: 4 - - touchscreen-min-x : minimum x coordinate reported (0 if not set) 5 - - touchscreen-min-y : minimum y coordinate reported (0 if not set) 6 - - touchscreen-size-x : horizontal resolution of touchscreen 7 - (maximum x coordinate reported + 1) 8 - - touchscreen-size-y : vertical resolution of touchscreen 9 - (maximum y coordinate reported + 1) 10 - - touchscreen-max-pressure : maximum reported pressure (arbitrary range 11 - dependent on the controller) 12 - - touchscreen-min-pressure : minimum pressure on the touchscreen to be 13 - achieved in order for the touchscreen 14 - driver to report a touch event. 15 - - touchscreen-fuzz-x : horizontal noise value of the absolute input 16 - device (in pixels) 17 - - touchscreen-fuzz-y : vertical noise value of the absolute input 18 - device (in pixels) 19 - - touchscreen-fuzz-pressure : pressure noise value of the absolute input 20 - device (arbitrary range dependent on the 21 - controller) 22 - - touchscreen-average-samples : Number of data samples which are averaged 23 - for each read (valid values dependent on the 24 - controller) 25 - - touchscreen-inverted-x : X axis is inverted (boolean) 26 - - touchscreen-inverted-y : Y axis is inverted (boolean) 27 - - touchscreen-swapped-x-y : X and Y axis are swapped (boolean) 28 - Swapping is done after inverting the axis 29 - - touchscreen-x-mm : horizontal length in mm of the touchscreen 30 - - touchscreen-y-mm : vertical length in mm of the touchscreen 31 - 32 - Deprecated properties for Touchscreens: 33 - - x-size : deprecated name for touchscreen-size-x 34 - - y-size : deprecated name for touchscreen-size-y 35 - - moving-threshold : deprecated name for a combination of 36 - touchscreen-fuzz-x and touchscreen-fuzz-y 37 - - contact-threshold : deprecated name for touchscreen-fuzz-pressure 38 - - x-invert : deprecated name for touchscreen-inverted-x 39 - - y-invert : deprecated name for touchscreen-inverted-y 1 + See touchscreen.yaml
+83
Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/input/touchscreen/touchscreen.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Common touchscreen Bindings 8 + 9 + maintainers: 10 + - Dmitry Torokhov <dmitry.torokhov@gmail.com> 11 + 12 + properties: 13 + touchscreen-min-x: 14 + description: minimum x coordinate reported 15 + $ref: /schemas/types.yaml#/definitions/uint32 16 + default: 0 17 + 18 + touchscreen-min-y: 19 + description: minimum y coordinate reported 20 + $ref: /schemas/types.yaml#/definitions/uint32 21 + default: 0 22 + 23 + touchscreen-size-x: 24 + description: horizontal resolution of touchscreen (maximum x coordinate reported + 1) 25 + $ref: /schemas/types.yaml#/definitions/uint32 26 + 27 + touchscreen-size-y: 28 + description: vertical resolution of touchscreen (maximum y coordinate reported + 1) 29 + $ref: /schemas/types.yaml#/definitions/uint32 30 + 31 + touchscreen-max-pressure: 32 + description: maximum reported pressure (arbitrary range dependent on the controller) 33 + $ref: /schemas/types.yaml#/definitions/uint32 34 + 35 + touchscreen-min-pressure: 36 + description: minimum pressure on the touchscreen to be achieved in order for the 37 + touchscreen driver to report a touch event. 38 + $ref: /schemas/types.yaml#/definitions/uint32 39 + 40 + touchscreen-fuzz-x: 41 + description: horizontal noise value of the absolute input device (in pixels) 42 + $ref: /schemas/types.yaml#/definitions/uint32 43 + 44 + touchscreen-fuzz-y: 45 + description: vertical noise value of the absolute input device (in pixels) 46 + $ref: /schemas/types.yaml#/definitions/uint32 47 + 48 + touchscreen-fuzz-pressure: 49 + description: pressure noise value of the absolute input device (arbitrary range 50 + dependent on the controller) 51 + $ref: /schemas/types.yaml#/definitions/uint32 52 + 53 + touchscreen-average-samples: 54 + description: Number of data samples which are averaged for each read (valid values 55 + dependent on the controller) 56 + $ref: /schemas/types.yaml#/definitions/uint32 57 + 58 + touchscreen-inverted-x: 59 + description: X axis is inverted 60 + type: boolean 61 + 62 + touchscreen-inverted-y: 63 + description: Y axis is inverted 64 + type: boolean 65 + 66 + touchscreen-swapped-x-y: 67 + description: X and Y axis are swapped 68 + Swapping is done after inverting the axis 69 + type: boolean 70 + 71 + touchscreen-x-mm: 72 + description: horizontal length in mm of the touchscreen 73 + $ref: /schemas/types.yaml#/definitions/uint32 74 + 75 + touchscreen-y-mm: 76 + description: vertical length in mm of the touchscreen 77 + $ref: /schemas/types.yaml#/definitions/uint32 78 + 79 + dependencies: 80 + touchscreen-size-x: [ touchscreen-size-y ] 81 + touchscreen-size-y: [ touchscreen-size-x ] 82 + touchscreen-x-mm: [ touchscreen-y-mm ] 83 + touchscreen-y-mm: [ touchscreen-x-mm ]
+40 -5
drivers/input/misc/axp20x-pek.c
··· 191 191 axp20x_pek->info->shutdown_mask, buf, count); 192 192 } 193 193 194 - DEVICE_ATTR(startup, 0644, axp20x_show_attr_startup, axp20x_store_attr_startup); 195 - DEVICE_ATTR(shutdown, 0644, axp20x_show_attr_shutdown, 196 - axp20x_store_attr_shutdown); 194 + static DEVICE_ATTR(startup, 0644, axp20x_show_attr_startup, 195 + axp20x_store_attr_startup); 196 + static DEVICE_ATTR(shutdown, 0644, axp20x_show_attr_shutdown, 197 + axp20x_store_attr_shutdown); 197 198 198 199 static struct attribute *axp20x_attrs[] = { 199 200 &dev_attr_startup.attr, ··· 280 279 return error; 281 280 } 282 281 283 - if (axp20x_pek->axp20x->variant == AXP288_ID) 284 - enable_irq_wake(axp20x_pek->irq_dbr); 282 + device_init_wakeup(&pdev->dev, true); 285 283 286 284 return 0; 287 285 } ··· 352 352 return 0; 353 353 } 354 354 355 + static int __maybe_unused axp20x_pek_suspend(struct device *dev) 356 + { 357 + struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev); 358 + 359 + /* 360 + * As nested threaded IRQs are not automatically disabled during 361 + * suspend, we must explicitly disable non-wakeup IRQs. 362 + */ 363 + if (device_may_wakeup(dev)) { 364 + enable_irq_wake(axp20x_pek->irq_dbf); 365 + enable_irq_wake(axp20x_pek->irq_dbr); 366 + } else { 367 + disable_irq(axp20x_pek->irq_dbf); 368 + disable_irq(axp20x_pek->irq_dbr); 369 + } 370 + 371 + return 0; 372 + } 373 + 374 + static int __maybe_unused axp20x_pek_resume(struct device *dev) 375 + { 376 + struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev); 377 + 378 + if (device_may_wakeup(dev)) { 379 + disable_irq_wake(axp20x_pek->irq_dbf); 380 + disable_irq_wake(axp20x_pek->irq_dbr); 381 + } else { 382 + enable_irq(axp20x_pek->irq_dbf); 383 + enable_irq(axp20x_pek->irq_dbr); 384 + } 385 + 386 + return 0; 387 + } 388 + 355 389 static int __maybe_unused axp20x_pek_resume_noirq(struct device *dev) 356 390 { 357 391 struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev); ··· 405 371 } 406 372 407 373 static const struct dev_pm_ops axp20x_pek_pm_ops = { 374 + SET_SYSTEM_SLEEP_PM_OPS(axp20x_pek_suspend, axp20x_pek_resume) 408 375 #ifdef CONFIG_PM_SLEEP 409 376 .resume_noirq = axp20x_pek_resume_noirq, 410 377 #endif
+14
drivers/input/rmi4/rmi_f11.c
··· 412 412 413 413 /* Defs for Ctrl0. */ 414 414 #define RMI_F11_REPORT_MODE_MASK 0x07 415 + #define RMI_F11_REPORT_MODE_CONTINUOUS (0 << 0) 416 + #define RMI_F11_REPORT_MODE_REDUCED (1 << 0) 417 + #define RMI_F11_REPORT_MODE_FS_CHANGE (2 << 0) 418 + #define RMI_F11_REPORT_MODE_FP_CHANGE (3 << 0) 415 419 #define RMI_F11_ABS_POS_FILT (1 << 3) 416 420 #define RMI_F11_REL_POS_FILT (1 << 4) 417 421 #define RMI_F11_REL_BALLISTICS (1 << 5) ··· 1198 1194 if (sensor->axis_align.delta_y_threshold) 1199 1195 ctrl->ctrl0_11[RMI_F11_DELTA_Y_THRESHOLD] = 1200 1196 sensor->axis_align.delta_y_threshold; 1197 + 1198 + /* 1199 + * If distance threshold values are set, switch to reduced reporting 1200 + * mode so they actually get used by the controller. 1201 + */ 1202 + if (ctrl->ctrl0_11[RMI_F11_DELTA_X_THRESHOLD] || 1203 + ctrl->ctrl0_11[RMI_F11_DELTA_Y_THRESHOLD]) { 1204 + ctrl->ctrl0_11[0] &= ~RMI_F11_REPORT_MODE_MASK; 1205 + ctrl->ctrl0_11[0] |= RMI_F11_REPORT_MODE_REDUCED; 1206 + } 1201 1207 1202 1208 if (f11->sens_query.has_dribble) { 1203 1209 switch (sensor->dribble) {
+10
drivers/input/serio/Kconfig
··· 165 165 To compile this driver as a module, choose M here: the 166 166 module will be called maceps2. 167 167 168 + config SERIO_SGI_IOC3 169 + tristate "SGI IOC3 PS/2 controller" 170 + depends on SGI_MFD_IOC3 171 + help 172 + Say Y here if you have an SGI Onyx2, SGI Octane or IOC3 PCI card 173 + and you want to attach and use a keyboard, mouse, or both. 174 + 175 + To compile this driver as a module, choose M here: the 176 + module will be called ioc3kbd. 177 + 168 178 config SERIO_LIBPS2 169 179 tristate "PS/2 driver library" 170 180 depends on SERIO_I8042 || SERIO_I8042=n
+1
drivers/input/serio/Makefile
··· 20 20 obj-$(CONFIG_SERIO_PCIPS2) += pcips2.o 21 21 obj-$(CONFIG_SERIO_PS2MULT) += ps2mult.o 22 22 obj-$(CONFIG_SERIO_MACEPS2) += maceps2.o 23 + obj-$(CONFIG_SERIO_SGI_IOC3) += ioc3kbd.o 23 24 obj-$(CONFIG_SERIO_LIBPS2) += libps2.o 24 25 obj-$(CONFIG_SERIO_RAW) += serio_raw.o 25 26 obj-$(CONFIG_SERIO_AMS_DELTA) += ams_delta_serio.o
+1 -1
drivers/input/serio/apbps2.c
··· 51 51 52 52 struct apbps2_priv { 53 53 struct serio *io; 54 - struct apbps2_regs *regs; 54 + struct apbps2_regs __iomem *regs; 55 55 }; 56 56 57 57 static int apbps2_idx;
+216
drivers/input/serio/ioc3kbd.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * SGI IOC3 PS/2 controller driver for linux 4 + * 5 + * Copyright (C) 2019 Thomas Bogendoerfer <tbogendoerfer@suse.de> 6 + * 7 + * Based on code Copyright (C) 2005 Stanislaw Skowronek <skylark@unaligned.org> 8 + * Copyright (C) 2009 Johannes Dickgreber <tanzy@gmx.de> 9 + */ 10 + 11 + #include <linux/delay.h> 12 + #include <linux/init.h> 13 + #include <linux/io.h> 14 + #include <linux/serio.h> 15 + #include <linux/module.h> 16 + #include <linux/platform_device.h> 17 + 18 + #include <asm/sn/ioc3.h> 19 + 20 + struct ioc3kbd_data { 21 + struct ioc3_serioregs __iomem *regs; 22 + struct serio *kbd, *aux; 23 + bool kbd_exists, aux_exists; 24 + int irq; 25 + }; 26 + 27 + static int ioc3kbd_wait(struct ioc3_serioregs __iomem *regs, u32 mask) 28 + { 29 + unsigned long timeout = 0; 30 + 31 + while ((readl(&regs->km_csr) & mask) && (timeout < 250)) { 32 + udelay(50); 33 + timeout++; 34 + } 35 + return (timeout >= 250) ? -ETIMEDOUT : 0; 36 + } 37 + 38 + static int ioc3kbd_write(struct serio *dev, u8 val) 39 + { 40 + struct ioc3kbd_data *d = dev->port_data; 41 + int ret; 42 + 43 + ret = ioc3kbd_wait(d->regs, KM_CSR_K_WRT_PEND); 44 + if (ret) 45 + return ret; 46 + 47 + writel(val, &d->regs->k_wd); 48 + 49 + return 0; 50 + } 51 + 52 + static int ioc3kbd_start(struct serio *dev) 53 + { 54 + struct ioc3kbd_data *d = dev->port_data; 55 + 56 + d->kbd_exists = true; 57 + return 0; 58 + } 59 + 60 + static void ioc3kbd_stop(struct serio *dev) 61 + { 62 + struct ioc3kbd_data *d = dev->port_data; 63 + 64 + d->kbd_exists = false; 65 + } 66 + 67 + static int ioc3aux_write(struct serio *dev, u8 val) 68 + { 69 + struct ioc3kbd_data *d = dev->port_data; 70 + int ret; 71 + 72 + ret = ioc3kbd_wait(d->regs, KM_CSR_M_WRT_PEND); 73 + if (ret) 74 + return ret; 75 + 76 + writel(val, &d->regs->m_wd); 77 + 78 + return 0; 79 + } 80 + 81 + static int ioc3aux_start(struct serio *dev) 82 + { 83 + struct ioc3kbd_data *d = dev->port_data; 84 + 85 + d->aux_exists = true; 86 + return 0; 87 + } 88 + 89 + static void ioc3aux_stop(struct serio *dev) 90 + { 91 + struct ioc3kbd_data *d = dev->port_data; 92 + 93 + d->aux_exists = false; 94 + } 95 + 96 + static void ioc3kbd_process_data(struct serio *dev, u32 data) 97 + { 98 + if (data & KM_RD_VALID_0) 99 + serio_interrupt(dev, (data >> KM_RD_DATA_0_SHIFT) & 0xff, 0); 100 + if (data & KM_RD_VALID_1) 101 + serio_interrupt(dev, (data >> KM_RD_DATA_1_SHIFT) & 0xff, 0); 102 + if (data & KM_RD_VALID_2) 103 + serio_interrupt(dev, (data >> KM_RD_DATA_2_SHIFT) & 0xff, 0); 104 + } 105 + 106 + static irqreturn_t ioc3kbd_intr(int itq, void *dev_id) 107 + { 108 + struct ioc3kbd_data *d = dev_id; 109 + u32 data_k, data_m; 110 + 111 + data_k = readl(&d->regs->k_rd); 112 + if (d->kbd_exists) 113 + ioc3kbd_process_data(d->kbd, data_k); 114 + 115 + data_m = readl(&d->regs->m_rd); 116 + if (d->aux_exists) 117 + ioc3kbd_process_data(d->aux, data_m); 118 + 119 + return IRQ_HANDLED; 120 + } 121 + 122 + static int ioc3kbd_probe(struct platform_device *pdev) 123 + { 124 + struct ioc3_serioregs __iomem *regs; 125 + struct device *dev = &pdev->dev; 126 + struct ioc3kbd_data *d; 127 + struct serio *sk, *sa; 128 + int irq, ret; 129 + 130 + regs = devm_platform_ioremap_resource(pdev, 0); 131 + if (IS_ERR(regs)) 132 + return PTR_ERR(regs); 133 + 134 + irq = platform_get_irq(pdev, 0); 135 + if (irq < 0) 136 + return -ENXIO; 137 + 138 + d = devm_kzalloc(dev, sizeof(*d), GFP_KERNEL); 139 + if (!d) 140 + return -ENOMEM; 141 + 142 + sk = kzalloc(sizeof(*sk), GFP_KERNEL); 143 + if (!sk) 144 + return -ENOMEM; 145 + 146 + sa = kzalloc(sizeof(*sa), GFP_KERNEL); 147 + if (!sa) { 148 + kfree(sk); 149 + return -ENOMEM; 150 + } 151 + 152 + sk->id.type = SERIO_8042; 153 + sk->write = ioc3kbd_write; 154 + sk->start = ioc3kbd_start; 155 + sk->stop = ioc3kbd_stop; 156 + snprintf(sk->name, sizeof(sk->name), "IOC3 keyboard %d", pdev->id); 157 + snprintf(sk->phys, sizeof(sk->phys), "ioc3/serio%dkbd", pdev->id); 158 + sk->port_data = d; 159 + sk->dev.parent = dev; 160 + 161 + sa->id.type = SERIO_8042; 162 + sa->write = ioc3aux_write; 163 + sa->start = ioc3aux_start; 164 + sa->stop = ioc3aux_stop; 165 + snprintf(sa->name, sizeof(sa->name), "IOC3 auxiliary %d", pdev->id); 166 + snprintf(sa->phys, sizeof(sa->phys), "ioc3/serio%daux", pdev->id); 167 + sa->port_data = d; 168 + sa->dev.parent = dev; 169 + 170 + d->regs = regs; 171 + d->kbd = sk; 172 + d->aux = sa; 173 + d->irq = irq; 174 + 175 + platform_set_drvdata(pdev, d); 176 + serio_register_port(d->kbd); 177 + serio_register_port(d->aux); 178 + 179 + ret = request_irq(irq, ioc3kbd_intr, IRQF_SHARED, "ioc3-kbd", d); 180 + if (ret) { 181 + dev_err(dev, "could not request IRQ %d\n", irq); 182 + serio_unregister_port(d->kbd); 183 + serio_unregister_port(d->aux); 184 + return ret; 185 + } 186 + 187 + /* enable ports */ 188 + writel(KM_CSR_K_CLAMP_3 | KM_CSR_M_CLAMP_3, &regs->km_csr); 189 + 190 + return 0; 191 + } 192 + 193 + static int ioc3kbd_remove(struct platform_device *pdev) 194 + { 195 + struct ioc3kbd_data *d = platform_get_drvdata(pdev); 196 + 197 + free_irq(d->irq, d); 198 + 199 + serio_unregister_port(d->kbd); 200 + serio_unregister_port(d->aux); 201 + 202 + return 0; 203 + } 204 + 205 + static struct platform_driver ioc3kbd_driver = { 206 + .probe = ioc3kbd_probe, 207 + .remove = ioc3kbd_remove, 208 + .driver = { 209 + .name = "ioc3-kbd", 210 + }, 211 + }; 212 + module_platform_driver(ioc3kbd_driver); 213 + 214 + MODULE_AUTHOR("Thomas Bogendoerfer <tbogendoerfer@suse.de>"); 215 + MODULE_DESCRIPTION("SGI IOC3 serio driver"); 216 + MODULE_LICENSE("GPL");
+10 -5
drivers/input/touchscreen/ads7846.c
··· 333 333 req->xfer[1].len = 2; 334 334 335 335 /* for 1uF, settle for 800 usec; no cap, 100 usec. */ 336 - req->xfer[1].delay_usecs = ts->vref_delay_usecs; 336 + req->xfer[1].delay.value = ts->vref_delay_usecs; 337 + req->xfer[1].delay.unit = SPI_DELAY_UNIT_USECS; 337 338 spi_message_add_tail(&req->xfer[1], &req->msg); 338 339 339 340 /* Enable reference voltage */ ··· 1019 1018 * have had enough time to stabilize. 1020 1019 */ 1021 1020 if (pdata->settle_delay_usecs) { 1022 - x->delay_usecs = pdata->settle_delay_usecs; 1021 + x->delay.value = pdata->settle_delay_usecs; 1022 + x->delay.unit = SPI_DELAY_UNIT_USECS; 1023 1023 1024 1024 x++; 1025 1025 x->tx_buf = &packet->read_y; ··· 1063 1061 1064 1062 /* ... maybe discard first sample ... */ 1065 1063 if (pdata->settle_delay_usecs) { 1066 - x->delay_usecs = pdata->settle_delay_usecs; 1064 + x->delay.value = pdata->settle_delay_usecs; 1065 + x->delay.unit = SPI_DELAY_UNIT_USECS; 1067 1066 1068 1067 x++; 1069 1068 x->tx_buf = &packet->read_x; ··· 1097 1094 1098 1095 /* ... maybe discard first sample ... */ 1099 1096 if (pdata->settle_delay_usecs) { 1100 - x->delay_usecs = pdata->settle_delay_usecs; 1097 + x->delay.value = pdata->settle_delay_usecs; 1098 + x->delay.unit = SPI_DELAY_UNIT_USECS; 1101 1099 1102 1100 x++; 1103 1101 x->tx_buf = &packet->read_z1; ··· 1129 1125 1130 1126 /* ... maybe discard first sample ... */ 1131 1127 if (pdata->settle_delay_usecs) { 1132 - x->delay_usecs = pdata->settle_delay_usecs; 1128 + x->delay.value = pdata->settle_delay_usecs; 1129 + x->delay.unit = SPI_DELAY_UNIT_USECS; 1133 1130 1134 1131 x++; 1135 1132 x->tx_buf = &packet->read_z2;
+19 -36
drivers/input/touchscreen/edt-ft5x06.c
··· 13 13 * http://www.glyn.com/Products/Displays 14 14 */ 15 15 16 - #include <linux/module.h> 17 - #include <linux/ratelimit.h> 18 - #include <linux/irq.h> 16 + #include <linux/debugfs.h> 17 + #include <linux/delay.h> 18 + #include <linux/gpio/consumer.h> 19 + #include <linux/i2c.h> 19 20 #include <linux/interrupt.h> 20 21 #include <linux/input.h> 21 - #include <linux/i2c.h> 22 - #include <linux/kernel.h> 23 - #include <linux/uaccess.h> 24 - #include <linux/delay.h> 25 - #include <linux/debugfs.h> 26 - #include <linux/slab.h> 27 - #include <linux/gpio/consumer.h> 28 22 #include <linux/input/mt.h> 29 23 #include <linux/input/touchscreen.h> 30 - #include <asm/unaligned.h> 24 + #include <linux/irq.h> 25 + #include <linux/kernel.h> 26 + #include <linux/module.h> 27 + #include <linux/ratelimit.h> 31 28 #include <linux/regulator/consumer.h> 29 + #include <linux/slab.h> 30 + #include <linux/uaccess.h> 31 + 32 + #include <asm/unaligned.h> 32 33 33 34 #define WORK_REGISTER_THRESHOLD 0x00 34 35 #define WORK_REGISTER_REPORT_RATE 0x08 ··· 1051 1050 { 1052 1051 const struct edt_i2c_chip_data *chip_data; 1053 1052 struct edt_ft5x06_ts_data *tsdata; 1053 + u8 buf[2] = { 0xfc, 0x00 }; 1054 1054 struct input_dev *input; 1055 1055 unsigned long irq_flags; 1056 1056 int error; ··· 1142 1140 return error; 1143 1141 } 1144 1142 1143 + /* 1144 + * Dummy read access. EP0700MLP1 returns bogus data on the first 1145 + * register read access and ignores writes. 1146 + */ 1147 + edt_ft5x06_ts_readwrite(tsdata->client, 2, buf, 2, buf); 1148 + 1145 1149 edt_ft5x06_ts_set_regs(tsdata); 1146 1150 edt_ft5x06_ts_get_defaults(&client->dev, tsdata); 1147 1151 edt_ft5x06_ts_get_parameters(tsdata); ··· 1208 1200 return error; 1209 1201 1210 1202 edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev)); 1211 - device_init_wakeup(&client->dev, 1); 1212 1203 1213 1204 dev_dbg(&client->dev, 1214 1205 "EDT FT5x06 initialized: IRQ %d, WAKE pin %d, Reset pin %d.\n", ··· 1226 1219 1227 1220 return 0; 1228 1221 } 1229 - 1230 - static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev) 1231 - { 1232 - struct i2c_client *client = to_i2c_client(dev); 1233 - 1234 - if (device_may_wakeup(dev)) 1235 - enable_irq_wake(client->irq); 1236 - 1237 - return 0; 1238 - } 1239 - 1240 - static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev) 1241 - { 1242 - struct i2c_client *client = to_i2c_client(dev); 1243 - 1244 - if (device_may_wakeup(dev)) 1245 - disable_irq_wake(client->irq); 1246 - 1247 - return 0; 1248 - } 1249 - 1250 - static SIMPLE_DEV_PM_OPS(edt_ft5x06_ts_pm_ops, 1251 - edt_ft5x06_ts_suspend, edt_ft5x06_ts_resume); 1252 1222 1253 1223 static const struct edt_i2c_chip_data edt_ft5x06_data = { 1254 1224 .max_support_points = 5, ··· 1265 1281 .driver = { 1266 1282 .name = "edt_ft5x06", 1267 1283 .of_match_table = edt_ft5x06_of_match, 1268 - .pm = &edt_ft5x06_ts_pm_ops, 1269 1284 }, 1270 1285 .id_table = edt_ft5x06_ts_id, 1271 1286 .probe = edt_ft5x06_ts_probe,
+69 -8
drivers/input/touchscreen/elants_i2c.c
··· 59 59 #define CMD_HEADER_WRITE 0x54 60 60 #define CMD_HEADER_READ 0x53 61 61 #define CMD_HEADER_6B_READ 0x5B 62 + #define CMD_HEADER_ROM_READ 0x96 62 63 #define CMD_HEADER_RESP 0x52 63 64 #define CMD_HEADER_6B_RESP 0x9B 65 + #define CMD_HEADER_ROM_RESP 0x95 64 66 #define CMD_HEADER_HELLO 0x55 65 67 #define CMD_HEADER_REK 0x66 66 68 ··· 200 198 201 199 case CMD_HEADER_6B_READ: 202 200 expected_response = CMD_HEADER_6B_RESP; 201 + break; 202 + 203 + case CMD_HEADER_ROM_READ: 204 + expected_response = CMD_HEADER_ROM_RESP; 203 205 break; 204 206 205 207 default: ··· 562 556 563 557 /* hw version is available even if device in recovery state */ 564 558 error2 = elants_i2c_query_hw_version(ts); 559 + if (!error2) 560 + error2 = elants_i2c_query_bc_version(ts); 565 561 if (!error) 566 562 error = error2; 567 563 ··· 571 563 error = elants_i2c_query_fw_version(ts); 572 564 if (!error) 573 565 error = elants_i2c_query_test_version(ts); 574 - if (!error) 575 - error = elants_i2c_query_bc_version(ts); 576 566 if (!error) 577 567 error = elants_i2c_query_ts_info(ts); 578 568 ··· 619 613 return error; 620 614 } 621 615 616 + static int elants_i2c_validate_remark_id(struct elants_data *ts, 617 + const struct firmware *fw) 618 + { 619 + struct i2c_client *client = ts->client; 620 + int error; 621 + const u8 cmd[] = { CMD_HEADER_ROM_READ, 0x80, 0x1F, 0x00, 0x00, 0x21 }; 622 + u8 resp[6] = { 0 }; 623 + u16 ts_remark_id = 0; 624 + u16 fw_remark_id = 0; 625 + 626 + /* Compare TS Remark ID and FW Remark ID */ 627 + error = elants_i2c_execute_command(client, cmd, sizeof(cmd), 628 + resp, sizeof(resp)); 629 + if (error) { 630 + dev_err(&client->dev, "failed to query Remark ID: %d\n", error); 631 + return error; 632 + } 633 + 634 + ts_remark_id = get_unaligned_be16(&resp[3]); 635 + 636 + fw_remark_id = get_unaligned_le16(&fw->data[fw->size - 4]); 637 + 638 + if (fw_remark_id != ts_remark_id) { 639 + dev_err(&client->dev, 640 + "Remark ID Mismatched: ts_remark_id=0x%04x, fw_remark_id=0x%04x.\n", 641 + ts_remark_id, fw_remark_id); 642 + return -EINVAL; 643 + } 644 + 645 + return 0; 646 + } 647 + 622 648 static int elants_i2c_do_update_firmware(struct i2c_client *client, 623 649 const struct firmware *fw, 624 650 bool force) 625 651 { 652 + struct elants_data *ts = i2c_get_clientdata(client); 626 653 const u8 enter_iap[] = { 0x45, 0x49, 0x41, 0x50 }; 627 654 const u8 enter_iap2[] = { 0x54, 0x00, 0x12, 0x34 }; 628 655 const u8 iap_ack[] = { 0x55, 0xaa, 0x33, 0xcc }; 629 - const u8 close_idle[] = {0x54, 0x2c, 0x01, 0x01}; 656 + const u8 close_idle[] = { 0x54, 0x2c, 0x01, 0x01 }; 630 657 u8 buf[HEADER_SIZE]; 631 658 u16 send_id; 632 659 int page, n_fw_pages; 633 660 int error; 661 + bool check_remark_id = ts->iap_version >= 0x60; 634 662 635 663 /* Recovery mode detection! */ 636 664 if (force) { 637 665 dev_dbg(&client->dev, "Recovery mode procedure\n"); 666 + 667 + if (check_remark_id) { 668 + error = elants_i2c_validate_remark_id(ts, fw); 669 + if (error) 670 + return error; 671 + } 672 + 638 673 error = elants_i2c_send(client, enter_iap2, sizeof(enter_iap2)); 674 + if (error) { 675 + dev_err(&client->dev, "failed to enter IAP mode: %d\n", 676 + error); 677 + return error; 678 + } 639 679 } else { 640 680 /* Start IAP Procedure */ 641 681 dev_dbg(&client->dev, "Normal IAP procedure\n"); 682 + 642 683 /* Close idle mode */ 643 684 error = elants_i2c_send(client, close_idle, sizeof(close_idle)); 644 685 if (error) 645 686 dev_err(&client->dev, "Failed close idle: %d\n", error); 646 687 msleep(60); 688 + 647 689 elants_i2c_sw_reset(client); 648 690 msleep(20); 649 - error = elants_i2c_send(client, enter_iap, sizeof(enter_iap)); 650 - } 651 691 652 - if (error) { 653 - dev_err(&client->dev, "failed to enter IAP mode: %d\n", error); 654 - return error; 692 + if (check_remark_id) { 693 + error = elants_i2c_validate_remark_id(ts, fw); 694 + if (error) 695 + return error; 696 + } 697 + 698 + error = elants_i2c_send(client, enter_iap, sizeof(enter_iap)); 699 + if (error) { 700 + dev_err(&client->dev, "failed to enter IAP mode: %d\n", 701 + error); 702 + return error; 703 + } 655 704 } 656 705 657 706 msleep(20);