Difference between revisions of "TSC2102 Linux driver"

From ArmadeusWiki
Jump to: navigation, search
m (Usage)
m (Usage)
Line 30: Line 30:
 
==Usage==
 
==Usage==
 
* load all the needed drivers:
 
* load all the needed drivers:
insmod /lib/modules/drivers/hwmon/hwmon.ko
+
 
  insmod /lib/modules/drivers/spi/spi_imx.ko
+
  # modprobe spi_imx
  insmod /lib/modules/drivers/spi/tsc2102.ko
+
  # modprobe tsc2102_ts
  insmod /lib/modules/drivers/input/touchscreen/tsc2102_ts.ko
+
  TI TSC2102 driver initializing
 +
input: TSC2102 Touchscreen as /class/input/input0
 +
TSC2102 touchscreen driver initialized
 +
 
 +
* To check:
 +
# lsmod
 +
Module                  Size  Used by    Not tainted
 +
tsc2102_ts             1188  0
 +
tsc2102                10192  3 tsc2102_ts
 +
hwmon                    916  1 tsc2102
 +
spi_imx                7136  0
  
 
Then:
 
Then:

Revision as of 19:47, 17 November 2008

This page details the installation and the usage of the Linux drivers for the TSC2102 touchscreen & sound chip. Sound (ALSA) specific part can be found here.

Driver Installation

$ make linux-menuconfig
in Device Drivers  ---> Input device support  ---> select <*>   Event interface  as builtin
in Device Drivers  ---> Input device support  ---> [*]   Touchscreens  ---> select <M>   TSC 2102 based touchscreens as module

in Device Drivers  ---> SPI support  --->  select <M> Freescale iMX SPI controller as module
in Device Drivers  ---> SPI support  ---> --- TSC2102 codec support should be selected

in Device Drivers  ---> select <M> Hardware Monitoring support  ---> as module
$ make linux

Then reflash your Linux kernel and your Rootfs...

Architecture

Touchscreen (tsc2102_ts.ko) HWmon ALSA
TSC2102 Main driver (tsc2102.ko)
Linux API

Usage

  • load all the needed drivers:
# modprobe spi_imx
# modprobe tsc2102_ts
TI TSC2102 driver initializing
input: TSC2102 Touchscreen as /class/input/input0
TSC2102 touchscreen driver initialized
  • To check:
# lsmod
Module                  Size  Used by    Not tainted
tsc2102_ts              1188  0
tsc2102                10192  3 tsc2102_ts
hwmon                    916  1 tsc2102
spi_imx                 7136  0

Then:

  • get temperature and voltage with hwmon (Hardware Monitoring) interface
# cat /sys/class/hwmon/hwmon0/device/temp1_input    -- result in m°C

TSLib API Installation

Install the Tslib touchscreen API

Envt variables

  • You should define some ENVT variables to use the touchscreen API (tslib):
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_TSEVENTTYPE=INPUT
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_CALIBFILE=/etc/pointercal
  • you can add them to your /etc/profile:
# vi /etc/profile

Device file creation if not exist

  • /dev/input/event0 is created from the infos got from:
# cat /sys/class/input/event0/dev
13:64
# mkdir /dev/input
# cd /dev/input/
# mknod event0 c 13 64
# ls -al
drwxr-xr-x    2 root     root            0 Jan  1 00:39 .
drwxr-xr-x    5 root     root            0 Jan  1 00:39 ..
crw-r--r--    1 root     root      13,  64 Jan  1 00:39 event0
#

Quick test

To quickly check driver fonctionnality, touch the screen and check that tsc2102 interrupts count is increasing:

# cat /proc/interrupts
          CPU0
26:          0         MPU  IMX-uart
29:         17         MPU  IMX-uart
30:         22         MPU  IMX-uart
35:         12         MPU  imx-mmc
39:         14         MPU  I2C_IMX
40:         16         MPU  imx-spi.2
41:          0         MPU  imx-spi.1
59:       3682         MPU  i.MX Timer Tick
60:          0         MPU  DMA
61:          0         MPU  DMA
110:         0        GPIO  eth0
168:         0        GPIO  tsc2102
Err:         0
#

or start the touchscreen calibration tool:

/usr/bin/ts_calibrate

Links