keypad and Touchscreen Not working on IMX31 with Android SDK1.0

20 views
Skip to first unread message

Eric Michael

unread,
Feb 5, 2009, 5:00:11 AM2/5/09
to android-porting
Hi all,

I previously ported android on IMX31 with Android SDK release
mcr20 and everything was working fine including keypad and
touchscreen. Later when I updated with Android patch from SDK 1.0
release with IMX kernel from freescale linx-2.6.24 with android patch.
Keypad and touchscreen is not working. I also tried with enabling and
disabling power management options in the menuconfig and result are
same. I m getting the Android Desktop like screen with Screen lock
message and Only if keypad works I can test further for the Video and
Audio applications in the Android.Any help regarding this will be
highly appreciated and of great help for me and others in this group.

Thanks and Regards
Eric

Rajesh N

unread,
Feb 5, 2009, 5:57:19 AM2/5/09
to android...@googlegroups.com
Hi Eric,

Few mins back I enabled touch screen on Imx31 from freescale, plz apply this patch to u r source code , it will work !, there is a small problem in this patch as co-ordinates r wrongly mapped ,I mean to say it is in reverse , so it need to be rectified!!! kindly update u r status after applying this patch.

====================================================================
,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);


Best Regards,
Rajesh N
if (timeout == 0) {

Saroj (सरोज)

unread,
Feb 5, 2009, 10:13:43 AM2/5/09
to android...@googlegroups.com
Hi Eric,

Its really nice to hear that you have ported android on IMX31 board.
I am also trying to port android on IMX31 board, but still no success.
It would be nice if you share with us your details porting steps of android on IMX31 board.
Also it would be great if you share with your your android kernel configuration and patch.

Thanking you,

Regards,
Saroj K Pradhan


On Thu, Feb 5, 2009 at 3:30 PM, Eric Michael <mfas...@yahoo.co.in> wrote:



--
Regards,
Saroj K Pradhan


"My formula for living is quite simple. I get up in the morning and I go to bed at night. In between, I occupy myself as best I can. "

Rajesh N

unread,
Feb 7, 2009, 10:42:05 PM2/7/09
to android...@googlegroups.com
Hi Eric,

 Did u apply this patch for u r touch screen problem? I have applied it but for me co -ordinate is reverse , any view on this problem, is there anything gone wrong with patch?

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