summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-02-22 20:36:02 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2014-02-22 20:36:02 +0100
commita750b733521c7ac097bba5b9024c4bc1b82ee530 (patch)
treef5897f199990c9552deb534189e5fa76d92549e7 /firmware/target
parent8660393c9f695a329527208a740127119e236734 (diff)
zenxfi2: switch to new button driver
Change-Id: I5c5bc33d0cc08316e4d853e81a5ba4fb9c5b08d9
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
index 2e72eabdb4..bfefe2c13f 100644
--- a/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
+++ b/firmware/target/arm/imx233/creative-zenxfi2/button-zenxfi2.c
@@ -27,6 +27,15 @@
#include "usb.h"
#include "touchscreen.h"
#include "touchscreen-imx233.h"
+#include "button-imx233.h"
+
+struct imx233_button_map_t imx233_button_map[] =
+{
+ IMX233_BUTTON(POWER, GPIO(0, 11), "power", INVERTED),
+ IMX233_BUTTON(MENU, GPIO(0, 14), "menu", INVERTED),
+ IMX233_BUTTON_(JACK, GPIO(2, 7), "jack"),
+ IMX233_BUTTON_(END, END(), "")
+};
struct touch_calibration_point
{
@@ -69,19 +78,8 @@ void button_init_device(void)
imx233_touchscreen_init();
imx233_touchscreen_enable(true);
-
- /* power button */
- imx233_pinctrl_acquire(0, 11, "power");
- imx233_pinctrl_set_function(0, 11, PINCTRL_FUNCTION_GPIO);
- imx233_pinctrl_enable_gpio(0, 11, false);
- /* select button */
- imx233_pinctrl_acquire(0, 14, "select");
- imx233_pinctrl_set_function(0, 14, PINCTRL_FUNCTION_GPIO);
- imx233_pinctrl_enable_gpio(0, 14, false);
- /* jack detect */
- imx233_pinctrl_acquire(2, 7, "jack_detect");
- imx233_pinctrl_set_function(2, 7, PINCTRL_FUNCTION_GPIO);
- imx233_pinctrl_enable_gpio(2, 7, false);
+ /* generic */
+ imx233_button_init();
}
static int touch_to_pixels(int *val_x, int *val_y)
@@ -123,19 +121,7 @@ static int touchscreen_read_device(int *data)
return touchscreen_to_pixels(x, y, data);
}
-bool headphones_inserted(void)
-{
- return imx233_pinctrl_get_gpio(2, 7);
-}
-
int button_read_device(int *data)
{
- int res = 0;
- /* B0P11: #power
- * B0P14: #select */
- if(!imx233_pinctrl_get_gpio(0, 11))
- res |= BUTTON_POWER;
- if(!imx233_pinctrl_get_gpio(0, 14))
- res |= BUTTON_MENU;
- return res | touchscreen_read_device(data);
+ return imx233_button_read(touchscreen_read_device(data));
}