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 | 36 +++++++++++++++++++------------ include/linux/spi/tsc2301.h | 8 +++++- 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/arch/arm/mach-omap2/board-n800.c b/arch/arm/mach-omap2/board-n800.c index b35bc56..40136d9 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_touch_pressure = 400; tsc2301_config.ts_stab_time = 100; + tsc2301_config.ts_pressure_max = 2048; + 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_ignore_last = 1; + tsc2301_config.ts_touch_pressure = 400; + tsc2301_config.ts_stab_time = 1000; + tsc2301_config.ts_pressure_max = 2048; + 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..52f9dc4 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 @@ -122,7 +122,7 @@ struct tsc2301_ts { int ignore_last : 1; u16 x_plate_ohm; int stab_time; - int max_pressure; + int p_max; int touch_pressure; int pressure_limit; @@ -334,7 +334,7 @@ static void tsc2301_ts_rx(void *arg) * touching the screen) we can't trust the coordinate values. */ if (pressure < ts->pressure_limit && x < MAX_12BIT && y < MAX_12BIT) { - ts->pressure_limit = ts->max_pressure; + ts->pressure_limit = ts->p_max; if (ts->ignore_last) { if (ts->sample_cnt) update_pen_state(ts, ts->x, ts->y, ts->p); @@ -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"); @@ -584,12 +586,18 @@ int __devinit tsc2301_ts_init(struct tsc2301 *tsc, spin_lock_init(&ts->lock); - 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->touch_pressure = pdata->ts_touch_pressure ? : ts->max_pressure; - ts->ignore_last = pdata->ts_ignore_last; - ts->stab_time = pdata->ts_stab_time; + ts->x_plate_ohm = pdata->ts_x_plate_ohm ? : 280; + ts->hw_avg_max = pdata->ts_hw_avg; + ts->stab_time = pdata->ts_stab_time; + ts->p_max = pdata->ts_pressure_max ? : MAX_12BIT; + ts->touch_pressure = pdata->ts_touch_pressure ? : ts->p_max; + ts->ignore_last = pdata->ts_ignore_last; + + 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"); @@ -613,9 +621,9 @@ 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->p_max, p_fudge, 0); tsc2301_ts_start_scan(tsc); diff --git a/include/linux/spi/tsc2301.h b/include/linux/spi/tsc2301.h index 059cc58..34dffc7 100644 --- a/include/linux/spi/tsc2301.h +++ b/include/linux/spi/tsc2301.h @@ -17,18 +17,22 @@ 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 0, 4, 8, 16 samples per reading */ - u32 ts_max_pressure;/* Samples with bigger pressure value will + u32 ts_pressure_max;/* Samples with bigger pressure value will be ignored, since the corresponding X, Y values are unreliable */ u32 ts_touch_pressure; /* Pressure limit until we report a 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