Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 25 Jan 2014 01:17:30 +0000 (17:17 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 25 Jan 2014 01:17:30 +0000 (17:17 -0800)
Pull input subsystem updates from Dmitry Torokhov:
 "Just a swath of driver fixes and cleanups, no new drivers this time
  (although ALPS now supports one of the newer protocols, more to come)"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (57 commits)
  Input: wacom - add support for DTU-1031
  Input: wacom - fix wacom->shared guards for dual input devices
  Input: edt_ft5x06 - use devm_* functions where appropriate
  Input: hyperv-keyboard - pass through 0xE1 prefix
  Input: logips2pp - fix spelling s/reciver/receiver/
  Input: delete non-required instances of include <linux/init.h>
  Input: twl4030-keypad - convert to using managed resources
  Input: twl6040-vibra - remove unneeded check for CONFIG_OF
  Input: twl4030-keypad - add device tree support
  Input: twl6040-vibra - add missing of_node_put
  Input: twl4030-vibra - add missing of_node_put
  Input: i8042 - cleanup SERIO_I8042 dependencies
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on x86
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on unicore32
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on sparc
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO for SH_CAYMAN
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on powerpc
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on mips
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on IA64
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on ARM/Footbridge
  ...

204 files changed:
Documentation/devicetree/bindings/input/gpio-beeper.txt [new file with mode: 0644]
Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt [new file with mode: 0644]
Documentation/devicetree/bindings/input/twl4030-keypad.txt [new file with mode: 0644]
Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt [new file with mode: 0644]
Documentation/input/gamepad.txt
Documentation/input/joystick-api.txt
Documentation/input/joystick.txt
arch/alpha/Kconfig
arch/arm/mach-footbridge/Kconfig
arch/arm/mach-imx/mach-cpuimx35.c
arch/arm/mach-imx/mach-cpuimx51sd.c
arch/ia64/Kconfig
arch/mips/Kconfig
arch/powerpc/Kconfig
arch/sh/boards/Kconfig
arch/sh/boards/mach-ecovec24/setup.c
arch/sparc/Kconfig
arch/unicore32/Kconfig
arch/x86/Kconfig
drivers/input/gameport/emu10k1-gp.c
drivers/input/gameport/fm801-gp.c
drivers/input/input.c
drivers/input/joystick/a3d.c
drivers/input/joystick/adi.c
drivers/input/joystick/cobra.c
drivers/input/joystick/gf2k.c
drivers/input/joystick/grip.c
drivers/input/joystick/grip_mp.c
drivers/input/joystick/guillemot.c
drivers/input/joystick/iforce/iforce.h
drivers/input/joystick/interact.c
drivers/input/joystick/joydump.c
drivers/input/joystick/magellan.c
drivers/input/joystick/sidewinder.c
drivers/input/joystick/spaceball.c
drivers/input/joystick/spaceorb.c
drivers/input/joystick/stinger.c
drivers/input/joystick/tmdc.c
drivers/input/joystick/twidjoy.c
drivers/input/joystick/warrior.c
drivers/input/joystick/xpad.c
drivers/input/joystick/zhenhua.c
drivers/input/keyboard/Kconfig
drivers/input/keyboard/adp5520-keys.c
drivers/input/keyboard/adp5588-keys.c
drivers/input/keyboard/adp5589-keys.c
drivers/input/keyboard/bf54x-keys.c
drivers/input/keyboard/cros_ec_keyb.c
drivers/input/keyboard/davinci_keyscan.c
drivers/input/keyboard/ep93xx_keypad.c
drivers/input/keyboard/goldfish_events.c
drivers/input/keyboard/gpio_keys_polled.c
drivers/input/keyboard/hil_kbd.c
drivers/input/keyboard/imx_keypad.c
drivers/input/keyboard/jornada680_kbd.c
drivers/input/keyboard/jornada720_kbd.c
drivers/input/keyboard/lkkbd.c
drivers/input/keyboard/lm8323.c
drivers/input/keyboard/lm8333.c
drivers/input/keyboard/matrix_keypad.c
drivers/input/keyboard/max7359_keypad.c
drivers/input/keyboard/mcs_touchkey.c
drivers/input/keyboard/mpr121_touchkey.c
drivers/input/keyboard/newtonkbd.c
drivers/input/keyboard/nomadik-ske-keypad.c
drivers/input/keyboard/omap-keypad.c
drivers/input/keyboard/omap4-keypad.c
drivers/input/keyboard/pxa27x_keypad.c
drivers/input/keyboard/pxa930_rotary.c
drivers/input/keyboard/qt1070.c
drivers/input/keyboard/qt2160.c
drivers/input/keyboard/samsung-keypad.c
drivers/input/keyboard/sh_keysc.c
drivers/input/keyboard/spear-keyboard.c
drivers/input/keyboard/stmpe-keypad.c
drivers/input/keyboard/stowaway.c
drivers/input/keyboard/sunkbd.c
drivers/input/keyboard/tc3589x-keypad.c
drivers/input/keyboard/tca6416-keypad.c
drivers/input/keyboard/tnetv107x-keypad.c
drivers/input/keyboard/twl4030_keypad.c
drivers/input/keyboard/w90p910_keypad.c
drivers/input/keyboard/xtkbd.c
drivers/input/misc/Kconfig
drivers/input/misc/Makefile
drivers/input/misc/ad714x.c
drivers/input/misc/adxl34x.c
drivers/input/misc/atlas_btns.c
drivers/input/misc/bfin_rotary.c
drivers/input/misc/bma150.c
drivers/input/misc/cma3000_d0x.c
drivers/input/misc/cobalt_btns.c
drivers/input/misc/da9052_onkey.c
drivers/input/misc/da9055_onkey.c
drivers/input/misc/dm355evm_keys.c
drivers/input/misc/gp2ap002a00f.c
drivers/input/misc/gpio-beeper.c [new file with mode: 0644]
drivers/input/misc/gpio_tilt_polled.c
drivers/input/misc/keyspan_remote.c
drivers/input/misc/kxtj9.c
drivers/input/misc/max8997_haptic.c
drivers/input/misc/mc13783-pwrbutton.c
drivers/input/misc/mpu3050.c
drivers/input/misc/pcap_keys.c
drivers/input/misc/pcf50633-input.c
drivers/input/misc/pcf8574_keypad.c
drivers/input/misc/pcspkr.c
drivers/input/misc/pm8xxx-vibrator.c
drivers/input/misc/pmic8xxx-pwrkey.c
drivers/input/misc/powermate.c
drivers/input/misc/pwm-beeper.c
drivers/input/misc/retu-pwrbutton.c
drivers/input/misc/rotary_encoder.c
drivers/input/misc/sgi_btns.c
drivers/input/misc/sirfsoc-onkey.c
drivers/input/misc/twl4030-pwrbutton.c
drivers/input/misc/twl4030-vibra.c
drivers/input/misc/twl6040-vibra.c
drivers/input/misc/wm831x-on.c
drivers/input/misc/yealink.c
drivers/input/mouse/alps.c
drivers/input/mouse/alps.h
drivers/input/mouse/appletouch.c
drivers/input/mouse/bcm5974.c
drivers/input/mouse/cypress_ps2.c
drivers/input/mouse/elantech.c
drivers/input/mouse/gpio_mouse.c
drivers/input/mouse/logips2pp.c
drivers/input/mouse/navpoint.c
drivers/input/mouse/pxa930_trkball.c
drivers/input/mouse/sermouse.c
drivers/input/mouse/synaptics_usb.c
drivers/input/mouse/vsxxxaa.c
drivers/input/serio/Kconfig
drivers/input/serio/altera_ps2.c
drivers/input/serio/ambakmi.c
drivers/input/serio/hyperv-keyboard.c
drivers/input/serio/libps2.c
drivers/input/serio/olpc_apsp.c
drivers/input/serio/pcips2.c
drivers/input/serio/q40kbd.c
drivers/input/serio/rpckbd.c
drivers/input/serio/serio_raw.c
drivers/input/serio/xilinx_ps2.c
drivers/input/tablet/acecad.c
drivers/input/tablet/aiptek.c
drivers/input/tablet/gtco.c
drivers/input/tablet/hanwang.c
drivers/input/tablet/kbtab.c
drivers/input/tablet/wacom.h
drivers/input/tablet/wacom_sys.c
drivers/input/tablet/wacom_wac.c
drivers/input/tablet/wacom_wac.h
drivers/input/touchscreen/88pm860x-ts.c
drivers/input/touchscreen/ad7877.c
drivers/input/touchscreen/ad7879.c
drivers/input/touchscreen/ads7846.c
drivers/input/touchscreen/atmel_mxt_ts.c
drivers/input/touchscreen/atmel_tsadcc.c
drivers/input/touchscreen/cy8ctmg110_ts.c
drivers/input/touchscreen/cyttsp_core.c
drivers/input/touchscreen/cyttsp_i2c_common.c
drivers/input/touchscreen/da9034-ts.c
drivers/input/touchscreen/dynapro.c
drivers/input/touchscreen/edt-ft5x06.c
drivers/input/touchscreen/eeti_ts.c
drivers/input/touchscreen/egalax_ts.c
drivers/input/touchscreen/elo.c
drivers/input/touchscreen/fujitsu_ts.c
drivers/input/touchscreen/gunze.c
drivers/input/touchscreen/hampshire.c
drivers/input/touchscreen/ili210x.c
drivers/input/touchscreen/inexio.c
drivers/input/touchscreen/intel-mid-touch.c
drivers/input/touchscreen/jornada720_ts.c
drivers/input/touchscreen/lpc32xx_ts.c
drivers/input/touchscreen/mainstone-wm97xx.c
drivers/input/touchscreen/max11801_ts.c
drivers/input/touchscreen/mcs5000_ts.c
drivers/input/touchscreen/mms114.c
drivers/input/touchscreen/mtouch.c
drivers/input/touchscreen/pcap_ts.c
drivers/input/touchscreen/penmount.c
drivers/input/touchscreen/pixcir_i2c_ts.c
drivers/input/touchscreen/s3c2410_ts.c
drivers/input/touchscreen/st1232.c
drivers/input/touchscreen/stmpe-ts.c
drivers/input/touchscreen/ti_am335x_tsc.c
drivers/input/touchscreen/touchit213.c
drivers/input/touchscreen/touchright.c
drivers/input/touchscreen/touchwin.c
drivers/input/touchscreen/tsc2005.c
drivers/input/touchscreen/tsc2007.c
drivers/input/touchscreen/tsc40.c
drivers/input/touchscreen/ucb1400_ts.c
drivers/input/touchscreen/usbtouchscreen.c
drivers/input/touchscreen/wacom_w8001.c
drivers/input/touchscreen/wm831x-ts.c
drivers/input/touchscreen/wm97xx-core.c
drivers/input/touchscreen/zforce_ts.c
drivers/input/touchscreen/zylonite-wm97xx.c
include/linux/i2c/tsc2007.h
include/linux/platform_data/keypad-ep93xx.h
include/linux/platform_data/keypad-omap.h

diff --git a/Documentation/devicetree/bindings/input/gpio-beeper.txt b/Documentation/devicetree/bindings/input/gpio-beeper.txt
new file mode 100644 (file)
index 0000000..a5086e3
--- /dev/null
@@ -0,0 +1,13 @@
+* GPIO beeper device tree bindings
+
+Register a beeper connected to GPIO pin.
+
+Required properties:
+- compatible:  Should be "gpio-beeper".
+- gpios:       From common gpio binding; gpio connection to beeper enable pin.
+
+Example:
+       beeper: beeper {
+               compatible = "gpio-beeper";
+               gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>;
+       };
diff --git a/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt b/Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
new file mode 100644 (file)
index 0000000..ec365e1
--- /dev/null
@@ -0,0 +1,41 @@
+* Texas Instruments tsc2007 touchscreen controller
+
+Required properties:
+- compatible: must be "ti,tsc2007".
+- reg: I2C address of the chip.
+- ti,x-plate-ohms: X-plate resistance in ohms.
+
+Optional properties:
+- gpios: the interrupt gpio the chip is connected to (trough the penirq pin).
+  The penirq pin goes to low when the panel is touched.
+  (see GPIO binding[1] for more details).
+- interrupt-parent: the phandle for the gpio controller
+  (see interrupt binding[0]).
+- interrupts: (gpio) interrupt to which the chip is connected
+  (see interrupt binding[0]).
+- ti,max-rt: maximum pressure.
+- ti,fuzzx: specifies the absolute input fuzz x value.
+  If set, it will permit noise in the data up to +- the value given to the fuzz
+  parameter, that is used to filter noise from the event stream.
+- ti,fuzzy: specifies the absolute input fuzz y value.
+- ti,fuzzz: specifies the absolute input fuzz z value.
+- ti,poll-period: how much time to wait (in milliseconds) before reading again the
+  values from the tsc2007.
+
+[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+[1]: Documentation/devicetree/bindings/gpio/gpio.txt
+
+Example:
+       &i2c1 {
+               /* ... */
+               tsc2007@49 {
+                       compatible = "ti,tsc2007";
+                       reg = <0x49>;
+                       interrupt-parent = <&gpio4>;
+                       interrupts = <0x0 0x8>;
+                       gpios = <&gpio4 0 0>;
+                       ti,x-plate-ohms = <180>;
+               };
+
+               /* ... */
+       };
diff --git a/Documentation/devicetree/bindings/input/twl4030-keypad.txt b/Documentation/devicetree/bindings/input/twl4030-keypad.txt
new file mode 100644 (file)
index 0000000..e4be2f7
--- /dev/null
@@ -0,0 +1,27 @@
+* TWL4030's Keypad Controller device tree bindings
+
+TWL4030's Keypad controller is used to interface a SoC with a matrix-type
+keypad device. The keypad controller supports multiple row and column lines.
+A key can be placed at each intersection of a unique row and a unique column.
+The keypad controller can sense a key-press and key-release and report the
+event using a interrupt to the cpu.
+
+This binding is based on the matrix-keymap binding with the following
+changes:
+
+ * keypad,num-rows and keypad,num-columns are required.
+
+Required SoC Specific Properties:
+- compatible: should be one of the following
+   - "ti,twl4030-keypad": For controllers compatible with twl4030 keypad
+      controller.
+- interrupt: should be one of the following
+   - <1>: For controllers compatible with twl4030 keypad controller.
+
+Example:
+       twl_keypad: keypad {
+               compatible = "ti,twl4030-keypad";
+               interrupts = <1>;
+               keypad,num-rows = <8>;
+               keypad,num-columns = <8>;
+       };
diff --git a/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt b/Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
new file mode 100644 (file)
index 0000000..c864a46
--- /dev/null
@@ -0,0 +1,21 @@
+Texas Instruments TWL family (twl4030) pwrbutton module
+
+This module is part of the TWL4030. For more details about the whole
+chip see Documentation/devicetree/bindings/mfd/twl-familly.txt.
+
+This module provides a simple power button event via an Interrupt.
+
+Required properties:
+- compatible: should be one of the following
+   - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
+- interrupts: should be one of the following
+   - <8>: For controllers compatible with twl4030
+
+Example:
+
+&twl {
+       twl_pwrbutton: pwrbutton {
+               compatible = "ti,twl4030-pwrbutton";
+               interrupts = <8>;
+       };
+};
index 31bb6a4029ef84863a8f1341e023ed8961142a23..3f6d8a5e9cdc38f5ba0c2ec9a10ff68bb5949405 100644 (file)
@@ -68,7 +68,7 @@ features that you need, first. How each feature is mapped is described below.
 Legacy drivers often don't comply to these rules. As we cannot change them
 for backwards-compatibility reasons, you need to provide fixup mappings in
 user-space yourself. Some of them might also provide module-options that
-change the mappings so you can adivce users to set these.
+change the mappings so you can advise users to set these.
 
 All new gamepads are supposed to comply with this mapping. Please report any
 bugs, if they don't.
@@ -150,10 +150,10 @@ Menu-Pad:
                   BTN_START
   Many pads also have a third button which is branded or has a special symbol
   and meaning. Such buttons are mapped as BTN_MODE. Examples are the Nintendo
-  "HOME" button, the XBox "X"-button or Sony "P" button.
+  "HOME" button, the XBox "X"-button or Sony "PS" button.
 
 Rumble:
-  Rumble is adverticed as FF_RUMBLE.
+  Rumble is advertised as FF_RUMBLE.
 
 ----------------------------------------------------------------------------
   Written 2013 by David Herrmann <dh.herrmann@gmail.com>
index c507330740cd4fb14e37e617d01d95262057d129..943b18eac91827d62b10ab79dceb519bb895effd 100644 (file)
@@ -16,14 +16,14 @@ joystick.
 
 By default, the device is opened in blocking mode.
 
-       int fd = open ("/dev/js0", O_RDONLY);
+       int fd = open ("/dev/input/js0", O_RDONLY);
 
 
 2. Event Reading
 ~~~~~~~~~~~~~~~~
 
        struct js_event e;
-       read (fd, &e, sizeof(struct js_event));
+       read (fd, &e, sizeof(e));
 
 where js_event is defined as
 
@@ -34,8 +34,8 @@ where js_event is defined as
                __u8 number;    /* axis/button number */
        };
 
-If the read is successful, it will return sizeof(struct js_event), unless
-you wanted to read more than one event per read as described in section 3.1.
+If the read is successful, it will return sizeof(e), unless you wanted to read
+more than one event per read as described in section 3.1.
 
 
 2.1 js_event.type
@@ -99,9 +99,9 @@ may work well if you handle JS_EVENT_INIT events separately,
 
        if ((js_event.type & ~JS_EVENT_INIT) == JS_EVENT_BUTTON) {
                if (js_event.value)
-                       buttons_state |= (1 << js_event.number);
-               else
-                       buttons_state &= ~(1 << js_event.number);
+                       buttons_state |= (1 << js_event.number);
+               else
+                       buttons_state &= ~(1 << js_event.number);
        }
 
 is much safer since it can't lose sync with the driver. As you would
@@ -144,14 +144,14 @@ all events on the queue (that is, until you get a -1).
 For example,
 
        while (1) {
-               while (read (fd, &e, sizeof(struct js_event)) > 0) {
-                       process_event (e);
-               }
-               /* EAGAIN is returned when the queue is empty */
-               if (errno != EAGAIN) {
-                       /* error */
-               }
-               /* do something interesting with processed events */
+               while (read (fd, &e, sizeof(e)) > 0) {
+                       process_event (e);
+               }
+               /* EAGAIN is returned when the queue is empty */
+               if (errno != EAGAIN) {
+                       /* error */
+               }
+               /* do something interesting with processed events */
        }
 
 One reason for emptying the queue is that if it gets full you'll start
@@ -181,7 +181,7 @@ at a time using the typical read(2) functionality. For that, you would
 replace the read above with something like
 
        struct js_event mybuffer[0xff];
-       int i = read (fd, mybuffer, sizeof(struct mybuffer));
+       int i = read (fd, mybuffer, sizeof(mybuffer));
 
 In this case, read would return -1 if the queue was empty, or some
 other value in which the number of events read would be i /
@@ -269,9 +269,9 @@ The driver offers backward compatibility, though. Here's a quick summary:
        struct JS_DATA_TYPE js;
        while (1) {
                if (read (fd, &js, JS_RETURN) != JS_RETURN) {
-                       /* error */
-               }
-               usleep (1000);
+                       /* error */
+               }
+               usleep (1000);
        }
 
 As you can figure out from the example, the read returns immediately,
index 304262bb661a87b7e55631c18082f8462b9d859a..8d027dc86c1f001efa3576ab4b41363aea031af8 100644 (file)
@@ -116,7 +116,7 @@ your needs:
   For testing the joystick driver functionality, there is the jstest
 program in the utilities package. You run it by typing:
 
-       jstest /dev/js0
+       jstest /dev/input/js0
 
   And it should show a line with the joystick values, which update as you
 move the stick, and press its buttons. The axes should all be zero when the
@@ -136,7 +136,7 @@ joystick should be autocalibrated by the driver automagically. However, with
 some analog joysticks, that either do not use linear resistors, or if you
 want better precision, you can use the jscal program
 
-       jscal -c /dev/js0
+       jscal -c /dev/input/js0
 
  included in the joystick package to set better correction coefficients than
 what the driver would choose itself.
@@ -145,7 +145,7 @@ what the driver would choose itself.
 calibration using the jstest command, and if you do, you then can save the
 correction coefficients into a file
 
-       jscal -p /dev/js0 > /etc/joystick.cal
+       jscal -p /dev/input/js0 > /etc/joystick.cal
 
   And add a line to your rc script executing that file
 
@@ -556,7 +556,7 @@ interface, and "old" for the "0.x" interface. You run it by typing:
 
 5. FAQ
 ~~~~~~
-Q: Running 'jstest /dev/js0' results in "File not found" error. What's the
+Q: Running 'jstest /dev/input/js0' results in "File not found" error. What's the
    cause?
 A: The device files don't exist. Create them (see section 2.2).
 
index 3ba48fe1c0a549fc44ae60cd33ba5a864bf4514a..97a2d9a096b948cd0e325e8188d591a11fedef7a 100644 (file)
@@ -2,6 +2,7 @@ config ALPHA
        bool
        default y
        select ARCH_MIGHT_HAVE_PC_PARPORT
+       select ARCH_MIGHT_HAVE_PC_SERIO
        select HAVE_AOUT
        select HAVE_IDE
        select HAVE_OPROFILE
index 0f2111a11315853a046284b71b290890f3ae8fdd..fba55fb9f47dfe58829f74174c718d69e5ea70d1 100644 (file)
@@ -85,6 +85,7 @@ config FOOTBRIDGE
 # Footbridge in host mode
 config FOOTBRIDGE_HOST
        bool
+       select ARCH_MIGHT_HAVE_PC_SERIO
 
 # Footbridge in addin mode
 config FOOTBRIDGE_ADDIN
index 771362d1fbee712247242c3d7c5d9956b7f58e70..65e4c53e1554b134ff458ba3960f060bec130a1b 100644 (file)
@@ -53,7 +53,7 @@ static const struct imxi2c_platform_data
 };
 
 #define TSC2007_IRQGPIO                IMX_GPIO_NR(3, 2)
-static int tsc2007_get_pendown_state(void)
+static int tsc2007_get_pendown_state(struct device *dev)
 {
        return !gpio_get_value(TSC2007_IRQGPIO);
 }
index 9b5ddf5bbd339e4aff4012256762144c77332557..1fba2b8e983f7e9104ac506a8fccc951f361611b 100644 (file)
@@ -121,7 +121,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
 };
 
