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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull input subsystem updates from Dmitry Torokhov:
"You will get the following new drivers:

- Qualcomm PM8941 power key drver
- ChipOne icn8318 touchscreen controller driver
- Broadcom iProc touchscreen and keypad drivers
- Semtech SX8654 I2C touchscreen controller driver

ALPS driver now supports newer SS4 devices; Elantech got a fix that
should make it work on some ASUS laptops; and a slew of other
enhancements and random fixes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (51 commits)
Input: alps - non interleaved V2 dualpoint has separate stick button bits
Input: alps - fix touchpad buttons getting stuck when used with trackpoint
Input: atkbd - document "no new force-release quirks" policy
Input: ALPS - make alps_get_pkt_id_ss4_v2() and others static
Input: ALPS - V7 devices can report 5-finger taps
Input: ALPS - add support for SS4 touchpad devices
Input: ALPS - refactor alps_set_abs_params_mt()
Input: elantech - fix absolute mode setting on some ASUS laptops
Input: atmel_mxt_ts - split out touchpad initialisation logic
Input: atmel_mxt_ts - implement support for T100 touch object
Input: cros_ec_keyb - fix clearing keyboard state on wakeup
Input: gscps2 - drop pci_ids dependency
Input: synaptics - allocate 3 slots to keep stability in image sensors
Input: Revert "Revert "synaptics - use dmax in input_mt_assign_slots""
Input: MT - make slot assignment work for overcovered solutions
mfd: tc3589x: enforce device-tree only mode
Input: tc3589x - localize platform data
Input: tsc2007 - Convert msecs to jiffies only once
Input: edt-ft5x06 - remove EV_SYN event report
Input: edt-ft5x06 - allow to setting the maximum axes value through the DT
...

