Add X, Y and P fudge and size parameters to the platform data. Update the n800 board file to reflect this. Signed-off-by: Klaus Pedersen <klaus.k.pedersen@xxxxxxxxx> --- arch/arm/mach-omap2/board-n800.c | 19 +++++++++++++++---- drivers/input/touchscreen/tsc2301_ts.c | 23 ++++++++++++++++------- include/linux/spi/tsc2301.h | 6 +++++- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-omap2/board-n800.c b/arch/arm/mach-omap2/board-n800.c index b35bc56..8bfc5c2 100644 --- a/arch/arm/mach-omap2/board-n800.c +++ b/arch/arm/mach-omap2/board-n800.c @@ -218,7 +218,6 @@ static int n800_get_keyb_irq_state(struct device *dev) static struct tsc2301_platform_data tsc2301_config = { .reset_gpio = 118, .dav_gpio = 103, - .pen_int_gpio = 106, .keymap = { -1, /* Event for bit 0 */ KEY_UP, /* Event for bit 1 (up) */ @@ -333,14 +332,26 @@ static void __init n800_ts_set_config(void) tsc2301_config.ts_x_plate_ohm = 180; tsc2301_config.ts_hw_avg = 4; tsc2301_config.ts_ignore_last = 1; - tsc2301_config.ts_max_pressure = 255; + tsc2301_config.ts_max_pressure = 2048; + tsc2301_config.ts_touch_pressure = 400; tsc2301_config.ts_stab_time = 100; + tsc2301_config.ts_pressure_fudge = 2; + tsc2301_config.ts_x_max = 4096; + tsc2301_config.ts_x_fudge = 4; + tsc2301_config.ts_y_max = 4096; + tsc2301_config.ts_y_fudge = 7; } else if (strcmp(conf->panel_name, "ls041y3") == 0) { tsc2301_config.ts_x_plate_ohm = 280; tsc2301_config.ts_hw_avg = 16; - tsc2301_config.ts_touch_pressure= 215; - tsc2301_config.ts_max_pressure = 255; + tsc2301_config.ts_touch_pressure = 400; + tsc2301_config.ts_max_pressure = 2048; tsc2301_config.ts_ignore_last = 1; + tsc2301_config.ts_stab_time = 1000; + tsc2301_config.ts_pressure_fudge = 2; + tsc2301_config.ts_x_max = 4096; + tsc2301_config.ts_x_fudge = 4; + tsc2301_config.ts_y_max = 4096; + tsc2301_config.ts_y_fudge = 7; } else { printk(KERN_ERR "Unknown panel type, set default " "touchscreen configuration\n"); diff --git a/drivers/input/touchscreen/tsc2301_ts.c b/drivers/input/touchscreen/tsc2301_ts.c index fa42f21..633aa38 100644 --- a/drivers/input/touchscreen/tsc2301_ts.c +++ b/drivers/input/touchscreen/tsc2301_ts.c @@ -39,13 +39,13 @@ * * Initialize: * Request access to GPIO103 (DAV) - * tsc2301_dav_irq_handler will trigger when DAV line goes down + * tsc2301_ts_irq_handler will trigger when DAV line goes down * * 1) Pen is pressed against touchscreeen * 2) TSC2301 performs AD conversion * 3) After the conversion is done TSC2301 drives DAV line down - * 4) GPIO IRQ is received and tsc2301_dav_irq_handler is called - * 5) tsc2301_dav_irq_handler sets up tsc2301_ts_timer in TSC2301_TS_SCAN_TIME + * 4) GPIO IRQ is received and tsc2301_ts_irq_handler is called + * 5) tsc2301_ts_irq_handler sets up tsc2301_ts_timer in TSC2301_TS_SCAN_TIME * 6) tsc2301_ts_timer disables the irq and requests spi driver * to read X, Y, Z1 and Z2 * 7) SPI framework calls tsc2301_ts_rx after the coordinates are read @@ -556,6 +556,8 @@ int __devinit tsc2301_ts_init(struct tsc2301 *tsc, struct tsc2301_ts *ts; struct input_dev *idev; int dav_gpio, r; + int x_max, y_max; + int x_fudge, y_fudge, p_fudge; if (pdata->dav_gpio < 0) { dev_err(&tsc->spi->dev, "need DAV GPIO"); @@ -586,11 +588,17 @@ int __devinit tsc2301_ts_init(struct tsc2301 *tsc, ts->x_plate_ohm = pdata->ts_x_plate_ohm ? : 280; ts->hw_avg_max = pdata->ts_hw_avg; - ts->max_pressure= pdata->ts_max_pressure ? : MAX_12BIT; + ts->max_pressure = pdata->ts_max_pressure ? : MAX_12BIT; ts->touch_pressure = pdata->ts_touch_pressure ? : ts->max_pressure; ts->ignore_last = pdata->ts_ignore_last; ts->stab_time = pdata->ts_stab_time; + x_max = pdata->ts_x_max ? : 4096; + y_max = pdata->ts_y_max ? : 4096; + x_fudge = pdata->ts_x_fudge ? : 4; + y_fudge = pdata->ts_y_fudge ? : 8; + p_fudge = pdata->ts_pressure_fudge ? : 2; + if ((r = tsc2301_ts_check_config(ts, &ts->hw_flags))) { dev_err(&tsc->spi->dev, "invalid configuration\n"); goto err2; @@ -613,9 +621,10 @@ int __devinit tsc2301_ts_init(struct tsc2301 *tsc, tsc2301_ts_setup_spi_xfer(tsc); /* These parameters should perhaps be configurable? */ - input_set_abs_params(idev, ABS_X, 0, 4096, 0, 0); - input_set_abs_params(idev, ABS_Y, 0, 4096, 0, 0); - input_set_abs_params(idev, ABS_PRESSURE, 0, 1024, 0, 0); + input_set_abs_params(idev, ABS_X, 0, x_max, x_fudge, 0); + input_set_abs_params(idev, ABS_Y, 0, y_max, y_fudge, 0); + input_set_abs_params(idev, ABS_PRESSURE, 0, ts->max_pressure, + p_fudge, 0); tsc2301_ts_start_scan(tsc); diff --git a/include/linux/spi/tsc2301.h b/include/linux/spi/tsc2301.h index 059cc58..5533d89 100644 --- a/include/linux/spi/tsc2301.h +++ b/include/linux/spi/tsc2301.h @@ -17,7 +17,6 @@ struct tsc2301_platform_data { * Touchscreen */ s16 dav_gpio; - s16 pen_int_gpio; u16 ts_x_plate_ohm; u32 ts_stab_time; /* voltage settling time */ u8 ts_hw_avg; /* HW assiseted averaging. Can be @@ -29,6 +28,11 @@ struct tsc2301_platform_data { touch event. After that we switch to ts_max_pressure. */ unsigned ts_ignore_last : 1; + u32 ts_pressure_fudge; + u32 ts_x_max; + u32 ts_x_fudge; + u32 ts_y_max; + u32 ts_y_fudge; /* * Audio -- 1.5.3.3 - To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html