summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/ipod
diff options
context:
space:
mode:
authorMichael Sparmann <theseven@rockbox.org>2011-02-09 21:39:40 +0000
committerMichael Sparmann <theseven@rockbox.org>2011-02-09 21:39:40 +0000
commitacf54bed55752c1d2af6e9067e84b43d278cf01a (patch)
tree0178ba25650f25882ef1c859fc0f41ab354cc7e4 /firmware/target/arm/ipod
parentbf1ca7041e37d7e050ba0cb8d3ecc5accd302021 (diff)
downloadrockbox-acf54bed55752c1d2af6e9067e84b43d278cf01a.tar.gz
rockbox-acf54bed55752c1d2af6e9067e84b43d278cf01a.tar.bz2
rockbox-acf54bed55752c1d2af6e9067e84b43d278cf01a.zip
iPod Classic: This time really fix the hold switch. Read it out through the power manager, and cache the result for 100 milliseconds because the power manager doesn't like being spammed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29264 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/ipod')
-rw-r--r--firmware/target/arm/ipod/button-clickwheel.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/firmware/target/arm/ipod/button-clickwheel.c b/firmware/target/arm/ipod/button-clickwheel.c
index 632936965a..a43a059692 100644
--- a/firmware/target/arm/ipod/button-clickwheel.c
+++ b/firmware/target/arm/ipod/button-clickwheel.c
@@ -87,6 +87,11 @@ int int_btn = BUTTON_NONE;
static struct wakeup button_init_wakeup;
#endif
+#if CONFIG_CPU==S5L8702
+static long holdswitch_last_read;
+static bool holdswitch_last_value;
+#endif
+
#ifdef CPU_PP
static void opto_i2c_init(void)
{
@@ -372,7 +377,8 @@ void button_init_device(void)
#if CONFIG_CPU==S5L8701
INTMSK |= (1<<26);
#elif CONFIG_CPU==S5L8702
- //TODO: Implement
+ holdswitch_last_read = USEC_TIMER;
+ holdswitch_last_value = (pmu_read(0x87) & 2) == 0;
#endif
s5l_clickwheel_init();
wakeup_wait(&button_init_wakeup, HZ / 10);
@@ -383,7 +389,12 @@ bool button_hold(void)
#if CONFIG_CPU==S5L8701
return ((PDAT14 & (1 << 6)) == 0);
#elif CONFIG_CPU==S5L8702
- return ((PDATE & (1 << 4)) == 0);
+ if (USEC_TIMER - holdswitch_last_read > 100000)
+ {
+ holdswitch_last_read = USEC_TIMER;
+ holdswitch_last_value = (pmu_read(0x87) & 2) == 0;
+ }
+ return holdswitch_last_value;
#endif
}