]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'input/next'
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 10 Dec 2013 01:09:04 +0000 (12:09 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 10 Dec 2013 01:09:04 +0000 (12:09 +1100)
69 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-pwrbutton.txt [new file with mode: 0644]
arch/arm/mach-imx/mach-cpuimx35.c
arch/arm/mach-imx/mach-cpuimx51sd.c
arch/sh/boards/mach-ecovec24/setup.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/davinci_keyscan.c
drivers/input/keyboard/ep93xx_keypad.c
drivers/input/keyboard/imx_keypad.c
drivers/input/keyboard/lm8323.c
drivers/input/keyboard/lm8333.c
drivers/input/keyboard/max7359_keypad.c
drivers/input/keyboard/mcs_touchkey.c
drivers/input/keyboard/mpr121_touchkey.c
drivers/input/keyboard/nomadik-ske-keypad.c
drivers/input/keyboard/omap-keypad.c
drivers/input/keyboard/pxa930_rotary.c
drivers/input/keyboard/samsung-keypad.c
drivers/input/keyboard/sh_keysc.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/misc/Kconfig
drivers/input/misc/Makefile
drivers/input/misc/ad714x.c
drivers/input/misc/adxl34x.c
drivers/input/misc/bfin_rotary.c
drivers/input/misc/bma150.c
drivers/input/misc/cma3000_d0x.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/kxtj9.c
drivers/input/misc/pwm-beeper.c
drivers/input/misc/twl4030-pwrbutton.c
drivers/input/misc/twl4030-vibra.c
drivers/input/mouse/gpio_mouse.c
drivers/input/mouse/pxa930_trkball.c
drivers/input/serio/pcips2.c
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/da9034-ts.c
drivers/input/touchscreen/edt-ft5x06.c
drivers/input/touchscreen/eeti_ts.c
drivers/input/touchscreen/ili210x.c
drivers/input/touchscreen/mcs5000_ts.c
drivers/input/touchscreen/pixcir_i2c_ts.c
drivers/input/touchscreen/s3c2410_ts.c
drivers/input/touchscreen/st1232.c
drivers/input/touchscreen/tsc2005.c
drivers/input/touchscreen/tsc2007.c
drivers/input/touchscreen/ucb1400_ts.c
drivers/input/touchscreen/wm97xx-core.c
include/linux/i2c/tsc2007.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-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 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 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 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..0dc1151d02fbf05a152116336cf9e4628bd6f0ec 100644 (file)
@@ -71,7 +71,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..a8f5f92165654e4f536875b352f189ddb1ee100d 100644 (file)
@@ -173,7 +173,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 +227,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 +321,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 +425,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..ff7725a00776dd4e8d17b6f07ef75b02ce533c96 100644 (file)
@@ -499,7 +499,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 +553,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 +658,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 +864,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..16223f4599d425704c9ddf3ad613e9ab03790ae9 100644 (file)
@@ -180,7 +180,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 +333,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 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 328cfc1eed95dac7d8452547a389909d0320e35a..34bb3589526808ab30491ea9ef18dc4218f4ace2 100644 (file)
@@ -425,7 +425,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 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 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..5ec77523e0401e3238dddcf80ccc297962712cf0 100644 (file)
@@ -108,7 +108,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..98b8467aa6c94021d261062b3ab4b3c5c29ff43e 100644 (file)
@@ -188,7 +188,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 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..e80bb97433566df07a89b4562993271228108b77 100644 (file)
@@ -248,7 +248,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 248cdcf952965c616b4de79fca4dfe87f79e38b3..367b03ab92a259d8143b09aa430ff229cc97e8df 100644 (file)
@@ -84,7 +84,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 ac43a486c77536c6267aa33f766b104d698784d7..9ac8a1e0c08e6d3f6c84a1482f52f8519537f130 100644 (file)
@@ -321,7 +321,7 @@ static int samsung_keypad_probe(struct platform_device *pdev)
        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;
index fe0e498d24794e557c5c63f67059103dd105fcca..d65a98b1d7dde3f4c675f2d4b6b0df1e21d887bb 100644 (file)
@@ -171,7 +171,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 +198,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 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..8bc2879b4c876627c9e81db0f3c94120c4453130 100644 (file)
@@ -330,7 +330,7 @@ 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;
+       struct twl4030_keypad_data *pdata = dev_get_platdata(&pdev->dev);
        const struct matrix_keymap_data *keymap_data;
        struct twl4030_keypad *kp;
        struct input_dev *input;
index 7b039162a3f833485239274e613aad5cd6ad8710..e03614f20d3b10d5e8cbad86a9a4d9afc75639af 100644 (file)
@@ -121,7 +121,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 5f4967d01bc36a621655f64eea7e2c1408ef43b7..4ffc39732513fcd0a20a28d611c2b077ccd0e6bb 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..6deecdd3d11bae34af377bcf648d51b689cc054e 100644 (file)
@@ -969,7 +969,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 +986,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 0735de3a6468f85cad2c08a1dc601d5a67a67a23..d2049972f70a9ce634581a73e1b15d8f155d655a 100644 (file)
@@ -714,7 +714,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 cd139cb17e326dd6a740db877a2b85ef18344963..7703447d1fd9292dab4219f5236f9d97f7330f52 100644 (file)
@@ -92,7 +92,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 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..38b3c11a8ae911405bc2711de658aecd373774ed 100644 (file)
@@ -98,7 +98,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 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 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 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..d993775a7c3908513698208b499bc51494ea2094 100644 (file)
@@ -193,7 +193,7 @@ static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata,
 
 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 6b44413f54e357cd9201af5dc011bed845e1377d..6810a4626a2a5cb390a7c0c96e3a48127140aeed 100644 (file)
@@ -48,7 +48,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 0ecb9e7945eb0df7d8eb83031fbd39ed2f18355c..d20d2ae5f1ee695e324e67b9d74272f52829dba1 100644 (file)
@@ -166,7 +166,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 76f83836fd5a557b513eb8d3e91b2e964bfa5507..13062f667e82650467495702b35b038cff616130 100644 (file)
@@ -181,7 +181,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 867e7c33ac55072b19f2ff339705c4e90f6b428d..8318826d976eabdc55a5cd1c13269d720901edcf 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;
@@ -1199,7 +1202,8 @@ static void wacom_wireless_work(struct work_struct *work)
                        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;
@@ -1322,7 +1326,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;
@@ -1392,7 +1396,6 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
                        goto fail5;
                }
        }
