Input updates for v7.0-rc0

- support for FocalTech FT8112 added to i2c-hid driver
 
 - support for FocalTech FT3518 added to edt-ft5x06 driver
 
 - support for power buttons in TWL603x chips added to twl4030-pwrbutton
   driver
 
 - an update to gpio-decoder driver to make it usable on non-OF
   platforms and to clean up the code
 
 - an update to synaptics_i2c driver switching it to use managed
   resources and a fix to restarting polling after resume
 
 - an update to gpio-keys driver to fall back to getting IRQ from
   resources if not specified using other means
 
 - an update to ili210x driver to support polling mode
 
 - a number of input drivers switched to scnprintf() to suppress
   truncation warnings
 
 - a number of updates and conversions of device tree bindings to yaml
   format
 
 - fixes to spelling in comments and messages in several drivers
 
 - other assorted fixups.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQST2eWILY88ieB2DOtAj56VGEWXnAUCaZDuRwAKCRBAj56VGEWX
 nMDgAQDru/JJP8OzAOzkBVBKv4gq2/Sgcd9gnIWdbLmOgk/vyQD9FkurIYZeiPOJ
 8F/q0bhQPh72TlWF5mmD9A8PB48BFgs=
 =0l6r
 -----END PGP SIGNATURE-----

Merge tag 'input-for-v7.0-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input updates from Dmitry Torokhov:

 - support for FocalTech FT8112 added to i2c-hid driver

 - support for FocalTech FT3518 added to edt-ft5x06 driver

 - support for power buttons in TWL603x chips added to twl4030-pwrbutton
   driver

 - an update to gpio-decoder driver to make it usable on non-OF
   platforms and to clean up the code

 - an update to synaptics_i2c driver switching it to use managed
   resources and a fix to restarting polling after resume

 - an update to gpio-keys driver to fall back to getting IRQ from
   resources if not specified using other means

 - an update to ili210x driver to support polling mode

 - a number of input drivers switched to scnprintf() to suppress
   truncation warnings

 - a number of updates and conversions of device tree bindings to yaml
   format

 - fixes to spelling in comments and messages in several drivers

 - other assorted fixups

* tag 'input-for-v7.0-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (57 commits)
  dt-bindings: input: qcom,pm8941-pwrkey: Document PMM8654AU
  dt-bindings: input: touchscreen: imagis: allow linux,keycodes for ist3038
  Input: apbps2 - fix comment style and typos
  Input: gpio_keys - fall back to platform_get_irq() for interrupt-only keys
  Input: novatek-nvt-ts - drop wake_type check
  dt-bindings: input: touchscreen: tsc2007: document '#io-channel-cells'
  Input: ili210x - add support for polling mode
  dt-bindings: touchscreen: trivial-touch: Drop 'interrupts' requirement for old Ilitek
  Input: appletouch - fix potential race between resume and open
  HID: i2c-hid: Add FocalTech FT8112
  dt-bindings: input: i2c-hid: Introduce FocalTech FT8112
  Input: synaptics_i2c - switch to using managed resources
  Input: synaptics_i2c - guard polling restart in resume
  Input: gpio_decoder - don't use "proxy" headers
  Input: gpio_decoder - make use of the macros from bits.h
  Input: gpio_decoder - replace custom loop by gpiod_get_array_value_cansleep()
  Input: gpio_decoder - unify messages with help of dev_err_probe()
  Input: gpio_decoder - make use of device properties
  Input: serio - complete sizeof(*pointer) conversions
  Input: wdt87xx_i2c - switch to use dev_err_probe()
  ...
This commit is contained in:
Linus Torvalds 2026-02-15 08:24:19 -08:00
commit 348e77b814
50 changed files with 516 additions and 510 deletions

View file

@ -1,17 +0,0 @@
Android Goldfish Events Keypad
Android goldfish events keypad device generated by android emulator.
Required properties:
- compatible : should contain "google,goldfish-events-keypad" to match emulator
- reg : <registers mapping>
- interrupts : <interrupt mapping>
Example:
goldfish-events@9040000 {
compatible = "google,goldfish-events-keypad";
reg = <0x9040000 0x1000>;
interrupts = <0x5>;
};

View file

@ -0,0 +1,66 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/input/focaltech,ft8112.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: FocalTech FT8112 touchscreen controller
maintainers:
- Daniel Peng <Daniel_Peng@pegatron.corp-partner.google.com>
description:
Supports the FocalTech FT8112 touchscreen controller.
This touchscreen controller uses the i2c-hid protocol with a reset GPIO.
allOf:
- $ref: /schemas/input/touchscreen/touchscreen.yaml#
properties:
compatible:
enum:
- focaltech,ft8112
reg:
maxItems: 1
interrupts:
maxItems: 1
panel: true
reset-gpios:
maxItems: 1
vcc33-supply: true
vccio-supply: true
required:
- compatible
- reg
- interrupts
- vcc33-supply
additionalProperties: false
examples:
- |
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
touchscreen@38 {
compatible = "focaltech,ft8112";
reg = <0x38>;
interrupt-parent = <&pio>;
interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
reset-gpios = <&pio 126 GPIO_ACTIVE_LOW>;
vcc33-supply = <&pp3300_tchscr_x>;
};
};

View file

@ -0,0 +1,41 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/input/google,goldfish-events-keypad.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Android Goldfish Events Keypad
maintainers:
- Kuan-Wei Chiu <visitorckw@gmail.com>
allOf:
- $ref: input.yaml#
description:
Android goldfish events keypad device generated by android emulator.
properties:
compatible:
const: google,goldfish-events-keypad
reg:
maxItems: 1
interrupts:
maxItems: 1
required:
- compatible
- reg
- interrupts
unevaluatedProperties: false
examples:
- |
keypad@9040000 {
compatible = "google,goldfish-events-keypad";
reg = <0x9040000 0x1000>;
interrupts = <5>;
};

View file

@ -12,11 +12,18 @@ maintainers:
properties:
compatible:
enum:
- qcom,pm8941-pwrkey
- qcom,pm8941-resin
- qcom,pmk8350-pwrkey
- qcom,pmk8350-resin
oneOf:
- enum:
- qcom,pm8941-pwrkey
- qcom,pm8941-resin
- qcom,pmk8350-pwrkey
- qcom,pmk8350-resin
- items:
- const: qcom,pmm8654au-pwrkey
- const: qcom,pmk8350-pwrkey
- items:
- const: qcom,pmm8654au-resin
- const: qcom,pmk8350-resin
interrupts:
maxItems: 1

View file

@ -39,6 +39,7 @@ properties:
- edt,edt-ft5406
- edt,edt-ft5506
- evervision,ev-ft5726
- focaltech,ft3518
- focaltech,ft5426
- focaltech,ft5452
- focaltech,ft6236

View file

@ -0,0 +1,51 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/input/touchscreen/ilitek,ili210x.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Ilitek ILI21xx/ILI251x V3/V6 touch screen controller with i2c interface
maintainers:
- Frank Li <Frank.Li@nxp.com>
- Marek Vasut <marek.vasut+renesas@mailbox.org>
properties:
compatible:
enum:
- ilitek,ili210x
- ilitek,ili2117
- ilitek,ili2120
- ilitek,ili251x
reg:
maxItems: 1
interrupts:
maxItems: 1
reset-gpios:
maxItems: 1
wakeup-source: true
required:
- compatible
- reg
allOf:
- $ref: touchscreen.yaml
unevaluatedProperties: false
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
touchscreen@41 {
compatible = "ilitek,ili2120";
reg = <0x41>;
};
};

View file

@ -55,7 +55,9 @@ allOf:
properties:
compatible:
contains:
const: imagis,ist3032c
enum:
- imagis,ist3032c
- imagis,ist3038
then:
properties:
linux,keycodes: false

View file

@ -14,9 +14,13 @@ allOf:
properties:
compatible:
enum:
- sitronix,st1232
- sitronix,st1633
oneOf:
- enum:
- sitronix,st1232
- sitronix,st1633
- items:
- const: sitronix,st1624
- const: sitronix,st1633
reg:
maxItems: 1

View file

@ -53,6 +53,9 @@ properties:
how much time to wait (in milliseconds) before reading again the
values from the tsc2007.
"#io-channel-cells":
const: 1
required:
- compatible
- reg

View file

@ -23,9 +23,6 @@ properties:
# Hynitron cstxxx series touchscreen controller
- hynitron,cst340
# Ilitek I2C Touchscreen Controller
- ilitek,ili210x
- ilitek,ili2117
- ilitek,ili2120
- ilitek,ili2130
- ilitek,ili2131
- ilitek,ili2132
@ -33,7 +30,6 @@ properties:
- ilitek,ili2322
- ilitek,ili2323
- ilitek,ili2326
- ilitek,ili251x
- ilitek,ili2520
- ilitek,ili2521
# MAXI MAX11801 Resistive touch screen controller with i2c interface

