aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/h3600_ts_input.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-05-29 03:28:50 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2005-05-29 03:28:50 -0400
commitde1b963a416232bf429550ee475d6b9a34b66309 (patch)
tree96dd6265709962098339688a89d1ba0e3310b65a /drivers/input/touchscreen/h3600_ts_input.c
parentd083e90660657bf6bde508ba6c3eaa75eb4cf1f6 (diff)
Input: whitespace fixes in drivers/input/touchscreen
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/h3600_ts_input.c')
-rw-r--r--drivers/input/touchscreen/h3600_ts_input.c180
1 files changed, 90 insertions, 90 deletions
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c
index acb9137a0226..bcfa1e36f957 100644
--- a/drivers/input/touchscreen/h3600_ts_input.c
+++ b/drivers/input/touchscreen/h3600_ts_input.c
@@ -89,9 +89,9 @@ MODULE_LICENSE("GPL");
89#define H3600_SCANCODE_Q 4 /* 4 -> Q button */ 89#define H3600_SCANCODE_Q 4 /* 4 -> Q button */
90#define H3600_SCANCODE_START 5 /* 5 -> start menu */ 90#define H3600_SCANCODE_START 5 /* 5 -> start menu */
91#define H3600_SCANCODE_UP 6 /* 6 -> up */ 91#define H3600_SCANCODE_UP 6 /* 6 -> up */
92#define H3600_SCANCODE_RIGHT 7 /* 7 -> right */ 92#define H3600_SCANCODE_RIGHT 7 /* 7 -> right */
93#define H3600_SCANCODE_LEFT 8 /* 8 -> left */ 93#define H3600_SCANCODE_LEFT 8 /* 8 -> left */
94#define H3600_SCANCODE_DOWN 9 /* 9 -> down */ 94#define H3600_SCANCODE_DOWN 9 /* 9 -> down */
95 95
96static char *h3600_name = "H3600 TouchScreen"; 96static char *h3600_name = "H3600 TouchScreen";
97 97
@@ -113,7 +113,7 @@ struct h3600_dev {
113 113
114static irqreturn_t action_button_handler(int irq, void *dev_id, struct pt_regs *regs) 114static irqreturn_t action_button_handler(int irq, void *dev_id, struct pt_regs *regs)
115{ 115{
116 int down = (GPLR & GPIO_BITSY_ACTION_BUTTON) ? 0 : 1; 116 int down = (GPLR & GPIO_BITSY_ACTION_BUTTON) ? 0 : 1;
117 struct input_dev *dev = (struct input_dev *) dev_id; 117 struct input_dev *dev = (struct input_dev *) dev_id;
118 118
119 input_regs(dev, regs); 119 input_regs(dev, regs);
@@ -125,7 +125,7 @@ static irqreturn_t action_button_handler(int irq, void *dev_id, struct pt_regs *
125 125
126static irqreturn_t npower_button_handler(int irq, void *dev_id, struct pt_regs *regs) 126static irqreturn_t npower_button_handler(int irq, void *dev_id, struct pt_regs *regs)
127{ 127{
128 int down = (GPLR & GPIO_BITSY_NPOWER_BUTTON) ? 0 : 1; 128 int down = (GPLR & GPIO_BITSY_NPOWER_BUTTON) ? 0 : 1;
129 struct input_dev *dev = (struct input_dev *) dev_id; 129 struct input_dev *dev = (struct input_dev *) dev_id;
130 130
131 /* 131 /*
@@ -145,8 +145,8 @@ static irqreturn_t npower_button_handler(int irq, void *dev_id, struct pt_regs *
145static int flite_brightness = 25; 145static int flite_brightness = 25;
146 146
147enum flite_pwr { 147enum flite_pwr {
148 FLITE_PWR_OFF = 0, 148 FLITE_PWR_OFF = 0,
149 FLITE_PWR_ON = 1 149 FLITE_PWR_ON = 1
150}; 150};
151 151
152/* 152/*
@@ -157,9 +157,9 @@ unsigned int h3600_flite_power(struct input_dev *dev, enum flite_pwr pwr)
157 struct h3600_dev *ts = dev->private; 157 struct h3600_dev *ts = dev->private;
158 158
159 /* Must be in this order */ 159 /* Must be in this order */
160 ts->serio->write(ts->serio, 1); 160 ts->serio->write(ts->serio, 1);
161 ts->serio->write(ts->serio, pwr); 161 ts->serio->write(ts->serio, pwr);
162 ts->serio->write(ts->serio, brightness); 162 ts->serio->write(ts->serio, brightness);
163 return 0; 163 return 0;
164} 164}
165 165
@@ -169,26 +169,26 @@ static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req,
169{ 169{
170 struct input_dev *dev = (struct input_dev *) data; 170 struct input_dev *dev = (struct input_dev *) data;
171 171
172 switch (req) { 172 switch (req) {
173 case PM_SUSPEND: /* enter D1-D3 */ 173 case PM_SUSPEND: /* enter D1-D3 */
174 suspended = 1; 174 suspended = 1;
175 h3600_flite_power(dev, FLITE_PWR_OFF); 175 h3600_flite_power(dev, FLITE_PWR_OFF);
176 break; 176 break;
177 case PM_BLANK: 177 case PM_BLANK:
178 if (!suspended) 178 if (!suspended)
179 h3600_flite_power(dev, FLITE_PWR_OFF); 179 h3600_flite_power(dev, FLITE_PWR_OFF);
180 break; 180 break;
181 case PM_RESUME: /* enter D0 */ 181 case PM_RESUME: /* enter D0 */
182 /* same as unblank */ 182 /* same as unblank */
183 case PM_UNBLANK: 183 case PM_UNBLANK:
184 if (suspended) { 184 if (suspended) {
185 //initSerial(); 185 //initSerial();
186 suspended = 0; 186 suspended = 0;
187 } 187 }
188 h3600_flite_power(dev, FLITE_PWR_ON); 188 h3600_flite_power(dev, FLITE_PWR_ON);
189 break; 189 break;
190 } 190 }
191 return 0; 191 return 0;
192} 192}
193#endif 193#endif
194 194
@@ -199,25 +199,25 @@ static int h3600ts_pm_callback(struct pm_dev *pm_dev, pm_request_t req,
199 */ 199 */
200static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs) 200static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs)
201{ 201{
202 struct input_dev *dev = &ts->dev; 202 struct input_dev *dev = &ts->dev;
203 static int touched = 0; 203 static int touched = 0;
204 int key, down = 0; 204 int key, down = 0;
205 205
206 input_regs(dev, regs); 206 input_regs(dev, regs);
207 207
208 switch (ts->event) { 208 switch (ts->event) {
209 /* 209 /*
210 Buttons - returned as a single byte 210 Buttons - returned as a single byte
211 7 6 5 4 3 2 1 0 211 7 6 5 4 3 2 1 0
212 S x x x N N N N 212 S x x x N N N N
213 213
214 S switch state ( 0=pressed 1=released) 214 S switch state ( 0=pressed 1=released)
215 x Unused. 215 x Unused.
216 NNNN switch number 0-15 216 NNNN switch number 0-15
217 217
218 Note: This is true for non interrupt generated key events. 218 Note: This is true for non interrupt generated key events.
219 */ 219 */
220 case KEYBD_ID: 220 case KEYBD_ID:
221 down = (ts->buf[0] & 0x80) ? 0 : 1; 221 down = (ts->buf[0] & 0x80) ? 0 : 1;
222 222
223 switch (ts->buf[0] & 0x7f) { 223 switch (ts->buf[0] & 0x7f) {
@@ -229,40 +229,40 @@ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs)
229 break; 229 break;
230 case H3600_SCANCODE_CONTACTS: 230 case H3600_SCANCODE_CONTACTS:
231 key = KEY_PROG2; 231 key = KEY_PROG2;
232 break; 232 break;
233 case H3600_SCANCODE_Q: 233 case H3600_SCANCODE_Q:
234 key = KEY_Q; 234 key = KEY_Q;
235 break; 235 break;
236 case H3600_SCANCODE_START: 236 case H3600_SCANCODE_START:
237 key = KEY_PROG3; 237 key = KEY_PROG3;
238 break; 238 break;
239 case H3600_SCANCODE_UP: 239 case H3600_SCANCODE_UP:
240 key = KEY_UP; 240 key = KEY_UP;
241 break; 241 break;
242 case H3600_SCANCODE_RIGHT: 242 case H3600_SCANCODE_RIGHT:
243 key = KEY_RIGHT; 243 key = KEY_RIGHT;
244 break; 244 break;
245 case H3600_SCANCODE_LEFT: 245 case H3600_SCANCODE_LEFT:
246 key = KEY_LEFT; 246 key = KEY_LEFT;
247 break; 247 break;
248 case H3600_SCANCODE_DOWN: 248 case H3600_SCANCODE_DOWN:
249 key = KEY_DOWN; 249 key = KEY_DOWN;
250 break; 250 break;
251 default: 251 default:
252 key = 0; 252 key = 0;
253 } 253 }
254 if (key) 254 if (key)
255 input_report_key(dev, key, down); 255 input_report_key(dev, key, down);
256 break; 256 break;
257 /* 257 /*
258 * Native touchscreen event data is formatted as shown below:- 258 * Native touchscreen event data is formatted as shown below:-
259 * 259 *
260 * +-------+-------+-------+-------+ 260 * +-------+-------+-------+-------+
261 * | Xmsb | Xlsb | Ymsb | Ylsb | 261 * | Xmsb | Xlsb | Ymsb | Ylsb |
262 * +-------+-------+-------+-------+ 262 * +-------+-------+-------+-------+
263 * byte 0 1 2 3 263 * byte 0 1 2 3
264 */ 264 */
265 case TOUCHS_ID: 265 case TOUCHS_ID:
266 if (!touched) { 266 if (!touched) {
267 input_report_key(dev, BTN_TOUCH, 1); 267 input_report_key(dev, BTN_TOUCH, 1);
268 touched = 1; 268 touched = 1;
@@ -272,19 +272,19 @@ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs)
272 unsigned short x, y; 272 unsigned short x, y;
273 273
274 x = ts->buf[0]; x <<= 8; x += ts->buf[1]; 274 x = ts->buf[0]; x <<= 8; x += ts->buf[1];
275 y = ts->buf[2]; y <<= 8; y += ts->buf[3]; 275 y = ts->buf[2]; y <<= 8; y += ts->buf[3];
276 276
277 input_report_abs(dev, ABS_X, x); 277 input_report_abs(dev, ABS_X, x);
278 input_report_abs(dev, ABS_Y, y); 278 input_report_abs(dev, ABS_Y, y);
279 } else { 279 } else {
280 input_report_key(dev, BTN_TOUCH, 0); 280 input_report_key(dev, BTN_TOUCH, 0);
281 touched = 0; 281 touched = 0;
282 } 282 }
283 break; 283 break;
284 default: 284 default:
285 /* Send a non input event elsewhere */ 285 /* Send a non input event elsewhere */
286 break; 286 break;
287 } 287 }
288 288
289 input_sync(dev); 289 input_sync(dev);
290} 290}
@@ -293,7 +293,7 @@ static void h3600ts_process_packet(struct h3600_dev *ts, struct pt_regs *regs)
293 * h3600ts_event() handles events from the input module. 293 * h3600ts_event() handles events from the input module.
294 */ 294 */
295static int h3600ts_event(struct input_dev *dev, unsigned int type, 295static int h3600ts_event(struct input_dev *dev, unsigned int type,
296 unsigned int code, int value) 296 unsigned int code, int value)
297{ 297{
298 struct h3600_dev *ts = dev->private; 298 struct h3600_dev *ts = dev->private;
299 299
@@ -332,41 +332,41 @@ static int state;
332static irqreturn_t h3600ts_interrupt(struct serio *serio, unsigned char data, 332static irqreturn_t h3600ts_interrupt(struct serio *serio, unsigned char data,
333 unsigned int flags, struct pt_regs *regs) 333 unsigned int flags, struct pt_regs *regs)
334{ 334{
335 struct h3600_dev *ts = serio_get_drvdata(serio); 335 struct h3600_dev *ts = serio_get_drvdata(serio);
336 336
337 /* 337 /*
338 * We have a new frame coming in. 338 * We have a new frame coming in.
339 */ 339 */
340 switch (state) { 340 switch (state) {
341 case STATE_SOF: 341 case STATE_SOF:
342 if (data == CHAR_SOF) 342 if (data == CHAR_SOF)
343 state = STATE_ID; 343 state = STATE_ID;
344 break; 344 break;
345 case STATE_ID: 345 case STATE_ID:
346 ts->event = (data & 0xf0) >> 4; 346 ts->event = (data & 0xf0) >> 4;
347 ts->len = (data & 0xf); 347 ts->len = (data & 0xf);
348 ts->idx = 0; 348 ts->idx = 0;
349 if (ts->event >= MAX_ID) { 349 if (ts->event >= MAX_ID) {
350 state = STATE_SOF; 350 state = STATE_SOF;
351 break; 351 break;
352 } 352 }
353 ts->chksum = data; 353 ts->chksum = data;
354 state = (ts->len > 0) ? STATE_DATA : STATE_EOF; 354 state = (ts->len > 0) ? STATE_DATA : STATE_EOF;
355 break; 355 break;
356 case STATE_DATA: 356 case STATE_DATA:
357 ts->chksum += data; 357 ts->chksum += data;
358 ts->buf[ts->idx]= data; 358 ts->buf[ts->idx]= data;
359 if(++ts->idx == ts->len) 359 if (++ts->idx == ts->len)
360 state = STATE_EOF; 360 state = STATE_EOF;
361 break; 361 break;
362 case STATE_EOF: 362 case STATE_EOF:
363 state = STATE_SOF; 363 state = STATE_SOF;
364 if (data == CHAR_EOF || data == ts->chksum) 364 if (data == CHAR_EOF || data == ts->chksum)
365 h3600ts_process_packet(ts, regs); 365 h3600ts_process_packet(ts, regs);
366 break; 366 break;
367 default: 367 default:
368 printk("Error3\n"); 368 printk("Error3\n");
369 break; 369 break;
370 } 370 }
371 371
372 return IRQ_HANDLED; 372 return IRQ_HANDLED;
@@ -390,10 +390,10 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv)
390 init_input_dev(&ts->dev); 390 init_input_dev(&ts->dev);
391 391
392 /* Device specific stuff */ 392 /* Device specific stuff */
393 set_GPIO_IRQ_edge(GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES); 393 set_GPIO_IRQ_edge(GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES);
394 set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE); 394 set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE);
395 395
396 if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler, 396 if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler,
397 SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, 397 SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM,
398 "h3600_action", &ts->dev)) { 398 "h3600_action", &ts->dev)) {
399 printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); 399 printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n");
@@ -401,7 +401,7 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv)
401 return -EBUSY; 401 return -EBUSY;
402 } 402 }
403 403
404 if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, 404 if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler,
405 SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM, 405 SA_SHIRQ | SA_INTERRUPT | SA_SAMPLE_RANDOM,
406 "h3600_suspend", &ts->dev)) { 406 "h3600_suspend", &ts->dev)) {
407 free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev); 407 free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, &ts->dev);
@@ -433,7 +433,7 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv)
433 433
434 sprintf(ts->phys, "%s/input0", serio->phys); 434 sprintf(ts->phys, "%s/input0", serio->phys);
435 435
436 ts->dev.event = h3600ts_event; 436 ts->dev.event = h3600ts_event;
437 ts->dev.private = ts; 437 ts->dev.private = ts;
438 ts->dev.name = h3600_name; 438 ts->dev.name = h3600_name;
439 ts->dev.phys = ts->phys; 439 ts->dev.phys = ts->phys;
@@ -446,8 +446,8 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv)
446 446
447 err = serio_open(serio, drv); 447 err = serio_open(serio, drv);
448 if (err) { 448 if (err) {
449 free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts); 449 free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts);
450 free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts); 450 free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts);
451 serio_set_drvdata(serio, NULL); 451 serio_set_drvdata(serio, NULL);
452 kfree(ts); 452 kfree(ts);
453 return err; 453 return err;