diff options
Diffstat (limited to 'firmware/target/arm/imx233/sansa-fuzeplus')
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c | 19 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/button-target.h | 1 |
2 files changed, 18 insertions, 2 deletions
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c index 7f37d67d43..4882f243aa 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c | |||
@@ -19,6 +19,9 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "button-target.h" | 21 | #include "button-target.h" |
22 | #include "system.h" | ||
23 | #include "system-target.h" | ||
24 | #include "pinctrl-imx233.h" | ||
22 | 25 | ||
23 | void button_init_device(void) | 26 | void button_init_device(void) |
24 | { | 27 | { |
@@ -26,5 +29,19 @@ void button_init_device(void) | |||
26 | 29 | ||
27 | int button_read_device(void) | 30 | int button_read_device(void) |
28 | { | 31 | { |
29 | return 0; | 32 | int res = 0; |
33 | if(!imx233_get_gpio_input_mask(1, 0x40000000)) | ||
34 | res |= BUTTON_VOL_DOWN; | ||
35 | /* The imx233 uses the voltage on the PSWITCH pin to detect power up/down | ||
36 | * events as well as recovery mode. Since the power button is the power button | ||
37 | * and the volume up button is recovery, it is not possible to know whether | ||
38 | * power button is down when volume up is down (except if there is another | ||
39 | * method but volume up and power don't seem to be wired to GPIO pins). */ | ||
40 | switch((HW_POWER_STS & HW_POWER_STS__PSWITCH_BM) >> HW_POWER_STS__PSWITCH_BP) | ||
41 | { | ||
42 | case 1: res |= BUTTON_POWER; break; | ||
43 | case 3: res |= BUTTON_VOL_UP; break; | ||
44 | default: break; | ||
45 | } | ||
46 | return res; | ||
30 | } | 47 | } |
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h b/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h index b5d27bb176..81bbc34511 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h +++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h | |||
@@ -29,7 +29,6 @@ int button_read_device(void); | |||
29 | 29 | ||
30 | /* Main unit's buttons */ | 30 | /* Main unit's buttons */ |
31 | #define BUTTON_POWER 0x00000001 | 31 | #define BUTTON_POWER 0x00000001 |
32 | |||
33 | #define BUTTON_VOL_UP 0x00000002 | 32 | #define BUTTON_VOL_UP 0x00000002 |
34 | #define BUTTON_VOL_DOWN 0x00000004 | 33 | #define BUTTON_VOL_DOWN 0x00000004 |
35 | 34 | ||