2 * Generic DT helper functions for touchscreen devices
4 * Copyright (c) 2014 Sebastian Reichel <sre@kernel.org>
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.
13 #include <linux/input.h>
14 #include <linux/input/touchscreen.h>
17 * touchscreen_parse_of_params - parse common touchscreen DT properties
18 * @dev: device that should be parsed
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.
24 void touchscreen_parse_of_params(struct input_dev
*dev
)
26 struct device_node
*np
= dev
->dev
.parent
->of_node
;
27 struct input_absinfo
*absinfo
;
29 input_alloc_absinfo(dev
);
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
);
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
);
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
);
45 EXPORT_SYMBOL(touchscreen_parse_of_params
);