summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Arigo <markarigo@gmail.com>2008-12-19 03:31:26 +0000
committerMark Arigo <markarigo@gmail.com>2008-12-19 03:31:26 +0000
commit9bf93ba0075adf2b9e3291497e06918634d39880 (patch)
tree8c0ac278d72dba1e7633380a4f1422c1e58b9080
parentb15d837d3397f7b48a578a986bb3613bc6affe61 (diff)
downloadrockbox-9bf93ba0075adf2b9e3291497e06918634d39880.tar.gz
rockbox-9bf93ba0075adf2b9e3291497e06918634d39880.zip
Working touchpad for the Philips HDD1630 using the Synaptics driver. Like the m:robe 100, the strip is divided into up, select, and down button regions. You can't swipe like in the OF. The keymap still needs some work.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19480 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/SOURCES3
-rw-r--r--firmware/drivers/synaptics-mep.c16
-rw-r--r--firmware/target/arm/olympus/mrobe-100/button-target.h3
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/button-hdd1630.c156
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/button-target.h4
-rw-r--r--firmware/target/arm/system-pp502x.c8
6 files changed, 159 insertions, 31 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 86dc160291..278fcda9d6 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -535,6 +535,9 @@ target/arm/i2s-pp.c
535 535
536#ifdef PHILIPS_HDD1630 536#ifdef PHILIPS_HDD1630
537#ifndef SIMULATOR 537#ifndef SIMULATOR
538#ifndef BOOTLOADER
539drivers/synaptics-mep.c
540#endif /* BOOTLOADER */
538target/arm/ata-as-arm.S 541target/arm/ata-as-arm.S
539target/arm/ata-pp5020.c 542target/arm/ata-pp5020.c
540target/arm/wmcodec-pp.c 543target/arm/wmcodec-pp.c
diff --git a/firmware/drivers/synaptics-mep.c b/firmware/drivers/synaptics-mep.c
index 44b186034f..858edf54fe 100644
--- a/firmware/drivers/synaptics-mep.c
+++ b/firmware/drivers/synaptics-mep.c
@@ -32,6 +32,7 @@
32/* Driver for the Synaptics Touchpad based on the "Synaptics Modular Embedded 32/* Driver for the Synaptics Touchpad based on the "Synaptics Modular Embedded
33 Protocol: 3-Wire Interface Specification" documentation */ 33 Protocol: 3-Wire Interface Specification" documentation */
34 34
35#if defined(MROBE_100)
35#define ACK (GPIOD_INPUT_VAL & 0x1) 36#define ACK (GPIOD_INPUT_VAL & 0x1)
36#define ACK_HI GPIOD_OUTPUT_VAL |= 0x1 37#define ACK_HI GPIOD_OUTPUT_VAL |= 0x1
37#define ACK_LO GPIOD_OUTPUT_VAL &= ~0x1 38#define ACK_LO GPIOD_OUTPUT_VAL &= ~0x1
@@ -45,6 +46,21 @@
45#define DATA_LO GPIOD_OUTPUT_EN |= 0x4; GPIOD_OUTPUT_VAL &= ~0x4 46#define DATA_LO GPIOD_OUTPUT_EN |= 0x4; GPIOD_OUTPUT_VAL &= ~0x4
46#define DATA_CL GPIOD_OUTPUT_EN &= ~0x4 47#define DATA_CL GPIOD_OUTPUT_EN &= ~0x4
47 48
49#elif defined(PHILIPS_HDD1630)
50#define ACK (GPIOD_INPUT_VAL & 0x80)
51#define ACK_HI GPIOD_OUTPUT_VAL |= 0x80
52#define ACK_LO GPIOD_OUTPUT_VAL &= ~0x80
53
54#define CLK ((GPIOA_INPUT_VAL & 0x20) >> 5)
55#define CLK_HI GPIOA_OUTPUT_VAL |= 0x20
56#define CLK_LO GPIOA_OUTPUT_VAL &= ~0x20
57
58#define DATA ((GPIOA_INPUT_VAL & 0x10) >> 4)
59#define DATA_HI GPIOA_OUTPUT_EN |= 0x10; GPIOA_OUTPUT_VAL |= 0x10
60#define DATA_LO GPIOA_OUTPUT_EN |= 0x10; GPIOA_OUTPUT_VAL &= ~0x10
61#define DATA_CL GPIOA_OUTPUT_EN &= ~0x10
62#endif
63
48#define LO 0 64#define LO 0
49#define HI 1 65#define HI 1
50 66
diff --git a/firmware/target/arm/olympus/mrobe-100/button-target.h b/firmware/target/arm/olympus/mrobe-100/button-target.h
index 7f230831b1..c6b2c1067f 100644
--- a/firmware/target/arm/olympus/mrobe-100/button-target.h
+++ b/firmware/target/arm/olympus/mrobe-100/button-target.h
@@ -30,7 +30,10 @@
30bool button_hold(void); 30bool button_hold(void);
31void button_init_device(void); 31void button_init_device(void);
32int button_read_device(void); 32int button_read_device(void);
33
34#ifndef BOOTLOADER
33void button_int(void); 35void button_int(void);
36#endif
34 37
35#define POWEROFF_BUTTON BUTTON_POWER 38#define POWEROFF_BUTTON BUTTON_POWER
36#define POWEROFF_COUNT 10 39#define POWEROFF_COUNT 10
diff --git a/firmware/target/arm/philips/hdd1630/button-hdd1630.c b/firmware/target/arm/philips/hdd1630/button-hdd1630.c
index 84cb8f0c06..8976e7325c 100755
--- a/firmware/target/arm/philips/hdd1630/button-hdd1630.c
+++ b/firmware/target/arm/philips/hdd1630/button-hdd1630.c
@@ -22,9 +22,16 @@
22#include "system.h" 22#include "system.h"
23#include "button.h" 23#include "button.h"
24#include "backlight.h" 24#include "backlight.h"
25#include "synaptics-mep.h"
25 26
26/* Remember last buttons, to make single buzz sound */ 27#define LOGF_ENABLE
27int btn_old; 28#include "logf.h"
29
30#define MEP_BUTTON_HEADER 0x19
31#define MEP_BUTTON_ID 0x9
32#define MEP_ABSOLUTE_HEADER 0x0b
33
34static int int_btn = BUTTON_NONE;
28 35
29/* 36/*
30 * Generate a click sound from the player (not in headphones yet) 37 * Generate a click sound from the player (not in headphones yet)
@@ -38,10 +45,117 @@ void button_click(void)
38 GPO32_VAL &= ~0x2000; 45 GPO32_VAL &= ~0x2000;
39} 46}
40 47
48#ifndef BOOTLOADER
49static int syn_status = 0;
50
41void button_init_device(void) 51void button_init_device(void)
42{ 52{
43 /* TODO...for now, hardware initialisation is done by the bootloader */ 53 /* enable touchpad */
54 GPO32_ENABLE |= 0x80;
55 GPO32_VAL &= ~0x80;
56 udelay(1000);
57
58 /* enable ACK, CLK, DATA lines */
59 GPIOD_ENABLE |= 0x80;
60 GPIOA_ENABLE |= (0x10 | 0x20);
61
62 GPIOD_OUTPUT_EN |= 0x80; /* ACK */
63 GPIOD_OUTPUT_VAL |= 0x80; /* high */
64
65 GPIOA_OUTPUT_EN &= ~0x20; /* CLK */
66
67 GPIOA_OUTPUT_EN |= 0x10; /* DATA */
68 GPIOA_OUTPUT_VAL |= 0x10; /* high */
69
70 if (syn_init())
71 {
72#ifdef ROCKBOX_HAS_LOGF
73 syn_info();
74#endif
75 syn_status = 1;
76
77 /* enable interrupts */
78 GPIOA_INT_LEV &= ~0x20;
79 GPIOA_INT_CLR |= 0x20;
80 GPIOA_INT_EN |= 0x20;
81
82 CPU_INT_EN |= HI_MASK;
83 CPU_HI_INT_EN |= GPIO0_MASK;
84 }
85}
86
87/*
88 * Button interrupt handler
89 */
90void button_int(void)
91{
92 int data[4];
93 int val, id;
94
95 int_btn = BUTTON_NONE;
96
97 if (syn_status)
98 {
99 /* disable interrupt while we read the touchpad */
100 GPIOA_INT_EN &= ~0x20;
101 GPIOA_INT_CLR |= 0x20;
102
103 val = syn_read_device(data, 4);
104 if (val > 0)
105 {
106 val = data[0] & 0xff; /* packet header */
107 id = (data[1] >> 4) & 0xf; /* packet id */
108
109 logf("button_read_device...");
110 logf(" data[0] = 0x%08x", data[0]);
111 logf(" data[1] = 0x%08x", data[1]);
112 logf(" data[2] = 0x%08x", data[2]);
113 logf(" data[3] = 0x%08x", data[3]);
114
115 if ((val == MEP_BUTTON_HEADER) && (id == MEP_BUTTON_ID))
116 {
117 /* Buttons packet */
118 if (data[1] & 0x1)
119 int_btn |= BUTTON_LEFT;
120 if (data[1] & 0x2)
121 int_btn |= BUTTON_RIGHT;
122
123 /* An Absolute packet should follow which we ignore */
124 val = syn_read_device(data, 4);
125 logf(" int_btn = 0x%04x", int_btn);
126 }
127 else if (val == MEP_ABSOLUTE_HEADER)
128 {
129 /* Absolute packet - the finger is on the vertical strip.
130 Position ranges from 1-4095, with 1 at the bottom. */
131 val = ((data[1] >> 4) << 8) | data[2]; /* position */
132
133 logf(" pos %d", val);
134 logf(" z %d", data[3]);
135 logf(" finger %d", data[1] & 0x1);
136 logf(" gesture %d", data[1] & 0x2);
137 logf(" RelPosVld %d", data[1] & 0x4);
138
139 if(data[1] & 0x1) /* if finger on touch strip */
140 {
141 if ((val > 0) && (val <= 1365))
142 int_btn |= BUTTON_DOWN;
143 else if ((val > 1365) && (val <= 2730))
144 int_btn |= BUTTON_SELECT;
145 else if ((val > 2730) && (val <= 4095))
146 int_btn |= BUTTON_UP;
147 }
148 }
149 }
150
151 /* re-enable interrupts */
152 GPIOA_INT_LEV &= ~0x20;
153 GPIOA_INT_EN |= 0x20;
154 }
44} 155}
156#else
157void button_init_device(void){}
158#endif /* bootloader */
45 159
46bool button_hold(void) 160bool button_hold(void)
47{ 161{
@@ -53,34 +167,20 @@ bool button_hold(void)
53 */ 167 */
54int button_read_device(void) 168int button_read_device(void)
55{ 169{
56 int btn = BUTTON_NONE; 170 static int btn_old = BUTTON_NONE;
57 static bool hold_button = false; 171 int btn = int_btn;
58 bool hold_button_old;
59 172
60 /* Hold */ 173 /* Hold */
61 hold_button_old = hold_button; 174 if(button_hold())
62 hold_button = button_hold(); 175 return BUTTON_NONE;
63 176
64 /* device buttons */ 177 /* Device buttons */
65 if (!hold_button) 178 if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_MENU;
66 { 179 if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_VOL_UP;
67 /* These are the correct button definitions 180 if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN;
68 if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_MENU; 181 if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_VIEW;
69 if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_VOL_UP; 182 if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST;
70 if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; 183 if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER;
71 if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_VIEW;
72 if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST;
73 if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER;
74 */
75
76 /* This is a hack until the touchpad works */
77 if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_LEFT; /* BUTTON_MENU */
78 if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_UP; /* BUTTON_VOL_UP */
79 if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_DOWN; /* BUTTON_VOL_DOWN */
80 if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_RIGHT; /* BUTTON_VIEW */
81 if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_SELECT; /* BUTTON_PLAYLIST */
82 if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER;
83 }
84 184
85 if ((btn != btn_old) && (btn != BUTTON_NONE)) 185 if ((btn != btn_old) && (btn != BUTTON_NONE))
86 button_click(); 186 button_click();
diff --git a/firmware/target/arm/philips/hdd1630/button-target.h b/firmware/target/arm/philips/hdd1630/button-target.h
index 65cc4539cf..cd5b13775e 100755
--- a/firmware/target/arm/philips/hdd1630/button-target.h
+++ b/firmware/target/arm/philips/hdd1630/button-target.h
@@ -31,6 +31,10 @@ bool button_hold(void);
31void button_init_device(void); 31void button_init_device(void);
32int button_read_device(void); 32int button_read_device(void);
33 33
34#ifndef BOOTLOADER
35void button_int(void);
36#endif
37
34/* Main unit's buttons */ 38/* Main unit's buttons */
35#define BUTTON_POWER 0x00000001 39#define BUTTON_POWER 0x00000001
36#define BUTTON_PLAYLIST 0x00000002 40#define BUTTON_PLAYLIST 0x00000002
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index 0f336576d8..d683b3a561 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -34,9 +34,6 @@ extern void TIMER1(void);
34extern void TIMER2(void); 34extern void TIMER2(void);
35extern void ipod_mini_button_int(void); /* iPod Mini 1st gen only */ 35extern void ipod_mini_button_int(void); /* iPod Mini 1st gen only */
36extern void ipod_4g_button_int(void); /* iPod 4th gen and higher only */ 36extern void ipod_4g_button_int(void); /* iPod 4th gen and higher only */
37#ifdef MROBE_100
38extern void button_int(void);
39#endif
40 37
41void irq(void) 38void irq(void)
42{ 39{
@@ -75,6 +72,11 @@ void irq(void)
75 if (GPIOD_INT_STAT & 0x2) 72 if (GPIOD_INT_STAT & 0x2)
76 button_int(); 73 button_int();
77 } 74 }
75#elif defined(PHILIPS_HDD1630)
76 else if (CPU_HI_INT_STAT & GPIO0_MASK) {
77 if (GPIOA_INT_STAT & 0x20)
78 button_int();
79 }
78#endif 80#endif
79#ifdef HAVE_USBSTACK 81#ifdef HAVE_USBSTACK
80 else if (CPU_INT_STAT & USB_MASK) { 82 else if (CPU_INT_STAT & USB_MASK) {