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

Configure Feed

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

Merge 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()
...

+516 -510
-17
Documentation/devicetree/bindings/goldfish/events.txt
··· 1 - Android Goldfish Events Keypad 2 - 3 - Android goldfish events keypad device generated by android emulator. 4 - 5 - Required properties: 6 - 7 - - compatible : should contain "google,goldfish-events-keypad" to match emulator 8 - - reg : <registers mapping> 9 - - interrupts : <interrupt mapping> 10 - 11 - Example: 12 - 13 - goldfish-events@9040000 { 14 - compatible = "google,goldfish-events-keypad"; 15 - reg = <0x9040000 0x1000>; 16 - interrupts = <0x5>; 17 - };
+66
Documentation/devicetree/bindings/input/focaltech,ft8112.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/input/focaltech,ft8112.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: FocalTech FT8112 touchscreen controller 8 + 9 + maintainers: 10 + - Daniel Peng <Daniel_Peng@pegatron.corp-partner.google.com> 11 + 12 + description: 13 + Supports the FocalTech FT8112 touchscreen controller. 14 + This touchscreen controller uses the i2c-hid protocol with a reset GPIO. 15 + 16 + allOf: 17 + - $ref: /schemas/input/touchscreen/touchscreen.yaml# 18 + 19 + properties: 20 + compatible: 21 + enum: 22 + - focaltech,ft8112 23 + 24 + reg: 25 + maxItems: 1 26 + 27 + interrupts: 28 + maxItems: 1 29 + 30 + panel: true 31 + 32 + reset-gpios: 33 + maxItems: 1 34 + 35 + vcc33-supply: true 36 + 37 + vccio-supply: true 38 + 39 + required: 40 + - compatible 41 + - reg 42 + - interrupts 43 + - vcc33-supply 44 + 45 + additionalProperties: false 46 + 47 + examples: 48 + - | 49 + #include <dt-bindings/gpio/gpio.h> 50 + #include <dt-bindings/interrupt-controller/irq.h> 51 + 52 + i2c { 53 + #address-cells = <1>; 54 + #size-cells = <0>; 55 + 56 + touchscreen@38 { 57 + compatible = "focaltech,ft8112"; 58 + reg = <0x38>; 59 + 60 + interrupt-parent = <&pio>; 61 + interrupts = <15 IRQ_TYPE_LEVEL_LOW>; 62 + 63 + reset-gpios = <&pio 126 GPIO_ACTIVE_LOW>; 64 + vcc33-supply = <&pp3300_tchscr_x>; 65 + }; 66 + };
+41
Documentation/devicetree/bindings/input/google,goldfish-events-keypad.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/input/google,goldfish-events-keypad.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Android Goldfish Events Keypad 8 + 9 + maintainers: 10 + - Kuan-Wei Chiu <visitorckw@gmail.com> 11 + 12 + allOf: 13 + - $ref: input.yaml# 14 + 15 + description: 16 + Android goldfish events keypad device generated by android emulator. 17 + 18 + properties: 19 + compatible: 20 + const: google,goldfish-events-keypad 21 + 22 + reg: 23 + maxItems: 1 24 + 25 + interrupts: 26 + maxItems: 1 27 + 28 + required: 29 + - compatible 30 + - reg 31 + - interrupts 32 + 33 + unevaluatedProperties: false 34 + 35 + examples: 36 + - | 37 + keypad@9040000 { 38 + compatible = "google,goldfish-events-keypad"; 39 + reg = <0x9040000 0x1000>; 40 + interrupts = <5>; 41 + };
+12 -5
Documentation/devicetree/bindings/input/qcom,pm8941-pwrkey.yaml
··· 12 12 13 13 properties: 14 14 compatible: 15 - enum: 16 - - qcom,pm8941-pwrkey 17 - - qcom,pm8941-resin 18 - - qcom,pmk8350-pwrkey 19 - - qcom,pmk8350-resin 15 + oneOf: 16 + - enum: 17 + - qcom,pm8941-pwrkey 18 + - qcom,pm8941-resin 19 + - qcom,pmk8350-pwrkey 20 + - qcom,pmk8350-resin 21 + - items: 22 + - const: qcom,pmm8654au-pwrkey 23 + - const: qcom,pmk8350-pwrkey 24 + - items: 25 + - const: qcom,pmm8654au-resin 26 + - const: qcom,pmk8350-resin 20 27 21 28 interrupts: 22 29 maxItems: 1
+1
Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
··· 39 39 - edt,edt-ft5406 40 40 - edt,edt-ft5506 41 41 - evervision,ev-ft5726 42 + - focaltech,ft3518 42 43 - focaltech,ft5426 43 44 - focaltech,ft5452 44 45 - focaltech,ft6236
+51
Documentation/devicetree/bindings/input/touchscreen/ilitek,ili210x.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/input/touchscreen/ilitek,ili210x.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Ilitek ILI21xx/ILI251x V3/V6 touch screen controller with i2c interface 8 + 9 + maintainers: 10 + - Frank Li <Frank.Li@nxp.com> 11 + - Marek Vasut <marek.vasut+renesas@mailbox.org> 12 + 13 + properties: 14 + compatible: 15 + enum: 16 + - ilitek,ili210x 17 + - ilitek,ili2117 18 + - ilitek,ili2120 19 + - ilitek,ili251x 20 + 21 + reg: 22 + maxItems: 1 23 + 24 + interrupts: 25 + maxItems: 1 26 + 27 + reset-gpios: 28 + maxItems: 1 29 + 30 + wakeup-source: true 31 + 32 + required: 33 + - compatible 34 + - reg 35 + 36 + allOf: 37 + - $ref: touchscreen.yaml 38 + 39 + unevaluatedProperties: false 40 + 41 + examples: 42 + - | 43 + i2c { 44 + #address-cells = <1>; 45 + #size-cells = <0>; 46 + 47 + touchscreen@41 { 48 + compatible = "ilitek,ili2120"; 49 + reg = <0x41>; 50 + }; 51 + };
+3 -1
Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml
··· 55 55 properties: 56 56 compatible: 57 57 contains: 58 - const: imagis,ist3032c 58 + enum: 59 + - imagis,ist3032c 60 + - imagis,ist3038 59 61 then: 60 62 properties: 61 63 linux,keycodes: false
+7 -3
Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml
··· 14 14 15 15 properties: 16 16 compatible: 17 - enum: 18 - - sitronix,st1232 19 - - sitronix,st1633 17 + oneOf: 18 + - enum: 19 + - sitronix,st1232 20 + - sitronix,st1633 21 + - items: 22 + - const: sitronix,st1624 23 + - const: sitronix,st1633 20 24 21 25 reg: 22 26 maxItems: 1
+3
Documentation/devicetree/bindings/input/touchscreen/ti,tsc2007.yaml
··· 53 53 how much time to wait (in milliseconds) before reading again the 54 54 values from the tsc2007. 55 55 56 + "#io-channel-cells": 57 + const: 1 58 + 56 59 required: 57 60 - compatible 58 61 - reg
-4
Documentation/devicetree/bindings/input/touchscreen/trivial-touch.yaml
··· 23 23 # Hynitron cstxxx series touchscreen controller 24 24 - hynitron,cst340 25 25 # Ilitek I2C Touchscreen Controller 26 - - ilitek,ili210x 27 - - ilitek,ili2117 28 - - ilitek,ili2120 29 26 - ilitek,ili2130 30 27 - ilitek,ili2131 31 28 - ilitek,ili2132 ··· 30 33 - ilitek,ili2322 31 34 - ilitek,ili2323 32 35 - ilitek,ili2326 33 - - ilitek,ili251x 34 36 - ilitek,ili2520 35 37 - ilitek,ili2521 36 38 # MAXI MAX11801 Resistive touch screen controller with i2c interface
+1 -1
MAINTAINERS
··· 11404 11404 M: Job Noorman <job@noorman.info> 11405 11405 L: linux-input@vger.kernel.org 11406 11406 S: Maintained 11407 - F: Documentation/devicetree/bindings/input/touchscreen/himax,hx83112b.yaml 11407 + F: Documentation/devicetree/bindings/input/touchscreen/trivial-touch.yaml 11408 11408 F: drivers/input/touchscreen/himax_hx83112b.c 11409 11409 11410 11410 HIMAX HX852X TOUCHSCREEN DRIVER
+8
drivers/hid/i2c-hid/i2c-hid-of-elan.c
··· 168 168 .power_after_backlight = true, 169 169 }; 170 170 171 + static const struct elan_i2c_hid_chip_data focaltech_ft8112_chip_data = { 172 + .post_power_delay_ms = 10, 173 + .post_gpio_reset_on_delay_ms = 150, 174 + .hid_descriptor_address = 0x0001, 175 + .main_supply_name = "vcc33", 176 + }; 177 + 171 178 static const struct elan_i2c_hid_chip_data ilitek_ili9882t_chip_data = { 172 179 .post_power_delay_ms = 1, 173 180 .post_gpio_reset_on_delay_ms = 200, ··· 198 191 static const struct of_device_id elan_i2c_hid_of_match[] = { 199 192 { .compatible = "elan,ekth6915", .data = &elan_ekth6915_chip_data }, 200 193 { .compatible = "elan,ekth6a12nay", .data = &elan_ekth6a12nay_chip_data }, 194 + { .compatible = "focaltech,ft8112", .data = &focaltech_ft8112_chip_data }, 201 195 { .compatible = "ilitek,ili9882t", .data = &ilitek_ili9882t_chip_data }, 202 196 { .compatible = "ilitek,ili2901", .data = &ilitek_ili2901_chip_data }, 203 197 { }
+2 -1
drivers/input/keyboard/cros_ec_keyb.c
··· 269 269 270 270 if (ckdev->ec->event_size != ckdev->cols) { 271 271 dev_err(ckdev->dev, 272 - "Discarded incomplete key matrix event.\n"); 272 + "Discarded key matrix event, unexpected length: %d != %d\n", 273 + ckdev->ec->event_size, ckdev->cols); 273 274 return NOTIFY_OK; 274 275 } 275 276
+13 -6
drivers/input/keyboard/gpio_keys.c
··· 434 434 ms_to_ktime(bdata->software_debounce), 435 435 HRTIMER_MODE_REL); 436 436 } else { 437 - mod_delayed_work(system_wq, 437 + mod_delayed_work(system_dfl_wq, 438 438 &bdata->work, 439 439 msecs_to_jiffies(bdata->software_debounce)); 440 440 } ··· 616 616 break; 617 617 } 618 618 } else { 619 - if (!button->irq) { 620 - dev_err(dev, "Found button without gpio or irq\n"); 621 - return -EINVAL; 622 - } 619 + if (button->irq) { 620 + bdata->irq = button->irq; 621 + } else { 622 + irq = platform_get_irq_optional(pdev, idx); 623 + if (irq < 0) { 624 + error = irq; 625 + return dev_err_probe(dev, error, 626 + "Unable to determine IRQ# for button #%d", 627 + idx); 628 + } 623 629 624 - bdata->irq = button->irq; 630 + bdata->irq = irq; 631 + } 625 632 626 633 if (button->type && button->type != EV_KEY) { 627 634 dev_err(dev, "Only EV_KEY allowed for IRQ buttons.\n");
-4
drivers/input/keyboard/omap4-keypad.c
··· 193 193 kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, 194 194 kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); 195 195 196 - pm_runtime_mark_last_busy(dev); 197 196 pm_runtime_put_autosuspend(dev); 198 197 199 198 return IRQ_HANDLED; ··· 230 231 enable_irq(keypad_data->irq); 231 232 232 233 out: 233 - pm_runtime_mark_last_busy(dev); 234 234 pm_runtime_put_autosuspend(dev); 235 235 236 236 return error; ··· 263 265 enable_irq(keypad_data->irq); 264 266 clk_disable_unprepare(keypad_data->fck); 265 267 266 - pm_runtime_mark_last_busy(dev); 267 268 pm_runtime_put_autosuspend(dev); 268 269 } 269 270 ··· 401 404 omap4_keypad_stop(keypad_data); 402 405 } 403 406 404 - pm_runtime_mark_last_busy(dev); 405 407 pm_runtime_put_autosuspend(dev); 406 408 if (error) 407 409 return error;
-4
drivers/input/misc/cs40l50-vibra.c
··· 308 308 list_add(&effect->list, &vib->effect_head); 309 309 } 310 310 err_pm: 311 - pm_runtime_mark_last_busy(vib->dev); 312 311 pm_runtime_put_autosuspend(vib->dev); 313 312 err_exit: 314 313 work_data->error = error; ··· 367 368 dev_err(vib->dev, "Effect to play not found\n"); 368 369 } 369 370 370 - pm_runtime_mark_last_busy(vib->dev); 371 371 pm_runtime_put_autosuspend(vib->dev); 372 372 err_free: 373 373 kfree(work_data); ··· 382 384 383 385 vib->dsp.write(vib->dev, vib->regmap, vib->dsp.stop_cmd); 384 386 385 - pm_runtime_mark_last_busy(vib->dev); 386 387 pm_runtime_put_autosuspend(vib->dev); 387 388 388 389 kfree(work_data); ··· 453 456 list_del(&erase_effect->list); 454 457 kfree(erase_effect); 455 458 err_pm: 456 - pm_runtime_mark_last_busy(vib->dev); 457 459 pm_runtime_put_autosuspend(vib->dev); 458 460 err_exit: 459 461 work_data->error = error;
+33 -39
drivers/input/misc/gpio_decoder.c
··· 6 6 * encoded numeric value into an input event. 7 7 */ 8 8 9 - #include <linux/device.h> 9 + #include <linux/bitmap.h> 10 + #include <linux/dev_printk.h> 11 + #include <linux/device/devres.h> 12 + #include <linux/err.h> 10 13 #include <linux/gpio/consumer.h> 11 14 #include <linux/input.h> 12 - #include <linux/kernel.h> 15 + #include <linux/minmax.h> 16 + #include <linux/mod_devicetable.h> 13 17 #include <linux/module.h> 14 - #include <linux/of.h> 15 18 #include <linux/platform_device.h> 19 + #include <linux/property.h> 20 + #include <linux/types.h> 16 21 17 22 struct gpio_decoder { 18 23 struct gpio_descs *input_gpios; ··· 29 24 static int gpio_decoder_get_gpios_state(struct gpio_decoder *decoder) 30 25 { 31 26 struct gpio_descs *gpios = decoder->input_gpios; 32 - unsigned int ret = 0; 33 - int i, val; 27 + DECLARE_BITMAP(values, 32); 28 + unsigned int size; 29 + int err; 34 30 35 - for (i = 0; i < gpios->ndescs; i++) { 36 - val = gpiod_get_value_cansleep(gpios->desc[i]); 37 - if (val < 0) { 38 - dev_err(decoder->dev, 39 - "Error reading gpio %d: %d\n", 40 - desc_to_gpio(gpios->desc[i]), val); 41 - return val; 42 - } 43 - 44 - val = !!val; 45 - ret = (ret << 1) | val; 31 + size = min(gpios->ndescs, 32U); 32 + err = gpiod_get_array_value_cansleep(size, gpios->desc, gpios->info, values); 33 + if (err) { 34 + dev_err(decoder->dev, "Error reading GPIO: %d\n", err); 35 + return err; 46 36 } 47 37 48 - return ret; 38 + return bitmap_read(values, 0, size); 49 39 } 50 40 51 41 static void gpio_decoder_poll_gpios(struct input_dev *input) ··· 61 61 struct device *dev = &pdev->dev; 62 62 struct gpio_decoder *decoder; 63 63 struct input_dev *input; 64 - u32 max; 64 + u32 max; 65 65 int err; 66 66 67 67 decoder = devm_kzalloc(dev, sizeof(*decoder), GFP_KERNEL); ··· 72 72 device_property_read_u32(dev, "linux,axis", &decoder->axis); 73 73 74 74 decoder->input_gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN); 75 - if (IS_ERR(decoder->input_gpios)) { 76 - dev_err(dev, "unable to acquire input gpios\n"); 77 - return PTR_ERR(decoder->input_gpios); 78 - } 75 + if (IS_ERR(decoder->input_gpios)) 76 + return dev_err_probe(dev, PTR_ERR(decoder->input_gpios), 77 + "unable to acquire input gpios\n"); 79 78 80 - if (decoder->input_gpios->ndescs < 2) { 81 - dev_err(dev, "not enough gpios found\n"); 82 - return -EINVAL; 83 - } 79 + if (decoder->input_gpios->ndescs < 2) 80 + return dev_err_probe(dev, -EINVAL, "not enough gpios found\n"); 81 + 82 + if (decoder->input_gpios->ndescs > 31) 83 + return dev_err_probe(dev, -EINVAL, "too many gpios found\n"); 84 84 85 85 if (device_property_read_u32(dev, "decoder-max-value", &max)) 86 - max = (1U << decoder->input_gpios->ndescs) - 1; 86 + max = BIT(decoder->input_gpios->ndescs) - 1; 87 87 88 88 input = devm_input_allocate_device(dev); 89 89 if (!input) ··· 96 96 input_set_abs_params(input, decoder->axis, 0, max, 0, 0); 97 97 98 98 err = input_setup_polling(input, gpio_decoder_poll_gpios); 99 - if (err) { 100 - dev_err(dev, "failed to set up polling\n"); 101 - return err; 102 - } 99 + if (err) 100 + return dev_err_probe(dev, err, "failed to set up polling\n"); 103 101 104 102 err = input_register_device(input); 105 - if (err) { 106 - dev_err(dev, "failed to register input device\n"); 107 - return err; 108 - } 103 + if (err) 104 + return dev_err_probe(dev, err, "failed to register input device\n"); 109 105 110 106 return 0; 111 107 } 112 108 113 - #ifdef CONFIG_OF 114 109 static const struct of_device_id gpio_decoder_of_match[] = { 115 110 { .compatible = "gpio-decoder", }, 116 - { }, 111 + { } 117 112 }; 118 113 MODULE_DEVICE_TABLE(of, gpio_decoder_of_match); 119 - #endif 120 114 121 115 static struct platform_driver gpio_decoder_driver = { 122 116 .probe = gpio_decoder_probe, 123 117 .driver = { 124 118 .name = "gpio-decoder", 125 - .of_match_table = of_match_ptr(gpio_decoder_of_match), 119 + .of_match_table = gpio_decoder_of_match, 126 120 } 127 121 }; 128 122 module_platform_driver(gpio_decoder_driver);
+1 -1
drivers/input/misc/palmas-pwrbutton.c
··· 91 91 pm_wakeup_event(input_dev->dev.parent, 0); 92 92 input_sync(input_dev); 93 93 94 - mod_delayed_work(system_wq, &pwron->input_work, 94 + mod_delayed_work(system_dfl_wq, &pwron->input_work, 95 95 msecs_to_jiffies(PALMAS_PWR_KEY_Q_TIME_MS)); 96 96 97 97 return IRQ_HANDLED;
+1 -1
drivers/input/misc/pf1550-onkey.c
··· 173 173 return 0; 174 174 } 175 175 176 - static SIMPLE_DEV_PM_OPS(pf1550_onkey_pm_ops, pf1550_onkey_suspend, 176 + static DEFINE_SIMPLE_DEV_PM_OPS(pf1550_onkey_pm_ops, pf1550_onkey_suspend, 177 177 pf1550_onkey_resume); 178 178 179 179 static const struct platform_device_id pf1550_onkey_id[] = {
+58 -9
drivers/input/misc/twl4030-pwrbutton.c
··· 20 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 */ 22 22 23 + #include <linux/bits.h> 23 24 #include <linux/module.h> 24 25 #include <linux/init.h> 25 26 #include <linux/kernel.h> 26 27 #include <linux/errno.h> 27 28 #include <linux/input.h> 28 29 #include <linux/interrupt.h> 29 - #include <linux/of.h> 30 + #include <linux/mod_devicetable.h> 31 + #include <linux/property.h> 30 32 #include <linux/platform_device.h> 31 33 #include <linux/mfd/twl.h> 32 34 33 - #define PWR_PWRON_IRQ (1 << 0) 35 + #define PWR_PWRON_IRQ BIT(0) 34 36 35 - #define STS_HW_CONDITIONS 0xf 37 + struct twl_pwrbutton_chipdata { 38 + u8 status_reg; 39 + bool need_manual_irq; 40 + }; 41 + 42 + static const struct twl_pwrbutton_chipdata twl4030_chipdata = { 43 + .status_reg = 0xf, 44 + .need_manual_irq = false, 45 + }; 46 + 47 + static const struct twl_pwrbutton_chipdata twl6030_chipdata = { 48 + .status_reg = 0x2, 49 + .need_manual_irq = true, 50 + }; 36 51 37 52 static irqreturn_t powerbutton_irq(int irq, void *_pwr) 38 53 { 39 54 struct input_dev *pwr = _pwr; 55 + const struct twl_pwrbutton_chipdata *pdata = dev_get_drvdata(pwr->dev.parent); 40 56 int err; 41 57 u8 value; 42 58 43 - err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, STS_HW_CONDITIONS); 59 + err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, pdata->status_reg); 44 60 if (!err) { 45 61 pm_wakeup_event(pwr->dev.parent, 0); 46 62 input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ); ··· 71 55 72 56 static int twl4030_pwrbutton_probe(struct platform_device *pdev) 73 57 { 58 + const struct twl_pwrbutton_chipdata *pdata; 74 59 struct input_dev *pwr; 75 60 int irq = platform_get_irq(pdev, 0); 76 61 int err; 62 + 63 + pdata = device_get_match_data(&pdev->dev); 64 + if (!pdata) 65 + return -EINVAL; 66 + 67 + platform_set_drvdata(pdev, (void *)pdata); 77 68 78 69 pwr = devm_input_allocate_device(&pdev->dev); 79 70 if (!pwr) { ··· 108 85 return err; 109 86 } 110 87 88 + if (pdata->need_manual_irq) { 89 + err = twl6030_interrupt_unmask(0x01, REG_INT_MSK_LINE_A); 90 + if (err) 91 + return err; 92 + 93 + err = twl6030_interrupt_unmask(0x01, REG_INT_MSK_STS_A); 94 + if (err) 95 + return err; 96 + } 97 + 111 98 device_init_wakeup(&pdev->dev, true); 112 99 113 100 return 0; 114 101 } 115 102 116 - #ifdef CONFIG_OF 103 + static void twl4030_pwrbutton_remove(struct platform_device *pdev) 104 + { 105 + const struct twl_pwrbutton_chipdata *pdata = platform_get_drvdata(pdev); 106 + 107 + if (pdata->need_manual_irq) { 108 + twl6030_interrupt_mask(0x01, REG_INT_MSK_LINE_A); 109 + twl6030_interrupt_mask(0x01, REG_INT_MSK_STS_A); 110 + } 111 + } 112 + 117 113 static const struct of_device_id twl4030_pwrbutton_dt_match_table[] = { 118 - { .compatible = "ti,twl4030-pwrbutton" }, 119 - {}, 114 + { 115 + .compatible = "ti,twl4030-pwrbutton", 116 + .data = &twl4030_chipdata, 117 + }, 118 + { 119 + .compatible = "ti,twl6030-pwrbutton", 120 + .data = &twl6030_chipdata, 121 + }, 122 + { } 120 123 }; 121 124 MODULE_DEVICE_TABLE(of, twl4030_pwrbutton_dt_match_table); 122 - #endif 123 125 124 126 static struct platform_driver twl4030_pwrbutton_driver = { 125 127 .probe = twl4030_pwrbutton_probe, 128 + .remove = twl4030_pwrbutton_remove, 126 129 .driver = { 127 130 .name = "twl4030_pwrbutton", 128 - .of_match_table = of_match_ptr(twl4030_pwrbutton_dt_match_table), 131 + .of_match_table = twl4030_pwrbutton_dt_match_table, 129 132 }, 130 133 }; 131 134 module_platform_driver(twl4030_pwrbutton_driver);
+4 -5
drivers/input/mouse/appletouch.c
··· 200 200 u8 *data; /* transferred data */ 201 201 struct input_dev *input; /* input dev */ 202 202 const struct atp_info *info; /* touchpad model */ 203 - bool open; 204 203 bool valid; /* are the samples valid? */ 205 204 bool size_detect_done; 206 205 bool overflow_warned; ··· 799 800 if (usb_submit_urb(dev->urb, GFP_KERNEL)) 800 801 return -EIO; 801 802 802 - dev->open = true; 803 803 return 0; 804 804 } 805 805 ··· 808 810 809 811 usb_kill_urb(dev->urb); 810 812 cancel_work_sync(&dev->work); 811 - dev->open = false; 812 813 } 813 814 814 815 static int atp_handle_geyser(struct atp *dev) ··· 960 963 if (error) 961 964 return error; 962 965 963 - if (dev->open && usb_submit_urb(dev->urb, GFP_KERNEL)) 966 + guard(mutex)(&dev->input->mutex); 967 + if (input_device_enabled(dev->input) && usb_submit_urb(dev->urb, GFP_KERNEL)) 964 968 return -EIO; 965 969 966 970 return 0; ··· 979 981 { 980 982 struct atp *dev = usb_get_intfdata(iface); 981 983 982 - if (dev->open && usb_submit_urb(dev->urb, GFP_KERNEL)) 984 + guard(mutex)(&dev->input->mutex); 985 + if (input_device_enabled(dev->input) && usb_submit_urb(dev->urb, GFP_KERNEL)) 983 986 return -EIO; 984 987 985 988 return 0;
+2 -4
drivers/input/mouse/byd.c
··· 314 314 break; 315 315 } 316 316 default: 317 - psmouse_warn(psmouse, 318 - "Unrecognized Z: pkt = %02x %02x %02x %02x\n", 319 - psmouse->packet[0], psmouse->packet[1], 320 - psmouse->packet[2], psmouse->packet[3]); 317 + psmouse_warn(psmouse, "Unrecognized Z: pkt = %*ph\n", 318 + 4, psmouse->packet); 321 319 return PSMOUSE_BAD_DATA; 322 320 } 323 321
-3
drivers/input/mouse/cyapa.c
··· 403 403 } 404 404 405 405 pm_runtime_get_sync(dev); 406 - pm_runtime_mark_last_busy(dev); 407 406 pm_runtime_put_sync_autosuspend(dev); 408 407 out: 409 408 mutex_unlock(&cyapa->state_sync_lock); ··· 665 666 pm_runtime_enable(dev); 666 667 667 668 pm_runtime_get_sync(dev); 668 - pm_runtime_mark_last_busy(dev); 669 669 pm_runtime_put_sync_autosuspend(dev); 670 670 } 671 671 ··· 708 710 * process. 709 711 */ 710 712 pm_runtime_get_sync(dev); 711 - pm_runtime_mark_last_busy(dev); 712 713 pm_runtime_put_sync_autosuspend(dev); 713 714 } 714 715
-1
drivers/input/mouse/cyapa_gen5.c
··· 2833 2833 * process. 2834 2834 */ 2835 2835 pm_runtime_get_sync(dev); 2836 - pm_runtime_mark_last_busy(dev); 2837 2836 pm_runtime_put_sync_autosuspend(dev); 2838 2837 return 0; 2839 2838 } else if (report_id != PIP_TOUCH_REPORT_ID &&
+1 -1
drivers/input/mouse/psmouse-smbus.c
··· 299 299 { 300 300 int error; 301 301 302 - psmouse_smbus_wq = alloc_workqueue("psmouse-smbus", 0, 0); 302 + psmouse_smbus_wq = alloc_workqueue("psmouse-smbus", WQ_UNBOUND, 0); 303 303 if (!psmouse_smbus_wq) 304 304 return -ENOMEM; 305 305
+98 -123
drivers/input/mouse/synaptics_i2c.c
··· 240 240 */ 241 241 static s32 synaptics_i2c_reg_get(struct i2c_client *client, u16 reg) 242 242 { 243 - int ret; 243 + int error; 244 244 245 - ret = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8); 246 - if (ret == 0) 247 - ret = i2c_smbus_read_byte_data(client, reg & 0xff); 245 + error = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8); 246 + if (error) 247 + return error; 248 248 249 - return ret; 249 + return i2c_smbus_read_byte_data(client, reg & 0xff); 250 250 } 251 251 252 252 static s32 synaptics_i2c_reg_set(struct i2c_client *client, u16 reg, u8 val) 253 253 { 254 - int ret; 254 + int error; 255 255 256 - ret = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8); 257 - if (ret == 0) 258 - ret = i2c_smbus_write_byte_data(client, reg & 0xff, val); 256 + error = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8); 257 + if (error) 258 + return error; 259 259 260 - return ret; 260 + error = i2c_smbus_write_byte_data(client, reg & 0xff, val); 261 + if (error) 262 + return error; 263 + 264 + return error; 261 265 } 262 266 263 267 static s32 synaptics_i2c_word_get(struct i2c_client *client, u16 reg) 264 268 { 265 - int ret; 269 + int error; 266 270 267 - ret = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8); 268 - if (ret == 0) 269 - ret = i2c_smbus_read_word_data(client, reg & 0xff); 271 + error = i2c_smbus_write_byte_data(client, PAGE_SEL_REG, reg >> 8); 272 + if (error) 273 + return error; 270 274 271 - return ret; 275 + return i2c_smbus_read_word_data(client, reg & 0xff); 272 276 } 273 277 274 278 static int synaptics_i2c_config(struct i2c_client *client) 275 279 { 276 - int ret, control; 280 + int control; 281 + int error; 277 282 u8 int_en; 278 283 279 284 /* set Report Rate to Device Highest (>=80) and Sleep to normal */ 280 - ret = synaptics_i2c_reg_set(client, DEV_CONTROL_REG, 0xc1); 281 - if (ret) 282 - return ret; 285 + error = synaptics_i2c_reg_set(client, DEV_CONTROL_REG, 0xc1); 286 + if (error) 287 + return error; 283 288 284 289 /* set Interrupt Disable to Func20 / Enable to Func10) */ 285 290 int_en = (polling_req) ? 0 : INT_ENA_ABS_MSK | INT_ENA_REL_MSK; 286 - ret = synaptics_i2c_reg_set(client, INTERRUPT_EN_REG, int_en); 287 - if (ret) 288 - return ret; 291 + error = synaptics_i2c_reg_set(client, INTERRUPT_EN_REG, int_en); 292 + if (error) 293 + return error; 289 294 290 295 control = synaptics_i2c_reg_get(client, GENERAL_2D_CONTROL_REG); 291 296 /* No Deceleration */ ··· 299 294 control |= reduce_report ? 1 << REDUCE_REPORTING : 0; 300 295 /* No Filter */ 301 296 control |= no_filter ? 1 << NO_FILTER : 0; 302 - ret = synaptics_i2c_reg_set(client, GENERAL_2D_CONTROL_REG, control); 303 - if (ret) 304 - return ret; 297 + error = synaptics_i2c_reg_set(client, GENERAL_2D_CONTROL_REG, control); 298 + if (error) 299 + return error; 305 300 306 301 return 0; 307 302 } 308 303 309 304 static int synaptics_i2c_reset_config(struct i2c_client *client) 310 305 { 311 - int ret; 306 + int error; 312 307 313 308 /* Reset the Touchpad */ 314 - ret = synaptics_i2c_reg_set(client, DEV_COMMAND_REG, RESET_COMMAND); 315 - if (ret) { 309 + error = synaptics_i2c_reg_set(client, DEV_COMMAND_REG, RESET_COMMAND); 310 + if (error) { 316 311 dev_err(&client->dev, "Unable to reset device\n"); 317 - } else { 318 - usleep_range(SOFT_RESET_DELAY_US, SOFT_RESET_DELAY_US + 100); 319 - ret = synaptics_i2c_config(client); 320 - if (ret) 321 - dev_err(&client->dev, "Unable to config device\n"); 312 + return error; 322 313 } 323 314 324 - return ret; 315 + usleep_range(SOFT_RESET_DELAY_US, SOFT_RESET_DELAY_US + 100); 316 + error = synaptics_i2c_config(client); 317 + if (error) { 318 + dev_err(&client->dev, "Unable to config device\n"); 319 + return error; 320 + } 321 + 322 + return 0; 325 323 } 326 324 327 325 static int synaptics_i2c_check_error(struct i2c_client *client) 328 326 { 329 - int status, ret = 0; 327 + int status; 328 + int error; 330 329 331 330 status = i2c_smbus_read_byte_data(client, DEVICE_STATUS_REG) & 332 331 (CONFIGURED_MSK | ERROR_MSK); 333 332 334 - if (status != CONFIGURED_MSK) 335 - ret = synaptics_i2c_reset_config(client); 333 + if (status != CONFIGURED_MSK) { 334 + error = synaptics_i2c_reset_config(client); 335 + if (error) 336 + return error; 337 + } 336 338 337 - return ret; 339 + return 0; 338 340 } 339 341 340 342 static bool synaptics_i2c_get_input(struct synaptics_i2c *touch) ··· 384 372 { 385 373 struct synaptics_i2c *touch = dev_id; 386 374 387 - mod_delayed_work(system_wq, &touch->dwork, 0); 375 + mod_delayed_work(system_dfl_wq, &touch->dwork, 0); 388 376 389 377 return IRQ_HANDLED; 390 378 } ··· 433 421 delay = NO_DATA_SLEEP_MSECS; 434 422 } 435 423 return msecs_to_jiffies(delay); 436 - } else { 437 - delay = msecs_to_jiffies(THREAD_IRQ_SLEEP_MSECS); 438 - return round_jiffies_relative(delay); 439 424 } 425 + 426 + delay = msecs_to_jiffies(THREAD_IRQ_SLEEP_MSECS); 427 + return round_jiffies_relative(delay); 440 428 } 441 429 442 430 /* Work Handler */ ··· 460 448 * We poll the device once in THREAD_IRQ_SLEEP_SECS and 461 449 * if error is detected, we try to reset and reconfigure the touchpad. 462 450 */ 463 - mod_delayed_work(system_wq, &touch->dwork, delay); 451 + mod_delayed_work(system_dfl_wq, &touch->dwork, delay); 464 452 } 465 453 466 454 static int synaptics_i2c_open(struct input_dev *input) 467 455 { 468 456 struct synaptics_i2c *touch = input_get_drvdata(input); 469 - int ret; 457 + int error; 470 458 471 - ret = synaptics_i2c_reset_config(touch->client); 472 - if (ret) 473 - return ret; 459 + error = synaptics_i2c_reset_config(touch->client); 460 + if (error) 461 + return error; 474 462 475 463 if (polling_req) 476 - mod_delayed_work(system_wq, &touch->dwork, 477 - msecs_to_jiffies(NO_DATA_SLEEP_MSECS)); 464 + mod_delayed_work(system_dfl_wq, &touch->dwork, 465 + msecs_to_jiffies(NO_DATA_SLEEP_MSECS)); 478 466 479 467 return 0; 480 468 } ··· 501 489 input->id.bustype = BUS_I2C; 502 490 input->id.version = synaptics_i2c_word_get(touch->client, 503 491 INFO_QUERY_REG0); 504 - input->dev.parent = &touch->client->dev; 505 492 input->open = synaptics_i2c_open; 506 493 input->close = synaptics_i2c_close; 507 494 input_set_drvdata(input, touch); 508 495 509 496 /* Register the device as mouse */ 510 - __set_bit(EV_REL, input->evbit); 511 - __set_bit(REL_X, input->relbit); 512 - __set_bit(REL_Y, input->relbit); 497 + input_set_capability(input, EV_REL, REL_X); 498 + input_set_capability(input, EV_REL, REL_Y); 513 499 514 500 /* Register device's buttons and keys */ 515 - __set_bit(EV_KEY, input->evbit); 516 - __set_bit(BTN_LEFT, input->keybit); 501 + input_set_capability(input, EV_KEY, BTN_LEFT); 517 502 } 518 503 519 - static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *client) 504 + static int synaptics_i2c_probe(struct i2c_client *client) 520 505 { 506 + struct device *dev = &client->dev; 521 507 struct synaptics_i2c *touch; 508 + int error; 522 509 523 - touch = kzalloc(sizeof(*touch), GFP_KERNEL); 510 + touch = devm_kzalloc(dev, sizeof(*touch), GFP_KERNEL); 524 511 if (!touch) 525 - return NULL; 512 + return -ENOMEM; 526 513 527 514 touch->client = client; 528 515 touch->no_decel_param = no_decel; ··· 529 518 set_scan_rate(touch, scan_rate); 530 519 INIT_DELAYED_WORK(&touch->dwork, synaptics_i2c_work_handler); 531 520 532 - return touch; 533 - } 521 + error = synaptics_i2c_reset_config(client); 522 + if (error) 523 + return error; 534 524 535 - static int synaptics_i2c_probe(struct i2c_client *client) 536 - { 537 - int ret; 538 - struct synaptics_i2c *touch; 539 - 540 - touch = synaptics_i2c_touch_create(client); 541 - if (!touch) 542 - return -ENOMEM; 543 - 544 - ret = synaptics_i2c_reset_config(client); 545 - if (ret) 546 - goto err_mem_free; 547 - 548 - if (client->irq < 1) 525 + if (client->irq <= 0) 549 526 polling_req = true; 550 527 551 - touch->input = input_allocate_device(); 552 - if (!touch->input) { 553 - ret = -ENOMEM; 554 - goto err_mem_free; 555 - } 528 + touch->input = devm_input_allocate_device(dev); 529 + if (!touch->input) 530 + return -ENOMEM; 556 531 557 532 synaptics_i2c_set_input_params(touch); 558 533 559 534 if (!polling_req) { 560 - dev_dbg(&touch->client->dev, 561 - "Requesting IRQ: %d\n", touch->client->irq); 535 + dev_dbg(dev, "Requesting IRQ: %d\n", client->irq); 562 536 563 - ret = request_irq(touch->client->irq, synaptics_i2c_irq, 564 - IRQ_TYPE_EDGE_FALLING, 565 - DRIVER_NAME, touch); 566 - if (ret) { 567 - dev_warn(&touch->client->dev, 568 - "IRQ request failed: %d, " 569 - "falling back to polling\n", ret); 537 + error = devm_request_irq(dev, client->irq, synaptics_i2c_irq, 538 + IRQ_TYPE_EDGE_FALLING, 539 + DRIVER_NAME, touch); 540 + if (error) { 541 + dev_warn(dev, "IRQ request failed: %d, falling back to polling\n", 542 + error); 570 543 polling_req = true; 571 - synaptics_i2c_reg_set(touch->client, 572 - INTERRUPT_EN_REG, 0); 544 + synaptics_i2c_reg_set(client, INTERRUPT_EN_REG, 0); 573 545 } 574 546 } 575 547 576 548 if (polling_req) 577 - dev_dbg(&touch->client->dev, 578 - "Using polling at rate: %d times/sec\n", scan_rate); 549 + dev_dbg(dev, "Using polling at rate: %d times/sec\n", scan_rate); 579 550 580 551 /* Register the device in input subsystem */ 581 - ret = input_register_device(touch->input); 582 - if (ret) { 583 - dev_err(&client->dev, 584 - "Input device register failed: %d\n", ret); 585 - goto err_input_free; 552 + error = input_register_device(touch->input); 553 + if (error) { 554 + dev_err(dev, "Input device register failed: %d\n", error); 555 + return error; 586 556 } 587 557 588 558 i2c_set_clientdata(client, touch); 589 559 590 560 return 0; 591 - 592 - err_input_free: 593 - input_free_device(touch->input); 594 - err_mem_free: 595 - kfree(touch); 596 - 597 - return ret; 598 - } 599 - 600 - static void synaptics_i2c_remove(struct i2c_client *client) 601 - { 602 - struct synaptics_i2c *touch = i2c_get_clientdata(client); 603 - 604 - if (!polling_req) 605 - free_irq(client->irq, touch); 606 - 607 - input_unregister_device(touch->input); 608 - kfree(touch); 609 561 } 610 562 611 563 static int synaptics_i2c_suspend(struct device *dev) ··· 586 612 587 613 static int synaptics_i2c_resume(struct device *dev) 588 614 { 589 - int ret; 590 615 struct i2c_client *client = to_i2c_client(dev); 591 616 struct synaptics_i2c *touch = i2c_get_clientdata(client); 617 + struct input_dev *input = touch->input; 618 + int error; 592 619 593 - ret = synaptics_i2c_reset_config(client); 594 - if (ret) 595 - return ret; 620 + error = synaptics_i2c_reset_config(client); 621 + if (error) 622 + return error; 596 623 597 - mod_delayed_work(system_wq, &touch->dwork, 598 - msecs_to_jiffies(NO_DATA_SLEEP_MSECS)); 624 + guard(mutex)(&input->mutex); 625 + if (input_device_enabled(input)) 626 + mod_delayed_work(system_dfl_wq, &touch->dwork, 627 + msecs_to_jiffies(NO_DATA_SLEEP_MSECS)); 599 628 600 629 return 0; 601 630 } ··· 628 651 }, 629 652 630 653 .probe = synaptics_i2c_probe, 631 - .remove = synaptics_i2c_remove, 632 - 633 654 .id_table = synaptics_i2c_id_table, 634 655 }; 635 656
+1 -1
drivers/input/serio/altera_ps2.c
··· 81 81 struct serio *serio; 82 82 int error, irq; 83 83 84 - ps2if = devm_kzalloc(&pdev->dev, sizeof(struct ps2if), GFP_KERNEL); 84 + ps2if = devm_kzalloc(&pdev->dev, sizeof(*ps2if), GFP_KERNEL); 85 85 if (!ps2if) 86 86 return -ENOMEM; 87 87
+7 -7
drivers/input/serio/apbps2.c
··· 67 67 rxflags = (status & APBPS2_STATUS_PE) ? SERIO_PARITY : 0; 68 68 rxflags |= (status & APBPS2_STATUS_FE) ? SERIO_FRAME : 0; 69 69 70 - /* clear error bits? */ 70 + /* Clear error bits */ 71 71 if (rxflags) 72 72 iowrite32be(0, &priv->regs->status); 73 73 ··· 82 82 static int apbps2_write(struct serio *io, unsigned char val) 83 83 { 84 84 struct apbps2_priv *priv = io->port_data; 85 - unsigned int tleft = 10000; /* timeout in 100ms */ 85 + unsigned int tleft = 10000; /* Timeout in 100ms */ 86 86 87 - /* delay until PS/2 controller has room for more chars */ 87 + /* Delay until PS/2 controller has room for more chars */ 88 88 while ((ioread32be(&priv->regs->status) & APBPS2_STATUS_TF) && tleft--) 89 89 udelay(10); 90 90 ··· 104 104 struct apbps2_priv *priv = io->port_data; 105 105 int limit; 106 106 107 - /* clear error flags */ 107 + /* Clear error flags */ 108 108 iowrite32be(0, &priv->regs->status); 109 109 110 110 /* Clear old data if available (unlikely) */ ··· 112 112 while ((ioread32be(&priv->regs->status) & APBPS2_STATUS_DR) && --limit) 113 113 ioread32be(&priv->regs->data); 114 114 115 - /* Enable reciever and it's interrupt */ 115 + /* Enable receiver and its interrupt */ 116 116 iowrite32be(APBPS2_CTRL_RE | APBPS2_CTRL_RI, &priv->regs->ctrl); 117 117 118 118 return 0; ··· 122 122 { 123 123 struct apbps2_priv *priv = io->port_data; 124 124 125 - /* stop interrupts at PS/2 HW level */ 125 + /* Stop interrupts at PS/2 HW level */ 126 126 iowrite32be(0, &priv->regs->ctrl); 127 127 } 128 128 ··· 139 139 return -ENOMEM; 140 140 } 141 141 142 - /* Find Device Address */ 142 + /* Find device address */ 143 143 priv->regs = devm_platform_get_and_ioremap_resource(ofdev, 0, NULL); 144 144 if (IS_ERR(priv->regs)) 145 145 return PTR_ERR(priv->regs);
+1 -2
drivers/input/serio/arc_ps2.c
··· 189 189 if (irq < 0) 190 190 return -EINVAL; 191 191 192 - arc_ps2 = devm_kzalloc(&pdev->dev, sizeof(struct arc_ps2_data), 193 - GFP_KERNEL); 192 + arc_ps2 = devm_kzalloc(&pdev->dev, sizeof(*arc_ps2), GFP_KERNEL); 194 193 if (!arc_ps2) { 195 194 dev_err(&pdev->dev, "out of memory\n"); 196 195 return -ENOMEM;
+1 -1
drivers/input/serio/olpc_apsp.c
··· 171 171 struct olpc_apsp *priv; 172 172 int error; 173 173 174 - priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL); 174 + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 175 175 if (!priv) 176 176 return -ENOMEM; 177 177
+2 -2
drivers/input/touchscreen/dynapro.c
··· 119 119 120 120 pdynapro->serio = serio; 121 121 pdynapro->dev = input_dev; 122 - snprintf(pdynapro->phys, sizeof(pdynapro->phys), 123 - "%s/input0", serio->phys); 122 + scnprintf(pdynapro->phys, sizeof(pdynapro->phys), 123 + "%s/input0", serio->phys); 124 124 125 125 input_dev->name = "Dynapro Serial TouchScreen"; 126 126 input_dev->phys = pdynapro->phys;
+6
drivers/input/touchscreen/edt-ft5x06.c
··· 1475 1475 .max_support_points = 5, 1476 1476 }; 1477 1477 1478 + static const struct edt_i2c_chip_data edt_ft3518_data = { 1479 + .max_support_points = 10, 1480 + }; 1481 + 1478 1482 static const struct edt_i2c_chip_data edt_ft5452_data = { 1479 1483 .max_support_points = 5, 1480 1484 }; ··· 1507 1503 { .name = "edt-ft5x06", .driver_data = (long)&edt_ft5x06_data }, 1508 1504 { .name = "edt-ft5506", .driver_data = (long)&edt_ft5506_data }, 1509 1505 { .name = "ev-ft5726", .driver_data = (long)&edt_ft5506_data }, 1506 + { .name = "ft3518", .driver_data = (long)&edt_ft3518_data }, 1510 1507 { .name = "ft5452", .driver_data = (long)&edt_ft5452_data }, 1511 1508 /* Note no edt- prefix for compatibility with the ft6236.c driver */ 1512 1509 { .name = "ft6236", .driver_data = (long)&edt_ft6236_data }, ··· 1524 1519 { .compatible = "edt,edt-ft5406", .data = &edt_ft5x06_data }, 1525 1520 { .compatible = "edt,edt-ft5506", .data = &edt_ft5506_data }, 1526 1521 { .compatible = "evervision,ev-ft5726", .data = &edt_ft5506_data }, 1522 + { .compatible = "focaltech,ft3518", .data = &edt_ft3518_data }, 1527 1523 { .compatible = "focaltech,ft5426", .data = &edt_ft5506_data }, 1528 1524 { .compatible = "focaltech,ft5452", .data = &edt_ft5452_data }, 1529 1525 /* Note focaltech vendor prefix for compatibility with ft6236.c */
+1 -2
drivers/input/touchscreen/egalax_ts_serial.c
··· 108 108 109 109 egalax->serio = serio; 110 110 egalax->input = input_dev; 111 - snprintf(egalax->phys, sizeof(egalax->phys), 112 - "%s/input0", serio->phys); 111 + scnprintf(egalax->phys, sizeof(egalax->phys), "%s/input0", serio->phys); 113 112 114 113 input_dev->name = "EETI eGalaxTouch Serial TouchScreen"; 115 114 input_dev->phys = egalax->phys;
+1 -1
drivers/input/touchscreen/elo.c
··· 320 320 elo->expected_packet = ELO10_TOUCH_PACKET; 321 321 mutex_init(&elo->cmd_mutex); 322 322 init_completion(&elo->cmd_done); 323 - snprintf(elo->phys, sizeof(elo->phys), "%s/input0", serio->phys); 323 + scnprintf(elo->phys, sizeof(elo->phys), "%s/input0", serio->phys); 324 324 325 325 input_dev->name = "Elo Serial TouchScreen"; 326 326 input_dev->phys = elo->phys;
+1 -2
drivers/input/touchscreen/fujitsu_ts.c
··· 108 108 109 109 fujitsu->serio = serio; 110 110 fujitsu->dev = input_dev; 111 - snprintf(fujitsu->phys, sizeof(fujitsu->phys), 112 - "%s/input0", serio->phys); 111 + scnprintf(fujitsu->phys, sizeof(fujitsu->phys), "%s/input0", serio->phys); 113 112 114 113 input_dev->name = "Fujitsu Serial Touchscreen"; 115 114 input_dev->phys = fujitsu->phys;
+1 -1
drivers/input/touchscreen/gunze.c
··· 106 106 107 107 gunze->serio = serio; 108 108 gunze->dev = input_dev; 109 - snprintf(gunze->phys, sizeof(serio->phys), "%s/input0", serio->phys); 109 + scnprintf(gunze->phys, sizeof(serio->phys), "%s/input0", serio->phys); 110 110 111 111 input_dev->name = "Gunze AHL-51S TouchScreen"; 112 112 input_dev->phys = gunze->phys;
+2 -2
drivers/input/touchscreen/hampshire.c
··· 118 118 119 119 phampshire->serio = serio; 120 120 phampshire->dev = input_dev; 121 - snprintf(phampshire->phys, sizeof(phampshire->phys), 122 - "%s/input0", serio->phys); 121 + scnprintf(phampshire->phys, sizeof(phampshire->phys), 122 + "%s/input0", serio->phys); 123 123 124 124 input_dev->name = "Hampshire Serial TouchScreen"; 125 125 input_dev->phys = phampshire->phys;
+60 -36
drivers/input/touchscreen/ili210x.c
··· 327 327 return contact; 328 328 } 329 329 330 - static irqreturn_t ili210x_irq(int irq, void *irq_data) 330 + static void ili210x_process_events(struct ili210x *priv) 331 331 { 332 - struct ili210x *priv = irq_data; 333 332 struct i2c_client *client = priv->client; 334 333 const struct ili2xxx_chip *chip = priv->chip; 335 334 u8 touchdata[ILI210X_DATA_SIZE] = { 0 }; ··· 355 356 usleep_range(time_delta, time_delta + 1000); 356 357 } 357 358 } while (!priv->stop && keep_polling); 359 + } 360 + 361 + static irqreturn_t ili210x_irq(int irq, void *irq_data) 362 + { 363 + struct ili210x *priv = irq_data; 364 + 365 + ili210x_process_events(priv); 358 366 359 367 return IRQ_HANDLED; 368 + }; 369 + 370 + static void ili210x_work_i2c_poll(struct input_dev *input) 371 + { 372 + struct ili210x *priv = input_get_drvdata(input); 373 + 374 + ili210x_process_events(priv); 360 375 } 361 376 362 377 static int ili251x_firmware_update_resolution(struct device *dev) ··· 842 829 return 0; 843 830 } 844 831 832 + static ssize_t ili210x_firmware_update(struct device *dev, const u8 *fwbuf, 833 + u16 ac_end, u16 df_end) 834 + { 835 + struct i2c_client *client = to_i2c_client(dev); 836 + struct ili210x *priv = i2c_get_clientdata(client); 837 + const char *fwname = ILI251X_FW_FILENAME; 838 + int error; 839 + 840 + dev_dbg(dev, "Firmware update started, firmware=%s\n", fwname); 841 + 842 + ili210x_hardware_reset(priv->reset_gpio); 843 + 844 + error = ili210x_do_firmware_update(priv, fwbuf, ac_end, df_end); 845 + 846 + ili210x_hardware_reset(priv->reset_gpio); 847 + 848 + dev_dbg(dev, "Firmware update ended, error=%i\n", error); 849 + 850 + return error; 851 + } 852 + 845 853 static ssize_t ili210x_firmware_update_store(struct device *dev, 846 854 struct device_attribute *attr, 847 855 const char *buf, size_t count) 848 856 { 849 857 struct i2c_client *client = to_i2c_client(dev); 850 - struct ili210x *priv = i2c_get_clientdata(client); 851 858 const char *fwname = ILI251X_FW_FILENAME; 852 859 u16 ac_end, df_end; 853 860 int error; ··· 893 860 * the touch controller to disable the IRQs during update, so we have 894 861 * to do it this way here. 895 862 */ 896 - scoped_guard(disable_irq, &client->irq) { 897 - dev_dbg(dev, "Firmware update started, firmware=%s\n", fwname); 898 - 899 - ili210x_hardware_reset(priv->reset_gpio); 900 - 901 - error = ili210x_do_firmware_update(priv, fwbuf, ac_end, df_end); 902 - 903 - ili210x_hardware_reset(priv->reset_gpio); 904 - 905 - dev_dbg(dev, "Firmware update ended, error=%i\n", error); 863 + if (client->irq > 0) { 864 + guard(disable_irq)(&client->irq); 865 + error = ili210x_firmware_update(dev, fwbuf, ac_end, df_end); 866 + } else { 867 + error = ili210x_firmware_update(dev, fwbuf, ac_end, df_end); 906 868 } 907 869 908 870 return error ?: count; ··· 970 942 chip = device_get_match_data(dev); 971 943 if (!chip && id) 972 944 chip = (const struct ili2xxx_chip *)id->driver_data; 973 - if (!chip) { 974 - dev_err(&client->dev, "unknown device model\n"); 975 - return -ENODEV; 976 - } 977 - 978 - if (client->irq <= 0) { 979 - dev_err(dev, "No IRQ!\n"); 980 - return -EINVAL; 981 - } 945 + if (!chip) 946 + return dev_err_probe(&client->dev, -ENODEV, "unknown device model\n"); 982 947 983 948 reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); 984 949 if (IS_ERR(reset_gpio)) ··· 1019 998 1020 999 error = input_mt_init_slots(input, priv->chip->max_touches, 1021 1000 INPUT_MT_DIRECT); 1022 - if (error) { 1023 - dev_err(dev, "Unable to set up slots, err: %d\n", error); 1024 - return error; 1025 - } 1001 + if (error) 1002 + return dev_err_probe(dev, error, "Unable to set up slots\n"); 1026 1003 1027 - error = devm_request_threaded_irq(dev, client->irq, NULL, ili210x_irq, 1028 - IRQF_ONESHOT, client->name, priv); 1029 - if (error) { 1030 - dev_err(dev, "Unable to request touchscreen IRQ, err: %d\n", 1031 - error); 1032 - return error; 1004 + input_set_drvdata(input, priv); 1005 + 1006 + if (client->irq > 0) { 1007 + error = devm_request_threaded_irq(dev, client->irq, NULL, ili210x_irq, 1008 + IRQF_ONESHOT, client->name, priv); 1009 + if (error) 1010 + return dev_err_probe(dev, error, "Unable to request touchscreen IRQ\n"); 1011 + } else { 1012 + error = input_setup_polling(input, ili210x_work_i2c_poll); 1013 + if (error) 1014 + return dev_err_probe(dev, error, "Could not set up polling mode\n"); 1015 + 1016 + input_set_poll_interval(input, ILI2XXX_POLL_PERIOD); 1033 1017 } 1034 1018 1035 1019 error = devm_add_action_or_reset(dev, ili210x_stop, priv); ··· 1042 1016 return error; 1043 1017 1044 1018 error = input_register_device(priv->input); 1045 - if (error) { 1046 - dev_err(dev, "Cannot register input device, err: %d\n", error); 1047 - return error; 1048 - } 1019 + if (error) 1020 + return dev_err_probe(dev, error, "Cannot register input device\n"); 1049 1021 1050 1022 return 0; 1051 1023 }
+5 -5
drivers/input/touchscreen/ilitek_ts_i2c.c
··· 122 122 return error; 123 123 } 124 124 if (delay > 0) 125 - mdelay(delay); 125 + fsleep(delay * 1000); 126 126 127 127 if (read_len > 0) { 128 128 error = i2c_transfer(client->adapter, msgs + 1, 1); ··· 396 396 static void ilitek_reset(struct ilitek_ts_data *ts, int delay) 397 397 { 398 398 if (ts->reset_gpio) { 399 - gpiod_set_value(ts->reset_gpio, 1); 400 - mdelay(10); 401 - gpiod_set_value(ts->reset_gpio, 0); 402 - mdelay(delay); 399 + gpiod_set_value_cansleep(ts->reset_gpio, 1); 400 + fsleep(10000); 401 + gpiod_set_value_cansleep(ts->reset_gpio, 0); 402 + fsleep(delay * 1000); 403 403 } 404 404 } 405 405
+1 -1
drivers/input/touchscreen/inexio.c
··· 123 123 124 124 pinexio->serio = serio; 125 125 pinexio->dev = input_dev; 126 - snprintf(pinexio->phys, sizeof(pinexio->phys), "%s/input0", serio->phys); 126 + scnprintf(pinexio->phys, sizeof(pinexio->phys), "%s/input0", serio->phys); 127 127 128 128 input_dev->name = "iNexio Serial TouchScreen"; 129 129 input_dev->phys = pinexio->phys;
+1 -1
drivers/input/touchscreen/mtouch.c
··· 137 137 138 138 mtouch->serio = serio; 139 139 mtouch->dev = input_dev; 140 - snprintf(mtouch->phys, sizeof(mtouch->phys), "%s/input0", serio->phys); 140 + scnprintf(mtouch->phys, sizeof(mtouch->phys), "%s/input0", serio->phys); 141 141 142 142 input_dev->name = "MicroTouch Serial TouchScreen"; 143 143 input_dev->phys = mtouch->phys;
-5
drivers/input/touchscreen/novatek-nvt-ts.c
··· 27 27 #define NVT_TS_PARAMS_MAX_TOUCH 0x09 28 28 #define NVT_TS_PARAMS_MAX_BUTTONS 0x0a 29 29 #define NVT_TS_PARAMS_IRQ_TYPE 0x0b 30 - #define NVT_TS_PARAMS_WAKE_TYPE 0x0c 31 30 #define NVT_TS_PARAMS_CHIP_ID 0x0e 32 31 #define NVT_TS_PARAMS_SIZE 0x0f 33 32 ··· 48 49 }; 49 50 50 51 struct nvt_ts_i2c_chip_data { 51 - u8 wake_type; 52 52 u8 chip_id; 53 53 }; 54 54 ··· 259 261 if (width > NVT_TS_MAX_SIZE || height >= NVT_TS_MAX_SIZE || 260 262 data->max_touches > NVT_TS_MAX_TOUCHES || 261 263 irq_type >= ARRAY_SIZE(nvt_ts_irq_type) || 262 - data->buf[NVT_TS_PARAMS_WAKE_TYPE] != chip->wake_type || 263 264 data->buf[NVT_TS_PARAMS_CHIP_ID] != chip->chip_id) { 264 265 dev_err(dev, "Unsupported touchscreen parameters: %*ph\n", 265 266 NVT_TS_PARAMS_SIZE, data->buf); ··· 311 314 } 312 315 313 316 static const struct nvt_ts_i2c_chip_data nvt_nt11205_ts_data = { 314 - .wake_type = 0x05, 315 317 .chip_id = 0x05, 316 318 }; 317 319 318 320 static const struct nvt_ts_i2c_chip_data nvt_nt36672a_ts_data = { 319 - .wake_type = 0x01, 320 321 .chip_id = 0x08, 321 322 }; 322 323
+1 -1
drivers/input/touchscreen/penmount.c
··· 208 208 209 209 pm->serio = serio; 210 210 pm->dev = input_dev; 211 - snprintf(pm->phys, sizeof(pm->phys), "%s/input0", serio->phys); 211 + scnprintf(pm->phys, sizeof(pm->phys), "%s/input0", serio->phys); 212 212 pm->maxcontacts = 1; 213 213 214 214 input_dev->name = "PenMount Serial TouchScreen";
+9 -12
drivers/input/touchscreen/stmfts.c
··· 120 120 err = regulator_enable(sdata->ledvdd); 121 121 if (err) { 122 122 dev_warn(&sdata->client->dev, 123 - "failed to disable ledvdd regulator: %d\n", 123 + "failed to enable ledvdd regulator: %d\n", 124 124 err); 125 125 return err; 126 126 } ··· 141 141 142 142 /* 143 143 * We can't simply use i2c_smbus_read_i2c_block_data because we 144 - * need to read more than 255 bytes ( 144 + * need to read 256 bytes, which exceeds the 255-byte SMBus block limit. 145 145 */ 146 146 static int stmfts_read_events(struct stmfts_data *sdata) 147 147 { ··· 410 410 { 411 411 struct stmfts_data *sdata = dev_get_drvdata(dev); 412 412 413 - return sprintf(buf, "%#x\n", sdata->chip_id); 413 + return sysfs_emit(buf, "%#x\n", sdata->chip_id); 414 414 } 415 415 416 416 static ssize_t stmfts_sysfs_chip_version(struct device *dev, ··· 418 418 { 419 419 struct stmfts_data *sdata = dev_get_drvdata(dev); 420 420 421 - return sprintf(buf, "%u\n", sdata->chip_ver); 421 + return sysfs_emit(buf, "%u\n", sdata->chip_ver); 422 422 } 423 423 424 424 static ssize_t stmfts_sysfs_fw_ver(struct device *dev, ··· 426 426 { 427 427 struct stmfts_data *sdata = dev_get_drvdata(dev); 428 428 429 - return sprintf(buf, "%u\n", sdata->fw_ver); 429 + return sysfs_emit(buf, "%u\n", sdata->fw_ver); 430 430 } 431 431 432 432 static ssize_t stmfts_sysfs_config_id(struct device *dev, ··· 434 434 { 435 435 struct stmfts_data *sdata = dev_get_drvdata(dev); 436 436 437 - return sprintf(buf, "%#x\n", sdata->config_id); 437 + return sysfs_emit(buf, "%#x\n", sdata->config_id); 438 438 } 439 439 440 440 static ssize_t stmfts_sysfs_config_version(struct device *dev, ··· 442 442 { 443 443 struct stmfts_data *sdata = dev_get_drvdata(dev); 444 444 445 - return sprintf(buf, "%u\n", sdata->config_ver); 445 + return sysfs_emit(buf, "%u\n", sdata->config_ver); 446 446 } 447 447 448 448 static ssize_t stmfts_sysfs_read_status(struct device *dev, ··· 457 457 if (err) 458 458 return err; 459 459 460 - return sprintf(buf, "%#02x\n", status[0]); 460 + return sysfs_emit(buf, "%#02x\n", status[0]); 461 461 } 462 462 463 463 static ssize_t stmfts_sysfs_hover_enable_read(struct device *dev, ··· 465 465 { 466 466 struct stmfts_data *sdata = dev_get_drvdata(dev); 467 467 468 - return sprintf(buf, "%u\n", sdata->hover_enabled); 468 + return sysfs_emit(buf, "%u\n", sdata->hover_enabled); 469 469 } 470 470 471 471 static ssize_t stmfts_sysfs_hover_enable_write(struct device *dev, ··· 594 594 sdata->regulators); 595 595 } 596 596 597 - /* This function is void because I don't want to prevent using the touch key 598 - * only because the LEDs don't get registered 599 - */ 600 597 static int stmfts_enable_led(struct stmfts_data *sdata) 601 598 { 602 599 int err;
+2 -2
drivers/input/touchscreen/touchit213.c
··· 148 148 149 149 touchit213->serio = serio; 150 150 touchit213->dev = input_dev; 151 - snprintf(touchit213->phys, sizeof(touchit213->phys), 152 - "%s/input0", serio->phys); 151 + scnprintf(touchit213->phys, sizeof(touchit213->phys), 152 + "%s/input0", serio->phys); 153 153 154 154 input_dev->name = "Sahara Touch-iT213 Serial TouchScreen"; 155 155 input_dev->phys = touchit213->phys;
+1 -1
drivers/input/touchscreen/touchright.c
··· 111 111 112 112 tr->serio = serio; 113 113 tr->dev = input_dev; 114 - snprintf(tr->phys, sizeof(tr->phys), "%s/input0", serio->phys); 114 + scnprintf(tr->phys, sizeof(tr->phys), "%s/input0", serio->phys); 115 115 116 116 input_dev->name = "Touchright Serial TouchScreen"; 117 117 input_dev->phys = tr->phys;
+1 -1
drivers/input/touchscreen/touchwin.c
··· 118 118 119 119 tw->serio = serio; 120 120 tw->dev = input_dev; 121 - snprintf(tw->phys, sizeof(tw->phys), "%s/input0", serio->phys); 121 + scnprintf(tw->phys, sizeof(tw->phys), "%s/input0", serio->phys); 122 122 123 123 input_dev->name = "Touchwindow Serial TouchScreen"; 124 124 input_dev->phys = tw->phys;
+1 -1
drivers/input/touchscreen/tsc40.c
··· 92 92 93 93 ptsc->serio = serio; 94 94 ptsc->dev = input_dev; 95 - snprintf(ptsc->phys, sizeof(ptsc->phys), "%s/input0", serio->phys); 95 + scnprintf(ptsc->phys, sizeof(ptsc->phys), "%s/input0", serio->phys); 96 96 97 97 input_dev->name = "TSC-10/25/40 Serial TouchScreen"; 98 98 input_dev->phys = ptsc->phys;
+4 -10
drivers/input/touchscreen/wdt87xx_i2c.c
··· 1026 1026 int error; 1027 1027 1028 1028 input = devm_input_allocate_device(dev); 1029 - if (!input) { 1030 - dev_err(dev, "failed to allocate input device\n"); 1029 + if (!input) 1031 1030 return -ENOMEM; 1032 - } 1033 1031 wdt->input = input; 1034 1032 1035 1033 input->name = "WDT87xx Touchscreen"; ··· 1051 1053 INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); 1052 1054 1053 1055 error = input_register_device(input); 1054 - if (error) { 1055 - dev_err(dev, "failed to register input device: %d\n", error); 1056 - return error; 1057 - } 1056 + if (error) 1057 + return dev_err_probe(dev, error, "failed to register input device\n"); 1058 1058 1059 1059 return 0; 1060 1060 } ··· 1092 1096 NULL, wdt87xx_ts_interrupt, 1093 1097 IRQF_ONESHOT, 1094 1098 client->name, wdt); 1095 - if (error) { 1096 - dev_err(&client->dev, "request irq failed: %d\n", error); 1099 + if (error) 1097 1100 return error; 1098 - } 1099 1101 1100 1102 return 0; 1101 1103 }
-180
include/linux/input/adp5589.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Analog Devices ADP5589/ADP5585 I/O Expander and QWERTY Keypad Controller 4 - * 5 - * Copyright 2010-2011 Analog Devices Inc. 6 - */ 7 - 8 - #ifndef _ADP5589_H 9 - #define _ADP5589_H 10 - 11 - /* 12 - * ADP5589 specific GPI and Keymap defines 13 - */ 14 - 15 - #define ADP5589_KEYMAPSIZE 88 16 - 17 - #define ADP5589_GPI_PIN_ROW0 97 18 - #define ADP5589_GPI_PIN_ROW1 98 19 - #define ADP5589_GPI_PIN_ROW2 99 20 - #define ADP5589_GPI_PIN_ROW3 100 21 - #define ADP5589_GPI_PIN_ROW4 101 22 - #define ADP5589_GPI_PIN_ROW5 102 23 - #define ADP5589_GPI_PIN_ROW6 103 24 - #define ADP5589_GPI_PIN_ROW7 104 25 - #define ADP5589_GPI_PIN_COL0 105 26 - #define ADP5589_GPI_PIN_COL1 106 27 - #define ADP5589_GPI_PIN_COL2 107 28 - #define ADP5589_GPI_PIN_COL3 108 29 - #define ADP5589_GPI_PIN_COL4 109 30 - #define ADP5589_GPI_PIN_COL5 110 31 - #define ADP5589_GPI_PIN_COL6 111 32 - #define ADP5589_GPI_PIN_COL7 112 33 - #define ADP5589_GPI_PIN_COL8 113 34 - #define ADP5589_GPI_PIN_COL9 114 35 - #define ADP5589_GPI_PIN_COL10 115 36 - #define GPI_LOGIC1 116 37 - #define GPI_LOGIC2 117 38 - 39 - #define ADP5589_GPI_PIN_ROW_BASE ADP5589_GPI_PIN_ROW0 40 - #define ADP5589_GPI_PIN_ROW_END ADP5589_GPI_PIN_ROW7 41 - #define ADP5589_GPI_PIN_COL_BASE ADP5589_GPI_PIN_COL0 42 - #define ADP5589_GPI_PIN_COL_END ADP5589_GPI_PIN_COL10 43 - 44 - #define ADP5589_GPI_PIN_BASE ADP5589_GPI_PIN_ROW_BASE 45 - #define ADP5589_GPI_PIN_END ADP5589_GPI_PIN_COL_END 46 - 47 - #define ADP5589_GPIMAPSIZE_MAX (ADP5589_GPI_PIN_END - ADP5589_GPI_PIN_BASE + 1) 48 - 49 - /* 50 - * ADP5585 specific GPI and Keymap defines 51 - */ 52 - 53 - #define ADP5585_KEYMAPSIZE 30 54 - 55 - #define ADP5585_GPI_PIN_ROW0 37 56 - #define ADP5585_GPI_PIN_ROW1 38 57 - #define ADP5585_GPI_PIN_ROW2 39 58 - #define ADP5585_GPI_PIN_ROW3 40 59 - #define ADP5585_GPI_PIN_ROW4 41 60 - #define ADP5585_GPI_PIN_ROW5 42 61 - #define ADP5585_GPI_PIN_COL0 43 62 - #define ADP5585_GPI_PIN_COL1 44 63 - #define ADP5585_GPI_PIN_COL2 45 64 - #define ADP5585_GPI_PIN_COL3 46 65 - #define ADP5585_GPI_PIN_COL4 47 66 - #define GPI_LOGIC 48 67 - 68 - #define ADP5585_GPI_PIN_ROW_BASE ADP5585_GPI_PIN_ROW0 69 - #define ADP5585_GPI_PIN_ROW_END ADP5585_GPI_PIN_ROW5 70 - #define ADP5585_GPI_PIN_COL_BASE ADP5585_GPI_PIN_COL0 71 - #define ADP5585_GPI_PIN_COL_END ADP5585_GPI_PIN_COL4 72 - 73 - #define ADP5585_GPI_PIN_BASE ADP5585_GPI_PIN_ROW_BASE 74 - #define ADP5585_GPI_PIN_END ADP5585_GPI_PIN_COL_END 75 - 76 - #define ADP5585_GPIMAPSIZE_MAX (ADP5585_GPI_PIN_END - ADP5585_GPI_PIN_BASE + 1) 77 - 78 - struct adp5589_gpi_map { 79 - unsigned short pin; 80 - unsigned short sw_evt; 81 - }; 82 - 83 - /* scan_cycle_time */ 84 - #define ADP5589_SCAN_CYCLE_10ms 0 85 - #define ADP5589_SCAN_CYCLE_20ms 1 86 - #define ADP5589_SCAN_CYCLE_30ms 2 87 - #define ADP5589_SCAN_CYCLE_40ms 3 88 - 89 - /* RESET_CFG */ 90 - #define RESET_PULSE_WIDTH_500us 0 91 - #define RESET_PULSE_WIDTH_1ms 1 92 - #define RESET_PULSE_WIDTH_2ms 2 93 - #define RESET_PULSE_WIDTH_10ms 3 94 - 95 - #define RESET_TRIG_TIME_0ms (0 << 2) 96 - #define RESET_TRIG_TIME_1000ms (1 << 2) 97 - #define RESET_TRIG_TIME_1500ms (2 << 2) 98 - #define RESET_TRIG_TIME_2000ms (3 << 2) 99 - #define RESET_TRIG_TIME_2500ms (4 << 2) 100 - #define RESET_TRIG_TIME_3000ms (5 << 2) 101 - #define RESET_TRIG_TIME_3500ms (6 << 2) 102 - #define RESET_TRIG_TIME_4000ms (7 << 2) 103 - 104 - #define RESET_PASSTHRU_EN (1 << 5) 105 - #define RESET1_POL_HIGH (1 << 6) 106 - #define RESET1_POL_LOW (0 << 6) 107 - #define RESET2_POL_HIGH (1 << 7) 108 - #define RESET2_POL_LOW (0 << 7) 109 - 110 - /* ADP5589 Mask Bits: 111 - * C C C C C C C C C C C | R R R R R R R R 112 - * 1 9 8 7 6 5 4 3 2 1 0 | 7 6 5 4 3 2 1 0 113 - * 0 114 - * ---------------- BIT ------------------ 115 - * 1 1 1 1 1 1 1 1 1 0 0 | 0 0 0 0 0 0 0 0 116 - * 8 7 6 5 4 3 2 1 0 9 8 | 7 6 5 4 3 2 1 0 117 - */ 118 - 119 - #define ADP_ROW(x) (1 << (x)) 120 - #define ADP_COL(x) (1 << (x + 8)) 121 - #define ADP5589_ROW_MASK 0xFF 122 - #define ADP5589_COL_MASK 0xFF 123 - #define ADP5589_COL_SHIFT 8 124 - #define ADP5589_MAX_ROW_NUM 7 125 - #define ADP5589_MAX_COL_NUM 10 126 - 127 - /* ADP5585 Mask Bits: 128 - * C C C C C | R R R R R R 129 - * 4 3 2 1 0 | 5 4 3 2 1 0 130 - * 131 - * ---- BIT -- ----------- 132 - * 1 0 0 0 0 | 0 0 0 0 0 0 133 - * 0 9 8 7 6 | 5 4 3 2 1 0 134 - */ 135 - 136 - #define ADP5585_ROW_MASK 0x3F 137 - #define ADP5585_COL_MASK 0x1F 138 - #define ADP5585_ROW_SHIFT 0 139 - #define ADP5585_COL_SHIFT 6 140 - #define ADP5585_MAX_ROW_NUM 5 141 - #define ADP5585_MAX_COL_NUM 4 142 - 143 - #define ADP5585_ROW(x) (1 << ((x) & ADP5585_ROW_MASK)) 144 - #define ADP5585_COL(x) (1 << (((x) & ADP5585_COL_MASK) + ADP5585_COL_SHIFT)) 145 - 146 - /* Put one of these structures in i2c_board_info platform_data */ 147 - 148 - struct adp5589_kpad_platform_data { 149 - unsigned keypad_en_mask; /* Keypad (Rows/Columns) enable mask */ 150 - const unsigned short *keymap; /* Pointer to keymap */ 151 - unsigned short keymapsize; /* Keymap size */ 152 - bool repeat; /* Enable key repeat */ 153 - bool en_keylock; /* Enable key lock feature (ADP5589 only)*/ 154 - unsigned char unlock_key1; /* Unlock Key 1 (ADP5589 only) */ 155 - unsigned char unlock_key2; /* Unlock Key 2 (ADP5589 only) */ 156 - unsigned char unlock_timer; /* Time in seconds [0..7] between the two unlock keys 0=disable (ADP5589 only) */ 157 - unsigned char scan_cycle_time; /* Time between consecutive scan cycles */ 158 - unsigned char reset_cfg; /* Reset config */ 159 - unsigned short reset1_key_1; /* Reset Key 1 */ 160 - unsigned short reset1_key_2; /* Reset Key 2 */ 161 - unsigned short reset1_key_3; /* Reset Key 3 */ 162 - unsigned short reset2_key_1; /* Reset Key 1 */ 163 - unsigned short reset2_key_2; /* Reset Key 2 */ 164 - unsigned debounce_dis_mask; /* Disable debounce mask */ 165 - unsigned pull_dis_mask; /* Disable all pull resistors mask */ 166 - unsigned pullup_en_100k; /* Pull-Up 100k Enable Mask */ 167 - unsigned pullup_en_300k; /* Pull-Up 300k Enable Mask */ 168 - unsigned pulldown_en_300k; /* Pull-Down 300k Enable Mask */ 169 - const struct adp5589_gpi_map *gpimap; 170 - unsigned short gpimapsize; 171 - const struct adp5589_gpio_platform_data *gpio_data; 172 - }; 173 - 174 - struct i2c_client; /* forward declaration */ 175 - 176 - struct adp5589_gpio_platform_data { 177 - int gpio_start; /* GPIO Chip base # */ 178 - }; 179 - 180 - #endif