1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
Index: firmware/target/arm/s5l8700/ipodnano2g/button-target.h
===================================================================
--- firmware/target/arm/s5l8700/ipodnano2g/button-target.h  (revision 28606)
+++ firmware/target/arm/s5l8700/ipodnano2g/button-target.h  (working copy)
@@ -43,8 +43,9 @@
 #define BUTTON_RIGHT        0x00000008
 #define BUTTON_SCROLL_FWD   0x00000010
 #define BUTTON_SCROLL_BACK  0x00000020
+#define BUTTON_SCROLL       0x00000040

-#define BUTTON_PLAY         0x00000040
+#define BUTTON_PLAY         0x00000080

 #define BUTTON_MAIN (BUTTON_SELECT|BUTTON_MENU\
                 |BUTTON_LEFT|BUTTON_RIGHT|BUTTON_SCROLL_FWD\
Index: firmware/target/arm/ipod/button-target.h
===================================================================
--- firmware/target/arm/ipod/button-target.h  (revision 28606)
+++ firmware/target/arm/ipod/button-target.h  (working copy)
@@ -43,12 +43,13 @@
 #define BUTTON_RIGHT        0x00000008
 #define BUTTON_SCROLL_FWD   0x00000010
 #define BUTTON_SCROLL_BACK  0x00000020
+#define BUTTON_SCROLL       0x00000040

-#define BUTTON_PLAY         0x00000040
+#define BUTTON_PLAY         0x00000080

 #define BUTTON_MAIN (BUTTON_SELECT|BUTTON_MENU\
                 |BUTTON_LEFT|BUTTON_RIGHT|BUTTON_SCROLL_FWD\
-                |BUTTON_SCROLL_BACK|BUTTON_PLAY)
+                |BUTTON_SCROLL_BACK|BUTTON_SCROLL|BUTTON_PLAY)

     /* Remote control's buttons */
 #ifdef IPOD_ACCESSORY_PROTOCOL
Index: firmware/target/arm/ipod/button-clickwheel.c
===================================================================
--- firmware/target/arm/ipod/button-clickwheel.c  (revision 28606)
+++ firmware/target/arm/ipod/button-clickwheel.c  (working copy)
@@ -39,6 +39,7 @@
 #include "serial.h"
 #include "power.h"
 #include "powermgmt.h"
+#include "button-target.h"
 #if defined(IPOD_NANO2G)
 #include "pmu-target.h"
 #endif
@@ -249,6 +250,9 @@
                         }
                         last_wheel_usec = usec;
                         old_wheel_value = new_wheel_value;
+                        
+                        /* be able to read wheel action via button_read_device() */  
+                        btn |= BUTTON_SCROLL;
                     }
                 }
                 else
Index: firmware/drivers/button.c
===================================================================
--- firmware/drivers/button.c  (revision 28606)
+++ firmware/drivers/button.c  (working copy)
@@ -109,6 +109,24 @@
 }
 #endif

+#ifdef HAVE_ADJUSTABLE_CPU_FREQ
+static void gui_boost(bool state)
+{
+    static bool boosted = false;
+    
+    if (state && !boosted)
+    {
+        cpu_boost(true);
+        boosted = true;
+    }
+    else if (!state && boosted)
+    {
+        cpu_boost(false);
+        boosted = false;
+    }
+}
+#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
+
 static bool button_try_post(int button, int data)
 {
 #ifdef HAVE_TOUCHSCREEN
@@ -151,6 +169,9 @@
     static bool skip_remote_release = false;
 #endif
 #endif
+#ifdef HAVE_ADJUSTABLE_CPU_FREQ
+    static long last_button_tick;
+#endif
     int diff;
     int btn;
 #ifdef HAVE_BUTTON_DATA
@@ -181,6 +202,19 @@
     }
 #endif

+#ifdef HAVE_ADJUSTABLE_CPU_FREQ
+    /* Boost gui on button activity, unboost gui after timeout (1 sec). */
+    if (BUTTON_NONE != btn)
+    {
+        last_button_tick = current_tick;
+        gui_boost(true);
+    }
+    else if (TIME_AFTER(current_tick, last_button_tick + HZ))
+    {
+        gui_boost(false);
+    }
+#endif
+
     /* Find out if a key has been released */
     diff = btn ^ lastbtn;
     if(diff && (btn & diff) == 0)