summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/sony-nwz
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-02-22 20:34:39 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2014-02-22 20:34:39 +0100
commit8660393c9f695a329527208a740127119e236734 (patch)
tree23b866a6bd09807391cd2ca3496d5bd566e4d8f9 /firmware/target/arm/imx233/sony-nwz
parenta2bfbe9ebc9797894507e1a11bdcc372e4379509 (diff)
downloadrockbox-8660393c9f695a329527208a740127119e236734.tar.gz
rockbox-8660393c9f695a329527208a740127119e236734.tar.bz2
rockbox-8660393c9f695a329527208a740127119e236734.zip
nwz{e360,e370}: switch to new button driver
Change-Id: Iad08653f6cdbcfd75d3130186f91ed0b49a04ac9
Diffstat (limited to 'firmware/target/arm/imx233/sony-nwz')
-rw-r--r--firmware/target/arm/imx233/sony-nwz/button-nwz.c45
-rw-r--r--firmware/target/arm/imx233/sony-nwz/button-target.h8
2 files changed, 21 insertions, 32 deletions
diff --git a/firmware/target/arm/imx233/sony-nwz/button-nwz.c b/firmware/target/arm/imx233/sony-nwz/button-nwz.c
index 93520133e8..a1110af6b8 100644
--- a/firmware/target/arm/imx233/sony-nwz/button-nwz.c
+++ b/firmware/target/arm/imx233/sony-nwz/button-nwz.c
@@ -25,40 +25,37 @@
#include "power-imx233.h"
#include "string.h"
#include "usb.h"
-#include "button-lradc-imx233.h"
+#include "button-imx233.h"
-struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
+#define CHAN 0
+#define I_VDDIO 0 /* index in the table */
+
+struct imx233_button_map_t imx233_button_map[] =
{
+ [I_VDDIO] = IMX233_BUTTON_(VDDIO, VDDIO(3630), "vddio"), /* we need VDDIO for relative */
#ifdef SONY_NWZE360
- {195, BUTTON_VOL_DOWN},
- {810, BUTTON_VOL_UP},
+ IMX233_BUTTON(VOL_DOWN, LRADC_REL(CHAN, 180, I_VDDIO), "vol_down"),
+ IMX233_BUTTON(VOL_UP, LRADC_REL(CHAN, 830, I_VDDIO), "vol_up"),
+#endif
+ IMX233_BUTTON(BACK, LRADC_REL(CHAN, 1135, I_VDDIO), "back"),
+ IMX233_BUTTON(PLAY, LRADC_REL(CHAN, 1536, I_VDDIO), "play"),
+ IMX233_BUTTON(RIGHT, LRADC_REL(CHAN, 1930, I_VDDIO), "right"),
+ IMX233_BUTTON(LEFT, LRADC_REL(CHAN, 2290, I_VDDIO), "left"),
+ IMX233_BUTTON(UP, LRADC_REL(CHAN, 2655, I_VDDIO), "up"),
+ IMX233_BUTTON(DOWN, LRADC_REL(CHAN, 3020, I_VDDIO), "down"),
+ IMX233_BUTTON(POWER, PSWITCH(3), "power"),
+#ifdef HAS_BUTTON_HOLD
+ IMX233_BUTTON_(HOLD, GPIO(0, 9), "hold", INVERTED, PULLUP),
#endif
- {1095, BUTTON_BACK},
- {1470, BUTTON_PLAY},
- {1845, BUTTON_RIGHT},
- {2185, BUTTON_LEFT},
- {2525, BUTTON_UP},
- {2870, BUTTON_DOWN},
- {3400, 0},
- {0, IMX233_BUTTON_LRADC_END},
+ IMX233_BUTTON_(END, END(), "")
};
void button_init_device(void)
{
- imx233_button_lradc_init();
-}
-
-#ifdef HAS_BUTTON_HOLD
-bool button_hold(void)
-{
- return imx233_button_lradc_hold();
+ imx233_button_init();
}
-#endif
int button_read_device(void)
{
- int res = 0;
- if(BF_RD(POWER_STS, PSWITCH) == 3)
- res |= BUTTON_POWER;
- return imx233_button_lradc_read(res);
+ return imx233_button_read(0);
}
diff --git a/firmware/target/arm/imx233/sony-nwz/button-target.h b/firmware/target/arm/imx233/sony-nwz/button-target.h
index 94d480f575..41fe550935 100644
--- a/firmware/target/arm/imx233/sony-nwz/button-target.h
+++ b/firmware/target/arm/imx233/sony-nwz/button-target.h
@@ -29,17 +29,9 @@ int button_read_device(void);
bool button_debug_screen(void);
#ifdef SONY_NWZE360
-// Sony NWZ-E360 has hold detect on B0P09, inverted using pullup
#define HAS_BUTTON_HOLD
-#define IMX233_BUTTON_LRADC_HOLD_DET BLH_GPIO
-#define BLH_GPIO_BANK 0
-#define BLH_GPIO_PIN 9
-#define BLH_GPIO_INVERTED
-#define BLH_GPIO_PULLUP
#endif
-#define IMX233_BUTTON_LRADC_CHANNEL 0
-
/* Main unit's buttons */
#define BUTTON_POWER 0x00000001
#define BUTTON_BACK 0x00000002