From: Elvis D. <elv...@ma...> - 2009-05-17 00:28:38
|
Hi, On May 17, 2009, at 3:57 AM, David Vescovi wrote: > > Still wondering if the SPI input is an existing issue. > Anyone have the touch screen working? I've got the Samsung touchscreen working. I've had to modify the ADS7846 controller files as follows to improve the touchscreen response. Here is a patch file for the modifications to get a lighter response from the touchscreen. Best regards, Elvis diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/ board-overo.c index ea0f695..ad2094e 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c @@ -138,11 +138,17 @@ static int ads7846_get_pendown_state(void) static struct ads7846_platform_data ads7846_config = { .x_max = 0x0fff, .y_max = 0x0fff, - .x_plate_ohms = 180, +#if defined(CONFIG_PANEL_SAMSUNG_LTE430WQ_F0C) + .x_plate_ohms = CONFIG_PANEL_SAMSUNG_LTE430WQ_FOC_RESISTANCE_X_PLATE, + .y_plate_ohms = CONFIG_PANEL_SAMSUNG_LTE430WQ_FOC_RESISTANCE_Y_PLATE, +#else + .x_plate_ohms = 180, + .y_plate_ohms = 180, +#endif .pressure_max = 255, - .debounce_max = 10, - .debounce_tol = 3, - .debounce_rep = 1, + .debounce_max = CONFIG_TOUCHSCREEN_ADS7846_FILTER_DEBOUNCE_MAX, + .debounce_tol = CONFIG_TOUCHSCREEN_ADS7846_FILTER_DEBOUNCE_TOL, + .debounce_rep = CONFIG_TOUCHSCREEN_ADS7846_FILTER_DEBOUNCE_REP, .get_pendown_state = ads7846_get_pendown_state, .keep_vref_on = 1, }; diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/ touchscreen/Kconfig index 5bd3bfa..b1540f1 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -29,6 +29,31 @@ config TOUCHSCREEN_ADS7846 To compile this driver as a module, choose M here: the module will be called ads7846. +config TOUCHSCREEN_ADS7846_FILTER_DEBOUNCE_MAX + int "Touchscreen filter debounce max" + depends on TOUCHSCREEN_ADS7846 + range 1 50 + default 20 + help + Max number of additional readings per sample. + +config TOUCHSCREEN_ADS7846_FILTER_DEBOUNCE_TOL + int "Touchscreen filter debounce tollerance" + depends on TOUCHSCREEN_ADS7846 + range 1 150 + default 65 + help + Tolerance used for filtering the touchscreen. + +config TOUCHSCREEN_ADS7846_FILTER_DEBOUNCE_REP + int "Touchscreen filter debounce repetition" + depends on TOUCHSCREEN_ADS7846 + range 1 10 + default 1 + help + Additional consecutive good readings required after the + first two readings. + config TOUCHSCREEN_BITSY tristate "Compaq iPAQ H3600 (Bitsy) touchscreen" depends on SA1100_BITSY diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/ touchscreen/ads7846.c index a68b0a6..2d3b773 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -17,6 +17,8 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ + + #include <linux/hwmon.h> #include <linux/init.h> #include <linux/err.h> @@ -95,6 +97,7 @@ struct ads7846 { u16 vref_mv; u16 vref_delay_usecs; u16 x_plate_ohms; + u16 y_plate_ohms; u16 pressure_max; struct ads7846_packet *packet; @@ -533,7 +536,12 @@ static void ads7846_rx(void *ads) y = packet->tc.y; z1 = packet->tc.z1; z2 = packet->tc.z2; - +#ifdef VERBOSE + printk("ADS7846: Kernel settings x-plate:%d ohms, y-plate:%d ohms\n", + CONFIG_PANEL_SAMSUNG_LTE430WQ_FOC_RESISTANCE_X_PLATE, + CONFIG_PANEL_SAMSUNG_LTE430WQ_FOC_RESISTANCE_Y_PLATE); + printk("ADS7846: Sensor values x:%d, y:%d, z1:%d, z2:%d, x-plate:%d ohms, y-plate:%d ohms\n", x, y, z1, z2, ts->x_plate_ohms, ts- >y_plate_ohms); +#endif /* range filtering */ if (x == MAX_12BIT) x = 0; @@ -541,13 +549,17 @@ static void ads7846_rx(void *ads) if (ts->model == 7843) { Rt = ts->pressure_max / 2; } else if (likely(x && z1)) { - /* compute touch pressure resistance using equation #2 */ - Rt = z2; - Rt -= z1; - Rt *= x; + /* compute touch pressure resistance using + equation #2: Rt = ts->x_plate_ohms * (x / 4096) * ((z2 - z1) / z1) */ + Rt = z2; + Rt -= z1; Rt *= ts->x_plate_ohms; + Rt *= x; + Rt /= 4096; Rt /= z1; - Rt = (Rt + 2047) >> 12; +#ifdef VERBOSE + printk("ADS7846: computed touch pressure rt = %d\n", Rt); +#endif } else { Rt = 0; } @@ -558,7 +570,7 @@ static void ads7846_rx(void *ads) */ if (packet->tc.ignore || Rt > ts->pressure_max) { #ifdef VERBOSE - pr_debug("%s: ignored %d pressure %d\n", + printk("%s: ignored %d pressure %d\n", dev_name(&ts->spi->dev), packet->tc.ignore, Rt); #endif hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), @@ -927,6 +939,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) ts->model = pdata->model ? : 7846; ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100; ts->x_plate_ohms = pdata->x_plate_ohms ? : 400; + ts->y_plate_ohms = pdata->y_plate_ohms ? : 400; ts->pressure_max = pdata->pressure_max ? : ~0; if (pdata->filter != NULL) { diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/ omap2/displays/Kconfig index 3feecee..cfa6e34 100644 --- a/drivers/video/omap2/displays/Kconfig +++ b/drivers/video/omap2/displays/Kconfig @@ -13,6 +13,24 @@ config PANEL_SAMSUNG_LTE430WQ_F0C help LCD Panel used on Overo Palo43 +config PANEL_SAMSUNG_LTE430WQ_FOC_RESISTANCE_X_PLATE + int "LCD Panel X Plate Resistance in ohms" + depends on PANEL_SAMSUNG_LTE430WQ_F0C + range 100 900 + default 100 + help + LCD Panel X plate resistance in ohms, used for + calculating touchscreen pressure. + +config PANEL_SAMSUNG_LTE430WQ_FOC_RESISTANCE_Y_PLATE + int "LCD Panel Y Plate Resistance in ohms" + depends on PANEL_SAMSUNG_LTE430WQ_F0C + range 100 900 + default 100 + help + LCD Panel Y plate resistance in ohms, used for + calculating touchscreen pressure. + config PANEL_SHARP_LS037V7DW01 tristate "Sharp LS037V7DW01 LCD Panel" depends on OMAP2_DSS |