+3967 -241
+108
Documentation/devicetree/bindings/input/brcm,bcm-keypad.txt
··· 1 + * Broadcom Keypad Controller device tree bindings 2 + 3 + Broadcom Keypad controller is used to interface a SoC with a matrix-type 4 + keypad device. The keypad controller supports multiple row and column lines. 5 + A key can be placed at each intersection of a unique row and a unique column. 6 + The keypad controller can sense a key-press and key-release and report the 7 + event using a interrupt to the cpu. 8 + 9 + This binding is based on the matrix-keymap binding with the following 10 + changes: 11 + 12 + keypad,num-rows and keypad,num-columns are required. 13 + 14 + Required SoC Specific Properties: 15 + - compatible: should be "brcm,bcm-keypad" 16 + 17 + - reg: physical base address of the controller and length of memory mapped 18 + region. 19 + 20 + - interrupts: The interrupt number to the cpu. 21 + 22 + Board Specific Properties: 23 + - keypad,num-rows: Number of row lines connected to the keypad 24 + controller. 25 + 26 + - keypad,num-columns: Number of column lines connected to the 27 + keypad controller. 28 + 29 + - col-debounce-filter-period: The debounce period for the Column filter. 30 + 31 + KEYPAD_DEBOUNCE_1_ms = 0 32 + KEYPAD_DEBOUNCE_2_ms = 1 33 + KEYPAD_DEBOUNCE_4_ms = 2 34 + KEYPAD_DEBOUNCE_8_ms = 3 35 + KEYPAD_DEBOUNCE_16_ms = 4 36 + KEYPAD_DEBOUNCE_32_ms = 5 37 + KEYPAD_DEBOUNCE_64_ms = 6 38 + KEYPAD_DEBOUNCE_128_ms = 7 39 + 40 + - status-debounce-filter-period: The debounce period for the Status filter. 41 + 42 + KEYPAD_DEBOUNCE_1_ms = 0 43 + KEYPAD_DEBOUNCE_2_ms = 1 44 + KEYPAD_DEBOUNCE_4_ms = 2 45 + KEYPAD_DEBOUNCE_8_ms = 3 46 + KEYPAD_DEBOUNCE_16_ms = 4 47 + KEYPAD_DEBOUNCE_32_ms = 5 48 + KEYPAD_DEBOUNCE_64_ms = 6 49 + KEYPAD_DEBOUNCE_128_ms = 7 50 + 51 + - row-output-enabled: An optional property indicating whether the row or 52 + column is being used as output. If specified the row is being used 53 + as the output. Else defaults to column. 54 + 55 + - pull-up-enabled: An optional property indicating the Keypad scan mode. 56 + If specified implies the keypad scan pull-up has been enabled. 57 + 58 + - autorepeat: Boolean, Enable auto repeat feature of Linux input 59 + subsystem (optional). 60 + 61 + - linux,keymap: The keymap for keys as described in the binding document 62 + devicetree/bindings/input/matrix-keymap.txt. 63 + 64 + Example: 65 + #include "dt-bindings/input/input.h" 66 + 67 + / { 68 + keypad: keypad@180ac000 { 69 + /* Required SoC specific properties */ 70 + compatible = "brcm,bcm-keypad"; 71 + 72 + /* Required Board specific properties */ 73 + keypad,num-rows = <5>; 74 + keypad,num-columns = <5>; 75 + status = "okay"; 76 + 77 + linux,keymap = <MATRIX_KEY(0x00, 0x02, KEY_F) /* key_forward */ 78 + MATRIX_KEY(0x00, 0x03, KEY_HOME) /* key_home */ 79 + MATRIX_KEY(0x00, 0x04, KEY_M) /* key_message */ 80 + MATRIX_KEY(0x01, 0x00, KEY_A) /* key_contacts */ 81 + MATRIX_KEY(0x01, 0x01, KEY_1) /* key_1 */ 82 + MATRIX_KEY(0x01, 0x02, KEY_2) /* key_2 */ 83 + MATRIX_KEY(0x01, 0x03, KEY_3) /* key_3 */ 84 + MATRIX_KEY(0x01, 0x04, KEY_S) /* key_speaker */ 85 + MATRIX_KEY(0x02, 0x00, KEY_P) /* key_phone */ 86 + MATRIX_KEY(0x02, 0x01, KEY_4) /* key_4 */ 87 + MATRIX_KEY(0x02, 0x02, KEY_5) /* key_5 */ 88 + MATRIX_KEY(0x02, 0x03, KEY_6) /* key_6 */ 89 + MATRIX_KEY(0x02, 0x04, KEY_VOLUMEUP) /* key_vol_up */ 90 + MATRIX_KEY(0x03, 0x00, KEY_C) /* key_call_log */ 91 + MATRIX_KEY(0x03, 0x01, KEY_7) /* key_7 */ 92 + MATRIX_KEY(0x03, 0x02, KEY_8) /* key_8 */ 93 + MATRIX_KEY(0x03, 0x03, KEY_9) /* key_9 */ 94 + MATRIX_KEY(0x03, 0x04, KEY_VOLUMEDOWN) /* key_vol_down */ 95 + MATRIX_KEY(0x04, 0x00, KEY_H) /* key_headset */ 96 + MATRIX_KEY(0x04, 0x01, KEY_KPASTERISK) /* key_* */ 97 + MATRIX_KEY(0x04, 0x02, KEY_0) /* key_0 */ 98 + MATRIX_KEY(0x04, 0x03, KEY_GRAVE) /* key_# */ 99 + MATRIX_KEY(0x04, 0x04, KEY_MUTE) /* key_mute */ 100 + >; 101 + 102 + /* Optional board specific properties */ 103 + col-debounce-filter-period = <5>; 104 + row-output-enabled; 105 + pull-up-enabled; 106 + 107 + }; 108 + };
+43
Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.txt
··· 1 + Qualcomm PM8941 PMIC Power Key 2 + 3 + PROPERTIES 4 + 5 + - compatible: 6 + Usage: required 7 + Value type: <string> 8 + Definition: must be one of: 9 + "qcom,pm8941-pwrkey" 10 + 11 + - reg: 12 + Usage: required 13 + Value type: <prop-encoded-array> 14 + Definition: base address of registers for block 15 + 16 + - interrupts: 17 + Usage: required 18 + Value type: <prop-encoded-array> 19 + Definition: key change interrupt; The format of the specifier is 20 + defined by the binding document describing the node's 21 + interrupt parent. 22 + 23 + - debounce: 24 + Usage: optional 25 + Value type: <u32> 26 + Definition: time in microseconds that key must be pressed or released 27 + for state change interrupt to trigger. 28 + 29 + - bias-pull-up: 30 + Usage: optional 31 + Value type: <empty> 32 + Definition: presence of this property indicates that the KPDPWR_N pin 33 + should be configured for pull up. 34 + 35 + EXAMPLE 36 + 37 + pwrkey@800 { 38 + compatible = "qcom,pm8941-pwrkey"; 39 + reg = <0x800>; 40 + interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>; 41 + debounce = <15625>; 42 + bias-pull-up; 43 + };
+76
Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt
··· 1 + * Broadcom's IPROC Touchscreen Controller 2 + 3 + Required properties: 4 + - compatible: must be "brcm,iproc-touchscreen" 5 + - reg: physical base address of the controller and length of memory mapped 6 + region. 7 + - clocks: The clock provided by the SOC to driver the tsc 8 + - clock-name: name for the clock 9 + - interrupts: The touchscreen controller's interrupt 10 + 11 + Optional properties: 12 + - scanning_period: Time between scans. Each step is 1024 us. Valid 1-256. 13 + - debounce_timeout: Each step is 512 us. Valid 0-255 14 + - settling_timeout: The settling duration (in ms) is the amount of time 15 + the tsc waits to allow the voltage to settle after 16 + turning on the drivers in detection mode. 17 + Valid values: 0-11 18 + 0 = 0.008 ms 19 + 1 = 0.01 ms 20 + 2 = 0.02 ms 21 + 3 = 0.04 ms 22 + 4 = 0.08 ms 23 + 5 = 0.16 ms 24 + 6 = 0.32 ms 25 + 7 = 0.64 ms 26 + 8 = 1.28 ms 27 + 9 = 2.56 ms 28 + 10 = 5.12 ms 29 + 11 = 10.24 ms 30 + - touch_timeout: The continuous number of scan periods in which touch is 31 + not detected before the controller returns to idle state. 32 + Valid values 0-255. 33 + - average_data: Number of data samples which are averaged before a final 34 + data point is placed into the FIFO 35 + Valid values 0-7 36 + 0 = 1 sample 37 + 1 = 2 samples 38 + 2 = 4 samples 39 + 3 = 8 samples 40 + 4 = 16 samples 41 + 5 = 32 samples 42 + 6 = 64 samples 43 + 7 = 128 samples 44 + - fifo_threshold: Interrupt is generated whenever the number of fifo 45 + entries exceeds this value 46 + Valid values 0-31 47 + - touchscreen-size-x: horizontal resolution of touchscreen (in pixels) 48 + - touchscreen-size-y: vertical resolution of touchscreen (in pixels) 49 + - touchscreen-fuzz-x: horizontal noise value of the absolute input 50 + device (in pixels) 51 + - touchscreen-fuzz-y: vertical noise value of the absolute input 52 + device (in pixels) 53 + - touchscreen-inverted-x: X axis is inverted (boolean) 54 + - touchscreen-inverted-y: Y axis is inverted (boolean) 55 + 56 + Example: 57 + 58 + touchscreen: tsc@0x180A6000 { 59 + compatible = "brcm,iproc-touchscreen"; 60 + #address-cells = <1>; 61 + #size-cells = <1>; 62 + reg = <0x180A6000 0x40>; 63 + clocks = <&adc_clk>; 64 + clock-names = "tsc_clk"; 65 + interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>; 66 + 67 + scanning_period = <5>; 68 + debounce_timeout = <40>; 69 + settling_timeout = <7>; 70 + touch_timeout = <10>; 71 + average_data = <5>; 72 + fifo_threshold = <1>; 73 + /* Touchscreen is rotated 180 degrees. */ 74 + touchscreen-inverted-x; 75 + touchscreen-inverted-y; 76 + };
+46
Documentation/devicetree/bindings/input/touchscreen/chipone_icn8318.txt
··· 1 + * ChipOne icn8318 I2C touchscreen controller 2 + 3 + Required properties: 4 + - compatible : "chipone,icn8318" 5 + - reg : I2C slave address of the chip (0x40) 6 + - interrupt-parent : a phandle pointing to the interrupt controller 7 + serving the interrupt for this chip 8 + - interrupts : interrupt specification for the icn8318 interrupt 9 + - wake-gpios : GPIO specification for the WAKE input 10 + - touchscreen-size-x : horizontal resolution of touchscreen (in pixels) 11 + - touchscreen-size-y : vertical resolution of touchscreen (in pixels) 12 + 13 + Optional properties: 14 + - pinctrl-names : should be "default" 15 + - pinctrl-0: : a phandle pointing to the pin settings for the 16 + control gpios 17 + - touchscreen-fuzz-x : horizontal noise value of the absolute input 18 + device (in pixels) 19 + - touchscreen-fuzz-y : vertical noise value of the absolute input 20 + device (in pixels) 21 + - touchscreen-inverted-x : X axis is inverted (boolean) 22 + - touchscreen-inverted-y : Y axis is inverted (boolean) 23 + - touchscreen-swapped-x-y : X and Y axis are swapped (boolean) 24 + Swapping is done after inverting the axis 25 + 26 + Example: 27 + 28 + i2c@00000000 { 29 + /* ... */ 30 + 31 + chipone_icn8318@40 { 32 + compatible = "chipone,icn8318"; 33 + reg = <0x40>; 34 + interrupt-parent = <&pio>; 35 + interrupts = <9 IRQ_TYPE_EDGE_FALLING>; /* EINT9 (PG9) */ 36 + pinctrl-names = "default"; 37 + pinctrl-0 = <&ts_wake_pin_p66>; 38 + wake-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* PB3 */ 39 + touchscreen-size-x = <800>; 40 + touchscreen-size-y = <480>; 41 + touchscreen-inverted-x; 42 + touchscreen-swapped-x-y; 43 + }; 44 + 45 + /* ... */ 46 + };
+29
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,gt911" 6 + or "goodix,gt9110" 7 + or "goodix,gt912" 8 + or "goodix,gt927" 9 + or "goodix,gt9271" 10 + or "goodix,gt928" 11 + or "goodix,gt967" 12 + - reg : I2C address of the chip. Should be 0x5d or 0x14 13 + - interrupt-parent : Interrupt controller to which the chip is connected 14 + - interrupts : Interrupt to which the chip is connected 15 + 16 + Example: 17 + 18 + i2c@00000000 { 19 + /* ... */ 20 + 21 + gt928@5d { 22 + compatible = "goodix,gt928"; 23 + reg = <0x5d>; 24 + interrupt-parent = <&gpio>; 25 + interrupts = <0 0>; 26 + }; 27 + 28 + /* ... */ 29 + };
+19 -3
Documentation/devicetree/bindings/input/touchscreen/sun4i.txt
··· 2 2 -------------------------------------- 3 3 4 4 Required properties: 5 - - compatible: "allwinner,sun4i-a10-ts" or "allwinner,sun6i-a31-ts" 5 + - compatible: "allwinner,sun4i-a10-ts", "allwinner,sun5i-a13-ts" or 6 + "allwinner,sun6i-a31-ts" 6 7 - reg: mmio address range of the chip 7 8 - interrupts: interrupt to which the chip is connected 8 9 - #thermal-sensor-cells: shall be 0 9 10 10 11 Optional properties: 11 - - allwinner,ts-attached: boolean indicating that an actual touchscreen is 12 - attached to the controller 12 + - allwinner,ts-attached : boolean indicating that an actual touchscreen 13 + is attached to the controller 14 + - allwinner,tp-sensitive-adjust : integer (4 bits) 15 + adjust sensitivity of pen down detection 16 + between 0 (least sensitive) and 15 17 + (defaults to 15) 18 + - allwinner,filter-type : integer (2 bits) 19 + select median and averaging filter 20 + samples used for median / averaging filter 21 + 0: 4/2 22 + 1: 5/3 23 + 2: 8/4 24 + 3: 16/8 25 + (defaults to 1) 13 26 14 27 Example: 15 28 ··· 32 19 interrupts = <29>; 33 20 allwinner,ts-attached; 34 21 #thermal-sensor-cells = <0>; 22 + /* sensitive/noisy touch panel */ 23 + allwinner,tp-sensitive-adjust = <0>; 24 + allwinner,filter-type = <3>; 35 25 };
+16
Documentation/devicetree/bindings/input/touchscreen/sx8654.txt
··· 1 + * Semtech SX8654 I2C Touchscreen Controller 2 + 3 + Required properties: 4 + - compatible: must be "semtech,sx8654" 5 + - reg: i2c slave address 6 + - interrupt-parent: the phandle for the interrupt controller 7 + - interrupts: touch controller interrupt 8 + 9 + Example: 10 + 11 + sx8654@48 { 12 + compatible = "semtech,sx8654"; 13 + reg = <0x48>; 14 + interrupt-parent = <&gpio6>; 15 + interrupts = <3 IRQ_TYPE_EDGE_FALLING>; 16 + };
+2
Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
··· 16 16 controller) 17 17 - touchscreen-inverted-x : X axis is inverted (boolean) 18 18 - touchscreen-inverted-y : Y axis is inverted (boolean) 19 + - touchscreen-swapped-x-y : X and Y axis are swapped (boolean) 20 + Swapping is done after inverting the axis 19 21 20 22 Deprecated properties for Touchscreens: 21 23 - x-size : deprecated name for touchscreen-size-x
+2
Documentation/devicetree/bindings/vendor-prefixes.txt
··· 37 37 cavium Cavium, Inc. 38 38 cdns Cadence Design Systems Inc. 39 39 chipidea Chipidea, Inc 40 + chipone ChipOne 40 41 chipspark ChipSPARK 41 42 chrp Common Hardware Reference Platform 42 43 chunghwa Chunghwa Picture Tubes Ltd. ··· 79 78 giantplus Giantplus Technology Co., Ltd. 80 79 globalscale Globalscale Technologies, Inc. 81 80 gmt Global Mixed-mode Technology, Inc. 81 + goodix Shenzhen Huiding Technology Co., Ltd. 82 82 google Google, Inc. 83 83 gumstix Gumstix, Inc. 84 84 gw Gateworks Corporation
+7
MAINTAINERS
··· 2525 2525 S: Maintained 2526 2526 F: drivers/usb/chipidea/ 2527 2527 2528 + CHIPONE ICN8318 I2C TOUCHSCREEN DRIVER 2529 + M: Hans de Goede <hdegoede@redhat.com> 2530 + L: linux-input@vger.kernel.org 2531 + S: Maintained 2532 + F: Documentation/devicetree/bindings/input/touchscreen/chipone_icn8318.txt 2533 + F: drivers/input/touchscreen/chipone_icn8318.c 2534 + 2528 2535 CHROME HARDWARE PLATFORM SUPPORT 2529 2536 M: Olof Johansson <olof@lixom.net> 2530 2537 S: Maintained
+1 -1
drivers/hid/hid-debug.c
··· 815 815 [KEY_DELETEFILE] = "DeleteFile", [KEY_XFER] = "X-fer", 816 816 [KEY_PROG1] = "Prog1", [KEY_PROG2] = "Prog2", 817 817 [KEY_WWW] = "WWW", [KEY_MSDOS] = "MSDOS", 818 - [KEY_COFFEE] = "Coffee", [KEY_DIRECTION] = "Direction", 818 + [KEY_COFFEE] = "Coffee", [KEY_ROTATE_DISPLAY] = "RotateDisplay", 819 819 [KEY_CYCLEWINDOWS] = "CycleWindows", [KEY_MAIL] = "Mail", 820 820 [KEY_BOOKMARKS] = "Bookmarks", [KEY_COMPUTER] = "Computer", 821 821 [KEY_BACK] = "Back", [KEY_FORWARD] = "Forward",
+17 -9
drivers/input/input-mt.c
··· 368 368 int *slots, int num_pos) 369 369 { 370 370 struct input_mt_slot *s; 371 - int *w = mt->red, *p; 371 + int *w = mt->red, j; 372 372 373 - for (p = slots; p != slots + num_pos; p++) 374 - *p = -1; 373 + for (j = 0; j != num_pos; j++) 374 + slots[j] = -1; 375 375 376 376 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { 377 377 if (!input_mt_is_active(s)) 378 378 continue; 379 - for (p = slots; p != slots + num_pos; p++) 380 - if (*w++ < 0) 381 - *p = s - mt->slots; 379 + 380 + for (j = 0; j != num_pos; j++) { 381 + if (w[j] < 0) { 382 + slots[j] = s - mt->slots; 383 + break; 384 + } 385 + } 386 + 387 + w += num_pos; 382 388 } 383 389 384 390 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { 385 391 if (input_mt_is_active(s)) 386 392 continue; 387 - for (p = slots; p != slots + num_pos; p++) 388 - if (*p < 0) { 389 - *p = s - mt->slots; 393 + 394 + for (j = 0; j != num_pos; j++) { 395 + if (slots[j] < 0) { 396 + slots[j] = s - mt->slots; 390 397 break; 391 398 } 399 + } 392 400 } 393 401 } 394 402
+21
drivers/input/keyboard/Kconfig
··· 588 588 To compile this driver as a module, choose M here: the 589 589 module will be called davinci_keyscan. 590 590 591 + config KEYBOARD_IPAQ_MICRO 592 + tristate "Buttons on Micro SoC (iPaq h3100,h3600,h3700)" 593 + depends on MFD_IPAQ_MICRO 594 + help 595 + Say Y to enable support for the buttons attached to 596 + Micro peripheral controller on iPAQ h3100/h3600/h3700 597 + 598 + To compile this driver as a module, choose M here: the 599 + module will be called ipaq-micro-keys. 600 + 591 601 config KEYBOARD_OMAP 592 602 tristate "TI OMAP keypad support" 593 603 depends on ARCH_OMAP1 ··· 695 685 696 686 To compile this driver as a module, choose M here: the 697 687 module will be called cap11xx. 688 + 689 + config KEYBOARD_BCM 690 + tristate "Broadcom keypad driver" 691 + depends on OF && HAVE_CLK 692 + select INPUT_MATRIXKMAP 693 + default ARCH_BCM_CYGNUS 694 + help 695 + Say Y here if you want to use Broadcom keypad. 696 + 697 + To compile this driver as a module, choose M here: the 698 + module will be called bcm-keypad. 698 699 699 700 endif
+2
drivers/input/keyboard/Makefile
··· 10 10 obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o 11 11 obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o 12 12 obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o 13 + obj-$(CONFIG_KEYBOARD_BCM) += bcm-keypad.o 13 14 obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o 14 15 obj-$(CONFIG_KEYBOARD_CAP11XX) += cap11xx.o 15 16 obj-$(CONFIG_KEYBOARD_CLPS711X) += clps711x-keypad.o ··· 24 23 obj-$(CONFIG_KEYBOARD_TCA8418) += tca8418_keypad.o 25 24 obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o 26 25 obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o 26 + obj-$(CONFIG_KEYBOARD_IPAQ_MICRO) += ipaq-micro-keys.o 27 27 obj-$(CONFIG_KEYBOARD_IMX) += imx_keypad.o 28 28 obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o 29 29 obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o
+6
drivers/input/keyboard/atkbd.c
··· 1653 1653 return 1; 1654 1654 } 1655 1655 1656 + /* 1657 + * NOTE: do not add any more "force release" quirks to this table. The 1658 + * task of adjusting list of keys that should be "released" automatically 1659 + * by the driver is now delegated to userspace tools, such as udev, so 1660 + * submit such quirks there. 1661 + */ 1656 1662 static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { 1657 1663 { 1658 1664 .matches = {
+458
drivers/input/keyboard/bcm-keypad.c
··· 1 + /* 2 + * Copyright (C) 2014 Broadcom Corporation 3 + * 4 + * This program is free software; you can redistribute it and/or 5 + * modify it under the terms of the GNU General Public License as 6 + * published by the Free Software Foundation version 2. 7 + * 8 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 9 + * kind, whether express or implied; without even the implied warranty 10 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #include <linux/bitops.h> 15 + #include <linux/clk.h> 16 + #include <linux/gfp.h> 17 + #include <linux/io.h> 18 + #include <linux/input.h> 19 + #include <linux/input/matrix_keypad.h> 20 + #include <linux/interrupt.h> 21 + #include <linux/module.h> 22 + #include <linux/of.h> 23 + #include <linux/platform_device.h> 24 + #include <linux/stddef.h> 25 + #include <linux/types.h> 26 + 27 + #define DEFAULT_CLK_HZ 31250 28 + #define MAX_ROWS 8 29 + #define MAX_COLS 8 30 + 31 + /* Register/field definitions */ 32 + #define KPCR_OFFSET 0x00000080 33 + #define KPCR_MODE 0x00000002 34 + #define KPCR_MODE_SHIFT 1 35 + #define KPCR_MODE_MASK 1 36 + #define KPCR_ENABLE 0x00000001 37 + #define KPCR_STATUSFILTERENABLE 0x00008000 38 + #define KPCR_STATUSFILTERTYPE_SHIFT 12 39 + #define KPCR_COLFILTERENABLE 0x00000800 40 + #define KPCR_COLFILTERTYPE_SHIFT 8 41 + #define KPCR_ROWWIDTH_SHIFT 20 42 + #define KPCR_COLUMNWIDTH_SHIFT 16 43 + 44 + #define KPIOR_OFFSET 0x00000084 45 + #define KPIOR_ROWOCONTRL_SHIFT 24 46 + #define KPIOR_ROWOCONTRL_MASK 0xFF000000 47 + #define KPIOR_COLUMNOCONTRL_SHIFT 16 48 + #define KPIOR_COLUMNOCONTRL_MASK 0x00FF0000 49 + #define KPIOR_COLUMN_IO_DATA_SHIFT 0 50 + 51 + #define KPEMR0_OFFSET 0x00000090 52 + #define KPEMR1_OFFSET 0x00000094 53 + #define KPEMR2_OFFSET 0x00000098 54 + #define KPEMR3_OFFSET 0x0000009C 55 + #define KPEMR_EDGETYPE_BOTH 3 56 + 57 + #define KPSSR0_OFFSET 0x000000A0 58 + #define KPSSR1_OFFSET 0x000000A4 59 + #define KPSSRN_OFFSET(reg_n) (KPSSR0_OFFSET + 4 * (reg_n)) 60 + #define KPIMR0_OFFSET 0x000000B0 61 + #define KPIMR1_OFFSET 0x000000B4 62 + #define KPICR0_OFFSET 0x000000B8 63 + #define KPICR1_OFFSET 0x000000BC 64 + #define KPICRN_OFFSET(reg_n) (KPICR0_OFFSET + 4 * (reg_n)) 65 + #define KPISR0_OFFSET 0x000000C0 66 + #define KPISR1_OFFSET 0x000000C4 67 + 68 + #define KPCR_STATUSFILTERTYPE_MAX 7 69 + #define KPCR_COLFILTERTYPE_MAX 7 70 + 71 + /* Macros to determine the row/column from a bit that is set in SSR0/1. */ 72 + #define BIT_TO_ROW_SSRN(bit_nr, reg_n) (((bit_nr) >> 3) + 4 * (reg_n)) 73 + #define BIT_TO_COL(bit_nr) ((bit_nr) % 8) 74 + 75 + /* Structure representing various run-time entities */ 76 + struct bcm_kp { 77 + void __iomem *base; 78 + int irq; 79 + struct clk *clk; 80 + struct input_dev *input_dev; 81 + unsigned long last_state[2]; 82 + unsigned int n_rows; 83 + unsigned int n_cols; 84 + u32 kpcr; 85 + u32 kpior; 86 + u32 kpemr; 87 + u32 imr0_val; 88 + u32 imr1_val; 89 + }; 90 + 91 + /* 92 + * Returns the keycode from the input device keymap given the row and 93 + * column. 94 + */ 95 + static int bcm_kp_get_keycode(struct bcm_kp *kp, int row, int col) 96 + { 97 + unsigned int row_shift = get_count_order(kp->n_cols); 98 + unsigned short *keymap = kp->input_dev->keycode; 99 + 100 + return keymap[MATRIX_SCAN_CODE(row, col, row_shift)]; 101 + } 102 + 103 + static void bcm_kp_report_keys(struct bcm_kp *kp, int reg_num, int pull_mode) 104 + { 105 + unsigned long state, change; 106 + int bit_nr; 107 + int key_press; 108 + int row, col; 109 + unsigned int keycode; 110 + 111 + /* Clear interrupts */ 112 + writel(0xFFFFFFFF, kp->base + KPICRN_OFFSET(reg_num)); 113 + 114 + state = readl(kp->base + KPSSRN_OFFSET(reg_num)); 115 + change = kp->last_state[reg_num] ^ state; 116 + kp->last_state[reg_num] = state; 117 + 118 + for_each_set_bit(bit_nr, &change, BITS_PER_LONG) { 119 + key_press = state & BIT(bit_nr); 120 + /* The meaning of SSR register depends on pull mode. */ 121 + key_press = pull_mode ? !key_press : key_press; 122 + row = BIT_TO_ROW_SSRN(bit_nr, reg_num); 123 + col = BIT_TO_COL(bit_nr); 124 + keycode = bcm_kp_get_keycode(kp, row, col); 125 + input_report_key(kp->input_dev, keycode, key_press); 126 + } 127 + } 128 + 129 + static irqreturn_t bcm_kp_isr_thread(int irq, void *dev_id) 130 + { 131 + struct bcm_kp *kp = dev_id; 132 + int pull_mode = (kp->kpcr >> KPCR_MODE_SHIFT) & KPCR_MODE_MASK; 133 + int reg_num; 134 + 135 + for (reg_num = 0; reg_num <= 1; reg_num++) 136 + bcm_kp_report_keys(kp, reg_num, pull_mode); 137 + 138 + input_sync(kp->input_dev); 139 + 140 + return IRQ_HANDLED; 141 + } 142 + 143 + static int bcm_kp_start(struct bcm_kp *kp) 144 + { 145 + int error; 146 + 147 + if (kp->clk) { 148 + error = clk_prepare_enable(kp->clk); 149 + if (error) 150 + return error; 151 + } 152 + 153 + writel(kp->kpior, kp->base + KPIOR_OFFSET); 154 + 155 + writel(kp->imr0_val, kp->base + KPIMR0_OFFSET); 156 + writel(kp->imr1_val, kp->base + KPIMR1_OFFSET); 157 + 158 + writel(kp->kpemr, kp->base + KPEMR0_OFFSET); 159 + writel(kp->kpemr, kp->base + KPEMR1_OFFSET); 160 + writel(kp->kpemr, kp->base + KPEMR2_OFFSET); 161 + writel(kp->kpemr, kp->base + KPEMR3_OFFSET); 162 + 163 + writel(0xFFFFFFFF, kp->base + KPICR0_OFFSET); 164 + writel(0xFFFFFFFF, kp->base + KPICR1_OFFSET); 165 + 166 + kp->last_state[0] = readl(kp->base + KPSSR0_OFFSET); 167 + kp->last_state[0] = readl(kp->base + KPSSR1_OFFSET); 168 + 169 + writel(kp->kpcr | KPCR_ENABLE, kp->base + KPCR_OFFSET); 170 + 171 + return 0; 172 + } 173 + 174 + static void bcm_kp_stop(const struct bcm_kp *kp) 175 + { 176 + u32 val; 177 + 178 + val = readl(kp->base + KPCR_OFFSET); 179 + val &= ~KPCR_ENABLE; 180 + writel(0, kp->base + KPCR_OFFSET); 181 + writel(0, kp->base + KPIMR0_OFFSET); 182 + writel(0, kp->base + KPIMR1_OFFSET); 183 + writel(0xFFFFFFFF, kp->base + KPICR0_OFFSET); 184 + writel(0xFFFFFFFF, kp->base + KPICR1_OFFSET); 185 + 186 + if (kp->clk) 187 + clk_disable_unprepare(kp->clk); 188 + } 189 + 190 + static int bcm_kp_open(struct input_dev *dev) 191 + { 192 + struct bcm_kp *kp = input_get_drvdata(dev); 193 + 194 + return bcm_kp_start(kp); 195 + } 196 + 197 + static void bcm_kp_close(struct input_dev *dev) 198 + { 199 + struct bcm_kp *kp = input_get_drvdata(dev); 200 + 201 + bcm_kp_stop(kp); 202 + } 203 + 204 + static int bcm_kp_matrix_key_parse_dt(struct bcm_kp *kp) 205 + { 206 + struct device *dev = kp->input_dev->dev.parent; 207 + struct device_node *np = dev->of_node; 208 + int error; 209 + unsigned int dt_val; 210 + unsigned int i; 211 + unsigned int num_rows, col_mask, rows_set; 212 + 213 + /* Initialize the KPCR Keypad Configuration Register */ 214 + kp->kpcr = KPCR_STATUSFILTERENABLE | KPCR_COLFILTERENABLE; 215 + 216 + error = matrix_keypad_parse_of_params(dev, &kp->n_rows, &kp->n_cols); 217 + if (error) { 218 + dev_err(dev, "failed to parse kp params\n"); 219 + return error; 220 + } 221 + 222 + /* Set row width for the ASIC block. */ 223 + kp->kpcr |= (kp->n_rows - 1) << KPCR_ROWWIDTH_SHIFT; 224 + 225 + /* Set column width for the ASIC block. */ 226 + kp->kpcr |= (kp->n_cols - 1) << KPCR_COLUMNWIDTH_SHIFT; 227 + 228 + /* Configure the IMR registers */ 229 + 230 + /* 231 + * IMR registers contain interrupt enable bits for 8x8 matrix 232 + * IMR0 register format: <row3> <row2> <row1> <row0> 233 + * IMR1 register format: <row7> <row6> <row5> <row4> 234 + */ 235 + col_mask = (1 << (kp->n_cols)) - 1; 236 + num_rows = kp->n_rows; 237 + 238 + /* Set column bits in rows 0 to 3 in IMR0 */ 239 + kp->imr0_val = col_mask; 240 + 241 + rows_set = 1; 242 + while (--num_rows && rows_set++ < 4) 243 + kp->imr0_val |= kp->imr0_val << MAX_COLS; 244 + 245 + /* Set column bits in rows 4 to 7 in IMR1 */ 246 + kp->imr1_val = 0; 247 + if (num_rows) { 248 + kp->imr1_val = col_mask; 249 + while (--num_rows) 250 + kp->imr1_val |= kp->imr1_val << MAX_COLS; 251 + } 252 + 253 + /* Initialize the KPEMR Keypress Edge Mode Registers */ 254 + /* Trigger on both edges */ 255 + kp->kpemr = 0; 256 + for (i = 0; i <= 30; i += 2) 257 + kp->kpemr |= (KPEMR_EDGETYPE_BOTH << i); 258 + 259 + /* 260 + * Obtain the Status filter debounce value and verify against the 261 + * possible values specified in the DT binding. 262 + */ 263 + of_property_read_u32(np, "status-debounce-filter-period", &dt_val); 264 + 265 + if (dt_val > KPCR_STATUSFILTERTYPE_MAX) { 266 + dev_err(dev, "Invalid Status filter debounce value %d\n", 267 + dt_val); 268 + return -EINVAL; 269 + } 270 + 271 + kp->kpcr |= dt_val << KPCR_STATUSFILTERTYPE_SHIFT; 272 + 273 + /* 274 + * Obtain the Column filter debounce value and verify against the 275 + * possible values specified in the DT binding. 276 + */ 277 + of_property_read_u32(np, "col-debounce-filter-period", &dt_val); 278 + 279 + if (dt_val > KPCR_COLFILTERTYPE_MAX) { 280 + dev_err(dev, "Invalid Column filter debounce value %d\n", 281 + dt_val); 282 + return -EINVAL; 283 + } 284 + 285 + kp->kpcr |= dt_val << KPCR_COLFILTERTYPE_SHIFT; 286 + 287 + /* 288 + * Determine between the row and column, 289 + * which should be configured as output. 290 + */ 291 + if (of_property_read_bool(np, "row-output-enabled")) { 292 + /* 293 + * Set RowOContrl or ColumnOContrl in KPIOR 294 + * to the number of pins to drive as outputs 295 + */ 296 + kp->kpior = ((1 << kp->n_rows) - 1) << 297 + KPIOR_ROWOCONTRL_SHIFT; 298 + } else { 299 + kp->kpior = ((1 << kp->n_cols) - 1) << 300 + KPIOR_COLUMNOCONTRL_SHIFT; 301 + } 302 + 303 + /* 304 + * Determine if the scan pull up needs to be enabled 305 + */ 306 + if (of_property_read_bool(np, "pull-up-enabled")) 307 + kp->kpcr |= KPCR_MODE; 308 + 309 + dev_dbg(dev, "n_rows=%d n_col=%d kpcr=%x kpior=%x kpemr=%x\n", 310 + kp->n_rows, kp->n_cols, 311 + kp->kpcr, kp->kpior, kp->kpemr); 312 + 313 + return 0; 314 + } 315 + 316 + 317 + static int bcm_kp_probe(struct platform_device *pdev) 318 + { 319 + struct bcm_kp *kp; 320 + struct input_dev *input_dev; 321 + struct resource *res; 322 + int error; 323 + 324 + kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL); 325 + if (!kp) 326 + return -ENOMEM; 327 + 328 + input_dev = devm_input_allocate_device(&pdev->dev); 329 + if (!input_dev) { 330 + dev_err(&pdev->dev, "failed to allocate the input device\n"); 331 + return -ENOMEM; 332 + } 333 + 334 + __set_bit(EV_KEY, input_dev->evbit); 335 + 336 + /* Enable auto repeat feature of Linux input subsystem */ 337 + if (of_property_read_bool(pdev->dev.of_node, "autorepeat")) 338 + __set_bit(EV_REP, input_dev->evbit); 339 + 340 + input_dev->name = pdev->name; 341 + input_dev->phys = "keypad/input0"; 342 + input_dev->dev.parent = &pdev->dev; 343 + input_dev->open = bcm_kp_open; 344 + input_dev->close = bcm_kp_close; 345 + 346 + input_dev->id.bustype = BUS_HOST; 347 + input_dev->id.vendor = 0x0001; 348 + input_dev->id.product = 0x0001; 349 + input_dev->id.version = 0x0100; 350 + 351 + input_set_drvdata(input_dev, kp); 352 + 353 + kp->input_dev = input_dev; 354 + 355 + platform_set_drvdata(pdev, kp); 356 + 357 + error = bcm_kp_matrix_key_parse_dt(kp); 358 + if (error) 359 + return error; 360 + 361 + error = matrix_keypad_build_keymap(NULL, NULL, 362 + kp->n_rows, kp->n_cols, 363 + NULL, input_dev); 364 + if (error) { 365 + dev_err(&pdev->dev, "failed to build keymap\n"); 366 + return error; 367 + } 368 + 369 + /* Get the KEYPAD base address */ 370 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 371 + if (!res) { 372 + dev_err(&pdev->dev, "Missing keypad base address resource\n"); 373 + return -ENODEV; 374 + } 375 + 376 + kp->base = devm_ioremap_resource(&pdev->dev, res); 377 + if (IS_ERR(kp->base)) 378 + return PTR_ERR(kp->base); 379 + 380 + /* Enable clock */ 381 + kp->clk = devm_clk_get(&pdev->dev, "peri_clk"); 382 + if (IS_ERR(kp->clk)) { 383 + error = PTR_ERR(kp->clk); 384 + if (error != -ENOENT) { 385 + if (error != -EPROBE_DEFER) 386 + dev_err(&pdev->dev, "Failed to get clock\n"); 387 + return error; 388 + } 389 + dev_dbg(&pdev->dev, 390 + "No clock specified. Assuming it's enabled\n"); 391 + kp->clk = NULL; 392 + } else { 393 + unsigned int desired_rate; 394 + long actual_rate; 395 + 396 + error = of_property_read_u32(pdev->dev.of_node, 397 + "clock-frequency", &desired_rate); 398 + if (error < 0) 399 + desired_rate = DEFAULT_CLK_HZ; 400 + 401 + actual_rate = clk_round_rate(kp->clk, desired_rate); 402 + if (actual_rate <= 0) 403 + return -EINVAL; 404 + 405 + error = clk_set_rate(kp->clk, actual_rate); 406 + if (error) 407 + return error; 408 + 409 + error = clk_prepare_enable(kp->clk); 410 + if (error) 411 + return error; 412 + } 413 + 414 + /* Put the kp into a known sane state */ 415 + bcm_kp_stop(kp); 416 + 417 + kp->irq = platform_get_irq(pdev, 0); 418 + if (kp->irq < 0) { 419 + dev_err(&pdev->dev, "no IRQ specified\n"); 420 + return -EINVAL; 421 + } 422 + 423 + error = devm_request_threaded_irq(&pdev->dev, kp->irq, 424 + NULL, bcm_kp_isr_thread, 425 + IRQF_ONESHOT, pdev->name, kp); 426 + if (error) { 427 + dev_err(&pdev->dev, "failed to request IRQ\n"); 428 + return error; 429 + } 430 + 431 + error = input_register_device(input_dev); 432 + if (error) { 433 + dev_err(&pdev->dev, "failed to register input device\n"); 434 + return error; 435 + } 436 + 437 + return 0; 438 + } 439 + 440 + static const struct of_device_id bcm_kp_of_match[] = { 441 + { .compatible = "brcm,bcm-keypad" }, 442 + { }, 443 + }; 444 + MODULE_DEVICE_TABLE(of, bcm_kp_of_match); 445 + 446 + static struct platform_driver bcm_kp_device_driver = { 447 + .probe = bcm_kp_probe, 448 + .driver = { 449 + .name = "bcm-keypad", 450 + .of_match_table = of_match_ptr(bcm_kp_of_match), 451 + } 452 + }; 453 + 454 + module_platform_driver(bcm_kp_device_driver); 455 + 456 + MODULE_AUTHOR("Broadcom Corporation"); 457 + MODULE_DESCRIPTION("BCM Keypad Driver"); 458 + MODULE_LICENSE("GPL v2");
+1 -1
drivers/input/keyboard/cros_ec_keyb.c
··· 338 338 * wake source (e.g. the lid is open and the user might press a key to 339 339 * wake) then the key scan buffer should be preserved. 340 340 */ 341 - if (ckdev->ec->was_wake_device) 341 + if (!ckdev->ec->was_wake_device) 342 342 cros_ec_keyb_clear_keyboard(ckdev); 343 343 344 344 return 0;
+168
drivers/input/keyboard/ipaq-micro-keys.c
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify 3 + * it under the terms of the GNU General Public License version 2 as 4 + * published by the Free Software Foundation. 5 + * 6 + * h3600 atmel micro companion support, key subdevice 7 + * based on previous kernel 2.4 version 8 + * Author : Alessandro Gardich <gremlin@gremlin.it> 9 + * Author : Linus Walleij <linus.walleij@linaro.org> 10 + * 11 + */ 12 + #include <linux/module.h> 13 + #include <linux/init.h> 14 + #include <linux/fs.h> 15 + #include <linux/interrupt.h> 16 + #include <linux/sched.h> 17 + #include <linux/pm.h> 18 + #include <linux/sysctl.h> 19 + #include <linux/proc_fs.h> 20 + #include <linux/delay.h> 21 + #include <linux/device.h> 22 + #include <linux/input.h> 23 + #include <linux/platform_device.h> 24 + #include <linux/mfd/ipaq-micro.h> 25 + 26 + struct ipaq_micro_keys { 27 + struct ipaq_micro *micro; 28 + struct input_dev *input; 29 + u16 *codes; 30 + }; 31 + 32 + static const u16 micro_keycodes[] = { 33 + KEY_RECORD, /* 1: Record button */ 34 + KEY_CALENDAR, /* 2: Calendar */ 35 + KEY_ADDRESSBOOK, /* 3: Contacts (looks like Outlook) */ 36 + KEY_MAIL, /* 4: Envelope (Q on older iPAQs) */ 37 + KEY_HOMEPAGE, /* 5: Start (looks like swoopy arrow) */ 38 + KEY_UP, /* 6: Up */ 39 + KEY_RIGHT, /* 7: Right */ 40 + KEY_LEFT, /* 8: Left */ 41 + KEY_DOWN, /* 9: Down */ 42 + }; 43 + 44 + static void micro_key_receive(void *data, int len, unsigned char *msg) 45 + { 46 + struct ipaq_micro_keys *keys = data; 47 + int key, down; 48 + 49 + down = 0x80 & msg[0]; 50 + key = 0x7f & msg[0]; 51 + 52 + if (key < ARRAY_SIZE(micro_keycodes)) { 53 + input_report_key(keys->input, keys->codes[key], down); 54 + input_sync(keys->input); 55 + } 56 + } 57 + 58 + static void micro_key_start(struct ipaq_micro_keys *keys) 59 + { 60 + spin_lock(&keys->micro->lock); 61 + keys->micro->key = micro_key_receive; 62 + keys->micro->key_data = keys; 63 + spin_unlock(&keys->micro->lock); 64 + } 65 + 66 + static void micro_key_stop(struct ipaq_micro_keys *keys) 67 + { 68 + spin_lock(&keys->micro->lock); 69 + keys->micro->key = NULL; 70 + keys->micro->key_data = NULL; 71 + spin_unlock(&keys->micro->lock); 72 + } 73 + 74 + static int micro_key_open(struct input_dev *input) 75 + { 76 + struct ipaq_micro_keys *keys = input_get_drvdata(input); 77 + 78 + micro_key_start(keys); 79 + 80 + return 0; 81 + } 82 + 83 + static void micro_key_close(struct input_dev *input) 84 + { 85 + struct ipaq_micro_keys *keys = input_get_drvdata(input); 86 + 87 + micro_key_stop(keys); 88 + } 89 + 90 + static int micro_key_probe(struct platform_device *pdev) 91 + { 92 + struct ipaq_micro_keys *keys; 93 + int error; 94 + int i; 95 + 96 + keys = devm_kzalloc(&pdev->dev, sizeof(*keys), GFP_KERNEL); 97 + if (!keys) 98 + return -ENOMEM; 99 + 100 + keys->micro = dev_get_drvdata(pdev->dev.parent); 101 + 102 + keys->input = devm_input_allocate_device(&pdev->dev); 103 + if (!keys->input) 104 + return -ENOMEM; 105 + 106 + keys->input->keycodesize = sizeof(micro_keycodes[0]); 107 + keys->input->keycodemax = ARRAY_SIZE(micro_keycodes); 108 + keys->codes = devm_kmemdup(&pdev->dev, micro_keycodes, 109 + keys->input->keycodesize * keys->input->keycodemax, 110 + GFP_KERNEL); 111 + keys->input->keycode = keys->codes; 112 + 113 + __set_bit(EV_KEY, keys->input->evbit); 114 + for (i = 0; i < ARRAY_SIZE(micro_keycodes); i++) 115 + __set_bit(micro_keycodes[i], keys->input->keybit); 116 + 117 + keys->input->name = "h3600 micro keys"; 118 + keys->input->open = micro_key_open; 119 + keys->input->close = micro_key_close; 120 + input_set_drvdata(keys->input, keys); 121 + 122 + error = input_register_device(keys->input); 123 + if (error) 124 + return error; 125 + 126 + platform_set_drvdata(pdev, keys); 127 + return 0; 128 + } 129 + 130 + static int __maybe_unused micro_key_suspend(struct device *dev) 131 + { 132 + struct ipaq_micro_keys *keys = dev_get_drvdata(dev); 133 + 134 + micro_key_stop(keys); 135 + 136 + return 0; 137 + } 138 + 139 + static int __maybe_unused micro_key_resume(struct device *dev) 140 + { 141 + struct ipaq_micro_keys *keys = dev_get_drvdata(dev); 142 + struct input_dev *input = keys->input; 143 + 144 + mutex_lock(&input->mutex); 145 + 146 + if (input->users) 147 + micro_key_start(keys); 148 + 149 + mutex_unlock(&input->mutex); 150 + 151 + return 0; 152 + } 153 + 154 + static SIMPLE_DEV_PM_OPS(micro_key_dev_pm_ops, 155 + micro_key_suspend, micro_key_resume); 156 + 157 + static struct platform_driver micro_key_device_driver = { 158 + .driver = { 159 + .name = "ipaq-micro-keys", 160 + .pm = &micro_key_dev_pm_ops, 161 + }, 162 + .probe = micro_key_probe, 163 + }; 164 + module_platform_driver(micro_key_device_driver); 165 + 166 + MODULE_LICENSE("GPL"); 167 + MODULE_DESCRIPTION("driver for iPAQ Atmel micro keys"); 168 + MODULE_ALIAS("platform:ipaq-micro-keys");
+26 -7
drivers/input/keyboard/tc3589x-keypad.c
··· 70 70 #define TC3589x_KBD_INT_CLR 0x1 71 71 72 72 /** 73 + * struct tc35893_keypad_platform_data - platform specific keypad data 74 + * @keymap_data: matrix scan code table for keycodes 75 + * @krow: mask for available rows, value is 0xFF 76 + * @kcol: mask for available columns, value is 0xFF 77 + * @debounce_period: platform specific debounce time 78 + * @settle_time: platform specific settle down time 79 + * @irqtype: type of interrupt, falling or rising edge 80 + * @enable_wakeup: specifies if keypad event can wake up system from sleep 81 + * @no_autorepeat: flag for auto repetition 82 + */ 83 + struct tc3589x_keypad_platform_data { 84 + const struct matrix_keymap_data *keymap_data; 85 + u8 krow; 86 + u8 kcol; 87 + u8 debounce_period; 88 + u8 settle_time; 89 + unsigned long irqtype; 90 + bool enable_wakeup; 91 + bool no_autorepeat; 92 + }; 93 + 94 + /** 73 95 * struct tc_keypad - data structure used by keypad driver 74 96 * @tc3589x: pointer to tc35893 75 97 * @input: pointer to input device object ··· 376 354 const struct tc3589x_keypad_platform_data *plat; 377 355 int error, irq; 378 356 379 - plat = tc3589x->pdata->keypad; 380 - if (!plat) { 381 - plat = tc3589x_keypad_of_probe(&pdev->dev); 382 - if (IS_ERR(plat)) { 383 - dev_err(&pdev->dev, "invalid keypad platform data\n"); 384 - return PTR_ERR(plat); 385 - } 357 + plat = tc3589x_keypad_of_probe(&pdev->dev); 358 + if (IS_ERR(plat)) { 359 + dev_err(&pdev->dev, "invalid keypad platform data\n"); 360 + return PTR_ERR(plat); 386 361 } 387 362 388 363 irq = platform_get_irq(pdev, 0);
+24
drivers/input/misc/Kconfig
··· 115 115 To compile this driver as a module, choose M here: the 116 116 module will be called pcspkr. 117 117 118 + config INPUT_PM8941_PWRKEY 119 + tristate "Qualcomm PM8941 power key support" 120 + depends on MFD_SPMI_PMIC 121 + help 122 + Say Y here if you want support for the power key usually found 123 + on boards using a Qualcomm PM8941 compatible PMIC. 124 + 125 + If unsure, say Y. 126 + 127 + To compile this driver as a module, choose M here: the module 128 + will be called pm8941-pwrkey. 129 + 118 130 config INPUT_PM8XXX_VIBRATOR 119 131 tristate "Qualcomm PM8XXX vibrator support" 120 132 depends on MFD_PM8XXX ··· 176 164 177 165 To compile this driver as module, choose M here: the 178 166 module will be called max77693-haptic. 167 + 168 + config INPUT_MAX77843_HAPTIC 169 + tristate "MAXIM MAX77843 haptic controller support" 170 + depends on MFD_MAX77843 && REGULATOR 171 + select INPUT_FF_MEMLESS 172 + help 173 + This option enables support for the haptic controller on 174 + MAXIM MAX77843 chip. The driver supports ff-memless interface 175 + from input framework. 176 + 177 + To compile this driver as module, choose M here: the 178 + module will be called max77843-haptic. 179 179 180 180 config INPUT_MAX8925_ONKEY 181 181 tristate "MAX8925 ONKEY support"
+2
drivers/input/misc/Makefile
··· 39 39 obj-$(CONFIG_INPUT_KXTJ9) += kxtj9.o 40 40 obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o 41 41 obj-$(CONFIG_INPUT_MAX77693_HAPTIC) += max77693-haptic.o 42 + obj-$(CONFIG_INPUT_MAX77843_HAPTIC) += max77843-haptic.o 42 43 obj-$(CONFIG_INPUT_MAX8925_ONKEY) += max8925_onkey.o 43 44 obj-$(CONFIG_INPUT_MAX8997_HAPTIC) += max8997_haptic.o 44 45 obj-$(CONFIG_INPUT_MC13783_PWRBUTTON) += mc13783-pwrbutton.o ··· 50 49 obj-$(CONFIG_INPUT_PCF50633_PMU) += pcf50633-input.o 51 50 obj-$(CONFIG_INPUT_PCF8574) += pcf8574_keypad.o 52 51 obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o 52 + obj-$(CONFIG_INPUT_PM8941_PWRKEY) += pm8941-pwrkey.o 53 53 obj-$(CONFIG_INPUT_PM8XXX_VIBRATOR) += pm8xxx-vibrator.o 54 54 obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY) += pmic8xxx-pwrkey.o 55 55 obj-$(CONFIG_INPUT_POWERMATE) += powermate.o
+358
drivers/input/misc/max77843-haptic.c
··· 1 + /* 2 + * MAXIM MAX77693 Haptic device driver 3 + * 4 + * Copyright (C) 2015 Samsung Electronics 5 + * Author: Jaewon Kim <jaewon02.kim@samsung.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License as published by 9 + * the Free Software Foundation; either version 2 of the License, or 10 + * (at your option) any later version. 11 + */ 12 + 13 + #include <linux/err.h> 14 + #include <linux/i2c.h> 15 + #include <linux/init.h> 16 + #include <linux/input.h> 17 + #include <linux/mfd/max77843-private.h> 18 + #include <linux/module.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/pwm.h> 21 + #include <linux/regmap.h> 22 + #include <linux/regulator/consumer.h> 23 + #include <linux/slab.h> 24 + #include <linux/workqueue.h> 25 + 26 + #define MAX_MAGNITUDE_SHIFT 16 27 + 28 + enum max77843_haptic_motor_type { 29 + MAX77843_HAPTIC_ERM = 0, 30 + MAX77843_HAPTIC_LRA, 31 + }; 32 + 33 + enum max77843_haptic_pwm_divisor { 34 + MAX77843_HAPTIC_PWM_DIVISOR_32 = 0, 35 + MAX77843_HAPTIC_PWM_DIVISOR_64, 36 + MAX77843_HAPTIC_PWM_DIVISOR_128, 37 + MAX77843_HAPTIC_PWM_DIVISOR_256, 38 + }; 39 + 40 + struct max77843_haptic { 41 + struct regmap *regmap_haptic; 42 + struct device *dev; 43 + struct input_dev *input_dev; 44 + struct pwm_device *pwm_dev; 45 + struct regulator *motor_reg; 46 + struct work_struct work; 47 + struct mutex mutex; 48 + 49 + unsigned int magnitude; 50 + unsigned int pwm_duty; 51 + 52 + bool active; 53 + bool suspended; 54 + 55 + enum max77843_haptic_motor_type type; 56 + enum max77843_haptic_pwm_divisor pwm_divisor; 57 + }; 58 + 59 + static int max77843_haptic_set_duty_cycle(struct max77843_haptic *haptic) 60 + { 61 + int delta = (haptic->pwm_dev->period + haptic->pwm_duty) / 2; 62 + int error; 63 + 64 + error = pwm_config(haptic->pwm_dev, delta, haptic->pwm_dev->period); 65 + if (error) { 66 + dev_err(haptic->dev, "failed to configure pwm: %d\n", error); 67 + return error; 68 + } 69 + 70 + return 0; 71 + } 72 + 73 + static int max77843_haptic_bias(struct max77843_haptic *haptic, bool on) 74 + { 75 + int error; 76 + 77 + error = regmap_update_bits(haptic->regmap_haptic, 78 + MAX77843_SYS_REG_MAINCTRL1, 79 + MAX77843_MAINCTRL1_BIASEN_MASK, 80 + on << MAINCTRL1_BIASEN_SHIFT); 81 + if (error) { 82 + dev_err(haptic->dev, "failed to %s bias: %d\n", 83 + on ? "enable" : "disable", error); 84 + return error; 85 + } 86 + 87 + return 0; 88 + } 89 + 90 + static int max77843_haptic_config(struct max77843_haptic *haptic, bool enable) 91 + { 92 + unsigned int value; 93 + int error; 94 + 95 + value = (haptic->type << MCONFIG_MODE_SHIFT) | 96 + (enable << MCONFIG_MEN_SHIFT) | 97 + (haptic->pwm_divisor << MCONFIG_PDIV_SHIFT); 98 + 99 + error = regmap_write(haptic->regmap_haptic, 100 + MAX77843_HAP_REG_MCONFIG, value); 101 + if (error) { 102 + dev_err(haptic->dev, 103 + "failed to update haptic config: %d\n", error); 104 + return error; 105 + } 106 + 107 + return 0; 108 + } 109 + 110 + static int max77843_haptic_enable(struct max77843_haptic *haptic) 111 + { 112 + int error; 113 + 114 + if (haptic->active) 115 + return 0; 116 + 117 + error = pwm_enable(haptic->pwm_dev); 118 + if (error) { 119 + dev_err(haptic->dev, 120 + "failed to enable pwm device: %d\n", error); 121 + return error; 122 + } 123 + 124 + error = max77843_haptic_config(haptic, true); 125 + if (error) 126 + goto err_config; 127 + 128 + haptic->active = true; 129 + 130 + return 0; 131 + 132 + err_config: 133 + pwm_disable(haptic->pwm_dev); 134 + 135 + return error; 136 + } 137 + 138 + static int max77843_haptic_disable(struct max77843_haptic *haptic) 139 + { 140 + int error; 141 + 142 + if (!haptic->active) 143 + return 0; 144 + 145 + error = max77843_haptic_config(haptic, false); 146 + if (error) 147 + return error; 148 + 149 + pwm_disable(haptic->pwm_dev); 150 + 151 + haptic->active = false; 152 + 153 + return 0; 154 + } 155 + 156 + static void max77843_haptic_play_work(struct work_struct *work) 157 + { 158 + struct max77843_haptic *haptic = 159 + container_of(work, struct max77843_haptic, work); 160 + int error; 161 + 162 + mutex_lock(&haptic->mutex); 163 + 164 + if (haptic->suspended) 165 + goto out_unlock; 166 + 167 + if (haptic->magnitude) { 168 + error = max77843_haptic_set_duty_cycle(haptic); 169 + if (error) { 170 + dev_err(haptic->dev, 171 + "failed to set duty cycle: %d\n", error); 172 + goto out_unlock; 173 + } 174 + 175 + error = max77843_haptic_enable(haptic); 176 + if (error) 177 + dev_err(haptic->dev, 178 + "cannot enable haptic: %d\n", error); 179 + } else { 180 + error = max77843_haptic_disable(haptic); 181 + if (error) 182 + dev_err(haptic->dev, 183 + "cannot disable haptic: %d\n", error); 184 + } 185 + 186 + out_unlock: 187 + mutex_unlock(&haptic->mutex); 188 + } 189 + 190 + static int max77843_haptic_play_effect(struct input_dev *dev, void *data, 191 + struct ff_effect *effect) 192 + { 193 + struct max77843_haptic *haptic = input_get_drvdata(dev); 194 + u64 period_mag_multi; 195 + 196 + haptic->magnitude = effect->u.rumble.strong_magnitude; 197 + if (!haptic->magnitude) 198 + haptic->magnitude = effect->u.rumble.weak_magnitude; 199 + 200 + period_mag_multi = (u64)haptic->pwm_dev->period * haptic->magnitude; 201 + haptic->pwm_duty = (unsigned int)(period_mag_multi >> 202 + MAX_MAGNITUDE_SHIFT); 203 + 204 + schedule_work(&haptic->work); 205 + 206 + return 0; 207 + } 208 + 209 + static int max77843_haptic_open(struct input_dev *dev) 210 + { 211 + struct max77843_haptic *haptic = input_get_drvdata(dev); 212 + int error; 213 + 214 + error = max77843_haptic_bias(haptic, true); 215 + if (error) 216 + return error; 217 + 218 + error = regulator_enable(haptic->motor_reg); 219 + if (error) { 220 + dev_err(haptic->dev, 221 + "failed to enable regulator: %d\n", error); 222 + return error; 223 + } 224 + 225 + return 0; 226 + } 227 + 228 + static void max77843_haptic_close(struct input_dev *dev) 229 + { 230 + struct max77843_haptic *haptic = input_get_drvdata(dev); 231 + int error; 232 + 233 + cancel_work_sync(&haptic->work); 234 + max77843_haptic_disable(haptic); 235 + 236 + error = regulator_disable(haptic->motor_reg); 237 + if (error) 238 + dev_err(haptic->dev, 239 + "failed to disable regulator: %d\n", error); 240 + 241 + max77843_haptic_bias(haptic, false); 242 + } 243 + 244 + static int max77843_haptic_probe(struct platform_device *pdev) 245 + { 246 + struct max77843 *max77843 = dev_get_drvdata(pdev->dev.parent); 247 + struct max77843_haptic *haptic; 248 + int error; 249 + 250 + haptic = devm_kzalloc(&pdev->dev, sizeof(*haptic), GFP_KERNEL); 251 + if (!haptic) 252 + return -ENOMEM; 253 + 254 + haptic->regmap_haptic = max77843->regmap; 255 + haptic->dev = &pdev->dev; 256 + haptic->type = MAX77843_HAPTIC_LRA; 257 + haptic->pwm_divisor = MAX77843_HAPTIC_PWM_DIVISOR_128; 258 + 259 + INIT_WORK(&haptic->work, max77843_haptic_play_work); 260 + mutex_init(&haptic->mutex); 261 + 262 + haptic->pwm_dev = devm_pwm_get(&pdev->dev, NULL); 263 + if (IS_ERR(haptic->pwm_dev)) { 264 + dev_err(&pdev->dev, "failed to get pwm device\n"); 265 + return PTR_ERR(haptic->pwm_dev); 266 + } 267 + 268 + haptic->motor_reg = devm_regulator_get_exclusive(&pdev->dev, "haptic"); 269 + if (IS_ERR(haptic->motor_reg)) { 270 + dev_err(&pdev->dev, "failed to get regulator\n"); 271 + return PTR_ERR(haptic->motor_reg); 272 + } 273 + 274 + haptic->input_dev = devm_input_allocate_device(&pdev->dev); 275 + if (!haptic->input_dev) { 276 + dev_err(&pdev->dev, "failed to allocate input device\n"); 277 + return -ENOMEM; 278 + } 279 + 280 + haptic->input_dev->name = "max77843-haptic"; 281 + haptic->input_dev->id.version = 1; 282 + haptic->input_dev->dev.parent = &pdev->dev; 283 + haptic->input_dev->open = max77843_haptic_open; 284 + haptic->input_dev->close = max77843_haptic_close; 285 + input_set_drvdata(haptic->input_dev, haptic); 286 + input_set_capability(haptic->input_dev, EV_FF, FF_RUMBLE); 287 + 288 + error = input_ff_create_memless(haptic->input_dev, NULL, 289 + max77843_haptic_play_effect); 290 + if (error) { 291 + dev_err(&pdev->dev, "failed to create force-feedback\n"); 292 + return error; 293 + } 294 + 295 + error = input_register_device(haptic->input_dev); 296 + if (error) { 297 + dev_err(&pdev->dev, "failed to register input device\n"); 298 + return error; 299 + } 300 + 301 + platform_set_drvdata(pdev, haptic); 302 + 303 + return 0; 304 + } 305 + 306 + static int __maybe_unused max77843_haptic_suspend(struct device *dev) 307 + { 308 + struct platform_device *pdev = to_platform_device(dev); 309 + struct max77843_haptic *haptic = platform_get_drvdata(pdev); 310 + int error; 311 + 312 + error = mutex_lock_interruptible(&haptic->mutex); 313 + if (error) 314 + return error; 315 + 316 + max77843_haptic_disable(haptic); 317 + 318 + haptic->suspended = true; 319 + 320 + mutex_unlock(&haptic->mutex); 321 + 322 + return 0; 323 + } 324 + 325 + static int __maybe_unused max77843_haptic_resume(struct device *dev) 326 + { 327 + struct platform_device *pdev = to_platform_device(dev); 328 + struct max77843_haptic *haptic = platform_get_drvdata(pdev); 329 + unsigned int magnitude; 330 + 331 + mutex_lock(&haptic->mutex); 332 + 333 + haptic->suspended = false; 334 + 335 + magnitude = ACCESS_ONCE(haptic->magnitude); 336 + if (magnitude) 337 + max77843_haptic_enable(haptic); 338 + 339 + mutex_unlock(&haptic->mutex); 340 + 341 + return 0; 342 + } 343 + 344 + static SIMPLE_DEV_PM_OPS(max77843_haptic_pm_ops, 345 + max77843_haptic_suspend, max77843_haptic_resume); 346 + 347 + static struct platform_driver max77843_haptic_driver = { 348 + .driver = { 349 + .name = "max77843-haptic", 350 + .pm = &max77843_haptic_pm_ops, 351 + }, 352 + .probe = max77843_haptic_probe, 353 + }; 354 + module_platform_driver(max77843_haptic_driver); 355 + 356 + MODULE_AUTHOR("Jaewon Kim <jaewon02.kim@samsung.com>"); 357 + MODULE_DESCRIPTION("MAXIM MAX77843 Haptic driver"); 358 + MODULE_LICENSE("GPL");
+8 -27
drivers/input/misc/mma8450.c
··· 174 174 struct mma8450 *m; 175 175 int err; 176 176 177 - m = kzalloc(sizeof(struct mma8450), GFP_KERNEL); 178 - idev = input_allocate_polled_device(); 179 - if (!m || !idev) { 180 - err = -ENOMEM; 181 - goto err_free_mem; 182 - } 177 + m = devm_kzalloc(&c->dev, sizeof(*m), GFP_KERNEL); 178 + if (!m) 179 + return -ENOMEM; 180 + 181 + idev = devm_input_allocate_polled_device(&c->dev); 182 + if (!idev) 183 + return -ENOMEM; 183 184 184 185 m->client = c; 185 186 m->idev = idev; ··· 188 187 idev->private = m; 189 188 idev->input->name = MMA8450_DRV_NAME; 190 189 idev->input->id.bustype = BUS_I2C; 191 - idev->input->dev.parent = &c->dev; 192 190 idev->poll = mma8450_poll; 193 191 idev->poll_interval = POLL_INTERVAL; 194 192 idev->poll_interval_max = POLL_INTERVAL_MAX; ··· 202 202 err = input_register_polled_device(idev); 203 203 if (err) { 204 204 dev_err(&c->dev, "failed to register polled input device\n"); 205 - goto err_free_mem; 205 + return err; 206 206 } 207 207 208 208 i2c_set_clientdata(c, m); 209 - 210 - return 0; 211 - 212 - err_free_mem: 213 - input_free_polled_device(idev); 214 - kfree(m); 215 - return err; 216 - } 217 - 218 - static int mma8450_remove(struct i2c_client *c) 219 - { 220 - struct mma8450 *m = i2c_get_clientdata(c); 221 - struct input_polled_dev *idev = m->idev; 222 - 223 - input_unregister_polled_device(idev); 224 - input_free_polled_device(idev); 225 - kfree(m); 226 209 227 210 return 0; 228 211 } ··· 225 242 static struct i2c_driver mma8450_driver = { 226 243 .driver = { 227 244 .name = MMA8450_DRV_NAME, 228 - .owner = THIS_MODULE, 229 245 .of_match_table = mma8450_dt_ids, 230 246 }, 231 247 .probe = mma8450_probe, 232 - .remove = mma8450_remove, 233 248 .id_table = mma8450_id, 234 249 }; 235 250
+1 -1
drivers/input/misc/palmas-pwrbutton.c
··· 304 304 palmas_pwron_suspend, palmas_pwron_resume); 305 305 306 306 #ifdef CONFIG_OF 307 - static struct of_device_id of_palmas_pwr_match[] = { 307 + static const struct of_device_id of_palmas_pwr_match[] = { 308 308 { .compatible = "ti,palmas-pwrbutton" }, 309 309 { }, 310 310 };
+293
drivers/input/misc/pm8941-pwrkey.c
··· 1 + /* 2 + * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. 3 + * Copyright (c) 2014, Sony Mobile Communications Inc. 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 and 7 + * only version 2 as published by the Free Software Foundation. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + */ 14 + 15 + #include <linux/delay.h> 16 + #include <linux/errno.h> 17 + #include <linux/input.h> 18 + #include <linux/interrupt.h> 19 + #include <linux/kernel.h> 20 + #include <linux/log2.h> 21 + #include <linux/module.h> 22 + #include <linux/of.h> 23 + #include <linux/platform_device.h> 24 + #include <linux/reboot.h> 25 + #include <linux/regmap.h> 26 + 27 + #define PON_REV2 0x01 28 + 29 + #define PON_RT_STS 0x10 30 + #define PON_KPDPWR_N_SET BIT(0) 31 + 32 + #define PON_PS_HOLD_RST_CTL 0x5a 33 + #define PON_PS_HOLD_RST_CTL2 0x5b 34 + #define PON_PS_HOLD_ENABLE BIT(7) 35 + #define PON_PS_HOLD_TYPE_MASK 0x0f 36 + #define PON_PS_HOLD_TYPE_SHUTDOWN 4 37 + #define PON_PS_HOLD_TYPE_HARD_RESET 7 38 + 39 + #define PON_PULL_CTL 0x70 40 + #define PON_KPDPWR_PULL_UP BIT(1) 41 + 42 + #define PON_DBC_CTL 0x71 43 + #define PON_DBC_DELAY_MASK 0x7 44 + 45 + 46 + struct pm8941_pwrkey { 47 + struct device *dev; 48 + int irq; 49 + u32 baseaddr; 50 + struct regmap *regmap; 51 + struct input_dev *input; 52 + 53 + unsigned int revision; 54 + struct notifier_block reboot_notifier; 55 + }; 56 + 57 + static int pm8941_reboot_notify(struct notifier_block *nb, 58 + unsigned long code, void *unused) 59 + { 60 + struct pm8941_pwrkey *pwrkey = container_of(nb, struct pm8941_pwrkey, 61 + reboot_notifier); 62 + unsigned int enable_reg; 63 + unsigned int reset_type; 64 + int error; 65 + 66 + /* PMICs with revision 0 have the enable bit in same register as ctrl */ 67 + if (pwrkey->revision == 0) 68 + enable_reg = PON_PS_HOLD_RST_CTL; 69 + else 70 + enable_reg = PON_PS_HOLD_RST_CTL2; 71 + 72 + error = regmap_update_bits(pwrkey->regmap, 73 + pwrkey->baseaddr + enable_reg, 74 + PON_PS_HOLD_ENABLE, 75 + 0); 76 + if (error) 77 + dev_err(pwrkey->dev, 78 + "unable to clear ps hold reset enable: %d\n", 79 + error); 80 + 81 + /* 82 + * Updates of PON_PS_HOLD_ENABLE requires 3 sleep cycles between 83 + * writes. 84 + */ 85 + usleep_range(100, 1000); 86 + 87 + switch (code) { 88 + case SYS_HALT: 89 + case SYS_POWER_OFF: 90 + reset_type = PON_PS_HOLD_TYPE_SHUTDOWN; 91 + break; 92 + case SYS_RESTART: 93 + default: 94 + reset_type = PON_PS_HOLD_TYPE_HARD_RESET; 95 + break; 96 + }; 97 + 98 + error = regmap_update_bits(pwrkey->regmap, 99 + pwrkey->baseaddr + PON_PS_HOLD_RST_CTL, 100 + PON_PS_HOLD_TYPE_MASK, 101 + reset_type); 102 + if (error) 103 + dev_err(pwrkey->dev, "unable to set ps hold reset type: %d\n", 104 + error); 105 + 106 + error = regmap_update_bits(pwrkey->regmap, 107 + pwrkey->baseaddr + enable_reg, 108 + PON_PS_HOLD_ENABLE, 109 + PON_PS_HOLD_ENABLE); 110 + if (error) 111 + dev_err(pwrkey->dev, "unable to re-set enable: %d\n", error); 112 + 113 + return NOTIFY_DONE; 114 + } 115 + 116 + static irqreturn_t pm8941_pwrkey_irq(int irq, void *_data) 117 + { 118 + struct pm8941_pwrkey *pwrkey = _data; 119 + unsigned int sts; 120 + int error; 121 + 122 + error = regmap_read(pwrkey->regmap, 123 + pwrkey->baseaddr + PON_RT_STS, &sts); 124 + if (error) 125 + return IRQ_HANDLED; 126 + 127 + input_report_key(pwrkey->input, KEY_POWER, !!(sts & PON_KPDPWR_N_SET)); 128 + input_sync(pwrkey->input); 129 + 130 + return IRQ_HANDLED; 131 + } 132 + 133 + static int __maybe_unused pm8941_pwrkey_suspend(struct device *dev) 134 + { 135 + struct pm8941_pwrkey *pwrkey = dev_get_drvdata(dev); 136 + 137 + if (device_may_wakeup(dev)) 138 + enable_irq_wake(pwrkey->irq); 139 + 140 + return 0; 141 + } 142 + 143 + static int __maybe_unused pm8941_pwrkey_resume(struct device *dev) 144 + { 145 + struct pm8941_pwrkey *pwrkey = dev_get_drvdata(dev); 146 + 147 + if (device_may_wakeup(dev)) 148 + disable_irq_wake(pwrkey->irq); 149 + 150 + return 0; 151 + } 152 + 153 + static SIMPLE_DEV_PM_OPS(pm8941_pwr_key_pm_ops, 154 + pm8941_pwrkey_suspend, pm8941_pwrkey_resume); 155 + 156 + static int pm8941_pwrkey_probe(struct platform_device *pdev) 157 + { 158 + struct pm8941_pwrkey *pwrkey; 159 + bool pull_up; 160 + u32 req_delay; 161 + int error; 162 + 163 + if (of_property_read_u32(pdev->dev.of_node, "debounce", &req_delay)) 164 + req_delay = 15625; 165 + 166 + if (req_delay > 2000000 || req_delay == 0) { 167 + dev_err(&pdev->dev, "invalid debounce time: %u\n", req_delay); 168 + return -EINVAL; 169 + } 170 + 171 + pull_up = of_property_read_bool(pdev->dev.of_node, "bias-pull-up"); 172 + 173 + pwrkey = devm_kzalloc(&pdev->dev, sizeof(*pwrkey), GFP_KERNEL); 174 + if (!pwrkey) 175 + return -ENOMEM; 176 + 177 + pwrkey->dev = &pdev->dev; 178 + 179 + pwrkey->regmap = dev_get_regmap(pdev->dev.parent, NULL); 180 + if (!pwrkey->regmap) { 181 + dev_err(&pdev->dev, "failed to locate regmap\n"); 182 + return -ENODEV; 183 + } 184 + 185 + pwrkey->irq = platform_get_irq(pdev, 0); 186 + if (pwrkey->irq < 0) { 187 + dev_err(&pdev->dev, "failed to get irq\n"); 188 + return pwrkey->irq; 189 + } 190 + 191 + error = of_property_read_u32(pdev->dev.of_node, "reg", 192 + &pwrkey->baseaddr); 193 + if (error) 194 + return error; 195 + 196 + error = regmap_read(pwrkey->regmap, pwrkey->baseaddr + PON_REV2, 197 + &pwrkey->revision); 198 + if (error) { 199 + dev_err(&pdev->dev, "failed to set debounce: %d\n", error); 200 + return error; 201 + } 202 + 203 + pwrkey->input = devm_input_allocate_device(&pdev->dev); 204 + if (!pwrkey->input) { 205 + dev_dbg(&pdev->dev, "unable to allocate input device\n"); 206 + return -ENOMEM; 207 + } 208 + 209 + input_set_capability(pwrkey->input, EV_KEY, KEY_POWER); 210 + 211 + pwrkey->input->name = "pm8941_pwrkey"; 212 + pwrkey->input->phys = "pm8941_pwrkey/input0"; 213 + 214 + req_delay = (req_delay << 6) / USEC_PER_SEC; 215 + req_delay = ilog2(req_delay); 216 + 217 + error = regmap_update_bits(pwrkey->regmap, 218 + pwrkey->baseaddr + PON_DBC_CTL, 219 + PON_DBC_DELAY_MASK, 220 + req_delay); 221 + if (error) { 222 + dev_err(&pdev->dev, "failed to set debounce: %d\n", error); 223 + return error; 224 + } 225 + 226 + error = regmap_update_bits(pwrkey->regmap, 227 + pwrkey->baseaddr + PON_PULL_CTL, 228 + PON_KPDPWR_PULL_UP, 229 + pull_up ? PON_KPDPWR_PULL_UP : 0); 230 + if (error) { 231 + dev_err(&pdev->dev, "failed to set pull: %d\n", error); 232 + return error; 233 + } 234 + 235 + error = devm_request_threaded_irq(&pdev->dev, pwrkey->irq, 236 + NULL, pm8941_pwrkey_irq, 237 + IRQF_ONESHOT, 238 + "pm8941_pwrkey", pwrkey); 239 + if (error) { 240 + dev_err(&pdev->dev, "failed requesting IRQ: %d\n", error); 241 + return error; 242 + } 243 + 244 + error = input_register_device(pwrkey->input); 245 + if (error) { 246 + dev_err(&pdev->dev, "failed to register input device: %d\n", 247 + error); 248 + return error; 249 + } 250 + 251 + pwrkey->reboot_notifier.notifier_call = pm8941_reboot_notify, 252 + error = register_reboot_notifier(&pwrkey->reboot_notifier); 253 + if (error) { 254 + dev_err(&pdev->dev, "failed to register reboot notifier: %d\n", 255 + error); 256 + return error; 257 + } 258 + 259 + platform_set_drvdata(pdev, pwrkey); 260 + device_init_wakeup(&pdev->dev, 1); 261 + 262 + return 0; 263 + } 264 + 265 + static int pm8941_pwrkey_remove(struct platform_device *pdev) 266 + { 267 + struct pm8941_pwrkey *pwrkey = platform_get_drvdata(pdev); 268 + 269 + device_init_wakeup(&pdev->dev, 0); 270 + unregister_reboot_notifier(&pwrkey->reboot_notifier); 271 + 272 + return 0; 273 + } 274 + 275 + static const struct of_device_id pm8941_pwr_key_id_table[] = { 276 + { .compatible = "qcom,pm8941-pwrkey" }, 277 + { } 278 + }; 279 + MODULE_DEVICE_TABLE(of, pm8941_pwr_key_id_table); 280 + 281 + static struct platform_driver pm8941_pwrkey_driver = { 282 + .probe = pm8941_pwrkey_probe, 283 + .remove = pm8941_pwrkey_remove, 284 + .driver = { 285 + .name = "pm8941-pwrkey", 286 + .pm = &pm8941_pwr_key_pm_ops, 287 + .of_match_table = of_match_ptr(pm8941_pwr_key_id_table), 288 + }, 289 + }; 290 + module_platform_driver(pm8941_pwrkey_driver); 291 + 292 + MODULE_DESCRIPTION("PM8941 Power Key driver"); 293 + MODULE_LICENSE("GPL v2");
+1 -8
drivers/input/misc/pwm-beeper.c
··· 50 50 } 51 51 52 52 if (value == 0) { 53 - pwm_config(beeper->pwm, 0, 0); 54 53 pwm_disable(beeper->pwm); 55 54 } else { 56 55 period = HZ_TO_NANOSECONDS(value); ··· 168 169 static SIMPLE_DEV_PM_OPS(pwm_beeper_pm_ops, 169 170 pwm_beeper_suspend, pwm_beeper_resume); 170 171 171 - #ifdef CONFIG_PM_SLEEP 172 - #define PWM_BEEPER_PM_OPS (&pwm_beeper_pm_ops) 173 - #else 174 - #define PWM_BEEPER_PM_OPS NULL 175 - #endif 176 - 177 172 #ifdef CONFIG_OF 178 173 static const struct of_device_id pwm_beeper_match[] = { 179 174 { .compatible = "pwm-beeper", }, ··· 180 187 .remove = pwm_beeper_remove, 181 188 .driver = { 182 189 .name = "pwm-beeper", 183 - .pm = PWM_BEEPER_PM_OPS, 190 + .pm = &pwm_beeper_pm_ops, 184 191 .of_match_table = of_match_ptr(pwm_beeper_match), 185 192 }, 186 193 };
+1 -1
drivers/input/misc/regulator-haptic.c
··· 245 245 static SIMPLE_DEV_PM_OPS(regulator_haptic_pm_ops, 246 246 regulator_haptic_suspend, regulator_haptic_resume); 247 247 248 - static struct of_device_id regulator_haptic_dt_match[] = { 248 + static const struct of_device_id regulator_haptic_dt_match[] = { 249 249 { .compatible = "regulator-haptic" }, 250 250 { /* sentinel */ }, 251 251 };
+1 -1
drivers/input/misc/tps65218-pwrbutton.c
··· 106 106 return 0; 107 107 } 108 108 109 - static struct of_device_id of_tps65218_pwr_match[] = { 109 + static const struct of_device_id of_tps65218_pwr_match[] = { 110 110 { .compatible = "ti,tps65218-pwrbutton" }, 111 111 { }, 112 112 };
+364 -17
drivers/input/mouse/alps.c
··· 153 153 ALPS_PROTO_V7, 0x48, 0x48, ALPS_DUALPOINT 154 154 }; 155 155 156 + static const struct alps_protocol_info alps_v8_protocol_data = { 157 + ALPS_PROTO_V8, 0x18, 0x18, 0 158 + }; 159 + 156 160 static void alps_set_abs_params_st(struct alps_data *priv, 157 161 struct input_dev *dev1); 158 162 static void alps_set_abs_params_mt(struct alps_data *priv, 159 163 struct input_dev *dev1); 164 + static void alps_set_abs_params_v7(struct alps_data *priv, 165 + struct input_dev *dev1); 166 + static void alps_set_abs_params_ss4_v2(struct alps_data *priv, 167 + struct input_dev *dev1); 160 168 161 169 /* Packet formats are described in Documentation/input/alps.txt */ 162 170 ··· 249 241 250 242 input_sync(dev2); 251 243 return; 244 + } 245 + 246 + /* Non interleaved V2 dualpoint has separate stick button bits */ 247 + if (priv->proto_version == ALPS_PROTO_V2 && 248 + priv->flags == (ALPS_PASS | ALPS_DUALPOINT)) { 249 + left |= packet[0] & 1; 250 + right |= packet[0] & 2; 251 + middle |= packet[0] & 4; 252 252 } 253 253 254 254 alps_report_buttons(dev, dev2, left, right, middle); ··· 1101 1085 alps_process_touchpad_packet_v7(psmouse); 1102 1086 } 1103 1087 1088 + static unsigned char alps_get_pkt_id_ss4_v2(unsigned char *byte) 1089 + { 1090 + unsigned char pkt_id = SS4_PACKET_ID_IDLE; 1091 + 1092 + if (byte[0] == 0x18 && byte[1] == 0x10 && byte[2] == 0x00 && 1093 + (byte[3] & 0x88) == 0x08 && byte[4] == 0x10 && byte[5] == 0x00) { 1094 + pkt_id = SS4_PACKET_ID_IDLE; 1095 + } else if (!(byte[3] & 0x10)) { 1096 + pkt_id = SS4_PACKET_ID_ONE; 1097 + } else if (!(byte[3] & 0x20)) { 1098 + pkt_id = SS4_PACKET_ID_TWO; 1099 + } else { 1100 + pkt_id = SS4_PACKET_ID_MULTI; 1101 + } 1102 + 1103 + return pkt_id; 1104 + } 1105 + 1106 + static int alps_decode_ss4_v2(struct alps_fields *f, 1107 + unsigned char *p, struct psmouse *psmouse) 1108 + { 1109 + struct alps_data *priv = psmouse->private; 1110 + unsigned char pkt_id; 1111 + unsigned int no_data_x, no_data_y; 1112 + 1113 + pkt_id = alps_get_pkt_id_ss4_v2(p); 1114 + 1115 + /* Current packet is 1Finger coordinate packet */ 1116 + switch (pkt_id) { 1117 + case SS4_PACKET_ID_ONE: 1118 + f->mt[0].x = SS4_1F_X_V2(p); 1119 + f->mt[0].y = SS4_1F_Y_V2(p); 1120 + f->pressure = ((SS4_1F_Z_V2(p)) * 2) & 0x7f; 1121 + f->fingers = 1; 1122 + f->first_mp = 0; 1123 + f->is_mp = 0; 1124 + break; 1125 + 1126 + case SS4_PACKET_ID_TWO: 1127 + if (priv->flags & ALPS_BUTTONPAD) { 1128 + f->mt[0].x = SS4_BTL_MF_X_V2(p, 0); 1129 + f->mt[0].y = SS4_BTL_MF_Y_V2(p, 0); 1130 + f->mt[1].x = SS4_BTL_MF_X_V2(p, 1); 1131 + f->mt[1].y = SS4_BTL_MF_Y_V2(p, 1); 1132 + } else { 1133 + f->mt[0].x = SS4_STD_MF_X_V2(p, 0); 1134 + f->mt[0].y = SS4_STD_MF_Y_V2(p, 0); 1135 + f->mt[1].x = SS4_STD_MF_X_V2(p, 1); 1136 + f->mt[1].y = SS4_STD_MF_Y_V2(p, 1); 1137 + } 1138 + f->pressure = SS4_MF_Z_V2(p, 0) ? 0x30 : 0; 1139 + 1140 + if (SS4_IS_MF_CONTINUE(p)) { 1141 + f->first_mp = 1; 1142 + } else { 1143 + f->fingers = 2; 1144 + f->first_mp = 0; 1145 + } 1146 + f->is_mp = 0; 1147 + 1148 + break; 1149 + 1150 + case SS4_PACKET_ID_MULTI: 1151 + if (priv->flags & ALPS_BUTTONPAD) { 1152 + f->mt[2].x = SS4_BTL_MF_X_V2(p, 0); 1153 + f->mt[2].y = SS4_BTL_MF_Y_V2(p, 0); 1154 + f->mt[3].x = SS4_BTL_MF_X_V2(p, 1); 1155 + f->mt[3].y = SS4_BTL_MF_Y_V2(p, 1); 1156 + no_data_x = SS4_MFPACKET_NO_AX_BL; 1157 + no_data_y = SS4_MFPACKET_NO_AY_BL; 1158 + } else { 1159 + f->mt[2].x = SS4_STD_MF_X_V2(p, 0); 1160 + f->mt[2].y = SS4_STD_MF_Y_V2(p, 0); 1161 + f->mt[3].x = SS4_STD_MF_X_V2(p, 1); 1162 + f->mt[3].y = SS4_STD_MF_Y_V2(p, 1); 1163 + no_data_x = SS4_MFPACKET_NO_AX; 1164 + no_data_y = SS4_MFPACKET_NO_AY; 1165 + } 1166 + 1167 + f->first_mp = 0; 1168 + f->is_mp = 1; 1169 + 1170 + if (SS4_IS_5F_DETECTED(p)) { 1171 + f->fingers = 5; 1172 + } else if (f->mt[3].x == no_data_x && 1173 + f->mt[3].y == no_data_y) { 1174 + f->mt[3].x = 0; 1175 + f->mt[3].y = 0; 1176 + f->fingers = 3; 1177 + } else { 1178 + f->fingers = 4; 1179 + } 1180 + break; 1181 + 1182 + case SS4_PACKET_ID_IDLE: 1183 + default: 1184 + memset(f, 0, sizeof(struct alps_fields)); 1185 + break; 1186 + } 1187 + 1188 + f->left = !!(SS4_BTN_V2(p) & 0x01); 1189 + if (!(priv->flags & ALPS_BUTTONPAD)) { 1190 + f->right = !!(SS4_BTN_V2(p) & 0x02); 1191 + f->middle = !!(SS4_BTN_V2(p) & 0x04); 1192 + } 1193 + 1194 + return 0; 1195 + } 1196 + 1197 + static void alps_process_packet_ss4_v2(struct psmouse *psmouse) 1198 + { 1199 + struct alps_data *priv = psmouse->private; 1200 + unsigned char *packet = psmouse->packet; 1201 + struct input_dev *dev = psmouse->dev; 1202 + struct alps_fields *f = &priv->f; 1203 + 1204 + memset(f, 0, sizeof(struct alps_fields)); 1205 + priv->decode_fields(f, packet, psmouse); 1206 + if (priv->multi_packet) { 1207 + /* 1208 + * Sometimes the first packet will indicate a multi-packet 1209 + * sequence, but sometimes the next multi-packet would not 1210 + * come. Check for this, and when it happens process the 1211 + * position packet as usual. 1212 + */ 1213 + if (f->is_mp) { 1214 + /* Now process the 1st packet */ 1215 + priv->decode_fields(f, priv->multi_data, psmouse); 1216 + } else { 1217 + priv->multi_packet = 0; 1218 + } 1219 + } 1220 + 1221 + /* 1222 + * "f.is_mp" would always be '0' after merging the 1st and 2nd packet. 1223 + * When it is set, it means 2nd packet comes without 1st packet come. 1224 + */ 1225 + if (f->is_mp) 1226 + return; 1227 + 1228 + /* Save the first packet */ 1229 + if (!priv->multi_packet && f->first_mp) { 1230 + priv->multi_packet = 1; 1231 + memcpy(priv->multi_data, packet, sizeof(priv->multi_data)); 1232 + return; 1233 + } 1234 + 1235 + priv->multi_packet = 0; 1236 + 1237 + alps_report_mt_data(psmouse, (f->fingers <= 4) ? f->fingers : 4); 1238 + 1239 + input_mt_report_finger_count(dev, f->fingers); 1240 + 1241 + input_report_key(dev, BTN_LEFT, f->left); 1242 + input_report_key(dev, BTN_RIGHT, f->right); 1243 + input_report_key(dev, BTN_MIDDLE, f->middle); 1244 + 1245 + input_report_abs(dev, ABS_PRESSURE, f->pressure); 1246 + input_sync(dev); 1247 + } 1248 + 1249 + static bool alps_is_valid_package_ss4_v2(struct psmouse *psmouse) 1250 + { 1251 + if (psmouse->pktcnt == 4 && ((psmouse->packet[3] & 0x08) != 0x08)) 1252 + return false; 1253 + if (psmouse->pktcnt == 6 && ((psmouse->packet[5] & 0x10) != 0x0)) 1254 + return false; 1255 + return true; 1256 + } 1257 + 1104 1258 static DEFINE_MUTEX(alps_mutex); 1105 1259 1106 1260 static void alps_register_bare_ps2_mouse(struct work_struct *work) ··· 1345 1159 bool report_buttons) 1346 1160 { 1347 1161 struct alps_data *priv = psmouse->private; 1348 - struct input_dev *dev; 1162 + struct input_dev *dev, *dev2 = NULL; 1349 1163 1350 1164 /* Figure out which device to use to report the bare packet */ 1351 1165 if (priv->proto_version == ALPS_PROTO_V2 && 1352 1166 (priv->flags & ALPS_DUALPOINT)) { 1353 1167 /* On V2 devices the DualPoint Stick reports bare packets */ 1354 1168 dev = priv->dev2; 1169 + dev2 = psmouse->dev; 1355 1170 } else if (unlikely(IS_ERR_OR_NULL(priv->dev3))) { 1356 1171 /* Register dev3 mouse if we received PS/2 packet first time */ 1357 1172 if (!IS_ERR(priv->dev3)) ··· 1364 1177 } 1365 1178 1366 1179 if (report_buttons) 1367 - alps_report_buttons(dev, NULL, 1180 + alps_report_buttons(dev, dev2, 1368 1181 packet[0] & 1, packet[0] & 2, packet[0] & 4); 1369 1182 1370 1183 input_report_rel(dev, REL_X, ··· 1492 1305 * a device connected to the external PS/2 port. Because bare PS/2 1493 1306 * protocol does not have enough constant bits to self-synchronize 1494 1307 * properly we only do this if the device is fully synchronized. 1308 + * Can not distinguish V8's first byte from PS/2 packet's 1495 1309 */ 1496 - if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) { 1310 + if (priv->proto_version != ALPS_PROTO_V8 && 1311 + !psmouse->out_of_sync_cnt && 1312 + (psmouse->packet[0] & 0xc8) == 0x08) { 1313 + 1497 1314 if (psmouse->pktcnt == 3) { 1498 1315 alps_report_bare_ps2_packet(psmouse, psmouse->packet, 1499 1316 true); ··· 1545 1354 return PSMOUSE_BAD_DATA; 1546 1355 } 1547 1356 1548 - if (priv->proto_version == ALPS_PROTO_V7 && 1549 - !alps_is_valid_package_v7(psmouse)) { 1357 + if ((priv->proto_version == ALPS_PROTO_V7 && 1358 + !alps_is_valid_package_v7(psmouse)) || 1359 + (priv->proto_version == ALPS_PROTO_V8 && 1360 + !alps_is_valid_package_ss4_v2(psmouse))) { 1550 1361 psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", 1551 1362 psmouse->pktcnt - 1, 1552 1363 psmouse->packet[psmouse->pktcnt - 1]); ··· 2323 2130 return -1; 2324 2131 } 2325 2132 2133 + static int alps_get_otp_values_ss4_v2(struct psmouse *psmouse, 2134 + unsigned char index, unsigned char otp[]) 2135 + { 2136 + struct ps2dev *ps2dev = &psmouse->ps2dev; 2137 + 2138 + switch (index) { 2139 + case 0: 2140 + if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSTREAM) || 2141 + ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSTREAM) || 2142 + ps2_command(ps2dev, otp, PSMOUSE_CMD_GETINFO)) 2143 + return -1; 2144 + 2145 + break; 2146 + 2147 + case 1: 2148 + if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETPOLL) || 2149 + ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETPOLL) || 2150 + ps2_command(ps2dev, otp, PSMOUSE_CMD_GETINFO)) 2151 + return -1; 2152 + 2153 + break; 2154 + } 2155 + 2156 + return 0; 2157 + } 2158 + 2159 + static int alps_update_device_area_ss4_v2(unsigned char otp[][4], 2160 + struct alps_data *priv) 2161 + { 2162 + int num_x_electrode; 2163 + int num_y_electrode; 2164 + int x_pitch, y_pitch, x_phys, y_phys; 2165 + 2166 + num_x_electrode = SS4_NUMSENSOR_XOFFSET + (otp[1][0] & 0x0F); 2167 + num_y_electrode = SS4_NUMSENSOR_YOFFSET + ((otp[1][0] >> 4) & 0x0F); 2168 + 2169 + priv->x_max = (num_x_electrode - 1) * SS4_COUNT_PER_ELECTRODE; 2170 + priv->y_max = (num_y_electrode - 1) * SS4_COUNT_PER_ELECTRODE; 2171 + 2172 + x_pitch = ((otp[1][2] >> 2) & 0x07) + SS4_MIN_PITCH_MM; 2173 + y_pitch = ((otp[1][2] >> 5) & 0x07) + SS4_MIN_PITCH_MM; 2174 + 2175 + x_phys = x_pitch * (num_x_electrode - 1); /* In 0.1 mm units */ 2176 + y_phys = y_pitch * (num_y_electrode - 1); /* In 0.1 mm units */ 2177 + 2178 + priv->x_res = priv->x_max * 10 / x_phys; /* units / mm */ 2179 + priv->y_res = priv->y_max * 10 / y_phys; /* units / mm */ 2180 + 2181 + return 0; 2182 + } 2183 + 2184 + static int alps_update_btn_info_ss4_v2(unsigned char otp[][4], 2185 + struct alps_data *priv) 2186 + { 2187 + unsigned char is_btnless; 2188 + 2189 + is_btnless = (otp[1][1] >> 3) & 0x01; 2190 + 2191 + if (is_btnless) 2192 + priv->flags |= ALPS_BUTTONPAD; 2193 + 2194 + return 0; 2195 + } 2196 + 2197 + static int alps_set_defaults_ss4_v2(struct psmouse *psmouse, 2198 + struct alps_data *priv) 2199 + { 2200 + unsigned char otp[2][4]; 2201 + 2202 + memset(otp, 0, sizeof(otp)); 2203 + 2204 + if (alps_get_otp_values_ss4_v2(psmouse, 0, &otp[0][0]) || 2205 + alps_get_otp_values_ss4_v2(psmouse, 1, &otp[1][0])) 2206 + return -1; 2207 + 2208 + alps_update_device_area_ss4_v2(otp, priv); 2209 + 2210 + alps_update_btn_info_ss4_v2(otp, priv); 2211 + 2212 + return 0; 2213 + } 2214 + 2326 2215 static int alps_dolphin_get_device_area(struct psmouse *psmouse, 2327 2216 struct alps_data *priv) 2328 2217 { ··· 2490 2215 goto error; 2491 2216 2492 2217 alps_exit_command_mode(psmouse); 2218 + return ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE); 2219 + 2220 + error: 2221 + alps_exit_command_mode(psmouse); 2222 + return ret; 2223 + } 2224 + 2225 + static int alps_hw_init_ss4_v2(struct psmouse *psmouse) 2226 + { 2227 + struct ps2dev *ps2dev = &psmouse->ps2dev; 2228 + char param[2] = {0x64, 0x28}; 2229 + int ret = -1; 2230 + 2231 + /* enter absolute mode */ 2232 + if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSTREAM) || 2233 + ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSTREAM) || 2234 + ps2_command(ps2dev, &param[0], PSMOUSE_CMD_SETRATE) || 2235 + ps2_command(ps2dev, &param[1], PSMOUSE_CMD_SETRATE)) { 2236 + goto error; 2237 + } 2238 + 2239 + /* T.B.D. Decread noise packet number, delete in the future */ 2240 + if (alps_exit_command_mode(psmouse) || 2241 + alps_enter_command_mode(psmouse) || 2242 + alps_command_mode_write_reg(psmouse, 0x001D, 0x20)) { 2243 + goto error; 2244 + } 2245 + alps_exit_command_mode(psmouse); 2246 + 2493 2247 return ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE); 2494 2248 2495 2249 error: ··· 2615 2311 priv->hw_init = alps_hw_init_v7; 2616 2312 priv->process_packet = alps_process_packet_v7; 2617 2313 priv->decode_fields = alps_decode_packet_v7; 2618 - priv->set_abs_params = alps_set_abs_params_mt; 2314 + priv->set_abs_params = alps_set_abs_params_v7; 2619 2315 priv->nibble_commands = alps_v3_nibble_commands; 2620 2316 priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2621 2317 priv->x_max = 0xfff; ··· 2623 2319 2624 2320 if (priv->fw_ver[1] != 0xba) 2625 2321 priv->flags |= ALPS_BUTTONPAD; 2322 + 2323 + break; 2324 + 2325 + case ALPS_PROTO_V8: 2326 + priv->hw_init = alps_hw_init_ss4_v2; 2327 + priv->process_packet = alps_process_packet_ss4_v2; 2328 + priv->decode_fields = alps_decode_ss4_v2; 2329 + priv->set_abs_params = alps_set_abs_params_ss4_v2; 2330 + priv->nibble_commands = alps_v3_nibble_commands; 2331 + priv->addr_command = PSMOUSE_CMD_RESET_WRAP; 2332 + 2333 + if (alps_set_defaults_ss4_v2(psmouse, priv)) 2334 + return -EIO; 2626 2335 2627 2336 break; 2628 2337 } ··· 2706 2389 } else if (ec[0] == 0x88 && ec[1] == 0x07 && 2707 2390 ec[2] >= 0x90 && ec[2] <= 0x9d) { 2708 2391 protocol = &alps_v3_protocol_data; 2392 + } else if (e7[0] == 0x73 && e7[1] == 0x03 && 2393 + e7[2] == 0x14 && ec[1] == 0x02) { 2394 + protocol = &alps_v8_protocol_data; 2709 2395 } else { 2710 2396 psmouse_dbg(psmouse, 2711 2397 "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec); ··· 2757 2437 { 2758 2438 input_set_abs_params(dev1, ABS_X, 0, priv->x_max, 0, 0); 2759 2439 input_set_abs_params(dev1, ABS_Y, 0, priv->y_max, 0, 0); 2440 + input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); 2760 2441 } 2761 2442 2762 - static void alps_set_abs_params_mt(struct alps_data *priv, 2763 - struct input_dev *dev1) 2443 + static void alps_set_abs_params_mt_common(struct alps_data *priv, 2444 + struct input_dev *dev1) 2764 2445 { 2765 2446 input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, priv->x_max, 0, 0); 2766 2447 input_set_abs_params(dev1, ABS_MT_POSITION_Y, 0, priv->y_max, 0, 0); ··· 2769 2448 input_abs_set_res(dev1, ABS_MT_POSITION_X, priv->x_res); 2770 2449 input_abs_set_res(dev1, ABS_MT_POSITION_Y, priv->y_res); 2771 2450 2772 - input_mt_init_slots(dev1, MAX_TOUCHES, INPUT_MT_POINTER | 2773 - INPUT_MT_DROP_UNUSED | INPUT_MT_TRACK | INPUT_MT_SEMI_MT); 2774 - 2775 2451 set_bit(BTN_TOOL_TRIPLETAP, dev1->keybit); 2776 2452 set_bit(BTN_TOOL_QUADTAP, dev1->keybit); 2453 + } 2777 2454 2778 - /* V7 is real multi-touch */ 2779 - if (priv->proto_version == ALPS_PROTO_V7) 2780 - clear_bit(INPUT_PROP_SEMI_MT, dev1->propbit); 2455 + static void alps_set_abs_params_mt(struct alps_data *priv, 2456 + struct input_dev *dev1) 2457 + { 2458 + alps_set_abs_params_mt_common(priv, dev1); 2459 + input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); 2460 + 2461 + input_mt_init_slots(dev1, MAX_TOUCHES, 2462 + INPUT_MT_POINTER | INPUT_MT_DROP_UNUSED | 2463 + INPUT_MT_TRACK | INPUT_MT_SEMI_MT); 2464 + } 2465 + 2466 + static void alps_set_abs_params_v7(struct alps_data *priv, 2467 + struct input_dev *dev1) 2468 + { 2469 + alps_set_abs_params_mt_common(priv, dev1); 2470 + set_bit(BTN_TOOL_QUINTTAP, dev1->keybit); 2471 + 2472 + input_mt_init_slots(dev1, MAX_TOUCHES, 2473 + INPUT_MT_POINTER | INPUT_MT_DROP_UNUSED | 2474 + INPUT_MT_TRACK); 2475 + 2476 + set_bit(BTN_TOOL_QUINTTAP, dev1->keybit); 2477 + } 2478 + 2479 + static void alps_set_abs_params_ss4_v2(struct alps_data *priv, 2480 + struct input_dev *dev1) 2481 + { 2482 + alps_set_abs_params_mt_common(priv, dev1); 2483 + input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); 2484 + set_bit(BTN_TOOL_QUINTTAP, dev1->keybit); 2485 + 2486 + input_mt_init_slots(dev1, MAX_TOUCHES, 2487 + INPUT_MT_POINTER | INPUT_MT_DROP_UNUSED | 2488 + INPUT_MT_TRACK); 2781 2489 } 2782 2490 2783 2491 int alps_init(struct psmouse *psmouse) ··· 2839 2489 dev1->evbit[BIT_WORD(EV_ABS)] |= BIT_MASK(EV_ABS); 2840 2490 2841 2491 priv->set_abs_params(priv, dev1); 2842 - /* No pressure on V7 */ 2843 - if (priv->proto_version != ALPS_PROTO_V7) 2844 - input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); 2845 2492 2846 2493 if (priv->flags & ALPS_WHEEL) { 2847 2494 dev1->evbit[BIT_WORD(EV_REL)] |= BIT_MASK(EV_REL);
+77 -1
drivers/input/mouse/alps.h
··· 22 22 #define ALPS_PROTO_V5 0x500 23 23 #define ALPS_PROTO_V6 0x600 24 24 #define ALPS_PROTO_V7 0x700 /* t3btl t4s */ 25 + #define ALPS_PROTO_V8 0x800 /* SS4btl SS4s */ 25 26 26 - #define MAX_TOUCHES 2 27 + #define MAX_TOUCHES 4 27 28 28 29 #define DOLPHIN_COUNT_PER_ELECTRODE 64 29 30 #define DOLPHIN_PROFILE_XOFFSET 8 /* x-electrode offset */ 30 31 #define DOLPHIN_PROFILE_YOFFSET 1 /* y-electrode offset */ 32 + 33 + /* 34 + * enum SS4_PACKET_ID - defines the packet type for V8 35 + * SS4_PACKET_ID_IDLE: There's no finger and no button activity. 36 + * SS4_PACKET_ID_ONE: There's one finger on touchpad 37 + * or there's button activities. 38 + * SS4_PACKET_ID_TWO: There's two or more fingers on touchpad 39 + * SS4_PACKET_ID_MULTI: There's three or more fingers on touchpad 40 + */ 41 + enum SS4_PACKET_ID { 42 + SS4_PACKET_ID_IDLE = 0, 43 + SS4_PACKET_ID_ONE, 44 + SS4_PACKET_ID_TWO, 45 + SS4_PACKET_ID_MULTI, 46 + }; 47 + 48 + #define SS4_COUNT_PER_ELECTRODE 256 49 + #define SS4_NUMSENSOR_XOFFSET 7 50 + #define SS4_NUMSENSOR_YOFFSET 7 51 + #define SS4_MIN_PITCH_MM 50 52 + 53 + #define SS4_MASK_NORMAL_BUTTONS 0x07 54 + 55 + #define SS4_1F_X_V2(_b) ((_b[0] & 0x0007) | \ 56 + ((_b[1] << 3) & 0x0078) | \ 57 + ((_b[1] << 2) & 0x0380) | \ 58 + ((_b[2] << 5) & 0x1C00) \ 59 + ) 60 + 61 + #define SS4_1F_Y_V2(_b) (((_b[2]) & 0x000F) | \ 62 + ((_b[3] >> 2) & 0x0030) | \ 63 + ((_b[4] << 6) & 0x03C0) | \ 64 + ((_b[4] << 5) & 0x0C00) \ 65 + ) 66 + 67 + #define SS4_1F_Z_V2(_b) (((_b[5]) & 0x0F) | \ 68 + ((_b[5] >> 1) & 0x70) | \ 69 + ((_b[4]) & 0x80) \ 70 + ) 71 + 72 + #define SS4_1F_LFB_V2(_b) (((_b[2] >> 4) & 0x01) == 0x01) 73 + 74 + #define SS4_MF_LF_V2(_b, _i) ((_b[1 + (_i) * 3] & 0x0004) == 0x0004) 75 + 76 + #define SS4_BTN_V2(_b) ((_b[0] >> 5) & SS4_MASK_NORMAL_BUTTONS) 77 + 78 + #define SS4_STD_MF_X_V2(_b, _i) (((_b[0 + (_i) * 3] << 5) & 0x00E0) | \ 79 + ((_b[1 + _i * 3] << 5) & 0x1F00) \ 80 + ) 81 + 82 + #define SS4_STD_MF_Y_V2(_b, _i) (((_b[1 + (_i) * 3] << 3) & 0x0010) | \ 83 + ((_b[2 + (_i) * 3] << 5) & 0x01E0) | \ 84 + ((_b[2 + (_i) * 3] << 4) & 0x0E00) \ 85 + ) 86 + 87 + #define SS4_BTL_MF_X_V2(_b, _i) (SS4_STD_MF_X_V2(_b, _i) | \ 88 + ((_b[0 + (_i) * 3] >> 3) & 0x0010) \ 89 + ) 90 + 91 + #define SS4_BTL_MF_Y_V2(_b, _i) (SS4_STD_MF_Y_V2(_b, _i) | \ 92 + ((_b[0 + (_i) * 3] >> 3) & 0x0008) \ 93 + ) 94 + 95 + #define SS4_MF_Z_V2(_b, _i) (((_b[1 + (_i) * 3]) & 0x0001) | \ 96 + ((_b[1 + (_i) * 3] >> 1) & 0x0002) \ 97 + ) 98 + 99 + #define SS4_IS_MF_CONTINUE(_b) ((_b[2] & 0x10) == 0x10) 100 + #define SS4_IS_5F_DETECTED(_b) ((_b[2] & 0x10) == 0x10) 101 + 102 + 103 + #define SS4_MFPACKET_NO_AX 8160 /* X-Coordinate value */ 104 + #define SS4_MFPACKET_NO_AY 4080 /* Y-Coordinate value */ 105 + #define SS4_MFPACKET_NO_AX_BL 8176 /* Buttonless X-Coordinate value */ 106 + #define SS4_MFPACKET_NO_AY_BL 4088 /* Buttonless Y-Coordinate value */ 31 107 32 108 /* 33 109 * enum V7_PACKET_ID - defines the packet type for V7
+1 -1
drivers/input/mouse/elan_i2c.h
··· 17 17 */ 18 18 19 19 #ifndef _ELAN_I2C_H 20 - #define _ELAN_i2C_H 20 + #define _ELAN_I2C_H 21 21 22 22 #include <linux/types.h> 23 23
+9 -6
drivers/input/mouse/elan_i2c_core.c
··· 99 99 error = regulator_enable(data->vcc); 100 100 if (error) { 101 101 dev_err(&data->client->dev, 102 - "Failed to enable regulator: %d\n", error); 102 + "failed to enable regulator: %d\n", error); 103 103 return error; 104 104 } 105 105 ··· 111 111 msleep(30); 112 112 } while (--repeat > 0); 113 113 114 + dev_err(&data->client->dev, "failed to enable power: %d\n", error); 114 115 return error; 115 116 } 116 117 ··· 126 125 error = regulator_disable(data->vcc); 127 126 if (error) { 128 127 dev_err(&data->client->dev, 129 - "Failed to disable regulator: %d\n", 128 + "failed to disable regulator: %d\n", 130 129 error); 131 130 /* Attempt to power the chip back up */ 132 131 data->ops->power_control(data->client, true); ··· 139 138 msleep(30); 140 139 } while (--repeat > 0); 141 140 141 + dev_err(&data->client->dev, "failed to disable power: %d\n", error); 142 142 return error; 143 143 } 144 144 ··· 198 196 if (!error) 199 197 return 0; 200 198 201 - repeat--; 202 199 msleep(30); 203 200 } while (--repeat > 0); 204 201 ··· 1085 1084 } 1086 1085 1087 1086 error = elan_enable_power(data); 1088 - if (error) 1087 + if (error) { 1089 1088 dev_err(dev, "power up when resuming failed: %d\n", error); 1089 + goto err; 1090 + } 1090 1091 1091 1092 error = elan_initialize(data); 1092 1093 if (error) 1093 1094 dev_err(dev, "initialize when resuming failed: %d\n", error); 1094 1095 1096 + err: 1095 1097 enable_irq(data->client->irq); 1096 - 1097 - return 0; 1098 + return error; 1098 1099 } 1099 1100 1100 1101 static SIMPLE_DEV_PM_OPS(elan_pm_ops, elan_suspend, elan_resume);
+9 -1
drivers/input/mouse/elan_i2c_i2c.c
··· 117 117 int ret; 118 118 119 119 ret = i2c_transfer(client->adapter, &msg, 1); 120 - return ret == 1 ? 0 : (ret < 0 ? ret : -EIO); 120 + if (ret != 1) { 121 + if (ret >= 0) 122 + ret = -EIO; 123 + dev_err(&client->dev, "writing cmd (0x%04x) failed: %d\n", 124 + reg, ret); 125 + return ret; 126 + } 127 + 128 + return 0; 121 129 } 122 130 123 131 static int elan_i2c_initialize(struct i2c_client *client)
+22
drivers/input/mouse/elantech.c
··· 893 893 } 894 894 895 895 /* 896 + * This writes the reg_07 value again to the hardware at the end of every 897 + * set_rate call because the register loses its value. reg_07 allows setting 898 + * absolute mode on v4 hardware 899 + */ 900 + static void elantech_set_rate_restore_reg_07(struct psmouse *psmouse, 901 + unsigned int rate) 902 + { 903 + struct elantech_data *etd = psmouse->private; 904 + 905 + etd->original_set_rate(psmouse, rate); 906 + if (elantech_write_reg(psmouse, 0x07, etd->reg_07)) 907 + psmouse_err(psmouse, "restoring reg_07 failed\n"); 908 + } 909 + 910 + /* 896 911 * Put the touchpad into absolute mode 897 912 */ 898 913 static int elantech_set_absolute_mode(struct psmouse *psmouse) ··· 1109 1094 * Asus K53SV 0x450f01 78, 15, 0c 2 hw buttons 1110 1095 * Asus G46VW 0x460f02 00, 18, 0c 2 hw buttons 1111 1096 * Asus G750JX 0x360f00 00, 16, 0c 2 hw buttons 1097 + * Asus TP500LN 0x381f17 10, 14, 0e clickpad 1098 + * Asus X750JN 0x381f17 10, 14, 0e clickpad 1112 1099 * Asus UX31 0x361f00 20, 15, 0e clickpad 1113 1100 * Asus UX32VD 0x361f02 00, 15, 0e clickpad 1114 1101 * Avatar AVIU-145A2 0x361f00 ? clickpad ··· 1650 1633 psmouse_err(psmouse, 1651 1634 "failed to put touchpad into absolute mode.\n"); 1652 1635 goto init_fail; 1636 + } 1637 + 1638 + if (etd->fw_version == 0x381f17) { 1639 + etd->original_set_rate = psmouse->set_rate; 1640 + psmouse->set_rate = elantech_set_rate_restore_reg_07; 1653 1641 } 1654 1642 1655 1643 if (elantech_set_input_params(psmouse)) {
+1
drivers/input/mouse/elantech.h
··· 142 142 struct finger_pos mt[ETP_MAX_FINGERS]; 143 143 unsigned char parity[256]; 144 144 int (*send_cmd)(struct psmouse *psmouse, unsigned char c, unsigned char *param); 145 + void (*original_set_rate)(struct psmouse *psmouse, unsigned int rate); 145 146 }; 146 147 147 148 #ifdef CONFIG_MOUSE_PS2_ELANTECH
+3 -3
drivers/input/mouse/lifebook.c
··· 256 256 257 257 int lifebook_detect(struct psmouse *psmouse, bool set_properties) 258 258 { 259 - if (!lifebook_present) 260 - return -1; 259 + if (!lifebook_present) 260 + return -1; 261 261 262 262 if (desired_serio_phys && 263 263 strcmp(psmouse->ps2dev.serio->phys, desired_serio_phys)) ··· 268 268 psmouse->name = "Lifebook TouchScreen"; 269 269 } 270 270 271 - return 0; 271 + return 0; 272 272 } 273 273 274 274 static int lifebook_create_relative_device(struct psmouse *psmouse)
+32 -6
drivers/input/mouse/psmouse-base.c
··· 474 474 PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)); 475 475 } 476 476 477 + static bool psmouse_check_pnp_id(const char *id, const char * const ids[]) 478 + { 479 + int i; 480 + 481 + for (i = 0; ids[i]; i++) 482 + if (!strcasecmp(id, ids[i])) 483 + return true; 484 + 485 + return false; 486 + } 487 + 477 488 /* 478 489 * psmouse_matches_pnp_id - check if psmouse matches one of the passed in ids. 479 490 */ 480 491 bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[]) 481 492 { 482 - int i; 493 + struct serio *serio = psmouse->ps2dev.serio; 494 + char *p, *fw_id_copy, *save_ptr; 495 + bool found = false; 483 496 484 - if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) 485 - for (i = 0; ids[i]; i++) 486 - if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i])) 487 - return true; 497 + if (strncmp(serio->firmware_id, "PNP: ", 5)) 498 + return false; 488 499 489 - return false; 500 + fw_id_copy = kstrndup(&serio->firmware_id[5], 501 + sizeof(serio->firmware_id) - 5, 502 + GFP_KERNEL); 503 + if (!fw_id_copy) 504 + return false; 505 + 506 + save_ptr = fw_id_copy; 507 + while ((p = strsep(&fw_id_copy, " ")) != NULL) { 508 + if (psmouse_check_pnp_id(p, ids)) { 509 + found = true; 510 + break; 511 + } 512 + } 513 + 514 + kfree(save_ptr); 515 + return found; 490 516 } 491 517 492 518 /*
+19 -23
drivers/input/mouse/synaptics.c
··· 67 67 #define X_MAX_POSITIVE 8176 68 68 #define Y_MAX_POSITIVE 8176 69 69 70 + /* maximum ABS_MT_POSITION displacement (in mm) */ 71 + #define DMAX 10 72 + 70 73 /***************************************************************************** 71 74 * Stuff we need even when we do not want native Synaptics support 72 75 ****************************************************************************/ ··· 203 200 "LEN2009", 204 201 "LEN200A", 205 202 "LEN200B", 203 + NULL 204 + }; 205 + 206 + /* This list has been kindly provided by Synaptics. */ 207 + static const char * const forcepad_pnp_ids[] = { 208 + "SYN300D", 209 + "SYN3014", 206 210 NULL 207 211 }; 208 212 ··· 697 687 hw->ext_buttons |= (buf[5] & ext_mask) << ext_bits; 698 688 } 699 689 700 - static bool is_forcepad; 701 - 702 690 static int synaptics_parse_hw_state(const unsigned char buf[], 703 691 struct synaptics_data *priv, 704 692 struct synaptics_hw_state *hw) ··· 726 718 hw->left = (buf[0] & 0x01) ? 1 : 0; 727 719 hw->right = (buf[0] & 0x02) ? 1 : 0; 728 720 729 - if (is_forcepad) { 721 + if (priv->is_forcepad) { 730 722 /* 731 723 * ForcePads, like Clickpads, use middle button 732 724 * bits to report primary button clicks. ··· 925 917 pos[i].y = synaptics_invert_y(hw[i]->y); 926 918 } 927 919 928 - input_mt_assign_slots(dev, slot, pos, nsemi, 0); 920 + input_mt_assign_slots(dev, slot, pos, nsemi, DMAX * priv->x_res); 929 921 930 922 for (i = 0; i < nsemi; i++) { 931 923 input_mt_slot(dev, slot[i]); ··· 1194 1186 ABS_MT_POSITION_Y); 1195 1187 /* Image sensors can report per-contact pressure */ 1196 1188 input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0); 1197 - input_mt_init_slots(dev, 2, INPUT_MT_POINTER | INPUT_MT_TRACK); 1189 + input_mt_init_slots(dev, 3, INPUT_MT_POINTER | INPUT_MT_TRACK); 1198 1190 1199 1191 /* Image sensors can signal 4 and 5 finger clicks */ 1200 1192 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); ··· 1426 1418 { } 1427 1419 }; 1428 1420 1429 - static const struct dmi_system_id forcepad_dmi_table[] __initconst = { 1430 - #if defined(CONFIG_DMI) && defined(CONFIG_X86) 1431 - { 1432 - .matches = { 1433 - DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1434 - DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook Folio 1040 G1"), 1435 - }, 1436 - }, 1437 - #endif 1438 - { } 1439 - }; 1440 - 1441 1421 void __init synaptics_module_init(void) 1442 1422 { 1443 1423 impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); 1444 1424 broken_olpc_ec = dmi_check_system(olpc_dmi_table); 1445 1425 cr48_profile_sensor = dmi_check_system(cr48_dmi_table); 1446 - 1447 - /* 1448 - * Unfortunately ForcePad capability is not exported over PS/2, 1449 - * so we have to resort to checking DMI. 1450 - */ 1451 - is_forcepad = dmi_check_system(forcepad_dmi_table); 1452 1426 } 1453 1427 1454 1428 static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) ··· 1464 1474 priv->absolute_mode = absolute_mode; 1465 1475 if (SYN_ID_DISGEST_SUPPORTED(priv->identity)) 1466 1476 priv->disable_gesture = true; 1477 + 1478 + /* 1479 + * Unfortunately ForcePad capability is not exported over PS/2, 1480 + * so we have to resort to checking PNP IDs. 1481 + */ 1482 + priv->is_forcepad = psmouse_matches_pnp_id(psmouse, forcepad_pnp_ids); 1467 1483 1468 1484 if (synaptics_set_mode(psmouse)) { 1469 1485 psmouse_err(psmouse, "Unable to initialize device.\n");
+1
drivers/input/mouse/synaptics.h
··· 196 196 unsigned long press_start; 197 197 bool press; 198 198 bool report_press; 199 + bool is_forcepad; 199 200 }; 200 201 201 202 void synaptics_module_init(void);
-1
drivers/input/serio/gscps2.c
··· 31 31 #include <linux/spinlock.h> 32 32 #include <linux/delay.h> 33 33 #include <linux/ioport.h> 34 - #include <linux/pci_ids.h> 35 34 36 35 #include <asm/irq.h> 37 36 #include <asm/io.h>
+25 -3
drivers/input/serio/i8042.c
··· 1162 1162 1163 1163 static int i8042_pm_suspend(struct device *dev) 1164 1164 { 1165 + int i; 1166 + 1165 1167 i8042_controller_reset(true); 1168 + 1169 + /* Set up serio interrupts for system wakeup. */ 1170 + for (i = 0; i < I8042_NUM_PORTS; i++) { 1171 + struct serio *serio = i8042_ports[i].serio; 1172 + 1173 + if (serio && device_may_wakeup(&serio->dev)) 1174 + enable_irq_wake(i8042_ports[i].irq); 1175 + } 1166 1176 1167 1177 return 0; 1168 1178 } 1169 1179 1170 1180 static int i8042_pm_resume(struct device *dev) 1171 1181 { 1182 + int i; 1183 + 1184 + for (i = 0; i < I8042_NUM_PORTS; i++) { 1185 + struct serio *serio = i8042_ports[i].serio; 1186 + 1187 + if (serio && device_may_wakeup(&serio->dev)) 1188 + disable_irq_wake(i8042_ports[i].irq); 1189 + } 1190 + 1172 1191 /* 1173 1192 * On resume from S2R we always try to reset the controller 1174 1193 * to bring it in a sane state. (In case of S2D we expect ··· 1319 1300 int i; 1320 1301 1321 1302 for (i = 0; i < I8042_NUM_PORTS; i++) { 1322 - if (i8042_ports[i].serio) { 1303 + struct serio *serio = i8042_ports[i].serio; 1304 + 1305 + if (serio) { 1323 1306 printk(KERN_INFO "serio: %s at %#lx,%#lx irq %d\n", 1324 - i8042_ports[i].serio->name, 1307 + serio->name, 1325 1308 (unsigned long) I8042_DATA_REG, 1326 1309 (unsigned long) I8042_COMMAND_REG, 1327 1310 i8042_ports[i].irq); 1328 - serio_register_port(i8042_ports[i].serio); 1311 + serio_register_port(serio); 1312 + device_set_wakeup_capable(&serio->dev, true); 1329 1313 } 1330 1314 } 1331 1315 }
+39 -2
drivers/input/touchscreen/Kconfig
··· 140 140 To compile this driver as a module, choose M here: the 141 141 module will be called bu21013_ts. 142 142 143 + config TOUCHSCREEN_CHIPONE_ICN8318 144 + tristate "chipone icn8318 touchscreen controller" 145 + depends on GPIOLIB 146 + depends on I2C 147 + depends on OF 148 + help 149 + Say Y here if you have a ChipOne icn8318 based I2C touchscreen. 150 + 151 + If unsure, say N. 152 + 153 + To compile this driver as a module, choose M here: the 154 + module will be called chipone_icn8318. 155 + 143 156 config TOUCHSCREEN_CY8CTMG110 144 157 tristate "cy8ctmg110 touchscreen" 145 158 depends on I2C ··· 310 297 311 298 config TOUCHSCREEN_GOODIX 312 299 tristate "Goodix I2C touchscreen" 313 - depends on I2C && ACPI 300 + depends on I2C 314 301 help 315 302 Say Y here if you have the Goodix touchscreen (such as one 316 303 installed in Onda v975w tablets) connected to your 317 - system. 304 + system. It also supports 5-finger chip models, which can be 305 + found on ARM tablets, like Wexler TAB7200 and MSI Primo73. 318 306 319 307 If unsure, say N. 320 308 ··· 336 322 337 323 To compile this driver as a module, choose M here: the 338 324 module will be called ili210x. 325 + 326 + config TOUCHSCREEN_IPROC 327 + tristate "IPROC touch panel driver support" 328 + depends on ARCH_BCM_IPROC || COMPILE_TEST 329 + help 330 + Say Y here if you want to add support for the IPROC touch 331 + controller to your system. 332 + 333 + If unsure, say N. 334 + 335 + To compile this driver as a module, choose M here: the 336 + module will be called bcm_iproc_tsc. 339 337 340 338 config TOUCHSCREEN_S3C2410 341 339 tristate "Samsung S3C2410/generic touchscreen input driver" ··· 987 961 988 962 To compile this driver as a module, choose M here: the 989 963 module will be called sur40. 964 + 965 + config TOUCHSCREEN_SX8654 966 + tristate "Semtech SX8654 touchscreen" 967 + depends on I2C 968 + help 969 + Say Y here if you have a Semtech SX8654 touchscreen controller. 970 + 971 + If unsure, say N 972 + 973 + To compile this driver as a module, choose M here: the 974 + module will be called sx8654. 990 975 991 976 config TOUCHSCREEN_TPS6507X 992 977 tristate "TPS6507x based touchscreens"
+3
drivers/input/touchscreen/Makefile
··· 17 17 obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o 18 18 obj-$(CONFIG_TOUCHSCREEN_AUO_PIXCIR) += auo-pixcir-ts.o 19 19 obj-$(CONFIG_TOUCHSCREEN_BU21013) += bu21013_ts.o 20 + obj-$(CONFIG_TOUCHSCREEN_CHIPONE_ICN8318) += chipone_icn8318.o 20 21 obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o 21 22 obj-$(CONFIG_TOUCHSCREEN_CYTTSP_CORE) += cyttsp_core.o 22 23 obj-$(CONFIG_TOUCHSCREEN_CYTTSP_I2C) += cyttsp_i2c.o cyttsp_i2c_common.o ··· 40 39 obj-$(CONFIG_TOUCHSCREEN_ILI210X) += ili210x.o 41 40 obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o 42 41 obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o 42 + obj-$(CONFIG_TOUCHSCREEN_IPROC) += bcm_iproc_tsc.o 43 43 obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o 44 44 obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o 45 45 obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o ··· 81 79 obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o 82 80 obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE) += zylonite-wm97xx.o 83 81 obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o 82 + obj-$(CONFIG_TOUCHSCREEN_SX8654) += sx8654.o 84 83 obj-$(CONFIG_TOUCHSCREEN_TPS6507X) += tps6507x-ts.o 85 84 obj-$(CONFIG_TOUCHSCREEN_ZFORCE) += zforce_ts.o
+1 -1
drivers/input/touchscreen/ar1021_i2c.c
··· 157 157 }; 158 158 MODULE_DEVICE_TABLE(i2c, ar1021_i2c_id); 159 159 160 - static struct of_device_id ar1021_i2c_of_match[] = { 160 + static const struct of_device_id ar1021_i2c_of_match[] = { 161 161 { .compatible = "microchip,ar1021-i2c", }, 162 162 { } 163 163 };
+348 -49
drivers/input/touchscreen/atmel_mxt_ts.c
··· 25 25 #include <linux/interrupt.h> 26 26 #include <linux/of.h> 27 27 #include <linux/slab.h> 28 + #include <asm/unaligned.h> 28 29 29 30 /* Version */ 30 31 #define MXT_VER_20 20 ··· 80 79 #define MXT_SPT_DIGITIZER_T43 43 81 80 #define MXT_SPT_MESSAGECOUNT_T44 44 82 81 #define MXT_SPT_CTECONFIG_T46 46 82 + #define MXT_TOUCH_MULTITOUCHSCREEN_T100 100 83 83 84 84 /* MXT_GEN_MESSAGE_T5 object */ 85 85 #define MXT_RPTID_NOMSG 0xff ··· 187 185 #define MXT_RESET_VALUE 0x01 188 186 #define MXT_BACKUP_VALUE 0x55 189 187 188 + /* T100 Multiple Touch Touchscreen */ 189 + #define MXT_T100_CTRL 0 190 + #define MXT_T100_CFG1 1 191 + #define MXT_T100_TCHAUX 3 192 + #define MXT_T100_XRANGE 13 193 + #define MXT_T100_YRANGE 24 194 + 195 + #define MXT_T100_CFG_SWITCHXY BIT(5) 196 + 197 + #define MXT_T100_TCHAUX_VECT BIT(0) 198 + #define MXT_T100_TCHAUX_AMPL BIT(1) 199 + #define MXT_T100_TCHAUX_AREA BIT(2) 200 + 201 + #define MXT_T100_DETECT BIT(7) 202 + #define MXT_T100_TYPE_MASK 0x70 203 + 204 + enum t100_type { 205 + MXT_T100_TYPE_FINGER = 1, 206 + MXT_T100_TYPE_PASSIVE_STYLUS = 2, 207 + MXT_T100_TYPE_HOVERING_FINGER = 4, 208 + MXT_T100_TYPE_GLOVE = 5, 209 + MXT_T100_TYPE_LARGE_TOUCH = 6, 210 + }; 211 + 212 + #define MXT_DISTANCE_ACTIVE_TOUCH 0 213 + #define MXT_DISTANCE_HOVERING 1 214 + 215 + #define MXT_TOUCH_MAJOR_DEFAULT 1 216 + #define MXT_PRESSURE_DEFAULT 1 217 + 190 218 /* Delay times */ 191 219 #define MXT_BACKUP_TIME 50 /* msec */ 192 220 #define MXT_RESET_TIME 200 /* msec */ ··· 276 244 unsigned int max_y; 277 245 bool in_bootloader; 278 246 u16 mem_size; 247 + u8 t100_aux_ampl; 248 + u8 t100_aux_area; 249 + u8 t100_aux_vect; 279 250 u8 max_reportid; 280 251 u32 config_crc; 281 252 u32 info_crc; ··· 288 253 bool update_input; 289 254 u8 last_message_count; 290 255 u8 num_touchids; 256 + u8 multitouch; 291 257 292 258 /* Cached parameters from object table */ 293 259 u16 T5_address; ··· 300 264 u8 T9_reportid_max; 301 265 u8 T19_reportid; 302 266 u16 T44_address; 267 + u8 T100_reportid_min; 268 + u8 T100_reportid_max; 303 269 304 270 /* for fw update in bootloader */ 305 271 struct completion bl_completion; ··· 809 771 data->update_input = true; 810 772 } 811 773 774 + static void mxt_proc_t100_message(struct mxt_data *data, u8 *message) 775 + { 776 + struct device *dev = &data->client->dev; 777 + struct input_dev *input_dev = data->input_dev; 778 + int id; 779 + u8 status; 780 + u8 type = 0; 781 + u16 x; 782 + u16 y; 783 + int distance = 0; 784 + int tool = 0; 785 + u8 major = 0; 786 + u8 pressure = 0; 787 + u8 orientation = 0; 788 + 789 + id = message[0] - data->T100_reportid_min - 2; 790 + 791 + /* ignore SCRSTATUS events */ 792 + if (id < 0) 793 + return; 794 + 795 + status = message[1]; 796 + x = get_unaligned_le16(&message[2]); 797 + y = get_unaligned_le16(&message[4]); 798 + 799 + if (status & MXT_T100_DETECT) { 800 + type = (status & MXT_T100_TYPE_MASK) >> 4; 801 + 802 + switch (type) { 803 + case MXT_T100_TYPE_HOVERING_FINGER: 804 + tool = MT_TOOL_FINGER; 805 + distance = MXT_DISTANCE_HOVERING; 806 + 807 + if (data->t100_aux_vect) 808 + orientation = message[data->t100_aux_vect]; 809 + 810 + break; 811 + 812 + case MXT_T100_TYPE_FINGER: 813 + case MXT_T100_TYPE_GLOVE: 814 + tool = MT_TOOL_FINGER; 815 + distance = MXT_DISTANCE_ACTIVE_TOUCH; 816 + 817 + if (data->t100_aux_area) 818 + major = message[data->t100_aux_area]; 819 + 820 + if (data->t100_aux_ampl) 821 + pressure = message[data->t100_aux_ampl]; 822 + 823 + if (data->t100_aux_vect) 824 + orientation = message[data->t100_aux_vect]; 825 + 826 + break; 827 + 828 + case MXT_T100_TYPE_PASSIVE_STYLUS: 829 + tool = MT_TOOL_PEN; 830 + 831 + /* 832 + * Passive stylus is reported with size zero so 833 + * hardcode. 834 + */ 835 + major = MXT_TOUCH_MAJOR_DEFAULT; 836 + 837 + if (data->t100_aux_ampl) 838 + pressure = message[data->t100_aux_ampl]; 839 + 840 + break; 841 + 842 + case MXT_T100_TYPE_LARGE_TOUCH: 843 + /* Ignore suppressed touch */ 844 + break; 845 + 846 + default: 847 + dev_dbg(dev, "Unexpected T100 type\n"); 848 + return; 849 + } 850 + } 851 + 852 + /* 853 + * Values reported should be non-zero if tool is touching the 854 + * device 855 + */ 856 + if (!pressure && type != MXT_T100_TYPE_HOVERING_FINGER) 857 + pressure = MXT_PRESSURE_DEFAULT; 858 + 859 + input_mt_slot(input_dev, id); 860 + 861 + if (status & MXT_T100_DETECT) { 862 + dev_dbg(dev, "[%u] type:%u x:%u y:%u a:%02X p:%02X v:%02X\n", 863 + id, type, x, y, major, pressure, orientation); 864 + 865 + input_mt_report_slot_state(input_dev, tool, 1); 866 + input_report_abs(input_dev, ABS_MT_POSITION_X, x); 867 + input_report_abs(input_dev, ABS_MT_POSITION_Y, y); 868 + input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, major); 869 + input_report_abs(input_dev, ABS_MT_PRESSURE, pressure); 870 + input_report_abs(input_dev, ABS_MT_DISTANCE, distance); 871 + input_report_abs(input_dev, ABS_MT_ORIENTATION, orientation); 872 + } else { 873 + dev_dbg(dev, "[%u] release\n", id); 874 + 875 + /* close out slot */ 876 + input_mt_report_slot_state(input_dev, 0, 0); 877 + } 878 + 879 + data->update_input = true; 880 + } 881 + 812 882 static int mxt_proc_message(struct mxt_data *data, u8 *message) 813 883 { 814 884 u8 report_id = message[0]; ··· 932 786 * is not yet registered. 933 787 */ 934 788 mxt_dump_message(data, message); 935 - } else if (report_id >= data->T9_reportid_min 936 - && report_id <= data->T9_reportid_max) { 789 + } else if (report_id >= data->T9_reportid_min && 790 + report_id <= data->T9_reportid_max) { 937 791 mxt_proc_t9_message(data, message); 792 + } else if (report_id >= data->T100_reportid_min && 793 + report_id <= data->T100_reportid_max) { 794 + mxt_proc_t100_message(data, message); 938 795 } else if (report_id == data->T19_reportid) { 939 796 mxt_input_button(data, message); 940 797 data->update_input = true; ··· 1560 1411 data->T9_reportid_max = 0; 1561 1412 data->T19_reportid = 0; 1562 1413 data->T44_address = 0; 1414 + data->T100_reportid_min = 0; 1415 + data->T100_reportid_max = 0; 1563 1416 data->max_reportid = 0; 1564 1417 } 1565 1418 ··· 1638 1487 data->T7_address = object->start_address; 1639 1488 break; 1640 1489 case MXT_TOUCH_MULTI_T9: 1490 + data->multitouch = MXT_TOUCH_MULTI_T9; 1641 1491 data->T9_reportid_min = min_id; 1642 1492 data->T9_reportid_max = max_id; 1643 1493 data->num_touchids = object->num_report_ids ··· 1649 1497 break; 1650 1498 case MXT_SPT_GPIOPWM_T19: 1651 1499 data->T19_reportid = min_id; 1500 + break; 1501 + case MXT_TOUCH_MULTITOUCHSCREEN_T100: 1502 + data->multitouch = MXT_TOUCH_MULTITOUCHSCREEN_T100; 1503 + data->T100_reportid_min = min_id; 1504 + data->T100_reportid_max = max_id; 1505 + /* first two report IDs reserved */ 1506 + data->num_touchids = object->num_report_ids - 2; 1652 1507 break; 1653 1508 } 1654 1509 ··· 1741 1582 return 0; 1742 1583 } 1743 1584 1585 + static int mxt_read_t100_config(struct mxt_data *data) 1586 + { 1587 + struct i2c_client *client = data->client; 1588 + int error; 1589 + struct mxt_object *object; 1590 + u16 range_x, range_y; 1591 + u8 cfg, tchaux; 1592 + u8 aux; 1593 + 1594 + object = mxt_get_object(data, MXT_TOUCH_MULTITOUCHSCREEN_T100); 1595 + if (!object) 1596 + return -EINVAL; 1597 + 1598 + error = __mxt_read_reg(client, 1599 + object->start_address + MXT_T100_XRANGE, 1600 + sizeof(range_x), &range_x); 1601 + if (error) 1602 + return error; 1603 + 1604 + le16_to_cpus(&range_x); 1605 + 1606 + error = __mxt_read_reg(client, 1607 + object->start_address + MXT_T100_YRANGE, 1608 + sizeof(range_y), &range_y); 1609 + if (error) 1610 + return error; 1611 + 1612 + le16_to_cpus(&range_y); 1613 + 1614 + error = __mxt_read_reg(client, 1615 + object->start_address + MXT_T100_CFG1, 1616 + 1, &cfg); 1617 + if (error) 1618 + return error; 1619 + 1620 + error = __mxt_read_reg(client, 1621 + object->start_address + MXT_T100_TCHAUX, 1622 + 1, &tchaux); 1623 + if (error) 1624 + return error; 1625 + 1626 + /* Handle default values */ 1627 + if (range_x == 0) 1628 + range_x = 1023; 1629 + 1630 + if (range_y == 0) 1631 + range_y = 1023; 1632 + 1633 + if (cfg & MXT_T100_CFG_SWITCHXY) { 1634 + data->max_x = range_y; 1635 + data->max_y = range_x; 1636 + } else { 1637 + data->max_x = range_x; 1638 + data->max_y = range_y; 1639 + } 1640 + 1641 + /* allocate aux bytes */ 1642 + aux = 6; 1643 + 1644 + if (tchaux & MXT_T100_TCHAUX_VECT) 1645 + data->t100_aux_vect = aux++; 1646 + 1647 + if (tchaux & MXT_T100_TCHAUX_AMPL) 1648 + data->t100_aux_ampl = aux++; 1649 + 1650 + if (tchaux & MXT_T100_TCHAUX_AREA) 1651 + data->t100_aux_area = aux++; 1652 + 1653 + dev_dbg(&client->dev, 1654 + "T100 aux mappings vect:%u ampl:%u area:%u\n", 1655 + data->t100_aux_vect, data->t100_aux_ampl, data->t100_aux_area); 1656 + 1657 + dev_info(&client->dev, 1658 + "T100 Touchscreen size X%uY%u\n", data->max_x, data->max_y); 1659 + 1660 + return 0; 1661 + } 1662 + 1744 1663 static int mxt_input_open(struct input_dev *dev); 1745 1664 static void mxt_input_close(struct input_dev *dev); 1746 1665 1747 - static int mxt_initialize_t9_input_device(struct mxt_data *data) 1666 + static void mxt_set_up_as_touchpad(struct input_dev *input_dev, 1667 + struct mxt_data *data) 1748 1668 { 1749 - struct device *dev = &data->client->dev; 1750 1669 const struct mxt_platform_data *pdata = data->pdata; 1670 + int i; 1671 + 1672 + input_dev->name = "Atmel maXTouch Touchpad"; 1673 + 1674 + __set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit); 1675 + 1676 + input_abs_set_res(input_dev, ABS_X, MXT_PIXELS_PER_MM); 1677 + input_abs_set_res(input_dev, ABS_Y, MXT_PIXELS_PER_MM); 1678 + input_abs_set_res(input_dev, ABS_MT_POSITION_X, 1679 + MXT_PIXELS_PER_MM); 1680 + input_abs_set_res(input_dev, ABS_MT_POSITION_Y, 1681 + MXT_PIXELS_PER_MM); 1682 + 1683 + for (i = 0; i < pdata->t19_num_keys; i++) 1684 + if (pdata->t19_keymap[i] != KEY_RESERVED) 1685 + input_set_capability(input_dev, EV_KEY, 1686 + pdata->t19_keymap[i]); 1687 + } 1688 + 1689 + static int mxt_initialize_input_device(struct mxt_data *data) 1690 + { 1691 + const struct mxt_platform_data *pdata = data->pdata; 1692 + struct device *dev = &data->client->dev; 1751 1693 struct input_dev *input_dev; 1752 1694 int error; 1753 1695 unsigned int num_mt_slots; 1754 1696 unsigned int mt_flags = 0; 1755 - int i; 1756 1697 1757 - error = mxt_read_t9_resolution(data); 1758 - if (error) 1759 - dev_warn(dev, "Failed to initialize T9 resolution\n"); 1698 + switch (data->multitouch) { 1699 + case MXT_TOUCH_MULTI_T9: 1700 + num_mt_slots = data->T9_reportid_max - data->T9_reportid_min + 1; 1701 + error = mxt_read_t9_resolution(data); 1702 + if (error) 1703 + dev_warn(dev, "Failed to initialize T9 resolution\n"); 1704 + break; 1705 + 1706 + case MXT_TOUCH_MULTITOUCHSCREEN_T100: 1707 + num_mt_slots = data->num_touchids; 1708 + error = mxt_read_t100_config(data); 1709 + if (error) 1710 + dev_warn(dev, "Failed to read T100 config\n"); 1711 + break; 1712 + 1713 + default: 1714 + dev_err(dev, "Invalid multitouch object\n"); 1715 + return -EINVAL; 1716 + } 1760 1717 1761 1718 input_dev = input_allocate_device(); 1762 1719 if (!input_dev) { ··· 1887 1612 input_dev->open = mxt_input_open; 1888 1613 input_dev->close = mxt_input_close; 1889 1614 1890 - __set_bit(EV_ABS, input_dev->evbit); 1891 - __set_bit(EV_KEY, input_dev->evbit); 1892 - __set_bit(BTN_TOUCH, input_dev->keybit); 1893 - 1894 - if (pdata->t19_num_keys) { 1895 - __set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit); 1896 - 1897 - for (i = 0; i < pdata->t19_num_keys; i++) 1898 - if (pdata->t19_keymap[i] != KEY_RESERVED) 1899 - input_set_capability(input_dev, EV_KEY, 1900 - pdata->t19_keymap[i]); 1901 - 1902 - mt_flags |= INPUT_MT_POINTER; 1903 - 1904 - input_abs_set_res(input_dev, ABS_X, MXT_PIXELS_PER_MM); 1905 - input_abs_set_res(input_dev, ABS_Y, MXT_PIXELS_PER_MM); 1906 - input_abs_set_res(input_dev, ABS_MT_POSITION_X, 1907 - MXT_PIXELS_PER_MM); 1908 - input_abs_set_res(input_dev, ABS_MT_POSITION_Y, 1909 - MXT_PIXELS_PER_MM); 1910 - 1911 - input_dev->name = "Atmel maXTouch Touchpad"; 1912 - } 1615 + input_set_capability(input_dev, EV_KEY, BTN_TOUCH); 1913 1616 1914 1617 /* For single touch */ 1915 - input_set_abs_params(input_dev, ABS_X, 1916 - 0, data->max_x, 0, 0); 1917 - input_set_abs_params(input_dev, ABS_Y, 1918 - 0, data->max_y, 0, 0); 1919 - input_set_abs_params(input_dev, ABS_PRESSURE, 1920 - 0, 255, 0, 0); 1618 + input_set_abs_params(input_dev, ABS_X, 0, data->max_x, 0, 0); 1619 + input_set_abs_params(input_dev, ABS_Y, 0, data->max_y, 0, 0); 1620 + 1621 + if (data->multitouch == MXT_TOUCH_MULTI_T9 || 1622 + (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && 1623 + data->t100_aux_ampl)) { 1624 + input_set_abs_params(input_dev, ABS_PRESSURE, 0, 255, 0, 0); 1625 + } 1626 + 1627 + /* If device has buttons we assume it is a touchpad */ 1628 + if (pdata->t19_num_keys) { 1629 + mxt_set_up_as_touchpad(input_dev, data); 1630 + mt_flags |= INPUT_MT_POINTER; 1631 + } 1921 1632 1922 1633 /* For multi touch */ 1923 - num_mt_slots = data->T9_reportid_max - data->T9_reportid_min + 1; 1924 1634 error = input_mt_init_slots(input_dev, num_mt_slots, mt_flags); 1925 1635 if (error) { 1926 1636 dev_err(dev, "Error %d initialising slots\n", error); 1927 1637 goto err_free_mem; 1928 1638 } 1929 1639 1930 - input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 1931 - 0, MXT_MAX_AREA, 0, 0); 1640 + if (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100) { 1641 + input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, 1642 + 0, MT_TOOL_MAX, 0, 0); 1643 + input_set_abs_params(input_dev, ABS_MT_DISTANCE, 1644 + MXT_DISTANCE_ACTIVE_TOUCH, 1645 + MXT_DISTANCE_HOVERING, 1646 + 0, 0); 1647 + } 1648 + 1932 1649 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 1933 1650 0, data->max_x, 0, 0); 1934 1651 input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 1935 1652 0, data->max_y, 0, 0); 1936 - input_set_abs_params(input_dev, ABS_MT_PRESSURE, 1937 - 0, 255, 0, 0); 1653 + 1654 + if (data->multitouch == MXT_TOUCH_MULTI_T9 || 1655 + (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && 1656 + data->t100_aux_area)) { 1657 + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 1658 + 0, MXT_MAX_AREA, 0, 0); 1659 + } 1660 + 1661 + if (data->multitouch == MXT_TOUCH_MULTI_T9 || 1662 + (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && 1663 + data->t100_aux_ampl)) { 1664 + input_set_abs_params(input_dev, ABS_MT_PRESSURE, 1665 + 0, 255, 0, 0); 1666 + } 1667 + 1668 + if (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && 1669 + data->t100_aux_vect) { 1670 + input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 1671 + 0, 255, 0, 0); 1672 + } 1673 + 1674 + if (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && 1675 + data->t100_aux_ampl) { 1676 + input_set_abs_params(input_dev, ABS_MT_PRESSURE, 1677 + 0, 255, 0, 0); 1678 + } 1679 + 1680 + if (data->multitouch == MXT_TOUCH_MULTITOUCHSCREEN_T100 && 1681 + data->t100_aux_vect) { 1682 + input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 1683 + 0, 255, 0, 0); 1684 + } 1938 1685 1939 1686 input_set_drvdata(input_dev, data); 1940 1687 ··· 2062 1765 dev_warn(dev, "Error %d updating config\n", error); 2063 1766 } 2064 1767 2065 - error = mxt_initialize_t9_input_device(data); 2066 - if (error) 2067 - return error; 1768 + if (data->multitouch) { 1769 + error = mxt_initialize_input_device(data); 1770 + if (error) 1771 + return error; 1772 + } else { 1773 + dev_warn(dev, "No touch object detected\n"); 1774 + } 2068 1775 2069 1776 dev_info(dev, 2070 1777 "Family: %u Variant: %u Firmware V%u.%u.%02X Objects: %u\n", ··· 2345 2044 static void mxt_start(struct mxt_data *data) 2346 2045 { 2347 2046 /* Touch enable */ 2348 - mxt_write_object(data, 2349 - MXT_TOUCH_MULTI_T9, MXT_TOUCH_CTRL, 0x83); 2047 + mxt_write_object(data, data->multitouch, MXT_TOUCH_CTRL, 0x83); 2350 2048 } 2351 2049 2352 2050 static void mxt_stop(struct mxt_data *data) 2353 2051 { 2354 2052 /* Touch disable */ 2355 - mxt_write_object(data, 2356 - MXT_TOUCH_MULTI_T9, MXT_TOUCH_CTRL, 0); 2053 + mxt_write_object(data, data->multitouch, MXT_TOUCH_CTRL, 0); 2357 2054 } 2358 2055 2359 2056 static int mxt_input_open(struct input_dev *dev)
+522
drivers/input/touchscreen/bcm_iproc_tsc.c
··· 1 + /* 2 + * Copyright (C) 2015 Broadcom Corporation 3 + * 4 + * This program is free software; you can redistribute it and/or 5 + * modify it under the terms of the GNU General Public License as 6 + * published by the Free Software Foundation version 2. 7 + * 8 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 9 + * kind, whether express or implied; without even the implied warranty 10 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + #include <linux/module.h> 14 + #include <linux/init.h> 15 + #include <linux/input.h> 16 + #include <linux/delay.h> 17 + #include <linux/interrupt.h> 18 + #include <linux/keyboard.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/slab.h> 21 + #include <linux/of.h> 22 + #include <asm/irq.h> 23 + #include <linux/io.h> 24 + #include <linux/clk.h> 25 + #include <linux/serio.h> 26 + 27 + #define IPROC_TS_NAME "iproc-ts" 28 + 29 + #define PEN_DOWN_STATUS 1 30 + #define PEN_UP_STATUS 0 31 + 32 + #define X_MIN 0 33 + #define Y_MIN 0 34 + #define X_MAX 0xFFF 35 + #define Y_MAX 0xFFF 36 + 37 + /* Value given by controller for invalid coordinate. */ 38 + #define INVALID_COORD 0xFFFFFFFF 39 + 40 + /* Register offsets */ 41 + #define REGCTL1 0x00 42 + #define REGCTL2 0x04 43 + #define INTERRUPT_THRES 0x08 44 + #define INTERRUPT_MASK 0x0c 45 + 46 + #define INTERRUPT_STATUS 0x10 47 + #define CONTROLLER_STATUS 0x14 48 + #define FIFO_DATA 0x18 49 + #define FIFO_DATA_X_Y_MASK 0xFFFF 50 + #define ANALOG_CONTROL 0x1c 51 + 52 + #define AUX_DATA 0x20 53 + #define DEBOUNCE_CNTR_STAT 0x24 54 + #define SCAN_CNTR_STAT 0x28 55 + #define REM_CNTR_STAT 0x2c 56 + 57 + #define SETTLING_TIMER_STAT 0x30 58 + #define SPARE_REG 0x34 59 + #define SOFT_BYPASS_CONTROL 0x38 60 + #define SOFT_BYPASS_DATA 0x3c 61 + 62 + 63 + /* Bit values for INTERRUPT_MASK and INTERRUPT_STATUS regs */ 64 + #define TS_PEN_INTR_MASK BIT(0) 65 + #define TS_FIFO_INTR_MASK BIT(2) 66 + 67 + /* Bit values for CONTROLLER_STATUS reg1 */ 68 + #define TS_PEN_DOWN BIT(0) 69 + 70 + /* Shift values for control reg1 */ 71 + #define SCANNING_PERIOD_SHIFT 24 72 + #define DEBOUNCE_TIMEOUT_SHIFT 16 73 + #define SETTLING_TIMEOUT_SHIFT 8 74 + #define TOUCH_TIMEOUT_SHIFT 0 75 + 76 + /* Shift values for coordinates from fifo */ 77 + #define X_COORD_SHIFT 0 78 + #define Y_COORD_SHIFT 16 79 + 80 + /* Bit values for REGCTL2 */ 81 + #define TS_CONTROLLER_EN_BIT BIT(16) 82 + #define TS_CONTROLLER_AVGDATA_SHIFT 8 83 + #define TS_CONTROLLER_AVGDATA_MASK (0x7 << TS_CONTROLLER_AVGDATA_SHIFT) 84 + #define TS_CONTROLLER_PWR_LDO BIT(5) 85 + #define TS_CONTROLLER_PWR_ADC BIT(4) 86 + #define TS_CONTROLLER_PWR_BGP BIT(3) 87 + #define TS_CONTROLLER_PWR_TS BIT(2) 88 + #define TS_WIRE_MODE_BIT BIT(1) 89 + 90 + #define dbg_reg(dev, priv, reg) \ 91 + dev_dbg(dev, "%20s= 0x%08x\n", #reg, readl((priv)->regs + reg)) 92 + 93 + struct tsc_param { 94 + /* Each step is 1024 us. Valid 1-256 */ 95 + u32 scanning_period; 96 + 97 + /* Each step is 512 us. Valid 0-255 */ 98 + u32 debounce_timeout; 99 + 100 + /* 101 + * The settling duration (in ms) is the amount of time the tsc 102 + * waits to allow the voltage to settle after turning on the 103 + * drivers in detection mode. Valid values: 0-11 104 + * 0 = 0.008 ms 105 + * 1 = 0.01 ms 106 + * 2 = 0.02 ms 107 + * 3 = 0.04 ms 108 + * 4 = 0.08 ms 109 + * 5 = 0.16 ms 110 + * 6 = 0.32 ms 111 + * 7 = 0.64 ms 112 + * 8 = 1.28 ms 113 + * 9 = 2.56 ms 114 + * 10 = 5.12 ms 115 + * 11 = 10.24 ms 116 + */ 117 + u32 settling_timeout; 118 + 119 + /* touch timeout in sample counts */ 120 + u32 touch_timeout; 121 + 122 + /* 123 + * Number of data samples which are averaged before a final data point 124 + * is placed into the FIFO 125 + */ 126 + u32 average_data; 127 + 128 + /* FIFO threshold */ 129 + u32 fifo_threshold; 130 + 131 + /* Optional standard touchscreen properties. */ 132 + u32 max_x; 133 + u32 max_y; 134 + u32 fuzz_x; 135 + u32 fuzz_y; 136 + bool invert_x; 137 + bool invert_y; 138 + }; 139 + 140 + struct iproc_ts_priv { 141 + struct platform_device *pdev; 142 + struct input_dev *idev; 143 + 144 + void __iomem *regs; 145 + struct clk *tsc_clk; 146 + 147 + int pen_status; 148 + struct tsc_param cfg_params; 149 + }; 150 + 151 + /* 152 + * Set default values the same as hardware reset values 153 + * except for fifo_threshold with is set to 1. 154 + */ 155 + static const struct tsc_param iproc_default_config = { 156 + .scanning_period = 0x5, /* 1 to 256 */ 157 + .debounce_timeout = 0x28, /* 0 to 255 */ 158 + .settling_timeout = 0x7, /* 0 to 11 */ 159 + .touch_timeout = 0xa, /* 0 to 255 */ 160 + .average_data = 5, /* entry 5 = 32 pts */ 161 + .fifo_threshold = 1, /* 0 to 31 */ 162 + .max_x = X_MAX, 163 + .max_y = Y_MAX, 164 + }; 165 + 166 + static void ts_reg_dump(struct iproc_ts_priv *priv) 167 + { 168 + struct device *dev = &priv->pdev->dev; 169 + 170 + dbg_reg(dev, priv, REGCTL1); 171 + dbg_reg(dev, priv, REGCTL2); 172 + dbg_reg(dev, priv, INTERRUPT_THRES); 173 + dbg_reg(dev, priv, INTERRUPT_MASK); 174 + dbg_reg(dev, priv, INTERRUPT_STATUS); 175 + dbg_reg(dev, priv, CONTROLLER_STATUS); 176 + dbg_reg(dev, priv, FIFO_DATA); 177 + dbg_reg(dev, priv, ANALOG_CONTROL); 178 + dbg_reg(dev, priv, AUX_DATA); 179 + dbg_reg(dev, priv, DEBOUNCE_CNTR_STAT); 180 + dbg_reg(dev, priv, SCAN_CNTR_STAT); 181 + dbg_reg(dev, priv, REM_CNTR_STAT); 182 + dbg_reg(dev, priv, SETTLING_TIMER_STAT); 183 + dbg_reg(dev, priv, SPARE_REG); 184 + dbg_reg(dev, priv, SOFT_BYPASS_CONTROL); 185 + dbg_reg(dev, priv, SOFT_BYPASS_DATA); 186 + } 187 + 188 + static irqreturn_t iproc_touchscreen_interrupt(int irq, void *data) 189 + { 190 + struct platform_device *pdev = data; 191 + struct iproc_ts_priv *priv = platform_get_drvdata(pdev); 192 + u32 intr_status; 193 + u32 raw_coordinate; 194 + u16 x; 195 + u16 y; 196 + int i; 197 + bool needs_sync = false; 198 + 199 + intr_status = readl(priv->regs + INTERRUPT_STATUS); 200 + intr_status &= TS_PEN_INTR_MASK | TS_FIFO_INTR_MASK; 201 + if (intr_status == 0) 202 + return IRQ_NONE; 203 + 204 + /* Clear all interrupt status bits, write-1-clear */ 205 + writel(intr_status, priv->regs + INTERRUPT_STATUS); 206 + 207 + /* Pen up/down */ 208 + if (intr_status & TS_PEN_INTR_MASK) { 209 + if (readl(priv->regs + CONTROLLER_STATUS) & TS_PEN_DOWN) 210 + priv->pen_status = PEN_DOWN_STATUS; 211 + else 212 + priv->pen_status = PEN_UP_STATUS; 213 + 214 + input_report_key(priv->idev, BTN_TOUCH, priv->pen_status); 215 + needs_sync = true; 216 + 217 + dev_dbg(&priv->pdev->dev, 218 + "pen up-down (%d)\n", priv->pen_status); 219 + } 220 + 221 + /* coordinates in FIFO exceed the theshold */ 222 + if (intr_status & TS_FIFO_INTR_MASK) { 223 + for (i = 0; i < priv->cfg_params.fifo_threshold; i++) { 224 + raw_coordinate = readl(priv->regs + FIFO_DATA); 225 + if (raw_coordinate == INVALID_COORD) 226 + continue; 227 + 228 + /* 229 + * The x and y coordinate are 16 bits each 230 + * with the x in the lower 16 bits and y in the 231 + * upper 16 bits. 232 + */ 233 + x = (raw_coordinate >> X_COORD_SHIFT) & 234 + FIFO_DATA_X_Y_MASK; 235 + y = (raw_coordinate >> Y_COORD_SHIFT) & 236 + FIFO_DATA_X_Y_MASK; 237 + 238 + /* We only want to retain the 12 msb of the 16 */ 239 + x = (x >> 4) & 0x0FFF; 240 + y = (y >> 4) & 0x0FFF; 241 + 242 + /* adjust x y according to lcd tsc mount angle */ 243 + if (priv->cfg_params.invert_x) 244 + x = priv->cfg_params.max_x - x; 245 + 246 + if (priv->cfg_params.invert_y) 247 + y = priv->cfg_params.max_y - y; 248 + 249 + input_report_abs(priv->idev, ABS_X, x); 250 + input_report_abs(priv->idev, ABS_Y, y); 251 + needs_sync = true; 252 + 253 + dev_dbg(&priv->pdev->dev, "xy (0x%x 0x%x)\n", x, y); 254 + } 255 + } 256 + 257 + if (needs_sync) 258 + input_sync(priv->idev); 259 + 260 + return IRQ_HANDLED; 261 + } 262 + 263 + static int iproc_ts_start(struct input_dev *idev) 264 + { 265 + struct iproc_ts_priv *priv = input_get_drvdata(idev); 266 + u32 val; 267 + int error; 268 + 269 + /* Enable clock */ 270 + error = clk_prepare_enable(priv->tsc_clk); 271 + if (error) { 272 + dev_err(&priv->pdev->dev, "%s clk_prepare_enable failed %d\n", 273 + __func__, error); 274 + return error; 275 + } 276 + 277 + /* 278 + * Interrupt is generated when: 279 + * FIFO reaches the int_th value, and pen event(up/down) 280 + */ 281 + val = TS_PEN_INTR_MASK | TS_FIFO_INTR_MASK; 282 + writel(val, priv->regs + INTERRUPT_MASK); 283 + 284 + writel(priv->cfg_params.fifo_threshold, priv->regs + INTERRUPT_THRES); 285 + 286 + /* Initialize control reg1 */ 287 + val = 0; 288 + val |= priv->cfg_params.scanning_period << SCANNING_PERIOD_SHIFT; 289 + val |= priv->cfg_params.debounce_timeout << DEBOUNCE_TIMEOUT_SHIFT; 290 + val |= priv->cfg_params.settling_timeout << SETTLING_TIMEOUT_SHIFT; 291 + val |= priv->cfg_params.touch_timeout << TOUCH_TIMEOUT_SHIFT; 292 + writel(val, priv->regs + REGCTL1); 293 + 294 + /* Try to clear all interrupt status */ 295 + val = readl(priv->regs + INTERRUPT_STATUS); 296 + val |= TS_FIFO_INTR_MASK | TS_PEN_INTR_MASK; 297 + writel(val, priv->regs + INTERRUPT_STATUS); 298 + 299 + /* Initialize control reg2 */ 300 + val = readl(priv->regs + REGCTL2); 301 + val |= TS_CONTROLLER_EN_BIT | TS_WIRE_MODE_BIT; 302 + 303 + val &= ~TS_CONTROLLER_AVGDATA_MASK; 304 + val |= priv->cfg_params.average_data << TS_CONTROLLER_AVGDATA_SHIFT; 305 + 306 + val &= ~(TS_CONTROLLER_PWR_LDO | /* PWR up LDO */ 307 + TS_CONTROLLER_PWR_ADC | /* PWR up ADC */ 308 + TS_CONTROLLER_PWR_BGP | /* PWR up BGP */ 309 + TS_CONTROLLER_PWR_TS); /* PWR up TS */ 310 + 311 + writel(val, priv->regs + REGCTL2); 312 + 313 + ts_reg_dump(priv); 314 + 315 + return 0; 316 + } 317 + 318 + static void iproc_ts_stop(struct input_dev *dev) 319 + { 320 + u32 val; 321 + struct iproc_ts_priv *priv = input_get_drvdata(dev); 322 + 323 + writel(0, priv->regs + INTERRUPT_MASK); /* Disable all interrupts */ 324 + 325 + /* Only power down touch screen controller */ 326 + val = readl(priv->regs + REGCTL2); 327 + val |= TS_CONTROLLER_PWR_TS; 328 + writel(val, priv->regs + REGCTL2); 329 + 330 + clk_disable(priv->tsc_clk); 331 + } 332 + 333 + static int iproc_get_tsc_config(struct device *dev, struct iproc_ts_priv *priv) 334 + { 335 + struct device_node *np = dev->of_node; 336 + u32 val; 337 + 338 + priv->cfg_params = iproc_default_config; 339 + 340 + if (!np) 341 + return 0; 342 + 343 + if (of_property_read_u32(np, "scanning_period", &val) >= 0) { 344 + if (val < 1 || val > 256) { 345 + dev_err(dev, "scanning_period (%u) must be [1-256]\n", 346 + val); 347 + return -EINVAL; 348 + } 349 + priv->cfg_params.scanning_period = val; 350 + } 351 + 352 + if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) { 353 + if (val > 255) { 354 + dev_err(dev, "debounce_timeout (%u) must be [0-255]\n", 355 + val); 356 + return -EINVAL; 357 + } 358 + priv->cfg_params.debounce_timeout = val; 359 + } 360 + 361 + if (of_property_read_u32(np, "settling_timeout", &val) >= 0) { 362 + if (val > 11) { 363 + dev_err(dev, "settling_timeout (%u) must be [0-11]\n", 364 + val); 365 + return -EINVAL; 366 + } 367 + priv->cfg_params.settling_timeout = val; 368 + } 369 + 370 + if (of_property_read_u32(np, "touch_timeout", &val) >= 0) { 371 + if (val > 255) { 372 + dev_err(dev, "touch_timeout (%u) must be [0-255]\n", 373 + val); 374 + return -EINVAL; 375 + } 376 + priv->cfg_params.touch_timeout = val; 377 + } 378 + 379 + if (of_property_read_u32(np, "average_data", &val) >= 0) { 380 + if (val > 8) { 381 + dev_err(dev, "average_data (%u) must be [0-8]\n", val); 382 + return -EINVAL; 383 + } 384 + priv->cfg_params.average_data = val; 385 + } 386 + 387 + if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) { 388 + if (val > 31) { 389 + dev_err(dev, "fifo_threshold (%u)) must be [0-31]\n", 390 + val); 391 + return -EINVAL; 392 + } 393 + priv->cfg_params.fifo_threshold = val; 394 + } 395 + 396 + /* Parse optional properties. */ 397 + of_property_read_u32(np, "touchscreen-size-x", &priv->cfg_params.max_x); 398 + of_property_read_u32(np, "touchscreen-size-y", &priv->cfg_params.max_y); 399 + 400 + of_property_read_u32(np, "touchscreen-fuzz-x", 401 + &priv->cfg_params.fuzz_x); 402 + of_property_read_u32(np, "touchscreen-fuzz-y", 403 + &priv->cfg_params.fuzz_y); 404 + 405 + priv->cfg_params.invert_x = 406 + of_property_read_bool(np, "touchscreen-inverted-x"); 407 + priv->cfg_params.invert_y = 408 + of_property_read_bool(np, "touchscreen-inverted-y"); 409 + 410 + return 0; 411 + } 412 + 413 + static int iproc_ts_probe(struct platform_device *pdev) 414 + { 415 + struct iproc_ts_priv *priv; 416 + struct input_dev *idev; 417 + struct resource *res; 418 + int irq; 419 + int error; 420 + 421 + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 422 + if (!priv) 423 + return -ENOMEM; 424 + 425 + /* touchscreen controller memory mapped regs */ 426 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 427 + priv->regs = devm_ioremap_resource(&pdev->dev, res); 428 + if (IS_ERR(priv->regs)) { 429 + error = PTR_ERR(priv->regs); 430 + dev_err(&pdev->dev, "unable to map I/O memory: %d\n", error); 431 + return error; 432 + } 433 + 434 + priv->tsc_clk = devm_clk_get(&pdev->dev, "tsc_clk"); 435 + if (IS_ERR(priv->tsc_clk)) { 436 + error = PTR_ERR(priv->tsc_clk); 437 + dev_err(&pdev->dev, 438 + "failed getting clock tsc_clk: %d\n", error); 439 + return error; 440 + } 441 + 442 + priv->pdev = pdev; 443 + error = iproc_get_tsc_config(&pdev->dev, priv); 444 + if (error) { 445 + dev_err(&pdev->dev, "get_tsc_config failed: %d\n", error); 446 + return error; 447 + } 448 + 449 + idev = devm_input_allocate_device(&pdev->dev); 450 + if (!idev) { 451 + dev_err(&pdev->dev, "failed to allocate input device\n"); 452 + return -ENOMEM; 453 + } 454 + 455 + priv->idev = idev; 456 + priv->pen_status = PEN_UP_STATUS; 457 + 458 + /* Set input device info */ 459 + idev->name = IPROC_TS_NAME; 460 + idev->dev.parent = &pdev->dev; 461 + 462 + idev->id.bustype = BUS_HOST; 463 + idev->id.vendor = SERIO_UNKNOWN; 464 + idev->id.product = 0; 465 + idev->id.version = 0; 466 + 467 + idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); 468 + __set_bit(BTN_TOUCH, idev->keybit); 469 + 470 + input_set_abs_params(idev, ABS_X, X_MIN, priv->cfg_params.max_x, 471 + priv->cfg_params.fuzz_x, 0); 472 + input_set_abs_params(idev, ABS_Y, Y_MIN, priv->cfg_params.max_y, 473 + priv->cfg_params.fuzz_y, 0); 474 + 475 + idev->open = iproc_ts_start; 476 + idev->close = iproc_ts_stop; 477 + 478 + input_set_drvdata(idev, priv); 479 + platform_set_drvdata(pdev, priv); 480 + 481 + /* get interrupt */ 482 + irq = platform_get_irq(pdev, 0); 483 + if (irq < 0) { 484 + dev_err(&pdev->dev, "platform_get_irq failed: %d\n", irq); 485 + return irq; 486 + } 487 + 488 + error = devm_request_irq(&pdev->dev, irq, 489 + iproc_touchscreen_interrupt, 490 + IRQF_SHARED, IPROC_TS_NAME, pdev); 491 + if (error) 492 + return error; 493 + 494 + error = input_register_device(priv->idev); 495 + if (error) { 496 + dev_err(&pdev->dev, 497 + "failed to register input device: %d\n", error); 498 + return error; 499 + } 500 + 501 + return 0; 502 + } 503 + 504 + static const struct of_device_id iproc_ts_of_match[] = { 505 + {.compatible = "brcm,iproc-touchscreen", }, 506 + { }, 507 + }; 508 + MODULE_DEVICE_TABLE(of, iproc_ts_of_match); 509 + 510 + static struct platform_driver iproc_ts_driver = { 511 + .probe = iproc_ts_probe, 512 + .driver = { 513 + .name = IPROC_TS_NAME, 514 + .of_match_table = of_match_ptr(iproc_ts_of_match), 515 + }, 516 + }; 517 + 518 + module_platform_driver(iproc_ts_driver); 519 + 520 + MODULE_DESCRIPTION("IPROC Touchscreen driver"); 521 + MODULE_AUTHOR("Broadcom"); 522 + MODULE_LICENSE("GPL v2");
+316
drivers/input/touchscreen/chipone_icn8318.c
··· 1 + /* 2 + * Driver for ChipOne icn8318 i2c touchscreen controller 3 + * 4 + * Copyright (c) 2015 Red Hat Inc. 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * Red Hat authors: 12 + * Hans de Goede <hdegoede@redhat.com> 13 + */ 14 + 15 + #include <linux/gpio/consumer.h> 16 + #include <linux/interrupt.h> 17 + #include <linux/i2c.h> 18 + #include <linux/input.h> 19 + #include <linux/input/mt.h> 20 + #include <linux/module.h> 21 + #include <linux/of.h> 22 + 23 + #define ICN8318_REG_POWER 4 24 + #define ICN8318_REG_TOUCHDATA 16 25 + 26 + #define ICN8318_POWER_ACTIVE 0 27 + #define ICN8318_POWER_MONITOR 1 28 + #define ICN8318_POWER_HIBERNATE 2 29 + 30 + #define ICN8318_MAX_TOUCHES 5 31 + 32 + struct icn8318_touch { 33 + __u8 slot; 34 + __be16 x; 35 + __be16 y; 36 + __u8 pressure; /* Seems more like finger width then pressure really */ 37 + __u8 event; 38 + /* The difference between 2 and 3 is unclear */ 39 + #define ICN8318_EVENT_NO_DATA 1 /* No finger seen yet since wakeup */ 40 + #define ICN8318_EVENT_UPDATE1 2 /* New or updated coordinates */ 41 + #define ICN8318_EVENT_UPDATE2 3 /* New or updated coordinates */ 42 + #define ICN8318_EVENT_END 4 /* Finger lifted */ 43 + } __packed; 44 + 45 + struct icn8318_touch_data { 46 + __u8 softbutton; 47 + __u8 touch_count; 48 + struct icn8318_touch touches[ICN8318_MAX_TOUCHES]; 49 + } __packed; 50 + 51 + struct icn8318_data { 52 + struct i2c_client *client; 53 + struct input_dev *input; 54 + struct gpio_desc *wake_gpio; 55 + u32 max_x; 56 + u32 max_y; 57 + bool invert_x; 58 + bool invert_y; 59 + bool swap_x_y; 60 + }; 61 + 62 + static int icn8318_read_touch_data(struct i2c_client *client, 63 + struct icn8318_touch_data *touch_data) 64 + { 65 + u8 reg = ICN8318_REG_TOUCHDATA; 66 + struct i2c_msg msg[2] = { 67 + { 68 + .addr = client->addr, 69 + .len = 1, 70 + .buf = &reg 71 + }, 72 + { 73 + .addr = client->addr, 74 + .flags = I2C_M_RD, 75 + .len = sizeof(struct icn8318_touch_data), 76 + .buf = (u8 *)touch_data 77 + } 78 + }; 79 + 80 + return i2c_transfer(client->adapter, msg, 2); 81 + } 82 + 83 + static inline bool icn8318_touch_active(u8 event) 84 + { 85 + return (event == ICN8318_EVENT_UPDATE1) || 86 + (event == ICN8318_EVENT_UPDATE2); 87 + } 88 + 89 + static irqreturn_t icn8318_irq(int irq, void *dev_id) 90 + { 91 + struct icn8318_data *data = dev_id; 92 + struct device *dev = &data->client->dev; 93 + struct icn8318_touch_data touch_data; 94 + int i, ret, x, y; 95 + 96 + ret = icn8318_read_touch_data(data->client, &touch_data); 97 + if (ret < 0) { 98 + dev_err(dev, "Error reading touch data: %d\n", ret); 99 + return IRQ_HANDLED; 100 + } 101 + 102 + if (touch_data.softbutton) { 103 + /* 104 + * Other data is invalid when a softbutton is pressed. 105 + * This needs some extra devicetree bindings to map the icn8318 106 + * softbutton codes to evdev codes. Currently no known devices 107 + * use this. 108 + */ 109 + return IRQ_HANDLED; 110 + } 111 + 112 + if (touch_data.touch_count > ICN8318_MAX_TOUCHES) { 113 + dev_warn(dev, "Too much touches %d > %d\n", 114 + touch_data.touch_count, ICN8318_MAX_TOUCHES); 115 + touch_data.touch_count = ICN8318_MAX_TOUCHES; 116 + } 117 + 118 + for (i = 0; i < touch_data.touch_count; i++) { 119 + struct icn8318_touch *touch = &touch_data.touches[i]; 120 + bool act = icn8318_touch_active(touch->event); 121 + 122 + input_mt_slot(data->input, touch->slot); 123 + input_mt_report_slot_state(data->input, MT_TOOL_FINGER, act); 124 + if (!act) 125 + continue; 126 + 127 + x = be16_to_cpu(touch->x); 128 + y = be16_to_cpu(touch->y); 129 + 130 + if (data->invert_x) 131 + x = data->max_x - x; 132 + 133 + if (data->invert_y) 134 + y = data->max_y - y; 135 + 136 + if (!data->swap_x_y) { 137 + input_event(data->input, EV_ABS, ABS_MT_POSITION_X, x); 138 + input_event(data->input, EV_ABS, ABS_MT_POSITION_Y, y); 139 + } else { 140 + input_event(data->input, EV_ABS, ABS_MT_POSITION_X, y); 141 + input_event(data->input, EV_ABS, ABS_MT_POSITION_Y, x); 142 + } 143 + } 144 + 145 + input_mt_sync_frame(data->input); 146 + input_sync(data->input); 147 + 148 + return IRQ_HANDLED; 149 + } 150 + 151 + static int icn8318_start(struct input_dev *dev) 152 + { 153 + struct icn8318_data *data = input_get_drvdata(dev); 154 + 155 + enable_irq(data->client->irq); 156 + gpiod_set_value_cansleep(data->wake_gpio, 1); 157 + 158 + return 0; 159 + } 160 + 161 + static void icn8318_stop(struct input_dev *dev) 162 + { 163 + struct icn8318_data *data = input_get_drvdata(dev); 164 + 165 + disable_irq(data->client->irq); 166 + i2c_smbus_write_byte_data(data->client, ICN8318_REG_POWER, 167 + ICN8318_POWER_HIBERNATE); 168 + gpiod_set_value_cansleep(data->wake_gpio, 0); 169 + } 170 + 171 + #ifdef CONFIG_PM_SLEEP 172 + static int icn8318_suspend(struct device *dev) 173 + { 174 + struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev)); 175 + 176 + mutex_lock(&data->input->mutex); 177 + if (data->input->users) 178 + icn8318_stop(data->input); 179 + mutex_unlock(&data->input->mutex); 180 + 181 + return 0; 182 + } 183 + 184 + static int icn8318_resume(struct device *dev) 185 + { 186 + struct icn8318_data *data = i2c_get_clientdata(to_i2c_client(dev)); 187 + 188 + mutex_lock(&data->input->mutex); 189 + if (data->input->users) 190 + icn8318_start(data->input); 191 + mutex_unlock(&data->input->mutex); 192 + 193 + return 0; 194 + } 195 + #endif 196 + 197 + static SIMPLE_DEV_PM_OPS(icn8318_pm_ops, icn8318_suspend, icn8318_resume); 198 + 199 + static int icn8318_probe(struct i2c_client *client, 200 + const struct i2c_device_id *id) 201 + { 202 + struct device *dev = &client->dev; 203 + struct device_node *np = dev->of_node; 204 + struct icn8318_data *data; 205 + struct input_dev *input; 206 + u32 fuzz_x = 0, fuzz_y = 0; 207 + int error; 208 + 209 + if (!client->irq) { 210 + dev_err(dev, "Error no irq specified\n"); 211 + return -EINVAL; 212 + } 213 + 214 + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 215 + if (!data) 216 + return -ENOMEM; 217 + 218 + data->wake_gpio = devm_gpiod_get(dev, "wake", GPIOD_OUT_LOW); 219 + if (IS_ERR(data->wake_gpio)) { 220 + error = PTR_ERR(data->wake_gpio); 221 + if (error != -EPROBE_DEFER) 222 + dev_err(dev, "Error getting wake gpio: %d\n", error); 223 + return error; 224 + } 225 + 226 + if (of_property_read_u32(np, "touchscreen-size-x", &data->max_x) || 227 + of_property_read_u32(np, "touchscreen-size-y", &data->max_y)) { 228 + dev_err(dev, "Error touchscreen-size-x and/or -y missing\n"); 229 + return -EINVAL; 230 + } 231 + 232 + /* Optional */ 233 + of_property_read_u32(np, "touchscreen-fuzz-x", &fuzz_x); 234 + of_property_read_u32(np, "touchscreen-fuzz-y", &fuzz_y); 235 + data->invert_x = of_property_read_bool(np, "touchscreen-inverted-x"); 236 + data->invert_y = of_property_read_bool(np, "touchscreen-inverted-y"); 237 + data->swap_x_y = of_property_read_bool(np, "touchscreen-swapped-x-y"); 238 + 239 + input = devm_input_allocate_device(dev); 240 + if (!input) 241 + return -ENOMEM; 242 + 243 + input->name = client->name; 244 + input->id.bustype = BUS_I2C; 245 + input->open = icn8318_start; 246 + input->close = icn8318_stop; 247 + input->dev.parent = dev; 248 + 249 + if (!data->swap_x_y) { 250 + input_set_abs_params(input, ABS_MT_POSITION_X, 0, 251 + data->max_x, fuzz_x, 0); 252 + input_set_abs_params(input, ABS_MT_POSITION_Y, 0, 253 + data->max_y, fuzz_y, 0); 254 + } else { 255 + input_set_abs_params(input, ABS_MT_POSITION_X, 0, 256 + data->max_y, fuzz_y, 0); 257 + input_set_abs_params(input, ABS_MT_POSITION_Y, 0, 258 + data->max_x, fuzz_x, 0); 259 + } 260 + 261 + error = input_mt_init_slots(input, ICN8318_MAX_TOUCHES, 262 + INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); 263 + if (error) 264 + return error; 265 + 266 + data->client = client; 267 + data->input = input; 268 + input_set_drvdata(input, data); 269 + 270 + error = devm_request_threaded_irq(dev, client->irq, NULL, icn8318_irq, 271 + IRQF_ONESHOT, client->name, data); 272 + if (error) { 273 + dev_err(dev, "Error requesting irq: %d\n", error); 274 + return error; 275 + } 276 + 277 + /* Stop device till opened */ 278 + icn8318_stop(data->input); 279 + 280 + error = input_register_device(input); 281 + if (error) 282 + return error; 283 + 284 + i2c_set_clientdata(client, data); 285 + 286 + return 0; 287 + } 288 + 289 + static const struct of_device_id icn8318_of_match[] = { 290 + { .compatible = "chipone,icn8318" }, 291 + { } 292 + }; 293 + MODULE_DEVICE_TABLE(of, icn8318_of_match); 294 + 295 + /* This is useless for OF-enabled devices, but it is needed by I2C subsystem */ 296 + static const struct i2c_device_id icn8318_i2c_id[] = { 297 + { }, 298 + }; 299 + MODULE_DEVICE_TABLE(i2c, icn8318_i2c_id); 300 + 301 + static struct i2c_driver icn8318_driver = { 302 + .driver = { 303 + .owner = THIS_MODULE, 304 + .name = "chipone_icn8318", 305 + .pm = &icn8318_pm_ops, 306 + .of_match_table = icn8318_of_match, 307 + }, 308 + .probe = icn8318_probe, 309 + .id_table = icn8318_i2c_id, 310 + }; 311 + 312 + module_i2c_driver(icn8318_driver); 313 + 314 + MODULE_DESCRIPTION("ChipOne icn8318 I2C Touchscreen Driver"); 315 + MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>"); 316 + MODULE_LICENSE("GPL");
+5 -1
drivers/input/touchscreen/edt-ft5x06.c
··· 37 37 #include <linux/gpio.h> 38 38 #include <linux/of_gpio.h> 39 39 #include <linux/input/mt.h> 40 + #include <linux/input/touchscreen.h> 40 41 #include <linux/input/edt-ft5x06.h> 41 42 42 43 #define MAX_SUPPORT_POINTS 5 ··· 1035 1034 input->id.bustype = BUS_I2C; 1036 1035 input->dev.parent = &client->dev; 1037 1036 1038 - __set_bit(EV_SYN, input->evbit); 1039 1037 __set_bit(EV_KEY, input->evbit); 1040 1038 __set_bit(EV_ABS, input->evbit); 1041 1039 __set_bit(BTN_TOUCH, input->keybit); ··· 1044 1044 0, tsdata->num_x * 64 - 1, 0, 0); 1045 1045 input_set_abs_params(input, ABS_MT_POSITION_Y, 1046 1046 0, tsdata->num_y * 64 - 1, 0, 0); 1047 + 1048 + if (!pdata) 1049 + touchscreen_parse_of_params(input); 1050 + 1047 1051 error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, 0); 1048 1052 if (error) { 1049 1053 dev_err(&client->dev, "Unable to init MT slots.\n");
+10 -4
drivers/input/touchscreen/elants_i2c.c
··· 98 98 #define MAX_FW_UPDATE_RETRIES 30 99 99 100 100 #define ELAN_FW_PAGESIZE 132 101 - #define ELAN_FW_FILENAME "elants_i2c.bin" 102 101 103 102 /* calibration timeout definition */ 104 103 #define ELAN_CALI_TIMEOUT_MSEC 10000 ··· 696 697 { 697 698 struct i2c_client *client = ts->client; 698 699 const struct firmware *fw; 700 + char *fw_name; 699 701 int error; 700 702 701 - error = request_firmware(&fw, ELAN_FW_FILENAME, &client->dev); 703 + fw_name = kasprintf(GFP_KERNEL, "elants_i2c_%4x.bin", ts->hw_version); 704 + if (!fw_name) 705 + return -ENOMEM; 706 + 707 + dev_info(&client->dev, "requesting fw name = %s\n", fw_name); 708 + error = request_firmware(&fw, fw_name, &client->dev); 709 + kfree(fw_name); 702 710 if (error) { 703 - dev_err(&client->dev, "failed to request firmware %s: %d\n", 704 - ELAN_FW_FILENAME, error); 711 + dev_err(&client->dev, "failed to request firmware: %d\n", 712 + error); 705 713 return error; 706 714 } 707 715
+29 -7
drivers/input/touchscreen/goodix.c
··· 23 23 #include <linux/irq.h> 24 24 #include <linux/interrupt.h> 25 25 #include <linux/slab.h> 26 + #include <linux/acpi.h> 27 + #include <linux/of.h> 26 28 #include <asm/unaligned.h> 27 29 28 30 struct goodix_ts_data { ··· 50 48 #define GOODIX_REG_VERSION 0x8140 51 49 52 50 #define RESOLUTION_LOC 1 51 + #define MAX_CONTACTS_LOC 5 53 52 #define TRIGGER_LOC 6 54 53 55 54 static const unsigned long goodix_irq_flags[] = { ··· 102 99 } 103 100 104 101 touch_num = data[0] & 0x0f; 105 - if (touch_num > GOODIX_MAX_CONTACTS) 102 + if (touch_num > ts->max_touch_num) 106 103 return -EPROTO; 107 104 108 105 if (touch_num > 1) { ··· 144 141 */ 145 142 static void goodix_process_events(struct goodix_ts_data *ts) 146 143 { 147 - u8 point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS]; 144 + u8 point_data[1 + GOODIX_CONTACT_SIZE * ts->max_touch_num]; 148 145 int touch_num; 149 146 int i; 150 147 ··· 205 202 ts->abs_x_max = GOODIX_MAX_WIDTH; 206 203 ts->abs_y_max = GOODIX_MAX_HEIGHT; 207 204 ts->int_trigger_type = GOODIX_INT_TRIGGER; 205 + ts->max_touch_num = GOODIX_MAX_CONTACTS; 208 206 return; 209 207 } 210 208 211 209 ts->abs_x_max = get_unaligned_le16(&config[RESOLUTION_LOC]); 212 210 ts->abs_y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]); 213 - ts->int_trigger_type = (config[TRIGGER_LOC]) & 0x03; 214 - if (!ts->abs_x_max || !ts->abs_y_max) { 211 + ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; 212 + ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; 213 + if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { 215 214 dev_err(&ts->client->dev, 216 215 "Invalid config, using defaults\n"); 217 216 ts->abs_x_max = GOODIX_MAX_WIDTH; 218 217 ts->abs_y_max = GOODIX_MAX_HEIGHT; 218 + ts->max_touch_num = GOODIX_MAX_CONTACTS; 219 219 } 220 220 } 221 - 222 221 223 222 /** 224 223 * goodix_read_version - Read goodix touchscreen version ··· 300 295 input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); 301 296 input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); 302 297 303 - input_mt_init_slots(ts->input_dev, GOODIX_MAX_CONTACTS, 298 + input_mt_init_slots(ts->input_dev, ts->max_touch_num, 304 299 INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); 305 300 306 301 ts->input_dev->name = "Goodix Capacitive TouchScreen"; ··· 377 372 { } 378 373 }; 379 374 375 + #ifdef CONFIG_ACPI 380 376 static const struct acpi_device_id goodix_acpi_match[] = { 381 377 { "GDIX1001", 0 }, 382 378 { } 383 379 }; 384 380 MODULE_DEVICE_TABLE(acpi, goodix_acpi_match); 381 + #endif 382 + 383 + #ifdef CONFIG_OF 384 + static const struct of_device_id goodix_of_match[] = { 385 + { .compatible = "goodix,gt911" }, 386 + { .compatible = "goodix,gt9110" }, 387 + { .compatible = "goodix,gt912" }, 388 + { .compatible = "goodix,gt927" }, 389 + { .compatible = "goodix,gt9271" }, 390 + { .compatible = "goodix,gt928" }, 391 + { .compatible = "goodix,gt967" }, 392 + { } 393 + }; 394 + MODULE_DEVICE_TABLE(of, goodix_of_match); 395 + #endif 385 396 386 397 static struct i2c_driver goodix_ts_driver = { 387 398 .probe = goodix_ts_probe, ··· 405 384 .driver = { 406 385 .name = "Goodix-TS", 407 386 .owner = THIS_MODULE, 408 - .acpi_match_table = goodix_acpi_match, 387 + .acpi_match_table = ACPI_PTR(goodix_acpi_match), 388 + .of_match_table = of_match_ptr(goodix_of_match), 409 389 }, 410 390 }; 411 391 module_i2c_driver(goodix_ts_driver);
+52 -10
drivers/input/touchscreen/of_touchscreen.c
··· 11 11 12 12 #include <linux/of.h> 13 13 #include <linux/input.h> 14 + #include <linux/input/mt.h> 14 15 #include <linux/input/touchscreen.h> 16 + 17 + static u32 of_get_optional_u32(struct device_node *np, 18 + const char *property) 19 + { 20 + u32 val = 0; 21 + 22 + of_property_read_u32(np, property, &val); 23 + 24 + return val; 25 + } 26 + 27 + static void touchscreen_set_params(struct input_dev *dev, 28 + unsigned long axis, 29 + int max, int fuzz) 30 + { 31 + struct input_absinfo *absinfo; 32 + 33 + if (!test_bit(axis, dev->absbit)) { 34 + /* 35 + * Emit a warning only if the axis is not a multitouch 36 + * axis, which might not be set by the driver. 37 + */ 38 + if (!input_is_mt_axis(axis)) 39 + dev_warn(&dev->dev, 40 + "DT specifies parameters but the axis is not set up\n"); 41 + return; 42 + } 43 + 44 + absinfo = &dev->absinfo[axis]; 45 + absinfo->maximum = max; 46 + absinfo->fuzz = fuzz; 47 + } 15 48 16 49 /** 17 50 * touchscreen_parse_of_params - parse common touchscreen DT properties ··· 57 24 void touchscreen_parse_of_params(struct input_dev *dev) 58 25 { 59 26 struct device_node *np = dev->dev.parent->of_node; 60 - struct input_absinfo *absinfo; 27 + u32 maximum, fuzz; 61 28 62 29 input_alloc_absinfo(dev); 63 30 if (!dev->absinfo) 64 31 return; 65 32 66 - absinfo = &dev->absinfo[ABS_X]; 67 - of_property_read_u32(np, "touchscreen-size-x", &absinfo->maximum); 68 - of_property_read_u32(np, "touchscreen-fuzz-x", &absinfo->fuzz); 33 + maximum = of_get_optional_u32(np, "touchscreen-size-x"); 34 + fuzz = of_get_optional_u32(np, "touchscreen-fuzz-x"); 35 + if (maximum || fuzz) { 36 + touchscreen_set_params(dev, ABS_X, maximum, fuzz); 37 + touchscreen_set_params(dev, ABS_MT_POSITION_X, maximum, fuzz); 38 + } 69 39 70 - absinfo = &dev->absinfo[ABS_Y]; 71 - of_property_read_u32(np, "touchscreen-size-y", &absinfo->maximum); 72 - of_property_read_u32(np, "touchscreen-fuzz-y", &absinfo->fuzz); 40 + maximum = of_get_optional_u32(np, "touchscreen-size-y"); 41 + fuzz = of_get_optional_u32(np, "touchscreen-fuzz-y"); 42 + if (maximum || fuzz) { 43 + touchscreen_set_params(dev, ABS_Y, maximum, fuzz); 44 + touchscreen_set_params(dev, ABS_MT_POSITION_Y, maximum, fuzz); 45 + } 73 46 74 - absinfo = &dev->absinfo[ABS_PRESSURE]; 75 - of_property_read_u32(np, "touchscreen-max-pressure", &absinfo->maximum); 76 - of_property_read_u32(np, "touchscreen-fuzz-pressure", &absinfo->fuzz); 47 + maximum = of_get_optional_u32(np, "touchscreen-max-pressure"); 48 + fuzz = of_get_optional_u32(np, "touchscreen-fuzz-pressure"); 49 + if (maximum || fuzz) { 50 + touchscreen_set_params(dev, ABS_PRESSURE, maximum, fuzz); 51 + touchscreen_set_params(dev, ABS_MT_PRESSURE, maximum, fuzz); 52 + } 77 53 } 78 54 EXPORT_SYMBOL(touchscreen_parse_of_params);
+34 -12
drivers/input/touchscreen/sun4i-ts.c
··· 30 30 * These kinds of heuristics are just asking for trouble (and don't belong 31 31 * in the kernel). So this driver offers straight forward, reliable single 32 32 * touch functionality only. 33 + * 34 + * s.a. A20 User Manual "1.15 TP" (Documentation/arm/sunxi/README) 35 + * (looks like the description in the A20 User Manual v1.3 is better 36 + * than the one in the A10 User Manual v.1.5) 33 37 */ 34 38 35 39 #include <linux/err.h> ··· 197 193 if (ts->temp_data == -1) 198 194 return -EAGAIN; 199 195 200 - *temp = (ts->temp_data - ts->temp_offset) * ts->temp_step; 196 + *temp = ts->temp_data * ts->temp_step - ts->temp_offset; 201 197 202 198 return 0; 203 199 } ··· 250 246 int error; 251 247 u32 reg; 252 248 bool ts_attached; 249 + u32 tp_sensitive_adjust = 15; 250 + u32 filter_type = 1; 253 251 254 252 ts = devm_kzalloc(dev, sizeof(struct sun4i_ts_data), GFP_KERNEL); 255 253 if (!ts) ··· 261 255 ts->ignore_fifo_data = true; 262 256 ts->temp_data = -1; 263 257 if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts")) { 264 - /* Allwinner SDK has temperature = -271 + (value / 6) (C) */ 265 - ts->temp_offset = 1626; 258 + /* Allwinner SDK has temperature (C) = (value / 6) - 271 */ 259 + ts->temp_offset = 271000; 266 260 ts->temp_step = 167; 261 + } else if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) { 262 + /* 263 + * The A10 temperature sensor has quite a wide spread, these 264 + * parameters are based on the averaging of the calibration 265 + * results of 4 completely different boards, with a spread of 266 + * temp_step from 0.096 - 0.170 and temp_offset from 176 - 331. 267 + */ 268 + ts->temp_offset = 257000; 269 + ts->temp_step = 133; 267 270 } else { 268 271 /* 269 272 * The user manuals do not contain the formula for calculating 270 273 * the temperature. The formula used here is from the AXP209, 271 274 * which is designed by X-Powers, an affiliate of Allwinner: 272 275 * 273 - * temperature = -144.7 + (value * 0.1) 276 + * temperature (C) = (value * 0.1) - 144.7 274 277 * 275 278 * Allwinner does not have any documentation whatsoever for 276 279 * this hardware. Moreover, it is claimed that the sensor 277 280 * is inaccurate and cannot work properly. 278 281 */ 279 - ts->temp_offset = 1447; 282 + ts->temp_offset = 144700; 280 283 ts->temp_step = 100; 281 284 } 282 285 ··· 328 313 ts->base + TP_CTRL0); 329 314 330 315 /* 331 - * sensitive_adjust = 15 : max, which is not all that sensitive, 316 + * tp_sensitive_adjust is an optional property 332 317 * tp_mode = 0 : only x and y coordinates, as we don't use dual touch 333 318 */ 334 - writel(TP_SENSITIVE_ADJUST(15) | TP_MODE_SELECT(0), 319 + of_property_read_u32(np, "allwinner,tp-sensitive-adjust", 320 + &tp_sensitive_adjust); 321 + writel(TP_SENSITIVE_ADJUST(tp_sensitive_adjust) | TP_MODE_SELECT(0), 335 322 ts->base + TP_CTRL2); 336 323 337 - /* Enable median filter, type 1 : 5/3 */ 338 - writel(FILTER_EN(1) | FILTER_TYPE(1), ts->base + TP_CTRL3); 324 + /* 325 + * Enable median and averaging filter, optional property for 326 + * filter type. 327 + */ 328 + of_property_read_u32(np, "allwinner,filter-type", &filter_type); 329 + writel(FILTER_EN(1) | FILTER_TYPE(filter_type), ts->base + TP_CTRL3); 339 330 340 331 /* Enable temperature measurement, period 1953 (2 seconds) */ 341 332 writel(TEMP_ENABLE(1) | TEMP_PERIOD(1953), ts->base + TP_TPR); ··· 351 330 * finally enable tp mode. 352 331 */ 353 332 reg = STYLUS_UP_DEBOUN(5) | STYLUS_UP_DEBOUN_EN(1); 354 - if (of_device_is_compatible(np, "allwinner,sun4i-a10-ts")) 355 - reg |= TP_MODE_EN(1); 356 - else 333 + if (of_device_is_compatible(np, "allwinner,sun6i-a31-ts")) 357 334 reg |= SUN6I_TP_MODE_EN(1); 335 + else 336 + reg |= TP_MODE_EN(1); 358 337 writel(reg, ts->base + TP_CTRL1); 359 338 360 339 /* ··· 404 383 405 384 static const struct of_device_id sun4i_ts_of_match[] = { 406 385 { .compatible = "allwinner,sun4i-a10-ts", }, 386 + { .compatible = "allwinner,sun5i-a13-ts", }, 407 387 { .compatible = "allwinner,sun6i-a31-ts", }, 408 388 { /* sentinel */ } 409 389 };
+286
drivers/input/touchscreen/sx8654.c
··· 1 + /* 2 + * Driver for Semtech SX8654 I2C touchscreen controller. 3 + * 4 + * Copyright (c) 2015 Armadeus Systems 5 + * Sébastien Szymanski <sebastien.szymanski@armadeus.com> 6 + * 7 + * Using code from: 8 + * - sx865x.c 9 + * Copyright (c) 2013 U-MoBo Srl 10 + * Pierluigi Passaro <p.passaro@u-mobo.com> 11 + * - sx8650.c 12 + * Copyright (c) 2009 Wayne Roberts 13 + * - tsc2007.c 14 + * Copyright (c) 2008 Kwangwoo Lee 15 + * - ads7846.c 16 + * Copyright (c) 2005 David Brownell 17 + * Copyright (c) 2006 Nokia Corporation 18 + * - corgi_ts.c 19 + * Copyright (C) 2004-2005 Richard Purdie 20 + * - omap_ts.[hc], ads7846.h, ts_osk.c 21 + * Copyright (C) 2002 MontaVista Software 22 + * Copyright (C) 2004 Texas Instruments 23 + * Copyright (C) 2005 Dirk Behme 24 + * 25 + * This program is free software; you can redistribute it and/or modify 26 + * it under the terms of the GNU General Public License version 2 as 27 + * published by the Free Software Foundation. 28 + */ 29 + 30 + #include <linux/input.h> 31 + #include <linux/module.h> 32 + #include <linux/of.h> 33 + #include <linux/i2c.h> 34 + #include <linux/interrupt.h> 35 + #include <linux/irq.h> 36 + 37 + /* register addresses */ 38 + #define I2C_REG_TOUCH0 0x00 39 + #define I2C_REG_TOUCH1 0x01 40 + #define I2C_REG_CHANMASK 0x04 41 + #define I2C_REG_IRQMASK 0x22 42 + #define I2C_REG_IRQSRC 0x23 43 + #define I2C_REG_SOFTRESET 0x3f 44 + 45 + /* commands */ 46 + #define CMD_READ_REGISTER 0x40 47 + #define CMD_MANUAL 0xc0 48 + #define CMD_PENTRG 0xe0 49 + 50 + /* value for I2C_REG_SOFTRESET */ 51 + #define SOFTRESET_VALUE 0xde 52 + 53 + /* bits for I2C_REG_IRQSRC */ 54 + #define IRQ_PENTOUCH_TOUCHCONVDONE 0x08 55 + #define IRQ_PENRELEASE 0x04 56 + 57 + /* bits for RegTouch1 */ 58 + #define CONDIRQ 0x20 59 + #define FILT_7SA 0x03 60 + 61 + /* bits for I2C_REG_CHANMASK */ 62 + #define CONV_X 0x80 63 + #define CONV_Y 0x40 64 + 65 + /* coordinates rate: higher nibble of CTRL0 register */ 66 + #define RATE_MANUAL 0x00 67 + #define RATE_5000CPS 0xf0 68 + 69 + /* power delay: lower nibble of CTRL0 register */ 70 + #define POWDLY_1_1MS 0x0b 71 + 72 + #define MAX_12BIT ((1 << 12) - 1) 73 + 74 + struct sx8654 { 75 + struct input_dev *input; 76 + struct i2c_client *client; 77 + }; 78 + 79 + static irqreturn_t sx8654_irq(int irq, void *handle) 80 + { 81 + struct sx8654 *sx8654 = handle; 82 + int irqsrc; 83 + u8 data[4]; 84 + unsigned int x, y; 85 + int retval; 86 + 87 + irqsrc = i2c_smbus_read_byte_data(sx8654->client, 88 + CMD_READ_REGISTER | I2C_REG_IRQSRC); 89 + dev_dbg(&sx8654->client->dev, "irqsrc = 0x%x", irqsrc); 90 + 91 + if (irqsrc < 0) 92 + goto out; 93 + 94 + if (irqsrc & IRQ_PENRELEASE) { 95 + dev_dbg(&sx8654->client->dev, "pen release interrupt"); 96 + 97 + input_report_key(sx8654->input, BTN_TOUCH, 0); 98 + input_sync(sx8654->input); 99 + } 100 + 101 + if (irqsrc & IRQ_PENTOUCH_TOUCHCONVDONE) { 102 + dev_dbg(&sx8654->client->dev, "pen touch interrupt"); 103 + 104 + retval = i2c_master_recv(sx8654->client, data, sizeof(data)); 105 + if (retval != sizeof(data)) 106 + goto out; 107 + 108 + /* invalid data */ 109 + if (unlikely(data[0] & 0x80 || data[2] & 0x80)) 110 + goto out; 111 + 112 + x = ((data[0] & 0xf) << 8) | (data[1]); 113 + y = ((data[2] & 0xf) << 8) | (data[3]); 114 + 115 + input_report_abs(sx8654->input, ABS_X, x); 116 + input_report_abs(sx8654->input, ABS_Y, y); 117 + input_report_key(sx8654->input, BTN_TOUCH, 1); 118 + input_sync(sx8654->input); 119 + 120 + dev_dbg(&sx8654->client->dev, "point(%4d,%4d)\n", x, y); 121 + } 122 + 123 + out: 124 + return IRQ_HANDLED; 125 + } 126 + 127 + static int sx8654_open(struct input_dev *dev) 128 + { 129 + struct sx8654 *sx8654 = input_get_drvdata(dev); 130 + struct i2c_client *client = sx8654->client; 131 + int error; 132 + 133 + /* enable pen trigger mode */ 134 + error = i2c_smbus_write_byte_data(client, I2C_REG_TOUCH0, 135 + RATE_5000CPS | POWDLY_1_1MS); 136 + if (error) { 137 + dev_err(&client->dev, "writing to I2C_REG_TOUCH0 failed"); 138 + return error; 139 + } 140 + 141 + error = i2c_smbus_write_byte(client, CMD_PENTRG); 142 + if (error) { 143 + dev_err(&client->dev, "writing command CMD_PENTRG failed"); 144 + return error; 145 + } 146 + 147 + enable_irq(client->irq); 148 + 149 + return 0; 150 + } 151 + 152 + static void sx8654_close(struct input_dev *dev) 153 + { 154 + struct sx8654 *sx8654 = input_get_drvdata(dev); 155 + struct i2c_client *client = sx8654->client; 156 + int error; 157 + 158 + disable_irq(client->irq); 159 + 160 + /* enable manual mode mode */ 161 + error = i2c_smbus_write_byte(client, CMD_MANUAL); 162 + if (error) { 163 + dev_err(&client->dev, "writing command CMD_MANUAL failed"); 164 + return; 165 + } 166 + 167 + error = i2c_smbus_write_byte_data(client, I2C_REG_TOUCH0, 0); 168 + if (error) { 169 + dev_err(&client->dev, "writing to I2C_REG_TOUCH0 failed"); 170 + return; 171 + } 172 + } 173 + 174 + static int sx8654_probe(struct i2c_client *client, 175 + const struct i2c_device_id *id) 176 + { 177 + struct sx8654 *sx8654; 178 + struct input_dev *input; 179 + int error; 180 + 181 + if (!i2c_check_functionality(client->adapter, 182 + I2C_FUNC_SMBUS_READ_WORD_DATA)) 183 + return -ENXIO; 184 + 185 + sx8654 = devm_kzalloc(&client->dev, sizeof(*sx8654), GFP_KERNEL); 186 + if (!sx8654) 187 + return -ENOMEM; 188 + 189 + input = devm_input_allocate_device(&client->dev); 190 + if (!sx8654) 191 + return -ENOMEM; 192 + 193 + input->name = "SX8654 I2C Touchscreen"; 194 + input->id.bustype = BUS_I2C; 195 + input->dev.parent = &client->dev; 196 + input->open = sx8654_open; 197 + input->close = sx8654_close; 198 + 199 + __set_bit(INPUT_PROP_DIRECT, input->propbit); 200 + input_set_capability(input, EV_KEY, BTN_TOUCH); 201 + input_set_abs_params(input, ABS_X, 0, MAX_12BIT, 0, 0); 202 + input_set_abs_params(input, ABS_Y, 0, MAX_12BIT, 0, 0); 203 + 204 + sx8654->client = client; 205 + sx8654->input = input; 206 + 207 + input_set_drvdata(sx8654->input, sx8654); 208 + 209 + error = i2c_smbus_write_byte_data(client, I2C_REG_SOFTRESET, 210 + SOFTRESET_VALUE); 211 + if (error) { 212 + dev_err(&client->dev, "writing softreset value failed"); 213 + return error; 214 + } 215 + 216 + error = i2c_smbus_write_byte_data(client, I2C_REG_CHANMASK, 217 + CONV_X | CONV_Y); 218 + if (error) { 219 + dev_err(&client->dev, "writing to I2C_REG_CHANMASK failed"); 220 + return error; 221 + } 222 + 223 + error = i2c_smbus_write_byte_data(client, I2C_REG_IRQMASK, 224 + IRQ_PENTOUCH_TOUCHCONVDONE | 225 + IRQ_PENRELEASE); 226 + if (error) { 227 + dev_err(&client->dev, "writing to I2C_REG_IRQMASK failed"); 228 + return error; 229 + } 230 + 231 + error = i2c_smbus_write_byte_data(client, I2C_REG_TOUCH1, 232 + CONDIRQ | FILT_7SA); 233 + if (error) { 234 + dev_err(&client->dev, "writing to I2C_REG_TOUCH1 failed"); 235 + return error; 236 + } 237 + 238 + error = devm_request_threaded_irq(&client->dev, client->irq, 239 + NULL, sx8654_irq, 240 + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 241 + client->name, sx8654); 242 + if (error) { 243 + dev_err(&client->dev, 244 + "Failed to enable IRQ %d, error: %d\n", 245 + client->irq, error); 246 + return error; 247 + } 248 + 249 + /* Disable the IRQ, we'll enable it in sx8654_open() */ 250 + disable_irq(client->irq); 251 + 252 + error = input_register_device(sx8654->input); 253 + if (error) 254 + return error; 255 + 256 + i2c_set_clientdata(client, sx8654); 257 + return 0; 258 + } 259 + 260 + #ifdef CONFIG_OF 261 + static const struct of_device_id sx8654_of_match[] = { 262 + { .compatible = "semtech,sx8654", }, 263 + { }, 264 + }; 265 + MODULE_DEVICE_TABLE(of, sx8654_of_match); 266 + #endif 267 + 268 + static const struct i2c_device_id sx8654_id_table[] = { 269 + { "semtech_sx8654", 0 }, 270 + { }, 271 + }; 272 + MODULE_DEVICE_TABLE(i2c, sx8654_id_table); 273 + 274 + static struct i2c_driver sx8654_driver = { 275 + .driver = { 276 + .name = "sx8654", 277 + .of_match_table = of_match_ptr(sx8654_of_match), 278 + }, 279 + .id_table = sx8654_id_table, 280 + .probe = sx8654_probe, 281 + }; 282 + module_i2c_driver(sx8654_driver); 283 + 284 + MODULE_AUTHOR("Sébastien Szymanski <sebastien.szymanski@armadeus.com>"); 285 + MODULE_DESCRIPTION("Semtech SX8654 I2C Touchscreen Driver"); 286 + MODULE_LICENSE("GPL");
+5 -6
drivers/input/touchscreen/tsc2007.c
··· 75 75 u16 model; 76 76 u16 x_plate_ohms; 77 77 u16 max_rt; 78 - unsigned long poll_period; 78 + unsigned long poll_period; /* in jiffies */ 79 79 int fuzzx; 80 80 int fuzzy; 81 81 int fuzzz; ··· 214 214 dev_dbg(&ts->client->dev, "ignored pressure %d\n", rt); 215 215 } 216 216 217 - wait_event_timeout(ts->wait, ts->stopped, 218 - msecs_to_jiffies(ts->poll_period)); 217 + wait_event_timeout(ts->wait, ts->stopped, ts->poll_period); 219 218 } 220 219 221 220 dev_dbg(&ts->client->dev, "UP\n"); ··· 313 314 ts->fuzzz = val32; 314 315 315 316 if (!of_property_read_u64(np, "ti,poll-period", &val64)) 316 - ts->poll_period = val64; 317 + ts->poll_period = msecs_to_jiffies(val64); 317 318 else 318 - ts->poll_period = 1; 319 + ts->poll_period = msecs_to_jiffies(1); 319 320 320 321 if (!of_property_read_u32(np, "ti,x-plate-ohms", &val32)) { 321 322 ts->x_plate_ohms = val32; ··· 349 350 ts->model = pdata->model; 350 351 ts->x_plate_ohms = pdata->x_plate_ohms; 351 352 ts->max_rt = pdata->max_rt ? : MAX_12BIT; 352 - ts->poll_period = pdata->poll_period ? : 1; 353 + ts->poll_period = msecs_to_jiffies(pdata->poll_period ? : 1); 353 354 ts->get_pendown_state = pdata->get_pendown_state; 354 355 ts->clear_penirq = pdata->clear_penirq; 355 356 ts->fuzzx = pdata->fuzzx;
+11
drivers/input/touchscreen/usbtouchscreen.c
··· 132 132 DEVTYPE_GUNZE, 133 133 DEVTYPE_DMC_TSC10, 134 134 DEVTYPE_IRTOUCH, 135 + DEVTYPE_IRTOUCH_HIRES, 135 136 DEVTYPE_IDEALTEK, 136 137 DEVTYPE_GENERAL_TOUCH, 137 138 DEVTYPE_GOTOP, ··· 199 198 #ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH 200 199 {USB_DEVICE(0x595a, 0x0001), .driver_info = DEVTYPE_IRTOUCH}, 201 200 {USB_DEVICE(0x6615, 0x0001), .driver_info = DEVTYPE_IRTOUCH}, 201 + {USB_DEVICE(0x6615, 0x0012), .driver_info = DEVTYPE_IRTOUCH_HIRES}, 202 202 #endif 203 203 204 204 #ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK ··· 1176 1174 .max_xc = 0x0fff, 1177 1175 .min_yc = 0x0, 1178 1176 .max_yc = 0x0fff, 1177 + .rept_size = 8, 1178 + .read_data = irtouch_read_data, 1179 + }, 1180 + 1181 + [DEVTYPE_IRTOUCH_HIRES] = { 1182 + .min_xc = 0x0, 1183 + .max_xc = 0x7fff, 1184 + .min_yc = 0x0, 1185 + .max_yc = 0x7fff, 1179 1186 .rept_size = 8, 1180 1187 .read_data = irtouch_read_data, 1181 1188 },
+3 -3
drivers/platform/x86/fujitsu-tablet.c
··· 59 59 KEY_RESERVED, 60 60 KEY_SCROLLDOWN, 61 61 KEY_SCROLLUP, 62 - KEY_DIRECTION, 62 + KEY_ROTATE_DISPLAY, 63 63 KEY_LEFTCTRL, 64 64 KEY_BRIGHTNESSUP, 65 65 KEY_BRIGHTNESSDOWN, ··· 116 116 KEY_RESERVED, 117 117 KEY_PROG1, 118 118 KEY_PROG2, 119 - KEY_DIRECTION, 119 + KEY_ROTATE_DISPLAY, 120 120 KEY_RESERVED, 121 121 KEY_RESERVED, 122 122 KEY_RESERVED, ··· 153 153 KEY_RESERVED, 154 154 KEY_RESERVED, 155 155 KEY_MAIL, 156 - KEY_DIRECTION, 156 + KEY_ROTATE_DISPLAY, 157 157 KEY_ESC, 158 158 KEY_ENTER, 159 159 KEY_BRIGHTNESSUP,
+1 -1
drivers/platform/x86/hp-wmi.c
··· 144 144 { KE_KEY, 0x20e8, { KEY_MEDIA } }, 145 145 { KE_KEY, 0x2142, { KEY_MEDIA } }, 146 146 { KE_KEY, 0x213b, { KEY_INFO } }, 147 - { KE_KEY, 0x2169, { KEY_DIRECTION } }, 147 + { KE_KEY, 0x2169, { KEY_ROTATE_DISPLAY } }, 148 148 { KE_KEY, 0x216a, { KEY_SETUP } }, 149 149 { KE_KEY, 0x231b, { KEY_HELP } }, 150 150 { KE_END, 0 }
-23
include/linux/mfd/tc3589x.h
··· 140 140 #define TC_KPD_DEBOUNCE_PERIOD 0xA3 141 141 #define TC_KPD_SETTLE_TIME 0xA3 142 142 143 - /** 144 - * struct tc35893_platform_data - data structure for platform specific data 145 - * @keymap_data: matrix scan code table for keycodes 146 - * @krow: mask for available rows, value is 0xFF 147 - * @kcol: mask for available columns, value is 0xFF 148 - * @debounce_period: platform specific debounce time 149 - * @settle_time: platform specific settle down time 150 - * @irqtype: type of interrupt, falling or rising edge 151 - * @enable_wakeup: specifies if keypad event can wake up system from sleep 152 - * @no_autorepeat: flag for auto repetition 153 - */ 154 - struct tc3589x_keypad_platform_data { 155 - const struct matrix_keymap_data *keymap_data; 156 - u8 krow; 157 - u8 kcol; 158 - u8 debounce_period; 159 - u8 settle_time; 160 - unsigned long irqtype; 161 - bool enable_wakeup; 162 - bool no_autorepeat; 163 - }; 164 143 165 144 /** 166 145 * struct tc3589x_platform_data - TC3589x platform data 167 146 * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*) 168 - * @keypad: keypad-specific platform data 169 147 */ 170 148 struct tc3589x_platform_data { 171 149 unsigned int block; 172 - const struct tc3589x_keypad_platform_data *keypad; 173 150 }; 174 151 175 152 #endif
+2 -1
include/uapi/linux/input.h
··· 369 369 #define KEY_MSDOS 151 370 370 #define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */ 371 371 #define KEY_SCREENLOCK KEY_COFFEE 372 - #define KEY_DIRECTION 153 372 + #define KEY_ROTATE_DISPLAY 153 /* Display orientation for e.g. tablets */ 373 + #define KEY_DIRECTION KEY_ROTATE_DISPLAY 373 374 #define KEY_CYCLEWINDOWS 154 374 375 #define KEY_MAIL 155 375 376 #define KEY_BOOKMARKS 156 /* AC Bookmarks */