Loading...
diff -raNu kernel.git/drivers/input/touchscreen/ucb1400_ts.c
linux-2.6.25-android-1.0_r1/drivers/input/touchscreen/ucb1400_ts.c
--- kernel.git/drivers/input/touchscreen/ucb1400_ts.c 2008-07-24
09:04:04.000000000 +0800
+++ linux-2.6.25-android-1.0_r1/drivers/input/touchscreen/ucb1400_ts.c      2009-05-15
17:07:      29.000000000 +0800
@@ -1,6 +1,9 @@
/*
 * Philips UCB1400 touchscreen driver
 *
+ * Author:      Mask 
+ * Modified:      April, 2009
+ *
* Author:      Nicolas Pitre
* Created:      September 25, 2006
* Copyright: MontaVista Software, Inc.
@@ -33,7 +36,6 @@
/*
 * Interesting UCB1400 AC-link registers
 */
-
#define UCB_IE_RIS            0x5e
#define UCB_IE_FAL            0x60
#define UCB_IE_STATUS       0x62
@@ -97,6 +99,10 @@
static int adcsync;
static int ts_delay = 55; /* us */
static int ts_delay_pressure; /* us */
+static u16 g_min_x = 90;
+static u16 g_min_y = 80;
+static u16 g_max_x = 920;
+static u16 g_max_y = 950;

static inline u16 ucb1400_reg_read(struct ucb1400 *ucb, u16 reg)
{
@@ -252,14 +258,28 @@

  static void ucb1400_ts_evt_add(struct input_dev *idev, u16 pressure, u16 x, u16 y)
  {
+/* it's hard code here, may be you should modify */
+      if(x > g_max_x)
+            x = g_max_x - 1;
+      else if(x  g_max_y)
+            y = g_max_y - 1;
+      else if(y ts_idev, p, x, y);
-                             timeout = msecs_to_jiffies(10);
+                            timeout = msecs_to_jiffies(0);
                  }

                  wait_event_freezable_timeout(ucb->ts_wait,
@@ -427,10 +447,12 @@
             unsigned long mask, timeout;

             mask = probe_irq_on();
+           /*

             /* Enable the ADC interrupt. */
             ucb1400_reg_write(ucb, UCB_IE_RIS, UCB_IE_ADC);
@@ -463,7 +485,10 @@
             /* Read triggered interrupt. */
             ucb->irq = probe_irq_off(mask);
             if (ucb->irq irq == NO_IRQ)
-                        return -ENODEV;
+           {
+                        ucb->irq = CREATOR_TOUCH_IRQ;
+                        //return -ENODEV;
+           }
             return 0;
 }
@@ -498,7 +523,8 @@
                         goto err_free_devs;
             }
-           error = request_irq(ucb->irq, ucb1400_hard_irq, IRQF_TRIGGER_RISING,
+           //error = request_irq(ucb->irq, ucb1400_hard_irq, IRQF_TRIGGER_RISING,
+           error = request_irq(ucb->irq, ucb1400_hard_irq, 0,
                                                     "UCB1400", ucb);
             if (error) {
                         printk(KERN_ERR "ucb1400: unable to grab irq%d: %d\n",
@@ -515,21 +541,27 @@
            idev->id.product = id;
            idev->open = ucb1400_ts_open;
            idev->close = ucb1400_ts_close;
-           idev->evbit[0] = BIT_MASK(EV_ABS);
+          set_bit(EV_KEY,idev->evbit);
+ set_bit(EV_ABS,idev->evbit);
+ set_bit(BTN_TOUCH,idev->keybit);

            ucb1400_adc_enable(ucb);
            x_res = ucb1400_ts_read_xres(ucb);
            y_res = ucb1400_ts_read_yres(ucb);
            ucb1400_adc_disable(ucb);
-          printk(KERN_DEBUG "UCB1400: x/y = %d/%d\n", x_res, y_res);
+          printk("UCB1400: x/y = %d/%d\n", x_res, y_res);
-          input_set_abs_params(idev, ABS_X, 0, x_res, 0, 0);
-          input_set_abs_params(idev, ABS_Y, 0, y_res, 0, 0);
-          input_set_abs_params(idev, ABS_PRESSURE, 0, 0, 0, 0);
+/* it's hard code here, may be you should modify */
+          input_set_abs_params(idev, ABS_X, 0, 240, 0, 0);
+          input_set_abs_params(idev, ABS_Y, 0, 320, 0, 0);
+          input_set_abs_params(idev, ABS_PRESSURE, 0, 1, 0, 0);


            error = input_register_device(idev);
            if (error)
+          {
+                         printk("%s:%s input_register_device FAIL\n",__FILE__,__func__);
                           goto err_free_irq;
+          }
            dev_set_drvdata(dev, ucb);
            return 0;
Loading...