IMX31 Touch Screen problem

35 views
Skip to first unread message

Justin

unread,
Mar 18, 2009, 6:05:15 AM3/18/09
to android-porting
Hail to all experts,

I'm trying to get the touch screen working on IMX31 3 stack boards. At
"kernel/drivers/input/touchscreen/mxc_ts.c" placed printf to test the
touchscreen respond/coordinate input.

Well I notice the output x-coor is inverted, everything else looks
fine.
Kernel is reading the input, but not the Android OS.

I tried the suggestion of:
http://groups.google.com/group/android-porting/browse_thread/thread/c6db7f339164dafa/3963e322a65ad5e6?lnk=gst&q=Touchscreen#3963e322a65ad5e6

I sees logcat: "D/InputManagerService( 1655): hide the small icon for
the input method" on the 1st time I touched the screen. After that
there isnt any event nor logcat output on the screen touch.

Can anyone please give me some clue?

Thank you.

Best Regards,
Justin

Rajesh N

unread,
Mar 18, 2009, 6:12:42 AM3/18/09
to android...@googlegroups.com
Hi Justin,

 just check the touchscreen events with "getevent" command, this will show cross ponding values for touchscreen events and key pressed events.

Yes, X and Y coordinates are inverted in i.MX31 board, solve that problem by subtracting 1000 from X coordinate values obtained , this will solve u r problem.

Thanks,
Rajesh N
--
Best Regards,
Rajesh N

Consy - Leong Wen Xin

unread,
Mar 18, 2009, 7:08:57 AM3/18/09
to android...@googlegroups.com
Hi Rajesh,

Thanks for the quick reply.
I checked on the Debug output:

Pressed on 398,673 :
/dev/input/event1: 0003 0000 0000018e
/dev/input/event1: 0003 0001 000002a1
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0001 014a 00000000
/dev/input/event1: 0000 0000 00000000

Well input is accepted, but no respond from the GUI. Apart from the MENU ICON faded, which causes me unable to enter/exit the menu with "Enter button" on IMX board.
Reason the MENU ICON fade is cause by:

input_report_key(mxc_inputdev,BTN_TOUCH,X)

If I excluded that on compile. Although MENU ICON doesn't fade on screen touch, still GUI not respond on touched point.
Did you get the touch screen working completely? Can you please give me more information?

Thank you.

Best Regards,
Justin

Rajesh N

unread,
Mar 18, 2009, 7:36:23 AM3/18/09
to android...@googlegroups.com
HI Guys,

 Yes, I have no problem in porting android on real target, did u apply a patch for touch screen which is needed?

if not , kindly do changes to these two files, u r touchscreen problem will be solved.

====================================================================
,diff -ur linux-2.6.22/drivers/input/touchscreen/mxc_ts.c
linux-2.6.22/drivers/input/touchscreen/mxc_ts.c
--- linux-2.6.22/drivers/input/touchscreen/mxc_ts.c     2008-06-02
20:40:12.000000000 +0900
+++ linux-2.6.22.android/drivers/input/touchscreen/mxc_ts.c     2008-06-17
18:49:28.000000000 +0900
@@ -38,6 +38,15 @@

 #define MXC_TS_NAME    "mxc_ts"

+#define X_AXIS_MAX 1000
+#define X_AXIS_MIN 80
+#define Y_AXIS_MAX 1000
+#define Y_AXIS_MIN 80
+#define PRESSURE_MAX 1
+#define PRESSURE_MIN 0

 static struct input_dev *mxc_inputdev = NULL;
 static u32 input_ts_installed;

@@ -50,15 +59,39 @@
                try_to_freeze();
                memset(&ts_sample, 0, sizeof(t_touch_screen));
                pmic_adc_get_touch_sample(&ts_sample, !wait);
-
+#if 1
+               if((ts_sample.x_position >= X_AXIS_MIN) &&
+                       (ts_sample.x_position <= X_AXIS_MAX) &&
+                       (ts_sample.y_position >= Y_AXIS_MIN) &&
+                       (ts_sample.y_position <= Y_AXIS_MAX)) {
+              
+                       input_report_abs(mxc_inputdev, ABS_X, ts_sample.x_position);
+                       input_report_abs(mxc_inputdev, ABS_Y, ts_sample.y_position);
+                       input_report_abs(mxc_inputdev, ABS_PRESSURE,
+                                        ts_sample.contact_resistance);
+
+                       input_report_key(mxc_inputdev,BTN_TOUCH,1);
+               }
+               else {
+                       input_report_key(mxc_inputdev,BTN_TOUCH,0);
+               }
+               input_sync(mxc_inputdev);
+              
+               wait = ts_sample.contact_resistance;
+               msleep(20);
+#else
                input_report_abs(mxc_inputdev, ABS_X, ts_sample.x_position);
                input_report_abs(mxc_inputdev, ABS_Y, ts_sample.y_position);
                input_report_abs(mxc_inputdev, ABS_PRESSURE,
                                 ts_sample.contact_resistance);
+
                input_sync(mxc_inputdev);

                wait = ts_sample.contact_resistance;
                msleep(20);
+#endif
        }

        return 0;
@@ -77,6 +110,12 @@
        mxc_inputdev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
        mxc_inputdev->keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH);
        mxc_inputdev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
