tegra2: make mxt_touch an InputClass in its own .conf snippet

Move mxt_touch touchscreen X input configuration to its own touchscreen.conf snippet.
This file is installed when the touchui USE flag is in use.

The touchscreen has an evdev-compatible kernel driver, and has a /dev/input/event* node.
Thus, an InputClass can be used, to find the correct device, and load the evdev X input driver.

A side affect of this, and the use of AutoAddDevices is the special xorg.conf.touchui becomes redundant and is therefore removed.

BUG=chromium-os:11929
TEST=Atmel maXTouch touchscreen still works for touchui builds.

Reviewed-on: http://gerrit.chromium.org/gerrit/1110
Reviewed-by: Jon Kliegman <kliegs@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
(cherry picked from commit 0f1a863590e4006adabbb13cbb541c1ed59ecdcc)

Change-Id: I3f677cf232d76c0a7b6a54332c87a73e3571731a
Reviewed-on: http://gerrit.chromium.org/gerrit/2084
Tested-by: Micah Catlin <micahc@chromium.org>
Reviewed-by: Micah Catlin <micahc@chromium.org>
diff --git a/overlay-tegra2/chromeos-base/xorg-conf/files/touchpad.conf-multitouch b/overlay-tegra2/chromeos-base/xorg-conf/files/touchpad-multitouch.conf
similarity index 100%
rename from overlay-tegra2/chromeos-base/xorg-conf/files/touchpad.conf-multitouch
rename to overlay-tegra2/chromeos-base/xorg-conf/files/touchpad-multitouch.conf
diff --git a/overlay-tegra2/chromeos-base/xorg-conf/files/touchscreen-mxt.conf b/overlay-tegra2/chromeos-base/xorg-conf/files/touchscreen-mxt.conf
new file mode 100644
index 0000000..1c26a94
--- /dev/null
+++ b/overlay-tegra2/chromeos-base/xorg-conf/files/touchscreen-mxt.conf
@@ -0,0 +1,17 @@
+Section "InputClass"
+    Identifier "mxt_touch"
+    Driver "evdev"
+    MatchDevicePath "/dev/input/event*"
+    MatchProduct "Atmel maXTouch Touchscreen"
+    Option "SendCoreEvents" "false"
+    Option "GrabDevice" "true"
+    Option "Calibration" "344 -5 5 799"
+# Numbers generated via xinput_calibrator
+# Option "Calibration" "min-x max-x min-y max-y"
+# Calibrates the X and Y axes for devices that need to scale to a different
+# coordinate system than reported to the X server. This feature is required for
+# devices that need to scale to a different coordinate system than originally
+# reported by the kernel (e.g. touchscreens). The scaling to the custom
+# coordinate system is done in-driver and the X server is unaware of the
+# transformation.
+EndSection
diff --git a/overlay-tegra2/chromeos-base/xorg-conf/files/xorg.conf.opengles b/overlay-tegra2/chromeos-base/xorg-conf/files/xorg.conf.opengles
index 0ac620f..0d05b82 100644
--- a/overlay-tegra2/chromeos-base/xorg-conf/files/xorg.conf.opengles
+++ b/overlay-tegra2/chromeos-base/xorg-conf/files/xorg.conf.opengles
@@ -10,23 +10,6 @@
     Option	"off time"	"0"
 EndSection
 
-Section "InputDevice"
-Identifier "mxt_touch"
-    Driver "evdev"
-    Option "SendCoreEvents" "false"
-    Option "GrabDevice" "true"
-    Option "Device" "/dev/input/mxt_touch"
-    Option "Calibration" "344 -5 5 799"
-# Numbers generated via xinput_calibrator
-# Option "Calibration" "min-x max-x min-y max-y"
-# Calibrates the X and Y axes for devices that need to scale to a different
-# coordinate system than reported to the X server. This feature is required for
-# devices that need to scale to a different coordinate system than originally
-# reported by the kernel (e.g. touchscreens). The scaling to the custom
-# coordinate system is done in-driver and the X server is unaware of the
-# transformation.
-EndSection
-
 Section "Monitor"
     Identifier	"TFTLCD"
 EndSection
