-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Input: add common DT binding for touchscreens
Add common DT binding documentation for touchscreen devices and implement input_parse_touchscreen_of_params, which parses the common properties and configures the input device accordingly. The method currently does not interpret the axis inversion properties, since there is no matching flag in the generic linux input device. Reviewed-by: Pavel Machek <pavel@ucw.cz> Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
- Loading branch information
Sebastian Reichel
authored and
Dmitry Torokhov
committed
May 29, 2014
1 parent
50525cb
commit b98abe5
Showing
5 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
General Touchscreen Properties: | ||
|
||
Optional properties for Touchscreens: | ||
- touchscreen-size-x : horizontal resolution of touchscreen | ||
(in pixels) | ||
- touchscreen-size-y : vertical resolution of touchscreen | ||
(in pixels) | ||
- touchscreen-max-pressure : maximum reported pressure (arbitrary range | ||
dependent on the controller) | ||
- touchscreen-fuzz-x : horizontal noise value of the absolute input | ||
device (in pixels) | ||
- touchscreen-fuzz-y : vertical noise value of the absolute input | ||
device (in pixels) | ||
- touchscreen-fuzz-pressure : pressure noise value of the absolute input | ||
device (arbitrary range dependent on the | ||
controller) | ||
- touchscreen-inverted-x : X axis is inverted (boolean) | ||
- touchscreen-inverted-y : Y axis is inverted (boolean) | ||
|
||
Deprecated properties for Touchscreens: | ||
- x-size : deprecated name for touchscreen-size-x | ||
- y-size : deprecated name for touchscreen-size-y | ||
- moving-threshold : deprecated name for a combination of | ||
touchscreen-fuzz-x and touchscreen-fuzz-y | ||
- contact-threshold : deprecated name for touchscreen-fuzz-pressure | ||
- x-invert : deprecated name for touchscreen-inverted-x | ||
- y-invert : deprecated name for touchscreen-inverted-y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Generic DT helper functions for touchscreen devices | ||
* | ||
* Copyright (c) 2014 Sebastian Reichel <sre@kernel.org> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
* published by the Free Software Foundation. | ||
* | ||
*/ | ||
|
||
#include <linux/of.h> | ||
#include <linux/input.h> | ||
#include <linux/input/touchscreen.h> | ||
|
||
/** | ||
* touchscreen_parse_of_params - parse common touchscreen DT properties | ||
* @dev: device that should be parsed | ||
* | ||
* This function parses common DT properties for touchscreens and setups the | ||
* input device accordingly. The function keeps previously setuped default | ||
* values if no value is specified via DT. | ||
*/ | ||
void touchscreen_parse_of_params(struct input_dev *dev) | ||
{ | ||
struct device_node *np = dev->dev.parent->of_node; | ||
struct input_absinfo *absinfo; | ||
|
||
input_alloc_absinfo(dev); | ||
if (!dev->absinfo) | ||
return; | ||
|
||
absinfo = &dev->absinfo[ABS_X]; | ||
of_property_read_u32(np, "touchscreen-size-x", &absinfo->maximum); | ||
of_property_read_u32(np, "touchscreen-fuzz-x", &absinfo->fuzz); | ||
|
||
absinfo = &dev->absinfo[ABS_Y]; | ||
of_property_read_u32(np, "touchscreen-size-y", &absinfo->maximum); | ||
of_property_read_u32(np, "touchscreen-fuzz-y", &absinfo->fuzz); | ||
|
||
absinfo = &dev->absinfo[ABS_PRESSURE]; | ||
of_property_read_u32(np, "touchscreen-max-pressure", &absinfo->maximum); | ||
of_property_read_u32(np, "touchscreen-fuzz-pressure", &absinfo->fuzz); | ||
} | ||
EXPORT_SYMBOL(touchscreen_parse_of_params); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2014 Sebastian Reichel <sre@kernel.org> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License version 2 as published by | ||
* the Free Software Foundation. | ||
*/ | ||
|
||
#ifndef _TOUCHSCREEN_H | ||
#define _TOUCHSCREEN_H | ||
|
||
#include <linux/input.h> | ||
|
||
#ifdef CONFIG_OF | ||
void touchscreen_parse_of_params(struct input_dev *dev); | ||
#else | ||
static inline void touchscreen_parse_of_params(struct input_dev *dev) | ||
{ | ||
} | ||
#endif | ||
|
||
#endif |