summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCástor Muñoz <cmvidal@gmail.com>2016-05-25 23:15:43 +0200
committerCástor Muñoz <cmvidal@gmail.com>2016-05-26 02:15:28 +0200
commitd8989b15b79b4732df147b35bbf0beb39be06065 (patch)
tree5c42430be4a9905748ec5fb9960c52bfe62402d2
parenta6b4bf3a338799ad6266f99ec0475142f120f863 (diff)
downloadrockbox-d8989b15b79b4732df147b35bbf0beb39be06065.tar.gz
rockbox-d8989b15b79b4732df147b35bbf0beb39be06065.zip
iPod Classic: use PMU interrupts to detect hold switch
Finally the hold switch workaround is removed and it is detected in the same way as OF does. Change-Id: Iceac6ca48ffd131b8ee9f62ffdc2b3e30eb02042
-rw-r--r--firmware/target/arm/ipod/button-clickwheel.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/firmware/target/arm/ipod/button-clickwheel.c b/firmware/target/arm/ipod/button-clickwheel.c
index 5f138aaf1b..5b7e10b39a 100644
--- a/firmware/target/arm/ipod/button-clickwheel.c
+++ b/firmware/target/arm/ipod/button-clickwheel.c
@@ -42,6 +42,10 @@
42#ifdef IPOD_NANO2G 42#ifdef IPOD_NANO2G
43#include "pmu-target.h" 43#include "pmu-target.h"
44#endif 44#endif
45#ifdef IPOD_6G
46#include "pmu-target.h"
47#include "clocking-s5l8702.h"
48#endif
45 49
46#define WHEEL_FAST_OFF_TIMEOUT 250000 /* timeout for acceleration = 250ms */ 50#define WHEEL_FAST_OFF_TIMEOUT 250000 /* timeout for acceleration = 250ms */
47#define WHEEL_REPEAT_TIMEOUT 250000 /* timeout for button repeat = 250ms */ 51#define WHEEL_REPEAT_TIMEOUT 250000 /* timeout for button repeat = 250ms */
@@ -271,12 +275,6 @@ static inline int ipod_4g_button_read(void)
271 semaphore_release(&button_init_wakeup); 275 semaphore_release(&button_init_wakeup);
272 } 276 }
273#endif 277#endif
274#if CONFIG_CPU==S5L8702
275 else if (status == 0xAAAAAAAA)
276 {
277 GPIOCMD = 0xe040f; /* DOUT = Output High */
278 }
279#endif
280 278
281#ifdef CPU_PP 279#ifdef CPU_PP
282 } 280 }
@@ -368,11 +366,9 @@ static void s5l_clickwheel_init(void)
368 WHEEL04 |= 1; 366 WHEEL04 |= 1;
369 PDAT10 &= ~2; 367 PDAT10 &= ~2;
370#elif CONFIG_CPU==S5L8702 368#elif CONFIG_CPU==S5L8702
371 PWRCON(1) &= ~(1 << 1); /* unmask clockgate */ 369 clockgate_enable(CLOCKGATE_CWHEEL, true);
372 WHEEL00 = 0; /* stop s5l8702 controller */ 370 PCONE = (PCONE & ~0x00ffff00) | 0x00222200;
373 PUNB(14) &= ~(1 << 2); /* disable pull-up for GPIO E2 */ 371 WHEEL00 = 0; /* stop s5l8702 controller */
374 udelay(100);
375 PCON(14) = (PCON(14) & ~0x00ffff00) | 0x00222200;
376 WHEELINT = 7; 372 WHEELINT = 7;
377 WHEEL10 = 1; 373 WHEEL10 = 1;
378 WHEEL00 = 0x380000; 374 WHEEL00 = 0x380000;
@@ -390,12 +386,6 @@ void button_init_device(void)
390#endif 386#endif
391 s5l_clickwheel_init(); 387 s5l_clickwheel_init();
392 semaphore_wait(&button_init_wakeup, HZ / 10); 388 semaphore_wait(&button_init_wakeup, HZ / 10);
393#if CONFIG_CPU==S5L8702
394 /* configure GPIO E2 as pull-up input */
395 PUNB(14) |= (1 << 2);
396 udelay(100);
397 GPIOCMD = 0xe0200;
398#endif
399} 389}
400 390
401bool button_hold(void) 391bool button_hold(void)
@@ -407,7 +397,7 @@ bool button_hold(void)
407 else PCON15 = (PCON15 & ~0xffff0000) | 0x22220000; 397 else PCON15 = (PCON15 & ~0xffff0000) | 0x22220000;
408 return value; 398 return value;
409#elif CONFIG_CPU==S5L8702 399#elif CONFIG_CPU==S5L8702
410 return ((PDATE & (1 << 2)) == 0); 400 return pmu_holdswitch_locked();
411#endif 401#endif
412} 402}
413 403
@@ -450,7 +440,9 @@ int button_read_device(void)
450 WHEEL10 = 0; 440 WHEEL10 = 0;
451 PWRCONEXT |= 1; 441 PWRCONEXT |= 1;
452#elif CONFIG_CPU==S5L8702 442#elif CONFIG_CPU==S5L8702
453 GPIOCMD = 0xe040e; /* DOUT = Output Low */ 443 WHEEL00 = 0;
444 PCONE = (PCONE & ~0x00ffff00) | 0x000e0e00;
445 clockgate_enable(CLOCKGATE_CWHEEL, false);
454#endif 446#endif
455 } 447 }
456 else 448 else
@@ -463,7 +455,7 @@ int button_read_device(void)
463 pmu_ldo_power_on(1); /* enable clickwheel power supply */ 455 pmu_ldo_power_on(1); /* enable clickwheel power supply */
464 s5l_clickwheel_init(); 456 s5l_clickwheel_init();
465#elif CONFIG_CPU==S5L8702 457#elif CONFIG_CPU==S5L8702
466 GPIOCMD = 0xe040f; /* DOUT = Output High */ 458 s5l_clickwheel_init();
467#endif 459#endif
468 } 460 }
469 } 461 }