diff options
| -rw-r--r-- | Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt | 27 | ||||
| -rw-r--r-- | drivers/input/touchscreen/Kconfig | 4 | ||||
| -rw-r--r-- | drivers/input/touchscreen/Makefile | 1 | ||||
| -rw-r--r-- | drivers/input/touchscreen/of_touchscreen.c | 45 | ||||
| -rw-r--r-- | include/linux/input/touchscreen.h | 22 |
5 files changed, 99 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt new file mode 100644 index 000000000000..d8e06163c54e --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | General Touchscreen Properties: | ||
| 2 | |||
| 3 | Optional properties for Touchscreens: | ||
| 4 | - touchscreen-size-x : horizontal resolution of touchscreen | ||
| 5 | (in pixels) | ||
| 6 | - touchscreen-size-y : vertical resolution of touchscreen | ||
| 7 | (in pixels) | ||
| 8 | - touchscreen-max-pressure : maximum reported pressure (arbitrary range | ||
| 9 | dependent on the controller) | ||
| 10 | - touchscreen-fuzz-x : horizontal noise value of the absolute input | ||
| 11 | device (in pixels) | ||
| 12 | - touchscreen-fuzz-y : vertical noise value of the absolute input | ||
| 13 | device (in pixels) | ||
| 14 | - touchscreen-fuzz-pressure : pressure noise value of the absolute input | ||
| 15 | device (arbitrary range dependent on the | ||
| 16 | controller) | ||
| 17 | - touchscreen-inverted-x : X axis is inverted (boolean) | ||
| 18 | - touchscreen-inverted-y : Y axis is inverted (boolean) | ||
| 19 | |||
| 20 | Deprecated properties for Touchscreens: | ||
| 21 | - x-size : deprecated name for touchscreen-size-x | ||
| 22 | - y-size : deprecated name for touchscreen-size-y | ||
| 23 | - moving-threshold : deprecated name for a combination of | ||
| 24 | touchscreen-fuzz-x and touchscreen-fuzz-y | ||
| 25 | - contact-threshold : deprecated name for touchscreen-fuzz-pressure | ||
| 26 | - x-invert : deprecated name for touchscreen-inverted-x | ||
| 27 | - y-invert : deprecated name for touchscreen-inverted-y | ||
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 43389c097b02..8e07fe8505fd 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
| @@ -11,6 +11,10 @@ menuconfig INPUT_TOUCHSCREEN | |||
| 11 | 11 | ||
| 12 | if INPUT_TOUCHSCREEN | 12 | if INPUT_TOUCHSCREEN |
| 13 | 13 | ||
| 14 | config OF_TOUCHSCREEN | ||
| 15 | def_tristate INPUT | ||
| 16 | depends on INPUT && OF | ||
| 17 | |||
| 14 | config TOUCHSCREEN_88PM860X | 18 | config TOUCHSCREEN_88PM860X |
| 15 | tristate "Marvell 88PM860x touchscreen" | 19 | tristate "Marvell 88PM860x touchscreen" |
| 16 | depends on MFD_88PM860X | 20 | depends on MFD_88PM860X |
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 71a97559ce68..4d479fb0a768 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | wm97xx-ts-y := wm97xx-core.o | 7 | wm97xx-ts-y := wm97xx-core.o |
| 8 | 8 | ||
| 9 | obj-$(CONFIG_OF_TOUCHSCREEN) += of_touchscreen.o | ||
| 9 | obj-$(CONFIG_TOUCHSCREEN_88PM860X) += 88pm860x-ts.o | 10 | obj-$(CONFIG_TOUCHSCREEN_88PM860X) += 88pm860x-ts.o |
| 10 | obj-$(CONFIG_TOUCHSCREEN_AD7877) += ad7877.o | 11 | obj-$(CONFIG_TOUCHSCREEN_AD7877) += ad7877.o |
| 11 | obj-$(CONFIG_TOUCHSCREEN_AD7879) += ad7879.o | 12 | obj-$(CONFIG_TOUCHSCREEN_AD7879) += ad7879.o |
diff --git a/drivers/input/touchscreen/of_touchscreen.c b/drivers/input/touchscreen/of_touchscreen.c new file mode 100644 index 000000000000..f8f9b84230b1 --- /dev/null +++ b/drivers/input/touchscreen/of_touchscreen.c | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | /* | ||
| 2 | * Generic DT helper functions for touchscreen devices | ||
| 3 | * | ||
| 4 | * Copyright (c) 2014 Sebastian Reichel <sre@kernel.org> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/of.h> | ||
| 13 | #include <linux/input.h> | ||
| 14 | #include <linux/input/touchscreen.h> | ||
| 15 | |||
| 16 | /** | ||
| 17 | * touchscreen_parse_of_params - parse common touchscreen DT properties | ||
| 18 | * @dev: device that should be parsed | ||
| 19 | * | ||
| 20 | * This function parses common DT properties for touchscreens and setups the | ||
| 21 | * input device accordingly. The function keeps previously setuped default | ||
| 22 | * values if no value is specified via DT. | ||
| 23 | */ | ||
| 24 | void touchscreen_parse_of_params(struct input_dev *dev) | ||
| 25 | { | ||
| 26 | struct device_node *np = dev->dev.parent->of_node; | ||
| 27 | struct input_absinfo *absinfo; | ||
| 28 | |||
| 29 | input_alloc_absinfo(dev); | ||
| 30 | if (!dev->absinfo) | ||
| 31 | return; | ||
| 32 | |||
| 33 | absinfo = &dev->absinfo[ABS_X]; | ||
| 34 | of_property_read_u32(np, "touchscreen-size-x", &absinfo->maximum); | ||
| 35 | of_property_read_u32(np, "touchscreen-fuzz-x", &absinfo->fuzz); | ||
| 36 | |||
| 37 | absinfo = &dev->absinfo[ABS_Y]; | ||
| 38 | of_property_read_u32(np, "touchscreen-size-y", &absinfo->maximum); | ||
| 39 | of_property_read_u32(np, "touchscreen-fuzz-y", &absinfo->fuzz); | ||
| 40 | |||
| 41 | absinfo = &dev->absinfo[ABS_PRESSURE]; | ||
| 42 | of_property_read_u32(np, "touchscreen-max-pressure", &absinfo->maximum); | ||
| 43 | of_property_read_u32(np, "touchscreen-fuzz-pressure", &absinfo->fuzz); | ||
| 44 | } | ||
| 45 | EXPORT_SYMBOL(touchscreen_parse_of_params); | ||
diff --git a/include/linux/input/touchscreen.h b/include/linux/input/touchscreen.h new file mode 100644 index 000000000000..08a5ef6e8f25 --- /dev/null +++ b/include/linux/input/touchscreen.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2014 Sebastian Reichel <sre@kernel.org> | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify it | ||
| 5 | * under the terms of the GNU General Public License version 2 as published by | ||
| 6 | * the Free Software Foundation. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifndef _TOUCHSCREEN_H | ||
| 10 | #define _TOUCHSCREEN_H | ||
| 11 | |||
| 12 | #include <linux/input.h> | ||
| 13 | |||
| 14 | #ifdef CONFIG_OF | ||
| 15 | void touchscreen_parse_of_params(struct input_dev *dev); | ||
| 16 | #else | ||
| 17 | static inline void touchscreen_parse_of_params(struct input_dev *dev) | ||
| 18 | { | ||
| 19 | } | ||
| 20 | #endif | ||
| 21 | |||
| 22 | #endif | ||