+       input_set_abs_params(mxc_inputdev,ABS_X,X_AXIS_MIN,X_AXIS_MAX,0,0);
+       input_set_abs_params(mxc_inputdev,ABS_Y,Y_AXIS_MIN,Y_AXIS_MAX,0,0);
+       input_set_abs_params(mxc_inputdev,ABS_PRESSURE,PRESSURE_MIN,PRESSURE_MAX,0,0);
        input_register_device(mxc_inputdev);

        input_ts_installed = 1;

=======================================================================
BTW I found ipu had some problem.following image is fix image.

diff -ur linux-2.6.22/drivers/mxc/ipu/ipu_common.c
linux-2.6.22/drivers/mxc/ipu/ipu_common.c
--- linux-2.6.22/drivers/mxc/ipu/ipu_common.c   2008-06-02
20:40:13.000000000 +0900
+++ linux-2.6.22.android/drivers/mxc/ipu/ipu_common.c   2008-06-17
18:49:40.000000000 +0900
@@ -588,23 +587,28 @@

        if (dma_chan == IDMA_CHAN_INVALID)
                return -EINVAL;
-
        spin_lock_irqsave(&ipu_lock, lock_flags);

        if (bufNum == 0) {
                reg = __raw_readl(IPU_CHA_BUF0_RDY);
+#if 0
                if (reg & (1UL << dma_chan)) {
                        spin_unlock_irqrestore(&ipu_lock, lock_flags);
                        return -EACCES;
                }
+#endif
                __raw_writel(DMAParamAddr(dma_chan) + 0x0008UL, IPU_IMA_ADDR);
                __raw_writel(phyaddr, IPU_IMA_DATA);
        } else {
                reg = __raw_readl(IPU_CHA_BUF1_RDY);
+#if 0
                if (reg & (1UL << dma_chan)) {
                        spin_unlock_irqrestore(&ipu_lock, lock_flags);
                        return -EACCES;
                }
+#endif
                __raw_writel(DMAParamAddr(dma_chan) + 0x0009UL, IPU_IMA_ADDR);
                __raw_writel(phyaddr, IPU_IMA_DATA);
        }
@@ -1139,7 +1143,15 @@
        if (wait_for_stop && channel != MEM_SDC_FG && channel != MEM_SDC_BG) {
                timeout = 40;
                while ((__raw_readl(IDMAC_CHA_BUSY) & chan_mask) ||
+#if 0
                       (_ipu_channel_status(channel) == TASK_STAT_ACTIVE)) {
+#else
+                      (_ipu_channel_status(channel) == TASK_STAT_ACTIVE) ||
+                      __raw_readl(IPU_CHA_BUF0_RDY) & (1UL << out_dma) ||
+                      __raw_readl(IPU_CHA_BUF0_RDY) & (1UL << out_dma))
+                       {      
+#endif
                        timeout--;
                        msleep(10);

Thanks & Regards,
Rajesh N

virstud

unread,
Mar 18, 2009, 8:16:15 AM3/18/09
to android-porting
http://groups.google.com/group/android-porting/browse_thread/thread/dbeba5caa4ed709/e24141ec7fff5798?lnk=gst&q=4pda#e24141ec7fff5798
> > On Wed, Mar 18, 2009 at 10:12 AM, Rajesh N <rajesh.andr...@gmail.com>wrote:
>
> >> Hi Justin,
>
> >>  just check the touchscreen events with "getevent" command, this will show
> >> cross ponding values for touchscreen events and key pressed events.
>
> >> Yes, X and Y coordinates are inverted in i.MX31 board, solve that problem
> >> by subtracting 1000 from X coordinate values obtained , this will solve u r
> >> problem.
>
> >> Thanks,
> >> Rajesh N
>
> >> On Wed, Mar 18, 2009 at 3:35 PM, Justin <wenxinle...@gmail.com> wrote:
>
> >>> Hail to all experts,
>
> >>> I'm trying to get the touch screen working on IMX31 3 stack boards. At
> >>> "kernel/drivers/input/touchscreen/mxc_ts.c" placed printf to test the
> >>> touchscreen respond/coordinate input.
>
> >>> Well I notice the output x-coor is inverted, everything else looks
> >>> fine.
> >>> Kernel is reading the input, but not the Android OS.
>
> >>> I tried the suggestion of:
>
> >>>http://groups.google.com/group/android-porting/browse_thread/thread/c...

Daniel

unread,
Mar 18, 2009, 9:33:45 AM3/18/09
to android-porting
On our i.MX31 board Android did not recognize the touchscreen as a
device of class CLASS_TOUCHSCREEN in frameworks/base/libs/ui/
EventHub.cpp in method EventHub::open_device.
A workaround which sets "devices->classes |= CLASS_TOUCHSCREEN" in
open_device manually for /dev/input/event1 worked for us.

On Mar 18, 1:16 pm, virstud <russia.proje...@gmail.com> wrote:
> http://groups.google.com/group/android-porting/browse_thread/thread/d...

Consy - Leong Wen Xin

unread,
Mar 19, 2009, 5:08:25 AM3/19/09
to android...@googlegroups.com
Hi all,

Thanks for the help!
Solution: Patch provided by Rajesh + Enable "CONFIG_ANDROID_POWER" (link provided by Virstud)
Got the touchscreen working now. Cheers!

Best Regards,
Justin
Reply all
Reply to author
Forward
0 new messages