This post intends to present an overview of the touchscreen calibration process under Android.
Although for calibration to happen during first boot it's necessary to pass "calibration" argument to kernel, it's not at kernel level that calibration actually happens.
In user space, init parses the kernel command line and if "calibration" argument is found, init sets Android's property ro.calibration to "1".
init source code can be found under system/core/init/init.c
After init process has properly set ro.calibration property, init.rc file calls the ts_calibrator program, which reads the property value. In case the value is "0", the program exits immediately. In case the value is "1", the program loads the configuration screen to capture 3 points.
Once the coordinates for the three points have been read, ts_calibrator stores the information inside /data/system/calibration and sets the same values to the touchscreen driver using its calibration interface available at /sys/module/mxc_ts/parameters/calibration.
After first boot, as /data/system/calibration is already there, ts_calibrator only loads its values to the driver, avoiding the calibration screen to be shown.
If a new calibration needs to be forced, it's only necessary to reboot the board after removing /data/system/calibration file.
At kernel level, the touchscreen driver implementation can be found at: kernel_imx/drivers/input/touchscreen/mxc_ts.c. This is the module that implements the interface found at /sys/module/mxc_ts/parameters/calibration and also the correction mechanism based on calibration parameters.