Hi Jun'ichi,

 Touch screen after applying ur  patch, but everything is working in reverse
manner , I think X and Y co-ordinates have swapped, when I touch extreem
right icon , It selects extreem left icon!!! (wired!)

I have attched my mxc_ts.c file with mail, kindly give me some suggestion on
how to resolve this problem...

Best Regards,
Rajesh N

On Wed, Feb 4, 2009 at 9:35 PM, Jun'ichi Hirayama <[email protected]>wrote:

> Hi  Rajesh
>
> Lastyear I was porting Android on IMX31 platform ,
> (kernel ver 2.6.22 )
>
> I adapted mxc_ts.c
>
> ====================================================================
> ,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);
>                       if (timeout == 0) {
>
> BR
> Jun'ichi
>
>
>
> On Wed, Feb 4, 2009 at 2:47 PM, Rocky <[email protected]> wrote:
>
>>
>> Hi,
>>
>>  I been working on Android for past few weeks , I have progressed
>> significantly on porting Android on IMX31 platform , now I am facing
>> problems with touch screen, it is not working !
>>
>>  I have checked "cat /dev/input/event1" I get some junk info whenever
>> I touch screen which proves something is working around the driver,
>> off late I have seen mail listing on android and issues with
>> touchscreen, which mentions using of "TSLIB" for android file system.
>>
>>  Can u provide me some inputs on following issues;
>>
>> (a) How to "statically"  compile and integrate "TSLIB" to android
>> filesystem, this would be a great help as far I have seen on mailing
>> list most of them have failed to compile it statically!
>>
>> (b) I would like to know if any patch or modification needs to be done
>> to "mxc_ts.c" file in  "../drivers/input/touchscreen/"
>>      I am attaching my "mxc_ts.c" file with mail , Kindly have a look
>> at it.
>>
>> I will highly appreciate u r help/ suggestions on touch screen issues
>> & awaiting for u r responce.
>>
>> Best Regards,
>> Rajesh
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

/*
 * Copyright 2007-2008 Freescale Semiconductor, Inc. All Rights Reserved.
 */

/*
 * The code contained herein is licensed under the GNU General Public
 * License. You may obtain a copy of the GNU General Public License
 * Version 2 or later at the following locations:
 *
 * http://www.opensource.org/licenses/gpl-license.html
 * http://www.gnu.org/copyleft/gpl.html
 */

/*!
 * @file mxc_ts.c
 *
 * @brief Driver for the Freescale Semiconductor MXC touchscreen.
 *
 * The touchscreen driver is designed as a standard input driver which is a
 * wrapper over low level PMIC driver. Most of the hardware configuration and
 * touchscreen functionality is implemented in the low level PMIC driver. During
 * initialization, this driver creates a kernel thread. This thread then calls
 * PMIC driver to obtain touchscreen values continously. These values are then
 * passed to the input susbsystem.
 *
 * @ingroup touchscreen
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/input.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/freezer.h>
#include <asm/arch/pmic_external.h>
#include <asm/arch/pmic_adc.h>

#define MXC_TS_NAME	"mxc_ts"

#define X_AXIS_MAX 1000
#define X_AXIS_MIN 50   
#define Y_AXIS_MAX 1000 
#define Y_AXIS_MIN 50
#define PRESSURE_MAX 1  
#define PRESSURE_MIN 0   



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

static int ts_thread(void *arg)
{
	t_touch_screen ts_sample;
	s32 wait = 0;
	daemonize("mxc_ts");
	while (input_ts_installed) {
		try_to_freeze();
		memset(&ts_sample, 0, sizeof(t_touch_screen));
		if (0 != pmic_adc_get_touch_sample(&ts_sample, !wait))
			continue;
		#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;
}

static int __init mxc_ts_init(void)
{
	int retval;

	mxc_inputdev = input_allocate_device();
	if (!mxc_inputdev) {
		printk(KERN_ERR
		       "mxc_ts_init: not enough memory for input device\n");
		return -ENOMEM;
	}

	mxc_inputdev->name = MXC_TS_NAME;
	mxc_inputdev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
	mxc_inputdev->keybit[BIT_WORD(BTN_TOUCH)] |= BIT_MASK(BTN_TOUCH);
	mxc_inputdev->absbit[0] =BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | BIT_MASK(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);

	retval = input_register_device(mxc_inputdev);
	if (retval < 0) {
		input_free_device(mxc_inputdev);
		return retval;
	}

	input_ts_installed = 1;
	kernel_thread(ts_thread, NULL, CLONE_VM | CLONE_FS);
	printk("mxc input touchscreen loaded\n");
	return 0;
}

static void __exit mxc_ts_exit(void)
{
	input_ts_installed = 0;
	input_unregister_device(mxc_inputdev);

	if (mxc_inputdev) {
		input_free_device(mxc_inputdev);
		mxc_inputdev = NULL;
	}
}

late_initcall(mxc_ts_init);
module_exit(mxc_ts_exit);

MODULE_DESCRIPTION("MXC input touchscreen driver");
MODULE_AUTHOR("Freescale Semiconductor, Inc.");
MODULE_LICENSE("GPL");

Reply via email to