diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2018-02-01 00:37:30 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2018-02-01 00:37:30 -0800 |
commit | d67ad78e09cbb9935c74a40b85c5abe5b9cd48f8 (patch) | |
tree | 56e92b487de80090a998ff3c0469375982156802 /drivers/input/touchscreen | |
parent | 060403f34008af90e310d7e0e7531ebb3acf9557 (diff) | |
parent | fafef982c7353e8982b951e40573e990ccf0ed00 (diff) |
Merge branch 'next' into for-linus
Prepare input updates for 4.16 merge window.
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/Kconfig | 15 | ||||
-rw-r--r-- | drivers/input/touchscreen/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/touchscreen/ad7877.c | 67 | ||||
-rw-r--r-- | drivers/input/touchscreen/atmel-wm97xx.c | 436 | ||||
-rw-r--r-- | drivers/input/touchscreen/auo-pixcir-ts.c | 6 | ||||
-rw-r--r-- | drivers/input/touchscreen/colibri-vf50-ts.c | 2 | ||||
-rw-r--r-- | drivers/input/touchscreen/da9052_tsi.c | 1 | ||||
-rw-r--r-- | drivers/input/touchscreen/edt-ft5x06.c | 14 | ||||
-rw-r--r-- | drivers/input/touchscreen/elants_i2c.c | 2 | ||||
-rw-r--r-- | drivers/input/touchscreen/goodix.c | 149 | ||||
-rw-r--r-- | drivers/input/touchscreen/melfas_mip4.c | 1 | ||||
-rw-r--r-- | drivers/input/touchscreen/mms114.c | 240 | ||||
-rw-r--r-- | drivers/input/touchscreen/raydium_i2c_ts.c | 14 | ||||
-rw-r--r-- | drivers/input/touchscreen/silead.c | 46 | ||||
-rw-r--r-- | drivers/input/touchscreen/stmfts.c | 11 | ||||
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 9 | ||||
-rw-r--r-- | drivers/input/touchscreen/wdt87xx_i2c.c | 2 |
17 files changed, 288 insertions, 728 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 0cfdb7cb610e..5fac4ef3ae7b 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -795,21 +795,6 @@ config TOUCHSCREEN_WM9713 Say Y here to enable support for the Wolfson Microelectronics WM9713 touchscreen controller. -config TOUCHSCREEN_WM97XX_ATMEL - tristate "WM97xx Atmel accelerated touch" - depends on TOUCHSCREEN_WM97XX && AVR32 - help - Say Y here for support for streaming mode with WM97xx touchscreens - on Atmel AT91 or AVR32 systems with an AC97C module. - - Be aware that this will use channel B in the controller for - streaming data, this must not conflict with other AC97C drivers. - - If unsure, say N. - - To compile this driver as a module, choose M here: the module will - be called atmel-wm97xx. - config TOUCHSCREEN_WM97XX_MAINSTONE tristate "WM97xx Mainstone/Palm accelerated touch" depends on TOUCHSCREEN_WM97XX && ARCH_PXA diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index d2a2b3b7af27..dddae7973436 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -97,7 +97,6 @@ obj-$(CONFIG_TOUCHSCREEN_WM97XX) += wm97xx-ts.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9713) += wm9713.o -obj-$(CONFIG_TOUCHSCREEN_WM97XX_ATMEL) += atmel-wm97xx.o obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE) += zylonite-wm97xx.o obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c index 0381c7809d1b..5cfe477ec992 100644 --- a/drivers/input/touchscreen/ad7877.c +++ b/drivers/input/touchscreen/ad7877.c @@ -417,8 +417,10 @@ out: return IRQ_HANDLED; } -static void ad7877_disable(struct ad7877 *ts) +static void ad7877_disable(void *data) { + struct ad7877 *ts = data; + mutex_lock(&ts->mutex); if (!ts->disabled) { @@ -707,12 +709,17 @@ static int ad7877_probe(struct spi_device *spi) return err; } - ts = kzalloc(sizeof(struct ad7877), GFP_KERNEL); - input_dev = input_allocate_device(); - if (!ts || !input_dev) { - err = -ENOMEM; - goto err_free_mem; - } + ts = devm_kzalloc(&spi->dev, sizeof(struct ad7877), GFP_KERNEL); + if (!ts) + return -ENOMEM; + + input_dev = devm_input_allocate_device(&spi->dev); + if (!input_dev) + return -ENOMEM; + + err = devm_add_action_or_reset(&spi->dev, ad7877_disable, ts); + if (err) + return err; spi_set_drvdata(spi, ts); ts->spi = spi; @@ -761,11 +768,10 @@ static int ad7877_probe(struct spi_device *spi) verify = ad7877_read(spi, AD7877_REG_SEQ1); - if (verify != AD7877_MM_SEQUENCE){ + if (verify != AD7877_MM_SEQUENCE) { dev_err(&spi->dev, "%s: Failed to probe %s\n", dev_name(&spi->dev), input_dev->name); - err = -ENODEV; - goto err_free_mem; + return -ENODEV; } if (gpio3) @@ -775,47 +781,21 @@ static int ad7877_probe(struct spi_device *spi) /* Request AD7877 /DAV GPIO interrupt */ - err = request_threaded_irq(spi->irq, NULL, ad7877_irq, - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - spi->dev.driver->name, ts); + err = devm_request_threaded_irq(&spi->dev, spi->irq, NULL, ad7877_irq, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + spi->dev.driver->name, ts); if (err) { dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); - goto err_free_mem; + return err; } - err = sysfs_create_group(&spi->dev.kobj, &ad7877_attr_group); + err = devm_device_add_group(&spi->dev, &ad7877_attr_group); if (err) - goto err_free_irq; + return err; err = input_register_device(input_dev); if (err) - goto err_remove_attr_group; - - return 0; - -err_remove_attr_group: - sysfs_remove_group(&spi->dev.kobj, &ad7877_attr_group); -err_free_irq: - free_irq(spi->irq, ts); -err_free_mem: - input_free_device(input_dev); - kfree(ts); - return err; -} - -static int ad7877_remove(struct spi_device *spi) -{ - struct ad7877 *ts = spi_get_drvdata(spi); - - sysfs_remove_group(&spi->dev.kobj, &ad7877_attr_group); - - ad7877_disable(ts); - free_irq(ts->spi->irq, ts); - - input_unregister_device(ts->input); - kfree(ts); - - dev_dbg(&spi->dev, "unregistered touchscreen\n"); + return err; return 0; } @@ -846,7 +826,6 @@ static struct spi_driver ad7877_driver = { .pm = &ad7877_pm, }, .probe = ad7877_probe, - .remove = ad7877_remove, }; module_spi_driver(ad7877_driver); diff --git a/drivers/input/touchscreen/atmel-wm97xx.c b/drivers/input/touchscreen/atmel-wm97xx.c deleted file mode 100644 index 9140a43cfe20..000000000000 --- a/drivers/input/touchscreen/atmel-wm97xx.c +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Atmel AT91 and AVR32 continuous touch screen driver for Wolfson WM97xx AC97 - * codecs. - * - * Copyright (C) 2008 - 2009 Atmel Corporation - * - * 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. - */ -#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> -#include <linux/wm97xx.h> -#include <linux/timer.h> -#include <linux/gpio.h> -#include <linux/io.h> -#include <linux/slab.h> - -#define AC97C_ICA 0x10 -#define AC97C_CBRHR 0x30 -#define AC97C_CBSR 0x38 -#define AC97C_CBMR 0x3c -#define AC97C_IER 0x54 -#define AC97C_IDR 0x58 - -#define AC97C_RXRDY (1 << 4) -#define AC97C_OVRUN (1 << 5) - -#define AC97C_CMR_SIZE_20 (0 << 16) -#define AC97C_CMR_SIZE_18 (1 << 16) -#define AC97C_CMR_SIZE_16 (2 << 16) -#define AC97C_CMR_SIZE_10 (3 << 16) -#define AC97C_CMR_CEM_LITTLE (1 << 18) -#define AC97C_CMR_CEM_BIG (0 << 18) -#define AC97C_CMR_CENA (1 << 21) - -#define AC97C_INT_CBEVT (1 << 4) - -#define AC97C_SR_CAEVT (1 << 3) - -#define AC97C_CH_MASK(slot) \ - (0x7 << (3 * (slot - 3))) -#define AC97C_CH_ASSIGN(slot, channel) \ - (AC97C_CHANNEL_##channel << (3 * (slot - 3))) -#define AC97C_CHANNEL_NONE 0x0 -#define AC97C_CHANNEL_B 0x2 - -#define ac97c_writel(chip, reg, val) \ - __raw_writel((val), (chip)->regs + AC97C_##reg) -#define ac97c_readl(chip, reg) \ - __raw_readl((chip)->regs + AC97C_##reg) - -#ifdef CONFIG_CPU_AT32AP700X -#define ATMEL_WM97XX_AC97C_IOMEM (0xfff02800) -#define ATMEL_WM97XX_AC97C_IRQ (29) -#define ATMEL_WM97XX_GPIO_DEFAULT (32+16) /* Pin 16 on port B. */ -#else -#error Unknown CPU, this driver only supports AT32AP700X CPUs. -#endif - -struct continuous { - u16 id; /* codec id */ - u8 code; /* continuous code */ - u8 reads; /* number of coord reads per read cycle */ - u32 speed; /* number of coords per second */ -}; - -#define WM_READS(sp) ((sp / HZ) + 1) - -static const struct continuous cinfo[] = { - {WM9705_ID2, 0, WM_READS(94), 94}, - {WM9705_ID2, 1, WM_READS(188), 188}, - {WM9705_ID2, 2, WM_READS(375), 375}, - {WM9705_ID2, 3, WM_READS(750), 750}, - {WM9712_ID2, 0, WM_READS(94), 94}, - {WM9712_ID2, 1, WM_READS(188), 188}, - {WM9712_ID2, 2, WM_READS(375), 375}, - {WM9712_ID2, 3, WM_READS(750), 750}, - {WM9713_ID2, 0, WM_READS(94), 94}, - {WM9713_ID2, 1, WM_READS(120), 120}, - {WM9713_ID2, 2, WM_READS(154), 154}, - {WM9713_ID2, 3, WM_READS(188), 188}, -}; - -/* Continuous speed index. */ -static int sp_idx; - -/* - * Pen sampling frequency (Hz) in continuous mode. - */ -static int cont_rate = 188; -module_param(cont_rate, int, 0); -MODULE_PARM_DESC(cont_rate, "Sampling rate in continuous mode (Hz)"); - -/* - * Pen down detection. - * - * This driver can either poll or use an interrupt to indicate a pen down - * event. If the irq request fails then it will fall back to polling mode. - */ -static int pen_int = 1; -module_param(pen_int, int, 0); -MODULE_PARM_DESC(pen_int, "Pen down detection (1 = interrupt, 0 = polling)"); - -/* - * Pressure readback. - * - * Set to 1 to read back pen down pressure. - */ -static int pressure; -module_param(pressure, int, 0); -MODULE_PARM_DESC(pressure, "Pressure readback (1 = pressure, 0 = no pressure)"); - -/* - * AC97 touch data slot. - * - * Touch screen readback data ac97 slot. - */ -static int ac97_touch_slot = 5; -module_param(ac97_touch_slot, int, 0); -MODULE_PARM_DESC(ac97_touch_slot, "Touch screen data slot AC97 number"); - -/* - * GPIO line number. - * - * Set to GPIO number where the signal from the WM97xx device is hooked up. - */ -static int atmel_gpio_line = ATMEL_WM97XX_GPIO_DEFAULT; -module_param(atmel_gpio_line, int, 0); -MODULE_PARM_DESC(atmel_gpio_line, "GPIO line number connected to WM97xx"); - -struct atmel_wm97xx { - struct wm97xx *wm; - struct timer_list pen_timer; - void __iomem *regs; - unsigned long ac97c_irq; - unsigned long gpio_pen; - unsigned long gpio_irq; - unsigned short x; - unsigned short y; -}; - -static irqreturn_t atmel_wm97xx_channel_b_interrupt(int irq, void *dev_id) -{ - struct atmel_wm97xx *atmel_wm97xx = dev_id; - struct wm97xx *wm = atmel_wm97xx->wm; - int status = ac97c_readl(atmel_wm97xx, CBSR); - irqreturn_t retval = IRQ_NONE; - - if (status & AC97C_OVRUN) { - dev_dbg(&wm->touch_dev->dev, "AC97C overrun\n"); - ac97c_readl(atmel_wm97xx, CBRHR); - retval = IRQ_HANDLED; - } else if (status & AC97C_RXRDY) { - u16 data; - u16 value; - u16 source; - u16 pen_down; - - data = ac97c_readl(atmel_wm97xx, CBRHR); - value = data & 0x0fff; - source = data & WM97XX_ADCSEL_MASK; - pen_down = (data & WM97XX_PEN_DOWN) >> 8; - - if (source == WM97XX_ADCSEL_X) - atmel_wm97xx->x = value; - if (source == WM97XX_ADCSEL_Y) - atmel_wm97xx->y = value; - - if (!pressure && source == WM97XX_ADCSEL_Y) { - input_report_abs(wm->input_dev, ABS_X, atmel_wm97xx->x); - input_report_abs(wm->input_dev, ABS_Y, atmel_wm97xx->y); - input_report_key(wm->input_dev, BTN_TOUCH, pen_down); - input_sync(wm->input_dev); - } else if (pressure && source == WM97XX_ADCSEL_PRES) { - input_report_abs(wm->input_dev, ABS_X, atmel_wm97xx->x); - input_report_abs(wm->input_dev, ABS_Y, atmel_wm97xx->y); - input_report_abs(wm->input_dev, ABS_PRESSURE, value); - input_report_key(wm->input_dev, BTN_TOUCH, value); - input_sync(wm->input_dev); - } - - retval = IRQ_HANDLED; - } - - return retval; -} - -static void atmel_wm97xx_acc_pen_up(struct wm97xx *wm) -{ - struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(wm->touch_dev); - struct input_dev *input_dev = wm->input_dev; - int pen_down = gpio_get_value(atmel_wm97xx->gpio_pen); - - if (pen_down != 0) { - mod_timer(&atmel_wm97xx->pen_timer, - jiffies + msecs_to_jiffies(1)); - } else { - if (pressure) - input_report_abs(input_dev, ABS_PRESSURE, 0); - input_report_key(input_dev, BTN_TOUCH, 0); - input_sync(input_dev); - } -} - -static void atmel_wm97xx_pen_timer(struct timer_list *t) -{ - struct atmel_wm97xx *atmel_wm97xx = from_timer(atmel_wm97xx, t, - pen_timer); - - atmel_wm97xx_acc_pen_up(atmel_wm97xx->wm); -} - -static int atmel_wm97xx_acc_startup(struct wm97xx *wm) -{ - struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(wm->touch_dev); - int idx = 0; - - if (wm->ac97 == NULL) - return -ENODEV; - - for (idx = 0; idx < ARRAY_SIZE(cinfo); idx++) { - if (wm->id != cinfo[idx].id) - continue; - - sp_idx = idx; - - if (cont_rate <= cinfo[idx].speed) - break; - } - - wm->acc_rate = cinfo[sp_idx].code; - wm->acc_slot = ac97_touch_slot; - dev_info(&wm->touch_dev->dev, "atmel accelerated touchscreen driver, " - "%d samples/sec\n", cinfo[sp_idx].speed); - - if (pen_int) { - unsigned long reg; - - wm->pen_irq = atmel_wm97xx->gpio_irq; - - switch (wm->id) { - case WM9712_ID2: /* Fall through. */ - case WM9713_ID2: - /* - * Use GPIO 13 (PEN_DOWN) to assert GPIO line 3 - * (PENDOWN). - */ - wm97xx_config_gpio(wm, WM97XX_GPIO_13, WM97XX_GPIO_IN, - WM97XX_GPIO_POL_HIGH, - WM97XX_GPIO_STICKY, - WM97XX_GPIO_WAKE); - wm97xx_config_gpio(wm, WM97XX_GPIO_3, WM97XX_GPIO_OUT, - WM97XX_GPIO_POL_HIGH, - WM97XX_GPIO_NOTSTICKY, - WM97XX_GPIO_NOWAKE); - case WM9705_ID2: /* Fall through. */ - /* - * Enable touch data slot in AC97 controller channel B. - */ - reg = ac97c_readl(atmel_wm97xx, ICA); - reg &= ~AC97C_CH_MASK(wm->acc_slot); - reg |= AC97C_CH_ASSIGN(wm->acc_slot, B); - ac97c_writel(atmel_wm97xx, ICA, reg); - - /* - * Enable channel and interrupt for RXRDY and OVERRUN. - */ - ac97c_writel(atmel_wm97xx, CBMR, AC97C_CMR_CENA - | AC97C_CMR_CEM_BIG - | AC97C_CMR_SIZE_16 - | AC97C_OVRUN - | AC97C_RXRDY); - /* Dummy read to empty RXRHR. */ - ac97c_readl(atmel_wm97xx, CBRHR); - /* - * Enable interrupt for channel B in the AC97 - * controller. - */ - ac97c_writel(atmel_wm97xx, IER, AC97C_INT_CBEVT); - break; - default: - dev_err(&wm->touch_dev->dev, "pen down irq not " - "supported on this device\n"); - pen_int = 0; - break; - } - } - - return 0; -} - -static void atmel_wm97xx_acc_shutdown(struct wm97xx *wm) -{ - if (pen_int) { - struct atmel_wm97xx *atmel_wm97xx = - platform_get_drvdata(wm->touch_dev); - unsigned long ica; - - switch (wm->id & 0xffff) { - case WM9705_ID2: /* Fall through. */ - case WM9712_ID2: /* Fall through. */ - case WM9713_ID2: - /* Disable slot and turn off channel B interrupts. */ - ica = ac97c_readl(atmel_wm97xx, ICA); - ica &= ~AC97C_CH_MASK(wm->acc_slot); - ac97c_writel(atmel_wm97xx, ICA, ica); - ac97c_writel(atmel_wm97xx, IDR, AC97C_INT_CBEVT); - ac97c_writel(atmel_wm97xx, CBMR, 0); - wm->pen_irq = 0; - break; - default: - dev_err(&wm->touch_dev->dev, "unknown codec\n"); - break; - } - } -} - -static void atmel_wm97xx_irq_enable(struct wm97xx *wm, int enable) -{ - /* Intentionally left empty. */ -} - -static struct wm97xx_mach_ops atmel_mach_ops = { - .acc_enabled = 1, - .acc_pen_up = atmel_wm97xx_acc_pen_up, - .acc_startup = atmel_wm97xx_acc_startup, - .acc_shutdown = atmel_wm97xx_acc_shutdown, - .irq_enable = atmel_wm97xx_irq_enable, - .irq_gpio = WM97XX_GPIO_3, -}; - -static int __init atmel_wm97xx_probe(struct platform_device *pdev) -{ - struct wm97xx *wm = platform_get_drvdata(pdev); - struct atmel_wm97xx *atmel_wm97xx; - int ret; - - atmel_wm97xx = kzalloc(sizeof(struct atmel_wm97xx), GFP_KERNEL); - if (!atmel_wm97xx) - return -ENOMEM; - - atmel_wm97xx->wm = wm; - atmel_wm97xx->regs = (void *)ATMEL_WM97XX_AC97C_IOMEM; - atmel_wm97xx->ac97c_irq = ATMEL_WM97XX_AC97C_IRQ; - atmel_wm97xx->gpio_pen = atmel_gpio_line; - atmel_wm97xx->gpio_irq = gpio_to_irq(atmel_wm97xx->gpio_pen); - - timer_setup(&atmel_wm97xx->pen_timer, atmel_wm97xx_pen_timer, 0); - - ret = request_irq(atmel_wm97xx->ac97c_irq, - atmel_wm97xx_channel_b_interrupt, - IRQF_SHARED, "atmel-wm97xx-ch-b", atmel_wm97xx); - if (ret) { - dev_dbg(&pdev->dev, "could not request ac97c irq\n"); - goto err; - } - - platform_set_drvdata(pdev, atmel_wm97xx); - - ret = wm97xx_register_mach_ops(wm, &atmel_mach_ops); - if (ret) - goto err_irq; - - return ret; - -err_irq: - free_irq(atmel_wm97xx->ac97c_irq, atmel_wm97xx); -err: - kfree(atmel_wm97xx); - return ret; -} - -static int __exit atmel_wm97xx_remove(struct platform_device *pdev) -{ - struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(pdev); - struct wm97xx *wm = atmel_wm97xx->wm; - - ac97c_writel(atmel_wm97xx, IDR, AC97C_INT_CBEVT); - free_irq(atmel_wm97xx->ac97c_irq, atmel_wm97xx); - del_timer_sync(&atmel_wm97xx->pen_timer); - wm97xx_unregister_mach_ops(wm); - kfree(atmel_wm97xx); - - return 0; -} - -#ifdef CONFIG_PM_SLEEP -static int atmel_wm97xx_suspend(struct device *dev) -{ - struct platform_device *pdev = to_platform_device(dev); - struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(pdev); - - ac97c_writel(atmel_wm97xx, IDR, AC97C_INT_CBEVT); - disable_irq(atmel_wm97xx->gpio_irq); - del_timer_sync(&atmel_wm97xx->pen_timer); - - return 0; -} - -static int atmel_wm97xx_resume(struct device *dev) -{ - struct platform_device *pdev = to_platform_device(dev); - struct atmel_wm97xx *atmel_wm97xx = platform_get_drvdata(pdev); - struct wm97xx *wm = atmel_wm97xx->wm; - - if (wm->input_dev->users) { - enable_irq(atmel_wm97xx->gpio_irq); - ac97c_writel(atmel_wm97xx, IER, AC97C_INT_CBEVT); - } - - return 0; -} -#endif - -static SIMPLE_DEV_PM_OPS(atmel_wm97xx_pm_ops, - atmel_wm97xx_suspend, atmel_wm97xx_resume); - -static struct platform_driver atmel_wm97xx_driver = { - .remove = __exit_p(atmel_wm97xx_remove), - .driver = { - .name = "wm97xx-touch", - .pm = &atmel_wm97xx_pm_ops, - }, -}; - -module_platform_driver_probe(atmel_wm97xx_driver, atmel_wm97xx_probe); - -MODULE_AUTHOR("Hans-Christian Egtvedt <egtvedt@samfundet.no>"); -MODULE_DESCRIPTION("wm97xx continuous touch driver for Atmel AT91 and AVR32"); -MODULE_LICENSE("GPL"); diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c index 6592fc5d48b4..df8ca856393b 100644 --- a/drivers/input/touchscreen/auo-pixcir-ts.c +++ b/drivers/input/touchscreen/auo-pixcir-ts.c @@ -408,8 +408,6 @@ static void auo_pixcir_input_close(struct input_dev *dev) struct auo_pixcir_ts *ts = input_get_drvdata(dev); auo_pixcir_stop(ts); - - return; } static int __maybe_unused auo_pixcir_suspend(struct device *dev) @@ -487,10 +485,8 @@ static struct auo_pixcir_ts_platdata *auo_pixcir_parse_dt(struct device *dev) return ERR_PTR(-ENOENT); pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { - dev_err(dev, "failed to allocate platform data\n"); + if (!pdata) return ERR_PTR(-ENOMEM); - } pdata->gpio_int = of_get_gpio(np, 0); if (!gpio_is_valid(pdata->gpio_int)) { diff --git a/drivers/input/touchscreen/colibri-vf50-ts.c b/drivers/input/touchscreen/colibri-vf50-ts.c index 69c08acae264..82ca5ab65cec 100644 --- a/drivers/input/touchscreen/colibri-vf50-ts.c +++ b/drivers/input/touchscreen/colibri-vf50-ts.c @@ -28,7 +28,6 @@ #include <linux/types.h> #define DRIVER_NAME "colibri-vf50-ts" -#define DRV_VERSION "1.0" #define VF_ADC_MAX ((1 << 12) - 1) @@ -382,4 +381,3 @@ module_platform_driver(vf50_touch_driver); MODULE_AUTHOR("Sanchayan Maity"); MODULE_DESCRIPTION("Colibri VF50 Touchscreen driver"); MODULE_LICENSE("GPL"); -MODULE_VERSION(DRV_VERSION); diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c index 5a013bb7bcad..b5dfd5944cc3 100644 --- a/drivers/input/touchscreen/da9052_tsi.c +++ b/drivers/input/touchscreen/da9052_tsi.c @@ -26,7 +26,6 @@ struct da9052_tsi { struct da9052 *da9052; struct input_dev *dev; struct delayed_work ts_pen_work; - struct mutex mutex; bool stopped; bool adc_on; }; diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index c53a3d7239e7..1e18ca0d1b4e 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -511,6 +511,12 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata) int ret; int error; + if (tsdata->version != EDT_M06) { + dev_err(&client->dev, + "No factory mode support for non-M06 devices\n"); + return -EINVAL; + } + disable_irq(client->irq); if (!tsdata->raw_buffer) { @@ -524,9 +530,6 @@ static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata) } /* mode register is 0x3c when in the work mode */ - if (tsdata->version != EDT_M06) - goto m09_out; - error = edt_ft5x06_register_write(tsdata, WORK_REGISTER_OPMODE, 0x03); if (error) { dev_err(&client->dev, @@ -559,11 +562,6 @@ err_out: enable_irq(client->irq); return error; - -m09_out: - dev_err(&client->dev, "No factory mode support for M09/M12/GENERIC_FT\n"); - return -EINVAL; - } static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index a458e5ec9e41..bb8aac23e464 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -45,7 +45,6 @@ /* Device, Driver information */ #define DEVICE_NAME "elants_i2c" -#define DRV_VERSION "1.0.9" /* Convert from rows or columns into resolution */ #define ELAN_TS_RESOLUTION(n, m) (((n) - 1) * (m)) @@ -1406,5 +1405,4 @@ module_i2c_driver(elants_i2c_driver); MODULE_AUTHOR("Scott Liu <scott.liu@emc.com.tw>"); MODULE_DESCRIPTION("Elan I2c Touchscreen driver"); -MODULE_VERSION(DRV_VERSION); MODULE_LICENSE("GPL"); diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 69d0b8cbc71f..9736c83dd418 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -22,6 +22,7 @@ #include <linux/i2c.h> #include <linux/input.h> #include <linux/input/mt.h> +#include <linux/input/touchscreen.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/irq.h> @@ -43,11 +44,7 @@ struct goodix_ts_data { struct i2c_client *client; struct input_dev *input_dev; const struct goodix_chip_data *chip; - int abs_x_max; - int abs_y_max; - bool swapped_x_y; - bool inverted_x; - bool inverted_y; + struct touchscreen_properties prop; unsigned int max_touch_num; unsigned int int_trigger_type; struct gpio_desc *gpiod_int; @@ -160,7 +157,7 @@ static int goodix_i2c_read(struct i2c_client *client, u16 reg, u8 *buf, int len) { struct i2c_msg msgs[2]; - u16 wbuf = cpu_to_be16(reg); + __be16 wbuf = cpu_to_be16(reg); int ret; msgs[0].flags = 0; @@ -295,18 +292,10 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) int input_y = get_unaligned_le16(&coor_data[3]); int input_w = get_unaligned_le16(&coor_data[5]); - /* Inversions have to happen before axis swapping */ - if (ts->inverted_x) - input_x = ts->abs_x_max - input_x; - if (ts->inverted_y) - input_y = ts->abs_y_max - input_y; - if (ts->swapped_x_y) - swap(input_x, input_y); - input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); - input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); - input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, input_y); + touchscreen_report_pos(ts->input_dev, &ts->prop, + input_x, input_y, true); input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, input_w); input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w); } @@ -579,44 +568,27 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts) static void goodix_read_config(struct goodix_ts_data *ts) { u8 config[GOODIX_CONFIG_MAX_LENGTH]; + int x_max, y_max; int error; error = goodix_i2c_read(ts->client, ts->chip->config_addr, config, ts->chip->config_len); if (error) { - dev_warn(&ts->client->dev, - "Error reading config (%d), using defaults\n", + dev_warn(&ts->client->dev, "Error reading config: %d\n", error); - ts->abs_x_max = GOODIX_MAX_WIDTH; - ts->abs_y_max = GOODIX_MAX_HEIGHT; - if (ts->swapped_x_y) - swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = GOODIX_INT_TRIGGER; ts->max_touch_num = GOODIX_MAX_CONTACTS; return; } - ts->abs_x_max = get_unaligned_le16(&config[RESOLUTION_LOC]); - ts->abs_y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]); - if (ts->swapped_x_y) - swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; - if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { - dev_err(&ts->client->dev, - "Invalid config, using defaults\n"); - ts->abs_x_max = GOODIX_MAX_WIDTH; - ts->abs_y_max = GOODIX_MAX_HEIGHT; - if (ts->swapped_x_y) - swap(ts->abs_x_max, ts->abs_y_max); - ts->max_touch_num = GOODIX_MAX_CONTACTS; - } - if (dmi_check_system(rotated_screen)) { - ts->inverted_x = true; - ts->inverted_y = true; - dev_dbg(&ts->client->dev, - "Applying '180 degrees rotated screen' quirk\n"); + x_max = get_unaligned_le16(&config[RESOLUTION_LOC]); + y_max = get_unaligned_le16(&config[RESOLUTION_LOC + 2]); + if (x_max && y_max) { + input_abs_set_max(ts->input_dev, ABS_MT_POSITION_X, x_max - 1); + input_abs_set_max(ts->input_dev, ABS_MT_POSITION_Y, y_max - 1); } } @@ -676,32 +648,28 @@ static int goodix_i2c_test(struct i2c_client *client) } /** - * goodix_request_input_dev - Allocate, populate and register the input device + * goodix_configure_dev - Finish device initialization * * @ts: our goodix_ts_data pointer * - * Must be called during probe + * Must be called from probe to finish initialization of the device. + * Contains the common initialization code for both devices that + * declare gpio pins and devices that do not. It is either called + * directly from probe or from request_firmware_wait callback. */ -static int goodix_request_input_dev(struct goodix_ts_data *ts) +static int goodix_configure_dev(struct goodix_ts_data *ts) { int error; + ts->int_trigger_type = GOODIX_INT_TRIGGER; + ts->max_touch_num = GOODIX_MAX_CONTACTS; + ts->input_dev = devm_input_allocate_device(&ts->client->dev); if (!ts->input_dev) { dev_err(&ts->client->dev, "Failed to allocate input device."); return -ENOMEM; } - input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, - 0, ts->abs_x_max, 0, 0); - input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, - 0, ts->abs_y_max, 0, 0); - input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); - input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); - - input_mt_init_slots(ts->input_dev, ts->max_touch_num, - INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); - ts->input_dev->name = "Goodix Capacitive TouchScreen"; ts->input_dev->phys = "input/ts"; ts->input_dev->id.bustype = BUS_I2C; @@ -712,42 +680,49 @@ static int goodix_request_input_dev(struct goodix_ts_data *ts) /* Capacitive Windows/Home button on some devices */ input_set_capability(ts->input_dev, EV_KEY, KEY_LEFTMETA); - error = input_register_device(ts->input_dev); - if (error) { - dev_err(&ts->client->dev, - "Failed to register input device: %d", error); - return error; - } + input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_X); + input_set_capability(ts->input_dev, EV_ABS, ABS_MT_POSITION_Y); + input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0); + input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); - return 0; -} + /* Read configuration and apply touchscreen parameters */ + goodix_read_config(ts); -/** - * goodix_configure_dev - Finish device initialization - * - * @ts: our goodix_ts_data pointer - * - * Must be called from probe to finish initialization of the device. - * Contains the common initialization code for both devices that - * declare gpio pins and devices that do not. It is either called - * directly from probe or from request_firmware_wait callback. - */ -static int goodix_configure_dev(struct goodix_ts_data *ts) -{ - int error; + /* Try overriding touchscreen parameters via device properties */ + touchscreen_parse_properties(ts->input_dev, true, &ts->prop); - ts->swapped_x_y = device_property_read_bool(&ts->client->dev, - "touchscreen-swapped-x-y"); - ts->inverted_x = device_property_read_bool(&ts->client->dev, - "touchscreen-inverted-x"); - ts->inverted_y = device_property_read_bool(&ts->client->dev, - "touchscreen-inverted-y"); + if (!ts->prop.max_x || !ts->prop.max_y || !ts->max_touch_num) { + dev_err(&ts->client->dev, "Invalid config, using defaults\n"); + ts->prop.max_x = GOODIX_MAX_WIDTH - 1; + ts->prop.max_y = GOODIX_MAX_HEIGHT - 1; + ts->max_touch_num = GOODIX_MAX_CONTACTS; + input_abs_set_max(ts->input_dev, + ABS_MT_POSITION_X, ts->prop.max_x); + input_abs_set_max(ts->input_dev, + ABS_MT_POSITION_Y, ts->prop.max_y); + } - goodix_read_config(ts); + if (dmi_check_system(rotated_screen)) { + ts->prop.invert_x = true; + ts->prop.invert_y = true; + dev_dbg(&ts->client->dev, + "Applying '180 degrees rotated screen' quirk\n"); + } - error = goodix_request_input_dev(ts); - if (error) + error = input_mt_init_slots(ts->input_dev, ts->max_touch_num, + INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); + if (error) { + dev_err(&ts->client->dev, + "Failed to initialize MT slots: %d", error); return error; + } + + error = input_register_device(ts->input_dev);< |