Hi,
I found out that either the current mxc_ts driver and the evtouch input
driver from xorg does not allow any kind of touchscreen calibration at all.
The xorg evtouch input driver claims to support calibration, but is only
a sort of boundary restrict thing. No linear scaling or offset
I added some module options to the mxc_ts driver in order to allow lineaer
scaling and offset calibration. The values are passed to the driver through
module parameters.
The code snippet from mxc_ts.c:
#include <asm/arch/pmic_adc.h>
#define MXC_TS_NAME "mxc_ts"
static int xmax = 908;
module_param(xmax, uint, 0);
MODULE_PARM_DESC(xmax, "Max x val");
static int xmin = 120;
module_param(xmin, uint, 0);
MODULE_PARM_DESC(xmin, "Min x val");
static int ymax = 928;
module_param(ymax, uint, 0);
MODULE_PARM_DESC(ymax, "Max y val");
static int ymin = 120;
module_param(ymin, uint, 0);
MODULE_PARM_DESC(ymin, "Min y val");
static int xres = 240;
module_param(xres, uint, 0);
MODULE_PARM_DESC(xres, "xres");
static int yres = 320;
module_param(yres, uint, 0);
MODULE_PARM_DESC(xres, "yres");
static struct input_dev *mxc_inputdev = NULL;
static u32 input_ts_installed;
static int ts_thread(void *arg)
{
t_touch_screen ts_sample;
s32 wait = 0;
daemonize("mxc_ts");
while (input_ts_installed) {
try_to_freeze();
memset(&ts_sample, 0, sizeof(t_touch_screen));
pmic_adc_get_touch_sample(&ts_sample, !wait);
{
int x, y;
x = (ts_sample.x_position-xmin)*xres/(xmax-xmin);
y = (ts_sample.y_position-ymin)*yres/(ymax-ymin);
if (ts_sample.x_position<xmin)
x = 0;
if (ts_sample.x_position>xmax)
x = xres;
if (ts_sample.y_position<ymin)
y = 0;
if (ts_sample.y_position>ymax)
y = yres;
input_report_abs(mxc_inputdev, ABS_X, x);
input_report_abs(mxc_inputdev, ABS_Y, y);
input_report_abs(mxc_inputdev, ABS_PRESSURE,
ts_sample.contact_resistance);
}
input_sync(mxc_inputdev);
wait = ts_sample.contact_resistance;
msleep(20);
}
return 0;
}
Best Regards,
jdr
|