Letux Kernel

Issue 21: configure for TSC2007

Reported by Nikolaus Schaller, Feb 19, 2010

TSC2007 support must be enabled
and we must specify the bus&address of our device.

Maybe, we also have to flip the Y coordinate which starts (0,0) at 
the lower left corner.

Comment 1 by Nikolaus Schaller, Feb 25, 2010

The good thing is that vanilla Linux already has a driver for the 
TSC2007! drivers/input/touchscreen/tsc2007.c Just needs to be 
configured into the kernel :)

But: the I2C and the TSC driver needs to be initialized in the 
board.c file. There may be examples to copy from other platforms, 
e.g. the Touchbook.

As far as I understand it needs two changes:
a) initialize the I2C bus
b) initialize the TSC (tsc2007_init)

Finally, I don't know yet how to activate the TSC in user-space 
(e.g. connect it to the X server).

Comment 2 by Nikolaus Schaller, Feb 26, 2010

It looks as if only this device uses the TSC2007:

gta04-kernel/arch/sh/boards/mach-ecovec24/setup.c

It looks quite simple (just needs to connect the PENIRQ GPIO - 
GPIO157 on our GTA04E-Board).

Still open to me is how we configure this to be in the I2C Bus 2.

--- CODE ---

/* TouchScreen */
#define IRQ0 32
static int ts_get_pendown_state(void)
{
	int val = 0;
	gpio_free(GPIO_FN_INTC_IRQ0);
	gpio_request(GPIO_PTZ0, NULL);
	gpio_direction_input(GPIO_PTZ0);

	val = gpio_get_value(GPIO_PTZ0);

	gpio_free(GPIO_PTZ0);
	gpio_request(GPIO_FN_INTC_IRQ0, NULL);

	return val ? 0 : 1;
}

static int ts_init(void)
{
	gpio_request(GPIO_FN_INTC_IRQ0, NULL);
	return 0;
}

struct tsc2007_platform_data tsc2007_info = {
	.model			= 2007,
	.x_plate_ohms		= 180,
	.get_pendown_state	= ts_get_pendown_state,
	.init_platform_hw	= ts_init,
};

static struct i2c_board_info ts_i2c_clients = {
	I2C_BOARD_INFO("tsc2007", 0x48),
	.type		= "tsc2007",
	.platform_data	= &tsc2007_info,
	.irq		= IRQ0,
};

Comment 3 by Nikolaus Schaller, Apr 14, 2010

Another quirk: if the TSC driver is to be compiled into the kernel 
(and not as a loadable module), compilation aborts:

  CC      arch/arm/mach-omap2/board-omap3beagle.o - due to target 
missing
arch/arm/mach-omap2/board-omap3beagle.c:309:5: Warnung: »TODO« ist 
nicht definiert
arch/arm/mach-omap2/board-omap3beagle.c: In Funktion »tsc2007_init«:
arch/arm/mach-omap2/board-omap3beagle.c:330: Fehler: »OMAP3_TS_GPIO« 
nicht deklariert (erste Benutzung in dieser Funktion)
arch/arm/mach-omap2/board-omap3beagle.c:330: Fehler: (Jeder nicht 
deklarierte Bezeichner wird nur einmal aufgeführt
arch/arm/mach-omap2/board-omap3beagle.c:330: Fehler: für jede 
Funktion in der er auftritt.)
arch/arm/mach-omap2/board-omap3beagle.c: Auf höchster Ebene:
arch/arm/mach-omap2/board-omap3beagle.c:343: Warnung: 
Initialisierung von inkompatiblem Zeigertyp
make[2]: *** [arch/arm/mach-omap2/board-omap3beagle.o] Error 1
make[1]: *** [arch/arm/mach-omap2] Error 2
make: *** [uImage] Error 2
Owner: hns

Comment 4 by Nikolaus Schaller, Apr 27, 2010

GPIOs and Interrupt connection is fixed. Driver is initializing and 
shows /sys/devices/virtual/input/input0
but there is no event0 file

Comment 5 by Nikolaus Schaller, May 19, 2010

TSC driver is now working. Only issue is that Y axis is flipped and 
touch screen calibration does not handle (at least in Angstrom).
Status: Fixed

Created: 11 years 5 months ago by Nikolaus Schaller

Updated: 11 years 2 months ago

Status: Fixed

Owner: Nikolaus Schaller

Labels:
Type:Task
Priority:High