View file

@ -11404,7 +11404,7 @@ HIMAX HX83112B TOUCHSCREEN SUPPORT
M: Job Noorman <job@noorman.info>
L: linux-input@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/input/touchscreen/himax,hx83112b.yaml
F: Documentation/devicetree/bindings/input/touchscreen/trivial-touch.yaml
F: drivers/input/touchscreen/himax_hx83112b.c
HIMAX HX852X TOUCHSCREEN DRIVER

View file

@ -168,6 +168,13 @@ static const struct elan_i2c_hid_chip_data elan_ekth6a12nay_chip_data = {
.power_after_backlight = true,
};
static const struct elan_i2c_hid_chip_data focaltech_ft8112_chip_data = {
.post_power_delay_ms = 10,
.post_gpio_reset_on_delay_ms = 150,
.hid_descriptor_address = 0x0001,
.main_supply_name = "vcc33",
};
static const struct elan_i2c_hid_chip_data ilitek_ili9882t_chip_data = {
.post_power_delay_ms = 1,
.post_gpio_reset_on_delay_ms = 200,
@ -191,6 +198,7 @@ static const struct elan_i2c_hid_chip_data ilitek_ili2901_chip_data = {
static const struct of_device_id elan_i2c_hid_of_match[] = {
{ .compatible = "elan,ekth6915", .data = &elan_ekth6915_chip_data },
{ .compatible = "elan,ekth6a12nay", .data = &elan_ekth6a12nay_chip_data },
{ .compatible = "focaltech,ft8112", .data = &focaltech_ft8112_chip_data },
{ .compatible = "ilitek,ili9882t", .data = &ilitek_ili9882t_chip_data },
{ .compatible = "ilitek,ili2901", .data = &ilitek_ili2901_chip_data },
{ }

View file

@ -269,7 +269,8 @@ static int cros_ec_keyb_work(struct notifier_block *nb,
if (ckdev->ec->event_size != ckdev->cols) {
dev_err(ckdev->dev,
"Discarded incomplete key matrix event.\n");
"Discarded key matrix event, unexpected length: %d != %d\n",
ckdev->ec->event_size, ckdev->cols);
return NOTIFY_OK;
}

View file

@ -434,7 +434,7 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
ms_to_ktime(bdata->software_debounce),
HRTIMER_MODE_REL);
} else {
mod_delayed_work(system_wq,
mod_delayed_work(system_dfl_wq,
&bdata->work,
msecs_to_jiffies(bdata->software_debounce));
}
@ -616,12 +616,19 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
break;
}
} else {
if (!button->irq) {
dev_err(dev, "Found button without gpio or irq\n");
return -EINVAL;
}
if (button->irq) {
bdata->irq = button->irq;
} else {
irq = platform_get_irq_optional(pdev, idx);
if (irq < 0) {
error = irq;
return dev_err_probe(dev, error,
"Unable to determine IRQ# for button #%d",
idx);
}
bdata->irq = button->irq;
bdata->irq = irq;
}
if (button->type && button->type != EV_KEY) {
dev_err(dev, "Only EV_KEY allowed for IRQ buttons.\n");

View file

@ -193,7 +193,6 @@ static irqreturn_t omap4_keypad_irq_thread_fn(int irq, void *dev_id)
kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS,
kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS));
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
return IRQ_HANDLED;
@ -231,7 +230,6 @@ static int omap4_keypad_open(struct input_dev *input)
enable_irq(keypad_data->irq);
out:
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
return error;
@ -265,7 +263,6 @@ static void omap4_keypad_close(struct input_dev *input)
enable_irq(keypad_data->irq);
clk_disable_unprepare(keypad_data->fck);
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
}
@ -404,7 +401,6 @@ static int omap4_keypad_probe(struct platform_device *pdev)
omap4_keypad_stop(keypad_data);
}
pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
if (error)
return error;

View file

@ -308,7 +308,6 @@ err_free:
list_add(&effect->list, &vib->effect_head);
}
err_pm:
pm_runtime_mark_last_busy(vib->dev);
pm_runtime_put_autosuspend(vib->dev);
err_exit:
work_data->error = error;
@ -368,7 +367,6 @@ static void cs40l50_start_worker(struct work_struct *work)
dev_err(vib->dev, "Effect to play not found\n");
}
pm_runtime_mark_last_busy(vib->dev);
pm_runtime_put_autosuspend(vib->dev);
err_free:
kfree(work_data);
@ -384,7 +382,6 @@ static void cs40l50_stop_worker(struct work_struct *work)
vib->dsp.write(vib->dev, vib->regmap, vib->dsp.stop_cmd);
pm_runtime_mark_last_busy(vib->dev);
pm_runtime_put_autosuspend(vib->dev);
kfree(work_data);
@ -456,7 +453,6 @@ static void cs40l50_erase_worker(struct work_struct *work)
list_del(&erase_effect->list);
kfree(erase_effect);
err_pm:
pm_runtime_mark_last_busy(vib->dev);
pm_runtime_put_autosuspend(vib->dev);
err_exit:
work_data->error = error;

View file

