Subject: UCB1300 touch screen patch

From: Tak-Shing Chan <[email-masked]>
Date: Mon, 19 Jun 2000 15:36:20 +0800 (CST)

Hi,

     According to Philips Semiconductors' application notes
regarding the differences between UCB1300 and UCB1200 [1], ``the
touchscreen interface should be programmed to pressure mode first
for a duration of 1 SIB frame before setting to position mode for
measurement.''  Sample patch below for 2.4.0-test1-ac7-rmk1-np6
(this also fixes a small typo in sa1100_ts.h and has a corrected
normalize function).  Now Microwindows Minesweeper is running
fine on the Assabet.  :-)

Regards,
Tak-Shing Chan

[1] http://www.semiconductors.com/acrobat/applicationnotes/AN809_1.pdf

--- /usr/src/linux/drivers/char/sa1100_ts.c.orig	Mon Jun 19 10:44:21 2000
+++ /usr/src/linux/drivers/char/sa1100_ts.c	Mon Jun 19 11:51:19 2000
@@ -211,6 +211,11 @@
 			pressure = sa1100_ts_measure_pressure();
 			if((pressure - ground) > UGL_SA1100_TS_PRESSURE_THRESHOLD) {
 				x += sa1100_ts_measure_x();
+#ifdef CONFIG_SA1100_ASSABET
+				/* See Philips' AN809 */
+    				sa1100_ts_regwrite(UGL_UCB1200_TS_CR,
+					UGL_UCB1200_TS_PRESSURE);
+#endif
 				y += sa1100_ts_measure_y();
 			} else {
 				*in_x = SA1100_TS_NOVALUE;
@@ -262,10 +267,13 @@
 
 int sa1100_ts_normalize(int * in_x, int * in_y)
 {
-	
+#ifdef CONFIG_SA1100_ASSABET
+	*in_x = (((SA1100_TS_RAW_MAX_X - *in_x)) * SA1100_TS_RES_X) / (SA1100_TS_RAW_MAX_X - SA1100_TS_RAW_MIN_X);
+	*in_y = (((SA1100_TS_RAW_MAX_Y - *in_y)) * SA1100_TS_RES_Y) / (SA1100_TS_RAW_MAX_Y - SA1100_TS_RAW_MIN_Y);
+#else
 	*in_x = (((*in_x - SA1100_TS_RAW_MIN_X)) * SA1100_TS_RES_X) / (SA1100_TS_RAW_MAX_X - SA1100_TS_RAW_MIN_X);
 	*in_y = (((*in_y - SA1100_TS_RAW_MIN_Y)) * SA1100_TS_RES_Y) / (SA1100_TS_RAW_MAX_Y - SA1100_TS_RAW_MIN_Y);
-	
+#endif
 	return 0;	
 }
 
@@ -424,12 +432,21 @@
 	memset(&_g_settings,0,sizeof(_g_settings));
 	g_settings = &_g_settings;
 
+#ifdef CONFIG_SA1100_ASSABET
+	g_settings->m_raw_max_x = 944;
+	g_settings->m_raw_max_y = 944;
+	g_settings->m_raw_min_x = 70;
+	g_settings->m_raw_min_y = 70;
+	g_settings->m_res_x = 320;
+	g_settings->m_res_y = 240;
+#else
 	g_settings->m_raw_max_x = 885;
 	g_settings->m_raw_max_y = 885;
 	g_settings->m_raw_min_x = 70;
 	g_settings->m_raw_min_y = 70;
 	g_settings->m_res_x = 640;
 	g_settings->m_res_y = 480;
+#endif
 	g_settings->m_fudge_x = 1;
 	g_settings->m_fudge_y = 1;
 	g_settings->m_avg_sample = 10;

--- /usr/src/linux/drivers/char/sa1100_ts.h.orig	Mon Jun 19 10:44:21 2000
+++ /usr/src/linux/drivers/char/sa1100_ts.h	Mon Jun 19 11:09:45 2000
@@ -104,9 +104,9 @@
 #define UGL_SA1100_TS_PRESSURE_THRESHOLD (g_settings->m_pressure)
 
 #define SA1100_TS_RAW_MAX_X		(g_settings->m_raw_max_x)
-#define SA1100_TS_RAW_MAX_Y		(g_settings->m_raw_max_x)
+#define SA1100_TS_RAW_MAX_Y		(g_settings->m_raw_max_y)
 #define SA1100_TS_RAW_MIN_X		(g_settings->m_raw_min_x)
-#define SA1100_TS_RAW_MIN_Y		(g_settings->m_raw_min_x)
+#define SA1100_TS_RAW_MIN_Y		(g_settings->m_raw_min_y)
 #define SA1100_TS_RES_X			(g_settings->m_res_x)
 #define SA1100_TS_RES_Y			(g_settings->m_res_y)
 #define SA1100_TS_FUDGE_X		(g_settings->m_fudge_x)

unsubscribe: body of `unsubscribe linux-arm-kernel' to [email-masked]

---

From: Hiroshi Ishii <[email-masked]>
Date: Tue, 20 Jun 2000 14:47:10 +0900

On Mon, 19 Jun 2000 15:36:20 +0800 (CST)

> normalize function).  Now Microwindows Minesweeper is running

Hummmm... My board (Assabet) out following message.

Unknown output type (FE00)

Why.....?
	
----
Funai Electric R & D
  System Software Engineer
        Hiroshi Ishii

---

From: Tak-Shing Chan <[email-masked]>
Date: Tue, 20 Jun 2000 17:02:06 +0800 (CST)

Beware of the minor device number:

     /dev/ts    : 34
     /dev/tsraw : 18

Tak-Shing Chan

---

From: Hiroshi Ishii <[email-masked]>
Date: Tue, 20 Jun 2000 18:30:51 +0900

On Tue, 20 Jun 2000 17:02:06 +0800 (CST)

> Beware of the minor device number:

Thanks. Working it cool!!!

----
Funai Electric R & D
  System Software Engineer
        Hiroshi Ishii