-
        return 0;
 
  fail5: wacom_destroy_leds(wacom);
index 782c2535f1d81a26db96716ac406405b2b03a78b..7655088f78e0efc4bab45fa62cfc442230b460c1 100644 (file)
@@ -1151,8 +1151,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 +1176,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);
 }
 
@@ -1217,7 +1223,7 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
        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)
            return 0;
 
        prox = (data[1] & 0x20) == 0x20;
@@ -1297,7 +1303,7 @@ 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;
@@ -1391,6 +1397,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 +1466,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;
 
@@ -1771,33 +1778,43 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
                __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
                break;
 
+       case INTUOSHT:
        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);
@@ -2200,6 +2217,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 +2365,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) },
index fd23a3790605070a41ec37f19eff051b0e89be5a..854cceb6d6deec48ba8da9432e57c6a83bd69043 100644 (file)
@@ -54,6 +54,7 @@
 #define WACOM_REPORT_TPCST             16
 #define WACOM_REPORT_TPC1FGE           18
 #define WACOM_REPORT_24HDT             1
+#define WACOM_REPORT_WL                        128
 
 /* device quirks */
 #define WACOM_QUIRK_MULTI_INPUT                0x0001
@@ -81,6 +82,7 @@ enum {
        INTUOSPS,
        INTUOSPM,
        INTUOSPL,
+       INTUOSHT,
        WACOM_21UX2,
        WACOM_22HD,
        DTK,
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..b9f9bcb22683d2252d50fffef464de317fbd3be6 100644 (file)
@@ -686,7 +686,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..a0364d8ae6c650b5e47f77b91b0085dc5534f824 100644 (file)
@@ -470,7 +470,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 +495,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..569578638233b6b49bd638916cfc5eb1ea55c13e 100644 (file)
@@ -101,7 +101,7 @@ struct ads7846 {
        struct spi_device       *spi;
        struct regulator        *reg;
 
-#if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE)
+#if IS_ENABLED(CONFIG_HWMON)
        struct attribute_group  *attr_group;
        struct device           *hwmon;
 #endif
@@ -421,7 +421,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) \
index 59aa24002c7bff9e1f8629787c7c0ce9eea36886..37ea05741d209a00c0648748ede58ecde5e82448 100644 (file)
@@ -1130,7 +1130,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..f7d1ea5849ba46d4c977cc0d6e763ba4d6658f2a 100644 (file)
@@ -182,7 +182,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 34ad84105e6ee1a18718fe06b23ca379a6a0346f..ea0f7645220f09fc71bcbc8099de69a156ee9f88 100644 (file)
@@ -299,7 +299,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 83fa1b15a97f4f6a7ea5a78b6ab044485a08f957..af0d68b703b702528a59d6b81cc90bf043e44f75 100644 (file)
@@ -705,7 +705,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;
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 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 f9f4e0c56eda9fec33439bcd8a54913f3953e462..58486f135a4c3d5a675c09ef5263055295f69bf2 100644 (file)
@@ -194,7 +194,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 +207,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 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..d32bd9e6d21540265c0d9a4d21299f8a6d7b35ec 100644 (file)
@@ -251,7 +251,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 +392,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 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 1271f97b40791bd983b6342bb3e2459bba9deef4..5b3ca807d179043fbda308a123ce2e82943113e6 100644 (file)
@@ -320,7 +320,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 +399,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 +410,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 +424,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 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 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);
 };