@@ -121,24 +104,20 @@
 Section "ServerLayout"
     Identifier	"Internal"
     Screen	"Screen Internal"
-    InputDevice	"mxt_touch"
 EndSection
 
 Section "ServerLayout"
     Identifier	"HDMI"
     Screen	"Screen HDMI"
-    InputDevice	"mxt_touch"
 EndSection
 
 Section "ServerLayout"
     Identifier	"DualView"
     Screen	"Screen Internal"
     Screen	"Screen HDMI" RightOf "Screen Internal"
-    InputDevice	"mxt_touch"
 EndSection
 
 Section "ServerLayout"
     Identifier	"Mirror"
     Screen	"Screen Mirror"
-    InputDevice	"mxt_touch"
 EndSection
diff --git a/overlay-tegra2/chromeos-base/xorg-conf/files/xorg.conf.touch b/overlay-tegra2/chromeos-base/xorg-conf/files/xorg.conf.touch
deleted file mode 100644
index 1bd6561..0000000
--- a/overlay-tegra2/chromeos-base/xorg-conf/files/xorg.conf.touch
+++ /dev/null
@@ -1,141 +0,0 @@
-# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-Section "ServerFlags"
-    Option	"DefaultServerLayout" "Internal"
-    Option	"blank time"	"0"
-    Option	"standby time"	"0"
-    Option	"suspend time"	"0"
-    Option	"off time"	"0"
-EndSection
-
-Section "InputClass"
-Identifier "mxt_touch"
-    Driver "evdev"
-    MatchDevicePath "/dev/input/event*"
-    MatchProduct "Atmel maXTouch Touchscreen"
-    Option "SendCoreEvents" "false"
-    Option "GrabDevice" "true"
-    Option "Calibration" "344 -5 5 799"
-# Numbers generated via xinput_calibrator
-# Option "Calibration" "min-x max-x min-y max-y"
-# Calibrates the X and Y axes for devices that need to scale to a different
-# coordinate system than reported to the X server. This feature is required for
-# devices that need to scale to a different coordinate system than originally
-# reported by the kernel (e.g. touchscreens). The scaling to the custom
-# coordinate system is done in-driver and the X server is unaware of the
-# transformation.
-EndSection
-
-Section "Monitor"
-    Identifier	"TFTLCD"
-EndSection
-
-Section "Monitor"
-    Identifier	"TV"
-    HorizSync       28.0 - 100.0
-    VertRefresh     43.0 - 72.0
-    ModeLine "720x480"   26.72   720  736  808  896   480  481  484  497   -HSync +Vsync
-EndSection
-
-Section "Monitor"
-    Identifier	"CRT"
-    HorizSync       28.0 - 100.0
-    VertRefresh     43.0 - 72.0
-    ModeLine "800x600"   38.22   800  832  912  1024  600  601  604  622   -HSync +Vsync
-    ModeLine "1280x960"  102.10  1280 1360 1496 1712  960  961  964  994   -HSync +Vsync
-    ModeLine "1280x1024" 108.88  1280 1360 1496 1712  1024 1025 1028 1060  -HSync +Vsync
-    ModeLine "1680x1050" 147.14  1680 1784 1968 2256  1050 1051 1054 1087  -HSync +Vsync
-EndSection
-
-Section "Monitor"
-    Identifier	"HDMI"
-    HorizSync       28.0 - 100.0
-    VertRefresh     43.0 - 72.0
-    ModeLine "1280x720"  74.48   1280 1336 1472 1664  720  721  724  746   -HSync +Vsync
-    ModeLine "720x480"   26.72   720  736  808  896   480  481  484  497   -HSync +Vsync
-    ModeLine "640x480"   23.86   640  656  720  800   480  481  484  497   -HSync +Vsync
-    ModeLine "720x576"   32.67   720  744  816  912   576  577  580  597   -HSync +Vsync
-    ModeLine "1920x1080" 172.80  1920 2040 2248 2576  1080 1081 1084 1118  -HSync +Vsync
-EndSection
-
-Section "Device"
-    Identifier	"Tegra Internal"
-    Driver	"tegra"
-    Option      "DisplayMask" "TFTLCD"
-    Option      "EnableBlending" "true"
-EndSection
-
-Section "Device"
-    Identifier	"Tegra HDMI"
-    Driver	"tegra"
-    Option      "DisplayMask" "HDMI"
-    Option      "UseEDIDModes" "HDMI"
-    Option      "EnableBlending" "false"
-EndSection
-
-Section "Device"
-    Identifier	"Tegra Mirror"
-    Driver	"tegra"
-    Option      "DisplayMask" "TFTLCD,HDMI"
-    Option      "UseEDIDModes" "HDMI"
-    Option      "EnableBlending" "true"
-EndSection
-
-Section "Screen"
-    Identifier	"Screen Internal"
-    Device	"Tegra Internal"
-    Monitor	"TFTLCD"
-    DefaultDepth 24
-    SubSection "Display"
-        Depth		24
-    EndSubsection
-EndSection
-
-Section "Screen"
-    Identifier	"Screen HDMI"
-    Device	"Tegra HDMI"
-    Monitor	"HDMI"
-    DefaultDepth 24
-    SubSection "Display"
-        Depth		24
-        ViewPort	0 0
-    EndSubsection
-EndSection
-
-Section "Screen"
-    Identifier	"Screen Mirror"
-    Device	"Tegra Mirror"
-    Monitor	"HDMI"
-    DefaultDepth 24
-    SubSection "Display"
-        Depth		24
-# Override the preferred resolution chosen by UseEDIDModes
-        Modes		"1280x720"
-        ViewPort	0 0
-# Override the preferred resolution chosen by UseEDIDModes
-        Virtual 	1280 720
-    EndSubsection
-EndSection
-
-Section "ServerLayout"
-    Identifier	"Internal"
-    Screen	"Screen Internal"
-EndSection
-
-Section "ServerLayout"
-    Identifier	"HDMI"
-    Screen	"Screen HDMI"
-EndSection
-
-Section "ServerLayout"
-    Identifier	"DualView"
-    Screen	"Screen Internal"
-    Screen	"Screen HDMI" RightOf "Screen Internal"
-EndSection
-
-Section "ServerLayout"
-    Identifier	"Mirror"
-    Screen	"Screen Mirror"
-EndSection
diff --git a/overlay-tegra2/chromeos-base/xorg-conf/xorg-conf-0.0.4-r206.ebuild b/overlay-tegra2/chromeos-base/xorg-conf/xorg-conf-0.0.4-r207.ebuild
similarity index 75%
rename from overlay-tegra2/chromeos-base/xorg-conf/xorg-conf-0.0.4-r206.ebuild
rename to overlay-tegra2/chromeos-base/xorg-conf/xorg-conf-0.0.4-r207.ebuild
index 82aee4f..22051fe 100644
--- a/overlay-tegra2/chromeos-base/xorg-conf/xorg-conf-0.0.4-r206.ebuild
+++ b/overlay-tegra2/chromeos-base/xorg-conf/xorg-conf-0.0.4-r207.ebuild
@@ -14,9 +14,7 @@
 
 src_install() {
 	insinto /etc/X11
-	if use touchui; then
-		newins "${FILESDIR}/xorg.conf.touch" xorg.conf
-	elif use opengles; then
+	if use opengles; then
 		newins "${FILESDIR}/xorg.conf.opengles" xorg.conf
 	else
 		newins "${FILESDIR}/xorg.conf.fbdev" xorg.conf
@@ -24,6 +22,9 @@
 
 	insinto /etc/X11/xorg.conf.d
 	if use multitouch; then
-		newins "${FILESDIR}/touchpad.conf-multitouch" touchpad.conf
+		newins "${FILESDIR}/touchpad-multitouch.conf" 50-touchpad-multitouch.conf
+	fi
+	if use touchui; then
+		newins "${FILESDIR}/touchscreen-mxt.conf" 60-touchscreen-mxt.conf
 	fi
 }