aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/of_touchscreen.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-21 05:33:03 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-21 08:44:55 -0400
commit64131a87f2aae2ed9e05d8227c5b009ca6c50d98 (patch)
treefdea23fd59216120bf54a48c60ca24489a733f14 /drivers/input/touchscreen/of_touchscreen.c
parent676ee36be04985062522804c2de04f0764212be6 (diff)
parent2c33ce009ca2389dbf0535d0672214d09738e35e (diff)
Merge branch 'drm-next-merged' of git://people.freedesktop.org/~airlied/linux into v4l_for_linus
* 'drm-next-merged' of git://people.freedesktop.org/~airlied/linux: (9717 commits) media-bus: Fixup RGB444_1X12, RGB565_1X16, and YUV8_1X24 media bus format hexdump: avoid warning in test function fs: take i_mutex during prepare_binprm for set[ug]id executables smp: Fix error case handling in smp_call_function_*() iommu-common: Fix PARISC compile-time warnings sparc: Make LDC use common iommu poll management functions sparc: Make sparc64 use scalable lib/iommu-common.c functions Break up monolithic iommu table/lock into finer graularity pools and lock sparc: Revert generic IOMMU allocator. tools/power turbostat: correct dumped pkg-cstate-limit value tools/power turbostat: calculate TSC frequency from CPUID(0x15) on SKL tools/power turbostat: correct DRAM RAPL units on recent Xeon processors tools/power turbostat: Initial Skylake support tools/power turbostat: Use $(CURDIR) instead of $(PWD) and add support for O= option in Makefile tools/power turbostat: modprobe msr, if needed tools/power turbostat: dump MSR_TURBO_RATIO_LIMIT2 tools/power turbostat: use new MSR_TURBO_RATIO_LIMIT names Bluetooth: hidp: Fix regression with older userspace and flags validation config: Enable NEED_DMA_MAP_STATE by default when SWIOTLB is selected perf/x86/intel/pt: Fix and clean up error handling in pt_event_add() ... That solves several merge conflicts: Documentation/DocBook/media/v4l/subdev-formats.xml Documentation/devicetree/bindings/vendor-prefixes.txt drivers/staging/media/mn88473/mn88473.c include/linux/kconfig.h include/uapi/linux/media-bus-format.h The ones at subdev-formats.xml and media-bus-format.h are not trivial. That's why we opted to merge from DRM.
Diffstat (limited to 'drivers/input/touchscreen/of_touchscreen.c')
-rw-r--r--drivers/input/touchscreen/of_touchscreen.c62
1 files changed, 52 insertions, 10 deletions
diff --git a/drivers/input/touchscreen/of_touchscreen.c b/drivers/input/touchscreen/of_touchscreen.c
index f8f9b84230b1..b82b5207c78b 100644
--- a/drivers/input/touchscreen/of_touchscreen.c
+++ b/drivers/input/touchscreen/of_touchscreen.c
@@ -11,8 +11,41 @@
11 11
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/input.h> 13#include <linux/input.h>
14#include <linux/input/mt.h>
14#include <linux/input/touchscreen.h> 15#include <linux/input/touchscreen.h>
15 16
17static u32 of_get_optional_u32(struct device_node *np,
18 const char *property)
19{
20 u32 val = 0;
21
22 of_property_read_u32(np, property, &val);
23
24 return val;
25}
26
27static void touchscreen_set_params(struct input_dev *dev,
28 unsigned long axis,
29 int max, int fuzz)
30{
31 struct input_absinfo *absinfo;
32
33 if (!test_bit(axis, dev->absbit)) {
34 /*
35 * Emit a warning only if the axis is not a multitouch
36 * axis, which might not be set by the driver.
37 */
38 if (!input_is_mt_axis(axis))
39 dev_warn(&dev->dev,
40 "DT specifies parameters but the axis is not set up\n");
41 return;
42 }
43
44 absinfo = &dev->absinfo[axis];
45 absinfo->maximum = max;
46 absinfo->fuzz = fuzz;
47}
48
16/** 49/**
17 * touchscreen_parse_of_params - parse common touchscreen DT properties 50 * touchscreen_parse_of_params - parse common touchscreen DT properties
18 * @dev: device that should be parsed 51 * @dev: device that should be parsed
@@ -24,22 +57,31 @@
24void touchscreen_parse_of_params(struct input_dev *dev) 57void touchscreen_parse_of_params(struct input_dev *dev)
25{ 58{
26 struct device_node *np = dev->dev.parent->of_node; 59 struct device_node *np = dev->dev.parent->of_node;
27 struct input_absinfo *absinfo; 60 u32 maximum, fuzz;
28 61
29 input_alloc_absinfo(dev); 62 input_alloc_absinfo(dev);
30 if (!dev->absinfo) 63 if (!dev->absinfo)
31 return; 64 return;
32 65
33 absinfo = &dev->absinfo[ABS_X]; 66 maximum = of_get_optional_u32(np, "touchscreen-size-x");
34 of_property_read_u32(np, "touchscreen-size-x", &absinfo->maximum); 67 fuzz = of_get_optional_u32(np, "touchscreen-fuzz-x");
35 of_property_read_u32(np, "touchscreen-fuzz-x", &absinfo->fuzz); 68 if (maximum || fuzz) {
69 touchscreen_set_params(dev, ABS_X, maximum, fuzz);
70 touchscreen_set_params(dev, ABS_MT_POSITION_X, maximum, fuzz);
71 }
36 72
37 absinfo = &dev->absinfo[ABS_Y]; 73 maximum = of_get_optional_u32(np, "touchscreen-size-y");
38 of_property_read_u32(np, "touchscreen-size-y", &absinfo->maximum); 74 fuzz = of_get_optional_u32(np, "touchscreen-fuzz-y");
39 of_property_read_u32(np, "touchscreen-fuzz-y", &absinfo->fuzz); 75 if (maximum || fuzz) {
76 touchscreen_set_params(dev, ABS_Y, maximum, fuzz);
77 touchscreen_set_params(dev, ABS_MT_POSITION_Y, maximum, fuzz);
78 }
40 79
41 absinfo = &dev->absinfo[ABS_PRESSURE]; 80 maximum = of_get_optional_u32(np, "touchscreen-max-pressure");
42 of_property_read_u32(np, "touchscreen-max-pressure", &absinfo->maximum); 81 fuzz = of_get_optional_u32(np, "touchscreen-fuzz-pressure");
43 of_property_read_u32(np, "touchscreen-fuzz-pressure", &absinfo->fuzz); 82 if (maximum || fuzz) {
83 touchscreen_set_params(dev, ABS_PRESSURE, maximum, fuzz);
84 touchscreen_set_params(dev, ABS_MT_PRESSURE, maximum, fuzz);
85 }
44} 86}
45EXPORT_SYMBOL(touchscreen_parse_of_params); 87EXPORT_SYMBOL(touchscreen_parse_of_params);