summaryrefslogtreecommitdiff
path: root/sys/arch/zaurus/dev
diff options
context:
space:
mode:
authorUwe Stuehler <uwe@cvs.openbsd.org>2005-04-24 18:55:50 +0000
committerUwe Stuehler <uwe@cvs.openbsd.org>2005-04-24 18:55:50 +0000
commit879323ed84438d1562ddaa1dc5dfa891a8e30d70 (patch)
tree77322298f9e3aba0df2fbfc6fafb4843e596215e /sys/arch/zaurus/dev
parentd8ae39c8f007b132312ae0a959d0caf0b6a7743b (diff)
Do down-sampling of the high-resolution touch pad events in kernel,
and provide sysctls for fine-tuning the touch pad area that covers the screen. Reasonable defaults are provided, but each machine can be a bit different due to the manufacturing process.
Diffstat (limited to 'sys/arch/zaurus/dev')
-rw-r--r--sys/arch/zaurus/dev/zts.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/sys/arch/zaurus/dev/zts.c b/sys/arch/zaurus/dev/zts.c
index 906dc899cc5..d816fcb11bb 100644
--- a/sys/arch/zaurus/dev/zts.c
+++ b/sys/arch/zaurus/dev/zts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zts.c,v 1.8 2005/04/19 21:54:48 djm Exp $ */
+/* $OpenBSD: zts.c,v 1.9 2005/04/24 18:55:49 uwe Exp $ */
/*
* Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
*
@@ -31,6 +31,10 @@
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsmousevar.h>
+#include <dev/wscons/wsdisplayvar.h>
+#include <arm/xscale/pxa2x0var.h>
+#include <arm/xscale/pxa2x0_lcd.h>
+
/*
* ADS784x touch screen controller
*/
@@ -49,6 +53,22 @@
#define CCNT_HS_400_VGA_C3K 6250 /* 15.024us */
+/* XXX need to ask zaurus_lcd.c for the screen dimension */
+#define CURRENT_DISPLAY (&sharp_zaurus_C3000)
+extern const struct lcd_panel_geometry sharp_zaurus_C3000;
+
+/* Settable via sysctl. */
+int zts_rawmode;
+struct ztsscale {
+ int ts_minx;
+ int ts_maxx;
+ int ts_miny;
+ int ts_maxy;
+} zts_scale = {
+ /* C3000 */
+ 209, 3620, 312, 3780
+};
+
int zts_match(struct device *, void *, void *);
void zts_attach(struct device *, struct device *, void *);
int zts_enable(void *);
@@ -68,6 +88,8 @@ struct zts_softc {
struct device *sc_wsmousedev;
int sc_oldx;
int sc_oldy;
+ int sc_resx;
+ int sc_resy;
};
struct cfattach zts_ca = {
@@ -116,6 +138,9 @@ zts_attach(struct device *parent, struct device *self, void *aux)
a.accesscookie = sc;
printf("\n");
+ sc->sc_resx = CURRENT_DISPLAY->panel_height;
+ sc->sc_resy = CURRENT_DISPLAY->panel_width;
+
sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint);
}
@@ -487,8 +512,18 @@ zts_irq(void *v)
pxa2x0_gpio_clear_intr(GPIO_TP_INT_C3K);
splx(s);
- if (down)
+ if (down) {
zts_avgpos(&tp);
+ if (!zts_rawmode) {
+ struct ztsscale *tsp = &zts_scale;
+
+ /* Scale down to the screen resolution. */
+ tp.x = ((tp.x - tsp->ts_minx) * sc->sc_resx) /
+ (tsp->ts_maxx - tsp->ts_minx);
+ tp.y = ((tp.y - tsp->ts_miny) * sc->sc_resy) /
+ (tsp->ts_maxy - tsp->ts_miny);
+ }
+ }
if (zkbd_modstate != 0 && down) {
if(zkbd_modstate & (1 << 1)) {