]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
tsc2301 - Add x, y & p fudge
authorKlaus Pedersen <klaus.k.pedersen@nokia.com>
Fri, 15 Feb 2008 21:31:36 +0000 (23:31 +0200)
committerTony Lindgren <tony@atomide.com>
Thu, 21 Feb 2008 00:19:58 +0000 (16:19 -0800)
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@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/board-n800.c
drivers/input/touchscreen/tsc2301_ts.c
include/linux/spi/tsc2301.h

index b35bc56c568242292e26c76a30bb5f2fabdc1eb0..8bfc5c2c30e82eab4797b3412a6b3b9dbfa3c266 100644 (file)
@@ -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");
index fa42f21a6b95912c416974da1941370ab95d0880..633aa387898a80a63d7460919762ea2c50d44a3c 100644 (file)
  *
  * 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);
 
index 059cc5811f13f7b580eb6b1e71e34c212ecf53c4..5533d895acfb2d0bb7a511ab713434a936aa97dc 100644 (file)
@@ -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