diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2014-07-24 16:58:06 +0200 |
---|---|---|
committer | Stefan Agner <stefan.agner@toradex.com> | 2014-07-24 17:21:20 +0200 |
commit | 1a8719ced11deafcbd78bb407d823208158409e6 (patch) | |
tree | f3cde5ebeb121b4dbd3056a195c403eaaf8d71ca /drivers | |
parent | 6a535bf81ef09e11dc8ddde5cebc11d6cf4296bd (diff) |
colibri-vf50-ts: add min_pressure parameter
Add parameter to define the minimal pressure required to be interpreted
as a touch event. Also filter out unusual high pressure since this
means there is no touch screen connected.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/touchscreen/colibri-vf50-ts.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/colibri-vf50-ts.c b/drivers/input/touchscreen/colibri-vf50-ts.c index bc42253f778b..48c101142abc 100644 --- a/drivers/input/touchscreen/colibri-vf50-ts.c +++ b/drivers/input/touchscreen/colibri-vf50-ts.c @@ -34,6 +34,8 @@ #define COLI_TOUCH_MIN_DELAY_US 1000 #define COLI_TOUCH_MAX_DELAY_US 2000 +static int min_pressure = 200; + struct adc_touch_device { struct platform_device *pdev; @@ -165,6 +167,7 @@ static void adc_ts_work(struct work_struct *ts_work) val_p = 2000; } + val_p = 2000 - val_p; dev_dbg(dev, "Measured values: x: %d, y: %d, z1: %d, z2: %d, " "p: %d\n", val_x, val_y, val_z1, val_z2, val_p); @@ -172,13 +175,13 @@ static void adc_ts_work(struct work_struct *ts_work) * If touch pressure is too low, stop measuring and reenable * touch detection */ - if (val_p > 1800) + if (val_p < min_pressure || val_p > 2000) break; /* Report touch position and sleep for next measurement */ input_report_abs(adc_ts->ts_input, ABS_X, MVF_ADC_MAX - val_x); input_report_abs(adc_ts->ts_input, ABS_Y, MVF_ADC_MAX - val_y); - input_report_abs(adc_ts->ts_input, ABS_PRESSURE, 2000 - val_p); + input_report_abs(adc_ts->ts_input, ABS_PRESSURE, val_p); input_report_key(adc_ts->ts_input, BTN_TOUCH, 1); input_sync(adc_ts->ts_input); @@ -407,6 +410,8 @@ static void __exit adc_ts_exit(void) module_init(adc_ts_init); module_exit(adc_ts_exit); +module_param(min_pressure, int, 0600); +MODULE_PARM_DESC(min_pressure, "Minimum pressure for touch detection"); MODULE_AUTHOR("Stefan Agner"); MODULE_DESCRIPTION("Colibri VF50 Touchscreen driver"); MODULE_LICENSE("GPL v2"); |