@ -6,13 +6,18 @@
* encoded numeric value into an input event.
*/
#include <linux/device.h>
#include <linux/bitmap.h>
#include <linux/dev_printk.h>
#include <linux/device/devres.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/input.h>
#include <linux/kernel.h>
#include <linux/minmax.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/types.h>
struct gpio_decoder {
struct gpio_descs *input_gpios;
@ -24,23 +29,18 @@ struct gpio_decoder {
static int gpio_decoder_get_gpios_state(struct gpio_decoder *decoder)
{
struct gpio_descs *gpios = decoder->input_gpios;
unsigned int ret = 0;
int i, val;
DECLARE_BITMAP(values, 32);
unsigned int size;
int err;
for (i = 0; i < gpios->ndescs; i++) {
val = gpiod_get_value_cansleep(gpios->desc[i]);
if (val < 0) {
dev_err(decoder->dev,
"Error reading gpio %d: %d\n",
desc_to_gpio(gpios->desc[i]), val);
return val;
}
val = !!val;
ret = (ret << 1) | val;
size = min(gpios->ndescs, 32U);
err = gpiod_get_array_value_cansleep(size, gpios->desc, gpios->info, values);
if (err) {
dev_err(decoder->dev, "Error reading GPIO: %d\n", err);
return err;
}
return ret;
return bitmap_read(values, 0, size);
}
static void gpio_decoder_poll_gpios(struct input_dev *input)
@ -61,7 +61,7 @@ static int gpio_decoder_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct gpio_decoder *decoder;
struct input_dev *input;
u32 max;
u32 max;
int err;
decoder = devm_kzalloc(dev, sizeof(*decoder), GFP_KERNEL);
@ -72,18 +72,18 @@ static int gpio_decoder_probe(struct platform_device *pdev)
device_property_read_u32(dev, "linux,axis", &decoder->axis);
decoder->input_gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN);
if (IS_ERR(decoder->input_gpios)) {
dev_err(dev, "unable to acquire input gpios\n");
return PTR_ERR(decoder->input_gpios);
}
if (IS_ERR(decoder->input_gpios))
return dev_err_probe(dev, PTR_ERR(decoder->input_gpios),
"unable to acquire input gpios\n");
if (decoder->input_gpios->ndescs < 2) {
dev_err(dev, "not enough gpios found\n");
return -EINVAL;
}
if (decoder->input_gpios->ndescs < 2)
return dev_err_probe(dev, -EINVAL, "not enough gpios found\n");
if (decoder->input_gpios->ndescs > 31)
return dev_err_probe(dev, -EINVAL, "too many gpios found\n");
if (device_property_read_u32(dev, "decoder-max-value", &max))
max = (1U << decoder->input_gpios->ndescs) - 1;
max = BIT(decoder->input_gpios->ndescs) - 1;
input = devm_input_allocate_device(dev);
if (!input)
@ -96,33 +96,27 @@ static int gpio_decoder_probe(struct platform_device *pdev)
input_set_abs_params(input, decoder->axis, 0, max, 0, 0);
err = input_setup_polling(input, gpio_decoder_poll_gpios);
if (err) {
dev_err(dev, "failed to set up polling\n");
return err;
}
if (err)
return dev_err_probe(dev, err, "failed to set up polling\n");
err = input_register_device(input);
if (err) {
dev_err(dev, "failed to register input device\n");
return err;
}
if (err)
return dev_err_probe(dev, err, "failed to register input device\n");
return 0;
}
#ifdef CONFIG_OF
static const struct of_device_id gpio_decoder_of_match[] = {
{ .compatible = "gpio-decoder", },
{ },
{ }
};
MODULE_DEVICE_TABLE(of, gpio_decoder_of_match);
#endif
static struct platform_driver gpio_decoder_driver = {
.probe = gpio_decoder_probe,
.driver = {
.name = "gpio-decoder",
.of_match_table = of_match_ptr(gpio_decoder_of_match),
.of_match_table = gpio_decoder_of_match,
}
};
module_platform_driver(gpio_decoder_driver);

View file

@ -91,7 +91,7 @@ static irqreturn_t pwron_irq(int irq, void *palmas_pwron)
pm_wakeup_event(input_dev->dev.parent, 0);
input_sync(input_dev);
mod_delayed_work(system_wq, &pwron->input_work,
mod_delayed_work(system_dfl_wq, &pwron->input_work,
msecs_to_jiffies(PALMAS_PWR_KEY_Q_TIME_MS));
return IRQ_HANDLED;

View file

@ -173,7 +173,7 @@ static int pf1550_onkey_resume(struct device *dev)
return 0;
}
static SIMPLE_DEV_PM_OPS(pf1550_onkey_pm_ops, pf1550_onkey_suspend,
static DEFINE_SIMPLE_DEV_PM_OPS(pf1550_onkey_pm_ops, pf1550_onkey_suspend,
pf1550_onkey_resume);
static const struct platform_device_id pf1550_onkey_id[] = {

View file

@ -20,27 +20,43 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/bits.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/of.h>
#include <linux/mod_devicetable.h>
#include <linux/property.h>
#include <linux/platform_device.h>
#include <linux/mfd/twl.h>
#define PWR_PWRON_IRQ (1 << 0)
#define PWR_PWRON_IRQ BIT(0)
#define STS_HW_CONDITIONS 0xf
struct twl_pwrbutton_chipdata {
u8 status_reg;
bool need_manual_irq;
};
static const struct twl_pwrbutton_chipdata twl4030_chipdata = {
.status_reg = 0xf,
.need_manual_irq = false,
};
static const struct twl_pwrbutton_chipdata twl6030_chipdata = {
.status_reg = 0x2,
.need_manual_irq = true,
};
static irqreturn_t powerbutton_irq(int irq, void *_pwr)
{
struct input_dev *pwr = _pwr;
const struct twl_pwrbutton_chipdata *pdata = dev_get_drvdata(pwr->dev.parent);
int err;
u8 value;
err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, STS_HW_CONDITIONS);
err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, pdata->status_reg);
if (!err) {
pm_wakeup_event(pwr->dev.parent, 0);
input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
@ -55,10 +71,17 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
static int twl4030_pwrbutton_probe(struct platform_device *pdev)
{
const struct twl_pwrbutton_chipdata *pdata;
struct input_dev *pwr;
int irq = platform_get_irq(pdev, 0);
int err;
pdata = device_get_match_data(&pdev->dev);
if (!pdata)
return -EINVAL;
platform_set_drvdata(pdev, (void *)pdata);
pwr = devm_input_allocate_device(&pdev->dev);
if (!pwr) {
dev_err(&pdev->dev, "Can't allocate power button\n");
@ -85,24 +108,50 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev)
return err;
}
if (pdata->need_manual_irq) {
err = twl6030_interrupt_unmask(0x01, REG_INT_MSK_LINE_A);
if (err)
return err;
err = twl6030_interrupt_unmask(0x01, REG_INT_MSK_STS_A);
if (err)
return err;
}
device_init_wakeup(&pdev->dev, true);
return 0;
}
#ifdef CONFIG_OF
static void twl4030_pwrbutton_remove(struct platform_device *pdev)
{
const struct twl_pwrbutton_chipdata *pdata = platform_get_drvdata(pdev);
if (pdata->need_manual_irq) {
twl6030_interrupt_mask(0x01, REG_INT_MSK_LINE_A);
twl6030_interrupt_mask(0x01, REG_INT_MSK_STS_A);
}
}
static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = {
{ .compatible = "ti,twl4030-pwrbutton" },
{},
{
.compatible = "ti,twl4030-pwrbutton",
.data = &twl4030_chipdata,
},
{
.compatible = "ti,twl6030-pwrbutton",
.data = &twl6030_chipdata,
},
{ }
};
MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table);
#endif
static struct platform_driver twl4030_pwrbutton_driver = {
.probe = twl4030_pwrbutton_probe,
.remove = twl4030_pwrbutton_remove,
.driver = {
.name = "twl4030_pwrbutton",
.of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table),
.of_match_table = twl4030_pwrbutton_dt_match_table,
},
};
module_platform_driver(twl4030_pwrbutton_driver);

View file

@ -200,7 +200,6 @@ struct atp {
u8 *data; /* transferred data */
struct input_dev *input; /* input dev */
const struct atp_info *info; /* touchpad model */
bool open;
bool valid; /* are the samples valid? */
bool size_detect_done;
bool overflow_warned;
@ -800,7 +799,6 @@ static int atp_open(struct input_dev *input)
if (usb_submit_urb(dev->urb, GFP_KERNEL))
return -EIO;
dev->open = true;
return 0;
}
@ -810,7 +808,6 @@ static void atp_close(struct input_dev *input)
usb_kill_urb(dev->urb);
cancel_work_sync(&dev->work);
dev->open = false;
}
static int atp_handle_geyser(struct atp *dev)
@ -963,7 +960,8 @@ static int atp_recover(struct atp *dev)
if (error)
return error;
if (dev->open && usb_submit_urb(dev->urb, GFP_KERNEL))
guard(mutex)(&dev->input->mutex);
if (input_device_enabled(dev->input) && usb_submit_urb(dev->urb, GFP_KERNEL))
return -EIO;
return 0;
@ -981,7 +979,8 @@ static int atp_resume(struct usb_interface *iface)
{
struct atp *dev = usb_get_intfdata(iface);
if (dev->open && usb_submit_urb(dev->urb, GFP_KERNEL))
guard(mutex)(&dev->input->mutex);
if (input_device_enabled(dev->input) && usb_submit_urb(dev->urb, GFP_KERNEL))
return -EIO;
return 0;

View file

@ -314,10 +314,8 @@ static psmouse_ret_t byd_process_byte(struct psmouse *psmouse)
break;
}
default:
psmouse_warn(psmouse,
"Unrecognized Z: pkt = %02x %02x %02x %02x\n",
psmouse->packet[0], psmouse->packet[1],
psmouse->packet[2], psmouse->packet[3]);
psmouse_warn(psmouse, "Unrecognized Z: pkt = %*ph\n",
4, psmouse->packet);
return PSMOUSE_BAD_DATA;
}

View file

@ -403,7 +403,6 @@ static int cyapa_open(struct input_dev *input)
}
pm_runtime_get_sync(dev);
pm_runtime_mark_last_busy(dev);
pm_runtime_put_sync_autosuspend(dev);
out:
mutex_unlock(&cyapa->state_sync_lock);
@ -666,7 +665,6 @@ out:
pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
pm_runtime_mark_last_busy(dev);
pm_runtime_put_sync_autosuspend(dev);
}
@ -710,7 +708,6 @@ static irqreturn_t cyapa_irq(int irq, void *dev_id)
* process.
*/
pm_runtime_get_sync(dev);
pm_runtime_mark_last_busy(dev);
pm_runtime_put_sync_autosuspend(dev);
}

View file