-static int tsc2007_get_pendown_state(void)
+static int tsc2007_get_pendown_state(struct device *dev)
 {
        if (mx51_revision() < IMX_CHIP_REVISION_3_0)
                return !gpio_get_value(TSC2007_IRQGPIO_REV2);
index c063b054294eeda643962776edbccd61259c1882..0c8e553e0b9f8cafdc40853047d3e9b873885ed3 100644 (file)
@@ -7,6 +7,7 @@ menu "Processor type and features"
 config IA64
        bool
        select ARCH_MIGHT_HAVE_PC_PARPORT
+       select ARCH_MIGHT_HAVE_PC_SERIO
        select PCI if (!IA64_HP_SIM)
        select ACPI if (!IA64_HP_SIM)
        select PM if (!IA64_HP_SIM)
index 52dac06ea6b474aee91850c454a10e73c833e9eb..c02f1c03a22e7e1dd2ce0d1de16f702104cac47c 100644 (file)
@@ -2,6 +2,7 @@ config MIPS
        bool
        default y
        select ARCH_MIGHT_HAVE_PC_PARPORT
+       select ARCH_MIGHT_HAVE_PC_SERIO
        select HAVE_CONTEXT_TRACKING
        select HAVE_GENERIC_DMA_COHERENT
        select HAVE_IDE
index bedc62b44aa69b17c9b0b3c61457fc235cca6479..1695b6ab503d8e1f2763f89e5696bbb9019abfaf 100644 (file)
@@ -86,6 +86,7 @@ config PPC
        bool
        default y
        select ARCH_MIGHT_HAVE_PC_PARPORT
+       select ARCH_MIGHT_HAVE_PC_SERIO
        select BINFMT_ELF
        select OF
        select OF_EARLY_FLATTREE
index fb5805745ace8160ea5074b68a51347903f6f5b0..eb1cf84231a20fd272ca18c9a7b9ee6ba8edea7d 100644 (file)
@@ -321,6 +321,7 @@ config SH_CAYMAN
        bool "Hitachi Cayman"
        depends on CPU_SUBTYPE_SH5_101 || CPU_SUBTYPE_SH5_103
        select SYS_SUPPORTS_PCI
+       select ARCH_MIGHT_HAVE_PC_SERIO
 
 config SH_POLARIS
        bool "SMSC Polaris"
index 122f737a901fbad4e22de06652e6eb9b04abdfc8..5bc3a15465c71a53906ed0f99a848298c30b2831 100644 (file)
@@ -502,7 +502,7 @@ static struct platform_device keysc_device = {
 /* TouchScreen */
 #define IRQ0 evt2irq(0x600)
 
-static int ts_get_pendown_state(void)
+static int ts_get_pendown_state(struct device *dev)
 {
        int val = 0;
        gpio_free(GPIO_FN_INTC_IRQ0);
index 63dfe68f4af8a751d7565822bb93424ba18f44a4..c51efdcd07a2d09e76c06e31671efcd19a6db4ed 100644 (file)
@@ -13,6 +13,7 @@ config SPARC
        bool
        default y
        select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
+       select ARCH_MIGHT_HAVE_PC_SERIO
        select OF
        select OF_PROMTREE
        select HAVE_IDE
index a7ba27b2752be0923644eba19035ba3a97a6c792..25c0dba508cc293712010c96d6c76938d198682a 100644 (file)
@@ -1,6 +1,7 @@
 config UNICORE32
        def_bool y
        select ARCH_MIGHT_HAVE_PC_PARPORT
+       select ARCH_MIGHT_HAVE_PC_SERIO
        select HAVE_MEMBLOCK
        select HAVE_GENERIC_DMA_COHERENT
        select HAVE_DMA_ATTRS
index 3e97a3dd4129b3f4b58744ef011a79d789e80483..940e50ebfafa66c76b9f0ed00d8928ed4e145fcb 100644 (file)
@@ -23,6 +23,7 @@ config X86
        def_bool y
        select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
        select ARCH_MIGHT_HAVE_PC_PARPORT
+       select ARCH_MIGHT_HAVE_PC_SERIO
        select HAVE_AOUT if X86_32
        select HAVE_UNSTABLE_SCHED_CLOCK
        select ARCH_SUPPORTS_NUMA_BALANCING
index fa7a95c1da0e25e319e6c943cbbe05026bac70cf..2909e9561cf32d08f856c613d63ab3e37bf86691 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <linux/module.h>
 #include <linux/ioport.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
index ae912d3aee4e55b4a3e9d9c19339bf2a7b685641..7c03114158e020fab0ce45786d47c67436138a2c 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
 
index d2965e4b32243a90f40db55a7722c3229d4edb3a..1c4c0db055509cc45df2e1865a5c0b6d86e25fc9 100644 (file)
@@ -1653,35 +1653,36 @@ static void input_dev_toggle(struct input_dev *dev, bool activate)
  */
 void input_reset_device(struct input_dev *dev)
 {
-       mutex_lock(&dev->mutex);
+       unsigned long flags;
 
-       if (dev->users) {
-               input_dev_toggle(dev, true);
+       mutex_lock(&dev->mutex);
+       spin_lock_irqsave(&dev->event_lock, flags);
 
-               /*
-                * Keys that have been pressed at suspend time are unlikely
-                * to be still pressed when we resume.
-                */
-               spin_lock_irq(&dev->event_lock);
-               input_dev_release_keys(dev);
-               spin_unlock_irq(&dev->event_lock);
-       }
+       input_dev_toggle(dev, true);
+       input_dev_release_keys(dev);
 
+       spin_unlock_irqrestore(&dev->event_lock, flags);
        mutex_unlock(&dev->mutex);
 }
 EXPORT_SYMBOL(input_reset_device);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int input_dev_suspend(struct device *dev)
 {
        struct input_dev *input_dev = to_input_dev(dev);
 
-       mutex_lock(&input_dev->mutex);
+       spin_lock_irq(&input_dev->event_lock);
 
-       if (input_dev->users)
-               input_dev_toggle(input_dev, false);
+       /*
+        * Keys that are pressed now are unlikely to be
+        * still pressed when we resume.
+        */
+       input_dev_release_keys(input_dev);
 
-       mutex_unlock(&input_dev->mutex);
+       /* Turn off LEDs and sounds, if any are active. */
+       input_dev_toggle(input_dev, false);
+
+       spin_unlock_irq(&input_dev->event_lock);
 
        return 0;
 }
@@ -1690,7 +1691,43 @@ static int input_dev_resume(struct device *dev)
 {
        struct input_dev *input_dev = to_input_dev(dev);
 
-       input_reset_device(input_dev);
+       spin_lock_irq(&input_dev->event_lock);
+
+       /* Restore state of LEDs and sounds, if any were active. */
+       input_dev_toggle(input_dev, true);
+
+       spin_unlock_irq(&input_dev->event_lock);
+
+       return 0;
+}
+
+static int input_dev_freeze(struct device *dev)
+{
+       struct input_dev *input_dev = to_input_dev(dev);
+
+       spin_lock_irq(&input_dev->event_lock);
+
+       /*
+        * Keys that are pressed now are unlikely to be
+        * still pressed when we resume.
+        */
+       input_dev_release_keys(input_dev);
+
+       spin_unlock_irq(&input_dev->event_lock);
+
+       return 0;
+}
+
+static int input_dev_poweroff(struct device *dev)
+{
+       struct input_dev *input_dev = to_input_dev(dev);
+
+       spin_lock_irq(&input_dev->event_lock);
+
+       /* Turn off LEDs and sounds, if any are active. */
+       input_dev_toggle(input_dev, false);
+
+       spin_unlock_irq(&input_dev->event_lock);
 
        return 0;
 }
@@ -1698,7 +1735,8 @@ static int input_dev_resume(struct device *dev)
 static const struct dev_pm_ops input_dev_pm_ops = {
        .suspend        = input_dev_suspend,
        .resume         = input_dev_resume,
-       .poweroff       = input_dev_suspend,
+       .freeze         = input_dev_freeze,
+       .poweroff       = input_dev_poweroff,
        .restore        = input_dev_resume,
 };
 #endif /* CONFIG_PM */
@@ -1707,7 +1745,7 @@ static struct device_type input_dev_type = {
        .groups         = input_dev_attr_groups,
        .release        = input_dev_release,
        .uevent         = input_dev_uevent,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
        .pm             = &input_dev_pm_ops,
 #endif
 };
index 85bc8dc07cfc084a32a10397412b649f5c7abbac..55efdfc7eb625bbca7a5d64af5eb34ce1eb49e2c 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/jiffies.h>
index 0cbfd2dfabf4502173b165ec66e0c6aaafdbf989..b78425765d3eb12ccd02fd1c3dc644a1956110a1 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/gameport.h>
-#include <linux/init.h>
 #include <linux/jiffies.h>
 
 #define DRIVER_DESC    "Logitech ADI joystick family driver"
index 65367e44d715391b251f0123309345784278173c..ae3ee24a2368ac05d18dc6dd4dd7e582eb61b103 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/jiffies.h>
index ab1cf288200403a744fcefbdbfcd9b684196fa4c..0f519db647488d4588a52b91a7fb424fdcc6fc34 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/gameport.h>
 #include <linux/jiffies.h>
index 9e1beff57c33a5094f796fa62a13e6f93cb40701..eac9c5b8d73e3678174b1b9c2228f5845de318bc 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
index c0f9c7b7eb4eb4a4d1c738f7fc4d81f295e81ed1..573191dd78e8c9e7e54f44546501c785b21c79e4 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
index 55196f730af6b80dd01284be87df1761b9899370..a9ac2f9cfce0055d9f88e0d6e680b033126135c0 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/jiffies.h>
index b1d7d9b0eb86e897ad0b11eb549bb23f11f74348..96ae4f5bd0ebf5b905b1ca7ed9d4cd70c28c1fe2 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/usb.h>
 #include <linux/serio.h>
index 88c22623a2e8cc01ec461d70f216f09486a25904..17c2c800743c8d230aebc0d60cdd8ad56de54e7a 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/jiffies.h>
index 7eb878bab9683505b42d40c0c4b79c6c20e93bdf..d1c6e4846a4acd7ab16307f9bc7b56074e8b58dc 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/gameport.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 
 #define DRIVER_DESC    "Gameport data dumper module"
index 9fb153eef2fc07b28661a7ec4661a952587319cc..c5358ba1f571ff18792c6491d6a6762ccaeb34a9 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Magellan and SpaceMouse 6dof controller driver"
 
index 04c69af371482e6927fc0416174265c95928d02c..4a95b224169f33f32fbc106a97add8a5b62e141b 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/gameport.h>
 #include <linux/jiffies.h>
index 80a7b27a457a046cb94efd10dbc8ff84bb0eab8b..f4445a4e8d6a5c937fabe921aad21b0ae8f65159 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 
index a41f291652e6ce55b028e21f4049f50ad226e3f9..f2667820e8c5f0177a635eb62afa9736f49d5f4f 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 
index 0f51a60e14a7f9903950c37b55c16d35fb83b98a..099c6d7b5e08732a2e0a1d26f0f4c25d1f3921cd 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Gravis Stinger gamepad driver"
 
index 5ef9bcdb0345bff2ebacac80ea73ea318403dd03..7e17cde464f0033e0474e6ef72775abd4a256ec6 100644 (file)
@@ -33,7 +33,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/jiffies.h>
index 2556a819357978897db8889dda334180b621c045..7f7e5ab3f9e303871de01d681f0453af1bb3e52a 100644 (file)
@@ -52,7 +52,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Handykey Twiddler keyboard as a joystick driver"
 
index 23b3071abb6e4b92ba8cf01b9e8bb8994c8e485e..e13a9144a25da517b3c1754abaa68599ddef2427 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Logitech WingMan Warrior joystick driver"
 
index 75e3b102ce450878bfc83c37572498efba4c92fd..603fe0dd3682f7cd5baa859de39f37e2253825d9 100644 (file)
@@ -74,7 +74,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/stat.h>
 #include <linux/module.h>
@@ -125,6 +124,8 @@ static const struct xpad_device {
        { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
        { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
        { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
+       { 0x046d, 0xc21d, "Logitech Gamepad F310", 0, XTYPE_XBOX360 },
+       { 0x046d, 0xc21f, "Logitech Gamepad F710", 0, XTYPE_XBOX360 },
        { 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 },
        { 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX },
        { 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX },
@@ -166,8 +167,8 @@ static const struct xpad_device {
        { 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 },
        { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
        { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 },
-       { 0x1689, 0xfd00, "Razer Onza Tournament Edition", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
-       { 0x1689, 0xfd01, "Razer Onza Classic Edition", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
+       { 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 },
+       { 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 },
        { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 },
        { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
        { 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 },
index c4de4388fd7f1f1b6efd1dbf3b2013e74b6e8881..30af2e8c670cded3ec6fb7b20e383a8b7e80982a 100644 (file)
@@ -49,7 +49,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "RC transmitter with 5-byte Zhen Hua protocol joystick driver"
 
index bb174c1a9886eb8a1592f347e71e20bdb6fd90b6..a673c9f3a0b97d939f24c76d88d42596ea097257 100644 (file)
@@ -525,7 +525,7 @@ config KEYBOARD_SUNKBD
 
 config KEYBOARD_SH_KEYSC
        tristate "SuperH KEYSC keypad support"
-       depends on SUPERH || ARM || COMPILE_TEST
+       depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
        help
          Say Y here if you want to use a keypad attached to the KEYSC block
          on SuperH processors such as sh7722 and sh7343.
index ef26b17fb159d411111d5c479c4b6d753846a61a..4cc14c2fa7d5e37f4b13662c4e85df22d87359c5 100644 (file)
@@ -8,7 +8,6 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
 #include <linux/mfd/adp5520.h>
@@ -71,7 +70,7 @@ static int adp5520_keys_notifier(struct notifier_block *nb,
 
 static int adp5520_keys_probe(struct platform_device *pdev)
 {
-       struct adp5520_keys_platform_data *pdata = pdev->dev.platform_data;
+       struct adp5520_keys_platform_data *pdata = dev_get_platdata(&pdev->dev);
        struct input_dev *input;
        struct adp5520_keys *dev;
        int ret, i;
index 3ed23513d881301fa06c1bde1ed14f56546d0147..bb3b57bea8ba4578df5d29c72230882ac29bd62a 100644 (file)
@@ -9,7 +9,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/workqueue.h>
@@ -173,7 +172,7 @@ static int adp5588_build_gpiomap(struct adp5588_kpad *kpad,
 static int adp5588_gpio_add(struct adp5588_kpad *kpad)
 {
        struct device *dev = &kpad->client->dev;
-       const struct adp5588_kpad_platform_data *pdata = dev->platform_data;
+       const struct adp5588_kpad_platform_data *pdata = dev_get_platdata(dev);
        const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
        int i, error;
 
@@ -227,7 +226,7 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad)
 static void adp5588_gpio_remove(struct adp5588_kpad *kpad)
 {
        struct device *dev = &kpad->client->dev;
-       const struct adp5588_kpad_platform_data *pdata = dev->platform_data;
+       const struct adp5588_kpad_platform_data *pdata = dev_get_platdata(dev);
        const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
        int error;
 
@@ -321,7 +320,8 @@ static irqreturn_t adp5588_irq(int irq, void *handle)
 
 static int adp5588_setup(struct i2c_client *client)
 {
-       const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data;
+       const struct adp5588_kpad_platform_data *pdata =
+                       dev_get_platdata(&client->dev);
        const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
        int i, ret;
        unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
@@ -424,7 +424,8 @@ static int adp5588_probe(struct i2c_client *client,
                         const struct i2c_device_id *id)
 {
        struct adp5588_kpad *kpad;
-       const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data;
+       const struct adp5588_kpad_platform_data *pdata =
+                       dev_get_platdata(&client->dev);
        struct input_dev *input;
        unsigned int revid;
        int ret, i;
index 60dafd4fa692e1d41457c471d5a79ef0bcdf21f0..6329549bf6add071e19c6c07b16e5db0dd8131c7 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/workqueue.h>
@@ -499,7 +498,7 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad,
 static int adp5589_gpio_add(struct adp5589_kpad *kpad)
 {
        struct device *dev = &kpad->client->dev;
-       const struct adp5589_kpad_platform_data *pdata = dev->platform_data;
+       const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev);
        const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
        int i, error;
 
@@ -553,7 +552,7 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
 static void adp5589_gpio_remove(struct adp5589_kpad *kpad)
 {
        struct device *dev = &kpad->client->dev;
-       const struct adp5589_kpad_platform_data *pdata = dev->platform_data;
+       const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev);
        const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
        int error;
 
@@ -658,7 +657,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
 {
        struct i2c_client *client = kpad->client;
        const struct adp5589_kpad_platform_data *pdata =
-               client->dev.platform_data;
+               dev_get_platdata(&client->dev);
        u8 (*reg) (u8) = kpad->var->reg;
        unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
        unsigned char pull_mask = 0;
@@ -864,7 +863,7 @@ static int adp5589_probe(struct i2c_client *client,
 {
        struct adp5589_kpad *kpad;
        const struct adp5589_kpad_platform_data *pdata =
-               client->dev.platform_data;
+               dev_get_platdata(&client->dev);
        struct input_dev *input;
        unsigned int revid;
        int ret, i;
index 09b91d09308780ceebc25d9f860f88eb56b68183..e6d46c5994d7a909aa340bb5810b39b27442037c 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <linux/module.h>
 
-#include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
@@ -180,7 +179,7 @@ static irqreturn_t bfin_kpad_isr(int irq, void *dev_id)
 static int bfin_kpad_probe(struct platform_device *pdev)
 {
        struct bf54x_kpad *bf54x_kpad;
-       struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data;
+       struct bfin_kpad_platform_data *pdata = dev_get_platdata(&pdev->dev);
        struct input_dev *input;
        int i, error;
 
@@ -333,7 +332,7 @@ out:
 
 static int bfin_kpad_remove(struct platform_device *pdev)
 {
-       struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data;
+       struct bfin_kpad_platform_data *pdata = dev_get_platdata(&pdev->dev);
        struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
 
        del_timer_sync(&bf54x_kpad->timer);
index 7e8b0a52af25b63108c781a19f908b084a22975c..408379669d3c2016194a4184d2cb1f0a532d9cfd 100644 (file)
@@ -38,6 +38,7 @@
  * @row_shift: log2 or number of rows, rounded up
  * @keymap_data: Matrix keymap data used to convert to keyscan values
  * @ghost_filter: true to enable the matrix key-ghosting filter
+ * @old_kb_state: bitmap of keys pressed last scan
  * @dev: Device pointer
  * @idev: Input device
  * @ec: Top level ChromeOS device to use to talk to EC
@@ -49,6 +50,7 @@ struct cros_ec_keyb {
        int row_shift;
        const struct matrix_keymap_data *keymap_data;
        bool ghost_filter;
+       uint8_t *old_kb_state;
 
        struct device *dev;
        struct input_dev *idev;
@@ -135,6 +137,7 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
        struct input_dev *idev = ckdev->idev;
        int col, row;
        int new_state;
+       int old_state;
        int num_cols;
 
        num_cols = len;
@@ -153,18 +156,19 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
                for (row = 0; row < ckdev->rows; row++) {
                        int pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift);
                        const unsigned short *keycodes = idev->keycode;
-                       int code;
 
-                       code = keycodes[pos];
                        new_state = kb_state[col] & (1 << row);
-                       if (!!new_state != test_bit(code, idev->key)) {
+                       old_state = ckdev->old_kb_state[col] & (1 << row);
+                       if (new_state != old_state) {
                                dev_dbg(ckdev->dev,
                                        "changed: [r%d c%d]: byte %02x\n",
                                        row, col, new_state);
 
-                               input_report_key(idev, code, new_state);
+                               input_report_key(idev, keycodes[pos],
+                                                new_state);
                        }
                }
+               ckdev->old_kb_state[col] = kb_state[col];
        }
        input_sync(ckdev->idev);
 }
@@ -226,6 +230,9 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
                                            &ckdev->cols);
        if (err)
                return err;
+       ckdev->old_kb_state = devm_kzalloc(&pdev->dev, ckdev->cols, GFP_KERNEL);
+       if (!ckdev->old_kb_state)
+               return -ENOMEM;
 
        idev = devm_input_allocate_device(&pdev->dev);
        if (!idev)
index d15977a8361ea5b007fa19e3a653600252a99cbd..1559dc1cf9516c50527e6bddad12f18db74bc0c5 100644 (file)
@@ -172,7 +172,7 @@ static int __init davinci_ks_probe(struct platform_device *pdev)
        struct input_dev *key_dev;
        struct resource *res, *mem;
        struct device *dev = &pdev->dev;
-       struct davinci_ks_platform_data *pdata = pdev->dev.platform_data;
+       struct davinci_ks_platform_data *pdata = dev_get_platdata(&pdev->dev);
        int error, i;
 
        if (pdata->device_enable) {
index 47206bdba4113a54db431d581a62b84da93b28ed..e59876212b8c47b42f69973ee7f3f93fdc905694 100644 (file)
@@ -244,7 +244,7 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
        if (!keypad)
                return -ENOMEM;
 
-       keypad->pdata = pdev->dev.platform_data;
+       keypad->pdata = dev_get_platdata(&pdev->dev);
        if (!keypad->pdata) {
                err = -EINVAL;
                goto failed_free;
index 9f60a2ec88dbb46235315de650e6281ec938038f..69e854763370a0150cfafaf6abec07317569a93b 100644 (file)
@@ -14,7 +14,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/types.h>
 #include <linux/input.h>
index 4e428199e580f36c1c9228870d8b4b1a8d02ef0f..e571e194ff84e8521c19d64f4b52d4f29d704846 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input-polldev.h>
index 589e3c258f3f1ecd48c0df846987e796b02ebdbc..610a8af795a1f5b090b73d7bb8919bf41d3e331a 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/serio.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/completion.h>
 #include <linux/slab.h>
 #include <linux/pci_ids.h>
index 328cfc1eed95dac7d8452547a389909d0320e35a..cbf4f8038cbae434998e9aaa4f6120ed6f5f3c9a 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/err.h>
-#include <linux/init.h>
 #include <linux/input/matrix_keypad.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
@@ -425,7 +424,8 @@ MODULE_DEVICE_TABLE(of, imx_keypad_of_match);
 
 static int imx_keypad_probe(struct platform_device *pdev)
 {
-       const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data;
+       const struct matrix_keymap_data *keymap_data =
+                       dev_get_platdata(&pdev->dev);
        struct imx_keypad *keypad;
        struct input_dev *input_dev;
        struct resource *res;
index a2a034c25f0b59906b270af4ff88c2af0aee7b52..69b1f002ff5261ede83e687d3908d125a282bfe4 100644 (file)
@@ -16,7 +16,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input-polldev.h>
 #include <linux/interrupt.h>
index b0ad457ca9d8ede1a5411e940b3dae7f0c2e57a1..cd729d485e9876f4535f5fc3f41217f1a80aefc2 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/device.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
index fc0a63c2f2785a8b529ad3e0afc43debc284d6c7..9fcd9f1d5dc8edc2547c5d303df87e5b666b8059 100644 (file)
@@ -65,7 +65,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/workqueue.h>
index 0de23f41b2d316364b8a0f50b8b1b72ca5c9555b..0b42118cbf8f53709debac3415b9d28b5e355a77 100644 (file)
@@ -627,7 +627,7 @@ static DEVICE_ATTR(disable_kp, 0644, lm8323_show_disable, lm8323_set_disable);
 static int lm8323_probe(struct i2c_client *client,
                                  const struct i2c_device_id *id)
 {
-       struct lm8323_platform_data *pdata = client->dev.platform_data;
+       struct lm8323_platform_data *pdata = dev_get_platdata(&client->dev);
        struct input_dev *idev;
        struct lm8323_chip *lm;
        int pwm;
index 5a8ca35dc9af97898d9fa8f0a7988309edeb57a6..9081cbef11ea126d4c46097416dce9cff21aa799 100644 (file)
@@ -131,7 +131,8 @@ static irqreturn_t lm8333_irq_thread(int irq, void *data)
 static int lm8333_probe(struct i2c_client *client,
                                  const struct i2c_device_id *id)
 {
-       const struct lm8333_platform_data *pdata = client->dev.platform_data;
+       const struct lm8333_platform_data *pdata =
+                       dev_get_platdata(&client->dev);
        struct lm8333 *lm8333;
        struct input_dev *input;
        int err, active_time;
index 90ff73ace42496a26fbec96081847d4f23fcfae6..8d2e19e81e1e59b63c31eccd989b441f503e8706 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/types.h>
 #include <linux/delay.h>
 #include <linux/platform_device.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
index bc2cdaf563fd76da86c9318f0159a9d7a492590f..430b54539720055c78c8e2832e70a03b1ed0a555 100644 (file)
@@ -182,7 +182,8 @@ static void max7359_initialize(struct i2c_client *client)
 static int max7359_probe(struct i2c_client *client,
                                        const struct i2c_device_id *id)
 {
-       const struct matrix_keymap_data *keymap_data = client->dev.platform_data;
+       const struct matrix_keymap_data *keymap_data =
+                       dev_get_platdata(&client->dev);
        struct max7359_keypad *keypad;
        struct input_dev *input_dev;
        int ret;
index 7c236f9c6a519f1baf7f36f44599dd96fc82820c..1da8e0b44b563252350ab2c21b085c4442969de9 100644 (file)
@@ -12,7 +12,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/i2c/mcs.h>
 #include <linux/interrupt.h>
@@ -108,7 +107,7 @@ static int mcs_touchkey_probe(struct i2c_client *client,
        int error;
        int i;
 
-       pdata = client->dev.platform_data;
+       pdata = dev_get_platdata(&client->dev);
        if (!pdata) {
                dev_err(&client->dev, "no platform data defined\n");
                return -EINVAL;
index f7f3e9a9fd3f5c4b63234fd63b750f10b327afb0..009c82256e895ec2383715a2ce706ed75133b0f3 100644 (file)
@@ -13,7 +13,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/i2c.h>
 #include <linux/slab.h>
@@ -188,7 +187,8 @@ err_i2c_write:
 static int mpr_touchkey_probe(struct i2c_client *client,
                              const struct i2c_device_id *id)
 {
-       const struct mpr121_platform_data *pdata = client->dev.platform_data;
+       const struct mpr121_platform_data *pdata =
+                       dev_get_platdata(&client->dev);
        struct mpr121_touchkey *mpr121;
        struct input_dev *input_dev;
        int error;
index f971898ad59183f07aafd0811cd725f3aea903e2..20f0443779907d8306e56a8bc75ba02f5f91d2d9 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/input.h>
-#include <linux/init.h>
 #include <linux/serio.h>
 
 #define DRIVER_DESC    "Newton keyboard driver"
index c7d505cce72f7b36e3658ae5cdea16a0cc96ffba..63332e2f86288f75827e95342f7043b47b09e472 100644 (file)
@@ -222,7 +222,8 @@ static irqreturn_t ske_keypad_irq(int irq, void *dev_id)
 
 static int __init ske_keypad_probe(struct platform_device *pdev)
 {
-       const struct ske_keypad_platform_data *plat = pdev->dev.platform_data;
+       const struct ske_keypad_platform_data *plat =
+                       dev_get_platdata(&pdev->dev);
        struct ske_keypad *keypad;
        struct input_dev *input;
        struct resource *res;
index d0d5226d9cd4981398997d60db6b01949bc0030a..b1acc9852eb726c78189d1d3727b3862937841f1 100644 (file)
@@ -25,7 +25,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/types.h>
 #include <linux/input.h>
@@ -248,7 +247,7 @@ static int omap_kp_probe(struct platform_device *pdev)
 {
        struct omap_kp *omap_kp;
        struct input_dev *input_dev;
-       struct omap_kp_platform_data *pdata =  pdev->dev.platform_data;
+       struct omap_kp_platform_data *pdata = dev_get_platdata(&pdev->dev);
        int i, col_idx, row_idx, ret;
        unsigned int row_shift, keycodemax;
 
index 30acfd49fa6c16ffed7d759b834dea335afd1324..0400b3f2b4b9501d92663f17fccb74272267690f 100644 (file)
@@ -22,7 +22,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/errno.h>
index 186138c720c79ebfee4ef896c61aeee78c770289..d8241ba0afa0737b5779371563c5623969931df5 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/device.h>
index 248cdcf952965c616b4de79fca4dfe87f79e38b3..374ca0246c8f08e2dd30fbb09bc1099fb27a1f16 100644 (file)
@@ -8,7 +8,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
@@ -84,7 +83,8 @@ static void pxa930_rotary_close(struct input_dev *dev)
 
 static int pxa930_rotary_probe(struct platform_device *pdev)
 {
-       struct pxa930_rotary_platform_data *pdata = pdev->dev.platform_data;
+       struct pxa930_rotary_platform_data *pdata =
+                       dev_get_platdata(&pdev->dev);
        struct pxa930_rotary *r;
        struct input_dev *input_dev;
        struct resource *res;
index 6c561ec3cc09853240ad1cc0f3bbc6902085ff95..52cd6e88acd7090072b7a5a2096a07d3ebc1b8e4 100644 (file)
@@ -25,7 +25,6 @@
  */
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/input.h>
 #include <linux/slab.h>
index 1c0ddad0a1ccdeb6444c80ff3443f7f3d40c079b..819b22897c1371050a4064ba8bf81d6d7bfd1e3d 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/leds.h>
 #include <linux/module.h>
 #include <linux/slab.h>
index ac43a486c77536c6267aa33f766b104d698784d7..5e80fbf7b5edd50dbfe7fafa43bacf56d562fde3 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/err.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
@@ -244,8 +243,8 @@ static void samsung_keypad_close(struct input_dev *input_dev)
 }
 
 #ifdef CONFIG_OF
-static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
-                               struct device *dev)
+static struct samsung_keypad_platdata *
+samsung_keypad_parse_dt(struct device *dev)
 {
        struct samsung_keypad_platdata *pdata;
        struct matrix_keymap_data *keymap_data;
@@ -253,17 +252,22 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
        struct device_node *np = dev->of_node, *key_np;
        unsigned int key_count;
 
+       if (!np) {
+               dev_err(dev, "missing device tree data\n");
+               return ERR_PTR(-EINVAL);
+       }
+
        pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
        if (!pdata) {
                dev_err(dev, "could not allocate memory for platform data\n");
-               return NULL;
+               return ERR_PTR(-ENOMEM);
        }
 
        of_property_read_u32(np, "samsung,keypad-num-rows", &num_rows);
        of_property_read_u32(np, "samsung,keypad-num-columns", &num_cols);
        if (!num_rows || !num_cols) {
                dev_err(dev, "number of keypad rows/columns not specified\n");
-               return NULL;
+               return ERR_PTR(-EINVAL);
        }
        pdata->rows = num_rows;
        pdata->cols = num_cols;
@@ -271,7 +275,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
        keymap_data = devm_kzalloc(dev, sizeof(*keymap_data), GFP_KERNEL);
        if (!keymap_data) {
                dev_err(dev, "could not allocate memory for keymap data\n");
-               return NULL;
+               return ERR_PTR(-ENOMEM);
        }
        pdata->keymap_data = keymap_data;
 
@@ -280,7 +284,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
        keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL);
        if (!keymap) {
                dev_err(dev, "could not allocate memory for keymap\n");
-               return NULL;
+               return ERR_PTR(-ENOMEM);
        }
        keymap_data->keymap = keymap;
 
@@ -294,16 +298,19 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
 
        if (of_get_property(np, "linux,input-no-autorepeat", NULL))
                pdata->no_autorepeat = true;
+
        if (of_get_property(np, "linux,input-wakeup", NULL))
                pdata->wakeup = true;
 
        return pdata;
 }
 #else
-static
-struct samsung_keypad_platdata *samsung_keypad_parse_dt(struct device *dev)
+static struct samsung_keypad_platdata *
+samsung_keypad_parse_dt(struct device *dev)
 {
-       return NULL;
+       dev_err(dev, "no platform data defined\n");
+
+       return ERR_PTR(-EINVAL);
 }
 #endif
 
@@ -318,13 +325,11 @@ static int samsung_keypad_probe(struct platform_device *pdev)
        unsigned int keymap_size;
        int error;
 
-       if (pdev->dev.of_node)
-               pdata = samsung_keypad_parse_dt(&pdev->dev);
-       else
-               pdata = pdev->dev.platform_data;
+       pdata = dev_get_platdata(&pdev->dev);
        if (!pdata) {
-               dev_err(&pdev->dev, "no platform data defined\n");
-               return -EINVAL;
+               pdata = samsung_keypad_parse_dt(&pdev->dev);
+               if (IS_ERR(pdata))
+                       return PTR_ERR(pdata);
        }
 
        keymap_data = pdata->keymap_data;
index fe0e498d24794e557c5c63f67059103dd105fcca..7abf03b4cc9c75ea72452439a61aad326d1e6195 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/delay.h>
@@ -171,7 +170,7 @@ static int sh_keysc_probe(struct platform_device *pdev)
        int i;
        int irq, error;
 
-       if (!pdev->dev.platform_data) {
+       if (!dev_get_platdata(&pdev->dev)) {
                dev_err(&pdev->dev, "no platform data defined\n");
                error = -EINVAL;
                goto err0;
@@ -198,7 +197,7 @@ static int sh_keysc_probe(struct platform_device *pdev)
        }
 
        platform_set_drvdata(pdev, priv);
-       memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata));
+       memcpy(&priv->pdata, dev_get_platdata(&pdev->dev), sizeof(priv->pdata));
        pdata = &priv->pdata;
 
        priv->iomem_base = ioremap_nocache(res->start, resource_size(res));
index 85ff530d9a913c00741f39bf0082f701e4a59d91..258af10e5811d47ccdc18e64ddcb98aa08629551 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <linux/clk.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/io.h>
index 5cbec56f772000f2b10836ef6585c65472f96b2d..c6727dda68f2901e10305ca15135def55c1e5675 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
index cc612c5d542782fdf898757bdfdd1434b7d19d86..a6e0d565e30667551dd9f4ca00a2a547868b13f8 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/input.h>
-#include <linux/init.h>
 #include <linux/serio.h>
 
 #define DRIVER_DESC    "Stowaway keyboard driver"
index 5f836b1638c159fa4f2386e09c516092abe8dbd8..dc6bb9d5b4f0287ab3cbba6fbb1fdb0121f532d5 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/workqueue.h>
index 208de7cbb7fae2460dac5576c69f5847165ac3c9..74494a357522db3506a5b29cbd86b3409e13f22b 100644 (file)
@@ -10,7 +10,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
index bfc832c35a7cf811aaf121ec59cca5e1f161a442..dc983ab6c0ad566d6b5d126eed9c5551525d62d4 100644 (file)
@@ -213,7 +213,7 @@ static int tca6416_keypad_probe(struct i2c_client *client,
                return -ENODEV;
        }
 
-       pdata = client->dev.platform_data;
+       pdata = dev_get_platdata(&client->dev);
        if (!pdata) {
                dev_dbg(&client->dev, "no platform data\n");
                return -EINVAL;
index 8bd24d52bf1bedd0438e0737350c640b6e3b38b8..086511c2121b821b701fe12ba9ec3763f8470e3b 100644 (file)
@@ -162,7 +162,7 @@ static int keypad_probe(struct platform_device *pdev)
        int error = 0, sz, row_shift;
        u32 rev = 0;
 
-       pdata = pdev->dev.platform_data;
+       pdata = dev_get_platdata(&pdev->dev);
        if (!pdata) {
                dev_err(dev, "cannot find device data\n");
                return -EINVAL;
index d2d178c84ea7584467badbfc2a79ba35afbdb726..c5a11700a1bf1a506257d865a0312fc8b68bfe63 100644 (file)
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
 #include <linux/i2c/twl.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 
 /*
  * The TWL4030 family chips include a keypad controller that supports
@@ -60,6 +60,7 @@
 struct twl4030_keypad {
        unsigned short  keymap[TWL4030_KEYMAP_SIZE];
        u16             kp_state[TWL4030_MAX_ROWS];
+       bool            autorepeat;
        unsigned        n_rows;
        unsigned        n_cols;
        unsigned        irq;
@@ -330,70 +331,89 @@ static int twl4030_kp_program(struct twl4030_keypad *kp)
  */
 static int twl4030_kp_probe(struct platform_device *pdev)
 {
-       struct twl4030_keypad_data *pdata = pdev->dev.platform_data;
-       const struct matrix_keymap_data *keymap_data;
+       struct twl4030_keypad_data *pdata = dev_get_platdata(&pdev->dev);
+       const struct matrix_keymap_data *keymap_data = NULL;
        struct twl4030_keypad *kp;
        struct input_dev *input;
        u8 reg;
        int error;
 
-       if (!pdata || !pdata->rows || !pdata->cols || !pdata->keymap_data ||
-           pdata->rows > TWL4030_MAX_ROWS || pdata->cols > TWL4030_MAX_COLS) {
-               dev_err(&pdev->dev, "Invalid platform_data\n");
-               return -EINVAL;
-       }
+       kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL);
+       if (!kp)
+               return -ENOMEM;
 
-       keymap_data = pdata->keymap_data;
-
-       kp = kzalloc(sizeof(*kp), GFP_KERNEL);
-       input = input_allocate_device();
-       if (!kp || !input) {
-               error = -ENOMEM;
-               goto err1;
-       }
+       input = devm_input_allocate_device(&pdev->dev);
+       if (!input)
+               return -ENOMEM;
 
-       /* Get the debug Device */
-       kp->dbg_dev = &pdev->dev;
-       kp->input = input;
-
-       kp->n_rows = pdata->rows;
-       kp->n_cols = pdata->cols;
-       kp->irq = platform_get_irq(pdev, 0);
+       /* get the debug device */
+       kp->dbg_dev             = &pdev->dev;
+       kp->input               = input;
 
        /* setup input device */
        input->name             = "TWL4030 Keypad";
        input->phys             = "twl4030_keypad/input0";
-       input->dev.parent       = &pdev->dev;
 
        input->id.bustype       = BUS_HOST;
        input->id.vendor        = 0x0001;
        input->id.product       = 0x0001;
        input->id.version       = 0x0003;
 
+       if (pdata) {
+               if (!pdata->rows || !pdata->cols || !pdata->keymap_data) {
+                       dev_err(&pdev->dev, "Missing platform_data\n");
+                       return -EINVAL;
+               }
+
+               kp->n_rows = pdata->rows;
+               kp->n_cols = pdata->cols;
+               kp->autorepeat = pdata->rep;
+               keymap_data = pdata->keymap_data;
+       } else {
+               error = matrix_keypad_parse_of_params(&pdev->dev, &kp->n_rows,
+                                                     &kp->n_cols);
+               if (error)
+                       return error;
+
+               kp->autorepeat = true;
+       }
+
+       if (kp->n_rows > TWL4030_MAX_ROWS || kp->n_cols > TWL4030_MAX_COLS) {
+               dev_err(&pdev->dev,
+                       "Invalid rows/cols amount specified in platform/devicetree data\n");
+               return -EINVAL;
+       }
+
+       kp->irq = platform_get_irq(pdev, 0);
+       if (!kp->irq) {
+               dev_err(&pdev->dev, "no keyboard irq assigned\n");
+               return -EINVAL;
+       }
+
        error = matrix_keypad_build_keymap(keymap_data, NULL,
                                           TWL4030_MAX_ROWS,
                                           1 << TWL4030_ROW_SHIFT,
                                           kp->keymap, input);
        if (error) {
                dev_err(kp->dbg_dev, "Failed to build keymap\n");
-               goto err1;
+               return error;
        }
 
        input_set_capability(input, EV_MSC, MSC_SCAN);
        /* Enable auto repeat feature of Linux input subsystem */
-       if (pdata->rep)
+       if (kp->autorepeat)
                __set_bit(EV_REP, input->evbit);
 
        error = input_register_device(input);
        if (error) {
                dev_err(kp->dbg_dev,
                        "Unable to register twl4030 keypad device\n");
-               goto err1;
+               return error;
        }
 
        error = twl4030_kp_program(kp);
        if (error)
-               goto err2;
+               return error;
 
        /*
         * This ISR will always execute in kernel thread context because of
@@ -401,47 +421,33 @@ static int twl4030_kp_probe(struct platform_device *pdev)
         *
         * NOTE:  we assume this host is wired to TWL4040 INT1, not INT2 ...
         */
-       error = request_threaded_irq(kp->irq, NULL, do_kp_irq,
-                       0, pdev->name, kp);
+       error = devm_request_threaded_irq(&pdev->dev, kp->irq, NULL, do_kp_irq,
+                                         0, pdev->name, kp);
        if (error) {
-               dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n",
-                       kp->irq);
-               goto err2;
+               dev_info(kp->dbg_dev, "request_irq failed for irq no=%d: %d\n",
+                       kp->irq, error);
+               return error;
        }
 
        /* Enable KP and TO interrupts now. */
        reg = (u8) ~(KEYP_IMR1_KP | KEYP_IMR1_TO);
        if (twl4030_kpwrite_u8(kp, reg, KEYP_IMR1)) {
-               error = -EIO;
-               goto err3;
+               /* mask all events - we don't care about the result */
+               (void) twl4030_kpwrite_u8(kp, 0xff, KEYP_IMR1);
+               return -EIO;
        }
 
        platform_set_drvdata(pdev, kp);
        return 0;
-
-err3:
-       /* mask all events - we don't care about the result */
-       (void) twl4030_kpwrite_u8(kp, 0xff, KEYP_IMR1);
-       free_irq(kp->irq, kp);
-err2:
-       input_unregister_device(input);
-       input = NULL;
-err1:
-       input_free_device(input);
-       kfree(kp);
-       return error;
 }
 
-static int twl4030_kp_remove(struct platform_device *pdev)
-{
-       struct twl4030_keypad *kp = platform_get_drvdata(pdev);
-
-       free_irq(kp->irq, kp);
-       input_unregister_device(kp->input);
-       kfree(kp);
-
-       return 0;
-}
+#ifdef CONFIG_OF
+static const struct of_device_id twl4030_keypad_dt_match_table[] = {
+       { .compatible = "ti,twl4030-keypad" },
+       {},
+};
+MODULE_DEVICE_TABLE(of, twl4030_keypad_dt_match_table);
+#endif
 
 /*
  * NOTE: twl4030 are multi-function devices connected via I2C.
@@ -451,10 +457,10 @@ static int twl4030_kp_remove(struct platform_device *pdev)
 
 static struct platform_driver twl4030_kp_driver = {
        .probe          = twl4030_kp_probe,
-       .remove         = twl4030_kp_remove,
        .driver         = {
                .name   = "twl4030_keypad",
                .owner  = THIS_MODULE,
+               .of_match_table = of_match_ptr(twl4030_keypad_dt_match_table),
        },
 };
 module_platform_driver(twl4030_kp_driver);
index 7b039162a3f833485239274e613aad5cd6ad8710..e8b9d94daae795b14e183638ca4b272aa2ff2b0f 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/device.h>
@@ -121,7 +120,7 @@ static void w90p910_keypad_close(struct input_dev *dev)
 static int w90p910_keypad_probe(struct platform_device *pdev)
 {
        const struct w90p910_keypad_platform_data *pdata =
-                                               pdev->dev.platform_data;
+                                               dev_get_platdata(&pdev->dev);
        const struct matrix_keymap_data *keymap_data;
        struct w90p910_keypad *keypad;
        struct input_dev *input_dev;
index d050d9d0011bfe42313e0617ea8674591c57f466..7c2325bd7408d2f0a6a83e18b8a83720508cfa9b 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/input.h>
-#include <linux/init.h>
 #include <linux/serio.h>
 
 #define DRIVER_DESC    "XT keyboard driver"
index e2413acbbb1678af621f50ce7d22cd96a2de6da6..7904ab05527a4ffe2ab12c4fb90e24f94f5ddadf 100644 (file)
@@ -222,6 +222,15 @@ config INPUT_GP2A
          To compile this driver as a module, choose M here: the
          module will be called gp2ap002a00f.
 
+config INPUT_GPIO_BEEPER
+       tristate "Generic GPIO Beeper support"
+       depends on OF_GPIO
+       help
+         Say Y here if you have a beeper connected to a GPIO pin.
+
+         To compile this driver as a module, choose M here: the
+         module will be called gpio-beeper.
+
 config INPUT_GPIO_TILT_POLLED
        tristate "Polled GPIO tilt switch"
        depends on GPIOLIB
index 0ebfb6dbf0f7788afd75b7a88bd171ff90b567b6..cda71fc52fb3a6bd026bd5edf878f03834996b88 100644 (file)
@@ -27,6 +27,7 @@ obj-$(CONFIG_INPUT_DA9052_ONKEY)      += da9052_onkey.o
 obj-$(CONFIG_INPUT_DA9055_ONKEY)       += da9055_onkey.o
 obj-$(CONFIG_INPUT_DM355EVM)           += dm355evm_keys.o
 obj-$(CONFIG_INPUT_GP2A)               += gp2ap002a00f.o
+obj-$(CONFIG_INPUT_GPIO_BEEPER)                += gpio-beeper.o
 obj-$(CONFIG_INPUT_GPIO_TILT_POLLED)   += gpio_tilt_polled.o
 obj-$(CONFIG_HP_SDC_RTC)               += hp_sdc_rtc.o
 obj-$(CONFIG_INPUT_IMS_PCU)            += ims-pcu.o
index 2e5d5e1de64787f17c2349e1a3c575144411518f..7a61e9ee682cff92c7b445c8fbc660f31286088b 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #include <linux/device.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
@@ -969,7 +968,7 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
        int error;
        struct input_dev *input[MAX_DEVICE_NUM];
 
-       struct ad714x_platform_data *plat_data = dev->platform_data;
+       struct ad714x_platform_data *plat_data = dev_get_platdata(dev);
        struct ad714x_chip *ad714x;
        void *drv_mem;
        unsigned long irqflags;
@@ -986,7 +985,7 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
                goto err_out;
        }
 
-       if (dev->platform_data == NULL) {
+       if (dev_get_platdata(dev) == NULL) {
                dev_err(dev, "platform data for ad714x doesn't exist\n");
                error = -EINVAL;
                goto err_out;
index 1cb1da2944191cdefbec3c8b910ce16ea994a758..2b2d02f408bbb3791e334a1005b4cde853193c2b 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #include <linux/device.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
@@ -714,7 +713,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
 
        ac->fifo_delay = fifo_delay_default;
 
-       pdata = dev->platform_data;
+       pdata = dev_get_platdata(dev);
        if (!pdata) {
                dev_dbg(dev,
                        "No platform data: Using default initialization\n");
index d781b5e520655f074071fb6fc6f9a6e9390086bd..638165c78e75bde47b62e090598c1f854db157c2 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/types.h>
 #include <linux/acpi.h>
index cd139cb17e326dd6a740db877a2b85ef18344963..e69d9bcb37e1c4ae8d2e952cafdded38b42b0bdd 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/pm.h>
@@ -92,7 +91,7 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id)
 
 static int bfin_rotary_probe(struct platform_device *pdev)
 {
-       struct bfin_rotary_platform_data *pdata = pdev->dev.platform_data;
+       struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev);
        struct bfin_rot *rotary;
        struct input_dev *input;
        int error;
index 865c2f9d25b9ff9cb55f63505852d89c06cf9687..52d3a9b28f0b80a253eb04584016b767c90c22cc 100644 (file)
@@ -526,7 +526,8 @@ static int bma150_register_polled_device(struct bma150_data *bma150)
 static int bma150_probe(struct i2c_client *client,
                                  const struct i2c_device_id *id)
 {
-       const struct bma150_platform_data *pdata = client->dev.platform_data;
+       const struct bma150_platform_data *pdata =
+                       dev_get_platdata(&client->dev);
        const struct bma150_cfg *cfg;
        struct bma150_data *bma150;
        int chip_id;
index df9b756594f80e54cd688faa51e7975c2bf5ff48..c7d00748277b1d34d7eaf98930ec14b8b16ce621 100644 (file)
@@ -284,7 +284,7 @@ EXPORT_SYMBOL(cma3000_resume);
 struct cma3000_accl_data *cma3000_init(struct device *dev, int irq,
                                       const struct cma3000_bus_ops *bops)
 {
-       const struct cma3000_platform_data *pdata = dev->platform_data;
+       const struct cma3000_platform_data *pdata = dev_get_platdata(dev);
        struct cma3000_accl_data *data;
        struct input_dev *input_dev;
        int rev;
index b5d71d245854684a33d8baeead24b78148a087c7..3e11510ff82de76e028d27878b921bf1e94b36e0 100644 (file)
@@ -17,7 +17,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include <linux/init.h>
 #include <linux/input-polldev.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
index 020569a499f20faa03a63fff95847ed8be42c273..1f695f229ea8988001da801bb60db7b6d939f293 100644 (file)
@@ -11,7 +11,6 @@
  * option) any later version.
  */
 
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
index a0af8b2506ce150b831ab0e0efb0569ab70b8d35..4b11ede34950e57587daa09f8c0af0ed63602ea4 100644 (file)
@@ -11,7 +11,6 @@
  * option) any later version.
  */
 
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
index a309a5c0899e365c59bf8c45517e6cb93dd3b276..0eba94f581df58403eb02f1010840ab1af1c6b5e 100644 (file)
@@ -9,7 +9,6 @@
  * 2 of the License, or (at your option) any later version.
  */
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
index fe30bd0fe4bdc8fb6fda70d758ad23597f0aaf25..de21e317da32b6155142c76fc346acfbac14d7d7 100644 (file)
@@ -125,7 +125,7 @@ static int gp2a_initialize(struct gp2a_data *dt)
 static int gp2a_probe(struct i2c_client *client,
                                const struct i2c_device_id *id)
 {
-       const struct gp2a_platform_data *pdata = client->dev.platform_data;
+       const struct gp2a_platform_data *pdata = dev_get_platdata(&client->dev);
        struct gp2a_data *dt;
        int error;
 
diff --git a/drivers/input/misc/gpio-beeper.c b/drivers/input/misc/gpio-beeper.c
new file mode 100644 (file)
index 0000000..b757435
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+ * Generic GPIO beeper driver
+ *
+ * Copyright (C) 2013 Alexander Shiyan <shc_work@mail.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/input.h>
+#include <linux/module.h>
+#include <linux/of_gpio.h>
+#include <linux/workqueue.h>
+#include <linux/platform_device.h>
+
+#define BEEPER_MODNAME         "gpio-beeper"
+
+struct gpio_beeper {
+       struct work_struct      work;
+       int                     gpio;
+       bool                    active_low;
+       bool                    beeping;
+};
+
+static void gpio_beeper_toggle(struct gpio_beeper *beep, bool on)
+{
+       gpio_set_value_cansleep(beep->gpio, on ^ beep->active_low);
+}
+
+static void gpio_beeper_work(struct work_struct *work)
+{
+       struct gpio_beeper *beep = container_of(work, struct gpio_beeper, work);
+
+       gpio_beeper_toggle(beep, beep->beeping);
+}
+
+static int gpio_beeper_event(struct input_dev *dev, unsigned int type,
+                            unsigned int code, int value)
+{
+       struct gpio_beeper *beep = input_get_drvdata(dev);
+
+       if (type != EV_SND || code != SND_BELL)
+               return -ENOTSUPP;
+
+       if (value < 0)
+               return -EINVAL;
+
+       beep->beeping = value;
+       /* Schedule work to actually turn the beeper on or off */
+       schedule_work(&beep->work);
+
+       return 0;
+}
+
+static void gpio_beeper_close(struct input_dev *input)
+{
+       struct gpio_beeper *beep = input_get_drvdata(input);
+
+       cancel_work_sync(&beep->work);
+       gpio_beeper_toggle(beep, false);
+}
+
+static int gpio_beeper_probe(struct platform_device *pdev)
+{
+       struct gpio_beeper *beep;
+       enum of_gpio_flags flags;
+       struct input_dev *input;
+       unsigned long gflags;
+       int err;
+
+       beep = devm_kzalloc(&pdev->dev, sizeof(*beep), GFP_KERNEL);
+       if (!beep)
+               return -ENOMEM;
+
+       beep->gpio = of_get_gpio_flags(pdev->dev.of_node, 0, &flags);
+       if (!gpio_is_valid(beep->gpio))
+               return beep->gpio;
+
+       input = devm_input_allocate_device(&pdev->dev);
+       if (!input)
+               return -ENOMEM;
+
+       INIT_WORK(&beep->work, gpio_beeper_work);
+
+       input->name             = pdev->name;
+       input->id.bustype       = BUS_HOST;
+       input->id.vendor        = 0x0001;
+       input->id.product       = 0x0001;
+       input->id.version       = 0x0100;
+       input->close            = gpio_beeper_close;
+       input->event            = gpio_beeper_event;
+
+       input_set_capability(input, EV_SND, SND_BELL);
+
+       beep->active_low = flags & OF_GPIO_ACTIVE_LOW;
+       gflags = beep->active_low ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
+
+       err = devm_gpio_request_one(&pdev->dev, beep->gpio, gflags, pdev->name);
+       if (err)
+               return err;
+
+       input_set_drvdata(input, beep);
+
+       return input_register_device(input);
+}
+
+static struct of_device_id gpio_beeper_of_match[] = {
+       { .compatible = BEEPER_MODNAME, },
+       { }
+};
+MODULE_DEVICE_TABLE(of, gpio_beeper_of_match);
+
+static struct platform_driver gpio_beeper_platform_driver = {
+       .driver = {
+               .name           = BEEPER_MODNAME,
+               .owner          = THIS_MODULE,
+               .of_match_table = gpio_beeper_of_match,
+       },
+       .probe  = gpio_beeper_probe,
+};
+module_platform_driver(gpio_beeper_platform_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
+MODULE_DESCRIPTION("Generic GPIO beeper driver");
index 714c68369134be4939b166421c0dcd5fbd38eeb8..1a81d9115226e0a66077441967f541793e43248e 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input-polldev.h>
@@ -98,7 +97,8 @@ static void gpio_tilt_polled_close(struct input_polled_dev *dev)
 
 static int gpio_tilt_polled_probe(struct platform_device *pdev)
 {
-       const struct gpio_tilt_platform_data *pdata = pdev->dev.platform_data;
+       const struct gpio_tilt_platform_data *pdata =
+                       dev_get_platdata(&pdev->dev);
        struct device *dev = &pdev->dev;
        struct gpio_tilt_polled_dev *tdev;
        struct input_polled_dev *poll_dev;
index 290fa5f97dedf8df849ef98329799e4244ccb2a5..01f3b5b300f319ea2d6f8ea369fb7ff141072827 100644 (file)
@@ -13,7 +13,6 @@
 
 #include <linux/kernel.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/usb/input.h>
index a993b67a8a5b34a956272f2007c26d1c1da85022..d708478bc5b5d463299d2d1dc52eae01bba47cc8 100644 (file)
@@ -509,7 +509,8 @@ out:
 static int kxtj9_probe(struct i2c_client *client,
                                 const struct i2c_device_id *id)
 {
-       const struct kxtj9_platform_data *pdata = client->dev.platform_data;
+       const struct kxtj9_platform_data *pdata =
+                       dev_get_platdata(&client->dev);
        struct kxtj9_data *tj9;
        int err;
 
index e973133212a516c1e810eb6f1ba720f9e69ad0c3..1fea5484941f8b6548d9d62ac7b39bd186429bc8 100644 (file)
@@ -23,7 +23,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/platform_device.h>
 #include <linux/err.h>
index d0277a7b1579ffdb891135bc71b8c55bf35f723a..0df6e8d8bd03226d2301f443341620dcd86a0a65 100644 (file)
@@ -20,7 +20,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/input.h>
index 6983ffbbfb94ac5fa90e0147c6a19de44d32e98b..5e5051351c3a87f71b2d1b047149810c43f280b4 100644 (file)
@@ -30,7 +30,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/mutex.h>
index 40ac9a5adf899c7db9dd8a032e73683bf996cd48..cd230365166efee2e0143c91579f30447ac7f9f0 100644 (file)
@@ -12,7 +12,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
index 73b13ebabe563e3d60a1d497ed7acd75488782d2..db92f4f3c99bb9177573238e898176fc5b601615 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/device.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
index 0deca5a3c87fe1adacdce8259a052738486749cb..97f711a7bd20dfb0b25726f0980e7246e9455768 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/i2c.h>
index 7288b267613d3177829593b43c6927b6121d445f..674a2cfc3c0edc27c65a239572b1bb569955cd46 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/i8253.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
 #include <linux/timex.h>
index ec086f6f3cc3e9f4efb38466580169a389f61a36..b88b7cbf93e29f68bfede1ad2547e2f36f0a3f11 100644 (file)
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
 #include <linux/slab.h>
-#include <linux/mfd/pm8xxx/core.h>
+#include <linux/regmap.h>
 
 #define VIB_DRV                        0x4A
 
@@ -35,7 +34,7 @@
  * struct pm8xxx_vib - structure to hold vibrator data
  * @vib_input_dev: input device supporting force feedback
  * @work: work structure to set the vibration parameters
- * @dev: device supporting force feedback
+ * @regmap: regmap for register read/write
  * @speed: speed of vibration set from userland
  * @active: state of vibrator
  * @level: level of vibration to set in the chip
 struct pm8xxx_vib {
        struct input_dev *vib_input_dev;
        struct work_struct work;
-       struct device *dev;
+       struct regmap *regmap;
        int speed;
        int level;
        bool active;
        u8  reg_vib_drv;
 };
 
-/**
- * pm8xxx_vib_read_u8 - helper to read a byte from pmic chip
- * @vib: pointer to vibrator structure
- * @data: placeholder for data to be read
- * @reg: register address
- */
-static int pm8xxx_vib_read_u8(struct pm8xxx_vib *vib,
-                                u8 *data, u16 reg)
-{
-       int rc;
-
-       rc = pm8xxx_readb(vib->dev->parent, reg, data);
-       if (rc < 0)
-               dev_warn(vib->dev, "Error reading pm8xxx reg 0x%x(0x%x)\n",
-                               reg, rc);
-       return rc;
-}
-
-/**
- * pm8xxx_vib_write_u8 - helper to write a byte to pmic chip
- * @vib: pointer to vibrator structure
- * @data: data to write
- * @reg: register address
- */
-static int pm8xxx_vib_write_u8(struct pm8xxx_vib *vib,
-                                u8 data, u16 reg)
-{
-       int rc;
-
-       rc = pm8xxx_writeb(vib->dev->parent, reg, data);
-       if (rc < 0)
-               dev_warn(vib->dev, "Error writing pm8xxx reg 0x%x(0x%x)\n",
-                               reg, rc);
-       return rc;
-}
-
 /**
  * pm8xxx_vib_set - handler to start/stop vibration
  * @vib: pointer to vibrator structure
@@ -95,14 +58,14 @@ static int pm8xxx_vib_write_u8(struct pm8xxx_vib *vib,
 static int pm8xxx_vib_set(struct pm8xxx_vib *vib, bool on)
 {
        int rc;
-       u8 val = vib->reg_vib_drv;
+       unsigned int val = vib->reg_vib_drv;
 
        if (on)
                val |= ((vib->level << VIB_DRV_SEL_SHIFT) & VIB_DRV_SEL_MASK);
        else
                val &= ~VIB_DRV_SEL_MASK;
 
-       rc = pm8xxx_vib_write_u8(vib, val, VIB_DRV);
+       rc = regmap_write(vib->regmap, VIB_DRV, val);
        if (rc < 0)
                return rc;
 
@@ -118,9 +81,9 @@ static void pm8xxx_work_handler(struct work_struct *work)
 {
        struct pm8xxx_vib *vib = container_of(work, struct pm8xxx_vib, work);
        int rc;
-       u8 val;
+       unsigned int val;
 
-       rc = pm8xxx_vib_read_u8(vib, &val, VIB_DRV);
+       rc = regmap_read(vib->regmap, VIB_DRV, &val);
        if (rc < 0)
                return;
 
@@ -184,34 +147,37 @@ static int pm8xxx_vib_probe(struct platform_device *pdev)
        struct pm8xxx_vib *vib;
        struct input_dev *input_dev;
        int error;
-       u8 val;
-
-       vib = kzalloc(sizeof(*vib), GFP_KERNEL);
-       input_dev = input_allocate_device();
-       if (!vib || !input_dev) {
-               dev_err(&pdev->dev, "couldn't allocate memory\n");
-               error = -ENOMEM;
-               goto err_free_mem;
-       }
+       unsigned int val;
+
+       vib = devm_kzalloc(&pdev->dev, sizeof(*vib), GFP_KERNEL);
+       if (!vib)
+               return -ENOMEM;
+
+       vib->regmap = dev_get_regmap(pdev->dev.parent, NULL);
+       if (!vib->regmap)
+               return -ENODEV;
+
+       input_dev = devm_input_allocate_device(&pdev->dev);
+       if (!input_dev)
+               return -ENOMEM;
 
        INIT_WORK(&vib->work, pm8xxx_work_handler);
-       vib->dev = &pdev->dev;
        vib->vib_input_dev = input_dev;
 
        /* operate in manual mode */
-       error = pm8xxx_vib_read_u8(vib, &val, VIB_DRV);
+       error = regmap_read(vib->regmap, VIB_DRV, &val);
        if (error < 0)
-               goto err_free_mem;
+               return error;
+
        val &= ~VIB_DRV_EN_MANUAL_MASK;
-       error = pm8xxx_vib_write_u8(vib, val, VIB_DRV);
+       error = regmap_write(vib->regmap, VIB_DRV, val);
        if (error < 0)
-               goto err_free_mem;
+               return error;
 
        vib->reg_vib_drv = val;
 
        input_dev->name = "pm8xxx_vib_ffmemless";
        input_dev->id.version = 1;
-       input_dev->dev.parent = &pdev->dev;
        input_dev->close = pm8xxx_vib_close;
        input_set_drvdata(input_dev, vib);
        input_set_capability(vib->vib_input_dev, EV_FF, FF_RUMBLE);
@@ -221,35 +187,17 @@ static int pm8xxx_vib_probe(struct platform_device *pdev)
        if (error) {
                dev_err(&pdev->dev,
                        "couldn't register vibrator as FF device\n");
-               goto err_free_mem;
+               return error;
        }
 
        error = input_register_device(input_dev);
        if (error) {
                dev_err(&pdev->dev, "couldn't register input device\n");
-               goto err_destroy_memless;
+               return error;
        }
 
        platform_set_drvdata(pdev, vib);
        return 0;
-
-err_destroy_memless:
-       input_ff_destroy(input_dev);
-err_free_mem:
-       input_free_device(input_dev);
-       kfree(vib);
-
-       return error;
-}
-
-static int pm8xxx_vib_remove(struct platform_device *pdev)
-{
-       struct pm8xxx_vib *vib = platform_get_drvdata(pdev);
-
-       input_unregister_device(vib->vib_input_dev);
-       kfree(vib);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -268,7 +216,6 @@ static SIMPLE_DEV_PM_OPS(pm8xxx_vib_pm_ops, pm8xxx_vib_suspend, NULL);
 
 static struct platform_driver pm8xxx_vib_driver = {
        .probe          = pm8xxx_vib_probe,
-       .remove         = pm8xxx_vib_remove,
        .driver         = {
                .name   = "pm8xxx-vib",
                .owner  = THIS_MODULE,
index b49b738aa9c69c5eb62207bc69b518b4fbe18af0..0e1a05f9585804cf4a987dd0bd34d50deb68722a 100644 (file)
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
+#include <linux/regmap.h>
 #include <linux/log2.h>
 
-#include <linux/mfd/pm8xxx/core.h>
 #include <linux/input/pmic8xxx-pwrkey.h>
 
 #define PON_CNTL_1 0x1C
  * @key_press_irq: key press irq number
  */
 struct pmic8xxx_pwrkey {
-       struct input_dev *pwr;
        int key_press_irq;
 };
 
-static irqreturn_t pwrkey_press_irq(int irq, void *_pwrkey)
+static irqreturn_t pwrkey_press_irq(int irq, void *_pwr)
 {
-       struct pmic8xxx_pwrkey *pwrkey = _pwrkey;
+       struct input_dev *pwr = _pwr;
 
-       input_report_key(pwrkey->pwr, KEY_POWER, 1);
-       input_sync(pwrkey->pwr);
+       input_report_key(pwr, KEY_POWER, 1);
+       input_sync(pwr);
 
        return IRQ_HANDLED;
 }
 
-static irqreturn_t pwrkey_release_irq(int irq, void *_pwrkey)
+static irqreturn_t pwrkey_release_irq(int irq, void *_pwr)
 {
-       struct pmic8xxx_pwrkey *pwrkey = _pwrkey;
+       struct input_dev *pwr = _pwr;
 
-       input_report_key(pwrkey->pwr, KEY_POWER, 0);
-       input_sync(pwrkey->pwr);
+       input_report_key(pwr, KEY_POWER, 0);
+       input_sync(pwr);
 
        return IRQ_HANDLED;
 }
@@ -88,7 +86,8 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev)
        int key_press_irq = platform_get_irq(pdev, 1);
        int err;
        unsigned int delay;
-       u8 pon_cntl;
+       unsigned int pon_cntl;
+       struct regmap *regmap;
        struct pmic8xxx_pwrkey *pwrkey;
        const struct pm8xxx_pwrkey_platform_data *pdata =
                                        dev_get_platdata(&pdev->dev);
@@ -103,30 +102,36 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       pwrkey = kzalloc(sizeof(*pwrkey), GFP_KERNEL);
+       regmap = dev_get_regmap(pdev->dev.parent, NULL);
+       if (!regmap) {
+               dev_err(&pdev->dev, "failed to locate regmap for the device\n");
+               return -ENODEV;
+       }
+
+       pwrkey = devm_kzalloc(&pdev->dev, sizeof(*pwrkey), GFP_KERNEL);
        if (!pwrkey)
                return -ENOMEM;
 
-       pwr = input_allocate_device();
+       pwrkey->key_press_irq = key_press_irq;
+
+       pwr = devm_input_allocate_device(&pdev->dev);
        if (!pwr) {
                dev_dbg(&pdev->dev, "Can't allocate power button\n");
-               err = -ENOMEM;
-               goto free_pwrkey;
+               return -ENOMEM;
        }
 
        input_set_capability(pwr, EV_KEY, KEY_POWER);
 
        pwr->name = "pmic8xxx_pwrkey";
        pwr->phys = "pmic8xxx_pwrkey/input0";
-       pwr->dev.parent = &pdev->dev;
 
        delay = (pdata->kpd_trigger_delay_us << 10) / USEC_PER_SEC;
        delay = 1 + ilog2(delay);
 
-       err = pm8xxx_readb(pdev->dev.parent, PON_CNTL_1, &pon_cntl);
+       err = regmap_read(regmap, PON_CNTL_1, &pon_cntl);
        if (err < 0) {
                dev_err(&pdev->dev, "failed reading PON_CNTL_1 err=%d\n", err);
-               goto free_input_dev;
+               return err;
        }
 
        pon_cntl &= ~PON_CNTL_TRIG_DELAY_MASK;
@@ -136,69 +141,46 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev)
        else
                pon_cntl &= ~PON_CNTL_PULL_UP;
 
-       err = pm8xxx_writeb(pdev->dev.parent, PON_CNTL_1, pon_cntl);
+       err = regmap_write(regmap, PON_CNTL_1, pon_cntl);
        if (err < 0) {
                dev_err(&pdev->dev, "failed writing PON_CNTL_1 err=%d\n", err);
-               goto free_input_dev;
+               return err;
        }
 
-       err = input_register_device(pwr);
+       err = devm_request_irq(&pdev->dev, key_press_irq, pwrkey_press_irq,
+                              IRQF_TRIGGER_RISING,
+                              "pmic8xxx_pwrkey_press", pwr);
        if (err) {
-               dev_dbg(&pdev->dev, "Can't register power key: %d\n", err);
-               goto free_input_dev;
+               dev_err(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n",
+                       key_press_irq, err);
+               return err;
        }
 
-       pwrkey->key_press_irq = key_press_irq;
-       pwrkey->pwr = pwr;
-
-       platform_set_drvdata(pdev, pwrkey);
-
-       err = request_irq(key_press_irq, pwrkey_press_irq,
-               IRQF_TRIGGER_RISING, "pmic8xxx_pwrkey_press", pwrkey);
-       if (err < 0) {
-               dev_dbg(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n",
-                                key_press_irq, err);
-               goto unreg_input_dev;
+       err = devm_request_irq(&pdev->dev, key_release_irq, pwrkey_release_irq,
+                              IRQF_TRIGGER_RISING,
+                              "pmic8xxx_pwrkey_release", pwr);
+       if (err) {
+               dev_err(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n",
+                       key_release_irq, err);
+               return err;
        }
 
-       err = request_irq(key_release_irq, pwrkey_release_irq,
-                IRQF_TRIGGER_RISING, "pmic8xxx_pwrkey_release", pwrkey);
-       if (err < 0) {
-               dev_dbg(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n",
-                                key_release_irq, err);
-
-               goto free_press_irq;
+       err = input_register_device(pwr);
+       if (err) {
+               dev_err(&pdev->dev, "Can't register power key: %d\n", err);
+               return err;
        }
 
+       platform_set_drvdata(pdev, pwrkey);
        device_init_wakeup(&pdev->dev, pdata->wakeup);
 
        return 0;
-
-free_press_irq:
-       free_irq(key_press_irq, pwrkey);
-unreg_input_dev:
-       input_unregister_device(pwr);
-       pwr = NULL;
-free_input_dev:
-       input_free_device(pwr);
-free_pwrkey:
-       kfree(pwrkey);
-       return err;
 }
 
 static int pmic8xxx_pwrkey_remove(struct platform_device *pdev)
 {
-       struct pmic8xxx_pwrkey *pwrkey = platform_get_drvdata(pdev);
-       int key_release_irq = platform_get_irq(pdev, 0);
-       int key_press_irq = platform_get_irq(pdev, 1);
-
        device_init_wakeup(&pdev->dev, 0);
 
-       free_irq(key_press_irq, pwrkey);
-       free_irq(key_release_irq, pwrkey);
-       input_unregister_device(pwrkey->pwr);
-       kfree(pwrkey);
-
        return 0;
 }
 
index 49c0c3ebd32141442acbc58deb9ef0b7e8f1b402..63b539d3dabae13ce7d1cb12fe19322f655043fd 100644 (file)
@@ -31,7 +31,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/usb/input.h>
 
index 940566e7be1322751689027166653845173d6004..8ef288e7c971e40ee687f5e358461c0b6402a784 100644 (file)
@@ -68,7 +68,7 @@ static int pwm_beeper_event(struct input_dev *input,
 
 static int pwm_beeper_probe(struct platform_device *pdev)
 {
-       unsigned long pwm_id = (unsigned long)pdev->dev.platform_data;
+       unsigned long pwm_id = (unsigned long)dev_get_platdata(&pdev->dev);
        struct pwm_beeper *beeper;
        int error;
 
index 7ca09baa00160ca50651a33db75ca5a476762d44..4bff1aa9b0db7314af5d2971f8adb3a8a0cc8458 100644 (file)
@@ -17,7 +17,6 @@
  */
 
 #include <linux/irq.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/errno.h>
 #include <linux/input.h>
index f920ba7ab51f5e1399649fa75c158a3770ae86e7..99b9e42aa7482cb7767df51a78aec9f1907c2357 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/device.h>
index 95cf299ef9a308a12b09d7e3c6ea9f7903928abd..f10474937a64b09371b6467449fb17df7fbbe047 100644 (file)
@@ -17,7 +17,6 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include <linux/init.h>
 #include <linux/input-polldev.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
index 7b8b03e0d0bef905cd793a158cfaba2f135eeb5f..e8897c36d21b022ce7d4d0ccb128c962db5aa78f 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/platform_device.h>
index b9a05fda03e402c2d8e382626a890d6099604231..fb3b63b2f85c3615619452ef9ee2e6f0528d8245 100644 (file)
@@ -52,15 +52,15 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
        return IRQ_HANDLED;
 }
 
-static int __init twl4030_pwrbutton_probe(struct platform_device *pdev)
+static int twl4030_pwrbutton_probe(struct platform_device *pdev)
 {
        struct input_dev *pwr;
        int irq = platform_get_irq(pdev, 0);
        int err;
 
-       pwr = input_allocate_device();
+       pwr = devm_input_allocate_device(&pdev->dev);
        if (!pwr) {
-               dev_dbg(&pdev->dev, "Can't allocate power button\n");
+               dev_err(&pdev->dev, "Can't allocate power button\n");
                return -ENOMEM;
        }
 
@@ -70,52 +70,42 @@ static int __init twl4030_pwrbutton_probe(struct platform_device *pdev)
        pwr->phys = "twl4030_pwrbutton/input0";
        pwr->dev.parent = &pdev->dev;
 
-       err = request_threaded_irq(irq, NULL, powerbutton_irq,
+       err = devm_request_threaded_irq(&pwr->dev, irq, NULL, powerbutton_irq,
                        IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
                        "twl4030_pwrbutton", pwr);
        if (err < 0) {
-               dev_dbg(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
-               goto free_input_dev;
+               dev_err(&pdev->dev, "Can't get IRQ for pwrbutton: %d\n", err);
+               return err;
        }
 
        err = input_register_device(pwr);
        if (err) {
-               dev_dbg(&pdev->dev, "Can't register power button: %d\n", err);
-               goto free_irq;
+               dev_err(&pdev->dev, "Can't register power button: %d\n", err);
+               return err;
        }
 
        platform_set_drvdata(pdev, pwr);
 
        return 0;
-
-free_irq:
-       free_irq(irq, pwr);
-free_input_dev:
-       input_free_device(pwr);
-       return err;
 }
 
-static int __exit twl4030_pwrbutton_remove(struct platform_device *pdev)
-{
-       struct input_dev *pwr = platform_get_drvdata(pdev);
-       int irq = platform_get_irq(pdev, 0);
-
-       free_irq(irq, pwr);
-       input_unregister_device(pwr);
-
-       return 0;
-}
+#ifdef CONFIG_OF
+static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
+       { .compatible = "ti,twl4030-pwrbutton" },
+       {},
+};
+MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
+#endif
 
 static struct platform_driver twl4030_pwrbutton_driver = {
-       .remove         = __exit_p(twl4030_pwrbutton_remove),
+       .probe          = twl4030_pwrbutton_probe,
        .driver         = {
                .name   = "twl4030_pwrbutton",
                .owner  = THIS_MODULE,
+               .of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
        },
 };
-
-module_platform_driver_probe(twl4030_pwrbutton_driver,
-                       twl4030_pwrbutton_probe);
+module_platform_driver(twl4030_pwrbutton_driver);
 
 MODULE_ALIAS("platform:twl4030_pwrbutton");
 MODULE_DESCRIPTION("Triton2 Power Button");
index 68a5f33152a8cd8914d39245257735d0e5ecae38..960ef2a709100836eb1dc752d89e4743f3afae89 100644 (file)
@@ -185,15 +185,17 @@ static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata,
        if (pdata && pdata->coexist)
                return true;
 
-       if (of_find_node_by_name(node, "codec"))
+       if (of_find_node_by_name(node, "codec")) {
+               of_node_put(node);
                return true;
+       }
 
        return false;
 }
 
 static int twl4030_vibra_probe(struct platform_device *pdev)
 {
-       struct twl4030_vibra_data *pdata = pdev->dev.platform_data;
+       struct twl4030_vibra_data *pdata = dev_get_platdata(&pdev->dev);
        struct device_node *twl4030_core_node = pdev->dev.parent->of_node;
        struct vibra_info *info;
        int ret;
index 7864b0c3ebb3f2f2ad571cb04ac29b67572aaa85..77dc23b94eb1eaad2232d8671024dc1ff4af359a 100644 (file)
@@ -258,17 +258,14 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL);
 static int twl6040_vibra_probe(struct platform_device *pdev)
 {
        struct device *twl6040_core_dev = pdev->dev.parent;
-       struct device_node *twl6040_core_node = NULL;
+       struct device_node *twl6040_core_node;
        struct vibra_info *info;
        int vddvibl_uV = 0;
        int vddvibr_uV = 0;
        int ret;
 
-#ifdef CONFIG_OF
        twl6040_core_node = of_find_node_by_name(twl6040_core_dev->of_node,
                                                 "vibra");
-#endif
-
        if (!twl6040_core_node) {
                dev_err(&pdev->dev, "parent of node is missing?\n");
                return -EINVAL;
@@ -276,6 +273,7 @@ static int twl6040_vibra_probe(struct platform_device *pdev)
 
        info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
        if (!info) {
+               of_node_put(twl6040_core_node);
                dev_err(&pdev->dev, "couldn't allocate memory\n");
                return -ENOMEM;
        }
@@ -295,6 +293,8 @@ static int twl6040_vibra_probe(struct platform_device *pdev)
        of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV", &vddvibl_uV);
        of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV", &vddvibr_uV);
 
+       of_node_put(twl6040_core_node);
+
        if ((!info->vibldrv_res && !info->viblmotor_res) ||
            (!info->vibrdrv_res && !info->vibrmotor_res)) {
                dev_err(info->dev, "invalid vibra driver/motor resistance\n");
index caa2c4068f0924f8070c705501f6771e6f0152fe..173b6dcca0dae9d1ba0b7f3d98983a4d00d9b201 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
index 285a5bd6cbc941ad966d4d643a825ccb4e465736..79c964c075f14029a8072a6ad441927a0a40cf04 100644 (file)
@@ -47,7 +47,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/rwsem.h>
index 5cf62e315218386817972a74aafcca22dc572113..fb15c64ffb957f3485be2751474a76e3bccf9682 100644 (file)
@@ -276,6 +276,57 @@ static void alps_process_packet_v1_v2(struct psmouse *psmouse)
        input_sync(dev);
 }
 
+/*
+ * Process bitmap data for V5 protocols. Return value is null.
+ *
+ * The bitmaps don't have enough data to track fingers, so this function
+ * only generates points representing a bounding box of at most two contacts.
+ * These two points are returned in x1, y1, x2, and y2.
+ */
+static void alps_process_bitmap_dolphin(struct alps_data *priv,
+                                       struct alps_fields *fields,
+                                       int *x1, int *y1, int *x2, int *y2)
+{
+       int box_middle_x, box_middle_y;
+       unsigned int x_map, y_map;
+       unsigned char start_bit, end_bit;
+       unsigned char x_msb, x_lsb, y_msb, y_lsb;
+
+       x_map = fields->x_map;
+       y_map = fields->y_map;
+
+       if (!x_map || !y_map)
+               return;
+
+       /* Get Most-significant and Least-significant bit */
+       x_msb = fls(x_map);
+       x_lsb = ffs(x_map);
+       y_msb = fls(y_map);
+       y_lsb = ffs(y_map);
+
+       /* Most-significant bit should never exceed max sensor line number */
+       if (x_msb > priv->x_bits || y_msb > priv->y_bits)
+               return;
+
+       *x1 = *y1 = *x2 = *y2 = 0;
+
+       if (fields->fingers > 1) {
+               start_bit = priv->x_bits - x_msb;
+               end_bit = priv->x_bits - x_lsb;
+               box_middle_x = (priv->x_max * (start_bit + end_bit)) /
+                               (2 * (priv->x_bits - 1));
+
+               start_bit = y_lsb - 1;
+               end_bit = y_msb - 1;
+               box_middle_y = (priv->y_max * (start_bit + end_bit)) /
+                               (2 * (priv->y_bits - 1));
+               *x1 = fields->x;
+               *y1 = fields->y;
+               *x2 = 2 * box_middle_x - *x1;
+               *y2 = 2 * box_middle_y - *y1;
+       }
+}
+
 /*
  * Process bitmap data from v3 and v4 protocols. Returns the number of
  * fingers detected. A return value of 0 means at least one of the
@@ -481,7 +532,8 @@ static void alps_decode_buttons_v3(struct alps_fields *f, unsigned char *p)
        f->ts_middle = !!(p[3] & 0x40);
 }
 
-static void alps_decode_pinnacle(struct alps_fields *f, unsigned char *p)
+static void alps_decode_pinnacle(struct alps_fields *f, unsigned char *p,
+                                struct psmouse *psmouse)
 {
        f->first_mp = !!(p[4] & 0x40);
        f->is_mp = !!(p[0] & 0x40);
@@ -502,48 +554,61 @@ static void alps_decode_pinnacle(struct alps_fields *f, unsigned char *p)
        alps_decode_buttons_v3(f, p);
 }
 
-static void alps_decode_rushmore(struct alps_fields *f, unsigned char *p)
+static void alps_decode_rushmore(struct alps_fields *f, unsigned char *p,
+                                struct psmouse *psmouse)
 {
-       alps_decode_pinnacle(f, p);
+       alps_decode_pinnacle(f, p, psmouse);
 
        f->x_map |= (p[5] & 0x10) << 11;
        f->y_map |= (p[5] & 0x20) << 6;
 }
 
-static void alps_decode_dolphin(struct alps_fields *f, unsigned char *p)
+static void alps_decode_dolphin(struct alps_fields *f, unsigned char *p,
+                               struct psmouse *psmouse)
 {
+       u64 palm_data = 0;
+       struct alps_data *priv = psmouse->private;
+
        f->first_mp = !!(p[0] & 0x02);
        f->is_mp = !!(p[0] & 0x20);
 
-       f->fingers = ((p[0] & 0x6) >> 1 |
+       if (!f->is_mp) {
+               f->x = ((p[1] & 0x7f) | ((p[4] & 0x0f) << 7));
+               f->y = ((p[2] & 0x7f) | ((p[4] & 0xf0) << 3));
+               f->z = (p[0] & 4) ? 0 : p[5] & 0x7f;
+               alps_decode_buttons_v3(f, p);
+       } else {
+               f->fingers = ((p[0] & 0x6) >> 1 |
                     (p[0] & 0x10) >> 2);
-       f->x_map = ((p[2] & 0x60) >> 5) |
-                  ((p[4] & 0x7f) << 2) |
-                  ((p[5] & 0x7f) << 9) |
-                  ((p[3] & 0x07) << 16) |
-                  ((p[3] & 0x70) << 15) |
-                  ((p[0] & 0x01) << 22);
-       f->y_map = (p[1] & 0x7f) |
-                  ((p[2] & 0x1f) << 7);
-
-       f->x = ((p[1] & 0x7f) | ((p[4] & 0x0f) << 7));
-       f->y = ((p[2] & 0x7f) | ((p[4] & 0xf0) << 3));
-       f->z = (p[0] & 4) ? 0 : p[5] & 0x7f;
 
-       alps_decode_buttons_v3(f, p);
+               palm_data = (p[1] & 0x7f) |
+                           ((p[2] & 0x7f) << 7) |
+                           ((p[4] & 0x7f) << 14) |
+                           ((p[5] & 0x7f) << 21) |
+                           ((p[3] & 0x07) << 28) |
+                           (((u64)p[3] & 0x70) << 27) |
+                           (((u64)p[0] & 0x01) << 34);
+
+               /* Y-profile is stored in P(0) to p(n-1), n = y_bits; */
+               f->y_map = palm_data & (BIT(priv->y_bits) - 1);
+
+               /* X-profile is stored in p(n) to p(n+m-1), m = x_bits; */
+               f->x_map = (palm_data >> priv->y_bits) &
+                          (BIT(priv->x_bits) - 1);
+       }
 }
 
-static void alps_process_touchpad_packet_v3(struct psmouse *psmouse)
+static void alps_process_touchpad_packet_v3_v5(struct psmouse *psmouse)
 {
        struct alps_data *priv = psmouse->private;
        unsigned char *packet = psmouse->packet;
        struct input_dev *dev = psmouse->dev;
        struct input_dev *dev2 = priv->dev2;
        int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
-       int fingers = 0, bmap_fingers;
-       struct alps_fields f;
+       int fingers = 0, bmap_fn;
+       struct alps_fields f = {0};
 
-       priv->decode_fields(&f, packet);
+       priv->decode_fields(&f, packet, psmouse);
 
        /*
         * There's no single feature of touchpad position and bitmap packets
@@ -560,19 +625,38 @@ static void alps_process_touchpad_packet_v3(struct psmouse *psmouse)
                 */
                if (f.is_mp) {
                        fingers = f.fingers;
-                       bmap_fingers = alps_process_bitmap(priv,
-                                                          f.x_map, f.y_map,
-                                                          &x1, &y1, &x2, &y2);
-
-                       /*
-                        * We shouldn't report more than one finger if
-                        * we don't have two coordinates.
-                        */
-                       if (fingers > 1 && bmap_fingers < 2)
-                               fingers = bmap_fingers;
-
-                       /* Now process position packet */
-                       priv->decode_fields(&f, priv->multi_data);
+                       if (priv->proto_version == ALPS_PROTO_V3) {
+                               bmap_fn = alps_process_bitmap(priv, f.x_map,
+                                                             f.y_map, &x1, &y1,
+                                                             &x2, &y2);
+
+                               /*
+                                * We shouldn't report more than one finger if
+                                * we don't have two coordinates.
+                                */
+                               if (fingers > 1 && bmap_fn < 2)
+                                       fingers = bmap_fn;
+
+                               /* Now process position packet */
+                               priv->decode_fields(&f, priv->multi_data,
+                                                   psmouse);
+                       } else {
+                               /*
+                                * Because Dolphin uses position packet's
+                                * coordinate data as Pt1 and uses it to
+                                * calculate Pt2, so we need to do position
+                                * packet decode first.
+                                */
+                               priv->decode_fields(&f, priv->multi_data,
+                                                   psmouse);
+
+                               /*
+                                * Since Dolphin's finger number is reliable,
+                                * there is no need to compare with bmap_fn.
+                                */
+                               alps_process_bitmap_dolphin(priv, &f, &x1, &y1,
+                                                           &x2, &y2);
+                       }
                } else {
                        priv->multi_packet = 0;
                }
@@ -662,7 +746,7 @@ static void alps_process_packet_v3(struct psmouse *psmouse)
                return;
        }
 
-       alps_process_touchpad_packet_v3(psmouse);
+       alps_process_touchpad_packet_v3_v5(psmouse);
 }
 
 static void alps_process_packet_v6(struct psmouse *psmouse)
@@ -1709,6 +1793,52 @@ error:
        return -1;
 }
 
+static int alps_dolphin_get_device_area(struct psmouse *psmouse,
+                                       struct alps_data *priv)
+{
+       struct ps2dev *ps2dev = &psmouse->ps2dev;
+       unsigned char param[4] = {0};
+       int num_x_electrode, num_y_electrode;
+
+       if (alps_enter_command_mode(psmouse))
+               return -1;
+
+       param[0] = 0x0a;
+       if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP) ||
+           ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETPOLL) ||
+           ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETPOLL) ||
+           ps2_command(ps2dev, &param[0], PSMOUSE_CMD_SETRATE) ||
+           ps2_command(ps2dev, &param[0], PSMOUSE_CMD_SETRATE))
+               return -1;
+
+       if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
+               return -1;
+
+       /*
+        * Dolphin's sensor line number is not fixed. It can be calculated
+        * by adding the device's register value with DOLPHIN_PROFILE_X/YOFFSET.
+        * Further more, we can get device's x_max and y_max by multiplying
+        * sensor line number with DOLPHIN_COUNT_PER_ELECTRODE.
+        *
+        * e.g. When we get register's sensor_x = 11 & sensor_y = 8,
+        *      real sensor line number X = 11 + 8 = 19, and
+        *      real sensor line number Y = 8 + 1 = 9.
+        *      So, x_max = (19 - 1) * 64 = 1152, and
+        *          y_max = (9 - 1) * 64 = 512.
+        */
+       num_x_electrode = DOLPHIN_PROFILE_XOFFSET + (param[2] & 0x0F);
+       num_y_electrode = DOLPHIN_PROFILE_YOFFSET + ((param[2] >> 4) & 0x0F);
+       priv->x_bits = num_x_electrode;
+       priv->y_bits = num_y_electrode;
+       priv->x_max = (num_x_electrode - 1) * DOLPHIN_COUNT_PER_ELECTRODE;
+       priv->y_max = (num_y_electrode - 1) * DOLPHIN_COUNT_PER_ELECTRODE;
+
+       if (alps_exit_command_mode(psmouse))
+               return -1;
+
+       return 0;
+}
+
 static int alps_hw_init_dolphin_v1(struct psmouse *psmouse)
 {
        struct ps2dev *ps2dev = &psmouse->ps2dev;
@@ -1763,13 +1893,13 @@ static void alps_set_defaults(struct alps_data *priv)
                break;
        case ALPS_PROTO_V5:
                priv->hw_init = alps_hw_init_dolphin_v1;
-               priv->process_packet = alps_process_packet_v3;
+               priv->process_packet = alps_process_touchpad_packet_v3_v5;
                priv->decode_fields = alps_decode_dolphin;
                priv->set_abs_params = alps_set_abs_params_mt;
                priv->nibble_commands = alps_v3_nibble_commands;
                priv->addr_command = PSMOUSE_CMD_RESET_WRAP;
                priv->byte0 = 0xc8;
-               priv->mask0 = 0xc8;
+               priv->mask0 = 0xd8;
                priv->flags = 0;
                priv->x_max = 1360;
                priv->y_max = 660;
@@ -1845,11 +1975,13 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
        if (alps_match_table(psmouse, priv, e7, ec) == 0) {
                return 0;
        } else if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0x50 &&
-                  ec[0] == 0x73 && ec[1] == 0x01) {
+                  ec[0] == 0x73 && (ec[1] == 0x01 || ec[1] == 0x02)) {
                priv->proto_version = ALPS_PROTO_V5;
                alps_set_defaults(priv);
-
-               return 0;
+               if (alps_dolphin_get_device_area(psmouse, priv))
+                       return -EIO;
+               else
+                       return 0;
        } else if (ec[0] == 0x88 && ec[1] == 0x08) {
                priv->proto_version = ALPS_PROTO_V3;
                alps_set_defaults(priv);
index 704f0f9243076190213b1c1876ef833348e61c99..03f88b6940c7c4e4b2f61c529adcf7dce0aaf96d 100644 (file)
 #define ALPS_PROTO_V5  5
 #define ALPS_PROTO_V6  6
 
+#define DOLPHIN_COUNT_PER_ELECTRODE    64
+#define DOLPHIN_PROFILE_XOFFSET                8       /* x-electrode offset */
+#define DOLPHIN_PROFILE_YOFFSET                1       /* y-electrode offset */
+
 /**
  * struct alps_model_info - touchpad ID table
  * @signature: E7 response string to match.
@@ -146,7 +150,8 @@ struct alps_data {
 
        int (*hw_init)(struct psmouse *psmouse);
        void (*process_packet)(struct psmouse *psmouse);
-       void (*decode_fields)(struct alps_fields *f, unsigned char *p);
+       void (*decode_fields)(struct alps_fields *f, unsigned char *p,
+                             struct psmouse *psmouse);
        void (*set_abs_params)(struct alps_data *priv, struct input_dev *dev1);
 
        int prev_fin;
index e42f1fa8cdc075c1bed3094de041563fb8d2af88..800ca7dfafc2b79350c879e168dfc5731fab518c 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <linux/kernel.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/usb/input.h>
index a73f9618b0adbbc0641c77a13254580e9d64ab0e..c329cdb0b91aa819f4b4f36dda820ed7a55d97e2 100644 (file)
@@ -34,7 +34,6 @@
 
 #include <linux/kernel.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/usb/input.h>
index a5869a856ea5ca3fff3a0c5bda49d0f81132b640..87095e2f5153c7dedeae38a18cd10efaa62a9e0c 100644 (file)
@@ -15,7 +15,6 @@
  * the Free Software Foundation.
  */
 
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
index 597e9b8fc18db99c5bf1f33b3a274c632b2ba24b..ef1cf52f8bb99212a96e9fe415ebf81bbb1e21bf 100644 (file)
@@ -486,6 +486,7 @@ static void elantech_input_sync_v4(struct psmouse *psmouse)
        unsigned char *packet = psmouse->packet;
 
        input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
+       input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
        input_mt_report_pointer_emulation(dev, true);
        input_sync(dev);
 }
@@ -983,6 +984,44 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
        return 0;
 }
 
+/*
+ * Advertise INPUT_PROP_BUTTONPAD for clickpads. The testing of bit 12 in
+ * fw_version for this is based on the following fw_version & caps table:
+ *
+ * Laptop-model:           fw_version:     caps:           buttons:
+ * Acer S3                 0x461f00        10, 13, 0e      clickpad
+ * Acer S7-392             0x581f01        50, 17, 0d      clickpad
+ * Acer V5-131             0x461f02        01, 16, 0c      clickpad
+ * Acer V5-551             0x461f00        ?               clickpad
+ * Asus K53SV              0x450f01        78, 15, 0c      2 hw buttons
+ * Asus G46VW              0x460f02        00, 18, 0c      2 hw buttons
+ * Asus G750JX             0x360f00        00, 16, 0c      2 hw buttons
+ * Asus UX31               0x361f00        20, 15, 0e      clickpad
+ * Asus UX32VD             0x361f02        00, 15, 0e      clickpad
+ * Avatar AVIU-145A2       0x361f00        ?               clickpad
+ * Gigabyte U2442          0x450f01        58, 17, 0c      2 hw buttons
+ * Lenovo L430             0x350f02        b9, 15, 0c      2 hw buttons (*)
+ * Samsung NF210           0x150b00        78, 14, 0a      2 hw buttons
+ * Samsung NP770Z5E        0x575f01        10, 15, 0f      clickpad
+ * Samsung NP700Z5B        0x361f06        21, 15, 0f      clickpad
+ * Samsung NP900X3E-A02    0x575f03        ?               clickpad
+ * Samsung NP-QX410        0x851b00        19, 14, 0c      clickpad
+ * Samsung RC512           0x450f00        08, 15, 0c      2 hw buttons
+ * Samsung RF710           0x450f00        ?               2 hw buttons
+ * System76 Pangolin       0x250f01        ?               2 hw buttons
+ * (*) + 3 trackpoint buttons
+ */
+static void elantech_set_buttonpad_prop(struct psmouse *psmouse)
+{
+       struct input_dev *dev = psmouse->dev;
+       struct elantech_data *etd = psmouse->private;
+
+       if (etd->fw_version & 0x001000) {
+               __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
+               __clear_bit(BTN_RIGHT, dev->keybit);
+       }
+}
+
 /*
  * Set the appropriate event bits for the input subsystem
  */
@@ -1026,6 +1065,8 @@ static int elantech_set_input_params(struct psmouse *psmouse)
                __set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
                /* fall through */
        case 3:
+               if (etd->hw_version == 3)
+                       elantech_set_buttonpad_prop(psmouse);
                input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0);
                input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0);
                if (etd->reports_pressure) {
@@ -1047,9 +1088,7 @@ static int elantech_set_input_params(struct psmouse *psmouse)
                         */
                        psmouse_warn(psmouse, "couldn't query resolution data.\n");
                }
-               /* v4 is clickpad, with only one button. */
-               __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
-               __clear_bit(BTN_RIGHT, dev->keybit);
+               elantech_set_buttonpad_prop(psmouse);
                __set_bit(BTN_TOOL_QUADTAP, dev->keybit);
                /* For X to recognize me as touchpad. */
                input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0);
index 6b44413f54e357cd9201af5dc011bed845e1377d..8c7d94200bdbd5a83258ef25542cc5130cc4dc4a 100644 (file)
@@ -8,7 +8,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/input-polldev.h>
@@ -48,7 +47,7 @@ static void gpio_mouse_scan(struct input_polled_dev *dev)
 
 static int gpio_mouse_probe(struct platform_device *pdev)
 {
-       struct gpio_mouse_platform_data *pdata = pdev->dev.platform_data;
+       struct gpio_mouse_platform_data *pdata = dev_get_platdata(&pdev->dev);
        struct input_polled_dev *input_poll;
        struct input_dev *input;
        int pin, i;
index 84de2fc6acc1c4a163a2b5fed4c45a34572fe4cb..136e222e2a16426b1ac4512348255074577c510e 100644 (file)
@@ -220,7 +220,7 @@ static const struct ps2pp_info *get_model_info(unsigned char model)
                { 61,   PS2PP_KIND_MX,                                  /* MX700 */
                                PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
                                PS2PP_EXTRA_BTN | PS2PP_NAV_BTN },
-               { 66,   PS2PP_KIND_MX,                                  /* MX3100 reciver */
+               { 66,   PS2PP_KIND_MX,                                  /* MX3100 receiver */
                                PS2PP_WHEEL | PS2PP_SIDE_BTN | PS2PP_TASK_BTN |
                                PS2PP_EXTRA_BTN | PS2PP_NAV_BTN | PS2PP_HWHEEL },
                { 72,   PS2PP_KIND_TRACKMAN,    0 },                    /* T-CH11: TrackMan Marble */
index 0b8d33591dee7e2eed5816753b4c2b636204da29..1ccc88af1f0bd775a93b0dd8f0da2dfd63c6fccd 100644 (file)
@@ -9,7 +9,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
index 0ecb9e7945eb0df7d8eb83031fbd39ed2f18355c..9b4d9a59e229fe65aa1d335de84fc2aff1913130 100644 (file)
@@ -10,7 +10,6 @@
  *  published by the Free Software Foundation.
  */
 
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
@@ -166,7 +165,7 @@ static int pxa930_trkball_probe(struct platform_device *pdev)
        if (!trkball)
                return -ENOMEM;
 
-       trkball->pdata = pdev->dev.platform_data;
+       trkball->pdata = dev_get_platdata(&pdev->dev);
        if (!trkball->pdata) {
                dev_err(&pdev->dev, "no platform data defined\n");
                error = -EINVAL;
index d5928fd0c914e8f28e30eee232ea990cfb47f484..8df526620ebffeaf67bc8be01b08365c70acb4eb 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Serial mouse driver"
 
index 64cf34ea7604cd115e5b383103bfa30913c13959..e122bda16aabddcf555f84dd06eed4dfbebca031 100644 (file)
@@ -39,7 +39,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
index e900d465aaf624f73762f0a5fe9a3461d76da5b0..38298232124fc10de191e26f51add23662040def 100644 (file)
@@ -82,7 +82,6 @@
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC "Driver for DEC VSXXX-AA and -GA mice and VSXXX-AB tablet"
 
index 8541f949778dc16953bdd269418113f0aa132e04..aec54e283580178741b6ced917f1ea429f23c554 100644 (file)
@@ -16,14 +16,19 @@ config SERIO
          To compile this driver as a module, choose M here: the
          module will be called serio.
 
+config ARCH_MIGHT_HAVE_PC_SERIO
+       bool
+       help
+         Select this config option from the architecture Kconfig if
+         the architecture might use a PC serio device (i8042) to
+         communicate with keyboard, mouse, etc.
+
 if SERIO
 
 config SERIO_I8042
        tristate "i8042 PC Keyboard controller"
        default y
-       depends on !PARISC && (!ARM || FOOTBRIDGE_HOST) && \
-                  (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN && !S390 && \
-                  !ARC
+       depends on ARCH_MIGHT_HAVE_PC_SERIO
        help
          i8042 is the chip over which the standard AT keyboard and PS/2
          mouse are connected to the computer. If you use these devices,
index 4777a73cd39024022307a90868cf65fc43490caf..cce69d6b95871107e9540363a15256f360ef8723 100644 (file)
@@ -12,7 +12,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/interrupt.h>
index b7c206db0df86fd34053f644b07e8b92abf2c4c0..762b08432de003dc155a7d78dce5572a3e352b33 100644 (file)
@@ -10,7 +10,6 @@
  * (at your option) any later version.
  */
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/serio.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
index 3a83c3c14b2364d34757313e3bad5364047acdab..613261994621451199ba551633303780a7d7c93f 100644 (file)
@@ -160,7 +160,9 @@ static void hv_kbd_on_receive(struct hv_device *hv_dev,
                        if (info & IS_E0)
                                serio_interrupt(kbd_dev->hv_serio,
                                                XTKBD_EMUL0, 0);
-
+                       if (info & IS_E1)
+                               serio_interrupt(kbd_dev->hv_serio,
+                                               XTKBD_EMUL1, 0);
                        scan_code = __le16_to_cpu(ks_msg->make_code);
                        if (info & IS_BREAK)
                                scan_code |= XTKBD_RELEASE;
index 07a8363f3c5c817e077f6cf9db954608585494a7..75516996db2070b621c6250cdd9710acf473ad42 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/i8042.h>
-#include <linux/init.h>
 #include <linux/libps2.h>
 
 #define DRIVER_DESC    "PS/2 driver library"
index 51b1d40cc286aaf224ac3e67cd500ae335bc129d..5d2fe7ece7ca0e88913569fa4c4d49bd5ffe60eb 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/serio.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
index 76f83836fd5a557b513eb8d3e91b2e964bfa5507..e862c6ea9d9e87ef9909021d022bb28567118ab1 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/input.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/serio.h>
 #include <linux/delay.h>
 #include <asm/io.h>
@@ -181,7 +180,6 @@ static void pcips2_remove(struct pci_dev *dev)
        struct pcips2_data *ps2if = pci_get_drvdata(dev);
 
        serio_unregister_port(ps2if->io);
-       pci_set_drvdata(dev, NULL);
        kfree(ps2if);
        pci_release_regions(dev);
        pci_disable_device(dev);
index 7a65a1bc5226ddabfd558b98545fb81085d16519..594256c385542aca2c6e1777847ccaf31317a79b 100644 (file)
@@ -30,7 +30,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/serio.h>
 #include <linux/interrupt.h>
 #include <linux/err.h>
index 567566ae0dae9abbf4c99054b09a4f7d7613dc45..e462e7791bb830c56f44a634d55bf1b24aabbcd9 100644 (file)
@@ -29,7 +29,6 @@
 
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/serio.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
index 59df2e7317a3c8eec1c52e2a89f53a551a0e0224..c9a02fe57576b38824a99425ff4d2abedc19ffd3 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/poll.h>
 #include <linux/module.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 #include <linux/major.h>
 #include <linux/device.h>
 #include <linux/miscdevice.h>
index dfbcd872f95e2a0daa025766e418acd9c869f3f3..e6cf52ebad87f43241b925c8da07eb0d78ee6199 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/interrupt.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/list.h>
 #include <linux/io.h>
 #include <linux/of_address.h>
index e062ec899ca110d18a1824608a41ea22e435d531..889f6b77e8cb61c03c41c591d06fd1a533fc9e8d 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/usb/input.h>
 
 /*
index ee83c3904ee83e2c3fd48770131f9430b6384141..e7f966da6efa318f1901ce912e4e0dd65b5c70f7 100644 (file)
@@ -74,7 +74,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/usb/input.h>
 #include <asm/uaccess.h>
 #include <asm/unaligned.h>
index 29e01ab6859f2ef56aa861a7444e304e93702776..caecffe8caff3e3742e08d9531b3f4eea3ae5ac7 100644 (file)
@@ -53,7 +53,6 @@ Scott Hill shill@gtcocalcomp.com
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/usb.h>
index 5cc04124995c4947d1d9b384f26159092805473b..cd852059b99e81899f8436f31071c929eb470b83 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/usb/input.h>
 
 #define DRIVER_AUTHOR   "Xing Wei <weixing@hanwang.com.cn>"
index 3fba74b9b602be947e03a00aad198fd7ca658bf3..d2ac7c2b5b8285b5b0272acca1db5622cd1a45f9 100644 (file)
@@ -1,7 +1,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/usb/input.h>
 #include <asm/unaligned.h>
 
index b79d45198d82801b89b58af39b14896f63b0d4c9..9ebf0ed3b3b372e6822e69b6f3efd68403a3c31a 100644 (file)
@@ -86,7 +86,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
-#include <linux/init.h>
 #include <linux/usb/input.h>
 #include <linux/power_supply.h>
 #include <asm/unaligned.h>
index 867e7c33ac55072b19f2ff339705c4e90f6b428d..b16ebef5b9111c7a999845300e1c33070f2a31b4 100644 (file)
@@ -304,7 +304,7 @@ static int wacom_parse_hid(struct usb_interface *intf,
        struct usb_device *dev = interface_to_usbdev(intf);
        char limit = 0;
        /* result has to be defined as int for some devices */
-       int result = 0;
+       int result = 0, touch_max = 0;
        int i = 0, usage = WCM_UNDEFINED, finger = 0, pen = 0;
        unsigned char *report;
 
@@ -351,7 +351,8 @@ static int wacom_parse_hid(struct usb_interface *intf,
                                if (usage == WCM_DESKTOP) {
                                        if (finger) {
                                                features->device_type = BTN_TOOL_FINGER;
-
+                                               /* touch device at least supports one touch point */
+                                               touch_max = 1;
                                                switch (features->type) {
                                                case TABLETPC2FG:
                                                        features->pktlen = WACOM_PKGLEN_TPC2FG;
@@ -504,6 +505,8 @@ static int wacom_parse_hid(struct usb_interface *intf,
        }
 
  out:
+       if (!features->touch_max && touch_max)
+               features->touch_max = touch_max;
        result = 0;
        kfree(report);
        return result;
@@ -1194,12 +1197,15 @@ static void wacom_wireless_work(struct work_struct *work)
                wacom_wac1->features.device_type = BTN_TOOL_PEN;
                snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen",
                         wacom_wac1->features.name);
+               wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max;
+               wacom_wac1->shared->type = wacom_wac1->features.type;
                error = wacom_register_input(wacom1);
                if (error)
                        goto fail;
 
                /* Touch interface */
-               if (wacom_wac1->features.touch_max) {
+               if (wacom_wac1->features.touch_max ||
+                   wacom_wac1->features.type == INTUOSHT) {
                        wacom_wac2->features =
                                *((struct wacom_features *)id->driver_info);
                        wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
@@ -1214,6 +1220,10 @@ static void wacom_wireless_work(struct work_struct *work)
                        error = wacom_register_input(wacom2);
                        if (error)
                                goto fail;
+
+                       if (wacom_wac1->features.type == INTUOSHT &&
+                           wacom_wac1->features.touch_max)
+                               wacom_wac->shared->touch_input = wacom_wac2->input;
                }
 
                error = wacom_initialize_battery(wacom);
@@ -1322,7 +1332,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
         * HID descriptor. If this is the touch interface (wMaxPacketSize
         * of WACOM_PKGLEN_BBTOUCH3), override the table values.
         */
-       if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
+       if (features->type >= INTUOS5S && features->type <= INTUOSHT) {
                if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) {
                        features->device_type = BTN_TOOL_FINGER;
                        features->pktlen = WACOM_PKGLEN_BBTOUCH3;
@@ -1393,6 +1403,11 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
                }
        }
 
+       if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) {
+               if (wacom_wac->features.device_type == BTN_TOOL_FINGER)
+                       wacom_wac->shared->touch_input = wacom_wac->input;
+       }
+
        return 0;
 
  fail5: wacom_destroy_leds(wacom);
index 782c2535f1d81a26db96716ac406405b2b03a78b..05f371df6c400a882621c13509f6a13a40eed077 100644 (file)
@@ -210,6 +210,62 @@ static int wacom_dtu_irq(struct wacom_wac *wacom)
        return 1;
 }
 
+static int wacom_dtus_irq(struct wacom_wac *wacom)
+{
+       char *data = wacom->data;
+       struct input_dev *input = wacom->input;
+       unsigned short prox, pressure = 0;
+
+       if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) {
+               dev_dbg(input->dev.parent,
+                       "%s: received unknown report #%d", __func__, data[0]);
+               return 0;
+       } else if (data[0] == WACOM_REPORT_DTUSPAD) {
+               input_report_key(input, BTN_0, (data[1] & 0x01));
+               input_report_key(input, BTN_1, (data[1] & 0x02));
+               input_report_key(input, BTN_2, (data[1] & 0x04));
+               input_report_key(input, BTN_3, (data[1] & 0x08));
+               input_report_abs(input, ABS_MISC,
+                                data[1] & 0x0f ? PAD_DEVICE_ID : 0);
+               /*
+                * Serial number is required when expresskeys are
+                * reported through pen interface.
+                */
+               input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
+               return 1;
+       } else {
+               prox = data[1] & 0x80;
+               if (prox) {
+                       switch ((data[1] >> 3) & 3) {
+                       case 1: /* Rubber */
+                               wacom->tool[0] = BTN_TOOL_RUBBER;
+                               wacom->id[0] = ERASER_DEVICE_ID;
+                               break;
+
+                       case 2: /* Pen */
+                               wacom->tool[0] = BTN_TOOL_PEN;
+                               wacom->id[0] = STYLUS_DEVICE_ID;
+                               break;
+                       }
+               }
+
+               input_report_key(input, BTN_STYLUS, data[1] & 0x20);
+               input_report_key(input, BTN_STYLUS2, data[1] & 0x40);
+               input_report_abs(input, ABS_X, get_unaligned_be16(&data[3]));
+               input_report_abs(input, ABS_Y, get_unaligned_be16(&data[5]));
+               pressure = ((data[1] & 0x03) << 8) | (data[2] & 0xff);
+               input_report_abs(input, ABS_PRESSURE, pressure);
+               input_report_key(input, BTN_TOUCH, pressure > 10);
+
+               if (!prox) /* out-prox */
+                       wacom->id[0] = 0;
+               input_report_key(input, wacom->tool[0], prox);
+               input_report_abs(input, ABS_MISC, wacom->id[0]);
+               input_event(input, EV_MSC, MSC_SERIAL, 1);
+               return 1;
+       }
+}
+
 static int wacom_graphire_irq(struct wacom_wac *wacom)
 {
        struct wacom_features *features = &wacom->features;
@@ -331,7 +387,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
 
        /* Enter report */
        if ((data[1] & 0xfc) == 0xc0) {
-               if (features->quirks == WACOM_QUIRK_MULTI_INPUT)
+               if (features->quirks & WACOM_QUIRK_MULTI_INPUT)
                        wacom->shared->stylus_in_proximity = true;
 
                /* serial number of the tool */
@@ -436,7 +492,7 @@ static int wacom_intuos_inout(struct wacom_wac *wacom)
 
        /* Exit report */
        if ((data[1] & 0xfe) == 0x80) {
-               if (features->quirks == WACOM_QUIRK_MULTI_INPUT)
+               if (features->quirks & WACOM_QUIRK_MULTI_INPUT)
                        wacom->shared->stylus_in_proximity = false;
 
                /*
@@ -1151,8 +1207,8 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
                int width, height;
 
                if (features->type >= INTUOSPS && features->type <= INTUOSPL) {
-                       width  = data[5];
-                       height = data[6];
+                       width  = data[5] * 100;
+                       height = data[6] * 100;
                } else {
                        /*
                         * "a" is a scaled-down area which we assume is
@@ -1176,10 +1232,16 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
 static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
 {
        struct input_dev *input = wacom->input;
+       struct wacom_features *features = &wacom->features;
 
-       input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
+       if (features->type == INTUOSHT) {
+               input_report_key(input, BTN_LEFT, (data[1] & 0x02) != 0);
+               input_report_key(input, BTN_BACK, (data[1] & 0x08) != 0);
+       } else {
+               input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
+               input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
+       }
        input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
-       input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
        input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
 }
 
@@ -1213,13 +1275,23 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom)
 
 static int wacom_bpt_pen(struct wacom_wac *wacom)
 {
+       struct wacom_features *features = &wacom->features;
        struct input_dev *input = wacom->input;
        unsigned char *data = wacom->data;
        int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
 
-       if (data[0] != 0x02)
+       if (data[0] != WACOM_REPORT_PENABLED && data[0] != WACOM_REPORT_USB)
            return 0;
 
+       if (data[0] == WACOM_REPORT_USB) {
+               if (features->type == INTUOSHT && features->touch_max) {
+                       input_report_switch(wacom->shared->touch_input,
+                                           SW_MUTE_DEVICE, data[8] & 0x40);
+                       input_sync(wacom->shared->touch_input);
+               }
+               return 0;
+       }
+
        prox = (data[1] & 0x20) == 0x20;
 
        /*
@@ -1252,8 +1324,8 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
                 * touching and applying pressure; do not report negative
                 * distance.
                 */
-               if (data[8] <= wacom->features.distance_max)
-                       d = wacom->features.distance_max - data[8];
+               if (data[8] <= features->distance_max)
+                       d = features->distance_max - data[8];
 
                pen = data[1] & 0x01;
                btn1 = data[1] & 0x02;
@@ -1297,13 +1369,20 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
        unsigned char *data = wacom->data;
        int connected;
 
-       if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80)
+       if (len != WACOM_PKGLEN_WIRELESS || data[0] != WACOM_REPORT_WL)
                return 0;
 
        connected = data[1] & 0x01;
        if (connected) {
                int pid, battery;
 
+               if ((wacom->shared->type == INTUOSHT) &&
+                               wacom->shared->touch_max) {
+                       input_report_switch(wacom->shared->touch_input,
+                                       SW_MUTE_DEVICE, data[5] & 0x40);
+                       input_sync(wacom->shared->touch_input);
+               }
+
                pid = get_unaligned_be16(&data[6]);
                battery = data[5] & 0x3f;
                if (wacom->pid != pid) {
@@ -1348,6 +1427,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
                sync = wacom_dtu_irq(wacom_wac);
                break;
 
+       case DTUS:
+               sync = wacom_dtus_irq(wacom_wac);
+               break;
+
        case INTUOS:
        case INTUOS3S:
        case INTUOS3:
@@ -1391,6 +1474,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
                break;
 
        case BAMBOO_PT:
+       case INTUOSHT:
                sync = wacom_bpt_irq(wacom_wac, len);
                break;
 
@@ -1459,7 +1543,7 @@ void wacom_setup_device_quirks(struct wacom_features *features)
 
        /* these device have multiple inputs */
        if (features->type >= WIRELESS ||
-           (features->type >= INTUOS5S && features->type <= INTUOSPL) ||
+           (features->type >= INTUOS5S && features->type <= INTUOSHT) ||
            (features->oVid && features->oPid))
                features->quirks |= WACOM_QUIRK_MULTI_INPUT;
 
@@ -1538,7 +1622,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 
        wacom_abs_set_axis(input_dev, wacom_wac);
 
-       switch (wacom_wac->features.type) {
+       switch (features->type) {
        case WACOM_MO:
                input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
                /* fall through */
@@ -1749,8 +1833,14 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
 
                /* fall through */
 
+       case DTUS:
        case PL:
        case DTU:
+               if (features->type == DTUS) {
+                       input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
+                       for (i = 0; i < 3; i++)
+                               __set_bit(BTN_0 + i, input_dev->keybit);
+               }
                __set_bit(BTN_TOOL_PEN, input_dev->keybit);
                __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
                __set_bit(BTN_STYLUS, input_dev->keybit);
@@ -1771,33 +1861,50 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
                __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
                break;
 
+       case INTUOSHT:
+               if (features->touch_max &&
+                   features->device_type == BTN_TOOL_FINGER) {
+                       input_dev->evbit[0] |= BIT_MASK(EV_SW);
+                       __set_bit(SW_MUTE_DEVICE, input_dev->swbit);
+               }
+               /* fall through */
+
        case BAMBOO_PT:
                __clear_bit(ABS_MISC, input_dev->absbit);
 
-               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
-
                if (features->device_type == BTN_TOOL_FINGER) {
-                       unsigned int flags = INPUT_MT_POINTER;
 
                        __set_bit(BTN_LEFT, input_dev->keybit);
                        __set_bit(BTN_FORWARD, input_dev->keybit);
                        __set_bit(BTN_BACK, input_dev->keybit);
                        __set_bit(BTN_RIGHT, input_dev->keybit);
 
-                       if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
-                               input_set_abs_params(input_dev,
+                       if (features->touch_max) {
+                               /* touch interface */
+                               unsigned int flags = INPUT_MT_POINTER;
+
+                               __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
+                               if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
+                                       input_set_abs_params(input_dev,
                                                     ABS_MT_TOUCH_MAJOR,
                                                     0, features->x_max, 0, 0);
-                               input_set_abs_params(input_dev,
+                                       input_set_abs_params(input_dev,
                                                     ABS_MT_TOUCH_MINOR,
                                                     0, features->y_max, 0, 0);
+                               } else {
+                                       __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
+                                       __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
+                                       flags = 0;
+                               }
+                               input_mt_init_slots(input_dev, features->touch_max, flags);
                        } else {
-                               __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
-                               __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
-                               flags = 0;
+                               /* buttons/keys only interface */
+                               __clear_bit(ABS_X, input_dev->absbit);
+                               __clear_bit(ABS_Y, input_dev->absbit);
+                               __clear_bit(BTN_TOUCH, input_dev->keybit);
                        }
-                       input_mt_init_slots(input_dev, features->touch_max, flags);
                } else if (features->device_type == BTN_TOOL_PEN) {
+                       __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
                        __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
                        __set_bit(BTN_TOOL_PEN, input_dev->keybit);
                        __set_bit(BTN_STYLUS, input_dev->keybit);
@@ -2055,6 +2162,9 @@ static const struct wacom_features wacom_features_0xCE =
 static const struct wacom_features wacom_features_0xF0 =
        { "Wacom DTU1631",        WACOM_PKGLEN_GRAPHIRE,  34623, 19553,  511,
          0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0xFB =
+       { "Wacom DTU1031",        WACOM_PKGLEN_DTUS,      22096, 13960,  511,
+         0, DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
 static const struct wacom_features wacom_features_0x57 =
        { "Wacom DTK2241",        WACOM_PKGLEN_INTUOS,    95840, 54260, 2047,
          63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES};
@@ -2200,6 +2310,17 @@ static const struct wacom_features wacom_features_0x300 =
 static const struct wacom_features wacom_features_0x301 =
        { "Wacom Bamboo One M",    WACOM_PKGLEN_BBPEN,    21648, 13530, 1023,
          31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
+static const struct wacom_features wacom_features_0x302 =
+       { "Wacom Intuos PT S",     WACOM_PKGLEN_BBPEN,    15200,  9500, 1023,
+         31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
+         .touch_max = 16 };
+static const struct wacom_features wacom_features_0x303 =
+       { "Wacom Intuos PT M",     WACOM_PKGLEN_BBPEN,    21600, 13500, 1023,
+         31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
+         .touch_max = 16 };
+static const struct wacom_features wacom_features_0x30E =
+       { "Wacom Intuos S",        WACOM_PKGLEN_BBPEN,    15200,  9500, 1023,
+         31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
 static const struct wacom_features wacom_features_0x6004 =
        { "ISD-V4",               WACOM_PKGLEN_GRAPHIRE,  12800,  8000,  255,
          0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -2337,6 +2458,9 @@ const struct usb_device_id wacom_ids[] = {
        { USB_DEVICE_WACOM(0x10F) },
        { USB_DEVICE_WACOM(0x300) },
        { USB_DEVICE_WACOM(0x301) },
+       { USB_DEVICE_DETAILED(0x302, USB_CLASS_HID, 0, 0) },
+       { USB_DEVICE_DETAILED(0x303, USB_CLASS_HID, 0, 0) },
+       { USB_DEVICE_DETAILED(0x30E, USB_CLASS_HID, 0, 0) },
        { USB_DEVICE_WACOM(0x304) },
        { USB_DEVICE_DETAILED(0x314, USB_CLASS_HID, 0, 0) },
        { USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) },
@@ -2347,6 +2471,7 @@ const struct usb_device_id wacom_ids[] = {
        { USB_DEVICE_WACOM(0xF8) },
        { USB_DEVICE_DETAILED(0xF6, USB_CLASS_HID, 0, 0) },
        { USB_DEVICE_WACOM(0xFA) },
+       { USB_DEVICE_WACOM(0xFB) },
        { USB_DEVICE_WACOM(0x0307) },
        { USB_DEVICE_DETAILED(0x0309, USB_CLASS_HID, 0, 0) },
        { USB_DEVICE_LENOVO(0x6004) },
index fd23a3790605070a41ec37f19eff051b0e89be5a..f69c0ebe7fa90d66a65b065ea838550e538b742d 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/types.h>
 
 /* maximum packet length for USB devices */
-#define WACOM_PKGLEN_MAX       64
+#define WACOM_PKGLEN_MAX       68
 
 #define WACOM_NAME_MAX         64
 
@@ -29,6 +29,7 @@
 #define WACOM_PKGLEN_WIRELESS  32
 #define WACOM_PKGLEN_MTOUCH    62
 #define WACOM_PKGLEN_MTTPC     40
+#define WACOM_PKGLEN_DTUS      68
 
 /* wacom data size per MT contact */
 #define WACOM_BYTES_PER_MT_PACKET      11
 #define WACOM_REPORT_INTUOSWRITE       6
 #define WACOM_REPORT_INTUOSPAD         12
 #define WACOM_REPORT_INTUOS5PAD                3
+#define WACOM_REPORT_DTUSPAD           21
 #define WACOM_REPORT_TPC1FG            6
 #define WACOM_REPORT_TPC2FG            13
 #define WACOM_REPORT_TPCMT             13
 #define WACOM_REPORT_TPCHID            15
 #define WACOM_REPORT_TPCST             16
+#define WACOM_REPORT_DTUS              17
 #define WACOM_REPORT_TPC1FGE           18
 #define WACOM_REPORT_24HDT             1
+#define WACOM_REPORT_WL                        128
+#define WACOM_REPORT_USB               192
 
 /* device quirks */
 #define WACOM_QUIRK_MULTI_INPUT                0x0001
@@ -68,6 +73,7 @@ enum {
        PTU,
        PL,
        DTU,
+       DTUS,
        INTUOS,
        INTUOS3S,
        INTUOS3,
@@ -81,6 +87,7 @@ enum {
        INTUOSPS,
        INTUOSPM,
        INTUOSPL,
+       INTUOSHT,
        WACOM_21UX2,
        WACOM_22HD,
        DTK,
@@ -129,6 +136,10 @@ struct wacom_features {
 struct wacom_shared {
        bool stylus_in_proximity;
        bool touch_down;
+       /* for wireless device to access USB interfaces */
+       unsigned touch_max;
+       int type;
+       struct input_dev *touch_input;
 };
 
 struct wacom_wac {
index f7de14a268bfc577b5dbc62abcccb3294de33f85..544e20c551f8360c4f355677af03bb638d034887 100644 (file)
@@ -172,7 +172,7 @@ static int pm860x_touch_dt_init(struct platform_device *pdev,
 static int pm860x_touch_probe(struct platform_device *pdev)
 {
        struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
-       struct pm860x_touch_pdata *pdata = pdev->dev.platform_data;
+       struct pm860x_touch_pdata *pdata = dev_get_platdata(&pdev->dev);
        struct pm860x_touch *touch;
        struct i2c_client *i2c = (chip->id == CHIP_PM8607) ? chip->client \
                                 : chip->companion;
index 69834dd3c313b95dcab54dcd23d51a6730727868..6793c85903aeb75f2813881b2d6af2eae2ca7e39 100644 (file)
@@ -37,7 +37,6 @@
 
 
 #include <linux/device.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
@@ -686,7 +685,7 @@ static int ad7877_probe(struct spi_device *spi)
 {
        struct ad7877                   *ts;
        struct input_dev                *input_dev;
-       struct ad7877_platform_data     *pdata = spi->dev.platform_data;
+       struct ad7877_platform_data     *pdata = dev_get_platdata(&spi->dev);
        int                             err;
        u16                             verify;
 
index facd3057b62dcb4aa634c41a674197ad1c5871e2..fce590677b7b0e4515dbcb0b938569ecbac1e9d6 100644 (file)
@@ -22,7 +22,6 @@
  */
 
 #include <linux/device.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
@@ -470,7 +469,7 @@ static int ad7879_gpio_add(struct ad7879 *ts,
 
 static void ad7879_gpio_remove(struct ad7879 *ts)
 {
-       const struct ad7879_platform_data *pdata = ts->dev->platform_data;
+       const struct ad7879_platform_data *pdata = dev_get_platdata(ts->dev);
        int ret;
 
        if (pdata->gpio_export) {
@@ -495,7 +494,7 @@ static inline void ad7879_gpio_remove(struct ad7879 *ts)
 struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned int irq,
                            const struct ad7879_bus_ops *bops)
 {
-       struct ad7879_platform_data *pdata = dev->platform_data;
+       struct ad7879_platform_data *pdata = dev_get_platdata(dev);
        struct ad7879 *ts;
        struct input_dev *input_dev;
        int err;
index ea195360747ef7a27119f84dfce26dc4a9d12d3a..45a06e495ed25702831441da6be558fa88491671 100644 (file)
@@ -19,7 +19,6 @@
  */
 #include <linux/types.h>
 #include <linux/hwmon.h>
-#include <linux/init.h>
 #include <linux/err.h>
 #include <linux/sched.h>
 #include <linux/delay.h>
@@ -101,8 +100,7 @@ struct ads7846 {
        struct spi_device       *spi;
        struct regulator        *reg;
 
-#if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE)
-       struct attribute_group  *attr_group;
+#if IS_ENABLED(CONFIG_HWMON)
        struct device           *hwmon;
 #endif
 
@@ -421,7 +419,7 @@ static int ads7845_read12_ser(struct device *dev, unsigned command)
        return status;
 }
 
-#if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE)
+#if IS_ENABLED(CONFIG_HWMON)
 
 #define SHOW(name, var, adjust) static ssize_t \
 name ## _show(struct device *dev, struct device_attribute *attr, char *buf) \
@@ -479,42 +477,36 @@ static inline unsigned vbatt_adjust(struct ads7846 *ts, ssize_t v)
 SHOW(in0_input, vaux, vaux_adjust)
 SHOW(in1_input, vbatt, vbatt_adjust)
 
-static struct attribute *ads7846_attributes[] = {
-       &dev_attr_temp0.attr,
-       &dev_attr_temp1.attr,
-       &dev_attr_in0_input.attr,
-       &dev_attr_in1_input.attr,
-       NULL,
-};
-
-static struct attribute_group ads7846_attr_group = {
-       .attrs = ads7846_attributes,
-};
+static umode_t ads7846_is_visible(struct kobject *kobj, struct attribute *attr,
+                                 int index)
+{
+       struct device *dev = container_of(kobj, struct device, kobj);
+       struct ads7846 *ts = dev_get_drvdata(dev);
 
-static struct attribute *ads7843_attributes[] = {
-       &dev_attr_in0_input.attr,
-       &dev_attr_in1_input.attr,
-       NULL,
-};
+       if (ts->model == 7843 && index < 2)     /* in0, in1 */
+               return 0;
+       if (ts->model == 7845 && index != 2)    /* in0 */
+               return 0;
 
-static struct attribute_group ads7843_attr_group = {
-       .attrs = ads7843_attributes,
-};
+       return attr->mode;
+}
 
-static struct attribute *ads7845_attributes[] = {
-       &dev_attr_in0_input.attr,
+static struct attribute *ads7846_attributes[] = {
+       &dev_attr_temp0.attr,           /* 0 */
+       &dev_attr_temp1.attr,           /* 1 */
+       &dev_attr_in0_input.attr,       /* 2 */
+       &dev_attr_in1_input.attr,       /* 3 */
        NULL,
 };
 
-static struct attribute_group ads7845_attr_group = {
-       .attrs = ads7845_attributes,
+static struct attribute_group ads7846_attr_group = {
+       .attrs = ads7846_attributes,
+       .is_visible = ads7846_is_visible,
 };
+__ATTRIBUTE_GROUPS(ads7846_attr);
 
 static int ads784x_hwmon_register(struct spi_device *spi, struct ads7846 *ts)
 {
-       struct device *hwmon;
-       int err;
-
        /* hwmon sensors need a reference voltage */
        switch (ts->model) {
        case 7846:
@@ -535,43 +527,19 @@ static int ads784x_hwmon_register(struct spi_device *spi, struct ads7846 *ts)
                break;
        }
 
-       /* different chips have different sensor groups */
-       switch (ts->model) {
-       case 7846:
-               ts->attr_group = &ads7846_attr_group;
-               break;
-       case 7845:
-               ts->attr_group = &ads7845_attr_group;
-               break;
-       case 7843:
-               ts->attr_group = &ads7843_attr_group;
-               break;
-       default:
-               dev_dbg(&spi->dev, "ADS%d not recognized\n", ts->model);
-               return 0;
-       }
-
-       err = sysfs_create_group(&spi->dev.kobj, ts->attr_group);
-       if (err)
-               return err;
-
-       hwmon = hwmon_device_register(&spi->dev);
-       if (IS_ERR(hwmon)) {
-               sysfs_remove_group(&spi->dev.kobj, ts->attr_group);
-               return PTR_ERR(hwmon);
-       }
+       ts->hwmon = hwmon_device_register_with_groups(&spi->dev, spi->modalias,
+                                                     ts, ads7846_attr_groups);
+       if (IS_ERR(ts->hwmon))
+               return PTR_ERR(ts->hwmon);
 
-       ts->hwmon = hwmon;
        return 0;
 }
 
 static void ads784x_hwmon_unregister(struct spi_device *spi,
                                     struct ads7846 *ts)
 {
-       if (ts->hwmon) {
-               sysfs_remove_group(&spi->dev.kobj, ts->attr_group);
+       if (ts->hwmon)
                hwmon_device_unregister(ts->hwmon);
-       }
 }
 
 #else
index 59aa24002c7bff9e1f8629787c7c0ce9eea36886..a70400754e92374be987679c12a89f49407c3dc3 100644 (file)
@@ -12,7 +12,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/firmware.h>
 #include <linux/i2c.h>
@@ -1130,7 +1129,7 @@ static void mxt_input_close(struct input_dev *dev)
 static int mxt_probe(struct i2c_client *client,
                const struct i2c_device_id *id)
 {
-       const struct mxt_platform_data *pdata = client->dev.platform_data;
+       const struct mxt_platform_data *pdata = dev_get_platdata(&client->dev);
        struct mxt_data *data;
        struct input_dev *input_dev;
        int error;
index bddabc5950778a793f04cdf6cbb9d3fe24bebcd1..a7c9d6967d1e331b1917dad9dfe4b0ac83b447c5 100644 (file)
@@ -12,7 +12,6 @@
  *  it under the terms of the GNU General Public License version 2 as
  *  published by the Free Software Foundation.
  */
-#include <linux/init.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -182,7 +181,7 @@ static int atmel_tsadcc_probe(struct platform_device *pdev)
        struct atmel_tsadcc     *ts_dev;
        struct input_dev        *input_dev;
        struct resource         *res;
-       struct at91_tsadcc_data *pdata = pdev->dev.platform_data;
+       struct at91_tsadcc_data *pdata = dev_get_platdata(&pdev->dev);
        int             err;
        unsigned int    prsc;
        unsigned int    reg;
index 8c651985a5c44929f083c99e881be5431bca9cad..5bf1aeeea8258e445b2a772befefcc75c160e103 100644 (file)
@@ -178,7 +178,7 @@ static irqreturn_t cy8ctmg110_irq_thread(int irq, void *dev_id)
 static int cy8ctmg110_probe(struct i2c_client *client,
                                        const struct i2c_device_id *id)
 {
-       const struct cy8ctmg110_pdata *pdata = client->dev.platform_data;
+       const struct cy8ctmg110_pdata *pdata = dev_get_platdata(&client->dev);
        struct cy8ctmg110 *ts;
        struct input_dev *input_dev;
        int err;
index 4204841cdc49743054f284cd4fcae8b7131255e8..eee656f77a2e3daa28a98727dbba5278026febc3 100644 (file)
@@ -534,7 +534,7 @@ static void cyttsp_close(struct input_dev *dev)
 struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
                            struct device *dev, int irq, size_t xfer_buf_size)
 {
-       const struct cyttsp_platform_data *pdata = dev->platform_data;
+       const struct cyttsp_platform_data *pdata = dev_get_platdata(dev);
        struct cyttsp *ts;
        struct input_dev *input_dev;
        int error;
@@ -553,7 +553,7 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops,
 
        ts->dev = dev;
        ts->input = input_dev;
-       ts->pdata = dev->platform_data;
+       ts->pdata = dev_get_platdata(dev);
        ts->bus_ops = bus_ops;
        ts->irq = irq;
 
index 1d7b6f154168cc213e75ea64ee4f973782d0a108..ccefa56ca21216f7f76e8596771b80cc6fd0c5ce 100644 (file)
@@ -31,6 +31,8 @@
 #include <linux/module.h>
 #include <linux/types.h>
 
+#include "cyttsp4_core.h"
+
 int cyttsp_i2c_read_block_data(struct device *dev, u8 *xfer_buf,
                                      u16 addr, u8 length, void *values)
 {
index 34ad84105e6ee1a18718fe06b23ca379a6a0346f..8ccf7bb4028a36c437b7c09726e23a9e94a03e8f 100644 (file)
@@ -13,7 +13,6 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
@@ -299,7 +298,7 @@ static void da9034_touch_close(struct input_dev *dev)
 
 static int da9034_touch_probe(struct platform_device *pdev)
 {
-       struct da9034_touch_pdata *pdata = pdev->dev.platform_data;
+       struct da9034_touch_pdata *pdata = dev_get_platdata(&pdev->dev);
        struct da9034_touch *touch;
        struct input_dev *input_dev;
        int ret;
index 1809677a6513fd0a9221010d8ce0e2c3f6475060..86237a910876ef30ba9b0af5090c135b75ab4f66 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Dynapro serial touchscreen driver"
 
index 83fa1b15a97f4f6a7ea5a78b6ab044485a08f957..412a85ec9ba5a918abf31ff53b69f3282c1eee1d 100644 (file)
@@ -623,8 +623,9 @@ static int edt_ft5x06_ts_reset(struct i2c_client *client,
 
        if (gpio_is_valid(reset_pin)) {
                /* this pulls reset down, enabling the low active reset */
-               error = gpio_request_one(reset_pin, GPIOF_OUT_INIT_LOW,
-                                        "edt-ft5x06 reset");
+               error = devm_gpio_request_one(&client->dev, reset_pin,
+                                             GPIOF_OUT_INIT_LOW,
+                                             "edt-ft5x06 reset");
                if (error) {
                        dev_err(&client->dev,
                                "Failed to request GPIO %d as reset pin, error %d\n",
@@ -705,7 +706,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
                                         const struct i2c_device_id *id)
 {
        const struct edt_ft5x06_platform_data *pdata =
-                                               client->dev.platform_data;
+                                               dev_get_platdata(&client->dev);
        struct edt_ft5x06_ts_data *tsdata;
        struct input_dev *input;
        int error;
@@ -723,8 +724,8 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
                return error;
 
        if (gpio_is_valid(pdata->irq_pin)) {
-               error = gpio_request_one(pdata->irq_pin,
-                                        GPIOF_IN, "edt-ft5x06 irq");
+               error = devm_gpio_request_one(&client->dev, pdata->irq_pin,
+                                             GPIOF_IN, "edt-ft5x06 irq");
                if (error) {
                        dev_err(&client->dev,
                                "Failed to request GPIO %d, error %d\n",
@@ -733,12 +734,16 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
                }
        }
 
-       tsdata = kzalloc(sizeof(*tsdata), GFP_KERNEL);
-       input = input_allocate_device();
-       if (!tsdata || !input) {
+       tsdata = devm_kzalloc(&client->dev, sizeof(*tsdata), GFP_KERNEL);
+       if (!tsdata) {
                dev_err(&client->dev, "failed to allocate driver data.\n");
-               error = -ENOMEM;
-               goto err_free_mem;
+               return -ENOMEM;
+       }
+
+       input = devm_input_allocate_device(&client->dev);
+       if (!input) {
+               dev_err(&client->dev, "failed to allocate input device.\n");
+               return -ENOMEM;
        }
 
        mutex_init(&tsdata->mutex);
@@ -749,7 +754,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
        error = edt_ft5x06_ts_identify(client, tsdata->name, fw_version);
        if (error) {
                dev_err(&client->dev, "touchscreen probe failed\n");
-               goto err_free_mem;
+               return error;
        }
 
        edt_ft5x06_ts_get_defaults(tsdata, pdata);
@@ -776,27 +781,30 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
        error = input_mt_init_slots(input, MAX_SUPPORT_POINTS, 0);
        if (error) {
                dev_err(&client->dev, "Unable to init MT slots.\n");
-               goto err_free_mem;
+               return error;
        }
 
        input_set_drvdata(input, tsdata);
        i2c_set_clientdata(client, tsdata);
 
-       error = request_threaded_irq(client->irq, NULL, edt_ft5x06_ts_isr,
-                                    IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
-                                    client->name, tsdata);
+       error = devm_request_threaded_irq(&client->dev, client->irq,
+                                         NULL, edt_ft5x06_ts_isr,
+                                         IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+                                         client->name, tsdata);
        if (error) {
                dev_err(&client->dev, "Unable to request touchscreen IRQ.\n");
-               goto err_free_mem;
+               return error;
        }
 
        error = sysfs_create_group(&client->dev.kobj, &edt_ft5x06_attr_group);
        if (error)
-               goto err_free_irq;
+               return error;
 
        error = input_register_device(input);
-       if (error)
-               goto err_remove_attrs;
+       if (error) {
+               sysfs_remove_group(&client->dev.kobj, &edt_ft5x06_attr_group);
+               return error;
+       }
 
        edt_ft5x06_ts_prepare_debugfs(tsdata, dev_driver_string(&client->dev));
        device_init_wakeup(&client->dev, 1);
@@ -806,40 +814,15 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
                pdata->irq_pin, pdata->reset_pin);
 
        return 0;
-
-err_remove_attrs:
-       sysfs_remove_group(&client->dev.kobj, &edt_ft5x06_attr_group);
-err_free_irq:
-       free_irq(client->irq, tsdata);
-err_free_mem:
-       input_free_device(input);
-       kfree(tsdata);
-
-       if (gpio_is_valid(pdata->irq_pin))
-               gpio_free(pdata->irq_pin);
-
-       return error;
 }
 
 static int edt_ft5x06_ts_remove(struct i2c_client *client)
 {
-       const struct edt_ft5x06_platform_data *pdata =
-                                               dev_get_platdata(&client->dev);
        struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
 
        edt_ft5x06_ts_teardown_debugfs(tsdata);
        sysfs_remove_group(&client->dev.kobj, &edt_ft5x06_attr_group);
 
-       free_irq(client->irq, tsdata);
-       input_unregister_device(tsdata->input);
-
-       if (gpio_is_valid(pdata->irq_pin))
-               gpio_free(pdata->irq_pin);
-       if (gpio_is_valid(pdata->reset_pin))
-               gpio_free(pdata->reset_pin);
-
-       kfree(tsdata);
-
        return 0;
 }
 
index 1ce3d29ffca5a11e2411936cce7999c089d68764..b1884ddd7a84fa74f41c7c7bae333dfce495914a 100644 (file)
@@ -157,7 +157,7 @@ static void eeti_ts_close(struct input_dev *dev)
 static int eeti_ts_probe(struct i2c_client *client,
                                   const struct i2c_device_id *idp)
 {
-       struct eeti_ts_platform_data *pdata = client->dev.platform_data;
+       struct eeti_ts_platform_data *pdata = dev_get_platdata(&client->dev);
        struct eeti_ts_priv *priv;
        struct input_dev *input;
        unsigned int irq_flags;
index 054d22583248386a5d392c0df90fed81d950e083..e6bcb13680b2d03498bfa93d982bc01bcbad4181 100644 (file)
@@ -18,7 +18,6 @@
 */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
index 957423d1471db4d873c3312c1df1e427b643514f..8051a4b704ea3b99f5d11ebc4dfd8857bfbb7a09 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 #include <linux/ctype.h>
 
 #define DRIVER_DESC    "Elo serial touchscreen driver"
index 10794ddbdf588503495badb9b26937a913ab4db3..d0e46a7e183b7aa346f89979eb6589918bff859c 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Fujitsu serial touchscreen driver"
 
index 41c71766bf18d85285c18004fbf494b8cac86112..e2ee626152730795519f57e51e0ac99810112f21 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Gunze AHL-51S touchscreen driver"
 
index 0cc47ea98acff584cf04bcf93d8305b638fe1714..ecb1e0e01328a95680d3d8f7c64c5dd38c5ccd7f 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Hampshire serial touchscreen driver"
 
index 1418bdda61bbdde36df38a88eb434be57e3db6ab..2a50891398185545bf7e63fa1c82ad13072c0130 100644 (file)
@@ -184,7 +184,7 @@ static int ili210x_i2c_probe(struct i2c_client *client,
                                       const struct i2c_device_id *id)
 {
        struct device *dev = &client->dev;
-       const struct ili210x_platform_data *pdata = dev->platform_data;
+       const struct ili210x_platform_data *pdata = dev_get_platdata(dev);
        struct ili210x *priv;
        struct input_dev *input;
        struct panel_info panel;
index a29c99c32245eda591bdcf457d853c78566af3ca..adb80b65a259683983a041d86bc6a3c0b28fcad6 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "iNexio serial touchscreen driver"
 
index e30d837dae2f12a130b91c6a620637b0e663fa72..4f6b156144e9d7ac01e21921eb658edcf49e2ace 100644 (file)
@@ -27,7 +27,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/err.h>
index e463a79ffecc0a3873cf4c3941b1c2c3dbdcab24..7324c5c0fb86b109593cacb25ad94358341a5581 100644 (file)
@@ -14,7 +14,6 @@
  */
 
 #include <linux/platform_device.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
index 9101ee529c92593284b6100b3ed45f6dc3a528de..2058253b55d9bfb461d1aa2a44cb7cd72d778d66 100644 (file)
@@ -15,7 +15,6 @@
  */
 
 #include <linux/platform_device.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
index 7d2b2136e5ad89f1a63a1ffce345f2c227096a71..0786010d7ed02aeaad3b2b20f38431272d56818f 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
index 9f84fcd08732f84726af16060107070cb2108b54..a68ec142ee9a5bceea5674397c8b5bfc573c9fc3 100644 (file)
@@ -33,7 +33,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
index f9f4e0c56eda9fec33439bcd8a54913f3953e462..647e36f5930e4c892ab56aa530a7463d0ef0df0f 100644 (file)
@@ -14,7 +14,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/i2c/mcs.h>
 #include <linux/interrupt.h>
@@ -194,7 +193,7 @@ static int mcs5000_ts_probe(struct i2c_client *client,
        struct input_dev *input_dev;
        int ret;
 
-       if (!client->dev.platform_data)
+       if (!dev_get_platdata(&client->dev))
                return -EINVAL;
 
        data = kzalloc(sizeof(struct mcs5000_ts_data), GFP_KERNEL);
@@ -207,7 +206,7 @@ static int mcs5000_ts_probe(struct i2c_client *client,
 
        data->client = client;
        data->input_dev = input_dev;
-       data->platform_data = client->dev.platform_data;
+       data->platform_data = dev_get_platdata(&client->dev);
 
        input_dev->name = "MELPAS MCS-5000 Touchscreen";
        input_dev->id.bustype = BUS_I2C;
index 1443532fe6c4d112f15a317d598ddc4f4dc78fb5..8a598c065391dd3a483453be18f1e59e7ca068ea 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/of.h>
 #include <linux/i2c.h>
index eb66b7c37c2f9408e3a29b7fd7b5254bf7dcfb08..9b5552a2616922a849573bad553080c130a976c9 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "MicroTouch serial touchscreen driver"
 
index f22e04dd4e16122a360f07ba23b1f7d8f654e461..cff2376817e5fc564f5173eb3c48d850491e661a 100644 (file)
@@ -11,7 +11,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/string.h>
 #include <linux/slab.h>
index b49f0b836925a63c5142990cb87975900e7f5323..417d87379265db4fcafccb0f5de355ccb3b1ae46 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/input.h>
 #include <linux/input/mt.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "PenMount serial touchscreen driver"
 
index 6cc6b36663ffb188ff97b20714d0d4de39dbb833..02392d2061d6a01f304216ecfed1dc84b9de60a3 100644 (file)
@@ -128,7 +128,8 @@ static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops,
 static int pixcir_i2c_ts_probe(struct i2c_client *client,
                                         const struct i2c_device_id *id)
 {
-       const struct pixcir_ts_platform_data *pdata = client->dev.platform_data;
+       const struct pixcir_ts_platform_data *pdata =
+                       dev_get_platdata(&client->dev);
        struct pixcir_i2c_ts_data *tsdata;
        struct input_dev *input;
        int error;
index b061af2c83768f2b0a7159c1707a78a6da55bc71..19cb247dbb86ef5adc570f38782e6f5954c2ee06 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/module.h>
 #include <linux/gpio.h>
 #include <linux/input.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
@@ -251,7 +250,7 @@ static int s3c2410ts_probe(struct platform_device *pdev)
 
        ts.dev = dev;
 
-       info = pdev->dev.platform_data;
+       info = dev_get_platdata(&pdev->dev);
        if (!info) {
                dev_err(dev, "no platform data, cannot attach\n");
                return -EINVAL;
@@ -392,7 +391,7 @@ static int s3c2410ts_suspend(struct device *dev)
 static int s3c2410ts_resume(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);
-       struct s3c2410_ts_mach_info *info = pdev->dev.platform_data;
+       struct s3c2410_ts_mach_info *info = dev_get_platdata(&pdev->dev);
 
        clk_enable(ts.clock);
        enable_irq(ts.irq_tc);
index 2f03b2f289dd365fe3053338d09d049b7d724244..5c342b3139e8989ed737a91180cb6b3fa0f58f9c 100644 (file)
@@ -154,7 +154,7 @@ static int st1232_ts_probe(struct i2c_client *client,
                                        const struct i2c_device_id *id)
 {
        struct st1232_ts_data *ts;
-       struct st1232_pdata *pdata = client->dev.platform_data;
+       struct st1232_pdata *pdata = dev_get_platdata(&client->dev);
        struct input_dev *input_dev;
        int error;
 
index 59e81b00f244c1852eca936493538e52d4eb3085..42ce31afa259e80d674b4cf2071e4c7cff5f4be0 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/device.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
index 2ca5a7bee04e45c3b5661df8a54ed97fdefbd1fa..4e793a17361f7b2e02955e7e6e02ece9151f8063 100644 (file)
@@ -14,7 +14,6 @@
  */
 
 
-#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/err.h>
 #include <linux/module.h>
index 5f29e5b8e1c1995bbede2bb5df00f7cc609a59d1..c27cf8f3d1ca9bb58699eca8b0ad93ea331518e0 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Sahara TouchIT-213 serial touchscreen driver"
 
index 8a2887daf194ed26c204ff5cf216f4261ec05520..4000e52054075acb33b2dae5dcf2fe5d34eb1ce8 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Touchright serial touchscreen driver"
 
index 588cdcb839ddef36541f5f685972a919417628c1..ba90f447df75f4d21d02c445f4de15481c27a938 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define DRIVER_DESC    "Touchwindow serial touchscreen driver"
 
index 811353353917d2b5f0440b8c5a5f5a704cd6c1e9..550adcbbfc2321b3110bf6a62d2c87805c6cabec 100644 (file)
@@ -571,7 +571,7 @@ static void tsc2005_setup_spi_xfer(struct tsc2005 *ts)
 
 static int tsc2005_probe(struct spi_device *spi)
 {
-       const struct tsc2005_platform_data *pdata = spi->dev.platform_data;
+       const struct tsc2005_platform_data *pdata = dev_get_platdata(&spi->dev);
        struct tsc2005 *ts;
        struct input_dev *input_dev;
        unsigned int max_x, max_y, max_p;
index 0b67ba476b4cdc204e6dc98aec29d006b217a4bc..1bf9906b5a3fc189276c39d065a2cc58b36ddbd3 100644 (file)
@@ -26,6 +26,9 @@
 #include <linux/interrupt.h>
 #include <linux/i2c.h>
 #include <linux/i2c/tsc2007.h>
+#include <linux/of_device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
 
 #define TSC2007_MEASURE_TEMP0          (0x0 << 4)
 #define TSC2007_MEASURE_AUX            (0x2 << 4)
@@ -72,15 +75,18 @@ struct tsc2007 {
        u16                     model;
        u16                     x_plate_ohms;
        u16                     max_rt;
-       unsigned long           poll_delay;
        unsigned long           poll_period;
+       int                     fuzzx;
+       int                     fuzzy;
+       int                     fuzzz;
 
+       unsigned                gpio;
        int                     irq;
 
        wait_queue_head_t       wait;
        bool                    stopped;
 
-       int                     (*get_pendown_state)(void);
+       int                     (*get_pendown_state)(struct device *);
        void                    (*clear_penirq)(void);
 };
 
@@ -161,7 +167,7 @@ static bool tsc2007_is_pen_down(struct tsc2007 *ts)
        if (!ts->get_pendown_state)
                return true;
 
-       return ts->get_pendown_state();
+       return ts->get_pendown_state(&ts->client->dev);
 }
 
 static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
@@ -178,7 +184,7 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
 
                rt = tsc2007_calculate_pressure(ts, &tc);
 
-               if (rt == 0 && !ts->get_pendown_state) {
+               if (!rt && !ts->get_pendown_state) {
                        /*
                         * If pressure reported is 0 and we don't have
                         * callback to check pendown state, we have to
@@ -228,7 +234,7 @@ static irqreturn_t tsc2007_hard_irq(int irq, void *handle)
 {
        struct tsc2007 *ts = handle;
 
-       if (!ts->get_pendown_state || likely(ts->get_pendown_state()))
+       if (tsc2007_is_pen_down(ts))
                return IRQ_WAKE_THREAD;
 
        if (ts->clear_penirq)
@@ -273,49 +279,134 @@ static void tsc2007_close(struct input_dev *input_dev)
        tsc2007_stop(ts);
 }
 
-static int tsc2007_probe(struct i2c_client *client,
-                                  const struct i2c_device_id *id)
+#ifdef CONFIG_OF
+static int tsc2007_get_pendown_state_gpio(struct device *dev)
 {
-       struct tsc2007 *ts;
-       struct tsc2007_platform_data *pdata = client->dev.platform_data;
-       struct input_dev *input_dev;
-       int err;
+       struct i2c_client *client = to_i2c_client(dev);
+       struct tsc2007 *ts = i2c_get_clientdata(client);
+
+       return !gpio_get_value(ts->gpio);
+}
+
+static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts)
+{
+       struct device_node *np = client->dev.of_node;
+       u32 val32;
+       u64 val64;
 
-       if (!pdata) {
-               dev_err(&client->dev, "platform data is required!\n");
+       if (!np) {
+               dev_err(&client->dev, "missing device tree data\n");
                return -EINVAL;
        }
 
-       if (!i2c_check_functionality(client->adapter,
-                                    I2C_FUNC_SMBUS_READ_WORD_DATA))
-               return -EIO;
+       if (!of_property_read_u32(np, "ti,max-rt", &val32))
+               ts->max_rt = val32;
+       else
+               ts->max_rt = MAX_12BIT;
+
+       if (!of_property_read_u32(np, "ti,fuzzx", &val32))
+               ts->fuzzx = val32;
+
+       if (!of_property_read_u32(np, "ti,fuzzy", &val32))
+               ts->fuzzy = val32;
+
+       if (!of_property_read_u32(np, "ti,fuzzz", &val32))
+               ts->fuzzz = val32;
+
+       if (!of_property_read_u64(np, "ti,poll-period", &val64))
+               ts->poll_period = val64;
+       else
+               ts->poll_period = 1;
 
-       ts = kzalloc(sizeof(struct tsc2007), GFP_KERNEL);
-       input_dev = input_allocate_device();
-       if (!ts || !input_dev) {
-               err = -ENOMEM;
-               goto err_free_mem;
+       if (!of_property_read_u32(np, "ti,x-plate-ohms", &val32)) {
+               ts->x_plate_ohms = val32;
+       } else {
+               dev_err(&client->dev, "missing ti,x-plate-ohms devicetree property.");
+               return -EINVAL;
        }
 
-       ts->client = client;
-       ts->irq = client->irq;
-       ts->input = input_dev;
-       init_waitqueue_head(&ts->wait);
+       ts->gpio = of_get_gpio(np, 0);
+       if (gpio_is_valid(ts->gpio))
+               ts->get_pendown_state = tsc2007_get_pendown_state_gpio;
+       else
+               dev_warn(&client->dev,
+                        "GPIO not specified in DT (of_get_gpio returned %d)\n",
+                        ts->gpio);
+
+       return 0;
+}
+#else
+static int tsc2007_probe_dt(struct i2c_client *client, struct tsc2007 *ts)
+{
+       dev_err(&client->dev, "platform data is required!\n");
+       return -EINVAL;
+}
+#endif
 
+static int tsc2007_probe_pdev(struct i2c_client *client, struct tsc2007 *ts,
+                             const struct tsc2007_platform_data *pdata,
+                             const struct i2c_device_id *id)
+{
        ts->model             = pdata->model;
        ts->x_plate_ohms      = pdata->x_plate_ohms;
        ts->max_rt            = pdata->max_rt ? : MAX_12BIT;
-       ts->poll_delay        = pdata->poll_delay ? : 1;
        ts->poll_period       = pdata->poll_period ? : 1;
        ts->get_pendown_state = pdata->get_pendown_state;
        ts->clear_penirq      = pdata->clear_penirq;
+       ts->fuzzx             = pdata->fuzzx;
+       ts->fuzzy             = pdata->fuzzy;
+       ts->fuzzz             = pdata->fuzzz;
 
        if (pdata->x_plate_ohms == 0) {
                dev_err(&client->dev, "x_plate_ohms is not set up in platform data");
-               err = -EINVAL;
-               goto err_free_mem;
+               return -EINVAL;
        }
 
+       return 0;
+}
+
+static void tsc2007_call_exit_platform_hw(void *data)
+{
+       struct device *dev = data;
+       const struct tsc2007_platform_data *pdata = dev_get_platdata(dev);
+
+       pdata->exit_platform_hw();
+}
+
+static int tsc2007_probe(struct i2c_client *client,
+                        const struct i2c_device_id *id)
+{
+       const struct tsc2007_platform_data *pdata = dev_get_platdata(&client->dev);
+       struct tsc2007 *ts;
+       struct input_dev *input_dev;
+       int err;
+
+       if (!i2c_check_functionality(client->adapter,
+                                    I2C_FUNC_SMBUS_READ_WORD_DATA))
+               return -EIO;
+
+       ts = devm_kzalloc(&client->dev, sizeof(struct tsc2007), GFP_KERNEL);
+       if (!ts)
+               return -ENOMEM;
+
+       if (pdata)
+               err = tsc2007_probe_pdev(client, ts, pdata, id);
+       else
+               err = tsc2007_probe_dt(client, ts);
+       if (err)
+               return err;
+
+       input_dev = devm_input_allocate_device(&client->dev);
+       if (!input_dev)
+               return -ENOMEM;
+
+       i2c_set_clientdata(client, ts);
+
+       ts->client = client;
+       ts->irq = client->irq;
+       ts->input = input_dev;
+       init_waitqueue_head(&ts->wait);
+
        snprintf(ts->phys, sizeof(ts->phys),
                 "%s/input0", dev_name(&client->dev));
 
@@ -331,53 +422,46 @@ static int tsc2007_probe(struct i2c_client *client,
        input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
        input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
 
-       input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, pdata->fuzzx, 0);
-       input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, pdata->fuzzy, 0);
+       input_set_abs_params(input_dev, ABS_X, 0, MAX_12BIT, ts->fuzzx, 0);
+       input_set_abs_params(input_dev, ABS_Y, 0, MAX_12BIT, ts->fuzzy, 0);
        input_set_abs_params(input_dev, ABS_PRESSURE, 0, MAX_12BIT,
-                       pdata->fuzzz, 0);
+                            ts->fuzzz, 0);
+
+       if (pdata) {
+               if (pdata->exit_platform_hw) {
+                       err = devm_add_action(&client->dev,
+                                             tsc2007_call_exit_platform_hw,
+                                             &client->dev);
+                       if (err) {
+                               dev_err(&client->dev,
+                                       "Failed to register exit_platform_hw action, %d\n",
+                                       err);
+                               return err;
+                       }
+               }
 
-       if (pdata->init_platform_hw)
-               pdata->init_platform_hw();
+               if (pdata->init_platform_hw)
+                       pdata->init_platform_hw();
+       }
 
-       err = request_threaded_irq(ts->irq, tsc2007_hard_irq, tsc2007_soft_irq,
-                                  IRQF_ONESHOT, client->dev.driver->name, ts);
-       if (err < 0) {
-               dev_err(&client->dev, "irq %d busy?\n", ts->irq);
-               goto err_free_mem;
+       err = devm_request_threaded_irq(&client->dev, ts->irq,
+                                       tsc2007_hard_irq, tsc2007_soft_irq,
+                                       IRQF_ONESHOT,
+                                       client->dev.driver->name, ts);
+       if (err) {
+               dev_err(&client->dev, "Failed to request irq %d: %d\n",
+                       ts->irq, err);
+               return err;
        }
 
        tsc2007_stop(ts);
 
        err = input_register_device(input_dev);
-       if (err)
-               goto err_free_irq;
-
-       i2c_set_clientdata(client, ts);
-
-       return 0;
-
- err_free_irq:
-       free_irq(ts->irq, ts);
-       if (pdata->exit_platform_hw)
-               pdata->exit_platform_hw();
- err_free_mem:
-       input_free_device(input_dev);
-       kfree(ts);
-       return err;
-}
-
-static int tsc2007_remove(struct i2c_client *client)
-{
-       struct tsc2007  *ts = i2c_get_clientdata(client);
-       struct tsc2007_platform_data *pdata = client->dev.platform_data;
-
-       free_irq(ts->irq, ts);
-
-       if (pdata->exit_platform_hw)
-               pdata->exit_platform_hw();
-
-       input_unregister_device(ts->input);
-       kfree(ts);
+       if (err) {
+               dev_err(&client->dev,
+                       "Failed to register input device: %d\n", err);
+               return err;
+       }
 
        return 0;
 }
@@ -389,14 +473,22 @@ static const struct i2c_device_id tsc2007_idtable[] = {
 
 MODULE_DEVICE_TABLE(i2c, tsc2007_idtable);
 
+#ifdef CONFIG_OF
+static const struct of_device_id tsc2007_of_match[] = {
+       { .compatible = "ti,tsc2007" },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, tsc2007_of_match);
+#endif
+
 static struct i2c_driver tsc2007_driver = {
        .driver = {
                .owner  = THIS_MODULE,
-               .name   = "tsc2007"
+               .name   = "tsc2007",
+               .of_match_table = of_match_ptr(tsc2007_of_match),
        },
        .id_table       = tsc2007_idtable,
        .probe          = tsc2007_probe,
-       .remove         = tsc2007_remove,
 };
 
 module_i2c_driver(tsc2007_driver);
index eb96f168fb9d53c68032c172faec9d2652dcfa70..29687872cb945356253b0dd017f74cb0a0acc3ef 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 #define PACKET_LENGTH  5
 struct tsc_ser {
index 1271f97b40791bd983b6342bb3e2459bba9deef4..b46c55cd1bbb89ada7b5d3aaf5959b3dd55554a3 100644 (file)
@@ -19,7 +19,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/sched.h>
 #include <linux/wait.h>
@@ -320,7 +319,7 @@ static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb,
 
 static int ucb1400_ts_probe(struct platform_device *pdev)
 {
-       struct ucb1400_ts *ucb = pdev->dev.platform_data;
+       struct ucb1400_ts *ucb = dev_get_platdata(&pdev->dev);
        int error, x_res, y_res;
        u16 fcsr;
 
@@ -399,7 +398,7 @@ err:
 
 static int ucb1400_ts_remove(struct platform_device *pdev)
 {
-       struct ucb1400_ts *ucb = pdev->dev.platform_data;
+       struct ucb1400_ts *ucb = dev_get_platdata(&pdev->dev);
 
        free_irq(ucb->irq, ucb);
        input_unregister_device(ucb->ts_idev);
@@ -410,7 +409,7 @@ static int ucb1400_ts_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int ucb1400_ts_suspend(struct device *dev)
 {
-       struct ucb1400_ts *ucb = dev->platform_data;
+       struct ucb1400_ts *ucb = dev_get_platdata(dev);
        struct input_dev *idev = ucb->ts_idev;
 
        mutex_lock(&idev->mutex);
@@ -424,7 +423,7 @@ static int ucb1400_ts_suspend(struct device *dev)
 
 static int ucb1400_ts_resume(struct device *dev)
 {
-       struct ucb1400_ts *ucb = dev->platform_data;
+       struct ucb1400_ts *ucb = dev_get_platdata(dev);
        struct input_dev *idev = ucb->ts_idev;
 
        mutex_lock(&idev->mutex);
index 5f87bed054674b487e724d3588806235b5b5f738..a0966331a89bb1269f358f13bc90be40161dad2c 100644 (file)
@@ -51,7 +51,6 @@
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/usb.h>
 #include <linux/usb/input.h>
 #include <linux/hid.h>
index 9a83be6b6584f8f3af131767197916c65c8c1000..2792ca397dd085eb1f8d30d0af2a12a233389a41 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/slab.h>
 #include <linux/input/mt.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 #include <linux/ctype.h>
 #include <linux/delay.h>
 
index 6be2eb6a153a5588180da011fd91611d2ad597ad..1b953a066b2c4134191d398ffc71389fd6ca6275 100644 (file)
@@ -13,7 +13,6 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/string.h>
 #include <linux/pm.h>
 #include <linux/input.h>
index 7e45c9f6e6b7426d69c90f82f3c8eb2c54a7a15f..d0ef91fc87d1cc67838056a77b5539fe10eef4ed 100644 (file)
@@ -584,7 +584,7 @@ static void wm97xx_ts_input_close(struct input_dev *idev)
 static int wm97xx_probe(struct device *dev)
 {
        struct wm97xx *wm;
-       struct wm97xx_pdata *pdata = dev->platform_data;
+       struct wm97xx_pdata *pdata = dev_get_platdata(dev);
        int ret = 0, id = 0;
 
        wm = kzalloc(sizeof(struct wm97xx), GFP_KERNEL);
index aa127ba392a45cbabe9f95180876543dd6441865..2175f341900204f8ba0c3ba42c99973603fc6b09 100644 (file)
@@ -279,7 +279,8 @@ static int zforce_start(struct zforce_ts *ts)
                goto error;
        }
 
-       if (zforce_setconfig(ts, SETCONFIG_DUALTOUCH)) {
+       ret = zforce_setconfig(ts, SETCONFIG_DUALTOUCH);
+       if (ret) {
                dev_err(&client->dev, "Unable to set config\n");
                goto error;
        }
index bf0869a7a78e2754d38e0883b5105efac8a76452..e2ccd683de6ec5563aef574f65e1336107d487f9 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/gpio.h>
 #include <linux/irq.h>
index 506a9f7af51e6a5dc4766f62d19dda5279d06e7e..4f35b6ad3889fac069910379c48b149dea413358 100644 (file)
@@ -7,16 +7,14 @@ struct tsc2007_platform_data {
        u16     model;                          /* 2007. */
        u16     x_plate_ohms;   /* must be non-zero value */
        u16     max_rt; /* max. resistance above which samples are ignored */
-       unsigned long poll_delay; /* delay (in ms) after pen-down event
-                                    before polling starts */
        unsigned long poll_period; /* time (in ms) between samples */
        int     fuzzx; /* fuzz factor for X, Y and pressure axes */
        int     fuzzy;
        int     fuzzz;
 
-       int     (*get_pendown_state)(void);
-       void    (*clear_penirq)(void);          /* If needed, clear 2nd level
-                                                  interrupt source */
+       int     (*get_pendown_state)(struct device *);
+       /* If needed, clear 2nd level interrupt source */
+       void    (*clear_penirq)(void);
        int     (*init_platform_hw)(void);
        void    (*exit_platform_hw)(void);
 };
index 1e2f4e97f428d072b942a5020ab32f28028d084b..adccee25b162f234eddf8352dd68811da16a078f 100644 (file)
@@ -1,9 +1,5 @@
-/*
- * arch/arm/mach-ep93xx/include/mach/ep93xx_keypad.h
- */
-
-#ifndef __ASM_ARCH_EP93XX_KEYPAD_H
-#define __ASM_ARCH_EP93XX_KEYPAD_H
+#ifndef __KEYPAD_EP93XX_H
+#define __KEYPAD_EP93XX_H
 
 struct matrix_keymap_data;
 
@@ -32,4 +28,4 @@ struct ep93xx_keypad_platform_data {
 #define EP93XX_MATRIX_ROWS             (8)
 #define EP93XX_MATRIX_COLS             (8)
 
-#endif /* __ASM_ARCH_EP93XX_KEYPAD_H */
+#endif /* __KEYPAD_EP93XX_H */
index a6b21eddb212771641f09e13d9216b4d7c89803c..c3a3abae98f073251c7134504365d0f2ae17d7b2 100644 (file)
@@ -1,14 +1,12 @@
 /*
- *  arch/arm/plat-omap/include/mach/keypad.h
- *
  *  Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#ifndef ASMARM_ARCH_KEYPAD_H
-#define ASMARM_ARCH_KEYPAD_H
+#ifndef __KEYPAD_OMAP_H
+#define __KEYPAD_OMAP_H
 
 #ifndef CONFIG_ARCH_OMAP1
 #warning Please update the board to use matrix-keypad driver