summaryrefslogtreecommitdiff
path: root/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2008-12-19 11:13:58 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2008-12-19 11:13:58 +0000
commit40ec54305250e9a4a5e54a293abb974121d4a110 (patch)
tree7b96a79ea493ea18432eb73efa3c1954e6699b5f /firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
parent9bf93ba0075adf2b9e3291497e06918634d39880 (diff)
* Add support for Onda VX747+ (FS#9674 by Olivier Barbut)
* Fix Onda VX767 support * Small cleanup git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19481 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c')
-rwxr-xr-x[-rw-r--r--]firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
index 2624eb3d82..1aa98819fe 100644..100755
--- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
@@ -27,11 +27,22 @@
#include "powermgmt.h"
#include "kernel.h"
+#ifdef ONDA_VX747
#define BTN_OFF (1 << 29)
#define BTN_VOL_DOWN (1 << 27)
#define BTN_HOLD (1 << 16)
#define BTN_MENU (1 << 1)
#define BTN_VOL_UP (1 << 0)
+#elif defined(ONDA_VX747P)
+#define BTN_OFF (1 << 29)
+#define BTN_VOL_DOWN (1 << 27)
+#define BTN_HOLD (1 << 22) /* on REG_GPIO_PXPIN(2) */
+#define BTN_MENU (1 << 20)
+#define BTN_VOL_UP (1 << 19)
+#else
+#error No buttons defined!
+#endif
+
#define BTN_MASK (BTN_OFF | BTN_VOL_DOWN | \
BTN_MENU | BTN_VOL_UP)
@@ -130,11 +141,19 @@ void button_init_device(void)
REG_SADC_CTRL = (~(SADC_CTRL_PENDM | SADC_CTRL_PENUM | SADC_CTRL_TSRDYM | SADC_CTRL_PBATRDYM));
REG_SADC_ENA = (SADC_ENA_TSEN | SADC_ENA_PBATEN);
+#ifdef ONDA_VX747
__gpio_as_input(32*3 + 29);
__gpio_as_input(32*3 + 27);
__gpio_as_input(32*3 + 16);
__gpio_as_input(32*3 + 1);
__gpio_as_input(32*3 + 0);
+#elif defined(ONDA_VX747P)
+ __gpio_as_input(32*3 + 29);
+ __gpio_as_input(32*3 + 27);
+ __gpio_as_input(32*3 + 20);
+ __gpio_as_input(32*3 + 19);
+ __gpio_as_input(32*2 + 22);
+#endif
mutex_init(&battery_mtx);
}
@@ -173,7 +192,13 @@ int button_read_device(int *data)
int ret = 0, tmp;
/* Filter button events out if HOLD button is pressed at firmware/ level */
- if((~REG_GPIO_PXPIN(3)) & BTN_HOLD)
+ if(
+#ifdef ONDA_VX747
+ (~REG_GPIO_PXPIN(3)) & BTN_HOLD
+#elif defined(ONDA_VX747P)
+ (~REG_GPIO_PXPIN(2)) & BTN_HOLD
+#endif
+ )
return 0;
tmp = (~REG_GPIO_PXPIN(3)) & BTN_MASK;