@ -2833,7 +2833,6 @@ static int cyapa_pip_event_process(struct cyapa *cyapa,
* process.
*/
pm_runtime_get_sync(dev);
pm_runtime_mark_last_busy(dev);
pm_runtime_put_sync_autosuspend(dev);
return 0;
} else if (report_id != PIP_TOUCH_REPORT_ID &&

View file

@ -299,7 +299,7 @@ int __init psmouse_smbus_module_init(void)
{
int error;
psmouse_smbus_wq = alloc_workqueue("psmouse-smbus", 0, 0);
psmouse_smbus_wq = alloc_workqueue("psmouse-smbus", WQ_UNBOUND, 0);
if (!psmouse_smbus_wq)
return -ENOMEM;

View file

@ -240,52 +240,57 @@ static inline void set_scan_rate(struct synaptics_i2c *touch, int scan_rate)
*/
static s32 synaptics_i2c_reg_get(struct i2c_client *client, u16 reg)
{
int ret;
int error;
ret = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8);
if (ret == 0)
ret = i2c_smbus_read_byte_data(client, reg & 0xff);
error = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8);
if (error)
return error;
return ret;
return i2c_smbus_read_byte_data(client, reg & 0xff);
}
static s32 synaptics_i2c_reg_set(struct i2c_client *client, u16 reg, u8 val)
{
int ret;
int error;
ret = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8);
if (ret == 0)
ret = i2c_smbus_write_byte_data(client, reg & 0xff, val);
error = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8);
if (error)
return error;
return ret;
error = i2c_smbus_write_byte_data(client, reg & 0xff, val);
if (error)
return error;
return error;
}
static s32 synaptics_i2c_word_get(struct i2c_client *client, u16 reg)
{
int ret;
int error;
ret = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8);
if (ret == 0)
ret = i2c_smbus_read_word_data(client, reg & 0xff);
error = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8);
if (error)
return error;
return ret;
return i2c_smbus_read_word_data(client, reg & 0xff);
}
static int synaptics_i2c_config(struct i2c_client *client)
{
int ret, control;
int control;
int error;
u8 int_en;
/* set Report Rate to Device Highest (>=80) and Sleep to normal */
ret = synaptics_i2c_reg_set(client, DEV_CONTROL_REG, 0xc1);
if (ret)
return ret;
error = synaptics_i2c_reg_set(client, DEV_CONTROL_REG, 0xc1);
if (error)
return error;
/* set Interrupt Disable to Func20 / Enable to Func10) */
int_en = (polling_req) ? 0 : INT_ENA_ABS_MSK | INT_ENA_REL_MSK;
ret = synaptics_i2c_reg_set(client, INTERRUPT_EN_REG, int_en);
if (ret)
return ret;
error = synaptics_i2c_reg_set(client, INTERRUPT_EN_REG, int_en);
if (error)
return error;
control = synaptics_i2c_reg_get(client, GENERAL_2D_CONTROL_REG);
/* No Deceleration */
@ -294,42 +299,49 @@ static int synaptics_i2c_config(struct i2c_client *client)
control |= reduce_report ? 1 << REDUCE_REPORTING : 0;
/* No Filter */
control |= no_filter ? 1 << NO_FILTER : 0;
ret = synaptics_i2c_reg_set(client, GENERAL_2D_CONTROL_REG, control);
if (ret)
return ret;
error = synaptics_i2c_reg_set(client, GENERAL_2D_CONTROL_REG, control);
if (error)
return error;
return 0;
}
static int synaptics_i2c_reset_config(struct i2c_client *client)
{
int ret;
int error;
/* Reset the Touchpad */
ret = synaptics_i2c_reg_set(client, DEV_COMMAND_REG, RESET_COMMAND);
if (ret) {
error = synaptics_i2c_reg_set(client, DEV_COMMAND_REG, RESET_COMMAND);
if (error) {
dev_err(&client->dev, "Unable to reset device\n");
} else {
usleep_range(SOFT_RESET_DELAY_US, SOFT_RESET_DELAY_US + 100);
ret = synaptics_i2c_config(client);
if (ret)
dev_err(&client->dev, "Unable to config device\n");
return error;
}
return ret;
usleep_range(SOFT_RESET_DELAY_US, SOFT_RESET_DELAY_US + 100);
error = synaptics_i2c_config(client);
if (error) {
dev_err(&client->dev, "Unable to config device\n");
return error;
}
return 0;
}
static int synaptics_i2c_check_error(struct i2c_client *client)
{
int status, ret = 0;
int status;
int error;
status = i2c_smbus_read_byte_data(client, DEVICE_STATUS_REG) &
(CONFIGURED_MSK | ERROR_MSK);
if (status != CONFIGURED_MSK)
ret = synaptics_i2c_reset_config(client);
if (status != CONFIGURED_MSK) {
error = synaptics_i2c_reset_config(client);
if (error)
return error;
}
return ret;
return 0;
}
static bool synaptics_i2c_get_input(struct synaptics_i2c *touch)
@ -372,7 +384,7 @@ static irqreturn_t synaptics_i2c_irq(int irq, void *dev_id)
{
struct synaptics_i2c *touch = dev_id;
mod_delayed_work(system_wq, &touch->dwork, 0);
mod_delayed_work(system_dfl_wq, &touch->dwork, 0);
return IRQ_HANDLED;
}
@ -421,10 +433,10 @@ static unsigned long synaptics_i2c_adjust_delay(struct synaptics_i2c *touch,
delay = NO_DATA_SLEEP_MSECS;
}
return msecs_to_jiffies(delay);
} else {
delay = msecs_to_jiffies(THREAD_IRQ_SLEEP_MSECS);
return round_jiffies_relative(delay);
}
delay = msecs_to_jiffies(THREAD_IRQ_SLEEP_MSECS);
return round_jiffies_relative(delay);
}
/* Work Handler */
@ -448,21 +460,21 @@ static void synaptics_i2c_work_handler(struct work_struct *work)
* We poll the device once in THREAD_IRQ_SLEEP_SECS and
* if error is detected, we try to reset and reconfigure the touchpad.
*/
mod_delayed_work(system_wq, &touch->dwork, delay);
mod_delayed_work(system_dfl_wq, &touch->dwork, delay);
}
static int synaptics_i2c_open(struct input_dev *input)
{
struct synaptics_i2c *touch = input_get_drvdata(input);
int ret;
int error;
ret = synaptics_i2c_reset_config(touch->client);
if (ret)
return ret;
error = synaptics_i2c_reset_config(touch->client);
if (error)
return error;
if (polling_req)
mod_delayed_work(system_wq, &touch->dwork,
msecs_to_jiffies(NO_DATA_SLEEP_MSECS));
mod_delayed_work(system_dfl_wq, &touch->dwork,
msecs_to_jiffies(NO_DATA_SLEEP_MSECS));
return 0;
}
@ -489,28 +501,27 @@ static void synaptics_i2c_set_input_params(struct synaptics_i2c *touch)
input->id.bustype = BUS_I2C;
input->id.version = synaptics_i2c_word_get(touch->client,
INFO_QUERY_REG0);
input->dev.parent = &touch->client->dev;
input->open = synaptics_i2c_open;
input->close = synaptics_i2c_close;
input_set_drvdata(input, touch);
/* Register the device as mouse */
__set_bit(EV_REL, input->evbit);
__set_bit(REL_X, input->relbit);
__set_bit(REL_Y, input->relbit);
input_set_capability(input, EV_REL, REL_X);
input_set_capability(input, EV_REL, REL_Y);
/* Register device's buttons and keys */
__set_bit(EV_KEY, input->evbit);
__set_bit(BTN_LEFT, input->keybit);
input_set_capability(input, EV_KEY, BTN_LEFT);
}
static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *client)
static int synaptics_i2c_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct synaptics_i2c *touch;
int error;
touch = kzalloc(sizeof(*touch), GFP_KERNEL);
touch = devm_kzalloc(dev, sizeof(*touch), GFP_KERNEL);
if (!touch)
return NULL;
return -ENOMEM;
touch->client = client;
touch->no_decel_param = no_decel;
@ -518,83 +529,46 @@ static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *clien
set_scan_rate(touch, scan_rate);
INIT_DELAYED_WORK(&touch->dwork, synaptics_i2c_work_handler);
return touch;
}
error = synaptics_i2c_reset_config(client);
if (error)
return error;
static int synaptics_i2c_probe(struct i2c_client *client)
{
int ret;
struct synaptics_i2c *touch;
touch = synaptics_i2c_touch_create(client);
if (!touch)
return -ENOMEM;
ret = synaptics_i2c_reset_config(client);
if (ret)
goto err_mem_free;
if (client->irq < 1)
if (client->irq <= 0)
polling_req = true;
touch->input = input_allocate_device();
if (!touch->input) {
ret = -ENOMEM;
goto err_mem_free;
}
touch->input = devm_input_allocate_device(dev);
if (!touch->input)
return -ENOMEM;
synaptics_i2c_set_input_params(touch);
if (!polling_req) {
dev_dbg(&touch->client->dev,
"Requesting IRQ: %d\n", touch->client->irq);
dev_dbg(dev, "Requesting IRQ: %d\n", client->irq);
ret = request_irq(touch->client->irq, synaptics_i2c_irq,
IRQ_TYPE_EDGE_FALLING,
DRIVER_NAME, touch);
if (ret) {
dev_warn(&touch->client->dev,
"IRQ request failed: %d, "
"falling back to polling\n", ret);
error = devm_request_irq(dev, client->irq, synaptics_i2c_irq,
IRQ_TYPE_EDGE_FALLING,
DRIVER_NAME, touch);
if (error) {
dev_warn(dev, "IRQ request failed: %d, falling back to polling\n",
error);
polling_req = true;
synaptics_i2c_reg_set(touch->client,
INTERRUPT_EN_REG, 0);
synaptics_i2c_reg_set(client, INTERRUPT_EN_REG, 0);
}
}
if (polling_req)
dev_dbg(&touch->client->dev,
"Using polling at rate: %d times/sec\n", scan_rate);
dev_dbg(dev, "Using polling at rate: %d times/sec\n", scan_rate);
/* Register the device in input subsystem */
ret = input_register_device(touch->input);
if (ret) {
dev_err(&client->dev,
"Input device register failed: %d\n", ret);
goto err_input_free;
error = input_register_device(touch->input);
if (error) {
dev_err(dev, "Input device register failed: %d\n", error);
return error;
}
i2c_set_clientdata(client, touch);
return 0;
err_input_free:
input_free_device(touch->input);
err_mem_free:
kfree(touch);
return ret;
}
static void synaptics_i2c_remove(struct i2c_client *client)
{
struct synaptics_i2c *touch = i2c_get_clientdata(client);
if (!polling_req)
free_irq(client->irq, touch);
input_unregister_device(touch->input);
kfree(touch);
}
static int synaptics_i2c_suspend(struct device *dev)
@ -612,16 +586,19 @@ static int synaptics_i2c_suspend(struct device *dev)
static int synaptics_i2c_resume(struct device *dev)
{
int ret;
struct i2c_client *client = to_i2c_client(dev);
struct synaptics_i2c *touch = i2c_get_clientdata(client);
struct input_dev *input = touch->input;
int error;
ret = synaptics_i2c_reset_config(client);
if (ret)
return ret;
error = synaptics_i2c_reset_config(client);
if (error)
return error;
mod_delayed_work(system_wq, &touch->dwork,
msecs_to_jiffies(NO_DATA_SLEEP_MSECS));
guard(mutex)(&input->mutex);
if (input_device_enabled(input))
mod_delayed_work(system_dfl_wq, &touch->dwork,
msecs_to_jiffies(NO_DATA_SLEEP_MSECS));
return 0;
}
@ -651,8 +628,6 @@ static struct i2c_driver synaptics_i2c_driver = {
},
.probe = synaptics_i2c_probe,
.remove = synaptics_i2c_remove,
.id_table = synaptics_i2c_id_table,
};

View file

@ -81,7 +81,7 @@ static int altera_ps2_probe(struct platform_device *pdev)
struct serio *serio;
int error, irq;
ps2if = devm_kzalloc(&pdev->dev, sizeof(struct ps2if), GFP_KERNEL);
ps2if = devm_kzalloc(&pdev->dev, sizeof(*ps2if), GFP_KERNEL);
if (!ps2if)
return -ENOMEM;

View file

@ -67,7 +67,7 @@ static irqreturn_t apbps2_isr(int irq, void *dev_id)
rxflags = (status & APBPS2_STATUS_PE) ? SERIO_PARITY : 0;
rxflags |= (status & APBPS2_STATUS_FE) ? SERIO_FRAME : 0;
/* clear error bits? */
/* Clear error bits */
if (rxflags)
iowrite32be(0, &priv->regs->status);
@ -82,9 +82,9 @@ static irqreturn_t apbps2_isr(int irq, void *dev_id)
static int apbps2_write(struct serio *io, unsigned char val)
{
struct apbps2_priv *priv = io->port_data;
unsigned int tleft = 10000; /* timeout in 100ms */
unsigned int tleft = 10000; /* Timeout in 100ms */
/* delay until PS/2 controller has room for more chars */
/* Delay until PS/2 controller has room for more chars */
while ((ioread32be(&priv->regs->status) & APBPS2_STATUS_TF) && tleft--)
udelay(10);
@ -104,7 +104,7 @@ static int apbps2_open(struct serio *io)
struct apbps2_priv *priv = io->port_data;
int limit;
/* clear error flags */
/* Clear error flags */
iowrite32be(0, &priv->regs->status);
/* Clear old data if available (unlikely) */
@ -112,7 +112,7 @@ static int apbps2_open(struct serio *io)
while ((ioread32be(&priv->regs->status) & APBPS2_STATUS_DR) && --limit)
ioread32be(&priv->regs->data);
/* Enable reciever and it's interrupt */
/* Enable receiver and its interrupt */
iowrite32be(APBPS2_CTRL_RE | APBPS2_CTRL_RI, &priv->regs->ctrl);
return 0;
@ -122,7 +122,7 @@ static void apbps2_close(struct serio *io)
{
struct apbps2_priv *priv = io->port_data;
/* stop interrupts at PS/2 HW level */
/* Stop interrupts at PS/2 HW level */
iowrite32be(0, &priv->regs->ctrl);
}
@ -139,7 +139,7 @@ static int apbps2_of_probe(struct platform_device *ofdev)
return -ENOMEM;
}
/* Find Device Address */
/* Find device address */
priv->regs = devm_platform_get_and_ioremap_resource(ofdev, 0, NULL);
if (IS_ERR(priv->regs))
return PTR_ERR(priv->regs);

View file

@ -189,8 +189,7 @@ static int arc_ps2_probe(struct platform_device *pdev)
if (irq < 0)
return -EINVAL;
arc_ps2 = devm_kzalloc(&pdev->dev, sizeof(struct arc_ps2_data),
GFP_KERNEL);
arc_ps2 = devm_kzalloc(&pdev->dev, sizeof(*arc_ps2), GFP_KERNEL);
if (!arc_ps2) {
dev_err(&pdev->dev, "out of memory\n");
return -ENOMEM;

View file

@ -171,7 +171,7 @@ static int olpc_apsp_probe(struct platform_device *pdev)
struct olpc_apsp *priv;
int error;
priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL);
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;

View file

@ -119,8 +119,8 @@ static int dynapro_connect(struct serio *serio, struct serio_driver *drv)
pdynapro->serio = serio;
pdynapro->dev = input_dev;
snprintf(pdynapro->phys, sizeof(pdynapro->phys),
"%s/input0", serio->phys);
scnprintf(pdynapro->phys, sizeof(pdynapro->phys),
"%s/input0", serio->phys);
input_dev->name = "Dynapro Serial TouchScreen";
input_dev->phys = pdynapro->phys;

View file

@ -1475,6 +1475,10 @@ static const struct edt_i2c_chip_data edt_ft5x06_data = {
.max_support_points = 5,
};
static const struct edt_i2c_chip_data edt_ft3518_data = {
.max_support_points = 10,
};
static const struct edt_i2c_chip_data edt_ft5452_data = {
.max_support_points = 5,
};
@ -1503,6 +1507,7 @@ static const struct i2c_device_id edt_ft5x06_ts_id[] = {
{ .name = "edt-ft5x06", .driver_data = (long)&edt_ft5x06_data },
{ .name = "edt-ft5506", .driver_data = (long)&edt_ft5506_data },
{ .name = "ev-ft5726", .driver_data = (long)&edt_ft5506_data },
{ .name = "ft3518", .driver_data = (long)&edt_ft3518_data },
{ .name = "ft5452", .driver_data = (long)&edt_ft5452_data },
/* Note no edt- prefix for compatibility with the ft6236.c driver */
{ .name = "ft6236", .driver_data = (long)&edt_ft6236_data },
@ -1519,6 +1524,7 @@ static const struct of_device_id edt_ft5x06_of_match[] = {
{ .compatible = "edt,edt-ft5406", .data = &edt_ft5x06_data },
{ .compatible = "edt,edt-ft5506", .data = &edt_ft5506_data },
{ .compatible = "evervision,ev-ft5726", .data = &edt_ft5506_data },
{ .compatible = "focaltech,ft3518", .data = &edt_ft3518_data },
{ .compatible = "focaltech,ft5426", .data = &edt_ft5506_data },
{ .compatible = "focaltech,ft5452", .data = &edt_ft5452_data },
/* Note focaltech vendor prefix for compatibility with ft6236.c */

View file

@ -108,8 +108,7 @@ static int egalax_connect(struct serio *serio, struct serio_driver *drv)
egalax->serio = serio;
egalax->input = input_dev;
snprintf(egalax->phys, sizeof(egalax->phys),
"%s/input0", serio->phys);
scnprintf(egalax->phys, sizeof(egalax->phys), "%s/input0", serio->phys);
input_dev->name = "EETI eGalaxTouch Serial TouchScreen";
input_dev->phys = egalax->phys;

View file

@ -320,7 +320,7 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
elo->expected_packet = ELO10_TOUCH_PACKET;
mutex_init(&elo->cmd_mutex);
init_completion(&elo->cmd_done);
snprintf(elo->phys, sizeof(elo->phys), "%s/input0", serio->phys);
scnprintf(elo->phys, sizeof(elo->phys), "%s/input0", serio->phys);
input_dev->name = "Elo Serial TouchScreen";
input_dev->phys = elo->phys;

View file

@ -108,8 +108,7 @@ static int fujitsu_connect(struct serio *serio, struct serio_driver *drv)
fujitsu->serio = serio;
fujitsu->dev = input_dev;
snprintf(fujitsu->phys, sizeof(fujitsu->phys),
"%s/input0", serio->phys);
scnprintf(fujitsu->phys, sizeof(fujitsu->phys), "%s/input0", serio->phys);
input_dev->name = "Fujitsu Serial Touchscreen";
input_dev->phys = fujitsu->phys;

View file

@ -106,7 +106,7 @@ static int gunze_connect(struct serio *serio, struct serio_driver *drv)
gunze->serio = serio;
gunze->dev = input_dev;
snprintf(gunze->phys, sizeof(serio->phys), "%s/input0", serio->phys);
scnprintf(gunze->phys, sizeof(serio->phys), "%s/input0", serio->phys);
input_dev->name = "Gunze AHL-51S TouchScreen";
input_dev->phys = gunze->phys;

View file

@ -118,8 +118,8 @@ static int hampshire_connect(struct serio *serio, struct serio_driver *drv)
phampshire->serio = serio;
phampshire->dev = input_dev;
snprintf(phampshire->phys, sizeof(phampshire->phys),
"%s/input0", serio->phys);
scnprintf(phampshire->phys, sizeof(phampshire->phys),
"%s/input0", serio->phys);
input_dev->name = "Hampshire Serial TouchScreen";
input_dev->phys = phampshire->phys;

View file

@ -327,9 +327,8 @@ static bool ili210x_report_events(struct ili210x *priv, u8 *touchdata)
return contact;
}
static irqreturn_t ili210x_irq(int irq, void *irq_data)
static void ili210x_process_events(struct ili210x *priv)
{
struct ili210x *priv = irq_data;
struct i2c_client *client = priv->client;
const struct ili2xxx_chip *chip = priv->chip;
u8 touchdata[ILI210X_DATA_SIZE] = { 0 };
@ -356,8 +355,22 @@ static irqreturn_t ili210x_irq(int irq, void *irq_data)
usleep_range(time_delta, time_delta + 1000);
}
} while (!priv->stop && keep_polling);
}
static irqreturn_t ili210x_irq(int irq, void *irq_data)
{
struct ili210x *priv = irq_data;
ili210x_process_events(priv);
return IRQ_HANDLED;
};
static void ili210x_work_i2c_poll(struct input_dev *input)
{
struct ili210x *priv = input_get_drvdata(input);
ili210x_process_events(priv);
}
static int ili251x_firmware_update_resolution(struct device *dev)
@ -829,12 +842,32 @@ static int ili210x_do_firmware_update(struct ili210x *priv,
return 0;
}
static ssize_t ili210x_firmware_update(struct device *dev, const u8 *fwbuf,
u16 ac_end, u16 df_end)
{
struct i2c_client *client = to_i2c_client(dev);
struct ili210x *priv = i2c_get_clientdata(client);
const char *fwname = ILI251X_FW_FILENAME;
int error;
dev_dbg(dev, "Firmware update started, firmware=%s\n", fwname);
ili210x_hardware_reset(priv->reset_gpio);
error = ili210x_do_firmware_update(priv, fwbuf, ac_end, df_end);
ili210x_hardware_reset(priv->reset_gpio);
dev_dbg(dev, "Firmware update ended, error=%i\n", error);
return error;
}
static ssize_t ili210x_firmware_update_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
struct ili210x *priv = i2c_get_clientdata(client);
const char *fwname = ILI251X_FW_FILENAME;
u16 ac_end, df_end;
int error;
@ -860,16 +893,11 @@ static ssize_t ili210x_firmware_update_store(struct device *dev,
* the touch controller to disable the IRQs during update, so we have
* to do it this way here.
*/
scoped_guard(disable_irq, &client->irq) {
dev_dbg(dev, "Firmware update started, firmware=%s\n", fwname);
ili210x_hardware_reset(priv->reset_gpio);
error = ili210x_do_firmware_update(priv, fwbuf, ac_end, df_end);
ili210x_hardware_reset(priv->reset_gpio);
dev_dbg(dev, "Firmware update ended, error=%i\n", error);
if (client->irq > 0) {
guard(disable_irq)(&client->irq);
error = ili210x_firmware_update(dev, fwbuf, ac_end, df_end);
} else {
error = ili210x_firmware_update(dev, fwbuf, ac_end, df_end);
}
return error ?: count;
@ -942,15 +970,8 @@ static int ili210x_i2c_probe(struct i2c_client *client)
chip = device_get_match_data(dev);
if (!chip && id)
chip = (const struct ili2xxx_chip *)id->driver_data;
if (!chip) {
dev_err(&client->dev, "unknown device model\n");
return -ENODEV;
}
if (client->irq <= 0) {
dev_err(dev, "No IRQ!\n");
return -EINVAL;
}
if (!chip)
return dev_err_probe(&client->dev, -ENODEV, "unknown device model\n");
reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(reset_gpio))
@ -998,17 +1019,22 @@ static int ili210x_i2c_probe(struct i2c_client *client)
error = input_mt_init_slots(input, priv->chip->max_touches,
INPUT_MT_DIRECT);
if (error) {
dev_err(dev, "Unable to set up slots, err: %d\n", error);
return error;
}
if (error)
return dev_err_probe(dev, error, "Unable to set up slots\n");
error = devm_request_threaded_irq(dev, client->irq, NULL, ili210x_irq,
IRQF_ONESHOT, client->name, priv);
if (error) {
dev_err(dev, "Unable to request touchscreen IRQ, err: %d\n",
error);
return error;
input_set_drvdata(input, priv);
if (client->irq > 0) {
error = devm_request_threaded_irq(dev, client->irq, NULL, ili210x_irq,
IRQF_ONESHOT, client->name, priv);
if (error)
return dev_err_probe(dev, error, "Unable to request touchscreen IRQ\n");
} else {
error = input_setup_polling(input, ili210x_work_i2c_poll);
if (error)
return dev_err_probe(dev, error, "Could not set up polling mode\n");
input_set_poll_interval(input, ILI2XXX_POLL_PERIOD);
}
error = devm_add_action_or_reset(dev, ili210x_stop, priv);
@ -1016,10 +1042,8 @@ static int ili210x_i2c_probe(struct i2c_client *client)
return error;
error = input_register_device(priv->input);
if (error) {
dev_err(dev, "Cannot register input device, err: %d\n", error);
return error;
}
if (error)
return dev_err_probe(dev, error, "Cannot register input device\n");
return 0;
}

View file

@ -122,7 +122,7 @@ static int ilitek_i2c_write_and_read(struct ilitek_ts_data *ts,
return error;
}
if (delay > 0)
mdelay(delay);
fsleep(delay * 1000);
if (read_len > 0) {
error = i2c_transfer(client->adapter, msgs + 1, 1);
@ -396,10 +396,10 @@ static const struct ilitek_protocol_map ptl_func_map[] = {
static void ilitek_reset(struct ilitek_ts_data *ts, int delay)
{
if (ts->reset_gpio) {
gpiod_set_value(ts->reset_gpio, 1);
mdelay(10);
gpiod_set_value(ts->reset_gpio, 0);
mdelay(delay);
gpiod_set_value_cansleep(ts->reset_gpio, 1);
fsleep(10000);
gpiod_set_value_cansleep(ts->reset_gpio, 0);
fsleep(delay * 1000);
}
}

View file

@ -123,7 +123,7 @@ static int inexio_connect(struct serio *serio, struct serio_driver *drv)
pinexio->serio = serio;
pinexio->dev = input_dev;
snprintf(pinexio->phys, sizeof(pinexio->phys), "%s/input0", serio->phys);
scnprintf(pinexio->phys, sizeof(pinexio->phys), "%s/input0", serio->phys);
input_dev->name = "iNexio Serial TouchScreen";
input_dev->phys = pinexio->phys;

View file

@ -137,7 +137,7 @@ static int mtouch_connect(struct serio *serio, struct serio_driver *drv)
mtouch->serio = serio;
mtouch->dev = input_dev;
snprintf(mtouch->phys, sizeof(mtouch->phys), "%s/input0", serio->phys);
scnprintf(mtouch->phys, sizeof(mtouch->phys), "%s/input0", serio->phys);
input_dev->name = "MicroTouch Serial TouchScreen";
input_dev->phys = mtouch->phys;

View file

@ -27,7 +27,6 @@
#define NVT_TS_PARAMS_MAX_TOUCH 0x09
#define NVT_TS_PARAMS_MAX_BUTTONS 0x0a
#define NVT_TS_PARAMS_IRQ_TYPE 0x0b
#define NVT_TS_PARAMS_WAKE_TYPE 0x0c
#define NVT_TS_PARAMS_CHIP_ID 0x0e
#define NVT_TS_PARAMS_SIZE 0x0f
@ -49,7 +48,6 @@ static const int nvt_ts_irq_type[4] = {
};
struct nvt_ts_i2c_chip_data {
u8 wake_type;
u8 chip_id;
};
@ -261,7 +259,6 @@ static int nvt_ts_probe(struct i2c_client *client)
if (width > NVT_TS_MAX_SIZE || height >= NVT_TS_MAX_SIZE ||
data->max_touches > NVT_TS_MAX_TOUCHES ||
irq_type >= ARRAY_SIZE(nvt_ts_irq_type) ||
data->buf[NVT_TS_PARAMS_WAKE_TYPE] != chip->wake_type ||
data->buf[NVT_TS_PARAMS_CHIP_ID] != chip->chip_id) {
dev_err(dev, "Unsupported touchscreen parameters: %*ph\n",
NVT_TS_PARAMS_SIZE, data->buf);
@ -314,12 +311,10 @@ static int nvt_ts_probe(struct i2c_client *client)
}
static const struct nvt_ts_i2c_chip_data nvt_nt11205_ts_data = {
.wake_type = 0x05,
.chip_id = 0x05,
};
static const struct nvt_ts_i2c_chip_data nvt_nt36672a_ts_data = {
.wake_type = 0x01,
.chip_id = 0x08,
};

View file

@ -208,7 +208,7 @@ static int pm_connect(struct serio *serio, struct serio_driver *drv)
pm->serio = serio;
pm->dev = input_dev;
snprintf(pm->phys, sizeof(pm->phys), "%s/input0", serio->phys);
scnprintf(pm->phys, sizeof(pm->phys), "%s/input0", serio->phys);
pm->maxcontacts = 1;
input_dev->name = "PenMount Serial TouchScreen";

View file

@ -120,7 +120,7 @@ static int stmfts_brightness_set(struct led_classdev *led_cdev,
err = regulator_enable(sdata->ledvdd);
if (err) {
dev_warn(&sdata->client->dev,
"failed to disable ledvdd regulator: %d\n",
"failed to enable ledvdd regulator: %d\n",
err);
return err;
}
@ -141,7 +141,7 @@ static enum led_brightness stmfts_brightness_get(struct led_classdev *led_cdev)
/*
* We can't simply use i2c_smbus_read_i2c_block_data because we
* need to read more than 255 bytes (
* need to read 256 bytes, which exceeds the 255-byte SMBus block limit.
*/
static int stmfts_read_events(struct stmfts_data *sdata)
{
@ -410,7 +410,7 @@ static ssize_t stmfts_sysfs_chip_id(struct device *dev,
{
struct stmfts_data *sdata = dev_get_drvdata(dev);
return sprintf(buf, "%#x\n", sdata->chip_id);
return sysfs_emit(buf, "%#x\n", sdata->chip_id);
}
static ssize_t stmfts_sysfs_chip_version(struct device *dev,
@ -418,7 +418,7 @@ static ssize_t stmfts_sysfs_chip_version(struct device *dev,
{
struct stmfts_data *sdata = dev_get_drvdata(dev);
return sprintf(buf, "%u\n", sdata->chip_ver);
return sysfs_emit(buf, "%u\n", sdata->chip_ver);
}
static ssize_t stmfts_sysfs_fw_ver(struct device *dev,
@ -426,7 +426,7 @@ static ssize_t stmfts_sysfs_fw_ver(struct device *dev,
{
struct stmfts_data *sdata = dev_get_drvdata(dev);
return sprintf(buf, "%u\n", sdata->fw_ver);
return sysfs_emit(buf, "%u\n", sdata->fw_ver);
}
static ssize_t stmfts_sysfs_config_id(struct device *dev,
@ -434,7 +434,7 @@ static ssize_t stmfts_sysfs_config_id(struct device *dev,
{
struct stmfts_data *sdata = dev_get_drvdata(dev);
return sprintf(buf, "%#x\n", sdata->config_id);
return sysfs_emit(buf, "%#x\n", sdata->config_id);
}
static ssize_t stmfts_sysfs_config_version(struct device *dev,
@ -442,7 +442,7 @@ static ssize_t stmfts_sysfs_config_version(struct device *dev,
{
struct stmfts_data *sdata = dev_get_drvdata(dev);
return sprintf(buf, "%u\n", sdata->config_ver);
return sysfs_emit(buf, "%u\n", sdata->config_ver);
}
static ssize_t stmfts_sysfs_read_status(struct device *dev,
@ -457,7 +457,7 @@ static ssize_t stmfts_sysfs_read_status(struct device *dev,
if (err)
return err;
return sprintf(buf, "%#02x\n", status[0]);
return sysfs_emit(buf, "%#02x\n", status[0]);
}
static ssize_t stmfts_sysfs_hover_enable_read(struct device *dev,
@ -465,7 +465,7 @@ static ssize_t stmfts_sysfs_hover_enable_read(struct device *dev,
{
struct stmfts_data *sdata = dev_get_drvdata(dev);
return sprintf(buf, "%u\n", sdata->hover_enabled);
return sysfs_emit(buf, "%u\n", sdata->hover_enabled);
}
static ssize_t stmfts_sysfs_hover_enable_write(struct device *dev,
@ -594,9 +594,6 @@ static void stmfts_power_off(void *data)
sdata->regulators);
}
/* This function is void because I don't want to prevent using the touch key
* only because the LEDs don't get registered
*/
static int stmfts_enable_led(struct stmfts_data *sdata)
{
int err;

View file

@ -148,8 +148,8 @@ static int touchit213_connect(struct serio *serio, struct serio_driver *drv)
touchit213->serio = serio;
touchit213->dev = input_dev;
snprintf(touchit213->phys, sizeof(touchit213->phys),
"%s/input0", serio->phys);
scnprintf(touchit213->phys, sizeof(touchit213->phys),
"%s/input0", serio->phys);
input_dev->name = "Sahara Touch-iT213 Serial TouchScreen";
input_dev->phys = touchit213->phys;

View file

@ -111,7 +111,7 @@ static int tr_connect(struct serio *serio, struct serio_driver *drv)
tr->serio = serio;
tr->dev = input_dev;
snprintf(tr->phys, sizeof(tr->phys), "%s/input0", serio->phys);
scnprintf(tr->phys, sizeof(tr->phys), "%s/input0", serio->phys);
input_dev->name = "Touchright Serial TouchScreen";
input_dev->phys = tr->phys;

View file

@ -118,7 +118,7 @@ static int tw_connect(struct serio *serio, struct serio_driver *drv)
tw->serio = serio;
tw->dev = input_dev;
snprintf(tw->phys, sizeof(tw->phys), "%s/input0", serio->phys);
scnprintf(tw->phys, sizeof(tw->phys), "%s/input0", serio->phys);
input_dev->name = "Touchwindow Serial TouchScreen";
input_dev->phys = tw->phys;

View file

@ -92,7 +92,7 @@ static int tsc_connect(struct serio *serio, struct serio_driver *drv)
ptsc->serio = serio;
ptsc->dev = input_dev;
snprintf(ptsc->phys, sizeof(ptsc->phys), "%s/input0", serio->phys);
scnprintf(ptsc->phys, sizeof(ptsc->phys), "%s/input0", serio->phys);
input_dev->name = "TSC-10/25/40 Serial TouchScreen";
input_dev->phys = ptsc->phys;

View file

@ -1026,10 +1026,8 @@ static int wdt87xx_ts_create_input_device(struct wdt87xx_data *wdt)
int error;
input = devm_input_allocate_device(dev);
if (!input) {
dev_err(dev, "failed to allocate input device\n");
if (!input)
return -ENOMEM;
}
wdt->input = input;
input->name = "WDT87xx Touchscreen";
@ -1053,10 +1051,8 @@ static int wdt87xx_ts_create_input_device(struct wdt87xx_data *wdt)
INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
error = input_register_device(input);
if (error) {
dev_err(dev, "failed to register input device: %d\n", error);
return error;
}
if (error)
return dev_err_probe(dev, error, "failed to register input device\n");
return 0;
}
@ -1096,10 +1092,8 @@ static int wdt87xx_ts_probe(struct i2c_client *client)
NULL, wdt87xx_ts_interrupt,
IRQF_ONESHOT,
client->name, wdt);
if (error) {
dev_err(&client->dev, "request irq failed: %d\n", error);
if (error)
return error;
}
return 0;
}

View file

@ -1,180 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Analog Devices ADP5589/ADP5585 I/O Expander and QWERTY Keypad Controller
*
* Copyright 2010-2011 Analog Devices Inc.
*/
#ifndef _ADP5589_H
#define _ADP5589_H
/*
* ADP5589 specific GPI and Keymap defines
*/
#define ADP5589_KEYMAPSIZE 88
#define ADP5589_GPI_PIN_ROW0 97
#define ADP5589_GPI_PIN_ROW1 98
#define ADP5589_GPI_PIN_ROW2 99
#define ADP5589_GPI_PIN_ROW3 100
#define ADP5589_GPI_PIN_ROW4 101
#define ADP5589_GPI_PIN_ROW5 102
#define ADP5589_GPI_PIN_ROW6 103
#define ADP5589_GPI_PIN_ROW7 104
#define ADP5589_GPI_PIN_COL0 105
#define ADP5589_GPI_PIN_COL1 106
#define ADP5589_GPI_PIN_COL2 107
#define ADP5589_GPI_PIN_COL3 108
#define ADP5589_GPI_PIN_COL4 109
#define ADP5589_GPI_PIN_COL5 110
#define ADP5589_GPI_PIN_COL6 111
#define ADP5589_GPI_PIN_COL7 112
#define ADP5589_GPI_PIN_COL8 113
#define ADP5589_GPI_PIN_COL9 114
#define ADP5589_GPI_PIN_COL10 115
#define GPI_LOGIC1 116
#define GPI_LOGIC2 117
#define ADP5589_GPI_PIN_ROW_BASE ADP5589_GPI_PIN_ROW0
#define ADP5589_GPI_PIN_ROW_END ADP5589_GPI_PIN_ROW7
#define ADP5589_GPI_PIN_COL_BASE ADP5589_GPI_PIN_COL0
#define ADP5589_GPI_PIN_COL_END ADP5589_GPI_PIN_COL10
#define ADP5589_GPI_PIN_BASE ADP5589_GPI_PIN_ROW_BASE
#define ADP5589_GPI_PIN_END ADP5589_GPI_PIN_COL_END
#define ADP5589_GPIMAPSIZE_MAX (ADP5589_GPI_PIN_END - ADP5589_GPI_PIN_BASE + 1)
/*
* ADP5585 specific GPI and Keymap defines
*/
#define ADP5585_KEYMAPSIZE 30
#define ADP5585_GPI_PIN_ROW0 37
#define ADP5585_GPI_PIN_ROW1 38
#define ADP5585_GPI_PIN_ROW2 39
#define ADP5585_GPI_PIN_ROW3 40
#define ADP5585_GPI_PIN_ROW4 41
#define ADP5585_GPI_PIN_ROW5 42
#define ADP5585_GPI_PIN_COL0 43
#define ADP5585_GPI_PIN_COL1 44
#define ADP5585_GPI_PIN_COL2 45
#define ADP5585_GPI_PIN_COL3 46
#define ADP5585_GPI_PIN_COL4 47
#define GPI_LOGIC 48
#define ADP5585_GPI_PIN_ROW_BASE ADP5585_GPI_PIN_ROW0
#define ADP5585_GPI_PIN_ROW_END ADP5585_GPI_PIN_ROW5
#define ADP5585_GPI_PIN_COL_BASE ADP5585_GPI_PIN_COL0
#define ADP5585_GPI_PIN_COL_END ADP5585_GPI_PIN_COL4
#define ADP5585_GPI_PIN_BASE ADP5585_GPI_PIN_ROW_BASE
#define ADP5585_GPI_PIN_END ADP5585_GPI_PIN_COL_END
#define ADP5585_GPIMAPSIZE_MAX (ADP5585_GPI_PIN_END - ADP5585_GPI_PIN_BASE + 1)
struct adp5589_gpi_map {
unsigned short pin;
unsigned short sw_evt;
};
/* scan_cycle_time */
#define ADP5589_SCAN_CYCLE_10ms 0
#define ADP5589_SCAN_CYCLE_20ms 1
#define ADP5589_SCAN_CYCLE_30ms 2
#define ADP5589_SCAN_CYCLE_40ms 3
/* RESET_CFG */
#define RESET_PULSE_WIDTH_500us 0
#define RESET_PULSE_WIDTH_1ms 1
#define RESET_PULSE_WIDTH_2ms 2
#define RESET_PULSE_WIDTH_10ms 3
#define RESET_TRIG_TIME_0ms (0 << 2)
#define RESET_TRIG_TIME_1000ms (1 << 2)
#define RESET_TRIG_TIME_1500ms (2 << 2)
#define RESET_TRIG_TIME_2000ms (3 << 2)
#define RESET_TRIG_TIME_2500ms (4 << 2)
#define RESET_TRIG_TIME_3000ms (5 << 2)
#define RESET_TRIG_TIME_3500ms (6 << 2)
#define RESET_TRIG_TIME_4000ms (7 << 2)
#define RESET_PASSTHRU_EN (1 << 5)
#define RESET1_POL_HIGH (1 << 6)
#define RESET1_POL_LOW (0 << 6)
#define RESET2_POL_HIGH (1 << 7)
#define RESET2_POL_LOW (0 << 7)
/* ADP5589 Mask Bits:
* C C C C C C C C C C C | R R R R R R R R
* 1 9 8 7 6 5 4 3 2 1 0 | 7 6 5 4 3 2 1 0
* 0
* ---------------- BIT ------------------
* 1 1 1 1 1 1 1 1 1 0 0 | 0 0 0 0 0 0 0 0
* 8 7 6 5 4 3 2 1 0 9 8 | 7 6 5 4 3 2 1 0
*/
#define ADP_ROW(x) (1 << (x))
#define ADP_COL(x) (1 << (x + 8))
#define ADP5589_ROW_MASK 0xFF
#define ADP5589_COL_MASK 0xFF
#define ADP5589_COL_SHIFT 8
#define ADP5589_MAX_ROW_NUM 7
#define ADP5589_MAX_COL_NUM 10
/* ADP5585 Mask Bits:
* C C C C C | R R R R R R
* 4 3 2 1 0 | 5 4 3 2 1 0
*
* ---- BIT -- -----------
* 1 0 0 0 0 | 0 0 0 0 0 0
* 0 9 8 7 6 | 5 4 3 2 1 0
*/
#define ADP5585_ROW_MASK 0x3F
#define ADP5585_COL_MASK 0x1F
#define ADP5585_ROW_SHIFT 0
#define ADP5585_COL_SHIFT 6
#define ADP5585_MAX_ROW_NUM 5
#define ADP5585_MAX_COL_NUM 4
#define ADP5585_ROW(x) (1 << ((x) & ADP5585_ROW_MASK))
#define ADP5585_COL(x) (1 << (((x) & ADP5585_COL_MASK) + ADP5585_COL_SHIFT))
/* Put one of these structures in i2c_board_info platform_data */
struct adp5589_kpad_platform_data {
unsigned keypad_en_mask; /* Keypad (Rows/Columns) enable mask */
const unsigned short *keymap; /* Pointer to keymap */
unsigned short keymapsize; /* Keymap size */
bool repeat; /* Enable key repeat */
bool en_keylock; /* Enable key lock feature (ADP5589 only)*/
unsigned char unlock_key1; /* Unlock Key 1 (ADP5589 only) */
unsigned char unlock_key2; /* Unlock Key 2 (ADP5589 only) */
unsigned char unlock_timer; /* Time in seconds [0..7] between the two unlock keys 0=disable (ADP5589 only) */
unsigned char scan_cycle_time; /* Time between consecutive scan cycles */
unsigned char reset_cfg; /* Reset config */
unsigned short reset1_key_1; /* Reset Key 1 */
unsigned short reset1_key_2; /* Reset Key 2 */
unsigned short reset1_key_3; /* Reset Key 3 */
unsigned short reset2_key_1; /* Reset Key 1 */
unsigned short reset2_key_2; /* Reset Key 2 */
unsigned debounce_dis_mask; /* Disable debounce mask */
unsigned pull_dis_mask; /* Disable all pull resistors mask */
unsigned pullup_en_100k; /* Pull-Up 100k Enable Mask */
unsigned pullup_en_300k; /* Pull-Up 300k Enable Mask */
unsigned pulldown_en_300k; /* Pull-Down 300k Enable Mask */
const struct adp5589_gpi_map *gpimap;
unsigned short gpimapsize;
const struct adp5589_gpio_platform_data *gpio_data;
};
struct i2c_client; /* forward declaration */
struct adp5589_gpio_platform_data {
int gpio_start; /* GPIO Chip base # */
};
#endif