File: of_touchscreen.c

package info (click to toggle)
linux 3.16.7-ckt4-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 736,636 kB
  • ctags: 2,374,727
  • sloc: ansic: 12,214,218; asm: 277,326; perl: 54,003; xml: 47,771; makefile: 30,483; sh: 8,035; python: 6,597; cpp: 5,124; yacc: 4,254; lex: 2,215; awk: 741; pascal: 231; lisp: 218; sed: 30
file content (45 lines) | stat: -rw-r--r-- 1,489 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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);