Commit e62ab7a153c92d6233a4eec432ac0c42c5d336c0

Authored by balrog
1 parent 1d4e547b

Improve tsc2005 touchscreen usability.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4401 c046a42c-6fe2-441c-8c8c-71466251a162
hw/max7310.c
@@ -134,8 +134,8 @@ static void max7310_event(i2c_slave *i2c, enum i2c_event event) @@ -134,8 +134,8 @@ static void max7310_event(i2c_slave *i2c, enum i2c_event event)
134 s->i2c_command_byte = 1; 134 s->i2c_command_byte = 1;
135 break; 135 break;
136 case I2C_FINISH: 136 case I2C_FINISH:
137 - if (s->len == 1)  
138 #ifdef VERBOSE 137 #ifdef VERBOSE
  138 + if (s->len == 1)
139 printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->len); 139 printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->len);
140 #endif 140 #endif
141 break; 141 break;
hw/tsc2005.c
@@ -23,13 +23,6 @@ @@ -23,13 +23,6 @@
23 #include "hw.h" 23 #include "hw.h"
24 #include "qemu-timer.h" 24 #include "qemu-timer.h"
25 #include "console.h" 25 #include "console.h"
26 -#include "omap.h"  
27 -  
28 -#define TSC_DATA_REGISTERS_PAGE 0x0  
29 -#define TSC_CONTROL_REGISTERS_PAGE 0x1  
30 -#define TSC_AUDIO_REGISTERS_PAGE 0x2  
31 -  
32 -#define TSC_VERBOSE  
33 26
34 #define TSC_CUT_RESOLUTION(value, p) ((value) >> (16 - (p ? 12 : 10))) 27 #define TSC_CUT_RESOLUTION(value, p) ((value) >> (16 - (p ? 12 : 10)))
35 28
@@ -115,9 +108,6 @@ static const uint16_t mode_regs[16] = { @@ -115,9 +108,6 @@ static const uint16_t mode_regs[16] = {
115 #define TEMP1_VAL (1264 << 4) /* +/- 5 at 12-bit */ 108 #define TEMP1_VAL (1264 << 4) /* +/- 5 at 12-bit */
116 #define TEMP2_VAL (1531 << 4) /* +/- 5 at 12-bit */ 109 #define TEMP2_VAL (1531 << 4) /* +/- 5 at 12-bit */
117 110
118 -#define TSC_POWEROFF_DELAY 50  
119 -#define TSC_SOFTSTEP_DELAY 50  
120 -  
121 static uint16_t tsc2005_read(struct tsc2005_state_s *s, int reg) 111 static uint16_t tsc2005_read(struct tsc2005_state_s *s, int reg)
122 { 112 {
123 uint16_t ret; 113 uint16_t ret;
@@ -250,9 +240,6 @@ static void tsc2005_pin_update(struct tsc2005_state_s *s) @@ -250,9 +240,6 @@ static void tsc2005_pin_update(struct tsc2005_state_s *s)
250 pin_state = !s->pressure; 240 pin_state = !s->pressure;
251 } 241 }
252 242
253 - if (!s->enabled)  
254 - pin_state = 0;  
255 -  
256 if (pin_state != s->irq) { 243 if (pin_state != s->irq) {
257 s->irq = pin_state; 244 s->irq = pin_state;
258 qemu_set_irq(s->pint, s->irq); 245 qemu_set_irq(s->pint, s->irq);
@@ -261,6 +248,8 @@ static void tsc2005_pin_update(struct tsc2005_state_s *s) @@ -261,6 +248,8 @@ static void tsc2005_pin_update(struct tsc2005_state_s *s)
261 switch (s->nextfunction) { 248 switch (s->nextfunction) {
262 case TSC_MODE_XYZ_SCAN: 249 case TSC_MODE_XYZ_SCAN:
263 case TSC_MODE_XY_SCAN: 250 case TSC_MODE_XY_SCAN:
  251 + if (!s->host_mode && s->dav)
  252 + s->enabled = 0;
264 if (!s->pressure) 253 if (!s->pressure)
265 return; 254 return;
266 /* Fall through */ 255 /* Fall through */
@@ -344,6 +333,9 @@ uint8_t tsc2005_txrx_word(void *opaque, uint8_t value) @@ -344,6 +333,9 @@ uint8_t tsc2005_txrx_word(void *opaque, uint8_t value)
344 s->enabled = !(value & 1); 333 s->enabled = !(value & 1);
345 fprintf(stderr, "%s: touchscreen sense %sabled\n", 334 fprintf(stderr, "%s: touchscreen sense %sabled\n",
346 __FUNCTION__, s->enabled ? "en" : "dis"); 335 __FUNCTION__, s->enabled ? "en" : "dis");
  336 + if (s->busy && !s->enabled)
  337 + qemu_del_timer(s->timer);
  338 + s->busy &= s->enabled;
347 } 339 }
348 tsc2005_pin_update(s); 340 tsc2005_pin_update(s);
349 } 341 }
hw/tsc210x.c
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 #include "audio/audio.h" 25 #include "audio/audio.h"
26 #include "qemu-timer.h" 26 #include "qemu-timer.h"
27 #include "console.h" 27 #include "console.h"
28 -#include "omap.h" 28 +#include "omap.h" /* For struct i2s_codec_s and struct uwire_slave_s */
29 29
30 #define TSC_DATA_REGISTERS_PAGE 0x0 30 #define TSC_DATA_REGISTERS_PAGE 0x0
31 #define TSC_CONTROL_REGISTERS_PAGE 0x1 31 #define TSC_CONTROL_REGISTERS_PAGE 0x1